/* فهمان — same look as the lesson reels: ink navy, notebook grid, one yellow accent,
   mint = منتهي/صح, coral = دوري/خطأ. */
:root {
  --bg: #0E1730;
  --bg-2: #0A1124;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .08);
  --hair: rgba(255, 255, 255, .12);
  --text: #F4F6FB;
  --muted: rgba(244, 246, 251, .68);
  --faint: rgba(244, 246, 251, .42);
  --accent: #FFC83D;
  --accent-ink: #1A1405;
  --mint: #3DDC97;
  --coral: #FF6B6B;
  --sky: #4CC2FF;
  --violet: #A58BFF;
  --font-display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --saffron: #FFC83D; --white: #F7F8FC; --ink: #0E1730; --ink-2: #16234A; --ink-3: #22325F;
  --radius: 20px;
  --radius-sm: 12px;
  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-size: 32px 32px, 32px 32px, 100% 100%;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.katex { font-size: 1.12em; }
.math { direction: ltr; unicode-bidi: isolate; display: inline-block; white-space: nowrap; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px;
  padding: 14px max(16px, calc((100vw - 1120px) / 2));
  background: rgba(10, 17, 36, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.brand img { display: block; height: 40px; width: auto; }
.crumbs { display: flex; gap: 8px; align-items: center; min-width: 0; color: var(--muted); font-size: 14px; overflow: hidden; }
.crumbs a { text-decoration: none; white-space: nowrap; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--faint); }
.crumbs .here { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 16px 64px; outline: none; }
.loading, .empty { color: var(--muted); padding: 60px 0; text-align: center; }
.loading { display: grid; justify-items: center; gap: 18px; }
.loader { width: 20px; height: 20px; background: var(--accent); animation: rh-spin 1.4s cubic-bezier(.6,0,.4,1) infinite; }
@keyframes rh-spin { 0% { transform: rotate(45deg) scale(1); } 50% { transform: rotate(225deg) scale(.7); } 100% { transform: rotate(405deg) scale(1); } }
.foot-logo { display: block; height: 30px; width: auto; margin: 0 auto 10px; opacity: .85; }
/* tracks: التاسع = sky, البكالوريا = violet */
.track { --tc: var(--accent); }
.track.t-sky { --tc: var(--sky); }
.track.t-violet { --tc: var(--violet); }
.track-section { margin-top: 36px; }
.track-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.track-head h2 { font-family: var(--font-display); }
.track-head .rh { width: 12px; height: 12px; background: var(--tc); transform: rotate(45deg); }
.track-head .sub { color: var(--muted); font-size: 14px; margin-inline-start: auto; }
.eyebrow.track { background: color-mix(in srgb, var(--tc) 16%, transparent); color: var(--tc); }
.foot { color: var(--faint); font-size: 13px; text-align: center; padding: 24px 16px 32px; border-top: 1px solid var(--hair); }
.foot p { margin: 0; }

/* ---------------------------------------------------------------- shared bits */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 14px; border-radius: 99px;
  background: rgba(255, 200, 61, .14); color: var(--accent);
  font-weight: 600; font-size: 14px;
}
h1, h2, h3 { line-height: 1.35; margin: 0; }
h1 { font-family: var(--font-display); font-size: clamp(30px, 6vw, 46px); font-weight: 700; }
.hero h1, .book-head h1, .lesson-head h1 { letter-spacing: -.005em; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 19px; font-weight: 700; }
.lead { color: var(--muted); font-size: 18px; margin: 10px 0 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 99px;
  border: 1px solid var(--hair); background: var(--surface-2);
  font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover { background: rgba(255,255,255,.12); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { background: #FFD465; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.tag { font-size: 13px; color: var(--faint); }

/* ---------------------------------------------------------------- library */
.hero { padding: 24px 0 36px; }
.hero h1 span { color: var(--accent); }
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.book {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px; min-height: 220px; text-decoration: none;
  transition: border-color .2s, transform .2s;
}
.book:hover { border-color: color-mix(in srgb, var(--tc, var(--accent)) 55%, transparent); transform: translateY(-2px); }
.book-symbol {
  position: absolute; inset-inline-start: -10px; bottom: -40px;
  font: italic 700 170px/1 "Times New Roman", serif;
  color: var(--tc, var(--accent)); opacity: .16; pointer-events: none;
}
.book .grade { color: var(--tc, var(--accent)); font-weight: 600; font-size: 14px; }
.book h2 { font-family: var(--font-display); font-size: 22px; }
.book .meta { margin-top: auto; color: var(--muted); font-size: 14px; }
.meter { height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; background: var(--tc, var(--accent)); border-radius: 3px; }
.book.soon { opacity: .5; pointer-events: none; }
.soon-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.soon-row .tag { margin-inline-end: 4px; }
.soon-chip { padding: 4px 14px; border-radius: 99px; border: 1px dashed color-mix(in srgb, var(--tc) 45%, transparent); color: var(--muted); font-size: 14px; }
.soon-card { padding: 24px; display: grid; gap: 14px; }
.soon-card h3 { color: var(--tc); font-family: var(--font-display); }
.soon-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------------------------------------------------------- book */
.book-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; padding: 8px 0 28px; }
.units { display: grid; gap: 16px; }
.unit { padding: 8px; }
.unit-head { display: flex; align-items: center; gap: 14px; padding: 12px 14px 10px; }
.unit-num {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center;
  background: rgba(255,200,61,.14); color: var(--accent); font-weight: 700;
}
.lessons { list-style: none; margin: 0; padding: 0; }
.lesson-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: var(--radius-sm); text-decoration: none;
}
a.lesson-row:hover { background: var(--surface-2); }
.lesson-row .n { color: var(--faint); font-weight: 600; width: 22px; text-align: center; flex-shrink: 0; }
.lesson-row .t { flex: 1; min-width: 0; }
.lesson-row .p { color: var(--faint); font-size: 13px; white-space: nowrap; }
.status { font-size: 13px; font-weight: 600; padding: 2px 12px; border-radius: 99px; white-space: nowrap; }
.status.ready { background: rgba(255,200,61,.14); color: var(--accent); }
.status.done { background: rgba(74,222,155,.14); color: var(--mint); }
.status.soon { background: rgba(255,255,255,.06); color: var(--faint); }
.lesson-row.soon { color: var(--muted); }

/* ---------------------------------------------------------------- lesson */
.lesson { display: grid; gap: 28px; }
@media (min-width: 920px) {
  .lesson { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .lesson .player { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 90px; }
}
.lesson-head .eyebrow { margin-bottom: 12px; }
.goals { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 6px; color: var(--muted); }
.goals li { display: flex; gap: 10px; align-items: baseline; }
.goals li::before { content: ""; width: 9px; height: 9px; background: var(--accent); flex-shrink: 0; transform: translateY(-2px) rotate(45deg); }

.player { display: grid; gap: 12px; justify-items: center; }
.video-frame {
  width: 100%; max-width: 360px; aspect-ratio: 9 / 16;
  border-radius: 26px; overflow: hidden; background: #000;
  border: 1px solid var(--hair);
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.8);
}
.video-frame video { width: 100%; height: 100%; display: block; object-fit: cover; }
.player .tag { text-align: center; }

.tabs {
  position: sticky; top: 66px; z-index: 5;
  display: flex; gap: 6px; padding: 6px; margin-bottom: 22px;
  border-radius: 99px; background: rgba(14, 23, 48, .92);
  border: 1px solid var(--hair); backdrop-filter: blur(10px);
}
.tabs button {
  flex: 1; min-height: 44px; border: 0; border-radius: 99px; background: transparent;
  color: var(--muted); font-weight: 600; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.tabs .count { font-size: 12px; opacity: .7; margin-inline-start: 4px; }

.panel[hidden] { display: none; }
.panel > * + * { margin-top: 16px; }

/* summary */
.concept { padding: 20px 22px; border-inline-start: 4px solid var(--accent); }
.concept.mint { border-inline-start-color: var(--mint); }
.concept.coral { border-inline-start-color: var(--coral); }
.concept.white { border-inline-start-color: rgba(255,255,255,.6); }
.concept h3 { color: var(--accent); margin-bottom: 4px; }
.concept.mint h3 { color: var(--mint); }
.concept.coral h3 { color: var(--coral); }
.concept.white h3 { color: var(--text); }
.concept p { margin: 0; color: var(--muted); }
.examples { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; justify-content: flex-start; }
.examples .math { background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px 14px; }

/* exercises */
.ex-set { padding: 22px; }
.ex-set-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 14px; }
.ex-set .hint { color: var(--faint); font-size: 14px; margin: -6px 0 14px; }
.ex-list { display: grid; gap: 12px; }
.ex {
  padding: 16px; border-radius: 16px;
  background: rgba(255,255,255,.035); border: 1px solid transparent;
  transition: border-color .2s, background .2s;
}
.ex.ok { border-color: rgba(74,222,155,.55); background: rgba(74,222,155,.07); }
.ex.bad { border-color: rgba(255,107,107,.55); background: rgba(255,107,107,.07); }
.ex-q { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ex-q .qn { color: var(--faint); font-weight: 600; }
.ex-q .qtext { flex: 1; min-width: 220px; }
.ex-q .qmath { font-size: 1.15em; }
.choices { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.choice {
  min-height: 42px; padding: 0 18px; border-radius: 99px; cursor: pointer;
  border: 1.5px solid var(--hair); background: transparent; font-weight: 600;
}
.choice:hover { border-color: rgba(255,255,255,.35); }
.choice.mint { color: var(--mint); }
.choice.coral { color: var(--coral); }
.choice.picked { background: var(--surface-2); border-color: currentColor; }
.ex.ok .choice:not(.picked), .ex.bad .choice:not(.picked) { opacity: .45; }
.answer-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.answer-row input {
  width: 140px; min-height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1.5px solid var(--hair); background: rgba(0,0,0,.25); color: var(--text);
  font: 600 18px var(--font); direction: ltr; text-align: center;
}
.answer-row input:focus { border-color: var(--accent); outline: none; }
.blank-q { display: inline-flex; align-items: center; gap: 12px; direction: ltr; font-size: 1.15em; }
.vfrac { display: inline-grid; justify-items: center; gap: 4px; font-weight: 600; }
.vfrac i { display: block; width: 100%; height: 2px; background: var(--text); border-radius: 1px; }
.vfrac input {
  width: 64px; min-height: 40px; border-radius: 10px; border: 1.5px solid var(--hair);
  background: rgba(0,0,0,.25); color: var(--text); font: 600 18px var(--font); text-align: center;
}
.vfrac input:focus { border-color: var(--accent); outline: none; }
.ex-q .answer-row { margin-top: 0; }
.feedback { margin-top: 10px; font-size: 15px; color: var(--muted); }
.feedback strong { color: var(--text); }
.ex.ok .feedback strong { color: var(--mint); }
.ex.bad .feedback strong { color: var(--coral); }
.reveal { background: none; border: 0; color: var(--faint); text-decoration: underline; cursor: pointer; font-size: 14px; padding: 0 6px; }

/* quiz */
.quiz-intro { padding: 28px; text-align: center; }
.quiz-intro .big { font-size: 56px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.quiz-intro p { color: var(--muted); margin: 8px 0 20px; }
.quiz-card { padding: 24px; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.quiz-card h3 { font-size: 21px; margin: 14px 0 18px; }
.quiz-opts { display: grid; gap: 10px; }
.quiz-opt {
  display: flex; align-items: center; gap: 12px; text-align: start;
  min-height: 56px; padding: 10px 16px; border-radius: 16px; cursor: pointer;
  border: 1.5px solid var(--hair); background: rgba(255,255,255,.03);
}
.quiz-opt:hover:not([disabled]) { border-color: rgba(255,255,255,.35); }
.quiz-opt .letter {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 14px;
}
.quiz-opt.right { border-color: var(--mint); background: rgba(74,222,155,.08); }
.quiz-opt.right .letter { background: var(--mint); color: #062615; }
.quiz-opt.wrong { border-color: var(--coral); background: rgba(255,107,107,.08); }
.quiz-opt.wrong .letter { background: var(--coral); color: #2a0707; }
.quiz-opt[disabled] { cursor: default; }
.quiz-why { margin-top: 14px; padding: 12px 16px; border-radius: 14px; background: rgba(255,255,255,.05); color: var(--muted); }
.quiz-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; }
.result { padding: 32px 24px; text-align: center; }
.ring { --p: 0; width: 160px; height: 160px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--ring, var(--accent)) calc(var(--p) * 1%), rgba(255,255,255,.08) 0); }
.ring > div { width: 128px; height: 128px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: 34px; font-weight: 700; }
.result p { color: var(--muted); }
.result .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.review { text-align: start; margin-top: 24px; display: grid; gap: 8px; }
.review-item { display: flex; gap: 10px; align-items: baseline; padding: 10px 14px; border-radius: 12px; background: rgba(255,255,255,.035); font-size: 15px; }
.review-item .mark { font-weight: 700; flex-shrink: 0; }
.review-item.ok .mark { color: var(--mint); }
.review-item.bad .mark { color: var(--coral); }

.next-up { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; flex-wrap: wrap; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .topbar { gap: 12px; }
  .crumbs { display: none; }
  main { padding-top: 20px; }
  .tabs { top: 64px; }
  .ex-set, .quiz-card { padding: 16px; }
  .ex-q .qtext { min-width: 0; }
  .book-head .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* lesson cover (opens the interactive player) */
.lesson-cover {
  position: relative; width: 100%; max-width: 360px; aspect-ratio: 9 / 14; border-radius: 26px; overflow: hidden;
  display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; text-decoration: none; padding: 24px;
  background-color: #0E1730;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 28px 28px; border: 1px solid var(--hair); box-shadow: 0 30px 80px -30px rgba(0,0,0,.8);
  transition: transform .2s, border-color .2s;
}
.lesson-cover:hover { transform: translateY(-3px); border-color: rgba(255,200,61,.5); }
.lc-kicker { color: var(--sky); font: 600 14px var(--font-display); }
.lc-title { font: 700 34px/1.25 var(--font-display); }
.lc-play { width: 78px; height: 78px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; margin: 10px 0; box-shadow: 0 12px 40px -10px rgba(255,200,61,.65); }
.lc-play svg { width: 32px; height: 32px; fill: var(--accent-ink); margin-left: 4px; }
.lc-meta { color: var(--muted); font-size: 14px; }
.lc-done { position: absolute; top: 14px; inset-inline-start: 14px; background: rgba(61,220,151,.16); color: var(--mint); font-size: 13px; font-weight: 600; padding: 3px 12px; border-radius: 99px; }
@media (max-width: 919px) { .lesson-cover { aspect-ratio: auto; max-width: none; padding: 34px 20px; } .lc-title { font-size: 30px; } }

/* practice: progress + typed fraction answers */
.pr-top { padding: 16px 20px; display: grid; gap: 10px; }
.pr-row { display: flex; justify-content: space-between; align-items: baseline; }
.pr-label { font-weight: 600; }
.pr-count { color: var(--muted); font-family: var(--font-display); }
.pr-count b { color: var(--text); font-size: 20px; }
.pr-top.all .pr-count b { color: var(--mint); }
.meter.mint > i { background: var(--mint); transition: width .4s; }
.ex-set-head { align-items: center; }
.ex-set-head h3 { flex: 1 1 auto; }
.set-score { font-family: var(--font-display); font-size: 14px; color: var(--muted); }
.set-score b { color: var(--text); }
.ex-set.done .set-score b { color: var(--mint); }
.set-reset { border: 1px solid var(--hair); background: transparent; color: var(--muted); border-radius: 99px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.set-reset:hover { color: var(--text); border-color: rgba(255,255,255,.3); }
.ex-head-tag { width: 100%; }

.ex-typed { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.ex-math { display: inline-flex; align-items: center; gap: 10px; direction: ltr; font-size: 1.12em; flex-wrap: nowrap; }
.ex-math .eqs { color: var(--muted); font-weight: 600; }
.ex-actions { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.vfrac input { width: 58px; min-height: 42px; padding: 0 4px; }
.vfrac b { font-family: var(--font-display); }
.sign {
  width: 34px; height: 34px; border-radius: 10px; border: 1.5px dashed var(--hair); background: transparent;
  color: var(--faint); font: 700 20px/1 var(--font-display); cursor: pointer; display: grid; place-items: center;
}
.sign[aria-pressed="true"] { border-style: solid; border-color: var(--coral); color: var(--coral); background: rgba(255,107,107,.1); }
.ex.ok .vfrac input { border-color: var(--mint); color: var(--mint); }
.ex.bad .vfrac input { border-color: var(--coral); }
.choice.answer { border-color: var(--mint) !important; color: var(--mint) !important; opacity: 1 !important; }
.ex.bad .choice.picked { border-color: var(--coral); color: var(--coral); }
.ex .choice { min-width: 88px; }
@media (max-width: 560px) {
  .ex-typed .qn { align-self: flex-start; }
  .ex-math { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .ex-actions { width: 100%; justify-content: flex-start; margin: 0; }
  .ex-actions .btn { flex: 1; }
  .ex-set-head { gap: 4px 10px; }
}

/* ================================================================ landing v2 */
.topnav { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.topnav a:not(.btn) { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 500; }
.topnav a:not(.btn):hover { color: var(--text); background: var(--surface-2); }
.btn.sm { min-height: 38px; padding: 0 16px; font-size: 15px; }
.btn.big { min-height: 54px; padding: 0 28px; font-size: 17px; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn.ghost { background: transparent; }
.crumbs:empty { display: none; }

.landing > section { margin-top: 72px; }
.landing > section:first-child { margin-top: 8px; }
.sec-title { font-family: var(--font-display); font-size: clamp(26px, 4vw, 34px); margin-bottom: 22px; }

/* hero */
.hero2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 48px; align-items: center; padding-top: 24px; }
.hero2 h1 { margin: 16px 0 0; font-size: clamp(34px, 5.4vw, 56px); line-height: 1.22; }
.hero2 h1 span { color: var(--accent); }
.hero2 .lead { font-size: 19px; max-width: 34em; }
.hero2-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero2-points { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-wrap: wrap; gap: 10px 22px; color: var(--muted); font-size: 15px; }
.hero2-points li { display: flex; align-items: center; gap: 8px; }
.hero2-points svg, .sub-list svg { width: 18px; height: 18px; color: var(--mint); flex-shrink: 0; }

/* phone mock (real player styles, static) */
.hero2-visual { display: grid; place-items: center; }
.phone {
  width: min(320px, 100%); aspect-ratio: 9 / 17.5; border-radius: 38px; padding: 12px; position: relative;
  background: #060B18; border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 50px 120px -40px rgba(76,194,255,.25), 0 40px 80px -30px rgba(0,0,0,.9);
  display: grid; grid-template-rows: auto 1fr auto auto; overflow: hidden; transform: rotate(-2deg);
}
.phone::before { content: ""; position: absolute; inset: 12px; border-radius: 28px; background-color: var(--bg);
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 22px 22px; }
.phone > * { position: relative; }
.phone-top { display: flex; justify-content: center; gap: 6px; padding: 18px 0 8px; }
.pd { width: 8px; height: 8px; background: #22325F; transform: rotate(45deg); }
.pd.now { background: var(--accent); transform: rotate(45deg) scale(1.3); }
.phone-stage { width: 100%; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.6cqh; padding: 0 6cqw; }
.phone-stage .lane { padding: 2.4cqh 5cqw; }
.phone-cap { text-align: center; font-size: 13px; color: var(--text); padding: 8px 14px; }
.phone-bar { display: flex; justify-content: center; padding: 8px 0 14px; border-top: 1px solid rgba(255,255,255,.07); }
.pb-play { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; }
.pb-play svg { width: 18px; height: 18px; fill: var(--accent-ink); }

/* how it works */
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.how-card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 24px; }
.how-card h3 { margin: 14px 0 6px; font-size: 20px; }
.how-card p { margin: 0; color: var(--muted); }
.how-n { width: 40px; height: 40px; display: grid; place-items: center; position: relative; font: 700 17px var(--font-display); color: var(--accent-ink); }
.how-n::before { content: ""; position: absolute; inset: 6px; background: var(--accent); transform: rotate(45deg); border-radius: 4px; z-index: -1; }
.how-n { z-index: 0; isolation: isolate; }

/* shelves with covers */
.tracks { display: grid; gap: 44px; }
.track-section { margin-top: 0; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px 18px; }
.book-card { display: grid; gap: 12px; text-decoration: none; color: inherit; }
.book-card .cover { position: relative; display: block; border-radius: 14px; overflow: hidden; aspect-ratio: 3 / 4;
  box-shadow: 0 18px 40px -18px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.08); transition: transform .25s, box-shadow .25s; }
.book-card .cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
a.book-card:hover .cover { transform: translateY(-4px); box-shadow: 0 26px 50px -18px rgba(0,0,0,.9), 0 0 0 1.5px var(--tc); }
.book-card.is-soon .cover img { filter: saturate(.55) brightness(.75); }
.cover-badge { position: absolute; top: 10px; inset-inline-start: 10px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cover-badge.free { background: var(--mint); color: #062615; }
.cover-badge.soon { background: rgba(10,17,36,.75); color: var(--text); border: 1px solid rgba(255,255,255,.18); }
.bc-body { display: grid; gap: 2px; }
.bc-title { font: 700 17px/1.35 var(--font-display); }
.bc-meta { color: var(--muted); font-size: 13px; }
.book-card.is-soon .bc-title { color: var(--muted); }

/* free lessons */
.free-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.free-card { display: flex; align-items: center; gap: 16px; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--hair); text-decoration: none; transition: border-color .2s, background .2s; }
.free-card:hover { border-color: rgba(61,220,151,.5); background: rgba(61,220,151,.05); }
.free-card img { width: 54px; height: 72px; border-radius: 8px; flex-shrink: 0; }
.fc-body { flex: 1; display: grid; gap: 2px; min-width: 0; }
.fc-kicker { color: var(--sky); font-size: 13px; font-weight: 600; }
.fc-title { font: 700 19px var(--font-display); }
.fc-meta { color: var(--muted); font-size: 13px; }
.fc-play { width: 44px; height: 44px; border-radius: 50%; background: var(--mint); display: grid; place-items: center; flex-shrink: 0; }
.fc-play svg { width: 18px; height: 18px; fill: #062615; }

/* subscription */
.sub-card { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; padding: 36px; border-radius: 28px;
  background: linear-gradient(135deg, rgba(255,200,61,.10), rgba(165,139,255,.08) 60%, rgba(76,194,255,.06)); border: 1px solid rgba(255,200,61,.3); }
.sub-card h2 { font-family: var(--font-display); font-size: clamp(28px, 4vw, 38px); margin: 12px 0 0; }
.sub-list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, auto)); gap: 10px 28px; }
.sub-list li { display: flex; align-items: center; gap: 8px; }
.sub-action { display: grid; gap: 12px; justify-items: center; text-align: center; }
.sub-price { color: var(--muted); font-size: 14px; }

/* book page hero with cover */
.book-hero { display: grid; grid-template-columns: 180px 1fr; gap: 28px; align-items: center; padding: 8px 0 30px; }
.book-hero-cover { width: 180px; height: auto; border-radius: 14px; box-shadow: 0 24px 50px -20px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.08); }
.book-hero-text h1 { margin: 12px 0 0; }

.status.free { background: rgba(61,220,151,.14); color: var(--mint); }
.status.locked { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.06); color: var(--muted); }
.status.locked svg { width: 13px; height: 13px; fill: currentColor; }
.lesson-row.locked .t { color: var(--muted); }
.locked-view { max-width: 640px; margin: 40px auto; padding: 40px 28px; text-align: center; display: grid; justify-items: center; gap: 10px; }
.locked-view h1 { font-size: 36px; }
.lock-mark { width: 64px; height: 64px; border-radius: 20px; background: rgba(255,200,61,.14); display: grid; place-items: center; color: var(--accent); }
.lock-mark svg { width: 30px; height: 30px; fill: currentColor; }
.locked-view .hero2-cta { justify-content: center; }

/* responsive */
@media (max-width: 920px) {
  .hero2 { grid-template-columns: 1fr; gap: 36px; }
  .hero2-visual { order: 2; }
  .phone { width: min(280px, 80vw); transform: none; }
  .how-grid { grid-template-columns: 1fr; }
  .sub-card { grid-template-columns: 1fr; }
  .sub-action { justify-items: stretch; }
  .sub-action .btn { width: 100%; }
}
@media (max-width: 680px) {
  .topnav a:not(.btn) { display: none; }
  .landing > section { margin-top: 56px; }
  .hero2-cta .btn { flex: 1 1 100%; }
  .shelf { grid-template-columns: repeat(2, 1fr); gap: 18px 14px; }
  .sub-list { grid-template-columns: 1fr; }
  .sub-card { padding: 26px 20px; }
  .book-hero { grid-template-columns: 110px 1fr; gap: 18px; }
  .book-hero-cover { width: 110px; }
  .book-hero-text h1 { font-size: 28px; }
  .book-hero-text .btn { width: 100%; }
}
@media (max-width: 360px) { .topnav .btn { padding: 0 12px; font-size: 14px; } }

main:focus, main:focus-visible { outline: none; }
.hero2 h1 span { white-space: nowrap; }
.phone-stage { gap: 14px; padding: 0 14px; }
.phone-stage .h-sm { font-size: 13px; }
.phone-stage .h-lg { font-size: 25px; }
.phone-stage .lane { width: 100%; gap: 10px; padding: 14px 16px; border-radius: 18px; }
.phone-stage .eq.mid { font-size: 30px; }
.phone-stage .frac.sm { font-size: 22px; }
.phone-stage .pill { font-size: 13px; }
@media (max-width: 920px) { .phone-stage .h-lg { font-size: 22px; } .phone-stage .eq.mid { font-size: 26px; } }

.chip { justify-self: start; margin-top: 4px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.chip.free { background: rgba(61,220,151,.16); color: var(--mint); }
.chip.soon { background: rgba(255,255,255,.06); color: var(--muted); }
.book-hero { grid-template-areas: "cover text" "cover cta"; }
.book-hero-cover { grid-area: cover; }
.book-hero-text { grid-area: text; }
.book-hero-cta { grid-area: cta; align-self: start; }
.book-hero-cta .btn { margin-top: 0; }
@media (max-width: 680px) {
  .book-hero { grid-template-areas: "cover text" "cta cta"; }
  .book-hero-cta .btn { width: 100%; }
}

#books, #subscribe { scroll-margin-top: 84px; }

.ex-math .fi { width: 84px; min-height: 44px; border-radius: 12px; border: 1.5px solid var(--hair); background: rgba(0,0,0,.25); color: var(--text); font: 600 20px var(--font-display); text-align: center; }
.ex-math .fi:focus { border-color: var(--accent); outline: none; }
.ex.ok .fi { border-color: var(--mint); color: var(--mint); }
.ex.bad .fi { border-color: var(--coral); }
.in-rad { display: inline-flex; align-items: stretch; direction: ltr; color: var(--text, #fff); }
.in-rad .rs { font: 500 2.1em/1 "Readex Pro", sans-serif; margin-inline-end: -.06em; align-self: center; }
.in-rad .fi { border-top: 3px solid currentColor; border-top-left-radius: 0; border-top-right-radius: 0; }
.in-pow { display: inline-flex; align-items: flex-start; direction: ltr; gap: .1em; }
.in-pow > .in-exp { display: inline-flex; align-items: center; gap: 4px; transform: translateY(-.55em); }
.in-pow .fi { width: 3.2em; height: 2.1em; font-size: .85em; }
.in-pow .sign { width: 1.9em; height: 1.9em; font-size: .8em; }
.concept .math { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; padding-block: .15em; }
.lesson-head .eyebrow { white-space: normal; max-width: 100%; line-height: 1.5; }
.lesson > * { min-width: 0; }
.fi-wrap { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.ex-list > .ex { min-width: 0; }
.choice { unicode-bidi: plaintext; }

/* English book: [[…]] spans inside Arabic text, English option text, typed-word answers */
.en { direction: ltr; unicode-bidi: isolate; font-family: var(--font); display: inline-block; max-width: 100%; }
.ex-word .qtext { flex-basis: 100%; }
.ex-word .ex-actions { margin-inline-start: 0; width: 100%; gap: 8px; }
.ex-word .fw { flex: 1; min-width: 0; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--hair); background: rgba(0,0,0,.25); color: var(--text); font: 600 18px var(--font); text-align: left; }
.ex-word .fw:focus { border-color: var(--accent); outline: none; }
.ex.ok .fw { border-color: var(--mint); color: var(--mint); }
.ex.bad .fw { border-color: var(--coral); }
.choice .en { font-weight: 600; }
