/* ===========================================================================
   TAGz — Customer App stylesheet (design tokens from Theme/System Core)
   ========================================================================= */
:root {
  color-scheme: light;
  --brand-primary: #E63946;
  --brand-primary-text: #ffffff;
  --brand-secondary: #1D3557;
  --primary-soft: #fde8ea;
  --bg: #f7f7f9;
  --surface: #ffffff;
  --surface2: #f1f1f3;
  --text: #111111;
  --text2: #555555;
  --border: #e5e5ea;
  --radius: 16px;
  --app-font: 'Inter', system-ui, sans-serif;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212;
  --surface: #1e1e1e;
  --surface2: #2a2a2a;
  --text: #ffffff;
  --text2: #b3b3b3;
  --border: #383838;
  --primary-soft: rgba(255,255,255,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--app-font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  max-width: 520px;
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
  transition: background .3s, color .3s;
}
.hidden { display: none !important; }

/* ---------- boot screen (business icon + smooth shake + typewriter credit) ---------- */
#boot {
  position: fixed; inset: 0; z-index: 500;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 24px; text-align: center;
  background: var(--bg, #0d1117);
  transition: opacity .4s ease, visibility .4s ease;
}
#boot.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot-icon-wrap {
  position: relative;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#boot-icon {
  max-width: 190px;
  max-height: 170px;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: 50% 50%;
  animation: smoothIconShake 2.6s ease-in-out infinite;
  filter: drop-shadow(0 6px 20px rgba(0,0,0,0.35));
}
@keyframes smoothIconShake {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  18% { transform: translateY(-3px) rotate(-1.5deg) scale(1.02); }
  36% { transform: translateY(0) rotate(1.2deg) scale(1.02); }
  54% { transform: translateY(-2px) rotate(-0.8deg) scale(1.01); }
  72% { transform: translateY(0) rotate(0.6deg) scale(1); }
  88% { transform: translateY(-1px) rotate(0deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  #boot-icon { animation: none; }
}
.boot-credit-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
}
.boot-typewriter {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text2, #94a3b8);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.typewriter-cursor {
  font-size: 14px;
  font-weight: 400;
  color: var(--brand-primary, #E63946);
  margin-inline-start: 2px;
  animation: blinkCursor 0.8s infinite;
}
@keyframes blinkCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.boot-spin {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--brand-primary, #E63946);
  animation: bootSpin 0.9s linear infinite;
}
@keyframes bootSpin { to { transform: rotate(360deg); } }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
}
.tb-side { display: flex; align-items: center; gap: 8px; }
#hd-logo { height: 48px; width: auto; }
#hd-slag { font-size: 12px; color: var(--text2); }
.icon-btn {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); width: 36px; height: 36px; border-radius: 50%;
  font-size: 17px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.icon-btn svg, .loc-pin svg { width: 20px; height: 20px; }
.sw-icon svg { width: 15px; height: 15px; }
.tab i svg { width: 22px; height: 22px; }
.icon-btn.on {
  background: var(--brand-primary, #E63946); border-color: var(--brand-primary, #E63946);
  color: var(--brand-primary-text, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary, #E63946) 25%, transparent);
}
.loc-pin {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 17px; text-decoration: none;
  cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.loc-pin svg { width: 20px; height: 20px; stroke: currentColor; fill: none; }
.loc-addr { font-size: 12px; color: var(--text2); }

/* ---------- lang popup ---------- */
.lang-pop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); display: grid; place-items: end center; }
.lang-pop-card { width: 100%; max-width: 520px; background: var(--surface); border-radius: 18px 18px 0 0; padding: 18px; }
.lang-pop-card h4 { margin-bottom: 12px; }
#lang-picker { display: grid; gap: 8px; }
.lang-opt { padding: 12px; border: 1px solid var(--border); background: var(--surface2); border-radius: 10px; cursor: pointer; text-align: center; }
.lang-opt.on { border-color: var(--brand-primary); color: var(--brand-primary); font-weight: 700; }

/* ---------- main ---------- */
/* Bottom clearance above the fixed tabbar lives HERE (single source of
   truth — do NOT add another .app-main padding rule; the later one wins).
   150px lets the last menu row scroll fully clear with visible breathing
   room above the footer on every view. */
.app-main { padding: 12px 14px calc(150px + env(safe-area-inset-bottom, 0px)); }
.view { animation: fadein .25s; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px);} to {opacity:1; transform:none;} }
.sec { font-size: 13px; font-weight: 700; color: var(--text2); margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .4px; }
.vtitle { font-size: 20px; margin: 6px 0 12px; }

/* delivery row */
.deliv-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.dv-label { font-size: 12px; color: var(--text2); white-space: nowrap; }
.dv-row, .prow { display: flex; gap: 10px; flex-wrap: wrap; }
/* About-page delivery icons: tidy uniform grid, never spread edge-to-edge */
#about-delivery { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
#about-delivery .dv { width: 100%; height: auto; aspect-ratio: 1; }
.dv { width: 56px; height: 56px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; text-decoration: none; position: relative; overflow: visible; }
.dv img { width: 100%; height: 100%; object-fit: contain; padding: 8px; box-sizing: border-box; display: block; border-radius: 10px; }

/* Delivery platform offer tag / badge */
.dp-tag {
  position: absolute;
  top: -7px;
  right: -7px;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dp-tag-text {
  background: var(--brand-primary, #E63946);
  color: var(--brand-primary-text, #ffffff);
  font-size: 8.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  line-height: 1.2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  border: 1.5px solid var(--surface);
  text-transform: uppercase;
  white-space: nowrap;
  max-width: 65px;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}
.dp-tag-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
}
[dir="rtl"] .dp-tag {
  right: auto;
  left: -7px;
}

/* banners */
.banners { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0 12px; scroll-snap-type: x mandatory; }
.b-card { min-width: 250px; scroll-snap-align: start; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.b-card img { width: 100%; height: 117px; object-fit: cover; display: block; }
/* ---- offer banner: reference card (full-bleed bg, left text overlay, floating) ----
   Round 10: card shrunk 10% (292 -> 263) with the offer image still shown
   whole & uncropped (contain) so the text overlay stays readable. */
.banners .b-card.obanner {
  position: relative;
  min-height: 263px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: none;
}
.banners .b-card.obanner > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain; display: block;
}
.banners .b-card.obanner .b-text {
  position: absolute; inset-inline-start: 0; bottom: 0;
  max-width: 78%;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 16px;
  text-align: start;
  color: #fff;
  /* transparent container + readable text: shadow only, no scrim band */
  text-shadow: 0 2px 14px rgba(0,0,0,.65), 0 1px 3px rgba(0,0,0,.8);
}
.banners .b-card.obanner .b-text .eyebrow { color: #ffd9dd; text-shadow: 0 1px 8px rgba(0,0,0,.7); }
.banners .b-card.obanner .b-text h3 {
  color: #fff; font-size: clamp(17px, 4.9vw, 22px); font-weight: 800; margin: 5px 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.banners .b-card.obanner .b-text p {
  color: rgba(255,255,255,.92); font-size: clamp(11px, 3.2vw, 13px);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
[data-theme="dark"] .banners .b-card.obanner { box-shadow: none; }
/* RTL: carousel track is forced LTR for swipe math, so mirror explicitly */
[dir="rtl"] .banners .b-card.obanner .b-text {
  inset-inline-start: auto; inset-inline-end: 0;
  left: auto; right: 0; text-align: right;
}
.b-card .b-body h3 { color: #fff; }
.b-card .b-body p { color: rgba(255,255,255,.88); }
.b-card .b-body .eyebrow { color: #ffd9dd; }
[data-theme="dark"] .b-card .b-body { background: rgba(15, 15, 20, 0.3); }
.eyebrow { color: var(--brand-primary); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.b-card h3 { font-size: clamp(14px, 4vw, 17px); margin: 4px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.b-card p { font-size: clamp(11px, 3.4vw, 13px); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* ---- skeleton loading (replaces blank paint while data loads) ---- */
.sk { position: relative; overflow: hidden; background: var(--surface2); }
.sk::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: skShimmer 1.2s infinite;
}
[dir="rtl"] .sk::after { animation-direction: reverse; }
@keyframes skShimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .sk::after { animation: none; } }
.sk-banner { height: 263px; border-radius: var(--radius-lg); margin-bottom: 12px; }
.sk-chips { display: flex; gap: 8px; margin-bottom: 12px; }
.sk-chips i { width: 84px; height: 34px; border-radius: 20px; }
.sk-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.sk-grid i { height: 190px; border-radius: var(--radius); display: block; }
/* Offers auto-scrolling carousel (Phase 5 / P6) */
.banners .ocar { width: 100%; overflow: hidden; }
.banners .ocar-track { display: flex; transition: transform .45s cubic-bezier(.4,0,.2,1); touch-action: pan-y; }
.banners .ocar-slide { min-width: 100%; flex: 0 0 100%; scroll-snap-align: start; }
.banners .ocar-slide img { width: 100%; height: 126px; object-fit: cover; }
.ocar-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 8px; }
.ocar-arr { background: var(--surface); border: 1px solid var(--border); color: var(--text); width: 30px; height: 30px; border-radius: 50%; font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.ocar-dots { display: flex; gap: 6px; }
.ocar-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); cursor: pointer; transition: width .2s, background .2s; }
.ocar-dot.on { width: 18px; border-radius: 4px; background: var(--brand-primary); }
@media (prefers-reduced-motion: reduce) {
  .banners .ocar-track { transition: none; }
  .banners .ocar-nav, .banners .ocar-arr { display: none; }
  .banners .ocar-slide { min-width: 260px; flex: 0 0 260px; }
  .banners .ocar { overflow-x: auto; }
}

/* category rail — 3 switchable views: chip (default) / circle / rectangular */
.cat-rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 10px 4px 14px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: all 0.2s ease;
}
.cat-chip img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--surface2);
  flex-shrink: 0;
}
.cat-chip span {
  display: inline-block;
  white-space: nowrap;
  line-height: 1.25;
}
.cat-chip.on {
  background: var(--brand-primary);
  color: var(--brand-primary-text, #fff);
  border-color: var(--brand-primary);
  box-shadow: 0 4px 12px rgba(230,57,70,0.28);
}
/* circle view: round image, label below, accent ring on active */
.cat-rail.cv-circle { gap: 18px; padding: 12px 4px 16px; }
.cat-rail.cv-circle .cat-chip { flex-direction: column; gap: 8px; padding: 0; border: none; background: none; font-size: 12.5px; min-width: 72px; box-shadow: none; }
.cat-rail.cv-circle .cat-chip img { width: 64px; height: 64px; border-radius: 50%; border: 2px solid transparent; }
.cat-rail.cv-circle .cat-chip.on { background: none; color: var(--text); border: none; box-shadow: none; }
.cat-rail.cv-circle .cat-chip.on img { border-color: var(--cat-accent, var(--brand-primary)); box-shadow: 0 0 0 2.5px var(--cat-accent, var(--brand-primary)); }
.cat-rail.cv-circle .cat-chip.on span { color: var(--cat-accent, var(--brand-primary)); font-weight: 700; }
/* rectangular view: image card with label under */
.cat-rail.cv-rect { gap: 14px; }
.cat-rail.cv-rect .cat-chip { flex-direction: column; gap: 0; padding: 0; border-radius: 16px; overflow: hidden; min-width: 98px; font-size: 12.5px; box-shadow: none; }
.cat-rail.cv-rect .cat-chip img { width: 98px; height: 68px; border-radius: 0; object-fit: contain; background: var(--surface2); }
.cat-rail.cv-rect .cat-chip span { padding: 8px 10px; }
.cat-rail.cv-rect .cat-chip.on { background: var(--surface); color: var(--text); border-color: var(--cat-accent, var(--brand-primary)); box-shadow: 0 0 0 2px var(--cat-accent, var(--brand-primary)); }

/* product grid */
.prods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; position: relative; }
.prods.list { display: block; }
.prods.list .pcard { display: flex; flex-direction: row; align-items: stretch; gap: 0; margin-bottom: 12px; }
.prods.list .pcard-img-wrap { width: 120px; flex: none; position: relative; }
.prods.list .pcard-img-wrap img { width: 120px; height: 100%; min-height: 110px; object-fit: contain; }
.prods.list .pinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.prods.list .inb { top: auto; bottom: 50px; right: 15px; left: auto; }
[dir="rtl"] .prods.list .inb, html[dir="rtl"] .prods.list .inb { right: auto; left: 15px; }

/* ---- view mode toggle ---- */
.viewmode-bar { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 8px; }
.vm-title { font-size: 12px; color: var(--text2); font-weight: 600; }
.vm-toggle { display: flex; border: 1px solid var(--border); border-radius: 20px; overflow: hidden; }
.vm-toggle .vm-btn { border: none; background: var(--surface); padding: 5px 14px; font-size: 12px; cursor: pointer; color: var(--text2); }
.vm-toggle .vm-btn.on { background: var(--brand-primary); color: var(--brand-primary-text, #fff); }
.vm-sort { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 20px; padding: 5px 8px; font-size: 12px; max-width: 148px; cursor: pointer; }
.vm-shuffle, .vm-catview { border: 1px solid var(--border); background: var(--surface); border-radius: 20px; padding: 5px 10px; font-size: 12px; cursor: pointer; color: var(--text); }
.pcard { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; cursor: pointer; position: relative; display: flex; flex-direction: column; }
/* Locked ~75% photo / ~25% info split — identical on every card.
   The photo box is aspect-ratio sized (never collapsible), the info panel is
   a fixed compact block with ellipsis, so rows can never collapse to strips. */
.pcard-img-wrap { position: relative; flex: none; aspect-ratio: 1 / 1; min-height: 0; }
.pcard-img-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; background: var(--surface2); }
/* item-discount corner ribbon: inline-start = upper-left in EN, upper-right in AR */
.pdisc { position: absolute; top: 8px; inset-inline-start: 8px; z-index: 2; font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: 20px; color: #fff; background: color-mix(in srgb, #E63946 80%, transparent); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.pbadge { position: absolute; top: 8px; left: 8px; z-index: 2; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; color: #fff; background: color-mix(in srgb, #E63946 80%, transparent); }
.ps-head .pbadge { position: static; display: inline-block; vertical-align: middle; margin-inline-start: 6px; }
.pbadge.b-bestseller { background: color-mix(in srgb, #E63946 80%, transparent); }
.pbadge.b-sale { background: color-mix(in srgb, #1E8A4C 80%, transparent); top: 32px; }
.pbadge.b-recommended { background: color-mix(in srgb, #F4A261 80%, transparent); color: #4a2c04; }
.pbadge.b-new { background: color-mix(in srgb, #2A9D8F 80%, transparent); color: #043b35; }
.was { color: var(--text2); font-weight: 400; font-size: 12px; text-decoration-thickness: 2px; }
.was-x { color: #E63946; font-weight: 800; font-size: 13px; }
.pinfo { position: relative; padding: 8px 54px 8px 10px; min-height: 96px; height: auto; flex: 1; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-start; }
.pprice .was { display: block; font-size: 11.5px; line-height: 1.15; color: var(--text2); margin-bottom: 1px; }
[dir="rtl"] .pinfo { padding: 8px 10px 8px 54px; text-align: right; }
/* Reserved tag slot: identical height with or without a tag */
.ptagrow { min-height: 20px; height: auto; flex: none; overflow: visible; margin-bottom: 4px; display: flex; align-items: center; }
[dir="rtl"] .ptagrow { justify-content: flex-start; }
.ptag { display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; line-height: 1.2; padding: 2px 8px; border-radius: 20px; color: #fff; background: color-mix(in srgb, #E63946 80%, transparent); white-space: nowrap; box-sizing: border-box; }
.ptag.b-recommended { background: color-mix(in srgb, #F4A261 80%, transparent); color: #4a2c04; }
.ptag.b-new { background: color-mix(in srgb, #2A9D8F 80%, transparent); color: #043b35; }
.pname { font-weight: 600; font-size: 13px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; margin-bottom: 2px; }
.prating { color: #f5a623; font-size: 11px; margin: 1px 0; }
.prow { display: flex; align-items: center; gap: 8px; margin-top: 1px; min-width: 0; flex: none; }
.pprice { color: var(--brand-primary); font-weight: 700; font-size: 14px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Quick-add: pinned to the info panel's lower corner (auto-mirrors RTL) */
.padd { position: absolute; inset-inline-end: 8px; bottom: 8px; width: 38px; height: 38px; border-radius: 12px; border: none; background: #1E8A4C; color: #fff; font-size: 22px; font-weight: 800; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.padd:active { transform: scale(.93); }
/* Cart quantity badge: positioned directly above the + button on the opposite side of the product name in all languages */
.inb {
  position: absolute;
  bottom: 50px;
  right: 15px;
  left: auto;
  top: auto;
  background: var(--brand-primary, #E63946);
  color: var(--brand-primary-text, #fff);
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  z-index: 5;
  pointer-events: none;
}
[dir="rtl"] .inb, html[dir="rtl"] .inb {
  right: auto;
  left: 15px;
}
/* list view: side photo stays prominent, discount corner sits opposite the image */
.prods.list .pcard-img-wrap { width: 120px; }
.prods.list .pcard-img-wrap img { width: 120px; height: 100%; min-height: 110px; }
.prods.list .pdisc { inset-inline-start: auto; inset-inline-end: 8px; }
/* cart: available discount-code chips (tap to copy + apply) */
.code-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 2px; }
.code-chip { border: 1px dashed var(--brand-primary); background: var(--primary-soft); color: var(--text); border-radius: 12px; padding: 5px 10px; font-size: 12px; font-weight: 700; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-chip b { color: var(--brand-primary); }
#promo-apply { background: var(--brand-primary); color: var(--brand-primary-text, #fff); border: none; border-radius: 10px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
.code-cap { font-size: 11px; color: var(--text2); margin-top: 6px; }

/* search */
.searchbox { position: sticky; top: 56px; z-index: 5; padding: 6px 0; }
.searchbox input { width: 100%; padding: 12px 14px; border-radius: 24px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px; }
.search-hint, .empty { text-align: center; color: var(--text2); padding: 30px 0; font-size: 14px; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 70; display: grid; align-items: end; }
.sheet-mask { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.sheet-card { position: relative; width: 100%; max-width: 520px; margin: 0 auto; background: var(--surface); border-radius: 20px 20px 0 0; padding: 16px; max-height: 88vh; overflow: auto; animation: sheetup .3s; }
@keyframes sheetup { from { transform: translateY(40px); opacity: 0;} to { transform:none; opacity:1;} }
.sheet:not(.show) { display: none; }
.sheet-x { position: absolute; top: 10px; right: 14px; background: var(--surface2); border: none; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; }
#ps-img { width: 100%; height: 230px; object-fit: contain; background: var(--surface2); border-radius: 14px; }
.ps-head { display: flex; justify-content: space-between; align-items: flex-start; margin-top: 12px; }
.ps-head h3 { font-size: 18px; }
.ps-rating { color: #f5a623; font-size: 13px; }
.ps-price { color: var(--brand-primary); font-weight: 800; font-size: 18px; }
#ps-desc { color: var(--text2); font-size: 13px; margin-top: 8px; }
.addon { display: flex; justify-content: space-between; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.addon b { color: var(--brand-primary); }
.ps-footer { display: flex; gap: 10px; align-items: center; margin-top: 14px; position: sticky; bottom: 0; background: var(--surface); padding: 8px 0; }
.qty-step { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 24px; padding: 6px 10px; color: var(--text); }
.qty-step button { border: none; background: var(--surface2); color: var(--text); width: 28px; height: 28px; border-radius: 50%; font-size: 16px; font-weight: 800; cursor: pointer; }
.qty-step span { color: var(--text); font-weight: 700; }

/* search recommendations title always spans the full grid width */
.rec-sec { grid-column: 1 / -1; }
.prods > .empty { grid-column: 1 / -1; }
/* cart */
.fulfil-toggle { display: flex; background: var(--surface2); border-radius: 24px; padding: 4px; margin-bottom: 14px; }
.fulfil-toggle.single-mode { background: var(--surface2); padding: 3px; }
.fulfil-toggle button { flex: 1; padding: 10px; border: none; background: transparent; border-radius: 20px; cursor: pointer; color: var(--text2); font-weight: 600; }
.fulfil-toggle.single-mode button { cursor: default; }
.fulfil-toggle button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
/* Delivery 2-block selector (City + Area) */
.deliv-blocks-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.deliv-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.deliv-block-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text2);
  letter-spacing: .5px;
}
.deliv-select {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color .15s ease;
}
.deliv-select:focus {
  border-color: var(--brand-primary);
}
@media (max-width: 420px) {
  .deliv-blocks-wrap {
    grid-template-columns: 1fr;
  }
}
.cart-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cl-thumb { width: 36px; height: 36px; border-radius: 10px; object-fit: contain; background: var(--surface2); flex-shrink: 0; }
.cl-name { flex: 1; font-size: 14px; font-weight: 600; }
.cl-name small { display: block; color: var(--text2); font-weight: 400; }
.cl-qty { display: flex; align-items: center; gap: 8px; }
.cq { border: 1px solid var(--border); background: var(--surface2); color: var(--text); width: 28px; height: 28px; border-radius: 8px; font-weight: 800; cursor: pointer; }
.cl-price { color: var(--brand-primary); font-weight: 700; min-width: 64px; text-align: end; }
.partner-row { margin-top: 14px; }
.order-summary { margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.os-row { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; }
.os-row.total { font-weight: 800; font-size: 16px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; }
/* Delivery offer/discount animation + percentage badge (Phase 5 / P7) */
.os-row.deliv-disc { align-items: center; }
.dd-badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 12px; background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary)); color: var(--brand-gradient-text, #fff); font-size: 11px; font-weight: 800; }
.dd-amt { color: var(--ok, #1E8A4C); font-weight: 700; }
.os-row.deliv-disc { animation: ddPop .5s cubic-bezier(.34,1.56,.64,1); }
@keyframes ddPop { 0% { transform: scale(.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .os-row.deliv-disc { animation: none; }
}
.promo { gap: 6px; }
.promo input { flex: 1; margin: 0; }
.linky { background: none; border: none; color: var(--brand-primary); cursor: pointer; font-size: 12px; }
.checkout-btns { display: grid; gap: 10px; background: transparent; border: none; margin-top: 10px; margin-bottom: 10px; }
.checkout-hint { font-size: 11px; color: var(--text2); text-align: center; margin-top: 6px; }
/* Structural end spacer: real content height (never swallowed like body
   padding can be) so max scroll always parks the last payment button fully
   above the fixed footer. */
.cart-endpad { height: 12px; } /* footer clearance now comes from .app-main (150px) on all views */
html { scroll-padding-bottom: 220px; }
.btn-checkout { background: var(--brand-primary); color: var(--brand-primary-text, #ffffff); border: none; border-radius: 26px; padding: 14px; font-size: 15px; font-weight: 700; cursor: pointer; }
.btn-checkout.wa { background: #25D366; color: #052e16; }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 26px; padding: 12px; cursor: pointer; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; }
.modal:not(.show) { display: none; }
.modal-card { position: relative; width: 90%; max-width: 380px; background: var(--surface); color: var(--text); border-radius: 18px; padding: 20px; border: 1px solid var(--border); }
.modal-card h3 { margin-bottom: 8px; color: var(--text); }
.modal-card p { color: var(--text2); font-size: 13px; margin-bottom: 12px; }
.modal-card input { width: 100%; padding: 12px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); border-radius: 12px; margin-bottom: 12px; }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; }

/* reservation (facebook-style) */
.rs-cover { position: relative; height: 180px; overflow: visible; margin-bottom: 46px; }
.rs-cover-media { width: 100%; height: 100%; border-radius: 0 0 14px 14px; overflow: hidden; position: relative; }
.rs-cover-media img, .rs-cover-media video, .rs-cover img, .rs-cover video { width: 100%; height: 100%; object-fit: cover; }
.rs-icon-wrap {
  position: absolute; bottom: -34px; left: 16px; width: 84px; height: 84px;
  border-radius: 22px; border: 3px solid var(--surface); background: var(--surface2);
  overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.2);
  display: block;
  padding: 0; z-index: 10;
}
.rs-icon-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.rs-head { margin-top: 20px; }
.rs-head h2 { font-size: 20px; color: var(--text); }
.rs-head p { color: var(--text2); font-size: 14px; }
.rs-offer, .rs-capacity { background: var(--primary-soft); color: var(--text); border: 1px solid var(--border); padding: 12px; border-radius: 12px; margin-top: 12px; font-size: 13px; }
[data-theme="dark"] .rs-offer, [data-theme="dark"] .rs-capacity { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.rs-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot { padding: 8px 14px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); cursor: pointer; }
.slot.on { background: var(--brand-primary); color: var(--brand-primary-text, #ffffff); border-color: var(--brand-primary); }
.rs-form { display: grid; gap: 10px; margin-top: 12px; }
.rs-form input, .rs-form textarea { padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 14px; }
.rs-od-text { color: var(--text2); font-size: 13px; }
.ad-banner { margin-top: 18px; }
.ad-banner img, .ad-banner video { width: 100%; border-radius: 14px; }
.vid-ctl { position: absolute; right: 10px; bottom: 10px; z-index: 3; width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff; font-size: 15px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
[dir="rtl"] .vid-ctl { right: auto; left: 10px; }

/* about */
.about-logo { width: 96px; height: 96px; object-fit: contain; margin: 10px auto; display: block; }
.about-desc { text-align: center; color: var(--text2); font-size: 14px; line-height: 1.5; padding: 0 10px; }

/* tabbar */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--border); display: flex; max-width: 520px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); border-radius: 8px 8px 0 0; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; background: none; border: none; color: var(--text2); font-size: 10px; cursor: pointer; position: relative; }
.tab i { font-style: normal; font-size: 20px; }
.tab.active { color: var(--brand-primary); }
#cart-count { position: absolute; top: 2px; margin-inline-start: 20px; background: var(--brand-primary); color: var(--brand-primary-text, #fff); font-size: 10px; font-weight: 800; line-height: 1; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 9px; display: grid; place-items: center; text-align: center; box-shadow: 0 0 0 1.5px var(--surface); }
/* continuous gentle wiggle while items are in the cart */
#cart-count.shake { animation: badgeWiggle 1.6s ease-in-out infinite; }
/* impact pulse on every added item */
#cart-count.pulse { animation: badgePop .45s cubic-bezier(.34,1.56,.64,1); }
@keyframes badgeWiggle { 0%,100% { transform: rotate(0deg); } 25% { transform: rotate(8deg); } 75% { transform: rotate(-8deg); } }
@keyframes badgePop { 0% { transform: scale(1.8); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  #cart-count.shake, #cart-count.pulse { animation: none; }
}

/* toast / after-order */
#toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 20px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 100; }
#toast.show { opacity: 1; }
.after-order { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: #23a55a; color: #06281c; padding: 12px 18px; border-radius: 14px; font-size: 14px; z-index: 95; box-shadow: 0 4px 16px rgba(0,0,0,.2); }

/* RTL */
[dir="rtl"] body { text-align: right; }
[dir="rtl"] .cl-price, [dir="rtl"] .pinfo { text-align: right; }
[dir="rtl"] .rs-icon-wrap { left: auto; right: 16px; }
[dir="rtl"] .sheet-x { right: auto; left: 14px; }

@media (max-width: 380px) {
  .prods { grid-template-columns: 1fr 1fr; }
}

/* =========================================================================
   Phase 3.5 — App background (admin-managed)
   Body mode switch is driven by applyAppBackground(): only ONE appbg-* class
   is ever present (color | image | neither=transparent), matching the single
   linked color-picker/upload design from the dashboard.
   ========================================================================= */
body.appbg-color { background: var(--app-bg-color, transparent); }
body.appbg-image {
  background-image: var(--app-bg-image, none);
  background-size: cover; background-position: center;
  background-repeat: no-repeat;
}
/* Full-viewport portrait fill (1080×1920): html covers edge-to-edge,
   body stays transparent so the image shows through the whole phone. */
html.appbg-color { background: var(--app-bg-color, transparent); }
html.appbg-image {
  background-image: var(--app-bg-image, none);
  background-size: cover; background-position: center top;
  background-repeat: no-repeat; min-height: 100%;
}
html.appbg-color body, html.appbg-image body { background-color: transparent; }

/* ---- Flood mode: custom background flows through the whole app ----
   Active only when the admin picks a color/image background. Surfaces turn
   translucent + blurred; transparent mode keeps the normal solid look. */
body.appbg-flood .topbar,
body.appbg-flood .tabbar,
body.appbg-flood .pcard,
body.appbg-flood .b-card,
body.appbg-flood .cat-chip,
body.appbg-flood .order-summary,
body.appbg-flood .sheet-card,
body.appbg-flood .modal-card,
body.appbg-flood .confirm-card,
body.appbg-flood .lang-pop-card,
body.appbg-flood .fulfil-toggle,
body.appbg-flood .own-deliv,
body.appbg-flood .soc-card,
body.appbg-flood .slot,
body.appbg-flood .addon,
body.appbg-flood .rs-offer,
body.appbg-flood .rs-capacity,
body.appbg-flood .searchbox input,
body.appbg-flood .cust-fields input,
body.appbg-flood .cust-fields select,
body.appbg-flood .rs-form input,
body.appbg-flood .rs-form textarea {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
}

/* =========================================================================
   Phase 3 — UI/UX polish: rounded corners, iOS transitions, modern scrollbars
   ========================================================================= */
:root {
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

/* --- rounded corners (consistent components) --- */
.pcard, .b-card, .dv, .cat-chip, .lang-opt, .addon, .slot-chip, .btn-checkout,
.after-order, .lang-pop-card, .modal-card, .sheet-card, .searchbox input {
  border-radius: var(--radius-md);
}
.btn-checkout { border-radius: var(--radius-lg); }
.banners .b-card { border-radius: var(--radius-lg); overflow: hidden; }

/* --- iOS-style view transitions --- */
.view { animation: iosFadeIn .28s ease; }
@keyframes iosFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes iosSheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet .sheet-card { animation: iosSheetUp .3s cubic-bezier(.3, .8, .3, 1); }
@keyframes iosPopIn {
  from { opacity: 0; transform: scale(.95) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-card, .lang-pop-card { animation: iosPopIn .22s ease; }

::selection { background: var(--primary-soft); }


/* --- modern minimal scrollbar --- */
* { scrollbar-width: thin; scrollbar-color: rgba(120,120,128,.45) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120,120,128,.4); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120,120,128,.6); }
::-webkit-scrollbar-corner { background: transparent; }

/* --- dark-mode toggle switch (Phase 3) --- */
.switch { position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 42px; height: 24px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--border); position: relative; transition: background .2s; flex-shrink: 0; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .track { background: var(--brand-primary); border-color: var(--brand-primary); }
.switch input:checked + .track::after { transform: translateX(18px); }
.sw-icon { font-size: 15px; }

/* --- customer confirm + payment dialog (Phase 3.5 / 3.9) --- */
.confirm-ov { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; animation: iosFadeIn .18s; }
.confirm-card { position: relative; width: 90%; max-width: 360px; background: var(--surface); color: var(--text); border-radius: var(--radius-lg); padding: 22px; text-align: center; box-shadow: 0 16px 40px rgba(0,0,0,.25); animation: iosPopIn .2s ease; max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; }
.confirm-card .confirm-ico { font-size: 34px; margin-bottom: 8px; }
.confirm-card p { font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.confirm-card input { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background: var(--surface); color: var(--text); }
.confirm-btns { display: flex; gap: 10px; justify-content: center; }
.confirm-btns .btn { flex: 1; }
.btn-primary { background: var(--brand-primary); color: var(--brand-primary-text, #fff); border: none; border-radius: 26px; padding: 12px; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn-checkout.pay { background: #1D3557; }
.own-deliv { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 6px 2px; background: var(--surface2); border-radius: 12px; font-size: 13px; }
.own-deliv select { flex: 1; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }

/* ============================ Round 9 ============================ */
/* --- customer details (identity) in the cart --- */
.cust-fields { margin-top: 14px; }
.cust-fields .sec { font-size: 14px; }
.cf-row { display: flex; gap: 8px; margin-bottom: 8px; }
.cf-row select { flex: 0 0 42%; appearance: none; }
.cust-fields input, .cust-fields select { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 14px; margin-bottom: 8px; }
.cf-row input { flex: 1; min-width: 0; margin-bottom: 0; }

/* --- social links on the About page (grid / list) --- */
.social-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 4px 0 14px; }
.social-grid.list { grid-template-columns: 1fr; }
.soc-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; }
.soc-cover img { width: 100%; height: 92px; object-fit: contain; background: var(--surface2); display: block; }
.soc-body { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.soc-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface2); font-size: 20px; overflow: hidden; flex: none; }
.soc-ico img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
/* Uploaded network icons show fully as-is: no circle, no crop, no stretch —
   natural aspect bounded into the card (emoji fallback keeps the circle). */
.soc-ico:has(img) { width: auto; height: auto; max-width: 100%; background: none; border-radius: 0; overflow: visible; }
.soc-ico:has(img) img { width: auto; height: auto; max-width: 120px; max-height: 44px; object-fit: contain; border-radius: 0; }
.soc-name { font-size: 13px; font-weight: 600; word-break: break-word; }

/* --- recommended products on the search tab --- */
.rec-sec { margin: 4px 0 10px; }
.pcomment { font-size: 12px; color: var(--text2); margin: 4px 0 6px; }

/* --- abandoned-cart feedback popup --- */
.modal-btns { display: flex; gap: 10px; }
.modal-btns .btn-ghost, .modal-btns .btn-checkout { flex: 1; text-align: center; padding: 12px; }
#fb-text { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 14px; resize: vertical; margin-bottom: 12px; }

/* --- High-contrast text & surface rules (Dark & Light) --- */
[data-theme="dark"] body { color: #ffffff; background: #121212; }
[data-theme="dark"] .topbar { background: #1e1e1e; border-bottom-color: #383838; }
[data-theme="dark"] .pname { color: #ffffff; }
[data-theme="dark"] .b-card h3 { color: #ffffff; }
[data-theme="dark"] .cl-name { color: #ffffff; }
[data-theme="dark"] .tabbar { background: #1e1e1e; border-top-color: #383838; }
[data-theme="dark"] .tab { color: #b3b3b3; }
[data-theme="dark"] .tab.active { color: var(--brand-primary); }
[data-theme="dark"] .icon-btn { background: #2a2a2a; color: #ffffff; border-color: #383838; }
[data-theme="dark"] .cat-chip { background: #1e1e1e; color: #ffffff; border-color: #383838; }
[data-theme="dark"] .cat-chip.on { background: var(--brand-primary); color: var(--brand-primary-text, #ffffff); border-color: var(--brand-primary); }
[data-theme="dark"] .soc-card { background: #1e1e1e; color: #ffffff; border-color: #383838; }
[data-theme="dark"] .soc-name { color: #ffffff; }
[data-theme="dark"] .soc-ico { background: #2a2a2a; color: #ffffff; }
[data-theme="dark"] .pcard { background: #1e1e1e; border-color: #383838; }
[data-theme="dark"] .b-card { background: #1e1e1e; border-color: #383838; }
[data-theme="dark"] .order-summary { background: #1e1e1e; border-color: #383838; color: #ffffff; }
[data-theme="dark"] .sheet-card { background: #1e1e1e; color: #ffffff; }
[data-theme="dark"] .sheet-x { background: #2a2a2a; color: #ffffff; }
[data-theme="dark"] .addon { background: #1e1e1e; border-color: #383838; color: #ffffff; }
[data-theme="dark"] .lang-pop-card { background: #1e1e1e; color: #ffffff; }
[data-theme="dark"] .lang-opt { background: #2a2a2a; color: #ffffff; border-color: #383838; }
[data-theme="dark"] .vm-toggle .vm-btn { background: #1e1e1e; color: #b3b3b3; }
[data-theme="dark"] .vm-toggle .vm-btn.on { background: var(--brand-primary); color: var(--brand-primary-text, #ffffff); }
[data-theme="dark"] .slot { background: #1e1e1e; color: #ffffff; border-color: #383838; }
[data-theme="dark"] .slot.on { background: var(--brand-primary); color: var(--brand-primary-text, #ffffff); border-color: var(--brand-primary); }

/* ================= Splash / Onboarding screen =================
   Full-viewport portrait stage: media slides (cover), story progress,
   floating brand, mid-screen arrows, bottom gradient + language pill. */
#splash { position: fixed; inset: 0; z-index: 400; background: #000; overflow: hidden; }
#splash.hidden { display: none; }
/* Mobile-size portrait canvas on every screen: full height, max 480px wide,
   centered — phones see true full-screen, desktops see a phone column. */
.sp-phone { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 480px); overflow: hidden; background: #000; }
.sp-stage { position: absolute; inset: 0; perspective: 1200px; overflow: hidden; background: #000; }
.sp-layer { position: absolute; inset: 0; }
.sp-layer img, .sp-layer video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* YouTube embeds can't object-fit: center a 16:9 frame scaled to cover. */
.sp-layer iframe.sp-yt { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); height: 100%; aspect-ratio: 16/9; width: auto; min-width: 100%; border: 0; display: block; }
/* story progress */
.sp-progress { position: absolute; top: 12px; left: 0; right: 0; display: flex; gap: 6px; padding: 0 12px; z-index: 5; }
.sp-seg { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.35); overflow: hidden; }
.sp-seg i { display: block; height: 100%; width: 0; background: #fff; border-radius: 2px; }
/* floating brand */
.sp-brand { position: absolute; top: 24px; left: 20px; z-index: 5; display: flex; gap: 10px; align-items: center; }
/* Arabic mirror: the whole brand block docks right; flex order flips by RTL */
[dir="rtl"] .sp-brand { left: auto; right: 20px; }
.sp-brand img { width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 1px 6px rgba(0,0,0,.5)); }
.sp-brand b { display: block; color: #fff; font-size: 17px; font-weight: 800; text-shadow: 0 1px 8px rgba(0,0,0,.7); }
.sp-brand span { display: block; color: rgba(255,255,255,.7); font-size: 13px; text-shadow: 0 1px 8px rgba(0,0,0,.7); }
/* mid-screen arrows */
.sp-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 6; background: none; border: none; padding: 18px 14px; cursor: pointer; }
.sp-arrow svg { display: block; width: 20px; height: 22px; filter: drop-shadow(0 1px 6px rgba(0,0,0,.6)); }
.sp-prev { left: 16px; }
.sp-next { right: 16px; }
/* bottom gradient + language pill */
.sp-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 60px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(0,0,0,.95) 0%, rgba(0,0,0,.55) 55%, rgba(0,0,0,0) 100%);
  -webkit-backdrop-filter: blur(15px); backdrop-filter: blur(15px);
  -webkit-mask-image: linear-gradient(to top, #000 70%, transparent 100%);
  mask-image: linear-gradient(to top, #000 70%, transparent 100%);
}
.sp-lang-label { display: flex; justify-content: space-between; align-items: baseline; color: #fff; font-size: 13px; margin-bottom: 10px; padding: 0 6px; text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.sp-langs { display: flex; flex-wrap: nowrap; border: 2px solid #fff; border-radius: 30px; background: rgba(0,0,0,.35); overflow: hidden; }
.sp-langs button { flex: 1 1 0; min-width: 0; background: none; border: none; color: #fff; font-size: clamp(15px, 4.6vw, 19px); font-weight: 700; padding: 20px 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-langs button:active { background: rgba(255,255,255,.18); }
/* 3D transitions (incoming layer) */
.sp-stage.sp-tr-cube .sp-enter { animation: spCube .8s cubic-bezier(.22,.61,.36,1); transform-origin: center; }
.sp-stage.sp-tr-flip .sp-enter { animation: spFlip .8s cubic-bezier(.22,.61,.36,1); transform-style: preserve-3d; }
.sp-stage.sp-tr-zoom .sp-enter { animation: spZoom .8s cubic-bezier(.22,.61,.36,1); }
.sp-stage.sp-tr-slideover .sp-enter { animation: spSlideOver .7s cubic-bezier(.22,.61,.36,1); }
.sp-stage.sp-tr-parallax .sp-enter { animation: spParIn .7s cubic-bezier(.22,.61,.36,1); }
.sp-stage.sp-tr-parallax .sp-leave { animation: spParOut .7s cubic-bezier(.22,.61,.36,1); }
@keyframes spCube { from { transform: perspective(1200px) rotateY(90deg); opacity: .3; } to { transform: perspective(1200px) rotateY(0deg); opacity: 1; } }
@keyframes spFlip { from { transform: perspective(1200px) rotateY(180deg); opacity: 0; } to { transform: perspective(1200px) rotateY(0deg); opacity: 1; } }
@keyframes spZoom { from { transform: scale(1.18); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes spSlideOver { from { transform: translateX(100%) scale(.96); } to { transform: translateX(0) scale(1); } }
@keyframes spParIn { from { transform: translateX(45%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes spParOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(-12%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .sp-stage .sp-enter, .sp-stage .sp-leave { animation: none !important; }
}

