* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color: transparent; }
html { color-scheme: dark; }
body {
  background: #0c0c0d;
  color: #f2efe9;
  font-family: 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ===== Header ===== */
.header { text-align: center; padding: 34px 20px 20px; }
.lockicon { width: 46px; height: 46px; margin: 0 auto 8px; }
.brandname { font-size: 30px; font-weight: 900; letter-spacing: 5px; direction: ltr; }
.brandname .o { color: #f97316; }
.brandar { font-size: 17px; font-weight: 700; color: #f97316; margin-top: 2px; }
.tagline { font-size: 12.5px; color: #a39d93; margin-top: 7px; }

/* ===== Top bar (inner pages) ===== */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid #222226;
  position: sticky; top: 0; background: #0c0c0d; z-index: 5;
}
.back {
  width: 38px; height: 38px; border-radius: 50%;
  background: #1a1a1d; border: 1px solid #2a2a2f;
  color: #f2efe9; font-size: 18px; line-height: 1;
}
.topbar .title { font-size: 19px; font-weight: 900; }
.topbar .sub { font-size: 12px; color: #a39d93; margin-top: 2px; }
.szbadge {
  margin-right: auto;
  background: linear-gradient(145deg, #f97316, #c2410c);
  color: #141414; font-weight: 900; font-size: 15px;
  border-radius: 10px; padding: 6px 12px; direction: ltr;
}
.szbadge:empty { display: none; }

/* ===== Home rows ===== */
.rows { padding: 6px 16px 0; max-width: 560px; margin: 0 auto; }
.grouplabel { font-size: 12.5px; color: #8f897f; font-weight: 700; padding: 16px 8px 8px; }
.row {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: right;
  background: #1a1a1d;
  border: 1px solid #2a2a2f;
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 12px;
  color: inherit;
}
.row:active { background: #202024; }
.thumb {
  flex: 0 0 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #f97316, #c2410c);
  color: #141414; font-size: 18px; font-weight: 900; direction: ltr;
}
.thumb.gray { background: linear-gradient(145deg, #3a3a40, #232326); }
.thumb svg { width: 26px; height: 26px; }
.rtext .t1 { font-size: 16.5px; font-weight: 800; }
.rtext .t2 { font-size: 12px; color: #a39d93; margin-top: 3px; }
.chev { margin-right: auto; color: #7d776d; font-size: 17px; }

.note {
  margin: 18px 16px 0;
  font-size: 12px; color: #8f897f; text-align: center; line-height: 1.8;
}

/* ===== Piece cards ===== */
.cards { padding: 14px 16px 0; max-width: 560px; margin: 0 auto; }
.card {
  display: flex; gap: 14px;
  background: #1a1a1d;
  border: 1px solid #2a2a2f;
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
  align-items: center;
}
.card.is-taken { opacity: .55; }
.pimg {
  flex: 0 0 84px; height: 84px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(145deg, #26262b, #17171a);
  display: flex; align-items: center; justify-content: center;
}
.pimg img { width: 100%; height: 100%; object-fit: cover; }
.pimg svg { width: 38px; height: 38px; opacity: .85; }
.pinfo { flex: 1; min-width: 0; }
.pname { font-size: 15px; font-weight: 800; line-height: 1.5; }
.pmeta { font-size: 12px; color: #a39d93; margin-top: 3px; }
.price { font-size: 15px; font-weight: 900; color: #f97316; margin-top: 5px; }
.statuschip { display: inline-block; font-size: 11.5px; font-weight: 800; border-radius: 8px; padding: 4px 10px; margin-top: 6px; }
.statuschip.reserved { background: #3a2f10; color: #e8b877; }
.statuschip.sold { background: #3a1418; color: #f0888f; }
.addbtn {
  flex: 0 0 auto;
  background: none; border: 1.5px solid #f97316; border-radius: 10px;
  color: #f97316; font-size: 12.5px; font-weight: 800;
  padding: 9px 14px;
}
.addbtn.added { background: #14532d; border-color: #14532d; color: #7ee2a8; }

/* ===== Empty state ===== */
.empty {
  text-align: center; padding: 60px 24px 40px;
  max-width: 560px; margin: 0 auto;
}
.empty svg { width: 56px; height: 56px; opacity: .9; }
.empty h3 { font-size: 17px; font-weight: 800; margin-top: 14px; }
.empty p { font-size: 13px; color: #a39d93; margin-top: 8px; line-height: 1.9; }

/* ===== Sticky list bar ===== */
.stickybar {
  position: fixed; bottom: 0; right: 0; left: 0;
  background: #17171a;
  border-top: 1px solid #2e2e33;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px;
  z-index: 10;
}
.stickybar .info {
  background: none; border: none; color: #b8b2a8;
  font-size: 12.5px; line-height: 1.5; text-align: right;
  display: flex; flex-direction: column;
}
.stickybar .info b { color: #f2efe9; font-size: 13.5px; }
.stickybar .book {
  margin-right: auto;
  background: #f97316; color: #141414;
  font-size: 15px; font-weight: 900;
  border: none; border-radius: 12px;
  padding: 13px 20px;
}
.book.wide { width: 100%; margin: 0; border-radius: 12px; padding: 14px; font-size: 15px; font-weight: 900; background: #f97316; color: #141414; border: none; }

/* ===== List sheet ===== */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 19;
}
.sheet {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 20;
  background: #17171a;
  border-radius: 20px 20px 0 0;
  border-top: 1px solid #2e2e33;
  max-height: 75vh; overflow-y: auto;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
}
.sheet-head { display: flex; align-items: center; margin-bottom: 8px; }
.sheet-head h2 { font-size: 17px; font-weight: 900; }
.sheet-close {
  margin-right: auto; background: #232326; border: none; color: #b8b2a8;
  width: 34px; height: 34px; border-radius: 50%; font-size: 14px;
}
.sheet-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 4px; border-bottom: 1px solid #242428;
}
.sheet-item .n { font-size: 14px; font-weight: 700; flex: 1; }
.sheet-item .p { font-size: 13.5px; font-weight: 800; color: #f97316; }
.sheet-item .rm { background: none; border: none; color: #8f897f; font-size: 15px; padding: 6px; }
.sheet-empty { text-align: center; color: #a39d93; font-size: 13.5px; padding: 26px 0; }
.sheet-foot { padding-top: 14px; }
.sheet-total { font-size: 14.5px; font-weight: 900; margin-bottom: 12px; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 110px; right: 50%; transform: translateX(50%);
  background: #26262b; color: #f2efe9;
  border: 1px solid #3a3a40;
  border-radius: 12px; padding: 12px 18px;
  font-size: 13px; font-weight: 700; z-index: 30;
  max-width: 86vw; text-align: center; line-height: 1.7;
}

/* ===== Piece page ===== */
.pdetail { max-width: 560px; margin: 0 auto; }
.gallery { position: relative; margin-top: 4px; }
.gslides {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.gslides::-webkit-scrollbar { display: none; }
.gslide {
  flex: 0 0 100%; scroll-snap-align: center;
  aspect-ratio: 1 / 1.1;
  background: linear-gradient(145deg, #1d1d21, #131316);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
  user-select: none; -webkit-user-select: none;
}
.gslide img { width: 100%; height: 100%; object-fit: contain; }
.gslide video { width: 100%; height: 100%; object-fit: contain; }
.gslide.noimg svg { width: 84px; height: 84px; opacity: .8; }
.gslide.spin { cursor: grab; touch-action: pan-y; }
.gslide.spin:active { cursor: grabbing; }
.spinhint {
  position: absolute; bottom: 12px; right: 50%; transform: translateX(50%);
  background: rgba(12,12,13,.72); border: 1px solid #3a3a40;
  color: #e8b877; font-size: 11.5px; font-weight: 700;
  border-radius: 999px; padding: 6px 14px; white-space: nowrap;
  pointer-events: none;
}
.gcount {
  position: absolute; top: 12px; left: 12px;
  background: rgba(12,12,13,.72); border: 1px solid #3a3a40;
  color: #f2efe9; font-size: 12px; font-weight: 800;
  border-radius: 999px; padding: 5px 12px;
}
.gdots {
  position: absolute; bottom: 12px; left: 12px;
  display: flex; gap: 6px;
}
.gdot { width: 7px; height: 7px; border-radius: 50%; background: #4a4a50; }
.gdot.on { background: #f97316; }
.pbody { padding: 16px 16px 0; }
.pname.big { font-size: 19px; font-weight: 900; line-height: 1.6; }
.price.big { font-size: 22px; margin-top: 8px; }
.pdesc { font-size: 13.5px; color: #c9c3b9; line-height: 1.9; margin-top: 12px; }
.paction { margin-top: 16px; }
.addbtn.big { width: 100%; padding: 15px; font-size: 15.5px; border-radius: 14px; }
.statuschip.big { font-size: 14.5px; padding: 12px 18px; width: 100%; text-align: center; }
.zoomhint { font-size: 11.5px; color: #8f897f; text-align: center; margin-top: 10px; }
.card[data-piece] { cursor: pointer; }

/* ===== Lightbox ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(6,6,7,.96);
  display: flex; align-items: center; justify-content: center;
}
.lb-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; touch-action: none;
}
.lb-stage img {
  max-width: 100vw; max-height: 100vh; object-fit: contain;
  transition: transform .18s ease;
  user-select: none; -webkit-user-select: none;
}
.lb-stage img.zoomed { cursor: grab; transition: none; }
.lb-close {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 14px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(26,26,29,.85); border: 1px solid #3a3a40;
  color: #f2efe9; font-size: 16px;
}
.lb-count {
  position: absolute; top: calc(22px + env(safe-area-inset-top)); right: 16px; z-index: 2;
  color: #c9c3b9; font-size: 13px; font-weight: 800;
  background: rgba(26,26,29,.85); border: 1px solid #3a3a40;
  border-radius: 999px; padding: 6px 14px;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(26,26,29,.85); border: 1px solid #3a3a40;
  color: #f2efe9; font-size: 20px; line-height: 1;
}
.lb-nav.prev { right: 12px; }
.lb-nav.next { left: 12px; }
