:root {
  /* هوية مكس كرتون ستور */
  --bg: #f3f8ff;
  --stage: #efe9f2;
  --ink: #14275f;
  --muted: #5d6b8f;
  --accent: #1f6fd1;          /* أزرق المتجر الغامق للأزرار */
  --accent-ink: #ffffff;
  --sky: #66c5ff;             /* اللون الأساسي للمتجر */
  --card: #ffffff;
  --line: #d9e7fb;
  --ring: #14275f;
  --shadow: 0 -8px 30px rgba(20, 50, 120, .12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1a3d;
    --stage: #1b2550;
    --ink: #eef4ff;
    --muted: #a8b6d8;
    --accent: #66c5ff;
    --accent-ink: #0b1a44;
    --card: #142456;
    --line: #26387a;
    --ring: #ffffff;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'PingARLT', 'Tajawal', system-ui, sans-serif; color: var(--ink); background: var(--bg);
  display: flex; flex-direction: column; min-height: 100dvh; overflow: hidden;
}
.top {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: .2px; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.brand .projectLogo { height: 40px; width: auto; display: block; }
.brand .logo { height: 38px; width: auto; display: block; filter: drop-shadow(0 2px 3px rgba(10,30,90,.25)); }
.link { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 700; font-size: 14px; padding: 6px 0; cursor: pointer; }

.stage { position: relative; flex: 1 1 auto; min-height: 42vh; background: var(--stage); }
#view { width: 100%; height: 100%; display: block; touch-action: none; }
.hint {
  position: absolute; top: 8px; left: 12px;
  background: rgba(255, 255, 255, .75); color: #5a4458; padding: 5px 12px; border-radius: 99px; font-size: 13px;
  transition: opacity .6s; pointer-events: none;
}
.loading {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--muted); font-weight: 500; background: var(--stage); transition: opacity .4s;
}
.loading[hidden] { display: none; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--sky); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.panel {
  flex: 0 0 auto; background: var(--card); border-radius: 22px 22px 0 0; box-shadow: var(--shadow);
  padding: 12px 0 max(12px, env(safe-area-inset-bottom)); max-height: 52vh; display: flex; flex-direction: column;
}
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 10px; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to left, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
          mask-image: linear-gradient(to left, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%); }   /* soft edges: more tabs to swipe */
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; border: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-weight: 700;
  font-size: 14px; padding: 8px 14px; border-radius: 99px; cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--sky); border-color: var(--sky); color: #0b1f52; }
.tabBody { overflow-y: auto; padding: 2px 16px 8px; flex: 1 1 auto; }
.row { margin: 6px 0 14px; }
.rowTitle { font-size: 14px; font-weight: 700; margin-bottom: 8px; display: flex; justify-content: space-between; }
.rowTitle .val { color: var(--muted); font-weight: 500; }
.options { display: flex; gap: 8px; flex-wrap: wrap; }
.opt {
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-weight: 700; font-size: 14px;
  padding: 10px 14px; border-radius: 14px; cursor: pointer; min-width: 72px;
}
.opt[aria-pressed="true"] { border-color: var(--sky); background: color-mix(in srgb, var(--sky) 22%, var(--bg)); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 4px 6px; }   /* all colours on rows: the picked one is always in view */
.swatches::-webkit-scrollbar { display: none; }
.sw {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .08); cursor: pointer; padding: 0;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .12);
}
.sw[aria-pressed="true"] { outline: 3px solid var(--ring); outline-offset: 2px; }
.nameIn {
  width: 100%; font: inherit; font-size: 18px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; text-align: center;
  padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink);
}
.note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.actions { padding: 6px 16px 0; }
.done, .btn {
  display: block; width: 100%; text-align: center; text-decoration: none; border: 0; border-radius: 16px; padding: 14px;
  font: inherit; font-size: 17px; font-weight: 800; cursor: pointer;
}
.done, .btn.primary { background: linear-gradient(180deg, #3aa8f5, var(--accent)); color: #fff; box-shadow: 0 6px 16px rgba(31,111,209,.35); }
@media (prefers-color-scheme: dark) { .done, .btn.primary { background: linear-gradient(180deg, #8fd6ff, var(--sky)); color: #0b1f52; } }
.btn { background: var(--bg); color: var(--ink); border: 1.5px solid var(--line); margin: 10px 0; }

.modal { position: fixed; inset: 0; background: rgba(20, 8, 18, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.modal[hidden] { display: none; }
.sheet {
  position: relative; width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto; background: var(--card); color: var(--ink);
  border-radius: 22px 22px 0 0; padding: 22px 18px max(18px, env(safe-area-inset-bottom));
}
@media (min-width: 700px) { .modal { align-items: center; } .sheet { border-radius: 22px; } }
.sheet h2 { margin: 0 0 6px; font-size: 22px; }
.x { position: absolute; top: 10px; left: 12px; background: none; border: 0; font-size: 28px; color: var(--muted); cursor: pointer; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.code {
  direction: ltr; text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 22px; font-weight: 700;
  letter-spacing: 1px; background: var(--bg); border: 2px dashed var(--sky); border-radius: 14px; padding: 14px 8px; word-break: break-all;
}
.codeIn {
  width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 18px; padding: 12px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); text-transform: uppercase;
}
.err { color: #d0263a; font-weight: 700; }
.summary { list-style: none; padding: 0; margin: 12px 0; }
.summary li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.summary .dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; margin-inline-start: 6px; border: 1px solid rgba(0, 0, 0, .15); }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #2b1d2a; color: #fff; padding: 10px 16px;
  border-radius: 99px; font-weight: 700; z-index: 20;
}
@media (min-width: 900px) {
  body { flex-direction: row; flex-wrap: wrap; }
  .top { width: 100%; }
  .stage { flex: 1 1 60%; min-width: 0; height: calc(100dvh - 56px); }
  /* min-width 0: the tabs row is wider than 400px; without it the panel grew and wrapped below the screen (2026-11-28) */
  .panel { flex: 0 0 400px; min-width: 0; width: 400px; max-height: none; height: calc(100dvh - 56px); border-radius: 22px 0 0 0; }
  /* desktop has no swipe and no scrollbar: show every tab on several lines (2026-11-28) */
  .tabs { flex-wrap: wrap; overflow: visible; flex: 0 0 auto; -webkit-mask-image: none; mask-image: none; }
}

/* ٢٨-١١: السعر فوق المعاينة بالريال، يتغيّر مع كل اختيار */
.price {
  position: absolute; top: 8px; right: 12px; z-index: 2;
  display: flex; flex-direction: column; align-items: center; line-height: 1.15;
  background: #fff; color: #14306e; padding: 5px 14px 6px; border-radius: 14px;
  box-shadow: 0 3px 10px rgba(10, 30, 90, .18); border: 2px solid var(--sky, #66c5ff);
}
.price small { font-size: 11px; color: #5d6b8a; font-weight: 500; }
.price b { font-size: 19px; font-weight: 800; white-space: nowrap; }
.price.bump b { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.12); } }
.summary li.total { font-size: 17px; border-top: 2px solid var(--line); margin-top: 4px; padding-top: 8px; }

/* العملة (٢٨-١١): علامة الريال الجديدة من خط مفتوح (OFL) */
@font-face { font-family: 'saudi_riyal'; src: url('https://cdn.jsdelivr.net/npm/@emran-alhaddad/saudi-riyal-font@1.1.0/fonts/bold/saudi_riyal.woff2') format('woff2'); font-display: swap; }
.sar { font-family: 'saudi_riyal', sans-serif; font-weight: normal; }
#curSel {
  font: inherit; font-size: 12px; color: #14306e; background: #eef6ff; border: 1px solid #cfe3f7; border-radius: 8px;
  padding: 1px 4px; margin-bottom: 2px; max-width: 150px; cursor: pointer;
}
#priceSar { font-size: 11px; color: #5d6b8a; white-space: nowrap; }

/* 29-11: «تم» window = big price + 3 numbered steps; «كيف أطلب؟» */
.topLinks { display: flex; gap: 14px; align-items: center; }
.bigPrice { margin: 10px 0 4px; padding: 12px 14px; border-radius: 14px; background: var(--bg); border: 1.5px solid var(--line); font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.bigPrice b { font-size: 26px; color: var(--accent); }
.copied { margin: 6px 0 10px; font-weight: 700; color: #1b8a4a; }
.copied.warn { color: #c0392b; }
.steps { margin: 6px 0 12px; padding: 0; list-style: none; counter-reset: st; }
.steps li { counter-increment: st; position: relative; padding: 9px 44px 9px 0; line-height: 1.6; border-bottom: 1px dashed var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps li::before { content: counter(st); position: absolute; right: 0; top: 8px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; display: grid; place-items: center; }
.more { margin: 6px 0; }
.more summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 6px 0; }
.topLinks .link { white-space: nowrap; }
@media (max-width: 420px) { .topLinks { gap: 10px; } .topLinks .link { font-size: 13px; } }
@media (max-width: 400px) { .topLinks { gap: 8px; } .topLinks .link { font-size: 12px; } }
/* 29-11: terms before ordering */
.terms { margin: 8px 0 12px; padding-inline-start: 22px; line-height: 1.7; font-size: 14.5px; }
.terms li { margin-bottom: 8px; }
.agree { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: var(--bg); border: 1.5px solid var(--line); font-weight: 700; cursor: pointer; }
.agree input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.btn.disabled { opacity: .45; }
/* 29-11 (plan 2): phone/email field before paying */
.contact { display: block; margin: 10px 0 6px; font-weight: 700; font-size: 14.5px; }
#contactIn { margin-bottom: 4px; }
#termsModal .tiny { margin: 0 0 10px; }

/* Final packaging review. Assets load only after consent and contact validation. */
.boxReviewModal { z-index: 12; }
.boxReviewSheet { max-width: 880px; max-height: 94dvh; }
.reviewEyebrow { margin: 0 0 7px; color: #973754; font-size: 13px; font-weight: 800; }
.reviewIntro { margin: 7px 0 14px; font-size: 14px; }
.reviewLayout { display: grid; gap: 12px; }
.reviewVisual { min-width: 0; }
.reviewViewerWrap { position: relative; overflow: hidden; border: 1px solid #f0d5df; border-radius: 18px; background: radial-gradient(ellipse at 45% 40%, #fff9fc, #f3dfe8); }
.boxPreview { width: 100%; height: clamp(240px, 40dvh, 370px); }
.boxPreview canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.reviewLoading { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; background: #faedf3; color: #763447; }
.reviewLoading[hidden],#retryBoxBtn[hidden] { display: none; }
.reviewViews { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.reviewViews button { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 7px 16px; font: inherit; font-size: 13px; cursor: pointer; }
.reviewViews button[aria-pressed="true"] { border-color: #b55a77; background: #fbe5ee; color: #6c253d; }
.reviewStatus { font-size: 12px; text-align: center; margin: 8px 0 0; min-height: 18px; }
.reviewPrice { margin-top: 0; gap: 12px; }
.reviewName { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; margin: 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.reviewName b { font-size: 17px; }
.reviewNote { color: var(--muted); line-height: 1.7; font-size: 13px; margin: 10px 0; }
.reviewFoot { position: sticky; bottom: -22px; background: var(--card); padding-top: 12px; padding-bottom: 4px; border-top: 1px solid var(--line); margin-top: 12px; display: grid; gap: 8px; }
.reviewFoot .btn { margin: 0; }
.reviewFoot button:disabled,.reviewViews button:disabled { opacity: .45; cursor: wait; }
.reviewEdit { border-color: transparent; background: transparent; }
.boxReviewSheet :focus-visible { outline: 3px solid #b55a77; outline-offset: 3px; }
@media (min-width: 760px) {
  .reviewLayout { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: start; }
  .boxPreview { height: min(50dvh, 440px); }
  .reviewFoot { grid-template-columns: 1.4fr 1fr; }
  .boxReviewSheet { padding: 26px; }
}

/* Both complimentary gifts, shown in the final design review. */
.orderGift { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 15px 12px; margin: 14px 0; background: #fff2f7; border: 1px solid #edc7d7; border-radius: 16px; color: #722a46; }
.orderGiftIcon { display: grid; place-items: center; width: 42px; height: 48px; color: #a74369; }
.orderGiftIcon svg { width: 42px; height: 42px; }
.orderGiftText { min-width: 0; }
.orderGiftText .orderGiftEyebrow { margin: 0 0 4px; font-size: 11px; font-weight: 800; color: #a14467; }
.orderGiftText h3 { margin: 0; font-size: 15px; font-weight: 800; line-height: 1.5; }
.orderGiftText p { margin: 5px 0 0; font-size: 12px; line-height: 1.7; }
.orderGiftBadge { align-self: start; padding: 3px 8px; border-radius: 99px; background: #8c3357; color: #fff; font-size: 11px; font-weight: 800; white-space: nowrap; }
.orderDeviceGift { grid-template-columns: 72px minmax(0, 1fr) auto; }
.orderDeviceGiftPhoto { width: 72px; height: 72px; object-fit: contain; border-radius: 10px; }
.boxReviewModal:not([hidden]) .orderGift { animation: orderGiftReveal .35s ease-out both; }
@keyframes orderGiftReveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .boxReviewModal:not([hidden]) .orderGift { animation: none; } }
@media (max-width: 370px) { .orderGift { grid-template-columns: 34px minmax(0, 1fr); gap: 8px; } .orderGiftIcon, .orderGiftIcon svg { width: 34px; } .orderGiftBadge { grid-column: 2; justify-self: start; } }
@media (max-width: 370px) { .orderDeviceGift { grid-template-columns: 62px minmax(0, 1fr); } .orderDeviceGiftPhoto { width: 62px; height: 62px; } }
