/* Ayahwise: mobile-first styles.

   Brand system (full guidelines: docs/ARCHITECTURE.md, "Design system")
   - Mark: the ayah verse marker holding a lamp flame (app/branding.py draws it).
   - Colour: Mushaf green #0A3D11 is the anchor, lamp gold #E0BA22 is the light
     (reward, progress, the flame). Neutrals are tinted green so greys never clash.
     Blue is not a brand colour any more: it appears only among the game tiles.
   - Roles: green = main actions, links, focus and success; gold = reward,
     progress, hints ("light") and the main action on green or dark surfaces;
     ink = selection.
   - Type: Delius (display: wordmark, headings, celebrations) for warmth,
     Figtree (interface and reading) for clarity and trust, Amiri Quran for verses.
   - Shape: pill buttons and chips; inputs 14px; answer options 16px; cards 24px.
     Buttons keep a small tactile edge and press down.
   - Light and dark themes follow the system setting.
*/

@font-face {
  font-family: "Delius";
  src: url("../fonts/Delius-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("../fonts/Figtree-Variable.ttf") format("truetype");
  font-weight: 300 900;
  font-display: swap;
}
@font-face {
  font-family: "Amiri Quran";
  src: url("../fonts/AmiriQuran-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Brand */
  --brand-green: #0A3D11;
  --brand-green-700: #14592A;
  --brand-gold: #E0BA22;
  --brand-gold-deep: #BA9917;
  --brand-ink: #0F1D16;
  --brand-parchment: #FAF8F1;
  --brand-blue: #2B63E8; /* game tiles only */

  /* Roles */
  --primary: var(--brand-green);
  --primary-hover: #0F4D18;
  --primary-lip: #041F07;
  --on-primary: #FFFFFF;
  --highlight: var(--brand-gold);
  --highlight-hover: #E9C53F;
  --highlight-lip: var(--brand-gold-deep);
  --on-highlight: var(--brand-ink);
  --highlight-soft: #FBF3D2;
  --highlight-ink: #6B560A;
  --info: var(--brand-ink);           /* selection */
  --info-soft: rgba(15, 29, 22, 0.06);
  --info-ink: var(--brand-ink);
  --focus: #2F7D3B;
  --link: var(--brand-green-700);
  --link-hover: var(--brand-green);
  --success: #2F7D3B;
  --success-soft: #E3F1E4;
  --success-ink: #14592A;
  --danger: #B42318;
  --danger-soft: #FCEBEA;
  --danger-ink: #8F1D14;

  /* Neutrals (tinted toward the green) */
  --canvas: #F4F6F1;
  --surface: #FFFFFF;
  --surface-2: #F7F9F4;
  --text: var(--brand-ink);
  --text-muted: #4B5B52;
  --text-subtle: #5E6E65;
  --line: rgba(15, 29, 22, 0.09);
  --line-strong: rgba(15, 29, 22, 0.17);
  --arabic-display: var(--brand-green);
  --hint-underline: rgba(186, 153, 23, 0.6);
  --new-underline: rgba(47, 125, 59, 0.7);
  --header-bg: rgba(255, 255, 255, 0.82);
  --header-line: rgba(15, 29, 22, 0.08);
  --on-green: #FFFFFF;
  --on-green-muted: rgba(255, 255, 255, 0.8);
  --overlay: rgba(6, 20, 12, 0.45);
  --bar-bg: rgba(244, 246, 241, 0.92);

  /* Depth (shadows tinted green, one light source from above) */
  --shadow-sm: 0 0 0 1px rgba(15, 29, 22, 0.05), 0 1px 2px rgba(10, 61, 17, 0.06);
  --shadow-md: 0 0 0 1px rgba(15, 29, 22, 0.05), 0 2px 4px rgba(10, 61, 17, 0.04), 0 14px 36px -16px rgba(10, 61, 17, 0.2);
  --shadow-lg: 0 0 0 1px rgba(15, 29, 22, 0.06), 0 30px 70px -28px rgba(10, 61, 17, 0.38);

  /* Shape */
  --r-sm: 10px;
  --r-md: 14px;
  --r-option: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-pill: 999px;

  /* Space */
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.25rem; --s-6: 1.5rem;
  --s-8: 2rem; --s-10: 2.5rem; --s-12: 3rem; --s-16: 4rem; --s-20: 5rem;

  /* Type */
  --ui: "Figtree", "Segoe UI", system-ui, sans-serif;
  --display: "Delius", "Figtree", system-ui, sans-serif;
  --arabic: "Amiri Quran", "Scheherazade New", "Noto Naskh Arabic", "Traditional Arabic", serif;
  --fs-xs: .8125rem;
  --fs-sm: .9375rem;
  --fs-base: 1.0625rem;
  --fs-lg: 1.1875rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: clamp(2rem, 1.35rem + 2.6vw, 2.75rem);
  --fs-display: clamp(2.35rem, 1.5rem + 2.8vw, 3.35rem);

  /* Motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-press: cubic-bezier(.3, .7, .4, 1);
  --dur-fast: 140ms;
  --dur: 220ms;
  --dur-slow: 520ms;

  --tap: 48px;
  --container: 1120px;

  /* Layers */
  --z-header: 20;
  --z-actionbar: 30;
  --z-sheet: 40;
  --z-consent: 50;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    /* On dark surfaces the lamp gold leads. */
    --primary: var(--brand-gold);
    --primary-hover: #E9C53F;
    --primary-lip: #8A700E;
    --on-primary: var(--brand-ink);
    --highlight-soft: rgba(224, 186, 34, 0.14);
    --highlight-ink: #EDCD58;
    --info: #EAF0EA;
    --info-soft: rgba(234, 240, 234, 0.08);
    --info-ink: #EAF0EA;
    --focus: var(--brand-gold);
    --link: #9FD3A8;
    --link-hover: #C7E8CC;
    --success: #5DB06B;
    --success-soft: rgba(93, 176, 107, 0.16);
    --success-ink: #A9DDB1;
    --danger: #EE6B5F;
    --danger-soft: rgba(238, 107, 95, 0.15);
    --danger-ink: #FFB0A8;

    --canvas: #0B1510;
    --surface: #111D17;
    --surface-2: #16241C;
    --text: #EAF0EA;
    --text-muted: #A7B5AD;
    --text-subtle: #879890;
    --line: rgba(234, 240, 234, 0.09);
    --line-strong: rgba(234, 240, 234, 0.18);
    --arabic-display: #F3E7BF;
    --hint-underline: rgba(224, 186, 34, 0.5);
    --new-underline: rgba(159, 211, 168, 0.8);
    --header-bg: rgba(17, 29, 23, 0.82);
    --header-line: rgba(234, 240, 234, 0.08);
    --overlay: rgba(0, 0, 0, 0.6);
    --bar-bg: rgba(11, 21, 16, 0.9);

    --shadow-sm: 0 0 0 1px rgba(234, 240, 234, 0.06);
    --shadow-md: 0 0 0 1px rgba(234, 240, 234, 0.07), 0 16px 40px -18px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 0 0 1px rgba(234, 240, 234, 0.08), 0 28px 64px -24px rgba(0, 0, 0, 0.8);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--ui);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--canvas);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
/* Sprite icons. Without a size an inline SVG falls back to 300 x 150 and spills out of its button. */
svg.icon { width: 1.2em; height: 1.2em; flex: none; vertical-align: -0.22em; fill: currentColor; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color var(--dur) var(--ease-out); }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.18; margin: 0 0 .5em; font-weight: 400; letter-spacing: -0.012em; text-wrap: balance; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 1em; text-wrap: pretty; }
strong, b { font-weight: 600; }
small, .muted { color: var(--text-muted); }
.visually-hidden:not(:focus):not(:active) {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
a.visually-hidden:focus {
  position: fixed; top: .5rem; left: .5rem; z-index: 100; padding: .5rem 1rem;
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}
.tnum { font-variant-numeric: tabular-nums; }
/* Arabic inside English text: the Quranic face is optically smaller, so it is set larger. */
:where(p, li, small, td, span.kw-meaning) > [lang="ar"] { font-size: 1.3em; line-height: 1.2; white-space: nowrap; }

[lang="ar"], .ar {
  font-family: var(--arabic);
  direction: rtl;
  unicode-bidi: isolate;
  font-feature-settings: "kern", "liga", "calt";
  letter-spacing: 0;
}

/* ---------- Header: a floating island ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  padding: max(.625rem, env(safe-area-inset-top)) .75rem 0;
}
.site-header .bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  max-width: var(--container);
  margin: 0 auto;
  padding: .375rem .5rem .375rem .75rem;
  min-height: 56px;
  border-radius: var(--r-pill);
  background: var(--header-bg);
  box-shadow: inset 0 0 0 1px var(--header-line), 0 10px 30px -18px rgba(10, 61, 17, 0.35);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
}
.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--arabic-display);
  text-decoration: none;
  margin-right: auto;
  border-radius: var(--r-pill);
}
.brand:hover { color: var(--arabic-display); }
.brand-mark { width: 34px; height: 34px; flex: none; display: block; }
.brand-mark.on-dark { display: none; }
.brand-text { font-family: var(--display); font-size: 1.32rem; letter-spacing: -0.01em; white-space: nowrap; line-height: 1; padding-bottom: 2px; }
.nav { display: flex; gap: .125rem; align-items: center; }
.nav a, .nav button.linklike {
  color: var(--text-muted);
  text-decoration: none;
  padding: .5rem .85rem;
  border-radius: var(--r-pill);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.nav a:hover, .nav button.linklike:hover { background: var(--info-soft); color: var(--text); }
.nav a[aria-current="page"] { background: var(--brand-green); color: #fff; }
.nav form { margin: 0; }
button.linklike { background: none; border: 0; cursor: pointer; padding: 0; font: inherit; color: var(--link); }
@media (prefers-color-scheme: dark) {
  .brand-mark.on-light { display: none; }
  .brand-mark.on-dark { display: block; }
  .nav a[aria-current="page"] { background: var(--brand-gold); color: var(--brand-ink); }
}

main.page {
  flex: 1;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--s-6) 1rem var(--s-16);
}
main.narrow { max-width: 640px; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: var(--s-10) 1rem calc(var(--s-8) + env(safe-area-inset-bottom));
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.site-footer .inner {
  max-width: var(--container); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center;
}
.site-footer .footer-brand { display: inline-flex; align-items: center; gap: .5rem; color: var(--arabic-display); margin-right: auto; font-family: var(--display); font-size: var(--fs-lg); }
.site-footer .footer-brand img { width: 24px; height: 24px; }
.site-footer .footer-brand .on-dark { display: none; }
@media (prefers-color-scheme: dark) { .site-footer .footer-brand .on-light { display: none; } .site-footer .footer-brand .on-dark { display: block; } }
.site-footer a, .site-footer button.linklike { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover, .site-footer button.linklike:hover { color: var(--text); }
.site-footer form { margin: 0; }
.site-footer .attribution { flex-basis: 100%; font-size: var(--fs-xs); color: var(--text-subtle); margin: var(--s-2) 0 0; }

.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: var(--s-5);
  margin-bottom: var(--s-4);
}
.card.flat { box-shadow: var(--shadow-sm); }
.card > :last-child { margin-bottom: 0; }
.grid { display: grid; gap: var(--s-4); }
@media (min-width: 720px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.three { grid-template-columns: repeat(3, 1fr); }
  main.page { padding-top: var(--s-10); }
  h1 { font-size: var(--fs-3xl); }
  .card { padding: var(--s-6) var(--s-8); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: var(--tap);
  padding: .7rem 1.5rem;
  border-radius: var(--r-pill);
  border: 0;
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--primary-lip), 0 8px 18px -10px rgba(10, 61, 17, 0.45);
  transition: transform var(--dur-fast) var(--ease-press), box-shadow var(--dur-fast) var(--ease-press),
              background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--primary-lip); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
/* "Please wait": the button that sent a slow request (AW.wait in app.js). It keeps its full colour, so it
   reads as working rather than disabled, with dots that count up and a soft light passing across. */
.btn.is-waiting { position: relative; overflow: hidden; opacity: 1; cursor: progress; transform: none; }
.btn.is-waiting::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, 0.22) 50%, transparent 75%);
  transform: translateX(-100%); animation: shimmer 1.6s var(--ease-out) infinite;
}
.btn.ghost.is-waiting::after { background: linear-gradient(100deg, transparent 25%, var(--info-soft) 50%, transparent 75%); }
.wait-label { display: inline-flex; align-items: baseline; white-space: nowrap; }
.wait-dots { display: inline-block; text-align: left; letter-spacing: .04em; }
.wait-dots.balance { visibility: hidden; }
.wait-dots i { font-style: normal; animation: 1.6s linear infinite; }
.wait-dots i:nth-child(1) { animation-name: wait-dot-1; }
.wait-dots i:nth-child(2) { animation-name: wait-dot-2; }
.wait-dots i:nth-child(3) { animation-name: wait-dot-3; }
@keyframes wait-dot-1 { 0%, 24.9% { opacity: 0; } 25%, 100% { opacity: 1; } }
@keyframes wait-dot-2 { 0%, 49.9% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes wait-dot-3 { 0%, 74.9% { opacity: 0; } 75%, 100% { opacity: 1; } }
.wait-note { flex-basis: 100%; margin: var(--s-2) 0 0; text-align: center; font-size: var(--fs-sm); color: var(--text-muted); }
.btn .icon { width: 1.15em; height: 1.15em; }
/* A trailing arrow sits in its own round well and nudges forward on hover. */
.btn .go {
  display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; margin-right: -.85rem; border-radius: 50%;
  background: rgba(255, 255, 255, 0.16); transition: transform var(--dur) var(--ease-out);
}
.btn:hover .go { transform: translateX(2px); }
.btn.gold { background: var(--highlight); color: var(--on-highlight); box-shadow: 0 3px 0 var(--highlight-lip), 0 8px 18px -10px rgba(186, 153, 23, 0.6); }
.btn.gold:hover { background: var(--highlight-hover); color: var(--on-highlight); }
.btn.gold:active { box-shadow: 0 1px 0 var(--highlight-lip); }
.btn.gold .go { background: rgba(15, 29, 22, 0.1); }
/* "blue" is the older secondary emphasis (e.g. Continue after a wrong answer): now the deep green. */
.btn.blue { background: var(--brand-green-700); color: #fff; box-shadow: 0 3px 0 var(--primary-lip); }
.btn.blue:hover { background: var(--brand-green); color: #fff; }
.btn.ghost {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1.5px var(--line-strong), 0 2px 0 var(--line-strong);
}
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.ghost:active { box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn.ghost[disabled] { box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost .go { background: var(--info-soft); }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: .45rem 1.1rem; font-size: var(--fs-sm); }
.btn.suggested { outline: 2.5px solid var(--focus); outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  .btn.blue { background: #1F6B2A; }
  .btn .go, .btn.gold .go { background: rgba(15, 29, 22, 0.14); }
}

/* ---------- Forms ---------- */
.form-row { margin-bottom: var(--s-5); }
label { display: block; margin-bottom: .375rem; font-size: var(--fs-sm); font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], textarea {
  width: 100%;
  min-height: var(--tap);
  padding: .7rem .9rem;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  font: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
input:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 4px rgba(47, 125, 59, 0.16); }
input[aria-invalid="true"] { border-color: var(--danger); }
input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px var(--danger-soft); }
.form-help { font-size: var(--fs-xs); color: var(--text-muted); margin: .375rem 0 0; }
.check { display: flex; gap: .6rem; align-items: center; }
.check label { margin: 0; font-size: var(--fs-base); }
.check input { width: 24px; height: 24px; flex: none; accent-color: var(--brand-green); }
.check.top { align-items: flex-start; }
.check.top label { line-height: 1.5; }
.errors { color: var(--danger-ink); font-size: var(--fs-sm); margin: .375rem 0 0; padding: 0; list-style: none; }

.flash {
  border-radius: var(--r-md); padding: .8rem 1rem; margin-bottom: var(--s-4);
  background: var(--info-soft); color: var(--info-ink); box-shadow: inset 3px 0 0 var(--info);
}
.flash.success { background: var(--success-soft); color: var(--success-ink); box-shadow: inset 3px 0 0 var(--success); }
.flash.error { background: var(--danger-soft); color: var(--danger-ink); box-shadow: inset 3px 0 0 var(--danger); }

/* ---------- Landing ---------- */
.lp-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(224, 186, 34, 0.16), transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(255, 255, 255, 0.06), transparent 60%),
    var(--brand-green);
  color: #fff;
  border-radius: var(--r-xl);
  padding: var(--s-8) var(--s-5);
  display: grid;
  gap: var(--s-8);
  margin-bottom: var(--s-12);
}
.lp-hero h1 {
  font-size: var(--fs-display);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-4);
  color: #fff;
}
.lp-hero .lede { color: rgba(255, 255, 255, 0.86); font-size: var(--fs-lg); max-width: 32rem; margin-bottom: var(--s-6); }
.lp-hero .actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-5); }
.lp-hero .reassure { color: rgba(255, 255, 255, 0.72); font-size: var(--fs-sm); margin: 0; }
.lp-verse {
  margin: 0;
  align-self: center;
  background: rgba(4, 31, 8, 0.34);
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  padding: var(--s-6) var(--s-5) var(--s-5);
  text-align: center;
}
.lp-verse .ayah { font-size: clamp(1.9rem, 6.5vw, 2.6rem); line-height: 2.1; color: var(--brand-gold); margin: 0 0 var(--s-3); }
.lp-verse .translation { color: rgba(255, 255, 255, 0.9); margin: 0 0 var(--s-2); }
.lp-verse .ref { color: rgba(255, 255, 255, 0.6); font-size: var(--fs-sm); margin: 0; }
@media (min-width: 880px) {
  .lp-hero { grid-template-columns: 1.1fr .9fr; align-items: center; padding: var(--s-16) var(--s-12); gap: var(--s-12); }
}

.lp-section { margin: 0 0 var(--s-16); }
.lp-section > h2 { font-size: var(--fs-3xl); line-height: 1.12; letter-spacing: -0.015em; max-width: 22ch; margin-bottom: var(--s-3); }
.lp-section > .lede { color: var(--text-muted); font-size: var(--fs-lg); max-width: 38rem; margin-bottom: var(--s-8); }
.eyebrow { color: var(--highlight-ink); font-size: var(--fs-sm); margin: 0 0 var(--s-2); }

.lp-path { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); counter-reset: step; }
.lp-path li {
  counter-increment: step;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: var(--s-5);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-1) var(--s-4);
  align-items: start;
  align-content: start;
}
.lp-path li::before {
  content: counter(step);
  grid-row: span 3;
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--highlight-soft); color: var(--highlight-ink); font-size: var(--fs-sm);
}
.lp-path .count { font-family: var(--display); font-size: var(--fs-2xl); line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.lp-path h3 { margin: 0; font-size: var(--fs-lg); }
.lp-path p { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }
@media (min-width: 880px) {
  .lp-path { grid-template-columns: repeat(4, 1fr); gap: var(--s-4); }
  .lp-path li { grid-template-columns: 1fr; }
  .lp-path li::before { grid-row: auto; margin-bottom: var(--s-3); }
  .lp-path li:nth-child(4) { background: var(--brand-green); color: #fff; box-shadow: var(--shadow-lg); }
  .lp-path li:nth-child(4) h3, .lp-path li:nth-child(4) .count { color: #fff; }
  .lp-path li:nth-child(4) p { color: rgba(255, 255, 255, 0.78); }
  .lp-path li:nth-child(4)::before { background: var(--brand-gold); color: var(--brand-ink); }
}

.lp-split { display: grid; gap: var(--s-8); align-items: start; }
@media (min-width: 880px) { .lp-split { grid-template-columns: .9fr 1.1fr; gap: var(--s-12); } }
.milestone-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.milestone-list li {
  display: inline-flex; align-items: baseline; gap: .5rem;
  background: var(--surface); border-radius: var(--r-pill); box-shadow: var(--shadow-sm);
  padding: .45rem .95rem; font-size: var(--fs-sm);
}
.milestone-list li small { color: var(--text-subtle); font-size: var(--fs-xs); }
.milestone-list li.first { background: var(--highlight-soft); box-shadow: none; color: var(--highlight-ink); }

.trust-grid { display: grid; gap: var(--s-4); }
@media (min-width: 720px) { .trust-grid { grid-template-columns: 1.3fr 1fr; } }
.trust-sources { list-style: none; margin: 0; padding: 0; }
.trust-sources li { padding: var(--s-4) 0; border-top: 1px solid var(--line); }
.trust-sources li:first-child { border-top: 0; padding-top: 0; }
.trust-sources strong { display: block; font-weight: 400; color: var(--text); }
.trust-sources span { color: var(--text-muted); font-size: var(--fs-sm); }
.promise { background: var(--highlight-soft); color: var(--text); }
.promise h3 { color: var(--highlight-ink); }
.promise ul { margin: 0; padding-left: 1.1rem; }
.promise li { margin-bottom: var(--s-2); }

.lp-cta {
  text-align: center; padding: var(--s-12) var(--s-5);
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-md);
}
.lp-cta .ar { display: block; font-size: 2.1rem; line-height: 2.3; margin-bottom: var(--s-3); color: var(--arabic-display); }
.lp-cta h2 { font-size: var(--fs-3xl); margin-bottom: var(--s-3); }
.lp-cta p { color: var(--text-muted); max-width: 30rem; margin: 0 auto var(--s-6); }

/* Old landing classes (kept for compatibility) */
.hero { background: var(--brand-green); color: #fff; border-radius: var(--r-xl); padding: var(--s-8) var(--s-5); text-align: center; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 2.6rem; margin-bottom: .9rem; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: var(--highlight-soft); color: var(--highlight-ink);
  display: grid; place-items: center; font-size: var(--fs-sm);
}

/* Reveal on scroll (app.js): only elements outside the first view are hidden, then fade up. */
.reveal-pending { opacity: 0; transform: translateY(18px); }
.reveal-in { transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }

/* ---------- Dashboard ---------- */
.welcome { margin-bottom: var(--s-6); }
.welcome h1 { margin-bottom: var(--s-1); }
.welcome p { margin: 0; }
.dash { display: grid; gap: var(--s-4); align-items: start; }
.dash > .col { display: grid; gap: var(--s-4); }
.dash .card { margin-bottom: 0; }
@media (min-width: 900px) { .dash { grid-template-columns: 1.55fr 1fr; gap: var(--s-6); } .dash > .col { gap: var(--s-6); } }

.cta-card {
  background:
    radial-gradient(100% 120% at 100% 0%, rgba(224, 186, 34, 0.18), transparent 55%),
    var(--brand-green);
  color: #fff;
}
.cta-card h2 { color: #fff; font-size: var(--fs-2xl); margin-bottom: var(--s-2); }
.cta-card .muted, .cta-card p { color: rgba(255, 255, 255, 0.82); }
.cta-card .btn.gold { margin-top: var(--s-2); }
.cta-card .btn.ghost { color: #fff; background: transparent; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.5); }

.onboard-steps { list-style: none; margin: var(--s-4) 0 var(--s-2); padding: 0; display: grid; gap: var(--s-3); counter-reset: ob; }
.onboard-steps li { counter-increment: ob; display: grid; grid-template-columns: 1.9rem 1fr; gap: 0 var(--s-3); align-items: start; color: rgba(255, 255, 255, 0.9); }
.onboard-steps li > * { grid-column: 2; }
.onboard-steps li::before {
  grid-column: 1; grid-row: 1 / span 2;
  content: counter(ob); width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 255, 255, 0.14); color: #fff; font-size: var(--fs-sm);
}
.onboard-steps strong { display: block; font-weight: 400; color: #fff; }
.onboard-steps span { font-size: var(--fs-sm); color: rgba(255, 255, 255, 0.72); }

.stat { display: flex; align-items: baseline; gap: .4rem; }
.stat strong { font-family: var(--display); font-size: 1.9rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); }
.stage { display: grid; grid-template-columns: 2.5rem 1fr; gap: var(--s-3); align-items: center; }
.stage strong { font-weight: 400; }
.stage .icon {
  width: 2.5rem; height: 2.5rem; border-radius: 12px; display: grid; place-items: center;
  background: var(--highlight-soft); color: var(--highlight-ink); font-family: var(--arabic); font-size: 1.3rem;
}
.stage.locked .icon { background: var(--surface-2); color: var(--text-subtle); box-shadow: inset 0 0 0 1px var(--line); }
.stage.locked { color: var(--text-muted); }
.meter { height: 8px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; margin-top: .3rem; }
.meter > span { display: block; height: 100%; background: var(--highlight); border-radius: inherit; }
.meter.green > span { background: var(--success); }

.level-box { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.level-box > div:last-child { flex: 1 1 12rem; min-width: 0; }
.level-badge {
  min-width: 3rem; height: 3rem; border-radius: 16px; background: var(--highlight); color: var(--on-highlight);
  display: grid; place-items: center; font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 -2px 0 var(--highlight-lip);
}
/* A level chosen for the next lesson, not yet in use. */
.level-badge.pending {
  background: var(--highlight-soft); color: var(--highlight-ink);
  box-shadow: none; outline: 2px dashed var(--highlight); outline-offset: -2px;
}
.level-status p { margin: 0; }
.level-pending { background: var(--highlight-soft); border-radius: 12px; padding: var(--s-2) var(--s-3); }
.level-pending strong { color: var(--highlight-ink); }
.level-status .flash { margin: var(--s-2) 0 0; }
.next-level-note { margin: var(--s-2) 0 0; font-size: var(--fs-sm); }
.next-level-note a { color: inherit; }
.level-controls { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip {
  display: inline-flex; flex-direction: column; align-items: center;
  border-radius: var(--r-md); padding: .35rem .8rem; background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.chip .ar { font-size: 1.45rem; line-height: 1.8; }
.chip small { font-size: var(--fs-xs); }
a.link-chip { color: inherit; text-decoration: none; min-height: var(--tap); justify-content: center; transition: box-shadow var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out); }
a.link-chip:hover { box-shadow: inset 0 0 0 1.5px var(--info); background: var(--surface); }
a.link-chip small { color: var(--link); }
.card-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.card-title-row a { font-size: var(--fs-sm); white-space: nowrap; }

/* ---------- Progress page ---------- */
details.unit { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-sm); margin-bottom: var(--s-2); }
details.unit > summary {
  cursor: pointer; padding: .9rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  list-style: none; border-radius: var(--r-md); transition: background-color var(--dur) var(--ease-out);
}
details.unit > summary:hover { background: var(--surface-2); }
details.unit > summary::-webkit-details-marker { display: none; }
details.unit[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--r-md) var(--r-md) 0 0; }
.word-table { width: 100%; border-collapse: collapse; }
.word-table td { padding: .55rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.word-table tr:last-child td { border-bottom: 0; }
.word-table .ar { font-size: 1.5rem; line-height: 1.9; white-space: nowrap; }
.pill { display: inline-block; font-size: var(--fs-xs); padding: .15rem .6rem; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-muted); white-space: nowrap; box-shadow: inset 0 0 0 1px var(--line); }
.pill.learning { background: var(--info-soft); color: var(--info-ink); box-shadow: none; }
.pill.learned { background: var(--highlight-soft); color: var(--highlight-ink); box-shadow: none; }
.pill.mastered { background: var(--success-soft); color: var(--success-ink); box-shadow: none; }

/* ---------- Learning session (focus mode: no site header or footer) ---------- */
body.learning-mode .site-header, body.learning-mode .site-footer { display: none; }
body.learning-mode main.page { padding-top: max(.625rem, env(safe-area-inset-top)); padding-bottom: 10rem; }

/* The focus-mode top bar (lessons, reading, quiz, game): the same floating glass island as the
   site header, so leaving is always one tap away, even halfway down a long exercise.
   Inside it: a quiet round exit, the progress, and a status chip, all 44px and concentric. */
.session-top, .play-top {
  position: sticky; top: max(.625rem, env(safe-area-inset-top)); z-index: var(--z-header);
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 56px; padding: .375rem; margin: 0 0 var(--s-4);
  border-radius: var(--r-pill);
  background: var(--header-bg);
  box-shadow: inset 0 0 0 1px var(--header-line), 0 10px 30px -18px rgba(10, 61, 17, 0.35);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
}
.session-progress { flex: 1; min-width: 0; height: 8px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; }
.session-progress > span {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(180deg, #EDCB45, var(--brand-gold));
  transition: width var(--dur-slow) var(--ease-out);
}
.level-pill {
  display: inline-flex; align-items: center; gap: .3rem; flex: none; min-height: 44px; padding: 0 1rem;
  font-size: var(--fs-sm); font-weight: 600; line-height: 1; white-space: nowrap;
  background: var(--highlight-soft); color: var(--highlight-ink); border-radius: var(--r-pill);
}
button.level-pill {
  border: 0; font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; padding-right: .75rem;
  transition: transform var(--dur-fast) var(--ease-press);
}
button.level-pill:active { transform: scale(.96); }
.level-pill .icon { width: 14px; height: 14px; opacity: .8; transition: transform var(--dur) var(--ease-out); }
.level-pill[aria-expanded="true"] .icon { transform: rotate(180deg); }
/* Exit: a soft round well with a fine cross. Easy to find, never louder than the lesson. */
.icon-btn {
  flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; font: inherit; text-decoration: none;
  background: var(--info-soft); color: var(--text-muted);
  transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out), transform var(--dur-fast) var(--ease-press);
}
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--line); color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.level-pill:focus-visible, .icon-btn:focus-visible { border-radius: var(--r-pill); }

.exercise { text-align: center; }
.exercise.enter { animation: rise var(--dur-slow) var(--ease-out) both; }
.exercise .kicker, .kicker { font-size: var(--fs-sm); color: var(--highlight-ink); margin: 0 0 var(--s-1); }
.kicker::first-letter { text-transform: uppercase; }
.exercise .prompt { font-size: var(--fs-lg); margin-bottom: var(--s-4); }
/* Amiri Quran's marks below the line (a kasra under a low letter) reach up to 0.3em under the line box,
   measured over every course word, so the bottom padding keeps them clear of whatever comes next. */
.word-display {
  font-size: clamp(3rem, 14vw, 4.6rem);
  line-height: 1.9;
  margin: .25rem 0 .25rem;
  padding-bottom: .32em;
  color: var(--arabic-display);
}
.word-display.medium { font-size: clamp(2.2rem, 10vw, 3.2rem); }
/* An English word to find in Arabic: a quiet lead-in, then the word once, as the card's focal point. */
.question { margin: var(--s-2) 0 var(--s-6); font-family: var(--ui); font-size: inherit; letter-spacing: 0; }
.question-lead { display: block; font-size: var(--fs-base); line-height: 1.4; color: var(--text-muted); margin-bottom: var(--s-2); }
.question-term {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.875rem, 1.45rem + 2vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--arabic-display);
  text-wrap: balance;
  overflow-wrap: break-word;
}
.meta-line { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--s-3); }
.vocab-image { margin: .5rem auto 1rem; max-width: 320px; }
.vocab-image img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-md); }
.vocab-image figcaption { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }

.text-display {
  font-size: clamp(1.9rem, 8vw, 2.6rem);
  line-height: 2.25;
  margin: .5rem 0 1rem;
  word-spacing: .12em;
}
.text-display .w {
  display: inline-block;
  padding: 0 .12em;
  border-radius: 10px;
  cursor: pointer;
  border: 0;
  border-bottom: 2px dotted var(--hint-underline);
  color: var(--text);
  background: none;
  font: inherit;
  line-height: inherit;
  transition: background-color var(--dur) var(--ease-out);
}
.text-display .w:hover { background: var(--highlight-soft); }
.text-display .w.hinted { background: var(--info-soft); }
.text-display .w.highlight { background: var(--brand-gold); color: var(--brand-ink); border-bottom-color: transparent; }
.text-display .w.correct { background: var(--success-soft); color: var(--success-ink); }
.text-display .w.wrong { background: var(--danger-soft); color: var(--danger-ink); }
.text-display .w.missed { background: var(--highlight-soft); }
.text-display.no-hints .w { border-bottom-style: solid; border-bottom-color: transparent; }
.ref-line { font-size: var(--fs-sm); color: var(--text-muted); margin-top: -.5rem; margin-bottom: var(--s-4); }

.milestone-card .kicker, .reading-card .kicker { margin: 0; }
.milestone-card h2, .reading-card h2 { margin-top: .1rem; }
.milestone-card progress { margin: .25rem 0 .5rem; }
.milestone-card > :last-child { margin-bottom: 0; }
.milestone-title { font-size: var(--fs-2xl); color: var(--arabic-display); margin: .25rem 0 .5rem; }
.milestone-verse { border-top: 1px solid var(--line); padding-top: var(--s-3); margin-top: var(--s-3); }
.milestone-verse .text-display { margin-bottom: .5rem; }
.milestone-meaning { font-size: var(--fs-base); margin: 0 0 var(--s-3); }
.meaning-box { background: var(--highlight-soft); border-radius: var(--r-md); padding: var(--s-4); text-align: left; margin: 0 0 var(--s-4); }
.meaning-box .label { font-size: var(--fs-xs); color: var(--highlight-ink); }
.meaning-box p { margin: .25rem 0 0; font-size: var(--fs-lg); }

.options { display: grid; gap: var(--s-3); margin: var(--s-4) 0; }
.option {
  width: 100%;
  min-height: 56px;
  padding: .8rem 1rem;
  border-radius: var(--r-option);
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 0 2px 0 var(--line-strong);
  font-weight: 500;
  font: inherit;
  font-size: var(--fs-base);
  line-height: 1.4;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out),
              transform var(--dur-fast) var(--ease-press), box-shadow var(--dur-fast) var(--ease-press);
}
.option.ar { text-align: center; font-size: 1.9rem; line-height: 1.7; padding: .25rem 1rem; }
.option:hover { background: var(--surface-2); border-color: var(--text-subtle); }
.option:active:not([disabled]) { transform: translateY(2px); box-shadow: 0 0 0 var(--line-strong); }
.option.selected { border-color: var(--info); background: var(--info-soft); box-shadow: 0 2px 0 var(--info); }
.option.correct { border-color: var(--success); background: var(--success-soft); box-shadow: 0 2px 0 var(--success); color: var(--success-ink); }
.option.wrong { border-color: var(--danger); background: var(--danger-soft); box-shadow: 0 2px 0 var(--danger); color: var(--danger-ink); }
.option[disabled] { cursor: default; }
@media (min-width: 720px) {
  .options.two-col { grid-template-columns: 1fr 1fr; }
}

.answer-input { font-size: var(--fs-lg); text-align: center; }
.answer-input.ar { font-size: 1.8rem; font-family: var(--arabic); direction: rtl; }
textarea.answer-input { min-height: 7rem; text-align: left; }

.hint-row { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); margin: .5rem 0 1rem; }
.hint-btn {
  border: 1.5px dashed var(--hint-underline); background: var(--surface); color: var(--text);
  border-radius: var(--r-pill); padding: .4rem .95rem; font: inherit; font-size: var(--fs-sm); cursor: pointer; min-height: 40px;
  transition: background-color var(--dur) var(--ease-out);
}
.hint-btn:hover { background: var(--surface-2); }
.hint-btn[aria-pressed="true"] { background: var(--highlight-soft); border-style: solid; }
.translit { font-style: italic; color: var(--text-muted); margin-bottom: var(--s-3); }

.family { text-align: left; margin-top: .5rem; }
.example { margin-top: var(--s-4); text-align: center; }
.example .text-display { font-size: clamp(1.5rem, 6vw, 2rem); }
.example-meaning { max-width: 34rem; margin: 0 auto var(--s-3); line-height: 1.5; text-wrap: pretty; }

/* Arabic keypad for typed Arabic answers */
.keypad { display: grid; grid-template-columns: repeat(7, 1fr); gap: .35rem; direction: rtl; margin: .5rem 0 1rem; }
.keypad button {
  min-height: 44px; border-radius: var(--r-sm); border: 0; background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 2px 0 var(--line-strong);
  font-family: var(--arabic); font-size: 1.35rem; cursor: pointer; color: var(--text);
  transition: transform var(--dur-fast) var(--ease-press);
}
.keypad button:active { transform: translateY(2px); box-shadow: inset 0 0 0 1px var(--line-strong); }
.keypad button.wide { grid-column: span 2; font-family: var(--ui); font-size: var(--fs-sm); }

/* Bottom action bar (thumb-friendly). It takes the colour of the result, like a verdict. */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-actionbar);
  background: var(--bar-bg);
  border-top: 1px solid var(--line);
  padding: .875rem 1rem calc(.875rem + env(safe-area-inset-bottom));
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  transition: background-color var(--dur) var(--ease-out);
}
.action-bar:has(.feedback.good) { background: var(--success-soft); border-top-color: transparent; }
.action-bar:has(.feedback.bad) { background: var(--danger-soft); border-top-color: transparent; }
/* "I don't know" is honest, not wrong: a calm neutral bar, not the red of a mistake. */
.action-bar:has(.feedback.calm) { background: var(--surface-2); }
@media (prefers-color-scheme: dark) {
  .action-bar:has(.feedback.good) { background: #0C2A1A; }
  .action-bar:has(.feedback.bad) { background: #2B1416; }
}
.action-bar .inner { max-width: 640px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: var(--s-3); }
.action-bar .inner .btn { flex: 1; }
.action-bar .inner .self-grade { flex-basis: 100%; }
.feedback {
  max-width: 640px; margin: 0 auto var(--s-3); padding: 0 .125rem;
  text-align: left; display: none;
}
.feedback.show { display: block; animation: rise var(--dur) var(--ease-out) both; }
.feedback.good { color: var(--success-ink); }
.feedback.bad { color: var(--danger-ink); }
.feedback.calm { color: var(--text); }
.feedback.calm span { color: var(--text-muted); }
.feedback.neutral { background: var(--info-soft); color: var(--info-ink); border-radius: var(--r-md); padding: .75rem 1rem; }
.feedback strong { display: block; font-family: var(--display); font-size: var(--fs-xl); font-weight: 400; line-height: 1.3; }
.feedback .ar { font-size: 1.4rem; }
.self-grade { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-2); width: 100%; }
@media (min-width: 560px) { .self-grade { grid-template-columns: repeat(4, 1fr); } }

/* Did you know? */
.dyk {
  text-align: left; background: var(--highlight-soft); border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5); margin: var(--s-4) 0; box-shadow: inset 3px 0 0 var(--brand-gold);
}
.dyk .label { color: var(--highlight-ink); font-size: var(--fs-sm); }
.dyk p { margin: .4rem 0; }
.dyk .source { font-size: var(--fs-xs); color: var(--text-muted); }

/* Word hint sheet */
.sheet-backdrop {
  position: fixed; inset: 0; background: var(--overlay); z-index: var(--z-sheet);
  opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease-out);
}
.sheet-backdrop.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: calc(var(--z-sheet) + 1);
  background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-lg);
  padding: var(--s-4) var(--s-5) calc(var(--s-5) + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform 320ms var(--ease-out);
  max-height: 80dvh; overflow-y: auto; overscroll-behavior: contain;
}
.sheet.show { transform: translateY(0); }
.sheet .grabber { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto var(--s-3); }
.sheet .hint-word { font-size: 2.6rem; line-height: 1.9; text-align: center; color: var(--arabic-display); }
.sheet .hint-meaning { font-size: 1.25rem; text-align: center; margin-bottom: var(--s-3); }
.sheet .parts { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: center; direction: rtl; margin-bottom: var(--s-3); }
.sheet .part { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-sm); padding: .3rem .75rem; text-align: center; direction: ltr; }
.sheet .part .ar { display: block; font-size: 1.5rem; line-height: 1.7; }
.sheet .part small { display: block; }
.sheet dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; margin: 0 0 var(--s-3); font-size: var(--fs-sm); }
.sheet dt { color: var(--text-muted); }
.sheet dd { margin: 0; }
@media (min-width: 720px) {
  .sheet { left: 50%; right: auto; width: 520px; margin-left: -260px; bottom: 1.5rem; border-radius: var(--r-xl); }
}

/* Session complete */
.complete { text-align: center; }
.complete .big { font-size: 3rem; color: var(--highlight-ink); font-family: var(--arabic); line-height: 1.6; }

/* Loading skeleton (shape of an exercise card) */
.skeleton { display: grid; gap: var(--s-3); justify-items: center; padding: var(--s-2) 0; }
.skeleton span {
  position: relative; overflow: hidden; display: block; border-radius: var(--r-sm); background: var(--line);
}
.skeleton span::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s var(--ease-out) infinite;
}
@media (prefers-color-scheme: dark) { .skeleton span::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent); } }
.skeleton .sk-kicker { width: 6rem; height: .8rem; }
.skeleton .sk-word { width: 9rem; height: 4rem; border-radius: var(--r-md); margin: var(--s-2) 0; }
.skeleton .sk-line { width: 70%; height: 1rem; }
.skeleton .sk-box { width: 100%; height: 4.5rem; border-radius: var(--r-md); margin-top: var(--s-2); }

/* ---------- Cookie consent ---------- */
.consent {
  position: fixed; left: .75rem; right: .75rem; bottom: .75rem; z-index: var(--z-consent);
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: var(--s-4) var(--s-5) var(--s-5); max-width: 520px; margin: 0 auto;
  animation: rise var(--dur-slow) var(--ease-out) both;
}
.consent h2 { font-size: var(--fs-lg); margin-bottom: var(--s-2); }
.consent p { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--s-3); }
.consent .actions { display: flex; gap: var(--s-2); }
.consent .actions .btn { flex: 1 1 0; min-width: 0; padding-left: .75rem; padding-right: .75rem; font-size: var(--fs-sm); white-space: nowrap; }
.consent details { margin-bottom: var(--s-3); font-size: var(--fs-sm); }
.consent details summary { cursor: pointer; color: var(--link); }
.consent .pref { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
/* A real tap target (24px minimum), not a 13px box stretched by the flex row. */
.consent .pref input[type="checkbox"] { width: 24px; height: 24px; flex: none; align-self: center; accent-color: var(--brand-green); }
@media (min-width: 720px) { .consent { left: auto; right: 1.5rem; bottom: 1.5rem; } }

/* ---------- Prose pages ---------- */
.prose { max-width: 44rem; }
.prose > p, .prose li { max-width: 65ch; }
.prose h1 { margin-bottom: var(--s-4); }
.prose h2 { margin-top: 1.8em; }
.prose li { margin-bottom: .5em; }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
.prose th, .prose td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: 400; color: var(--text-muted); width: 32%; }

/* Privacy policy, cookie policy and terms */
.legal-nav { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0 0 var(--s-5); }
.legal-nav a {
  padding: .35rem .9rem; border-radius: var(--r-pill); font-size: var(--fs-sm);
  color: var(--text-muted); text-decoration: none; box-shadow: inset 0 0 0 1.5px var(--line);
}
.legal-nav a:hover { color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.legal-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.legal ul { padding-left: 1.2rem; }
.legal .table-wrap { overflow-x: auto; margin: var(--s-3) 0; }
.legal table { min-width: 34rem; }
.legal th { width: auto; }
.legal td code { white-space: nowrap; }
/* Details the owner must still supply (see docs/LAUNCH_CHECKLIST.md). */
mark.todo { background: var(--danger-soft); color: var(--danger-ink); border-radius: 4px; padding: 0 .25rem; }

/* Settings: delete account */
.danger-zone summary { cursor: pointer; color: var(--danger); font-weight: 600; }
.btn.danger { background: var(--danger); color: var(--surface); box-shadow: 0 3px 0 var(--danger-ink); }
.btn.danger:hover { background: var(--danger-ink); color: var(--surface); }

/* ---------- Comprehension assessment of own-words answers ---------- */
.assessment { text-align: left; margin: 0 0 var(--s-4); }
.category { display: inline-block; border-radius: var(--r-pill); padding: .2rem .8rem; font-size: var(--fs-sm); margin: 0 0 var(--s-2); }
.category.full, .category.mostly { background: var(--success-soft); color: var(--success-ink); }
.category.partial { background: var(--highlight-soft); color: var(--highlight-ink); }
.category.misread { background: var(--danger-soft); color: var(--danger-ink); }
.category.none { background: var(--surface-2); color: var(--text-muted); }
.concepts { list-style: none; padding: 0; margin: var(--s-2) 0 0; display: grid; gap: .4rem; }
.concept { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; border-radius: var(--r-sm); padding: .4rem .8rem; box-shadow: inset 0 0 0 1px var(--line); }
.concept .ar { font-size: 1.35rem; line-height: 1.8; }
.concept-status { font-size: var(--fs-xs); min-width: 6.5rem; }
.concept-status::first-letter { text-transform: uppercase; }
.concept.understood { background: var(--success-soft); box-shadow: none; }
.concept.understood .concept-status { color: var(--success-ink); }
.concept.missing { background: var(--highlight-soft); box-shadow: none; }
.concept.missing .concept-status { color: var(--highlight-ink); }
.concept.misunderstood { background: var(--danger-soft); box-shadow: none; }
.concept.misunderstood .concept-status { color: var(--danger-ink); }

/* ---------- Native progress bars (no inline styles, CSP friendly) ---------- */
progress.meter-bar {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px; border: 0; border-radius: var(--r-pill); overflow: hidden;
  background: var(--line); margin-top: .35rem; display: block; color: var(--highlight);
}
progress.meter-bar::-webkit-progress-bar { background: var(--line); border-radius: var(--r-pill); }
progress.meter-bar::-webkit-progress-value { background: var(--highlight); border-radius: var(--r-pill); }
progress.meter-bar::-moz-progress-bar { background: var(--highlight); border-radius: var(--r-pill); }
progress.meter-bar.green::-webkit-progress-value { background: var(--success); }
progress.meter-bar.green::-moz-progress-bar { background: var(--success); }

/* ---------- Reading beyond the course ---------- */
/* Long verses (up to 128 words in 2:282): smaller type, set as an Arabic paragraph (right-aligned, natural spacing). */
.text-display.long { font-size: clamp(1.65rem, 6.6vw, 2.1rem); line-height: 2.15; text-align: start; }
.text-display.very-long { font-size: clamp(1.5rem, 6vw, 1.85rem); line-height: 2.1; text-align: start; word-spacing: .05em; }
.text-display .w.new { border-bottom: 2px solid var(--new-underline); }
/* In the reader only the words not learned yet are underlined (every word can still be tapped). */
#reader .text-display .w:not(.new) { border-bottom-color: transparent; }
#reader.enter { animation: rise var(--dur-slow) var(--ease-out) both; }
.read-title { font-size: var(--fs-xl); margin: .1rem 0 .25rem; }
.read-options .option { font-size: var(--fs-base); line-height: 1.45; }
.key-words { list-style: none; padding: 0; margin: .5rem 0 1rem; display: grid; gap: var(--s-2); text-align: left; }
.key-words li { display: flex; align-items: center; gap: var(--s-3); padding: .35rem .9rem; border-radius: var(--r-md); background: var(--info-soft); }
.key-words .ar { font-family: var(--arabic); font-size: 1.6rem; line-height: 1.7; min-width: 4.5rem; text-align: right; }
.key-words .kw-meaning { flex: 1; }
.surah-list { list-style: none; padding: 0; margin: .5rem 0 0; }
.surah-list li { padding: .7rem 0; border-top: 1px solid var(--line); }
.surah-list li:first-child { border-top: 0; }
.surah-row { display: flex; align-items: center; gap: var(--s-3); color: inherit; text-decoration: none; min-height: var(--tap); }
.surah-row:hover { color: inherit; }
.surah-row:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.surah-num {
  width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--highlight-soft); color: var(--highlight-ink);
  display: grid; place-items: center; font-size: var(--fs-xs); flex: none; font-variant-numeric: tabular-nums;
}
.surah-name { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.surah-name strong { font-weight: 400; }
.surah-pct { font-size: var(--fs-lg); color: var(--success-ink); flex: none; font-variant-numeric: tabular-nums; }
.surah-list progress { margin-top: .4rem; }
.reading-card .suggestion { font-size: var(--fs-lg); }

/* ---------- Errors ---------- */
.error-page { text-align: center; padding: var(--s-12) var(--s-5); }
.error-page .ar { display: block; font-size: 2.4rem; line-height: 1.8; color: var(--highlight-ink); }

/* ---------- Helpers ---------- */
.mt { margin-top: .75rem; }
.mb0 { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
[hidden] { display: none !important; }

@media (max-width: 430px) {
  body.signed-in .brand-text { display: none; }
  .nav a, .nav button.linklike { padding: .5rem .65rem; }
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal-pending { opacity: 1; transform: none; }
  /* The "Please wait" dots only appear and disappear (nothing moves), and they show the page is working. */
  .wait-dots i:nth-child(1) { animation: wait-dot-1 1.6s linear infinite !important; }
  .wait-dots i:nth-child(2) { animation: wait-dot-2 1.6s linear infinite !important; }
  .wait-dots i:nth-child(3) { animation: wait-dot-3 1.6s linear infinite !important; }
}

/* ---------- Brand motif: a faint verse-marker rosette on green surfaces ---------- */
.lp-hero, .cta-card, .daily-panel { position: relative; isolation: isolate; overflow: hidden; }
.lp-hero::after, .cta-card::after, .daily-panel::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  right: -70px; bottom: -90px; width: 300px; height: 300px;
  background: url("../img/brand/mark-on-dark.svg") center / contain no-repeat;
  opacity: .1;
}
.lp-hero::after { width: 460px; height: 460px; right: -120px; bottom: -160px; opacity: .08; }
.cta-card::after { width: 220px; height: 220px; right: -60px; bottom: -80px; }
