:root {
  --bg: #07141f;
  --panel: #0d2030;
  --panel-2: #0b1b2b;
  --line: #1d3547;
  --text: #e8eff6;
  --muted: #9fb3c4;
  --teal: #5eead4;
  --teal-dim: #2dd4bf;
  --font-ar: "Noto Kufi Arabic", "SF Arabic", "Geeza Pro", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-en: "Noto Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(900px 520px at 85% -8%, rgba(20, 184, 166, .22), transparent 60%),
    radial-gradient(760px 520px at 0% 105%, rgba(99, 102, 241, .16), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ar);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px;
  background: rgba(7, 20, 31, .78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.mark {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(145deg, #12384a, #0b1b2b);
  border: 1px solid #1f4557; position: relative;
}
.mark::after {
  content: ""; position: absolute; left: 6px; right: 6px; top: 50%; height: 8px;
  transform: translateY(-50%); border-radius: 6px; background: var(--teal);
}
.brand-t { display: flex; flex-direction: column; line-height: 1.15; }
.brand-t b { font-family: var(--font-en); font-size: 14px; letter-spacing: -.2px; }
.brand-t i { font-style: normal; font-size: 11px; color: var(--muted); }
.bar-actions { display: flex; align-items: center; gap: 8px; }
.ico {
  display: inline-flex; align-items: center; gap: 7px; font: inherit;
  font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .12);
  padding: 8px 14px; border-radius: 999px; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.ico:hover { background: rgba(255, 255, 255, .09); }
.ico[aria-expanded="true"] { background: var(--teal); color: #06222b; border-color: transparent; }
.ico svg, .dl svg { width: 15px; height: 15px; flex: 0 0 auto; }
.dl {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-ar); font-size: 13px; font-weight: 700; text-decoration: none;
  color: #06222b; background: var(--teal); padding: 8px 16px; border-radius: 999px;
  white-space: nowrap;
}
/* ---------- QR popover ---------- */
.qr-pop {
  position: fixed; top: 64px; right: 18px; z-index: 50;
  width: min(320px, calc(100vw - 24px));
  background: #0d2030; border: 1px solid var(--line); border-radius: 18px; padding: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.qr-pop[hidden] { display: none; }
.qr-pop-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.qr-pop-head b { font-family: var(--font-en); font-size: 15px; letter-spacing: -.2px; }
.qr-pop .x {
  border: 0; background: rgba(255, 255, 255, .06); color: var(--text);
  width: 30px; height: 30px; border-radius: 50%; font-size: 18px; cursor: pointer;
}
.qr-white { background: #fff; border-radius: 14px; padding: 12px; }
.qr-white svg { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.qr-pop-url {
  font-family: var(--font-en); font-size: 11.5px; color: #7f96a8;
  word-break: break-all; margin: 10px 0 12px; text-align: center;
}
.qr-pop-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini {
  font: inherit; font-size: 13px; font-weight: 700; padding: 9px; border-radius: 10px;
  cursor: pointer; background: rgba(255, 255, 255, .06); color: var(--text);
  border: 1px solid rgba(255, 255, 255, .12);
}
.mini.teal { background: var(--teal); color: #06222b; border-color: transparent; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #0f2c3d; border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-size: 13px; z-index: 70;
}
.toast[hidden] { display: none; }

/* ---------- hero ---------- */
.hero { max-width: 780px; margin: 0 auto; padding: 56px 20px 28px; text-align: center; }
.kicker {
  font-family: var(--font-en); font-size: 11px; font-weight: 700; letter-spacing: 3px;
  color: var(--teal); margin: 0 0 10px;
}
.hero h1 {
  font-family: var(--font-en); font-weight: 800; letter-spacing: -2px; line-height: 1;
  font-size: clamp(46px, 11vw, 86px); margin: 0;
}
.hero h1 em { font-style: normal; color: var(--teal); }
.lead { color: var(--muted); font-size: clamp(15px, 2.4vw, 18px); margin: 18px auto 0; max-width: 560px; }
.cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  padding: 13px 26px; border-radius: 999px; font-size: 15px; font-weight: 700;
  border: 1px solid transparent; transition: transform .15s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn small { font-weight: 500; opacity: .65; font-size: 12px; }
.btn.primary { background: var(--teal); color: #06222b; }
.btn.primary:hover { background: #7df3e1; }
.btn.ghost { border-color: rgba(255, 255, 255, .18); color: var(--text); background: rgba(255, 255, 255, .03); }
.btn.ghost:hover { background: rgba(255, 255, 255, .07); }
.btn.small { padding: 10px 18px; font-size: 13px; }
.meta { color: #7d92a5; font-size: 12.5px; margin-top: 14px; }

/* ---------- booklet viewer ---------- */
.book { max-width: 1120px; margin: 10px auto 0; padding: 24px 0 8px; }
.book-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 22px; margin-bottom: 10px;
}
.book-head h2 { font-size: 18px; margin: 0; }
.counter { font-family: var(--font-en); font-size: 13px; color: var(--muted); direction: ltr; }
.counter span { color: var(--teal); font-weight: 700; }
.stage { position: relative; }
.track {
  display: flex; gap: 16px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; padding: 12px 22px 18px;
  scrollbar-width: none;
}
.track::-webkit-scrollbar { display: none; }
.page {
  flex: 0 0 auto; margin: 0; scroll-snap-align: start;
  height: clamp(340px, 64vh, 600px);
  border-radius: 12px; overflow: hidden; background: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .07);
  cursor: zoom-in; transition: transform .2s ease;
}
.page:hover { transform: translateY(-3px); }
.page img { display: block; height: 100%; width: auto; }
.nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(11, 27, 43, .82); color: var(--text); font-size: 24px; line-height: 1;
  cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(8px);
}
.nav:hover { background: rgba(30, 64, 84, .9); }
#prev { left: 8px; }
#next { right: 8px; }
.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 8px 22px 2px; justify-content: center;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted);
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px; padding: 7px 13px; cursor: pointer; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.chip:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.chip .n {
  font-family: var(--font-en); font-size: 10.5px; font-weight: 700; color: #8ba3b5;
  background: rgba(255, 255, 255, .08); border-radius: 999px; padding: 1px 6px;
}
.chip.on { background: var(--teal); color: #06222b; border-color: transparent; }
.chip.on .n { background: rgba(6, 34, 43, .16); color: #06222b; }
.hint { text-align: center; color: #6f8597; font-size: 12px; margin: 10px 0 0; }

/* ---------- footer ---------- */
footer {
  text-align: center; color: #6b8092; font-size: 12.5px;
  padding: 40px 20px calc(28px + env(safe-area-inset-bottom));
  font-family: var(--font-en);
}

/* ---------- lightbox ---------- */
.lb {
  position: fixed; inset: 0; z-index: 60; background: rgba(4, 12, 18, .95);
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.lb[hidden] { display: none; }
.lb img { max-width: 100%; max-height: calc(100vh - 24px); width: auto; height: auto; border-radius: 6px; }
.lb-close {
  position: fixed; top: 14px; left: 14px; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(11, 27, 43, .85);
  color: #fff; font-size: 22px; cursor: pointer;
}
.lb-nav {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 61;
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(11, 27, 43, .85);
  color: #fff; font-size: 26px; line-height: 1; display: grid; place-items: center;
}
.lb-nav:hover { background: rgba(30, 64, 84, .9); }
#lbprev { left: 14px; }
#lbnext { right: 14px; }

@media (max-width: 720px) {
  .hero { padding-top: 40px; }
  .nav { display: none; }
  .page { height: clamp(320px, 58vh, 520px); }
  .book-head { padding: 0 16px; }
  .track { padding: 10px 16px 14px; }
  .chips { justify-content: flex-start; padding: 6px 16px 2px; }
  .lb-nav { width: 40px; height: 40px; font-size: 22px; }
}
@media (max-width: 560px) {
  .bar { padding: 10px 12px; }
  .brand-t i { display: none; }
  .ico { padding: 8px; }
  .ico .lbl, .dl .lbl { display: none; }
  .dl { padding: 8px; }
}
