/* Huroof: playful but calm. Iznik-tile teal, lantern saffron, night-sky ink.
   One bold element per page (the star lantern / big letter); everything else is quiet. */

:root {
  --ink: #1f2a5a;
  --ink-soft: #4a5585;
  --paper: #eef6fb;
  --card: #ffffff;
  --line: #c9d8e6;
  --teal: #13a89e;
  --teal-deep: #0b7a73;
  --teal-light: #d4f2ee;
  --sun: #ffc145;
  --rose: #ef476f;
  --heavy: #c9184a;
  --leaf: #3fa34d;

  --paint-sun: #ffe08a;
  --paint-sky: #bfe1ff;
  --paint-rose: #ffc2d1;
  --paint-leaf: #c8f0cd;

  --font-ui: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --font-ar: "Noto Naskh Arabic", "Geeza Pro", "Arabic Typesetting", serif;
  /* Qur'an text uses the same font as all other Arabic, so lessons, surahs and duas look alike. */
  --font-quran: var(--font-ar);

  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 28px;
  --press: 0 5px 0 var(--line);
  --space: clamp(1rem, 2.5vw, 1.75rem);
  --star: polygon(50% 0%, 65.3% 13%, 85.4% 14.6%, 87% 34.7%, 100% 50%, 87% 65.3%, 85.4% 85.4%, 65.3% 87%, 50% 100%, 34.7% 87%, 14.6% 85.4%, 13% 65.3%, 0% 50%, 13% 34.7%, 14.6% 14.6%, 34.7% 13%);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}
img, canvas { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; font-weight: 800; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--teal-deep); text-underline-offset: 3px; }
[lang="ar"] { font-family: var(--font-ar); }
code { font-size: .9em; background: var(--card); padding: .1em .35em; border-radius: 6px; }

:focus-visible { outline: 4px solid var(--sun); outline-offset: 3px; border-radius: 8px; }
.skip-link { position: absolute; top: .5rem; inset-inline-start: .5rem; background: var(--ink); color: #fff; padding: .5rem 1rem; border-radius: var(--r-sm); z-index: 10; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.skip-link:focus { clip-path: none; width: auto; height: auto; overflow: visible; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

main { width: min(1180px, 100% - 2 * var(--space)); margin-inline: auto; padding-block: var(--space) calc(var(--space) * 2); }

/* ---------- Header ---------- */
.site-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem;
  padding: .75rem var(--space);
  background: var(--card);
  border-bottom: 3px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: .5rem; text-decoration: none; color: var(--ink); }
.brand-ar { font-size: 1.9rem; font-weight: 700; color: var(--teal-deep); }
.brand-en { font-weight: 800; font-size: 1.2rem; }
/* The site name: Atkinson Hyperlegible's capital I has crossbars and its l a tail, so "Ilm" can't
   be read as "llm". Used wherever the name is shown (the header, and brand_name_html in text). */
.brand-en, .brand-name { font-family: "Atkinson Hyperlegible", var(--font-ui); font-weight: 700; letter-spacing: .01em; }
.site-nav { display: flex; flex-wrap: wrap; gap: .25rem; margin-inline-end: auto; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 700; padding: .3rem .65rem; border-radius: 999px; }
.site-nav a:hover { background: var(--teal-light); }
.who { display: flex; align-items: center; gap: .75rem; }
.who form { margin: 0; }
.child-chip { display: inline-flex; gap: .4rem; align-items: center; font-weight: 700; text-decoration: none; color: var(--ink); background: var(--paint-sun); padding: .25rem .9rem; border-radius: 999px; }
.link-btn { background: none; border: 0; color: var(--ink-soft); font: inherit; font-size: .95rem; cursor: pointer; text-decoration: underline; }

.flash { width: min(1180px, 100% - 2 * var(--space)); margin: 1rem auto 0; background: var(--teal-light); border-radius: var(--r-md); padding: .75rem 1.25rem; font-weight: 600; }
.flash p { margin: 0; }
.site-footer { text-align: center; color: var(--ink-soft); padding: 2rem var(--space); font-size: .95rem; }
.site-footer p { margin-inline: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 800; color: #fff; background: var(--teal);
  border: 0; border-radius: var(--r-md); padding: .65rem 1.3rem;
  box-shadow: 0 5px 0 var(--teal-deep); text-decoration: none; cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--teal-deep); }
.btn-big { font-size: 1.3rem; padding: .9rem 1.8rem; }
.btn-small { font-size: 1rem; padding: .4rem .9rem; border-radius: var(--r-sm); box-shadow: 0 4px 0 var(--teal-deep); }
.btn-ghost { background: var(--card); color: var(--ink); box-shadow: 0 5px 0 var(--line); border: 2px solid var(--line); }
.btn-sun { background: var(--sun); color: var(--ink); box-shadow: 0 4px 0 #d99a1e; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Page heads ---------- */
.page-head { margin-block: .5rem 1.5rem; }
.page-head p { color: var(--ink-soft); font-size: 1.2rem; }
.crumb { font-weight: 700; color: var(--teal-deep); margin-bottom: .2rem; }
.empty { color: var(--ink-soft); }
.pager { display: flex; justify-content: space-between; gap: 1rem; font-weight: 700; margin-bottom: 1rem; }
.pager a { text-decoration: none; }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--space) * 1.5); align-items: center; padding-block: 1rem 3rem; }
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); }
.lede { font-size: 1.3rem; color: var(--ink-soft); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }
.hero-board { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; }
.mini-tile {
  aspect-ratio: 1; display: grid; place-items: center;
  font-family: var(--font-ar); font-size: clamp(1.4rem, 3vw, 2.1rem); text-decoration: none; color: var(--ink);
  background: var(--card); border-radius: var(--r-sm); box-shadow: var(--press);
  animation: tile-in .5s cubic-bezier(.2, .9, .3, 1.3) both; animation-delay: calc(var(--i) * 35ms);
}
.mini-tile.is-heavy { color: var(--heavy); }
.mini-tile:hover { background: var(--paint-sun); }
@keyframes tile-in { from { opacity: 0; transform: scale(.6); } }
.steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; counter-reset: step; }
.steps li { background: var(--card); border-radius: var(--r-md); padding: 1rem 1.2rem; display: grid; gap: .1rem; border-top: 6px solid var(--teal); }
.steps li:nth-child(2) { border-color: var(--sun); }
.steps li:nth-child(3) { border-color: var(--rose); }
.steps li:nth-child(4) { border-color: var(--leaf); }
.steps li:nth-child(5) { border-color: var(--ink); }
.steps span:last-child { color: var(--ink-soft); }
.step-emoji { font-size: 1.8rem; }

/* ---------- Toolbox (Listen / crayons) ---------- */
.toolbox {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  background: var(--card); border-radius: var(--r-md); padding: .5rem .75rem; margin-bottom: 1.25rem;
  border: 2px solid var(--line); width: fit-content; max-width: 100%;
}
.tool {
  font: inherit; font-weight: 700; font-size: 1rem; color: var(--ink); background: var(--paper);
  border: 3px solid transparent; border-radius: 999px; padding: .3rem .9rem; cursor: pointer; min-height: 44px;
}
.tool.is-active { border-color: var(--ink); }
.tool.is-active:not(.crayon) { background: var(--card); }
.toolbox-sep { width: 2px; align-self: stretch; background: var(--line); margin-inline: .25rem; }
.crayon { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.crayon-sun { background: var(--paint-sun); }
.crayon-sky { background: var(--paint-sky); }
.crayon-rose { background: var(--paint-rose); }
.crayon-leaf { background: var(--paint-leaf); }
.crayon.is-active { transform: scale(1.12); }
body[data-tool="paint"] .cl, body[data-tool="paint"] .tile { cursor: crosshair; }

/* Paint applied to letters (tiles or individual clusters) */
.paint-sun { background-color: var(--paint-sun) !important; }
.paint-sky { background-color: var(--paint-sky) !important; }
.paint-rose { background-color: var(--paint-rose) !important; }
.paint-leaf { background-color: var(--paint-leaf) !important; }
.cl { border-radius: 6px; }

/* ---------- Alphabet board + lantern ---------- */
.alphabet-layout { display: grid; grid-template-columns: 300px 1fr; gap: var(--space); align-items: start; }
.lantern { position: sticky; top: 1rem; text-align: center; background: var(--card); border-radius: var(--r-lg); padding: 1.5rem 1rem; }
.lantern-star {
  width: min(240px, 100%); aspect-ratio: 1; margin: 0 auto 1rem; display: grid; place-items: center;
  background: var(--teal); clip-path: var(--star);
}
.lantern-letter { font-size: 7rem; line-height: 1; color: #fff; text-shadow: 0 4px 0 var(--teal-deep); }
.lantern-star.is-heavy { background: var(--heavy); }
.lantern-star { cursor: pointer; }
.lantern-star.pop { animation: pop .45s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes pop { 0% { transform: scale(.75) rotate(-12deg); } 100% { transform: scale(1) rotate(0); } }
.lantern-name { font-size: 1.6rem; font-weight: 800; margin: 0 auto; }
.lantern-name-ar { font-size: 1.6rem; margin: 0 auto .3rem; color: var(--teal-deep); }
.lantern-hint { color: var(--ink-soft); margin-inline: auto; }

.letter-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .8rem; }
.tile {
  font: inherit; aspect-ratio: 1; display: grid; place-items: center; align-content: center; gap: 0;
  background: var(--card); color: var(--ink); border: 3px solid transparent; border-radius: var(--r-md);
  box-shadow: var(--press); cursor: pointer; transition: transform .08s, box-shadow .08s;
}
.tile:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.tile.is-current { border-color: var(--ink); }
.tile-char { font-family: var(--font-ar); font-size: 2.8rem; line-height: 1.2; }
.tile.is-heavy .tile-char { color: var(--heavy); }
.tile-name { font-family: var(--font-ui); font-size: .85rem; color: var(--ink-soft); font-weight: 700; }
.legend { display: flex; align-items: center; gap: .5rem; color: var(--ink-soft); margin-top: 1rem; }
.swatch { width: 1rem; height: 1rem; border-radius: 4px; display: inline-block; }
.swatch-heavy { background: var(--heavy); }

/* ---------- Letter detail + tracing ---------- */
.letter-detail { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--space) * 1.5); }
.big-letter {
  font-size: 9rem; line-height: 1; width: 220px; aspect-ratio: 1; display: grid; place-items: center;
  color: #fff; background: var(--teal); border: 0; clip-path: var(--star); cursor: pointer; margin-bottom: 1rem;
  text-shadow: 0 5px 0 var(--teal-deep);
}
.big-letter.pop { animation: pop .45s cubic-bezier(.2, .9, .3, 1.4); }
.letter-hero h1 span { color: var(--teal-deep); }
.forms { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: flex-end; }
.form-card { margin: 0; background: var(--card); border-radius: var(--r-md); padding: .5rem 1rem; text-align: center; box-shadow: var(--press); min-width: 90px; }
.form-card span { font-size: 3rem; display: block; line-height: 1.5; }
.form-card figcaption { font-family: var(--font-ui); font-size: .9rem; color: var(--ink-soft); font-weight: 700; }
.note { color: var(--ink-soft); margin-top: 1rem; }
.trace-panel { background: var(--card); border-radius: var(--r-lg); padding: 1.25rem; }
.trace-wrap { aspect-ratio: 1; width: min(100%, 420px); margin-inline: auto; }
.trace-canvas {
  width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair;
  background: repeating-linear-gradient(0deg, transparent 0 59px, var(--teal-light) 59px 61px), var(--paper);
  border-radius: var(--r-md);
}
.trace-actions { display: flex; gap: .75rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.trace-feedback { text-align: center; font-weight: 700; min-height: 1.5em; margin: .75rem auto 0; }

/* ---------- Levels ---------- */
.levels { display: grid; gap: calc(var(--space) * 1.25); }
.level-head { display: flex; gap: 1rem; align-items: center; }
.level-head p { margin: 0; color: var(--ink-soft); }
.level-head .level-number { font-size: .85rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--teal-deep); }
.level-head h2 span { color: var(--teal-deep); font-size: .85em; margin-inline-start: .3rem; }
.level-emoji { font-size: 2.6rem; width: 72px; aspect-ratio: 1; display: grid; place-items: center; background: var(--card); clip-path: var(--star); flex: none; }
.lesson-path { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; }
.lesson-stop {
  display: grid; gap: .15rem; padding: 1rem 1.2rem; text-decoration: none; color: var(--ink);
  background: var(--card); border-radius: var(--r-md); box-shadow: var(--press);
}
.lesson-stop:hover { background: var(--teal-light); }
.lesson-title { font-weight: 800; font-size: 1.15rem; }
.lesson-meta { color: var(--ink-soft); font-size: .95rem; }
.stars { letter-spacing: .1em; font-size: 1.3rem; color: var(--line); white-space: nowrap; }
.star.is-on { color: var(--sun); text-shadow: 0 2px 0 #d99a1e; }

/* ---------- Lesson player ---------- */
.lesson-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 1rem; }
.meter { flex: 1 1 200px; height: 16px; background: var(--card); border-radius: 999px; overflow: hidden; border: 2px solid var(--line); }
.meter-fill { display: block; height: 100%; width: 0; background: var(--leaf); transition: width .3s; }
.meter-label { font-weight: 700; color: var(--ink-soft); }
.switch { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; cursor: pointer; }
.switch input { width: 1.2rem; height: 1.2rem; accent-color: var(--teal); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; direction: rtl; }
.card-grid-forms { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.say-card {
  position: relative; color: var(--ink); background: var(--card);
  border: 3px solid transparent; border-radius: var(--r-md); box-shadow: var(--press);
}
.say-play {
  font: inherit; color: inherit; background: none; border: 0; width: 100%; height: 100%;
  padding: 2.6rem .5rem .75rem; cursor: pointer; display: grid; gap: .25rem; justify-items: center; border-radius: inherit;
}
.say-card.is-playing { border-color: var(--teal); background: var(--teal-light); }
.say-card.is-heard::before { content: "🎧"; position: absolute; top: .35rem; right: .5rem; font-size: .85rem; opacity: .7; }
.say-card.is-mastered { border-color: var(--leaf); background: color-mix(in srgb, var(--paint-leaf) 45%, var(--card)); }
.say-check {
  position: absolute; top: .35rem; left: .35rem; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  font: inherit; font-weight: 800; font-size: 1.05rem; line-height: 1; cursor: pointer;
  color: var(--ink-soft); background: var(--card); border: 2px dashed var(--line);
}
.say-check:hover { border-color: var(--leaf); color: var(--leaf); }
.say-check[aria-pressed="true"] { color: #fff; background: var(--leaf); border: 2px solid var(--leaf); }
.say-check.pop { animation: pop .45s cubic-bezier(.2, .9, .3, 1.4); }

/* Lesson progress panel */
.status-chip { display: inline-block; vertical-align: middle; font-size: .9rem; font-weight: 800; padding: .15rem .7rem; border-radius: 999px; background: var(--line); color: var(--ink); }
.status-chip[data-status="in_progress"] { background: var(--paint-sun); }
.status-chip[data-status="done"] { background: var(--leaf); color: #fff; }
.lesson-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; background: var(--card); border-radius: var(--r-md); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.progress-meters { flex: 1 1 320px; display: grid; gap: .6rem; }
.progress-meter { display: grid; gap: .25rem; }
.progress-meter-label { font-weight: 700; color: var(--ink-soft); }
.progress-meter-label strong { color: var(--ink); }
.progress-actions { display: grid; gap: .4rem; justify-items: start; }
.progress-note { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.mark-done[aria-pressed="true"] { background: var(--leaf); color: #fff; border-color: var(--leaf); box-shadow: 0 4px 0 #2b7a37; }
.meter-read .meter-fill { background: var(--teal); }

/* Continue + levels */
.continue-banner {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; margin-bottom: 1.5rem;
  background: var(--teal); color: #fff; text-decoration: none; border-radius: var(--r-md); box-shadow: 0 5px 0 var(--teal-deep);
}
.continue-banner small { display: block; font-weight: 700; opacity: .9; }
.continue-banner strong { font-size: 1.3rem; }
.continue-icon { font-size: 1.4rem; width: 3rem; height: 3rem; display: grid; place-items: center; border-radius: 50%; background: rgb(255 255 255 / .2); flex: none; }
.continue-meter { margin-inline-start: auto; width: min(180px, 30%); height: 12px; border-radius: 999px; background: rgb(255 255 255 / .3); overflow: hidden; }
.continue-meter span { display: block; height: 100%; background: var(--sun); }
.level-count { margin-inline-start: auto; font-weight: 800; color: var(--ink-soft); white-space: nowrap; font-size: 1rem; }
h3 .level-count { margin-inline-start: .5rem; font-size: .9rem; }
.lesson-stop { position: relative; }
.lesson-status { justify-self: start; font-size: .8rem; font-weight: 800; padding: .05rem .6rem; border-radius: 999px; background: var(--line); }
[data-status="in_progress"] > .lesson-status { background: var(--paint-sun); }
[data-status="done"] > .lesson-status { background: var(--leaf); color: #fff; }
.lesson-stop[data-status="done"] { box-shadow: 0 5px 0 var(--leaf); }
.lesson-meter { display: block; height: 8px; border-radius: 999px; background: var(--paper); overflow: hidden; margin-block: .25rem; }
.lesson-meter span { display: block; height: 100%; background: var(--leaf); }
.overall { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 2rem; }
.say-text { font-family: var(--font-ar); font-size: 2.7rem; line-height: 1.6; direction: rtl; }
.say-sound { font-family: var(--font-ui); color: var(--ink-soft); font-weight: 700; direction: ltr; }
.say-forms { display: flex; flex-wrap: wrap; justify-content: center; gap: .9rem; font-family: var(--font-ar); font-size: 1.9rem; direction: rtl; margin-top: .4rem; }
.say-forms span { background: var(--paper); border-radius: var(--r-sm); padding: .1rem .75rem; min-width: 2.6rem; text-align: center; }
body.hide-sounds .say-sound { visibility: hidden; }

/* ---------- Quiz ---------- */
.quiz { max-width: 760px; margin-inline: auto; text-align: center; }
.quiz p { margin-inline: auto; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 1rem; }
.dots { display: flex; gap: .35rem; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.dot.is-right { background: var(--leaf); }
.dot.is-wrong { background: var(--rose); }
.dot.is-now { outline: 3px solid var(--ink); outline-offset: 1px; }
.hear-btn {
  font: inherit; font-weight: 800; font-size: 1.3rem; color: var(--ink); background: var(--sun);
  border: 0; border-radius: 999px; padding: .8rem 1.8rem; box-shadow: 0 5px 0 #d99a1e; cursor: pointer; margin-bottom: 1.5rem;
}
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.option {
  font-family: var(--font-ar); font-size: 3.2rem; line-height: 1.6; color: var(--ink);
  background: var(--card); border: 4px solid transparent; border-radius: var(--r-lg); box-shadow: var(--press); cursor: pointer; padding: .5rem;
}
.option.is-right { border-color: var(--leaf); background: var(--paint-leaf); }
.option.is-wrong { border-color: var(--rose); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.quiz-feedback { font-weight: 800; font-size: 1.3rem; min-height: 2em; margin-top: 1rem; }

/* ---------- Celebration overlay ---------- */
.sound-notice { position: fixed; inset-inline: 1rem; bottom: 1rem; margin: 0 auto; max-width: 420px; background: var(--card); border-radius: var(--r-md); padding: .75rem 1rem; box-shadow: 0 6px 24px rgb(31 42 90 / .25); text-align: center; font-weight: 700; z-index: 60; }
.celebrate { position: fixed; inset: 0; display: grid; place-items: center; background: rgb(31 42 90 / .55); z-index: 50; padding: 1rem; }
.celebrate[hidden] { display: none; }
.celebrate-card { background: var(--card); border-radius: var(--r-lg); padding: 2rem; text-align: center; max-width: 420px; width: 100%; animation: pop .45s cubic-bezier(.2, .9, .3, 1.4); }
.celebrate-card p { margin-inline: auto; }
.celebrate-stars { font-size: 3.4rem; letter-spacing: .1em; color: var(--line); }
.celebrate-stars .is-on { color: var(--sun); }
.celebrate-badge { background: var(--paint-sun); border-radius: var(--r-md); padding: .6rem 1rem; margin: .5rem 0; font-weight: 700; }
.celebrate-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }

/* ---------- Qur'an reader ---------- */
.surah-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem; }
.surah-card { display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem; background: var(--card); border-radius: var(--r-md); text-decoration: none; color: var(--ink); box-shadow: var(--press); }
.surah-card:hover { background: var(--teal-light); }
.surah-num { width: 44px; aspect-ratio: 1; display: grid; place-items: center; background: var(--teal); color: #fff; font-weight: 800; clip-path: var(--star); flex: none; }
.surah-names { display: grid; margin-inline-end: auto; }
.surah-names small { color: var(--ink-soft); }
.surah-ar { font-size: 1.5rem; }
.reader-head h1 span { color: var(--teal-deep); }
.reader-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.reader-layout { display: grid; grid-template-columns: 1fr 320px; gap: var(--space); align-items: start; }
.mushaf { background: var(--card); border-radius: var(--r-lg); padding: clamp(1rem, 3vw, 2.5rem); font-family: var(--font-quran); font-size: clamp(1.7rem, 3.2vw, 2.3rem); line-height: 2.5; }
.basmala { text-align: center; max-width: none; color: var(--teal-deep); }
.ayah { max-width: none; margin: 0 0 .5rem; padding: 0 .5rem; border-radius: var(--r-md); transition: background .2s; }
.ayah.is-playing { background: var(--teal-light); }
.word { font: inherit; color: inherit; background: none; border: 0; padding: 0 .1em; border-radius: 10px; cursor: pointer; }
.word:hover { background: var(--paper); }
.word.is-picked { background: var(--paint-sun); }
.ayah-end {
  font-family: var(--font-ui); font-size: 1rem; font-weight: 800; color: var(--teal-deep);
  width: 2.2rem; aspect-ratio: 1; display: inline-grid; place-items: center; vertical-align: middle;
  border: 0; background: var(--teal-light); clip-path: var(--star); cursor: pointer;
}
.detective { position: sticky; top: 1rem; background: var(--card); border-radius: var(--r-lg); padding: 1.25rem; }
.detective-help { color: var(--ink-soft); }
.detective-word { font-family: var(--font-quran); font-size: 3.4rem; line-height: 2; text-align: center; }
.detective-word .cl { cursor: pointer; }
.detective-word .cl.is-current { outline: 3px solid var(--teal); }
.detective-letter { font-weight: 800; font-size: 1.3rem; text-align: center; min-height: 1.5em; }
.source-note { color: var(--ink-soft); font-size: .9rem; margin-top: 1rem; }

/* ---------- Forms & accounts ---------- */
.form-page { max-width: 520px; margin-inline: auto; }
.form { display: grid; gap: 1rem; background: var(--card); border-radius: var(--r-lg); padding: 1.5rem; margin-bottom: 1rem; }
.field { display: grid; gap: .25rem; }
.field label { font-weight: 700; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="number"], .field input[type="tel"], .field input[type="url"], .field input[type="date"],
.field input[type="time"], .field input[type="datetime-local"], .field input[type="search"], .field select, .field textarea {
  font: inherit; padding: .6rem .8rem; border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--paper);
}
.help { color: var(--ink-soft); font-size: .9rem; }
.help ul { margin: .25rem 0 0; padding-inline-start: 1.2rem; }
.error, .form-errors { color: var(--heavy); font-weight: 700; }
.avatar-pick { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.avatar-pick legend { font-weight: 700; margin-bottom: .4rem; }
.avatar-option { display: inline-flex; align-items: center; gap: .3rem; background: var(--paper); border-radius: 999px; padding: .3rem .8rem; cursor: pointer; }
.avatar-option:has(input:checked) { background: var(--paint-sun); }
.child-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; }
.child-grid form { margin: 0; }
.child-card {
  width: 100%; font: inherit; font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none;
  display: grid; justify-items: center; gap: .3rem; padding: 1.25rem; background: var(--card);
  border: 3px solid transparent; border-radius: var(--r-lg); box-shadow: var(--press); cursor: pointer;
}
.child-card.is-active { border-color: var(--teal); }
.child-avatar { font-size: 3.2rem; }
.child-card-add { color: var(--teal-deep); }

/* ---------- Dashboard ---------- */
.stat-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem; }
.stat { background: var(--card); border-radius: var(--r-md); padding: 1rem 1.5rem; display: grid; min-width: 150px; }
.stat strong { font-size: 2.4rem; line-height: 1; }
.stat span { color: var(--ink-soft); font-weight: 700; }
.badge-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.badge { background: var(--card); border-radius: var(--r-md); padding: 1rem; display: grid; gap: .2rem; text-align: center; }
.badge small { color: var(--ink-soft); }
.badge-emoji { font-size: 2.4rem; }
.badge.is-locked { opacity: .45; filter: grayscale(1); }
.progress-list { list-style: none; padding: 0; display: grid; gap: .4rem; }
.progress-list li { background: var(--card); border-radius: var(--r-sm); padding: .5rem .9rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.progress-list small { color: var(--ink-soft); }

/* ---------- Qaida book pages ---------- */
.book-layout { display: grid; grid-template-columns: minmax(0, 760px) minmax(260px, 1fr); gap: var(--space); align-items: start; }
.book-sheet {
  container-type: inline-size; background: var(--card); border-radius: var(--r-lg);
  padding: clamp(.6rem, 2.5cqi, 1.5rem); box-shadow: 0 6px 24px rgb(31 42 90 / .12);
  border: 3px solid var(--line);
}
.book-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.book-sheet-title { font-weight: 800; color: #e76f51; font-size: clamp(1rem, 3cqi, 1.25rem); }
.book-sheet-page { font-weight: 800; color: var(--ink-soft); background: var(--paper); border-radius: 999px; padding: 0 .7rem; }
.book-blocks { display: grid; gap: clamp(.35rem, 1.2cqi, .6rem); }
.book-blocks > .has-gap { margin-top: clamp(.6rem, 3cqi, 1.4rem); }

.book-row { display: flex; flex-wrap: wrap; gap: clamp(.25rem, 1cqi, .5rem); justify-content: flex-start; }
.book-cell {
  position: relative; flex: var(--grow, 0) 1 calc(var(--w, 15%) - .5rem); min-width: 0;
  background: var(--card); border: 2px solid var(--line); border-radius: clamp(8px, 2cqi, 14px);
  box-shadow: 0 3px 0 var(--line); transition: border-color .15s, background-color .15s;
}
.book-cell-line { flex: 1 1 100%; }
.book-play {
  font: inherit; color: inherit; background: none; border: 0; width: 100%; height: 100%; cursor: pointer;
  display: grid; justify-items: center; align-content: center; gap: .1rem;
  padding: clamp(.35rem, 1.6cqi, .8rem) .2rem clamp(.3rem, 1.2cqi, .6rem); border-radius: inherit;
}
.book-ar { font-family: var(--font-ar); font-size: var(--fs, 2rem); line-height: 1.75; direction: rtl; white-space: nowrap; }
.book-ar.is-wrapped { white-space: normal; line-height: 1.5; text-align: center; }
.book-ar-quran { font-family: var(--font-quran); font-size: clamp(1.4rem, 4.6cqi, 2.2rem); white-space: normal; line-height: 2.1; }
.book-ar .cl { border-radius: 6px; }
.book-ar .cl.is-heavy-letter { color: #e76f51; }
html[data-heavy="off"] .book-ar .cl.is-heavy-letter { color: inherit; }
.book-en { font: 700 clamp(.6rem, 1.9cqi, .85rem)/1.2 var(--font-ui); color: var(--teal-deep); direction: ltr; max-width: 100%; overflow-wrap: anywhere; }
.book-sheet.hide-english .book-en { display: none; }

.book-cell .say-check, .book-step .say-check { width: 1.6rem; height: 1.6rem; font-size: .8rem; top: .25rem; left: .25rem; border-width: 2px; }
/* The ✓ sits in its own strip above the text, so it never covers a letter. */
.book-cell:not(.book-cell-line) .book-play { padding-top: 2rem; }
.book-cell-line .book-play { padding-left: 2.2rem; padding-right: 2.2rem; }
.book-cell.is-heard { box-shadow: 0 3px 0 var(--teal); }
.book-cell.is-mastered, .book-step.is-mastered { border-color: var(--leaf); background: color-mix(in srgb, var(--paint-leaf) 45%, var(--card)); }
.book-cell.is-current, .book-step.is-current { border-color: var(--teal); }
.book-cell.is-playing, .book-step.is-playing { border-color: #d99a1e; background: var(--paint-sun); }
.book-cell.is-dimmed, .book-step.is-dimmed { opacity: .35; }

.book-table { border: 2px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.book-table-head { font-size: clamp(.95rem, 3cqi, 1.15rem); color: #e76f51; text-align: center; margin: 0; padding: .45rem; background: color-mix(in srgb, var(--paint-rose) 35%, var(--card)); }
.book-table-head span { font-family: var(--font-ar); color: var(--ink); margin-inline-start: .3rem; }
.book-step { position: relative; border-top: 1px solid var(--line); }
.book-step .book-play {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; justify-items: start;
  gap: .2rem clamp(.4rem, 2cqi, 1rem); direction: ltr; padding: .3rem 2.4rem .3rem .6rem; text-align: left;
}
.book-pill { font: 800 .75rem/1 var(--font-ui); padding: .3rem .55rem; border-radius: 6px; background: #c8e6b9; color: var(--ink); white-space: nowrap; }
.book-pill.is-join { background: #5fae6e; color: #fff; }
.book-pill.is-waqf { background: #f6c3a6; }
.book-ar-step { font-size: clamp(1.4rem, 4.6cqi, 2rem); min-width: 3.5rem; text-align: center; }
.book-step-note { font-size: .85rem; color: var(--ink-soft); }
.book-step .book-en { font-size: .95rem; justify-self: end; }
.book-step .say-check { left: auto; right: .35rem; top: 50%; transform: translateY(-50%); }
@container (max-width: 560px) {
  /* Phones: keep boxes big enough to tap and read; rows wrap instead of shrinking. */
  .book-cell:not(.book-cell-line) { flex: 1 0 max(calc(var(--w, 15%) - .4rem), 4.6rem); }
  .book-ar { font-size: max(1.6rem, var(--fs, 2rem)); }
  .book-cell:not(.book-cell-line) .book-play { padding-top: 1.95rem; }
}
@container (max-width: 480px) {
  .book-step .book-play { grid-template-columns: auto auto 1fr; }
  .book-step-note { grid-column: 1 / -1; order: 5; }
}

.spotlight { position: sticky; top: 1rem; background: var(--card); border-radius: var(--r-lg); padding: 1.25rem; text-align: center; }
.spotlight-hint { color: var(--ink-soft); margin: 1rem auto; }
.spotlight-count { color: var(--ink-soft); font-weight: 700; margin: 0 auto .25rem; }
.spotlight-ar { font-family: var(--font-ar); font-size: clamp(2.4rem, 5vw, 3.4rem); line-height: 1.8; margin: 0 auto; word-break: break-word; }
.spotlight-en { font-size: 1.4rem; font-weight: 800; color: var(--teal-deep); margin: 0 auto .25rem; }
.spotlight-note { color: var(--ink-soft); font-weight: 700; margin: 0 auto .5rem; }
.spotlight-review { font-size: .9rem; color: var(--ink-soft); margin: 0 auto .5rem; }
.spotlight-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin: .75rem 0; }
.spot-check[aria-pressed="true"] { background: var(--leaf); color: #fff; border-color: var(--leaf); box-shadow: 0 4px 0 #2b7a37; }
.spot-check.pop { animation: pop .45s cubic-bezier(.2, .9, .3, 1.4); }
.spotlight-nav { display: flex; justify-content: space-between; gap: .5rem; }
.say-note { font-size: .8rem; color: var(--ink-soft); font-family: var(--font-ui); direction: ltr; }
.book-credit { color: var(--ink-soft); font-size: .85rem; margin-top: 1.5rem; }
.lesson-preview {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .25rem; direction: rtl; margin-bottom: .4rem;
  font-family: var(--font-ar); font-size: 1.25rem; line-height: 1.7; text-align: center;
}
.lesson-preview span { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 .2rem; }

/* ---------- Settings drawer ---------- */
/* The tab and drawer stay on the right edge in every language (physical, not inline-end). */
.settings-tab {
  position: fixed; right: 0; top: 40%; z-index: 40;
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  font: inherit; font-weight: 800; color: #fff; background: var(--teal);
  border: 0; border-radius: var(--r-md) 0 0 var(--r-md); padding: .8rem .45rem; cursor: pointer;
  box-shadow: -3px 4px 0 var(--teal-deep);
}
.settings-tab span:first-child { font-size: 1.4rem; }
.settings-tab-label { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .04em; }
.settings-tab:hover { background: var(--teal-deep); }
.settings-backdrop { position: fixed; inset: 0; background: rgb(31 42 90 / .35); z-index: 44; }
.settings-panel {
  position: fixed; inset-block: 0; right: 0; z-index: 45;
  width: min(400px, 100%); overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); color: var(--ink); padding: 1rem 1.25rem 2rem;
  box-shadow: -8px 0 30px rgb(31 42 90 / .25);
  transform: translateX(105%); visibility: hidden; transition: transform .25s ease, visibility 0s .25s;
}
.settings-panel.is-open { transform: none; visibility: visible; transition: transform .25s ease; }
.settings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.settings-head h2 { margin: 0; }
.settings-close { font: inherit; font-size: 1.3rem; width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 2px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.settings-section { background: var(--card); border-radius: var(--r-md); padding: 1rem; margin-bottom: 1rem; }
.settings-section h3 { margin-bottom: .6rem; }
.settings-form fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
.settings-form legend { font-weight: 800; margin-bottom: .4rem; padding: 0; }

.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .8rem; border-radius: 999px; border: 2px solid var(--line); font-weight: 700; font-size: .95rem; cursor: pointer; }
.chip:has(input:checked) { background: var(--teal-light); border-color: var(--teal); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:focus-visible) { outline: 4px solid var(--sun); }


.segmented { display: flex; border: 2px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.segmented label { flex: 1; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label > span { display: flex; align-items: center; justify-content: center; gap: .3rem; min-height: 2.6rem; padding: .3rem .5rem; text-align: center; font-weight: 700; font-size: .95rem; }
.segmented label + label > span { border-inline-start: 2px solid var(--line); }
.segmented input:checked + span { background: var(--teal); color: #fff; }
.segmented input:focus-visible + span { outline: 4px solid var(--sun); outline-offset: -4px; }

.theme-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.theme-swatch { cursor: pointer; text-align: center; font-weight: 700; font-size: .95rem; }
.theme-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.theme-swatch span::before { content: ""; display: block; height: 3rem; border-radius: var(--r-sm); margin-bottom: .25rem; border: 3px solid var(--line); }
.theme-swatch input:checked + span::before { border-color: var(--ink); box-shadow: 0 0 0 3px var(--sun); }
.theme-swatch input:focus-visible + span::before { outline: 4px solid var(--sun); }
.theme-sky span::before { background: linear-gradient(135deg, #eef6fb 50%, #13a89e 50%); }
.theme-sunset span::before { background: linear-gradient(135deg, #fff4e8 50%, #e76f51 50%); }
.theme-night span::before { background: linear-gradient(135deg, #141b38 50%, #2ec4b6 50%); }

.switch { display: flex; align-items: center; gap: .7rem; font-weight: 700; cursor: pointer; }
.switch input { appearance: none; width: 2.8rem; height: 1.6rem; flex: none; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: .2rem; left: .2rem; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--teal); }
.switch input:checked::after { transform: translateX(1.2rem); }

.lantern-listen { margin: .25rem auto .75rem; }

/* ---------- Learner settings: page design ---------- */
html[data-theme="sunset"] {
  --ink: #3d2645; --ink-soft: #6b4f73; --paper: #fff4e8; --line: #f1d3b8;
  --teal: #e76f51; --teal-deep: #b8492f; --teal-light: #fde2d4;
}
html[data-theme="night"] {
  color-scheme: dark;
  --ink: #e8ecff; --ink-soft: #aab3dd; --paper: #141b38; --card: #1f2850; --line: #34407a;
  --teal: #1f9e94; --teal-deep: #137068; --teal-light: #1d4a5a;
  --heavy: #ff6b8b;
  --paint-sun: #7a5d12; --paint-sky: #1f4c7a; --paint-rose: #7a2c45; --paint-leaf: #2c6136;
}
html[data-theme="night"] :is(.brand-ar, .lantern-name-ar, main a:not(.btn, .child-chip)) { color: #5fd3c8; }
html[data-text="large"] { font-size: 112.5%; }
html[data-text="xl"] { font-size: 127%; }
/* The script is Uthmani (the Madinah Mushaf), drawn with the King Fahd Complex's Hafs font when it is
   installed (static/fonts/quran-font.json), else Noto Naskh. ":root", not "html": the first :root
   rule above would otherwise win, leaving all Arabic in Noto Naskh (which draws a kasrah with a
   shaddah under the shaddah, above the letter; the Complex's font puts it below the letter). */
:root { --font-ar: "Qaida Quran", "Noto Naskh Arabic", serif; }
html :is(.book-ar, .say-text, .spotlight-ar) { line-height: 2.2; }
html .book-en { margin-top: .2rem; }
.book-sheet [lang="en"] { font-family: var(--font-ui); }
html[data-names="off"] .tile-name { display: none; }
html[data-heavy="off"] .tile.is-heavy .tile-char,
html[data-heavy="off"] .mini-tile.is-heavy { color: inherit; }
html[data-heavy="off"] .lantern-star.is-heavy { background: var(--teal); }
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after {
  animation: none !important; transition: none !important; scroll-behavior: auto !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero, .alphabet-layout, .letter-detail, .reader-layout, .book-layout { grid-template-columns: 1fr; }
  .spotlight { position: sticky; bottom: 0; top: auto; order: 2; padding: .75rem; box-shadow: 0 -6px 24px rgb(31 42 90 / .18); z-index: 5; }
  .spotlight-hint { margin: .25rem auto; font-size: .95rem; }
  .spotlight:has([data-spot-card][hidden]) { display: none; }
  .spotlight-ar { font-size: 2.2rem; line-height: 1.5; }
  .spotlight-en { font-size: 1.2rem; }
  .lantern, .detective { position: static; }
  .lantern { display: grid; grid-template-columns: 120px 1fr; text-align: start; align-items: center; gap: 0 1rem; }
  .lantern-star { width: 120px; grid-row: span 4; margin: 0; }
  .lantern-letter { font-size: 3.6rem; }
  .lantern > * { margin-inline: 0; }
  .detective { order: -1; }
}
@media (max-width: 520px) {
  body { font-size: 1.05rem; }
  .settings-tab { top: auto; bottom: 1rem; padding: .55rem .5rem; }
  .settings-tab-label { display: none; }
  body:has(.spotlight) .settings-tab { bottom: auto; top: 35%; }
  body:has(.dash-nav) .settings-tab { bottom: 5.5rem; }  /* above the dashboards' bottom bar */
  .letter-board { grid-template-columns: repeat(4, 1fr); gap: .5rem; }
  .tile-char { font-size: 2.2rem; }
  .tile-name { font-size: .7rem; }
  .options { gap: .6rem; }
  .big-letter { width: 170px; font-size: 7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Lesson "Learn" sections ---------- */
.lesson-subtitle { font-weight: 700; color: var(--teal-deep); margin-top: -.3em; }
.learn { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
.learn-title, .practice-title { margin: .5rem 0 0; }
.learn-hint, .practice-hint { color: var(--ink-soft); margin: 0; }
.objectives { background: var(--card); border-radius: var(--r-md); padding: 1rem 1.25rem; border-inline-start: 6px solid var(--teal); }
.objectives h2 { font-size: 1.2rem; margin-bottom: .4rem; }
.objectives ul { margin: 0; padding-inline-start: 1.2rem; display: grid; gap: .2rem; }
.objectives li::marker { content: "✓  "; color: var(--leaf); font-weight: 800; }
.learn-block { background: var(--card); border-radius: var(--r-md); padding: 1rem 1.25rem; }
.learn-block h3 { margin-bottom: .5rem; }
.learn-rule { border: 2px solid var(--teal-light); }
.prose p, .prose ul { margin: 0 0 .7em; max-width: 72ch; }
.prose ul { padding-inline-start: 1.2rem; }
.prose li { margin-bottom: .25em; }
.prose > :last-child { margin-bottom: 0; }
.ar-inline { font-family: var(--font-ar); font-size: 1.35em; line-height: 1.4; padding: 0 .1em; color: var(--teal-deep); }
.learn-tip { border-radius: var(--r-md); padding: .9rem 1.2rem; background: color-mix(in srgb, var(--paint-sun) 55%, var(--card)); }
.learn-tip-parent { background: color-mix(in srgb, var(--paint-sky) 55%, var(--card)); }
.learn-tip-warning { background: color-mix(in srgb, var(--paint-rose) 55%, var(--card)); }
.learn-tip-label { font-weight: 800; margin: 0 0 .3rem; }
.learn-tip h3 { font-size: 1.1rem; }

.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .6rem; margin-top: .6rem; }
.ex-grid-wide { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ex-chip {
  font: inherit; color: var(--ink); background: var(--paper); border: 2px solid var(--line); border-radius: var(--r-sm);
  padding: .5rem .4rem .45rem; cursor: pointer; display: grid; justify-items: center; align-content: start; gap: .1rem;
  box-shadow: 0 3px 0 var(--line); min-height: 44px;
}
.ex-chip:hover { border-color: var(--teal); }
.ex-chip.is-playing { border-color: #d99a1e; background: var(--paint-sun); }
.ex-ar { font-family: var(--font-ar); font-size: 2rem; line-height: 1.7; }
.ex-ar-quran { font-family: var(--font-quran); font-size: 1.6rem; line-height: 2.1; }
.ex-en { font-weight: 800; color: var(--teal-deep); font-size: .95rem; direction: ltr; }
.ex-meaning { font-size: .85rem; color: var(--ink-soft); direction: ltr; text-align: center; }
.ex-note { font-size: .78rem; color: var(--ink-soft); direction: ltr; text-align: center; }
.say-meaning { font-size: .85rem; color: var(--ink-soft); direction: ltr; text-align: center; padding: 0 .3rem; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: .5rem; }
.forms-table, .rule-table { border-collapse: collapse; width: 100%; min-width: 320px; }
.forms-table th, .forms-table td, .rule-table th, .rule-table td { border: 1px solid var(--line); padding: .35rem .5rem; text-align: center; vertical-align: middle; }
.forms-table thead th, .rule-table thead th { background: var(--teal-light); font-size: .9rem; }
.forms-table td { font-family: var(--font-ar); font-size: 1.9rem; line-height: 1.6; }
.forms-table tr.is-nonjoining td { background: color-mix(in srgb, var(--paint-rose) 25%, var(--card)); }
.forms-none { color: var(--ink-soft); font-family: var(--font-ui); font-size: 1rem; }
.forms-name { font: inherit; font-weight: 800; background: none; border: 0; color: var(--teal-deep); cursor: pointer; text-decoration: underline dotted; }
.rule-table td { text-align: start; }
.rule-table td .ar-inline { font-size: 1.5em; }

@media (max-width: 520px) {
  .learn-block, .objectives, .learn-tip { padding: .8rem .9rem; }
  .ex-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .45rem; }
  .ex-ar { font-size: 1.7rem; }
  .forms-table td { font-size: 1.5rem; }
}
@media (max-width: 640px) {
  /* Rule tables become stacked cards on phones: one card per row, each cell labelled. */
  .rule-table, .rule-table tbody, .rule-table tr, .rule-table td { display: block; width: 100%; min-width: 0; }
  .rule-table thead { display: none; }
  .rule-table tr { border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: .6rem; overflow: hidden; }
  .rule-table td { border: 0; border-bottom: 1px solid var(--paper); text-align: start; padding: .45rem .7rem; }
  .rule-table td:last-child { border-bottom: 0; }
  .rule-table td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: .78rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
  .rule-table td:first-child { background: var(--teal-light); }
  .rule-table td p { margin: 0; }
}

/* ---------- Topic cards (duas, prayer guide, classes) ---------- */
.topic-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.topic-card { display: flex; align-items: center; gap: 1rem; height: 100%; padding: 1.1rem 1.25rem; background: var(--card); border: 3px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--press); color: var(--ink); text-decoration: none; }
.topic-card:hover { border-color: var(--teal); }
.topic-emoji { font-size: 2.4rem; flex: none; }
.topic-body { display: grid; gap: .2rem; flex: 1; min-width: 0; }
.topic-body strong { font-size: 1.25rem; }
.topic-body small { color: var(--ink-soft); font-size: 1rem; line-height: 1.35; }
.topic-count { flex: none; font-weight: 800; color: var(--teal-deep); background: var(--teal-light); border-radius: 999px; padding: .15rem .7rem; font-size: .9rem; }
.review-note { color: var(--ink-soft); font-size: .95rem; margin-top: 2rem; text-align: center; }
.crumbs { font-weight: 700; margin-bottom: -.5rem; }
.crumbs a { text-decoration: none; }
.chip-row { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: 1rem; scrollbar-width: thin; }
.chip { flex: none; text-decoration: none; color: var(--ink); background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: .3rem .9rem; font-weight: 700; white-space: nowrap; }
.chip.is-current { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ---------- Duas ---------- */
.dua-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; margin-bottom: 1rem; font-weight: 700; }
.dua-memo-count { margin-inline-start: auto; color: var(--teal-deep); }
.dua-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.25rem; }
.dua-card { background: var(--card); border: 3px solid var(--line); border-radius: var(--r-lg); padding: 1.1rem clamp(1rem, 3vw, 1.75rem); scroll-margin-top: 1rem; }
.dua-card.is-known { border-color: var(--sun); }
.dua-head h2 { margin: 0; font-size: 1.3rem; }
.dua-when { margin: .15rem 0 0; color: var(--ink-soft); }
.dua-ar { position: relative; display: block; width: 100%; margin: .9rem 0 .6rem; padding: .8rem 2.6rem .8rem .8rem; background: var(--paper); border: 2px solid transparent; border-radius: var(--r-md); color: var(--ink); cursor: pointer; text-align: right; font: inherit; }
.dua-ar:hover, .dua-ar.is-playing { border-color: var(--teal); background: var(--teal-light); }
.dua-ar [lang="ar"] { display: block; font-size: clamp(1.6rem, 5vw, 2.2rem); line-height: 2.1; }
.dua-ar.is-quran [lang="ar"] { font-family: var(--font-quran); }
.dua-play { position: absolute; top: .6rem; right: .7rem; width: 1.8rem; height: 1.8rem; display: grid; place-items: center; border-radius: 50%; background: var(--teal); color: #fff; font-size: .8rem; }
.dua-ar.is-playing .dua-play { background: var(--rose); }
.dua-sound { margin: 0 0 .4rem; font-size: 1.15rem; font-weight: 700; color: var(--teal-deep); overflow-wrap: anywhere; }
.dua-meaning { margin: 0 0 .4rem; font-size: 1.1rem; }
.dua-note { margin: .2rem 0 0; color: var(--ink-soft); font-size: 1rem; }
.dua-note p { margin: 0 0 .3rem; }
.hide-sound .dua-sound, .hide-meaning .dua-meaning { display: none; }
.dua-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; margin-top: .8rem; padding-top: .7rem; border-top: 2px dashed var(--line); }
.dua-source { color: var(--ink-soft); font-size: .95rem; }
@media (max-width: 640px) {
  .dua-memo-count { margin-inline-start: 0; width: 100%; }
  .topic-card { padding: .9rem 1rem; }
  .topic-emoji { font-size: 2rem; }
}

/* ---------- Recitations and steps (prayer guide) ---------- */
.recite-list { display: grid; gap: .9rem; margin-top: .6rem; }
.recite-card { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-md); padding: .8rem 1rem; }
.recite-card .dua-ar { margin: .3rem 0 .5rem; }
.recite-title { margin: 0; font-weight: 800; }
.recite-repeat { color: var(--teal-deep); background: var(--teal-light); border-radius: 999px; padding: 0 .5rem; font-size: .9rem; }
.recite-card .dua-source { margin: .3rem 0 0; }
.how-steps { list-style: none; counter-reset: step; padding: 0; margin: .8rem 0 0; display: grid; gap: 1rem; }
.step { counter-increment: step; position: relative; padding: .9rem 1rem; padding-inline-start: 3.4rem; background: var(--paper); border-radius: var(--r-md); }
.step::before { content: counter(step); position: absolute; inset-inline-start: .8rem; top: .85rem; width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 800; }
.step-title { margin: .1rem 0 .3rem; font-size: 1.15rem; }
@media (max-width: 640px) {
  .step { padding: .8rem .75rem; }
  .step::before { position: static; display: inline-grid; margin-bottom: .3rem; }
}
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .8rem; margin-top: 2rem; }

/* ---------- Forms: choice chips, honeypot, wide forms ---------- */
.field textarea { resize: vertical; width: 100%; }
.field select, .field input { max-width: 100%; }
.hp-field { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.choice-group { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.choice-group legend { font-weight: 700; margin-bottom: .4rem; padding: 0; }
.choice { position: relative; display: inline-flex; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span { padding: .4rem .85rem; border: 2px solid var(--line); border-radius: 999px; background: var(--paper); font-weight: 600; cursor: pointer; }
.choice input:checked + span { background: var(--teal); border-color: var(--teal); color: #fff; }
.choice input:focus-visible + span { outline: 4px solid var(--sun); outline-offset: 2px; }
.check-label { display: flex; gap: .6rem; align-items: flex-start; font-weight: 600 !important; }
.check-label input { width: 1.3rem; height: 1.3rem; flex: none; margin-top: .15rem; accent-color: var(--teal); }
.form-page-wide { max-width: 760px; }
.form-section { font-size: 1.2rem; margin: .5rem 0 -.25rem; color: var(--teal-deep); }
.sent-card { background: var(--teal-light); border-radius: var(--r-lg); padding: 1.5rem; text-align: center; }
.sent-card .big { font-size: 3rem; margin: 0; }

/* ---------- Classes, mission ---------- */
.hero-band { background: var(--card); border-radius: var(--r-lg); padding: clamp(1.25rem, 4vw, 2.5rem); margin-bottom: 1.5rem; border: 3px solid var(--line); }
.hero-band h1 { margin-top: 0; }
.hero-band .lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 60ch; }
.btn-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1rem; }
.feature-grid { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.feature { background: var(--card); border-radius: var(--r-md); padding: 1rem 1.2rem; border: 2px solid var(--line); }
.feature h3 { margin: .2rem 0 .3rem; }
.feature p { margin: 0; color: var(--ink-soft); }
.feature .emoji { font-size: 2rem; }
.price-card { background: color-mix(in srgb, var(--paint-sun) 50%, var(--card)); border-radius: var(--r-lg); padding: 1.2rem 1.5rem; margin-bottom: 1.5rem; }
.price-card strong { font-size: 1.3rem; }
.prose-page { max-width: 760px; margin-inline: auto; }
.prose-page h2 { margin-top: 2rem; }

/* ---------- Main menu: a row on wide screens, a drop-down on phones ---------- */
.site-nav a[aria-current="page"] { background: var(--teal-light); color: var(--teal-deep); }
.nav-toggle { display: none; align-items: center; gap: .5rem; min-height: 2.6rem; min-width: 2.8rem; justify-content: center; font: inherit; font-weight: 800; color: var(--ink); background: var(--paper); border: 2px solid var(--line); border-radius: 999px; padding: .35rem .9rem; cursor: pointer; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display: block; width: 1.1rem; height: 3px; border-radius: 2px; background: currentColor; transition: transform .2s; }
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.25rem; margin-bottom: .5rem; font-weight: 700; }
@media (max-width: 980px) {
  .site-header { gap: .6rem; }
  .brand { margin-inline-end: auto; }
  .nav-toggle { display: inline-flex; order: 2; }
  .who { order: 1; gap: .5rem; }
  .site-nav { order: 3; flex-direction: column; width: 100%; margin: 0; padding: .4rem 0 .2rem; border-top: 2px solid var(--line); }
  .js .site-nav:not(.is-open) { display: none; }
  .site-nav a { padding: .7rem .9rem; border-radius: var(--r-sm); font-size: 1.1rem; }
  .site-nav .menu-courses > summary { padding: .7rem .9rem; border-radius: var(--r-sm); font-size: 1.1rem; }
}
@media (max-width: 420px) {
  .brand-ar { font-size: 1.5rem; }
  .nav-toggle-text { display: none; }
  .who .link-btn { font-size: .85rem; }
}

/* ---------- FAQ ---------- */
.faq { margin-top: 2rem; display: grid; gap: .6rem; }
.faq-item { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-md); padding: .2rem 1rem; }
.faq-item summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .6rem; padding: .6rem 0; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "+"; flex: none; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 50%; background: var(--teal-light); color: var(--teal-deep); font-family: var(--font-ui); font-weight: 800; line-height: 1; }
.faq-item[open] summary::before { content: "−"; }
.faq-item summary h3 { margin: 0; font-size: 1.1rem; }
.faq-item p { margin: 0 0 .8rem; margin-inline-start: 2.2rem; color: var(--ink-soft); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dua-label { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: .8rem 0 .2rem; }
.dua-page .dua-card .dua-ar [lang="ar"] { font-size: clamp(1.8rem, 6vw, 2.6rem); }
.related { margin-top: 2rem; }
.chip-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-list .chip { display: inline-block; white-space: normal; }
.dua-head h2 a { color: inherit; text-decoration: none; }
.dua-head h2 a:hover { text-decoration: underline; }

/* Long practice cards: ayahs and phrases span the row instead of squeezing into a narrow card. */
.say-card-wide { grid-column: 1 / -1; }
.say-card-mid { grid-column: span 2; }
.say-card-wide .say-play { padding: 1rem 3.2rem 1rem 3.2rem; justify-items: stretch; text-align: center; }
.say-card-wide .say-text { font-size: clamp(1.7rem, 4.4vw, 2.5rem); line-height: 2.2; }
.say-card-wide .say-sound { font-size: 1.05rem; }
@media (max-width: 520px) {
  .say-card-mid { grid-column: 1 / -1; }
  .say-card-wide .say-play { padding: 2.4rem .8rem .8rem; }
}

/* ---------- Urdu (right to left, Nastaliq) ---------- */
html[lang="ur"] { --font-ui-ur: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Noto Naskh Arabic", serif; }
html[lang="ur"] body { font-family: var(--font-ui-ur); line-height: 2; }
html[lang="ur"] :is(h1, h2, h3, h4) { line-height: 1.9; font-weight: 700; }
/* Not inside Arabic (the tappable words of a surah are buttons): Arabic looks the same in every language. */
html[lang="ur"] :is(button, input, select, textarea, .btn):not([lang="ar"] *) { font-family: var(--font-ui-ur); }
html[lang="ur"] .btn:not([lang="ar"] *) { line-height: 2; padding-block: .35rem .55rem; }
html[lang="ur"] small, html[lang="ur"] .help { line-height: 2; }
/* English inside Urdu pages (pronunciation, letter names, numbers in English) stays Latin and LTR. */
[lang="en"] { font-family: var(--font-ui); direction: ltr; unicode-bidi: isolate; }
html[lang="ur"] [lang="en"] { line-height: 1.5; }
/* Arabic keeps its own fonts inside Urdu pages. */
html[lang="ur"] [lang="ar"] { font-family: var(--font-ar); }
html[lang="ur"] .brand-en { font-family: var(--font-ui); }
.settings-ur { font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", serif; font-weight: 400; font-size: .9em; color: var(--ink-soft); }
[data-language-picker] span[lang="ur"] { font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", serif; }

/* Arrows point the reading direction: flipped in right-to-left pages. */
.arw { display: inline-block; }
html[dir="rtl"] .arw { transform: scaleX(-1); }

.more-surahs { margin-top: 2rem; }
.more-surahs summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1rem; }
.more-surahs summary h2 { margin: 0; display: inline; }
.more-surahs summary small { color: var(--ink-soft); }
.more-surahs .surah-grid { margin-top: 1rem; }

.page-head .page-note { font-size: 1rem; margin-top: .35rem; }
.site-footer .footer-credit { font-size: .85rem; opacity: .85; }
.legal-page .legal-updated { font-size: .9rem; color: var(--ink-soft); }
.say-card-shapes .say-text { word-spacing: .55em; }

/* ---------- Hifz ---------- */
.hifz-steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; margin: 0 0 1.5rem; }
.hifz-steps li { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-md); padding: .8rem 1rem; color: var(--ink-soft); }
.hifz-steps li span { font-size: 1.6rem; display: block; }
.hifz-steps li strong { display: block; color: var(--ink); font-size: 1.1rem; }
.hifz-plan { margin-bottom: 1.5rem; }
.hifz-plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.hifz-plan-grid > div { background: var(--paint-sun); border-radius: var(--r-md); padding: .8rem 1rem; }
.hifz-plan-grid h3 { margin: 0 0 .2rem; font-size: 1.1rem; }
.hifz-plan-grid p { margin: 0 0 .4rem; color: var(--ink-soft); font-size: .95rem; }
.hifz-plan-grid ul { margin: 0; padding-inline-start: 1.2rem; }
.hifz-plan-empty { list-style: none; margin-inline-start: -1.2rem; color: var(--ink-soft); }
.hifz-path { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.hifz-stop { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .2rem .8rem; padding: .7rem 1rem; background: var(--card); border: 2px solid var(--line); border-radius: var(--r-md); color: var(--ink); text-decoration: none; box-shadow: var(--press); }
.hifz-stop:hover { border-color: var(--teal); }
.hifz-stop[data-status="done"] { border-color: var(--leaf); }
.hifz-stop-num { width: 2rem; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: var(--teal-light); color: var(--teal-deep); font-weight: 800; }
.hifz-stop-names small { display: block; color: var(--ink-soft); }
.hifz-stop-names [lang="ar"] { font-size: 1.15rem; margin-inline-start: .3rem; }
.hifz-stop-state { font-size: .9rem; font-weight: 700; color: var(--teal-deep); }
.hifz-stop .lesson-meter { grid-column: 1 / -1; }
.hifz-bar { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.hifz-range { display: flex; gap: .75rem; font-weight: 700; }
.hifz-range select, .hifz-controls select { font: inherit; padding: .2rem .4rem; border-radius: var(--r-sm); border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.hifz-modes { min-width: min(100%, 360px); }
.hifz-panel { background: var(--card); border-radius: var(--r-lg); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.hifz-controls { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.hifz-hide { border: 0; padding: 0; margin: .9rem 0 0; }
.hifz-hide legend { font-weight: 800; margin-bottom: .3rem; }
.hifz-mic.is-listening { background: var(--rose); box-shadow: 0 5px 0 var(--heavy); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.04); } }
.hifz-status { font-weight: 700; margin: .8rem 0 0; }
.hifz-status[data-tone="good"] { color: var(--leaf); }
.hifz-status[data-tone="bad"] { color: var(--heavy); }
.hifz-score { font-weight: 800; margin: .4rem 0 0; }
.hifz-consent, .hifz-nomic { background: var(--paint-sun); border-radius: var(--r-md); padding: .8rem 1rem; margin-bottom: .8rem; }
.hifz-consent p, .hifz-nomic p { margin: 0 0 .5rem; color: var(--ink); }
.hifz-mushaf .hw { position: relative; display: inline-block; border-radius: 8px; padding-inline: .1em; cursor: default; }
.hifz-mushaf .hw.is-hidden { color: transparent; background: var(--paper); box-shadow: inset 0 -3px 0 var(--line); cursor: pointer; }
.hifz-mushaf .hw.is-hidden.is-peek { color: var(--ink-soft); }
.hifz-mushaf .hw.is-current { outline: 3px dashed var(--teal); outline-offset: 2px; }
.hifz-mushaf .hw.is-revealed { color: var(--ink); background: var(--paint-leaf); }
.hifz-mushaf .hw.is-assumed, .hifz-mushaf .hw.is-helped { background: var(--paint-sun); }
.hifz-mushaf .hw.is-wrong { box-shadow: inset 0 0 0 3px var(--heavy); background: var(--paint-rose); animation: shake .35s; }
.hifz-mushaf .hw[data-hint]::after { content: attr(data-hint); position: absolute; inset-block-end: 100%; inset-inline-start: 50%; transform: translateX(50%); color: var(--teal-deep); background: var(--card); border: 2px solid var(--teal); border-radius: var(--r-sm); padding: 0 .35em; font-size: .8em; line-height: 1.6; }
.hifz-mushaf .ayah.is-clean .ayah-end { background: var(--paint-leaf); }
.hifz-mushaf .ayah.is-retry .ayah-end { background: var(--paint-sun); }
.hifz-mushaf .ayah[hidden], .hifz-mushaf .basmala[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .hifz-mic.is-listening, .hifz-mushaf .hw.is-wrong { animation: none; } }

.surah-group { font-size: 1.3rem; margin: 0 0 .75rem; }

/* ﷺ in running text: its own box, so the tall ligature makes room instead of overlapping the line above. */
.saw { display: inline-block; font-family: var(--font-ar); line-height: 1.2; vertical-align: middle; }
/* The stop-signs table: a pause mark on its own is drawn small and high (it sits after a word in the
   mushaf), so the sign column shows it larger. */
.sign-table td:first-child .ar-inline { display: inline-block; font-size: 2.6em; line-height: 1.2; }

/* Indo-Pak Qur'an script (Settings → Qur'an script): all Arabic switches to the Complex's Nastaleeq
   font. The Qur'an has its own Indo-Pak text; other Arabic is respelled by apps/quran/spelling.py. */
html[data-quran-script="indopak"] {
  --font-quran: "Qaida IndoPak", "Qaida Quran", "Noto Naskh Arabic", serif;
  --font-ar: var(--font-quran);  /* all Arabic follows: the converter respells it the Indo-Pak way */
}
/* The pause or ruku sign of an ayah (لا ط ع ...) sits above its number, as in an Indo-Pak mushaf.
   static/js/quran-font.js measures the glyph and places it, then shows it. */
.ayah-mark { position: relative; display: inline-block; vertical-align: middle; }
.ayah-sign { position: absolute; left: 50%; top: 0; font-family: var(--font-quran); font-size: 1.1em; line-height: 1;
  direction: ltr; white-space: nowrap; color: var(--teal-deep); visibility: hidden; pointer-events: none; }
.ayah-sign.is-placed { visibility: visible; }
/* Indo-Pak signs exist only in that font: without it they would be drawn as letters, so hide them. */
html:not([data-quran-script="indopak"]) .qsign, html.no-quran-font .qsign { display: none; }
.sign-table td:first-child strong { font-size: 1.6em; color: var(--teal-deep); }

/* "Report a mistake": quiet links for teachers and scholars (apps/feedback). */
.report-link { font-size: .85rem; color: var(--ink-soft); margin-inline-start: auto; }
.report-shown { font-family: var(--font-ar); font-size: 2.25rem; line-height: 2.1; background: var(--card); border-radius: var(--r-md);
  padding: .5rem 1rem; margin: .5rem 0; }
.ayah-report, .step-report { font-family: var(--font-ui); font-size: .8rem; color: var(--ink-soft); opacity: .4;
  text-decoration: none; vertical-align: middle; padding: 0 .3rem; }
.ayah-report:hover, .ayah-report:focus-visible, .step-report:hover, .step-report:focus-visible { opacity: 1; color: var(--ink); }
.recite-card .report-link { display: inline-block; margin-top: .4rem; }

/* ---------- Dashboards (/teach/, /family/, /kids/) ---------- */
.dash { --c0: #13a89e; --c1: #ef476f; --c2: #ffb703; --c3: #4361ee; --c4: #3fa34d; --c5: #9b5de5; --c6: #f3722c; --c7: #00a6c8; }
.c0 { --cc: var(--c0); } .c1 { --cc: var(--c1); } .c2 { --cc: var(--c2); } .c3 { --cc: var(--c3); }
.c4 { --cc: var(--c4); } .c5 { --cc: var(--c5); } .c6 { --cc: var(--c6); } .c7 { --cc: var(--c7); }
.dash-nav { display: flex; gap: .25rem; margin-bottom: 1.25rem; background: var(--card); border-radius: 999px; padding: .3rem; width: fit-content; max-width: 100%; }
.dash-nav a { display: inline-flex; gap: .35rem; align-items: center; padding: .4rem 1rem; border-radius: 999px; font-weight: 700; color: var(--ink); text-decoration: none; }
.dash-nav a[aria-current="page"] { background: var(--teal); color: #fff; }
.dash-card { background: var(--card); border-radius: var(--r-md); padding: 1rem 1.25rem; margin-bottom: 1rem; border: 2px solid var(--line); }
.dash-card > summary { cursor: pointer; font-weight: 800; }
.dash-card[open] > summary { margin-bottom: .75rem; }
.dash-section { margin-bottom: 1.5rem; }
.page-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; font-weight: 800; color: var(--ink-soft); margin: 0; }
.next-class { border-inline-start: 8px solid var(--cc, var(--teal)); }
.next-class h2 { margin: .2rem 0; }
.next-time { margin: .25rem 0; }
.countdown { font-weight: 800; color: var(--teal-deep); margin: .25rem 0 .75rem; }
.class-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; background: var(--card); border-radius: var(--r-sm); padding: .6rem .9rem; margin-bottom: .5rem; border-inline-start: 6px solid var(--cc, var(--line)); }
.class-row.is-next { box-shadow: 0 0 0 3px var(--teal-light); }
.class-time { font-weight: 800; min-width: 4.5ch; }
.class-who { font-weight: 700; color: var(--ink); text-decoration: none; }
.class-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-inline-start: auto; align-items: center; }
.class-actions form { display: flex; gap: .4rem; margin: 0; }
.status-chip { display: inline-block; font-size: .8rem; font-weight: 800; padding: .1rem .6rem; border-radius: 999px; background: var(--paper); }
.st-held .status-chip, .status-chip.st-held { background: var(--paint-leaf); }
.st-absent .status-chip, .status-chip.st-absent { background: var(--paint-sun); }
.st-cancelled .status-chip, .status-chip.st-cancelled, .status-chip.st-moved { background: var(--paint-rose); }
.btn-join[disabled] { opacity: .5; cursor: not-allowed; }
.attention { padding-inline-start: 1.2rem; }
.attention li { margin-bottom: .4rem; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filter-bar input[type="search"] { flex: 1 1 14rem; }
.filter-bar input, .filter-bar select { font: inherit; padding: .45rem .7rem; border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--card); }
.student-grid { list-style: none; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.student-card { display: grid; gap: .1rem; background: var(--card); border-radius: var(--r-md); padding: 1rem; color: var(--ink); text-decoration: none; border: 2px solid var(--line); border-top: 6px solid var(--cc, var(--teal)); height: 100%; }
.student-card:hover { border-color: var(--teal); }
.student-card .child-avatar { font-size: 2rem; }
.student-name { font-weight: 800; font-size: 1.2rem; }
.student-head { display: flex; align-items: center; gap: .75rem; }
.student-head .child-avatar { font-size: 2.6rem; }
.student-head h1 { margin: 0; }
.tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 3px solid var(--line); margin-bottom: 1rem; }
.tabs a { padding: .5rem .9rem; font-weight: 700; color: var(--ink-soft); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -3px; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--teal); }
.mark-level { margin-bottom: 1rem; }
.mark-level h3 { font-size: 1.1rem; }
.mark-list { list-style: none; padding: 0; margin: 0; }
.mark-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: .3rem .75rem; padding: .5rem .25rem; border-bottom: 1px solid var(--line); }
.mark-title { font-weight: 700; }
.mark-practice { color: var(--leaf); font-size: .9rem; }
.mark-note { grid-column: 1 / -1; margin: 0; font-size: .95rem; color: var(--ink-soft); }
.mark-chip { font-size: .8rem; font-weight: 800; padding: .1rem .55rem; border-radius: 999px; background: var(--paper); white-space: nowrap; }
.m-practising { background: var(--paint-sun); } .m-can_read { background: var(--paint-sky); } .m-mastered { background: var(--paint-leaf); }
.m-none { color: var(--ink-soft); font-weight: 600; }
.mark-stars { color: #e0a100; }
.mark-edit { grid-column: 1 / -1; }
.mark-edit > summary { cursor: pointer; color: var(--teal-deep); font-weight: 700; font-size: .95rem; }
.mark-form { display: grid; gap: .5rem; padding: .5rem 0; }
.mark-form input[type="text"] { font: inherit; padding: .4rem .6rem; border: 2px solid var(--line); border-radius: var(--r-sm); }
.dash .segmented { display: flex; flex-wrap: wrap; gap: .3rem; border: 0; padding: 0; margin: 0; }
.dash .segmented label { position: relative; }
.dash .segmented input { position: absolute; opacity: 0; inset: 0; }
.dash .segmented span { display: inline-block; padding: .3rem .7rem; border-radius: 999px; border: 2px solid var(--line); background: var(--card); font-size: .9rem; font-weight: 700; cursor: pointer; }
.dash .segmented input:checked + span { background: var(--teal); border-color: var(--teal); color: #fff; }
.dash .segmented input:focus-visible + span { outline: 4px solid var(--sun); }
.quick-sheet { border-color: var(--teal); }
.history, .note-list { list-style: none; padding: 0; }
.history li { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.note-item { background: var(--card); border-radius: var(--r-sm); padding: .75rem 1rem; margin-bottom: .5rem; border-inline-start: 5px solid var(--teal); }
.note-item.is-private { border-color: var(--ink-soft); }
.note-item p { margin: 0 0 .25rem; }
.inline-form { display: inline; }
.note-templates { margin-bottom: .75rem; }
.chip-row .chip { cursor: pointer; border: 2px solid var(--line); background: var(--paper); font: inherit; font-size: .9rem; }
.plan-card h3 { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.plan-superseded, .plan-withdrawn { opacity: .65; }
.info-list { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; }
.info-list dt { font-weight: 700; color: var(--ink-soft); }
.info-list dd { margin: 0; overflow-wrap: anywhere; }
.info-rows { list-style: none; padding: 0; }
.info-rows li { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.secret-box { background: var(--paint-sun); border-radius: var(--r-sm); padding: .75rem 1rem; display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; text-align: start; }
.secret-box p { grid-column: 1 / -1; margin: 0; }
.secret-box dd { margin: 0; }
.copy-text { width: 100%; font: inherit; font-size: .95rem; padding: .5rem; border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--paper); }
.week-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.week { list-style: none; padding: 0; display: grid; gap: .5rem; }
.week-day { background: var(--card); border-radius: var(--r-sm); padding: .5rem .75rem; }
.week-day h3 { font-size: 1rem; margin: 0 0 .35rem; }
.week-day.is-empty { opacity: .7; }
.week-day.is-empty p { margin: 0; }
.week-class { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: center; padding: .35rem .5rem; margin-bottom: .3rem; border-radius: 8px; border-inline-start: 5px solid var(--cc, var(--teal)); background: var(--paper); font-size: .95rem; }
.week-class.st-cancelled, .week-class.st-absent { opacity: .7; }
.week-time { font-weight: 800; }
.week-act { font-size: .85rem; margin-inline-start: auto; }
.wizard-steps { display: flex; flex-wrap: wrap; gap: .25rem .5rem; padding: 0; list-style: none; counter-reset: step; margin-bottom: 1rem; }
.wizard-steps li { counter-increment: step; font-weight: 700; color: var(--ink-soft); font-size: .95rem; }
.wizard-steps li::before { content: counter(step) ". "; }
.wizard-steps li.is-current { color: var(--teal-deep); text-decoration: underline; text-underline-offset: 4px; }
.review-list { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; }
.review-list dt { font-weight: 700; color: var(--ink-soft); }
.review-list dd { margin: 0; overflow-wrap: anywhere; }
.alerts ul { padding-inline-start: 1.1rem; margin: 0 0 .5rem; }
.kids-login { text-align: center; }
.kids-login .form { text-align: start; }
.dash-hint { font-size: .9rem; }
@media (min-width: 900px) {
  .week { grid-template-columns: repeat(7, 1fr); }
  .week-day { min-height: 8rem; }
  .week-class { display: grid; gap: .1rem; }
  .week-act { margin-inline-start: 0; }
}
@media (max-width: 640px) {
  .dash { padding-bottom: 4.5rem; }
  .dash-nav { position: fixed; inset: auto 0 0 0; width: auto; z-index: 20; border-radius: 0; margin: 0; justify-content: space-around; border-top: 3px solid var(--line); padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); }
  .dash-nav a { flex-direction: column; gap: 0; padding: .3rem .5rem; font-size: .85rem; border-radius: var(--r-sm); }
  .dash-nav a span { font-size: 1.3rem; }
  .mark-row { grid-template-columns: 1fr auto; }
  .mark-practice { grid-column: 1 / -1; }
  .class-actions { margin-inline-start: 0; width: 100%; }
  .info-list, .secret-box, .review-list { grid-template-columns: 1fr; }
  .info-list dd, .review-list dd { margin-bottom: .4rem; }
}
.dash-body, .dash .form, .dash .form > *, .dash fieldset { min-width: 0; }
.dash .field input:not([type="checkbox"]):not([type="radio"]), .dash .field select, .dash .field textarea { width: 100%; max-width: 100%; }
.dash-card .form { padding: 0; background: none; margin-bottom: 0; }
.dash .note-templates { overflow: visible; flex-wrap: wrap; }
.dash .note-templates .chip { white-space: normal; text-align: start; flex: 0 1 auto; }
/* Phones: every control in the dashboards is at least 44px tall to tap. */
.dash .btn-small, .dash .week-act, .dash .mark-edit > summary, .dash .link-btn, .dash .tabs a,
.dash .dash-card > summary, .dash .chip-row .chip { min-height: 44px; display: inline-flex; align-items: center; }
.dash .segmented span { min-height: 44px; display: inline-flex; align-items: center; padding-inline: .9rem; }
.dash .mark-edit > summary { display: flex; }
.dash .dash-card > summary { display: list-item; line-height: 44px; }
.dash .week-act { padding-inline: .25rem; }
.week-class.is-clash { outline: 3px solid var(--rose); outline-offset: -1px; }
.clash-note { color: var(--heavy); font-size: .85rem; }
@media (max-width: 480px) {
  .tabs { flex-wrap: wrap; overflow: visible; row-gap: 0; }  /* all five tabs in sight */
  .tabs a { padding-inline: .6rem; }
}
.dash .class-who { min-height: 44px; display: inline-flex; align-items: center; }
/* More 44px tap targets: choice pills, avatars, check boxes, lesson links. */
.dash .choice span, .dash .avatar-option { min-height: 44px; display: inline-flex; align-items: center; }
.dash .check-label { min-height: 44px; align-items: center; }
.dash .check-label input { margin-top: 0; }
.progress-list li > a { min-height: 44px; display: inline-flex; align-items: center; }
.form-page .choice span, .form-page .avatar-option { min-height: 44px; display: inline-flex; align-items: center; }
.copy-text { min-height: 44px; }
.dash .field > * { min-width: 0; }  /* date and time inputs have a built-in minimum width */
.field input[type="url"], .field input[type="email"], .copy-text { direction: ltr; }
[dir="rtl"] .field input[type="url"], [dir="rtl"] .field input[type="email"] { text-align: right; }
.form-pair { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }

/* ---------- Stories (/stories/) ---------- */
.story-group { margin-bottom: 1.75rem; }
.story-group h2 { font-size: 1.3rem; color: var(--teal-deep); }
.story-path { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); counter-reset: none; }
.story-stop { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: .1rem .8rem; align-items: center; min-height: 64px;
  background: var(--card); border: 3px solid var(--line); border-radius: var(--r-md); padding: .75rem 1rem; color: var(--ink); text-decoration: none; box-shadow: var(--press); }
.story-stop:hover { border-color: var(--teal); }
.story-stop.is-read { border-color: var(--leaf); box-shadow: 0 5px 0 var(--leaf); }
.story-num { grid-row: span 2; width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--paint-sun); }
.story-stop.is-read .story-num { background: var(--paint-leaf); }
.story-title { font-weight: 800; line-height: 1.25; }
.story-meta { color: var(--ink-soft); font-size: .9rem; }
.draft-tag { color: var(--heavy); font-weight: 700; }
.story-page { max-width: 760px; margin-inline: auto; }
.story-facts { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: 1rem !important; }
.story-read { color: var(--leaf); font-weight: 800; }
.draft-note { border-inline-start: 5px solid var(--heavy); }
.story-text { font-size: clamp(1.2rem, 2.6vw, 1.4rem); line-height: 1.75; background: var(--card); border-radius: var(--r-lg); padding: clamp(1rem, 4vw, 2rem); margin-bottom: 1.5rem; }
.story-text p { max-width: 62ch; }
.story-text p:last-child { margin-bottom: 0; }
.story-audio { width: 100%; }
.story-sources, .story-talk, .story-done section { background: var(--card); border-radius: var(--r-md); padding: 1rem clamp(1rem, 3vw, 1.5rem); margin-bottom: 1rem; }
.story-sources h2, .story-talk h2, .story-done h2 { font-size: 1.3rem; }
.story-verse { border-top: 1px solid var(--line); padding: .25rem 0; }
.story-verse > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.story-ayahs { font-family: var(--font-quran); font-size: 1.7rem; line-height: 2.2; padding: .5rem 0; }
.story-ayah .ayah-end { font-size: 1rem; display: inline-grid; place-items: center; min-width: 1.8rem; height: 1.8rem; border-radius: 50%; border: 2px solid var(--teal); color: var(--teal-deep); font-family: var(--font-ui); }
.story-talk ul { padding-inline-start: 1.2rem; }
.story-talk li { margin-bottom: .5rem; }
.story-quiz { padding-inline-start: 1.4rem; display: grid; gap: .75rem; }
.story-q-text { font-weight: 700; margin-bottom: .2rem; }
.story-q details > summary { cursor: pointer; color: var(--teal-deep); font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.story-answer { background: var(--paint-leaf); border-radius: var(--r-sm); padding: .4rem .8rem; }
.story-activities { list-style: none; padding: 0; display: grid; gap: .6rem; }
.story-activities li { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.story-done .check-label { min-height: 44px; align-items: center; }
.story-done .check-label input { margin-top: 0; }
.story-done > .btn-big { width: 100%; margin-bottom: .5rem; }

/* ---------- Letter pages: place, pairs, words ---------- */
.letter-more { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 1.5rem; align-items: start; }
.letter-more .dash-card { margin: 0; }
.letter-more h2 { font-size: 1.25rem; }
.pair-list, .word-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.pair-list li { display: flex; gap: .8rem; align-items: center; }
.pair-letter { display: grid; place-items: center; min-width: 3.4rem; min-height: 3.4rem; border-radius: var(--r-sm); background: var(--paint-sky); font-family: var(--font-ar); font-size: 2rem; color: var(--ink); text-decoration: none; }
.word-list a { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .2rem .8rem; min-height: 44px; padding: .3rem .6rem; border-radius: var(--r-sm); background: var(--paper); color: var(--ink); text-decoration: none; }
.word-ar { font-family: var(--font-ar); font-size: 1.6rem; }
.word-en { font-size: .95rem; color: var(--ink-soft); }

/* Letters shown on their own use Noto Naskh in every script setting: both Qur'an fonts draw a lone Yaa
   without its dots (ى/ی, the mushaf convention), which beginners take for Alif Maqsoorah. The tracing
   canvas (static/js/letter.js) uses the same font. */
.mini-tile, .alphabet-layout .tile-char, .big-letter, .pair-letter, .forms .form-card span {
  font-family: "Noto Naskh Arabic", "Geeza Pro", serif;
}
/* Tap targets of at least 44px on phones. */
.mini-tile { min-height: 44px; display: grid; place-items: center; }
.pager a { min-height: 44px; display: inline-flex; align-items: center; padding-inline: .4rem; }
.ayah-report, .step-report { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; vertical-align: middle; }

/* Long surahs in parts of 40 ayahs (apps/quran/models.py Surah.AYAHS_PER_PART) */
.part-nav { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: 0 0 1rem; }
.part-label { font-weight: 700; color: var(--ink-soft); margin-inline-end: .25rem; }
.part-nav a { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 .7rem; border-radius: 999px; border: 2px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-weight: 700; font-size: .95rem; }
.part-nav a[aria-current="page"] { background: var(--teal); border-color: var(--teal); color: #fff; }
.ayah { scroll-margin-top: 1rem; }
.footer-nav a, .report-link, .chip-row .chip { min-height: 44px; display: inline-flex; align-items: center; }
.footer-nav { row-gap: 0; }
.btn-small, .chip { min-height: 44px; }
.chip { display: inline-flex; align-items: center; }
.btn-small { display: inline-flex; align-items: center; justify-content: center; }
[data-plan] li a { min-height: 44px; display: inline-flex; align-items: center; }

/* ---------- Courses, Library, search, menu (course structure) ---------- */
.crumbs { font-size: .95rem; color: var(--ink-soft); margin: 0 0 .75rem; display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.crumbs a { min-height: 44px; display: inline-flex; align-items: center; }
.menu-courses { position: relative; }
.menu-courses > summary { list-style: none; cursor: pointer; color: var(--ink); font-weight: 700; padding: .3rem .65rem; border-radius: 999px; white-space: nowrap; min-height: 44px; display: flex; align-items: center; gap: .3rem; }
.menu-courses > summary::-webkit-details-marker { display: none; }
.menu-courses > summary::after { content: " ▾"; font-size: .8em; }
.menu-courses[data-current] > summary, .menu-courses > summary:hover { background: var(--teal-light); color: var(--teal-deep); }
.menu-panel { position: absolute; z-index: 30; top: calc(100% + .4rem); inset-inline-start: 0; background: var(--card); border: 2px solid var(--line); border-radius: var(--r-md); padding: .5rem; box-shadow: 0 10px 30px rgba(31, 42, 90, .15); width: max-content; min-width: 260px; max-width: min(360px, 90vw); }
.menu-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.menu-list a, .menu-all { color: var(--ink); text-decoration: none; padding: .35rem .6rem; border-radius: var(--r-sm); min-height: 44px; display: flex; gap: .55rem; align-items: center; }
.menu-list a:hover, .menu-all:hover { background: var(--teal-light); }
.menu-list a.is-soon { color: var(--ink-soft); }
.menu-list a.is-soon strong { font-weight: 600; }
.menu-emoji { font-size: 1.2rem; width: 1.6rem; text-align: center; flex: none; }
.soon-tag { display: inline-block; font-style: normal; font-size: .72rem; font-weight: 800; letter-spacing: .02em; color: var(--ink); background: var(--paint-sun); border-radius: 999px; padding: .05rem .5rem; vertical-align: middle; white-space: nowrap; }
.menu-all { border-top: 2px solid var(--line); margin-top: .3rem; border-radius: 0 0 var(--r-sm) var(--r-sm); font-weight: 800; color: var(--teal-deep); }
.course-card.is-soon { border-style: dashed; box-shadow: none; }
.course-card.is-soon .course-emoji { opacity: .7; }
.soon-note { background: var(--paper); border-radius: var(--r-sm); padding: .6rem .8rem; }
.header-search { flex: 0 1 260px; }
.search-icon { display: none; place-items: center; min-width: 44px; min-height: 44px; border-radius: 50%; text-decoration: none; font-size: 1.2rem; }
.search-icon:hover { background: var(--teal-light); }
@media (min-width: 981px) and (max-width: 1599px) {
  .header-search { display: none; }
  .search-icon { display: grid; }
  .site-nav .nav-emoji { display: none; }
}
.search-box { position: relative; display: flex; align-items: center; }
.search-box input { width: 100%; min-height: 44px; font: inherit; padding: .45rem 2.8rem .45rem .9rem; border: 2px solid var(--line); border-radius: 999px; background: var(--paper); }
[dir="rtl"] .search-box input { padding: .45rem .9rem .45rem 2.8rem; }
.search-go { position: absolute; inset-inline-end: .2rem; min-width: 44px; min-height: 44px; border: 0; background: none; cursor: pointer; font-size: 1.1rem; }
.search-big { max-width: 640px; margin-top: .75rem; }
.search-big input { font-size: 1.15rem; min-height: 52px; }
.search-suggest { position: absolute; z-index: 40; top: calc(100% + .3rem); inset-inline: 0; list-style: none; margin: 0; padding: .3rem; background: var(--card); border: 2px solid var(--line); border-radius: var(--r-md); box-shadow: 0 10px 30px rgba(31, 42, 90, .15); min-width: 260px; }
.search-suggest a { display: grid; padding: .45rem .6rem; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; min-height: 44px; }
.search-suggest a:hover, .search-suggest a.is-active { background: var(--teal-light); }
.search-suggest small, .result-list small { color: var(--ink-soft); font-size: .85rem; }
.result-group { margin-bottom: 1.25rem; }
.result-group h2 { font-size: 1.2rem; }
.result-list { list-style: none; padding: 0; display: grid; gap: .4rem; }
.result-list a { display: grid; background: var(--card); border-radius: var(--r-sm); padding: .55rem .9rem; color: var(--ink); text-decoration: none; min-height: 44px; }
.result-list a:hover { background: var(--teal-light); }
.course-filters select { min-height: 44px; }
.course-track { margin-bottom: 1.75rem; }
.course-track h2 a { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.course-grid { list-style: none; padding: 0; display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.course-card { display: flex; gap: .8rem; height: 100%; background: var(--card); border: 3px solid var(--line); border-radius: var(--r-md); padding: 1rem; color: var(--ink); text-decoration: none; box-shadow: var(--press); }
.course-card:hover { border-color: var(--teal); }
.course-emoji { font-size: 2rem; line-height: 1; }
.course-body { display: grid; gap: .3rem; }
.course-body small { color: var(--ink-soft); }
.course-facts { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; }
.course-facts span { font-size: .85rem; font-weight: 700; background: var(--paper); border-radius: 999px; padding: .1rem .6rem; }
.course-head h2 { font-size: 1.2rem; margin-top: .75rem; }
.outcomes { list-style: none; padding: 0; display: grid; gap: .3rem; }
.module { background: var(--card); border-radius: var(--r-md); margin-bottom: .6rem; border: 2px solid var(--line); }
.module > summary { cursor: pointer; padding: .8rem 1rem; font-weight: 800; display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.module > summary small { color: var(--ink-soft); font-weight: 600; }
.step-list { list-style: none; padding: 0 .6rem .6rem; margin: 0; display: grid; gap: .3rem; }
.step-link { display: flex; gap: .7rem; align-items: center; min-height: 44px; padding: .3rem .5rem; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
.step-link:hover { background: var(--teal-light); }
.step-mark { display: grid; place-items: center; min-width: 2rem; height: 2rem; border-radius: 50%; background: var(--paper); font-weight: 800; font-size: .9rem; }
.step-link.is-done .step-mark { background: var(--paint-leaf); }
.step-link.is-started .step-mark { background: var(--paint-sun); }
.tabbar { display: none; }
@media (max-width: 980px) {
  .header-search { order: 4; flex: 1 1 100%; }
  .menu-panel { position: static; box-shadow: none; width: auto; max-width: none; margin-top: .4rem; }
}
@media (max-width: 640px) {
  .nav-toggle, .site-nav, .header-search { display: none !important; }
  .tabbar { display: flex; position: fixed; inset: auto 0 0 0; z-index: 25; background: var(--card); border-top: 3px solid var(--line); justify-content: space-around; padding: .2rem .2rem calc(.2rem + env(safe-area-inset-bottom)); }
  .tabbar > a, .tab-more > summary { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 52px; min-width: 56px; padding: .2rem .3rem; font-size: .8rem; font-weight: 700; color: var(--ink); text-decoration: none; border-radius: var(--r-sm); list-style: none; cursor: pointer; }
  .tab-more > summary::-webkit-details-marker { display: none; }
  .tabbar span { font-size: 1.25rem; }
  .tabbar > a[aria-current="page"] { background: var(--teal-light); color: var(--teal-deep); }
  .tab-more-panel { position: absolute; bottom: calc(100% + .3rem); inset-inline-end: .5rem; background: var(--card); border: 2px solid var(--line); border-radius: var(--r-md); padding: .4rem; display: grid; min-width: 220px; box-shadow: 0 -8px 30px rgba(31, 42, 90, .15); }
  .tab-more-panel a { min-height: 44px; display: flex; align-items: center; padding: .3rem .7rem; color: var(--ink); text-decoration: none; border-radius: var(--r-sm); }
  body { padding-bottom: 4.5rem; }
  body:has(.dash-nav) .tabbar { display: none; }  /* the dashboards have their own bottom bar */
  body:has(.dash-nav) { padding-bottom: 0; }
  body:not(:has(.dash-nav)) .settings-tab { bottom: 5rem; }
}
.popular, .home-courses { margin-block: 1.5rem; }
.home-track a { display: inline-flex; align-items: center; min-height: 44px; }
.popular-row { flex-wrap: wrap; overflow: visible; }
.home-track { margin-top: 1rem; }
.home-track a { color: var(--ink); text-decoration: none; }
.hero .search-big { margin-top: 1rem; }
.surah-meta { font-size: .8rem; opacity: .85; }

/* ---------- Sort and filter chips (surah list, Nazrah course) ---------- */
.sort-panel { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg); padding: .8rem 1rem; display: grid; gap: .55rem; margin-bottom: 1.25rem; }
.sort-panel > * { margin: 0; }
.sort-panel .chip-row { display: flex; align-items: center; gap: .6rem; min-width: 0; margin: 0; overflow: visible; padding: 0; }
.chip-label { flex: none; width: 7.5rem; font-weight: 800; font-size: .85rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.sort-panel .chips { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding: 2px; min-width: 0; }
.sort-panel .chips::-webkit-scrollbar { display: none; }
.sort-panel .chip, .chip-clear { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); font-weight: 700; font-size: .95rem; text-decoration: none; white-space: nowrap; }
.sort-panel .chip:hover { border-color: var(--teal); }
.sort-panel .chip.is-on { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip-clear { background: none; color: var(--teal-deep); }
.pill-select, .pill-input, .filter-bar .pill-select { min-height: 44px; font: inherit; font-weight: 700; padding: 0 2.2rem 0 1rem; border: 2px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); }
.pill-select, .filter-bar .pill-select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: right 1.1rem center, right .75rem center; background-size: .35rem .35rem; background-repeat: no-repeat; cursor: pointer; }
[dir="rtl"] .pill-select, [dir="rtl"] .filter-bar .pill-select { padding: 0 1rem 0 2.2rem; background-position: left .75rem center, left 1.1rem center; }
.pill-input { padding: 0 1rem; font-weight: 500; flex: 1 1 240px; max-width: 360px; }
.sort-panel .sort-find { flex-wrap: wrap; border-top: 2px dashed var(--line); padding-top: .6rem; }
.js [data-no-js-only] { display: none; }
@media (max-width: 640px) {
  .sort-panel .chip-row { flex-direction: column; align-items: stretch; gap: .25rem; }
  .chip-label { width: auto; }
  .sort-panel .chips { margin-inline: -1rem; padding-inline: 1rem; }
  .sort-panel .sort-find { flex-direction: row; align-items: center; }
}

/* ---------- Surah page: ayah by ayah ---------- */
.reader-bar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); padding: .5rem 0; margin-bottom: .75rem; border-bottom: 2px solid var(--line); }
.reader-jump { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; }
.reader-ayahs { padding: .5rem clamp(.75rem, 2.5vw, 2rem); overflow-anchor: none; }
.ayah-row { border-bottom: 2px solid var(--line); padding: .6rem 0 .4rem; scroll-margin-top: 5rem; transition: background .2s; border-radius: var(--r-sm); }
.ayah-row:last-child { border-bottom: 0; }
.ayah-row.is-playing { background: color-mix(in srgb, var(--paint-sun) 45%, var(--card)); box-shadow: inset 4px 0 0 var(--teal); }
[dir="rtl"] .ayah-row.is-playing { box-shadow: inset -4px 0 0 var(--teal); }
.ayah-row.is-playing .ayah-end, .ayah-row.is-playing .ayah-key { background: var(--teal); color: #fff; }
.ayah-row.is-playing .ayah-sign { color: var(--teal-deep); }
.ayah-row .ayah { margin: 0; padding: 0 .25rem; }
.ayah-tools { display: flex; align-items: center; gap: .35rem; font-family: var(--font-ui); font-size: 1rem; line-height: 1.2; }
.ayah-key { font-weight: 800; color: var(--teal-deep); background: var(--teal-light); border-radius: 999px; padding: .2rem .65rem; font-size: .85rem; margin-inline-end: .2rem; }
.ayah-btn { min-width: 44px; min-height: 44px; border-radius: 999px; border: 2px solid transparent; background: none; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .3rem; }
.ayah-btn:hover, .ayah-btn:focus-visible { border-color: var(--line); background: var(--paper); }
.ayah-btn-wide { padding: 0 .8rem; font-size: .85rem; color: var(--ink-soft); }
.ayah-tools .ayah-report { margin-inline-start: auto; }
.reader-ayahs .ayah-end { cursor: default; }
.load-more { display: flex; justify-content: center; align-items: center; min-height: 44px; margin: .5rem 0; font-weight: 700; color: var(--teal-deep); }
.load-more[hidden] { display: none; }
.pager-end { margin-top: 1.25rem; align-items: center; }
.step-note { font-size: .8rem; color: var(--ink-soft); font-weight: 600; }
.menu-text { display: grid; gap: .05rem; line-height: 1.25; }
.menu-text small { font-size: .82rem; font-weight: 500; color: var(--ink-soft); }
.menu-list a { padding-block: .45rem; }

/* ---------- Learning: homework, paths, learner home, placement (phase 2) ---------- */
.homework-list { list-style: none; padding: 0; display: grid; gap: .6rem; }
.homework { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between; background: var(--card); border: 2px solid var(--line); border-radius: var(--r-md); padding: .75rem 1rem; }
.homework.is-overdue { border-color: var(--heavy); }
.homework.is-finished { opacity: .75; }
.homework-main { flex: 1 1 260px; display: grid; gap: .25rem; min-width: 0; }
.homework-title { font-weight: 800; color: var(--ink); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.homework-meta { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; }
.homework-note { margin: 0; color: var(--ink-soft); }
.chip-tag { display: inline-flex; align-items: center; font-size: .82rem; font-weight: 700; background: var(--paper); border-radius: 999px; padding: .1rem .6rem; }
.chip-tag.is-late { background: var(--paint-rose); }
.chip-tag.is-ok { background: var(--paint-leaf); }
.homework-done > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.path-steps { list-style: none; padding: 0; display: grid; gap: .5rem; }
.path-step { display: flex; gap: .8rem; align-items: flex-start; background: var(--card); border: 2px solid var(--line); border-radius: var(--r-md); padding: .75rem 1rem; }
.path-step.is-now { border-color: var(--teal); box-shadow: var(--press); }
.path-step.is-soon { border-style: dashed; }
.path-step a { color: var(--ink); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.path-mark { flex: none; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--paper); font-weight: 800; }
.path-step.is-done .path-mark { background: var(--paint-leaf); }
.path-step.is-now .path-mark { background: var(--teal); color: #fff; }
.path-body { flex: 1; display: grid; gap: .25rem; min-width: 0; }
.path-line { font-size: .82rem; color: var(--ink-soft); }
.week-stats { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; }
.week-stats li { background: var(--card); border-radius: var(--r-md); padding: .8rem 1rem; display: grid; }
.week-stats strong { font-size: 1.8rem; color: var(--teal-deep); }
.placement fieldset { border: 2px solid var(--line); margin: 0 0 .8rem; }
.choice-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.choice { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 1rem; border: 2px solid var(--line); border-radius: 999px; background: var(--paper); cursor: pointer; font-weight: 600; }
.choice:has(input:checked) { border-color: var(--teal); background: var(--teal-light); }
.learnt-form { display: inline-flex; }
.course-next { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; background: var(--card); border: 2px solid var(--line); border-radius: var(--r-md); padding: .6rem 1rem; margin-top: 1.5rem; }
.course-next a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 700; }
.card-progress { font-size: .8rem; font-weight: 700; color: var(--teal-deep); }
.page-tools { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1.25rem; }
.module-assign { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; margin-inline-start: auto; }
.homework-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; } .form-stack fieldset { border: 0; padding: 0; } .form-stack input[type=text], .form-stack input[type=date] { min-height: 44px; font: inherit; padding: .3rem .7rem; border: 2px solid var(--line); border-radius: var(--r-sm); width: 100%; max-width: 420px; }
.home-paths { margin-block: 1.5rem; } .placement-cta { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; font-weight: 700; }

/* ---------- Phase 3: course lessons, word by word, tracker, certificates, printables ---------- */
.review-banner { background: color-mix(in srgb, var(--paint-sun) 40%, var(--card)); border: 2px solid var(--paint-sun); border-radius: var(--r-md); padding: .7rem 1rem; margin-bottom: 1rem; }
.review-banner p { margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.hadith-card { background: var(--card); border-inline-start: 5px solid var(--teal); border-radius: var(--r-md); padding: .9rem 1.1rem; margin: 0 0 1rem; }
.hadith-card blockquote { margin: 0; font-size: 1.1rem; }
.hadith-card figcaption { color: var(--ink-soft); font-size: .9rem; margin-top: .4rem; }
.hadith-lesson { margin-top: .5rem; border-top: 2px dashed var(--line); padding-top: .5rem; }
.self-check .check-list { display: grid; gap: .8rem; padding-inline-start: 1.2rem; }
.check-choices { list-style: "○ "; padding-inline-start: 1.2rem; }
.check-answer > summary { cursor: pointer; font-weight: 700; color: var(--teal-deep); min-height: 44px; display: flex; align-items: center; }
.learn-tip-activity { background: color-mix(in srgb, var(--paint-leaf) 45%, var(--card)); }
.wbw { display: grid; gap: .8rem; }
.wbw-ayah { background: var(--card); border-radius: var(--r-md); padding: .6rem .9rem; border: 2px solid var(--line); }
.wbw-ayah.is-playing { border-color: var(--teal); background: color-mix(in srgb, var(--paint-sun) 35%, var(--card)); }
.wbw-words { list-style: none; padding: 0; margin: .3rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem .9rem; }
.wbw-word { display: grid; justify-items: center; text-align: center; min-width: 3.5rem; padding: .2rem .3rem; border-radius: var(--r-sm); }
.wbw-word:hover { background: var(--teal-light); }
.wbw-ar { font-family: var(--font-quran); font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.9; }
.wbw-say { font-size: .78rem; color: var(--ink-soft); font-style: italic; }
.wbw-meaning { font-size: .9rem; font-weight: 700; color: var(--teal-deep); max-width: 9rem; }
.ramadan-days { list-style: none; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ramadan-day form { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-md); padding: .6rem .8rem; display: grid; gap: .2rem; }
.ramadan-day.is-fasted form { border-color: var(--teal); }
.ramadan-day-n { margin: 0; font-weight: 800; }
.tick { display: flex; align-items: center; gap: .5rem; min-height: 44px; }
.tick input[type="checkbox"] { width: 1.3rem; height: 1.3rem; }
.ramadan-totals { display: flex; gap: 1rem; }
.verified { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; font-weight: 700; color: var(--teal-deep); }
.certificate { background: var(--card); border: 10px double var(--teal); border-radius: var(--r-md); padding: 2rem 1.5rem; text-align: center; max-width: 820px; margin: 1rem auto; }
.cert-brand { font-weight: 800; color: var(--teal-deep); letter-spacing: .05em; }
.cert-title { font-size: clamp(2rem, 6vw, 3.2rem); margin: .2rem 0 1rem; }
.cert-name { font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 800; border-bottom: 2px solid var(--line); display: inline-block; padding: 0 1rem; }
.cert-course { font-size: 1.4rem; font-weight: 700; }
.cert-foot { display: flex; justify-content: space-around; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }
.cert-code { font-size: .85rem; color: var(--ink-soft); margin-top: 1.5rem; word-break: break-all; }
.printable { background: var(--card); border-radius: var(--r-md); padding: 1.2rem; }
.print-brand { color: var(--ink-soft); font-size: .85rem; margin: 0; }
.print-name { margin: .2rem 0 1rem; }
.sheet-block { break-inside: avoid; border-top: 2px solid var(--line); padding-top: .6rem; margin-top: .8rem; }
.sheet-choices { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; }
.sheet-lines { border-bottom: 1px solid var(--ink-soft); height: 1.8rem; margin: 0 0 .2rem; }
.print-name { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.fill-line { display: inline-block; width: min(14rem, 55vw); border-bottom: 1px solid var(--ink-soft); }
.fill-line.short { width: 7rem; }
.sheet-activity { border: 2px dashed var(--line); border-radius: var(--r-sm); padding: .5rem .7rem; }
.card-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.print-card { border: 2px dashed var(--ink-soft); border-radius: var(--r-sm); padding: .7rem; break-inside: avoid; }
.print-card-title { font-weight: 800; margin: 0; }
.print-card-ar { font-family: var(--font-quran); font-size: 1.5rem; line-height: 2; margin: .3rem 0; }
.print-card-say { font-style: italic; margin: 0; }
.print-card-meaning, .print-card-source { font-size: .9rem; margin: .3rem 0 0; }
.letters-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .5rem; }
.letters-cell { border: 2px solid var(--line); border-radius: var(--r-sm); display: grid; justify-items: center; padding: .4rem; }
.letters-char { font-family: var(--font-quran); font-size: 2.6rem; line-height: 1.6; }
.letters-name { font-size: .85rem; font-weight: 700; }
.ramadan-sheet { width: 100%; border-collapse: collapse; }
.ramadan-sheet th, .ramadan-sheet td { border: 1px solid var(--line); padding: .25rem .4rem; text-align: center; }
@media print {
  .site-header, .site-footer, .tabbar, .settings-tab, .crumbs, .no-print, .page-tools, .course-next, .flash { display: none !important; }
  body { background: #fff; padding: 0; }
  .printable, .certificate { border-radius: 0; box-shadow: none; }
  .certificate { margin: 0 auto; page-break-inside: avoid; }
}

/* ---------- Phase 4: the installable app ---------- */
.save-offline { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: 0 .9rem; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; }
.save-offline.is-saved { border-color: var(--teal); background: var(--teal-light); color: var(--teal-deep); }
.save-offline[disabled] { opacity: .75; cursor: progress; }
.module > summary .save-offline { margin-inline-start: .3rem; }
.install-row { display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: center; align-items: center; margin-top: .75rem; }
.install-row a { min-height: 44px; display: inline-flex; align-items: center; }
.tab-install { min-height: 44px; text-align: start; padding: .3rem .7rem; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; border-radius: var(--r-sm); }
.push-toggle { display: grid; gap: .4rem; }
