:root {
  --ink: #102033;
  --muted: #5c6b7c;
  --paper: #f3efe7;
  --card: #fffcf8;
  --line: #e3dbd0;
  --sand: #ebe4d8;
  --teal: #0e7c74;
  --clay: #a33b2b;
  --shadow: 0 18px 50px rgba(16, 32, 51, 0.08);
  font-family: "IBM Plex Sans Arabic", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); }
img { max-width: 100%; height: auto; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.topbar-bar { background: var(--ink); color: var(--card); }
.topbar-bar p, .header, .wrap, .footer-inner { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.topbar-bar p { margin: 0 auto; padding: 8px 0; font-size: 14px; }
.header-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, white);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header { display: flex; align-items: center; gap: 16px; padding: 12px 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; font-size: 18px; }
.mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 999px; background: var(--ink); color: var(--card); font-size: 14px;
}
.nav { display: none; gap: 18px; margin-inline-start: auto; color: var(--muted); font-size: 14px; }
.nav a { text-decoration: none; }
.cart-btn, .btn, .ghost, .chip, .swatch, .month, .pay-method, .storage, .work, .filter {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}
.cart-btn {
  margin-inline-start: auto;
  display: flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 8px 12px;
}
.cart-btn b {
  min-width: 20px; border-radius: 999px; background: var(--teal); color: white; font-size: 12px; padding: 0 6px;
}
.hero, .block { padding: 28px 0; }
.hero-grid, .pay-grid, .split { display: grid; gap: 28px; align-items: center; }
.hero-copy h1, .flow h1 { font-size: clamp(32px, 6vw, 52px); line-height: 1.15; margin: 8px 0; }
.kicker { color: var(--teal); font-weight: 700; margin: 0; }
.offer-lines { font-size: clamp(26px, 4vw, 34px); font-weight: 700; line-height: 1.25; margin: 16px 0; }
.offer-lines span { color: var(--teal); }
.muted { color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .month, .swatch, .storage, .work, .filter { border-radius: 999px; padding: 8px 14px; }
.chip.on, .storage.on, .work.on, .filter.on { background: var(--ink); color: var(--card); border-color: var(--ink); }
.month.on { background: var(--teal); color: white; border-color: var(--teal); }
.swatch { display: flex; align-items: center; gap: 8px; }
.swatch.on { background: var(--ink); color: var(--card); }
.swatch i, .dot {
  width: 16px; height: 16px; border-radius: 999px; border: 1px solid var(--line); display: inline-block;
}
.dot { width: 28px; height: 28px; padding: 0; }
.dot.on { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn, .ghost {
  border-radius: 999px; padding: 12px 18px; font-weight: 700; text-decoration: none; display: inline-block;
}
.btn { background: var(--teal); color: white; border-color: var(--teal); }
.btn.full { width: 100%; text-align: center; }
.price-lg { font-size: 28px; font-weight: 700; color: var(--teal); margin: 12px 0; }
.price-lg small { display: block; color: var(--ink); font-size: 15px; }
.shot { display: flex; justify-content: center; }
.shot img, .card img, .mini img, .summary img { width: auto; max-width: 100%; object-fit: contain; }
.shot img { max-height: 58vh; }
.filters { display: flex; gap: 8px; overflow: auto; padding-bottom: 4px; margin: 14px 0; }
.search {
  width: min(100%, 280px); border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); padding: 12px 16px;
}
.grid { display: grid; gap: 16px; }
.card, .panel, .summary, .flow {
  background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 16px;
}
.card h3, .panel h2, h2 { margin: 0; }
.card del, .old { color: var(--muted); font-size: 12px; }
.card .foot { display: flex; justify-content: space-between; align-items: end; gap: 8px; margin-top: 12px; }
.card img { background: var(--sand); border-radius: 16px; }
.finance { display: grid; gap: 12px; }
.finance article { border-radius: 24px; padding: 20px; border: 1px solid var(--line); background: var(--card); }
.finance article:first-child { background: var(--ink); color: var(--card); }
.finance strong { display: block; font-size: 28px; margin-top: 4px; }
.colors h3 { margin: 0 0 10px; }
.color-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mini { border: 1px solid var(--line); background: var(--card); border-radius: 18px; padding: 10px; text-align: start; }
.mini span { display: flex; gap: 6px; align-items: center; font-size: 14px; font-weight: 650; }

.drawer[hidden], [hidden] { display: none !important; }
.drawer { position: fixed; inset: 0; z-index: 30; }
.backdrop { position: absolute; inset: 0; border: 0; background: rgba(16, 32, 51, 0.4); }
.sheet {
  position: absolute; inset-block: 0; inset-inline-start: 0; width: min(420px, 100%);
  background: var(--card); display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.sheet header, .sheet footer { padding: 16px; border-bottom: 1px solid var(--line); }
.sheet footer { border-bottom: 0; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.sheet .items { padding: 16px; overflow: auto; flex: 1; display: grid; gap: 10px; align-content: start; }
.line { display: flex; gap: 10px; border: 1px solid var(--line); border-radius: 16px; padding: 10px; }
.summary .line { border-color: rgba(255,255,255,.12); }
.line img { width: 72px; height: 72px; object-fit: contain; background: white; border-radius: 12px; }
.icon { border: 0; background: transparent; font-size: 20px; color: var(--clay); }

.progress { display: flex; gap: 14px; align-items: center; font-size: 14px; flex-wrap: wrap; }
.progress span { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.progress i {
  width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center;
  background: var(--sand); color: var(--muted); font-style: normal; font-size: 12px; font-weight: 700;
}
.progress .on { color: var(--ink); font-weight: 700; }
.progress .on i { background: var(--teal); color: white; }
.fields { display: grid; gap: 12px; margin-top: 14px; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 650; }
.field input, .field select, .otp-input, .ltr {
  width: 100%; border-radius: 16px; border: 1px solid var(--line); background: var(--paper);
  padding: 12px 14px; font-size: 16px;
}
.ltr, .otp-input { direction: ltr; text-align: left; font-family: ui-monospace, "SFMono-Regular", monospace; letter-spacing: 0.12em; }
.otp-input { text-align: center; height: 64px; font-size: 28px; letter-spacing: 0.4em; border-radius: 18px; margin-top: 12px; }
.err { color: var(--clay); font-size: 14px; min-height: 1.2em; }
.pay-methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.pay-method { border-radius: 16px; padding: 10px; }
.pay-method small { display: block; }
.pay-method.on { background: var(--ink); color: var(--card); }
.pay-method:disabled { opacity: 0.45; }
.card-face {
  direction: ltr; text-align: left; color: white; border-radius: 18px; padding: 20px;
  background: linear-gradient(220deg, #1c3d58, #0d1b2a); box-shadow: var(--shadow);
}
.card-face .chip-gold { width: 46px; height: 32px; border-radius: 8px; margin: 22px 0; background: linear-gradient(135deg, #f3d48a, #c9962e); }
.card-face .pan { font-family: ui-monospace, monospace; letter-spacing: 0.14em; font-size: 20px; }
.card-face .meta { display: flex; justify-content: space-between; font-size: 12px; }
.summary { background: var(--ink); color: var(--card); display: grid; gap: 10px; align-content: start; }
.summary .muted, .summary small { color: #d9cbb8; }
.month.dark { background: transparent; color: white; border-color: rgba(255,255,255,.2); }
.month.dark.on { background: var(--teal); border-color: var(--teal); }

#loader {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: #0d1b2a; color: white; text-align: center; padding: 24px;
}
.spin { width: 112px; height: 112px; margin: 0 auto 24px; position: relative; }
.spin span, .spin em { position: absolute; border-radius: 999px; border: 4px solid transparent; }
.spin span { inset: 0; border-color: rgba(255,255,255,.12); border-top-color: #3dbeb4; animation: spin 1.05s linear infinite; }
.spin em { inset: 12px; border-bottom-color: rgba(255,255,255,.85); animation: spin 1.7s linear infinite reverse; }
.spin b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; }
.bar { height: 6px; background: rgba(255,255,255,.12); border-radius: 999px; overflow: hidden; margin-top: 22px; }
.bar i { display: block; height: 100%; width: 0; background: #3dbeb4; }
.done-box { background: var(--ink); color: white; text-align: center; }
.done-box .badge {
  width: 76px; height: 76px; margin: 0 auto 8px; border-radius: 999px; display: grid; place-items: center;
  background: var(--teal); font-size: 28px; font-weight: 800;
}
.footer { margin-top: 48px; background: var(--ink); color: #d9cbb8; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; padding: 28px 0; flex-wrap: wrap; }
.footer strong { color: white; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fill { to { width: 100%; } }

@media (min-width: 840px) {
  .nav { display: flex; }
  .cart-btn { margin-inline-start: 0; }
  .hero-grid, .pay-grid { grid-template-columns: 1.05fr 0.95fr; }
  .split { grid-template-columns: 1fr auto; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .finance { grid-template-columns: repeat(3, 1fr); }
  .color-grid { grid-template-columns: repeat(5, 1fr); }
  .fields.two { grid-template-columns: 1fr 1fr; }
  .wide { grid-column: 1 / -1; }
  .pay-methods { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .spin span, .spin em, .bar i { animation: none; }
  .bar i { width: 100%; }
}

/* مؤشر تحميل OTP: يظهر فقط خلال فترة الاختبار الحالية */
.otp-loader { display:flex; align-items:center; justify-content:center; gap:10px; margin:12px auto 0; color:var(--muted); font-size:14px; }
.otp-loader[hidden] { display:none; }
.otp-spinner { width:21px; height:21px; border-radius:50%; border:3px solid var(--line); border-top-color:var(--teal); animation:spin .75s linear infinite; }
@media (prefers-reduced-motion: reduce) { .otp-spinner { animation:none; } }
