/* ==========================================================================
   Noor-e-Taj Quran — styles
   Calm, readable, Islamic-inspired: parchment + emerald + muted gold.
   ========================================================================== */

/* Optional self-hosted King Fahd Complex font (see README). Falls back to Amiri Quran. */
/* Self-hosted Amiri Quran (SIL Open Font License, see /fonts/OFL-Amiri.txt) — works offline. */
@font-face { font-family: "Amiri Quran Local"; src: url("../fonts/AmiriQuran-Regular.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Amiri"; src: url("../fonts/Amiri-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Amiri"; src: url("../fonts/Amiri-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }

@font-face {
  font-family: "UthmanicHafs";
  src: url("../fonts/UthmanicHafs.woff2") format("woff2"), url("../fonts/UthmanicHafs.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #f6f1e6;
  --bg-pattern: rgba(15, 87, 65, 0.045);
  --surface: #fffdf8;
  --surface-2: #f1ebdc;
  --ink: #1c2823;
  --ink-soft: #3d4b44;
  --muted: #6c7a72;
  --line: #e4dccb;
  --brand: #0f5741;
  --brand-ink: #ffffff;
  --brand-soft: #e2efe8;
  --gold: #a87b2f;
  --gold-soft: #f4e9d2;
  --danger: #b4232b;
  --ok: #1f7a4d;
  --focus: #c48a22;
  --shadow: 0 1px 2px rgba(28, 40, 35, .06), 0 4px 16px rgba(28, 40, 35, .06);
  --radius: 14px;
  --radius-sm: 10px;
  --quran-size: 34px;
  --quran-font: "UthmanicHafs", "Amiri Quran Local", "Amiri Quran", serif;
  --ui-font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ar-ui-font: "Amiri", "Amiri Quran Local", serif;
  --highlight: rgba(168, 123, 47, .22);
  --select-ring: #1d6fb8;
  --play-tint: rgba(29, 111, 184, .10);
  --play-bar: #1d6fb8;
  --tabbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1512; --bg-pattern: rgba(214, 170, 92, .035); --surface: #141f1b; --surface-2: #1b2924;
    --ink: #ebe6d8; --ink-soft: #cfd6cf; --muted: #9aa79f; --line: #26352f; --brand: #48b38c; --brand-ink: #0b1411;
    --brand-soft: #193429; --gold: #d6aa5c; --gold-soft: #2c2618; --danger: #ff7b80; --ok: #5fd39a; --focus: #e2b765;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); --highlight: rgba(214, 170, 92, .22); --select-ring: #6cb4f0; --play-tint: rgba(108, 180, 240, .14); --play-bar: #6cb4f0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1512; --bg-pattern: rgba(214, 170, 92, .035); --surface: #141f1b; --surface-2: #1b2924;
  --ink: #ebe6d8; --ink-soft: #cfd6cf; --muted: #9aa79f; --line: #26352f; --brand: #48b38c; --brand-ink: #0b1411;
  --brand-soft: #193429; --gold: #d6aa5c; --gold-soft: #2c2618; --danger: #ff7b80; --ok: #5fd39a; --focus: #e2b765;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); --highlight: rgba(214, 170, 92, .22); --select-ring: #6cb4f0; --play-tint: rgba(108, 180, 240, .14); --play-bar: #6cb4f0;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--ui-font); font-size: 16px; line-height: 1.55;
  color: var(--ink); background-color: var(--bg);
  background-image:
    radial-gradient(circle at 0 0, var(--bg-pattern) 2px, transparent 2.5px),
    radial-gradient(circle at 12px 12px, var(--bg-pattern) 2px, transparent 2.5px);
  background-size: 24px 24px;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
body.has-player { padding-bottom: calc(var(--tabbar-h) + 84px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  body.has-player { padding-bottom: 92px; }
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.ar { font-family: var(--ar-ui-font); direction: rtl; unicode-bidi: isolate; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--brand); color: var(--brand-ink); padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: .5rem; }
.noscript { padding: 2rem; text-align: center; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem;
  padding: .6rem max(1rem, env(safe-area-inset-left)); background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.nav { display: none; gap: .25rem; margin-left: 1rem; }
.nav a { color: var(--ink-soft); padding: .45rem .75rem; border-radius: 999px; font-weight: 600; font-size: .95rem; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.account-link { font-weight: 600; padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); white-space: nowrap; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
.account-link:hover { text-decoration: none; background: var(--surface-2); }
@media (min-width: 900px) { .nav { display: flex; } .tabbar { display: none !important; } }
@media (max-width: 899px) { .account-link { display: none; } }

/* ---------- Bottom tab bar (mobile) ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .72rem; font-weight: 600; }
.tabbar a:hover { text-decoration: none; }
.tabbar svg { width: 24px; height: 24px; fill: currentColor; }
.tabbar a.active { color: var(--brand); }

/* ---------- Layout ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 1.25rem 1rem 2rem; outline: none; }
main:focus, main:focus-visible { outline: none; }
.empty svg { display: inline; width: 1em; height: 1em; vertical-align: -2px; fill: currentColor; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-head p { margin: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.card h2, .card h3 { margin-top: 0; }
.card-link { display: block; color: inherit; transition: border-color .15s, transform .15s; }
.card-link:hover { text-decoration: none; border-color: var(--brand); }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.spacer { flex: 1; }
.loading { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.divider { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 1.8rem 1.5rem; color: #f7f1e3;
  background: linear-gradient(135deg, #0f5741 0%, #0b3d2e 60%, #082d22 100%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; opacity: .14; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23e7c98b' stroke-width='1.2'%3E%3Cpath d='M40 6l9 22 22 9-22 9-9 22-9-22-22-9 22-9z'/%3E%3Ccircle cx='40' cy='40' r='10'/%3E%3C/g%3E%3C/svg%3E");
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; }
.hero p { color: #d9e7df; max-width: 46ch; }
.hero .btn { background: #e7c98b; color: #2a200d; border-color: transparent; }
.hero .btn.ghost { background: transparent; color: #f7f1e3; border-color: rgba(247, 241, 227, .45); }
.hero.has-logo { display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center; }
.hero-logo { width: clamp(150px, 22vw, 230px); height: auto; border-radius: 22%; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
@media (max-width: 640px) { .hero.has-logo { grid-template-columns: 1fr; } .hero-logo { order: -1; justify-self: center; width: min(220px, 70vw); } }
.dedication { display: flex; gap: 1rem; align-items: center; }
.dedication .t-ur { font-size: 1.15rem; line-height: 2; }
.dedication img { width: 120px; height: auto; border-radius: 22%; flex: none; }
@media (max-width: 560px) { .dedication { flex-direction: column; text-align: center; } }
.hero-ar { font-family: var(--quran-font); font-size: 1.6rem; color: #e7c98b; margin-bottom: .5rem; direction: rtl; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px; padding: .5rem 1rem;
  border-radius: 999px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  font-weight: 650; cursor: pointer; text-decoration: none; transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.subtle { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.btn.sm { min-height: 34px; padding: .3rem .75rem; font-size: .875rem; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; border: 1px solid transparent;
  background: transparent; cursor: pointer; color: var(--ink-soft);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn.on { color: var(--brand); background: var(--brand-soft); }
.field { display: grid; gap: .35rem; margin-bottom: .9rem; }
.field label { font-weight: 600; font-size: .9rem; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: .55rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.error-text { color: var(--danger); font-size: .875rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 650; background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); }
.chip.gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.chip.green { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; border: 1px solid var(--line); }
.segmented button { border: 0; background: transparent; padding: .4rem .9rem; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; user-select: none; font-weight: 600; font-size: .9rem; }
.switch input { appearance: none; width: 40px; height: 24px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(16px); }

/* ---------- Banners ---------- */
.banner { padding: .7rem 1rem; text-align: center; font-size: .9rem; font-weight: 600; }
.banner-warn { background: var(--gold-soft); color: var(--gold); }
.notice { border-radius: var(--radius); padding: .9rem 1.1rem; border: 1px solid var(--line); background: var(--surface-2); font-size: .92rem; }
.notice.warn { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
.notice.ok { background: var(--brand-soft); border-color: transparent; }
.notice strong { display: block; margin-bottom: .2rem; }
.notice code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; background: var(--surface); padding: .1rem .35rem; border-radius: 6px; border: 1px solid var(--line); word-break: break-all; }

/* ---------- Surah index ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: .7rem 1rem; font-weight: 650; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.surah-list { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.surah-item { display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; }
.surah-item:hover { border-color: var(--brand); text-decoration: none; }
.num-badge {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; font-weight: 700; font-size: .85rem; color: var(--brand);
  background: var(--brand-soft); clip-path: polygon(50% 0, 62% 12%, 79% 9%, 82% 27%, 97% 36%, 88% 50%, 97% 64%, 82% 73%, 79% 91%, 62% 88%, 50% 100%, 38% 88%, 21% 91%, 18% 73%, 3% 64%, 12% 50%, 3% 36%, 18% 27%, 21% 9%, 38% 12%);
}
.surah-item .meta { flex: 1; min-width: 0; }
.surah-item .name { font-weight: 700; }
.surah-item .sub { color: var(--muted); font-size: .82rem; }
.surah-item .ar-name { font-family: var(--quran-font); font-size: 1.45rem; color: var(--ink-soft); direction: rtl; }
.goto { display: flex; gap: .5rem; max-width: 420px; }

/* ---------- Reader ---------- */
.reader-head {
  position: sticky; top: 57px; z-index: 20; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .55rem .75rem; margin: -.25rem 0 1rem; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--radius);
}
.reader-title { display: flex; align-items: baseline; gap: .6rem; min-width: 0; }
.reader-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-title .ar { font-family: var(--quran-font); font-size: 1.4rem; }
.surah-banner {
  text-align: center; padding: 1.2rem 1rem 1rem; margin-bottom: 1rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); position: relative;
}
.surah-banner::before, .surah-banner::after { content: ""; position: absolute; top: 2.4rem; width: 18%; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.surah-banner::before { left: 4%; }
.surah-banner::after { right: 4%; transform: scaleX(-1); }
.surah-banner .ar { font-family: var(--quran-font); font-size: 2rem; color: var(--gold); line-height: 1.6; }
.bismillah { font-family: var(--quran-font); font-size: calc(var(--quran-size) * .95); direction: rtl; text-align: center; margin: .25rem 0 0; color: var(--ink); line-height: 2; }

.ayah { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem 1rem; margin-bottom: .8rem; scroll-margin-top: 130px; }
.ayah.playing { border-color: var(--gold); box-shadow: 0 0 0 3px var(--highlight); }
.ayah-bar { display: flex; align-items: center; gap: .25rem; margin-bottom: .35rem; }
.ayah-key { font-weight: 700; font-size: .8rem; color: var(--muted); margin-right: auto; letter-spacing: .02em; }
.ayah-bar .icon-btn { width: 36px; height: 36px; }
.ayah-text {
  font-family: var(--quran-font); font-size: var(--quran-size); line-height: 2.4; direction: rtl; text-align: right;
  padding: .15em 0 .1em; overflow: visible; overflow-wrap: normal; word-break: keep-all; text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  word-spacing: .08em; color: var(--ink); font-feature-settings: "calt", "liga", "mark", "mkmk";
}
.w { cursor: pointer; border-radius: 10px; padding: .1em .1em .05em; transition: background .12s, box-shadow .12s; position: relative; }
.w:hover { background: var(--surface-2); }
/* Selected word: ring. Playing word: underline bar + neutral tint. Neither changes the text colour,
   so Tajweed colours stay visible and the two highlights never look like a Tajweed rule. */
.w.selected { box-shadow: inset 0 0 0 2px var(--select-ring); }
.w.playing { background: var(--play-tint); box-shadow: inset 0 -4px 0 var(--play-bar); }
.w.selected.playing { box-shadow: inset 0 0 0 2px var(--select-ring), inset 0 -4px 0 var(--play-bar); }
.w:focus-visible { outline-offset: 0; }
.end-mark {
  cursor: pointer; background: transparent; font-weight: 700;
  display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; margin: 0 .2em; padding: 0 .15em; vertical-align: middle;
  font-size: .62em; line-height: 1; color: var(--gold); border: 1.5px solid currentColor; border-radius: 50%; font-family: var(--ar-ui-font);
}
.translation { margin-top: .5rem; font-size: .95rem; color: var(--ink-soft); }
.wbw .w { display: inline-flex; flex-direction: column; align-items: center; margin: 0 .15em .4em; vertical-align: top; }
.wbw .w small { font-family: var(--ui-font); font-size: .78rem; line-height: 1.3; direction: ltr; color: var(--muted); max-width: 9em; text-align: center; }
.reader-nav { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1rem; }

/* Tajweed colours (set from the legend at runtime; these are fallbacks) */
.tj { color: var(--tj-color, inherit); }
body.no-tajweed .tj { color: inherit !important; }

/* ---------- Bottom sheet / dialog ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(9, 15, 12, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; max-height: 86vh; overflow: auto; background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 1rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.2);
}
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 20px; } }
.sheet-grip { width: 42px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto .75rem; }
.sheet-head { display: flex; align-items: start; gap: .5rem; margin-bottom: .5rem; }
.sheet-head h2 { flex: 1; margin: 0; }
.big-word { font-family: var(--quran-font); font-size: 2.6rem; line-height: 1.9; direction: rtl; text-align: center; padding: .25rem 0; }
.rule-card { border-left: 5px solid var(--rule-color, var(--line)); background: var(--surface-2); border-radius: var(--radius-sm); padding: .7rem .9rem; margin: .5rem 0; }
.rule-card h3 { margin: 0 0 .2rem; font-size: 1rem; }
.rule-card .ar { font-size: 1.1rem; color: var(--muted); }
.pre { white-space: pre-line; }

/* ---------- Audio player ---------- */
.player {
  position: fixed; left: .5rem; right: .5rem; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + .5rem); z-index: 40;
  display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,.18); max-width: 900px; margin: 0 auto;
}
@media (min-width: 900px) { .player { bottom: 1rem; } }
.player .now { flex: 1; min-width: 0; font-size: .85rem; }
.player .now strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: .3rem; }
.player .progress > i { display: block; height: 100%; width: 0; background: var(--brand); }
.player .play { width: 46px; height: 46px; background: var(--brand); color: var(--brand-ink); }
.player .play:hover { background: var(--brand); filter: brightness(1.08); }
.player select { min-height: 34px; padding: .2rem .4rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: .82rem; }
@media (max-width: 520px) { .player .hide-sm { display: none; } }

/* ---------- Learn ---------- */
.level-title { display: flex; align-items: center; gap: .6rem; margin: 1.6rem 0 .8rem; }
.level-title .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }
.lesson-card { display: flex; gap: .9rem; align-items: start; }
.lesson-card .n { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; color: var(--muted); }
.lesson-card.done .n { background: var(--brand); color: var(--brand-ink); }
.lesson-card h3 { margin: 0 0 .15rem; }
.lesson-card p { margin: 0; color: var(--muted); font-size: .9rem; }
.lesson-body h2 { margin-top: 1.4rem; }
.lesson-body .pre { color: var(--ink-soft); }
.example-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.example { text-align: center; padding: .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.example:hover { border-color: var(--brand); }
.example .word { font-family: var(--quran-font); font-size: 2rem; line-height: 1.9; direction: rtl; }
.example .ref { font-size: .75rem; color: var(--muted); }
.quiz-q { margin-bottom: 1.1rem; }
.quiz-q fieldset { border: 0; padding: 0; margin: 0; }
.quiz-q legend { font-weight: 650; margin-bottom: .5rem; }
.option { display: flex; gap: .6rem; align-items: center; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: .4rem; cursor: pointer; background: var(--surface); }
.option:hover { border-color: var(--brand); }
.option input { accent-color: var(--brand); }
.option.correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.option.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.option .ar, .option-ar { font-size: 1.2rem; }

/* ---------- Progress ---------- */
.stat { display: grid; gap: .1rem; }
.stat .v { font-size: 1.7rem; font-weight: 750; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: .85rem; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 60%, var(--gold))); border-radius: 99px; }
.days { display: grid; grid-template-columns: repeat(15, 1fr); gap: 4px; }
.days i { aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); }
.days i.on { background: var(--brand); }

/* ---------- Practice / recorder ---------- */
.recorder { display: grid; gap: .8rem; }
.rec-btn { width: 72px; height: 72px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; background: var(--danger); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--danger) 35%, transparent); }
.rec-btn svg { width: 30px; height: 30px; fill: currentColor; }
.rec-btn.recording { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--danger) 18%, transparent); } }
@media (prefers-reduced-motion: reduce) { .rec-btn.recording { animation: none; } * { scroll-behavior: auto !important; } }
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s; }
.wave { width: 100%; height: 64px; background: var(--surface-2); border-radius: var(--radius-sm); }
.rec-item { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.rec-item audio { height: 36px; max-width: 100%; }
.disclaimer { font-size: .85rem; color: var(--muted); border-left: 3px solid var(--gold); padding-left: .7rem; }

/* ---------- Legend ---------- */
.legend-grid { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.legend-item { display: flex; gap: .8rem; align-items: start; cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit; }
.swatch { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--c, var(--surface-2)); border: 1px solid var(--line); }
.swatch.none { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, var(--surface) 4px, var(--surface) 8px); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 100px); z-index: 80;
  background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 999px; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow); max-width: 90vw;
}
@media (min-width: 900px) { .toast { bottom: 110px; } }

/* ---------- Landscape phones: give the text room ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  .reader-head { position: static; }
  .topbar { position: static; }
  .ayah-text { line-height: 2; }
}

@media print {
  .topbar, .tabbar, .player, .ayah-bar, .reader-head { display: none !important; }
  body { background: #fff; }
}
.ayah-text a.w { color: inherit; text-decoration: none; }

/* ---------- Interactive reader additions ---------- */
.ayah.flash { box-shadow: 0 0 0 3px var(--highlight); border-color: var(--gold); }
.ayah.playing { border-color: var(--play-bar); box-shadow: 0 0 0 3px var(--play-tint); }
.end-mark:hover { background: var(--gold-soft); }
.page-marker { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .8rem; font-weight: 700; margin: .4rem 0 .9rem; }
.page-marker::before, .page-marker::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.surah-ornament { height: 10px; margin: -.4rem auto .3rem; width: 160px; background:
  radial-gradient(circle, var(--gold) 2px, transparent 2.5px) center/16px 10px repeat-x; opacity: .7; }
.juz-banner .ar { font-family: var(--ui-font); font-size: 1.4rem; font-weight: 700; color: var(--gold); }
.mini-select, .mini-input { min-height: 34px; padding: .2rem .4rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: .85rem; }
.mini-input { width: 4.5rem; text-align: center; }
.reciter-select { max-width: 11rem; }
.rule-chip { border: 0; cursor: pointer; font: inherit; font-size: .8rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px;
  color: var(--ink); background: color-mix(in srgb, var(--rule-color, var(--line)) 18%, var(--surface)); border-left: 4px solid var(--rule-color, var(--line)); }

.wordbar {
  position: fixed; left: .5rem; right: .5rem; z-index: 45; max-width: 900px; margin: 0 auto;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + .5rem);
  display: grid; grid-template-columns: auto 1fr; gap: .4rem .9rem; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: .6rem .8rem; box-shadow: 0 8px 30px rgba(0,0,0,.18);
}
body.has-player .wordbar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 76px); }
@media (min-width: 900px) { .wordbar { bottom: 1rem; } body.has-player .wordbar { bottom: 86px; } }
.wordbar-word { font-family: var(--quran-font); font-size: 2.2rem; line-height: 1.9; padding: 0 .3rem; grid-row: span 2; }
.wordbar-info { min-width: 0; }
.wordbar-actions { grid-column: 1 / -1; display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
@media (min-width: 700px) { .wordbar { grid-template-columns: auto 1fr auto; } .wordbar-word { grid-row: auto; } .wordbar-actions { grid-column: auto; } }

/* Surah list with play buttons */
.surah-item { padding: 0; }
.surah-link { display: flex; align-items: center; gap: .9rem; padding: .8rem .2rem .8rem 1rem; flex: 1; min-width: 0; color: inherit; }
.surah-link:hover { text-decoration: none; }
.surah-item .meta { display: flex; flex-direction: column; }
.play-mini { margin-right: .5rem; color: var(--brand); flex: none; }
.play-mini:hover { background: var(--brand-soft); text-decoration: none; }
.num-badge svg { width: 18px; height: 18px; fill: currentColor; }

/* Para grid */
.juz-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.juz-card { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.juz-card:hover { border-color: var(--brand); }
.juz-link { flex: 1; display: grid; gap: .15rem; padding: .8rem 1rem; color: inherit; min-width: 0; }
.juz-link:hover { text-decoration: none; }
.juz-num { font-weight: 800; font-size: 1.3rem; color: var(--brand); }
.juz-num::before { content: "Para "; font-size: .8rem; font-weight: 700; color: var(--muted); }
.juz-opening { font-family: var(--quran-font); font-size: 1.35rem; line-height: 1.9; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.juz-card .sub { color: var(--muted); font-size: .8rem; }

/* Page grid */
.page-grid { display: grid; gap: .4rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.page-chip { display: flex; gap: .5rem; align-items: baseline; padding: .45rem .7rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: .85rem; }
.page-chip strong { color: var(--brand); min-width: 2.2rem; }
.page-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-chip:hover { border-color: var(--brand); text-decoration: none; }

/* Search, resume, picker */
.search-box { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search-box .input { flex: 1; }
.resume { display: grid; gap: .25rem; margin-bottom: 1rem; }
.resume .chip { justify-self: start; }
.ayah-picker { display: grid; gap: .5rem; grid-template-columns: 1fr 1fr; }
@media (min-width: 700px) { .ayah-picker { grid-template-columns: 2fr 1fr auto auto; } }
.small-h { font-size: 1rem; }
.result-text { font-family: var(--quran-font); font-size: 1.6rem; line-height: 2.2; margin: .3rem 0 0; color: var(--ink); }
.result mark { background: var(--gold-soft); color: inherit; border-radius: 6px; box-shadow: inset 0 -3px 0 var(--gold); }

/* Player: controls on one row, options on a second row on small screens */
.player { flex-wrap: wrap; row-gap: .35rem; }
.player .now { flex: 1 1 8rem; }
.player-opts { display: flex; gap: .35rem; align-items: center; flex-wrap: nowrap; overflow-x: auto; }
.player-opts select { flex: 0 1 auto; min-width: 0; }
@media (max-width: 899px) { .player-opts { flex-basis: 100%; } .player-opts .reciter-select { flex: 1 1 auto; max-width: none; } }
@media (min-width: 900px) { .player-close { order: 10; } }
.surah-banner .ar { line-height: 2.3; margin-bottom: .2rem; }
.reader-title .ar { line-height: 1.9; }
.surah-item .ar-name { line-height: 2; }
body.has-player { padding-bottom: calc(var(--tabbar-h) + 130px + env(safe-area-inset-bottom)); }
body.has-player .wordbar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 118px); }
@media (min-width: 900px) { body.has-player { padding-bottom: 100px; } body.has-player .wordbar { bottom: 86px; } }

/* ===================== Multilingual learning & translations ===================== */
:root {
  --ur-font: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", "Amiri", serif;
  --hi-font: "Noto Sans Devanagari", "Nirmala UI", "Mangal", var(--ui-font);
}
.t-ur { font-family: var(--ur-font); line-height: 2.25; }
.t-ar { font-family: var(--ar-ui-font); line-height: 1.9; }
/* Pashto: Naskh script (Amiri covers ټ ډ ړ ږ ښ ګ ڼ ې ۍ ځ څ and is stored for offline use) */
.t-ps { font-family: "Amiri", Tahoma, "Noto Naskh Arabic", serif; line-height: 2.1; }
.tr-text.t-ps { font-size: 1.15rem; }
.tr-by { font-weight: 400; color: var(--muted); }
.t-hi { font-family: var(--hi-font); line-height: 1.75; }
[dir="rtl"] { text-align: right; }
[dir="rtl"] .row { direction: rtl; }
.wrap { flex-wrap: wrap; }
.lead { font-size: 1.08rem; }
.h3 { font-size: 1.05rem; margin: 0 0 .5rem; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; line-height: 1.5; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-soft); font-family: var(--ui-font); }
.badge.warn { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.badge.ok { background: var(--brand-soft); border-color: transparent; color: var(--ok); }
.tj-badge { border-width: 2px; border-color: var(--tj-color, var(--line)); }
.check { display: flex; gap: .5rem; align-items: flex-start; padding: .35rem 0; cursor: pointer; }
.check input { margin-top: .45rem; }

.lang-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .5rem; }
.lang-opt { display: flex; flex-direction: column; align-items: center; gap: .1rem; min-height: 56px; padding: .45rem .6rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 1.05rem; }
.lang-opt small { font-size: .72rem; color: var(--muted); font-family: var(--ui-font); }
.lang-opt.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.lang-opt:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.lang-opt .t-ur { line-height: 1.6; }

.learn-hub > * + * { margin-top: 1.1rem; }
.learn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; }
.learn-card { display: flex; gap: .9rem; align-items: flex-start; }
.learn-card h3 { margin: 0 0 .2rem; font-size: 1.05rem; }
.learn-card p { margin: 0; }
.learn-card-icon { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.learn-card-icon svg { width: 22px; height: 22px; fill: currentColor; }
.tr-choose { display: grid; gap: .1rem; }

.rules-lib > * + * { margin-top: 1rem; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .7rem; }
.rule-card { display: flex; flex-direction: column; gap: .35rem; }
.rule-card p { margin: 0; color: var(--ink-soft); }
.rule-card .rule-ar { margin-inline-start: auto; font-size: 1.15rem; color: var(--muted); }
.swatch { width: 14px; height: 14px; border-radius: 4px; background: var(--tj-color, var(--line)); flex: 0 0 auto; }
.swatch.none { background: transparent; border: 1.5px dashed var(--muted); }
.glossary summary { cursor: pointer; font-weight: 700; }
.glossary dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: .8rem 0 0; }
.glossary dt { font-weight: 600; }
.glossary dd { margin: 0; align-self: center; }

.rule-page > * + * { margin-top: 1rem; }
.rule-head h1 { margin: .2rem 0 0; }
.rule-ar-big { font-size: 1.6rem; margin: .1rem 0; color: var(--gold); }
.prose p { margin: 0 0 .7rem; white-space: pre-line; }
.prose p:last-child { margin-bottom: 0; }
.example-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; }
.example-card { display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center; padding: .7rem; }
.example-card .word { font-family: var(--quran-font); font-size: 2.1rem; line-height: 1.9; }
.example-card .row { justify-content: center; }
.verse-card .verse-ar { font-family: var(--quran-font); font-size: calc(var(--quran-size) * .8); line-height: 2.2; margin: .4rem 0; text-align: right; }
.attribution { margin-top: .4rem; }

/* Translation under each ayah (reader, rule pages, search) */
.tr { margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed var(--line); }
.tr.compact { border-top: 0; padding-top: 0; margin-top: .2rem; }
.tr-label { font-size: .72rem; color: var(--muted); text-transform: none; margin-bottom: .15rem; font-family: var(--ui-font); }
.tr-text { margin: 0; font-size: 1.02rem; color: var(--ink-soft); white-space: pre-line; overflow-wrap: anywhere; }
.tr-text.t-ur { font-size: 1.12rem; }
.fn { border: 0; background: none; padding: 0 .1rem; color: var(--brand); font: inherit; font-size: .8em; vertical-align: super; cursor: pointer; line-height: 1; }
.fn:focus-visible { outline: 2px solid var(--focus); border-radius: 4px; }
.fn-panel { margin-top: .45rem; padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: .9rem; color: var(--ink-soft); white-space: pre-line; }
.fn-panel p { margin: 0 0 .4rem; }
.fn-panel p.on { color: var(--ink); font-weight: 600; }
.reader-tr-note { font-size: .78rem; color: var(--muted); margin: .4rem 0 0; }
.tr-sheet .group + .group { margin-top: .8rem; }
.tr-sheet h3 { font-size: .85rem; margin: 0 0 .2rem; color: var(--muted); }
.result .tr { border-top: 0; margin-top: .25rem; padding-top: 0; }
.result mark, .tr-text mark { background: var(--highlight); color: inherit; border-radius: 3px; }

@media (max-width: 600px) {
  .lang-picker { grid-template-columns: repeat(3, 1fr); }
  .lang-opt { min-height: 52px; padding: .35rem .3rem; font-size: .98rem; }
  .learn-grid, .rule-grid { grid-template-columns: 1fr; }
  .example-grid { grid-template-columns: repeat(2, 1fr); }
  .rule-ar-big { font-size: 1.35rem; }
  .glossary dl { grid-template-columns: 1fr; }
  .glossary dd { margin-bottom: .4rem; }
}

/* ---------------------------------------------------------------- Noorani Qaida (children, Urdu) */
.nav-ur { font-family: var(--ur-font); line-height: 1.4; }
.q-ar { font-family: var(--quran-font); direction: rtl; unicode-bidi: isolate; }
.q-home, .q-lesson-page, .q-read { display: grid; gap: 1rem; }
.q-home h1, .q-lesson-page h1 { margin: 0; line-height: 1.9; }
.q-hero { position: relative; overflow: hidden; border-radius: var(--radius); padding: 1.2rem 1.3rem; background: linear-gradient(135deg, var(--brand-soft), var(--gold-soft)); border: 1px solid var(--line); }
.q-hero-letters { position: absolute; inset-inline-start: 1rem; top: .2rem; font-size: 4.2rem; opacity: .12; color: var(--brand); pointer-events: none; }
.q-hero .lead { max-width: 60ch; }
.q-progress { display: grid; gap: .3rem; max-width: 420px; }
.q-progress .bar { height: 10px; border-radius: 999px; background: var(--surface); overflow: hidden; border: 1px solid var(--line); }
.q-progress .bar i { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.q-stage { margin: .4rem 0 0; font-size: 1.25rem; color: var(--brand); }
.q-lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: .75rem; }
.q-lesson { display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: start; }
.q-lesson h3 { margin: 0; font-size: 1.05rem; line-height: 1.9; }
.q-lesson p { margin: .1rem 0 .3rem; }
.q-num { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--gold-soft); color: var(--gold); font-weight: 800; font-size: 1.1rem; font-family: var(--q-font, var(--ur-font)); }
.q-num svg { width: 1.3rem; height: 1.3rem; fill: currentColor; }
.q-lesson.done .q-num { background: var(--brand); color: var(--brand-ink); }
.q-sub-ar { font-family: var(--ar-ui-font); color: var(--muted); font-size: 1.05rem; direction: rtl; }
.q-head { display: grid; gap: .3rem; }
.q-section h2 { margin-top: 0; }
.q-section p { margin: .4rem 0; }
.q-list { margin: .3rem 0; padding-inline-start: 1.2rem; }
.q-list li { margin: .15rem 0; }
.q-big { font-family: var(--quran-font); font-size: 2.4rem; line-height: 1.7; display: block; }

.q-letter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; }
.q-letter-btn { display: grid; justify-items: center; gap: 0; padding: .4rem .3rem .5rem; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; position: relative; min-height: 112px; }
.q-letter-btn:hover, .q-letter-btn[aria-pressed="true"] { border-color: var(--brand); }
.q-letter-btn[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--brand-soft); }
.q-letter-btn.heavy { background: var(--gold-soft); }
.q-letter-panel { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center; margin-top: .7rem; padding: .6rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); min-height: 4.5rem; }
.q-letter-panel > p { grid-column: 1 / -1; margin: 0; }
.q-letter-panel .q-big { font-size: 3.4rem; color: var(--brand); }
.q-letter-panel p { margin: .1rem 0 0; }
.q-name { font-family: var(--q-font, var(--ur-font)); font-size: .95rem; line-height: 1.8; }
.q-heavy { position: absolute; top: .25rem; inset-inline-end: .35rem; font-family: var(--q-font, var(--ur-font)); font-size: .7rem; color: var(--gold); }

.q-pair { display: grid; grid-template-columns: 7.5rem 1fr; gap: .8rem; align-items: center; padding: .3rem 0; border-bottom: 1px dashed var(--line); }
.q-pair:last-child { border-bottom: 0; }
.q-pair-letters { font-size: 2rem; letter-spacing: .3rem; color: var(--brand); }

.q-table-wrap { overflow-x: auto; }
.q-forms, .q-compare { border-collapse: collapse; width: 100%; min-width: 300px; }
.q-forms th, .q-forms td, .q-compare th, .q-compare td { border-bottom: 1px solid var(--line); padding: .15rem .4rem; text-align: center; }
.q-forms td, .q-compare td.q-ar { font-family: var(--quran-font); font-size: 2.2rem; line-height: 2; }
.q-compare td.q-ex { font-size: 1.7rem; color: var(--brand); }
.q-forms tr.nonjoin { background: var(--surface-2); }
.q-forms th, .q-compare th { font-weight: 600; font-size: .9rem; }

.q-sign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.q-sign { display: grid; justify-items: center; padding: .5rem; border-radius: var(--radius-sm); background: var(--surface-2); text-align: center; }
.q-sign .q-big { font-size: 3rem; color: var(--brand); }

.q-drill { display: grid; gap: .35rem; }
.q-drill-row { display: flex; flex-wrap: wrap; gap: .35rem; padding: .2rem 0; border-bottom: 1px dashed var(--line); }
.q-drill-row:last-child { border-bottom: 0; }
.q-syl { display: grid; justify-items: center; min-width: 4.6rem; padding: .1rem .5rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.q-syl .q-big { font-size: 2.2rem; }
.q-hijje { font-family: var(--q-font, var(--ur-font)); font-size: .78rem; line-height: 1.9; color: var(--ink-soft); text-align: center; }

.q-word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .55rem; }
.q-word-grid.wide { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.q-word { display: grid; gap: .2rem; justify-items: center; padding: .45rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); text-align: center; }
.q-word-btn { display: grid; justify-items: center; background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); font: inherit; width: 100%; }
.q-word-text { font-size: 2.1rem; line-height: 1.9; }
.q-play { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.q-play svg { width: 1rem; height: 1rem; fill: currentColor; }
.q-word-btn:hover .q-play { background: var(--brand); color: var(--brand-ink); }
.q-ref { font-size: .75rem; color: var(--muted); direction: ltr; unicode-bidi: isolate; }
.q-say { font-family: var(--q-font, var(--ur-font)); color: var(--brand); font-weight: 600; line-height: 1.9; }
.q-spell { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem; direction: rtl; }
.q-unit { display: grid; justify-items: center; background: var(--surface-2); border-radius: 8px; padding: 0 .35rem .15rem; }
.q-unit b { font-family: var(--quran-font); font-weight: 400; font-size: 1.45rem; line-height: 1.7; }
.q-unit small { font-family: var(--q-font, var(--ur-font)); font-size: .68rem; line-height: 1.8; color: var(--ink-soft); }

.q-rule .row { align-items: baseline; gap: .6rem; }
.q-stop { display: grid; grid-template-columns: 3.5rem 1fr; gap: .8rem; align-items: start; padding: .5rem 0; border-bottom: 1px dashed var(--line); }
.q-stop:last-child { border-bottom: 0; }
.q-stop .q-big { font-size: 2.6rem; color: var(--danger); text-align: center; }
.q-stop p { margin: 0 0 .3rem; }
.q-stop-ex { display: inline-grid; justify-items: center; padding: .1rem .55rem; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); }
.q-stop-ex span { font-family: var(--quran-font); font-size: 1.6rem; line-height: 1.8; direction: rtl; }
.q-stop-ex small { color: var(--muted); font-size: .72rem; direction: ltr; }

.q-surah-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .55rem; }
.q-surah { display: grid; justify-items: center; gap: .1rem; text-align: center; padding: .7rem .5rem; }
.q-surah-ar { font-family: var(--quran-font); font-size: 1.7rem; line-height: 1.8; }

.q-prompt { font-size: 1.15rem; font-weight: 600; margin: .2rem 0; }
.q-ex-show { font-size: 4rem; line-height: 1.7; text-align: center; padding: .2rem 0; color: var(--brand); }
.q-ex-show.word { font-size: 3rem; line-height: 2.2; padding-bottom: .5rem; color: var(--ink); }
.q-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; margin: .4rem 0; }
.q-opt { font-family: var(--q-font, var(--ur-font)); font-size: 1.05rem; line-height: 1.9; justify-content: center; text-align: center; min-height: 3.2rem; }
.q-opt.ar-opt .q-ar { font-size: 2rem; line-height: 1.6; }
.q-feedback { font-size: 1.05rem; font-weight: 600; margin: .3rem 0; min-height: 1.6em; }
.q-feedback.ok { color: var(--ok); }
.q-feedback.bad { color: var(--danger); }
.q-score { font-size: 2rem; font-weight: 800; text-align: center; margin: .2rem 0; }
.q-stars { display: flex; justify-content: center; gap: .25rem; font-size: 2.2rem; color: var(--line); margin-bottom: .6rem; }
.q-stars .on { color: var(--gold); }

.q-surah-title { font-family: var(--quran-font); font-size: 2.4rem; margin: 0; line-height: 1.7; }
.q-read-stage { display: grid; gap: .6rem; }
.q-read-progress { display: flex; flex-wrap: wrap; gap: .25rem; }
.q-read-progress span { width: .8rem; height: .8rem; border-radius: 50%; background: var(--line); }
.q-read-progress span.on { background: var(--gold); }
.q-read-progress span.cur { outline: 2px solid var(--brand); outline-offset: 1px; }
.q-read-ayah { font-size: 1.9rem; line-height: 2.3; text-align: right; }
.q-read-w { cursor: pointer; border-radius: 6px; padding: 0 .1rem; }
.q-read-w.past { color: var(--muted); }
.q-read-w.cur { background: var(--highlight); }
.q-read-end { color: var(--gold); font-size: .85em; }
.q-focus { display: grid; place-items: center; min-height: 8rem; border-radius: var(--radius); background: var(--surface-2); border: 2px dashed var(--line); }
.q-focus-word { font-size: 4.4rem; line-height: 1.8; }
.q-read-ctrl { display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem; align-items: center; }
.q-read-ctrl .btn { justify-content: center; font-family: var(--q-font, var(--ur-font)); }
.q-read-ctrl .btn.big { font-size: 1.15rem; padding: .7rem 1.4rem; }
.q-read-ctrl2 .btn { font-family: var(--q-font, var(--ur-font)); }

.qaida-banner { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center; background: linear-gradient(135deg, var(--gold-soft), var(--brand-soft)); }
.qaida-banner h2 { margin: 0; }
.qaida-banner p { margin: .2rem 0 0; }
.qaida-banner-ar { font-family: var(--quran-font); font-size: 2.4rem; color: var(--brand); line-height: 1.6; }

@media (max-width: 560px) {
  .q-lesson-grid { grid-template-columns: 1fr; }
  .q-letter-grid { grid-template-columns: repeat(4, 1fr); }
  .q-letter-btn { min-height: 100px; }
  .q-big { font-size: 2.1rem; }
  .q-pair { grid-template-columns: 1fr; gap: 0; }
  .q-word-grid { grid-template-columns: repeat(2, 1fr); }
  .q-word-text { font-size: 1.8rem; }
  .q-syl { min-width: 3.8rem; }
  .q-focus-word { font-size: 3.4rem; }
  .q-read-ayah { font-size: 1.6rem; }
  .q-read-ctrl { grid-template-columns: 1fr 1fr; }
  .q-read-ctrl .btn.big { grid-column: 1 / -1; grid-row: 1; }
  .q-opts { grid-template-columns: 1fr 1fr; }
  .q-ex-show { font-size: 3.3rem; }
}
.q-letter-panel { scroll-margin-bottom: calc(var(--tabbar-h) + 1.5rem); }

/* ---------------------------------------------------------------- Qaida pronunciation practice */
.q-syl { border: 2px solid transparent; cursor: pointer; font: inherit; color: var(--ink); position: relative; }
.q-syl:hover, .q-syl:focus-visible { border-color: var(--brand); }
.q-syl.has-ref::after, .q-letter-btn.has-ref::after, .q-forms td.has-ref::after { content: "🔊"; position: absolute; top: 2px; inset-inline-start: 4px; font-size: .62rem; }
.q-syl.needs, .q-letter-btn.needs, .q-word.needs, .q-forms td.needs { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, var(--surface)); }
.q-syl.mastered, .q-letter-btn.mastered, .q-word.mastered, .q-forms td.mastered { border-color: var(--ok); }
.q-forms td { position: relative; padding: 0; }
.q-cell-btn { all: unset; display: block; cursor: pointer; padding: .1rem .4rem; font-family: var(--quran-font); font-size: 2.2rem; line-height: 2; text-align: center; min-width: 3rem; border-radius: 8px; }
.q-cell-btn:hover, .q-cell-btn:focus-visible { background: var(--brand-soft); }
.q-word { position: relative; }
.q-word-foot { display: flex; align-items: center; justify-content: space-between; gap: .4rem; width: 100%; }
.q-mic { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--danger); cursor: pointer; }
.q-mic svg { width: 1rem; height: 1rem; fill: currentColor; }
.q-mic:hover { background: var(--danger); color: #fff; }
.q-home-links { gap: .5rem; }

.q-pr { display: grid; gap: .6rem; text-align: center; }
.q-pr-text { font-family: var(--quran-font); font-size: 4.2rem; line-height: 1.8; border-radius: var(--radius); padding: .2rem 1rem; transition: background .3s; }
.q-pr-text.good { background: color-mix(in srgb, var(--ok) 14%, transparent); }
.q-pr-text.ok { background: var(--gold-soft); }
.q-pr-text.bad { background: color-mix(in srgb, var(--danger) 13%, transparent); }
.q-pr-say { font-size: 1.05rem; margin: 0; }
.q-pr-actions { justify-content: center; gap: .6rem; }
.q-pr-actions .btn { min-width: 9rem; justify-content: center; font-family: var(--q-font, var(--ur-font)); }
.btn.q-rec { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.q-rec.on { animation: q-pulse 1s infinite; }
@keyframes q-pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--danger) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .btn.q-rec.on { animation: none; } }
.q-pr-meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.q-pr-meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s; }
.q-pr-status { min-height: 1.5em; margin: 0; }
.q-pr-result { display: grid; gap: .5rem; }
.q-pr-score { display: grid; justify-items: center; padding: .4rem; border-radius: var(--radius); }
.q-pr-score strong { font-size: 2.6rem; line-height: 1.2; font-family: var(--ui-font); }
.q-pr-score.good strong { color: var(--ok); }
.q-pr-score.ok strong { color: var(--gold); }
.q-pr-score.bad strong { color: var(--danger); }
.q-pr-words { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem; direction: rtl; }
.q-pr-word { font-size: 1.8rem; padding: 0 .4rem; border-radius: 8px; }
.q-pr-word.good { background: color-mix(in srgb, var(--ok) 14%, transparent); }
.q-pr-word.bad { background: color-mix(in srgb, var(--danger) 16%, transparent); text-decoration: underline wavy var(--danger); }
.q-pr-feedback { text-align: right; margin: 0; padding-inline-start: 1.2rem; }
.q-consent { text-align: right; }
.q-consent-opt { display: grid; grid-template-columns: auto 1fr; gap: .6rem; align-items: start; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.q-consent-opt span { display: grid; gap: .1rem; }
.q-consent-opt input { margin-top: .5rem; width: 1.2rem; height: 1.2rem; accent-color: var(--brand); }
.q-consent-opt.confirm { background: var(--gold-soft); }

.q-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; }
.q-stat { display: grid; justify-items: center; padding: .7rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-align: center; }
.q-stat strong { font-size: 1.6rem; }
.q-chart { width: 100%; height: auto; }
.q-chart-line { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.q-chart-dot { fill: var(--brand); }
.q-chart-guide { stroke: var(--line); stroke-dasharray: 4 4; }
.q-practice-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.q-chip-item { display: inline-grid; justify-items: center; padding: .1rem .7rem .3rem; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink); font: inherit; }
.q-chip-item span { font-size: 1.8rem; line-height: 1.7; }
.q-chip-item.needs { border-color: var(--danger); }
.q-progress-table { width: 100%; border-collapse: collapse; }
.q-progress-table th, .q-progress-table td { padding: .3rem .5rem; border-bottom: 1px solid var(--line); text-align: center; }
.q-history { display: grid; gap: .4rem; }
.q-hist { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: .6rem; align-items: center; padding: .35rem .5rem; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.q-hist.needs { border-inline-end: 4px solid var(--danger); }
.q-hist-text { font-size: 1.7rem; line-height: 1.7; text-align: center; }
.q-hist-meta { display: grid; gap: .1rem; }
.q-studio { display: grid; gap: .4rem; }
.q-studio-row { display: grid; grid-template-columns: 5rem 1fr auto; gap: .6rem; align-items: center; padding: .3rem 0; border-bottom: 1px dashed var(--line); }
.q-studio-text { font-family: var(--quran-font); font-size: 2rem; line-height: 1.8; text-align: center; }
.q-studio-lessons { display: flex; flex-wrap: wrap; gap: .3rem; }
.q-review { display: grid; gap: .5rem; }

@media (max-width: 560px) {
  .q-pr-text { font-size: 3.4rem; }
  .q-hist, .q-studio-row { grid-template-columns: 4rem 1fr; }
  .q-hist > .row, .q-studio-row > .row { grid-column: 1 / -1; }
  .q-stats { grid-template-columns: repeat(2, 1fr); }
}
.q-pr .q-pr-text, .q-pr .q-pr-say, .q-pr > p { text-align: center; }

/* ---------------------------------------------------------------- phonology: articulation diagram */
.mouth { width: 100%; max-width: 300px; height: auto; display: block; }
.mouth.compact { max-width: 150px; }
.mouth .m-skin { fill: var(--gold-soft); stroke: var(--gold); stroke-width: 1.5; }
.mouth .m-air { fill: var(--surface); stroke: color-mix(in srgb, var(--gold) 50%, transparent); stroke-width: 1; }
.mouth .m-palate { fill: color-mix(in srgb, var(--gold) 45%, var(--surface)); }
.mouth .m-velum { fill: color-mix(in srgb, #d9708a 55%, var(--surface)); stroke: #b85570; stroke-width: 1; }
.mouth .m-wall { fill: none; stroke: var(--gold); stroke-width: 2; }
.mouth .m-larynx { fill: color-mix(in srgb, var(--gold) 30%, var(--surface)); }
.mouth .m-folds { stroke: var(--ink-soft); stroke-width: 2.5; stroke-linecap: round; }
.mouth .m-tooth { fill: #fff; stroke: #c9c3b4; stroke-width: 1; }
.mouth .m-tongue { fill: #e0727f; stroke: #b14c5a; stroke-width: 1.5; }
.mouth .m-lip { fill: #d9707a; stroke: #a8484f; stroke-width: 1.2; }
.mouth .m-label { font: 600 9px/1 var(--font-ur, system-ui); fill: var(--muted); }
.mouth .m-point { fill: none; stroke: var(--brand); stroke-width: 3; }
.mouth .m-dot { fill: var(--brand); }
.mouth .m-point.pulse { animation: m-pulse 1.4s ease-out 3; transform-box: fill-box; transform-origin: center; }
@keyframes m-pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(2.1); opacity: 0; } }
.mouth .m-flow { fill: none; stroke: #3d8fd1; stroke-width: 2; stroke-dasharray: 5 5; opacity: 0; }
.mouth .m-flow.run { animation: m-flow 1.6s linear 2; }
@keyframes m-flow { 0% { opacity: .9; stroke-dashoffset: 40; } 90% { opacity: .9; } 100% { opacity: 0; stroke-dashoffset: 0; } }
.mouth .m-arrowhead { fill: #3d8fd1; }
.mouth .m-lift { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.mouth .m-burst-line { stroke: #e08a1e; stroke-width: 3; stroke-linecap: round; }
.mouth .m-burst { opacity: 0; }
.mouth .m-burst.run { animation: m-burst .5s ease-out 3; }
@keyframes m-burst { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mouth .m-point.pulse, .mouth .m-flow.run, .mouth .m-burst.run { animation: none; opacity: 1; } }

.q-art { display: grid; grid-template-columns: minmax(140px, 210px) 1fr; gap: 1rem; align-items: start; padding: .8rem; border-radius: var(--radius-sm); background: var(--surface-2); margin: .6rem 0; }
.q-art-fig { background: var(--surface); border-radius: var(--radius-sm); padding: .3rem; }
.q-art-info { min-width: 0; }
.q-art-info p, .q-art-info ol, .q-art-info ul { margin: .3rem 0; }
.q-art-head { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.q-art-head > span:last-child { display: inline-flex; gap: .4rem; align-items: baseline; flex-wrap: wrap; }
.q-art-letter { font-size: 2.6rem; line-height: 1.3; color: var(--brand); }
.q-art-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.q-art-steps { padding-inline-start: 1.3rem; }
.q-art-steps li { margin: .2rem 0; }
.q-art-sign { border-top: 1px dashed var(--line); padding-top: .3rem; margin-top: .3rem; }
.q-art-sign ul { padding-inline-start: 1.2rem; }
@media (max-width: 560px) { .q-art { grid-template-columns: 1fr; } .q-art-fig { max-width: 260px; margin-inline: auto; } }

.q-seg-chips { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin: .4rem 0; }
.q-seg { font-size: 1.7rem; min-width: 3rem; padding: .1rem .6rem; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.q-seg.on { border-color: var(--brand); background: var(--brand-soft); }
.q-seg.silent { opacity: .55; }

.q-guide-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin: .4rem 0; }
.q-guide { display: flex; gap: .3rem; list-style: none; padding: 0; margin: 0; counter-reset: g; }
.q-guide li { counter-increment: g; padding: .2rem .7rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .9rem; }
.q-guide li + li::before { content: '← '; }
.q-guide li.on { background: var(--brand); color: var(--brand-ink, #fff); }
.q-guide li.done { color: var(--ok); }
.q-dots { display: flex; align-items: center; gap: .25rem; }
.q-dots i { width: .8rem; height: .8rem; border-radius: 50%; border: 2px solid var(--ok); }
.q-dots i.on { background: var(--ok); }

.q-compare { display: grid; gap: .4rem; margin: .6rem 0; }
.q-wave { display: grid; grid-template-columns: 5.5rem 1fr; align-items: center; gap: .5rem; }
.q-wave-bars { display: flex; align-items: center; gap: 1px; height: 36px; direction: ltr; }
.q-wave-bars i { flex: 1; min-width: 1px; border-radius: 1px; }
.q-wave.ref .q-wave-bars i { background: var(--brand); }
.q-wave.me .q-wave-bars i { background: var(--gold); }

.q-finds h3 { margin: .6rem 0 .3rem; font-size: 1.05rem; }
.q-finds ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.q-find { padding: .6rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--line); border-inline-start: 4px solid var(--gold); background: var(--surface); }
.q-find.verified { border-inline-start-color: var(--danger); }
.q-find p { margin: .25rem 0; }
.q-find-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.q-find-letter { font-size: 1.4rem; }
.q-badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; }
.q-badge.warn { background: var(--gold-soft); color: var(--gold); border: 1px dashed var(--gold); }
.q-badge.ok { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); border: 1px solid var(--danger); }
.q-checks ul { margin: .2rem 0; padding-inline-start: 1.2rem; }
.q-ok { color: var(--ok); font-weight: 600; }
.q-ok.big { font-size: 1.1rem; }
.tiny { font-size: .78rem; }

.q-sign-btn { cursor: pointer; font: inherit; color: inherit; border: 1px solid var(--line); background: var(--surface); }
.q-sign-btn:hover { border-color: var(--brand); }
.q-sign-ex { font-size: 1.8rem; color: var(--brand); }
.q-pair-letters { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
.q-pair-btn { font-size: 1.8rem; min-width: 2.8rem; padding: 0 .5rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.q-pair-btn:hover { border-color: var(--brand); }
.q-pair-btn.needs { border-color: var(--danger); }
.q-pair-btn.mastered { border-color: var(--ok); }
.q-letter-fig { width: 150px; }
.q-letter-panel:has(.q-letter-fig) { grid-template-columns: 150px 1fr; }
@media (max-width: 480px) { .q-letter-panel:has(.q-letter-fig) { grid-template-columns: 1fr; } .q-letter-fig { margin-inline: auto; } }

.q-sound-list { display: grid; gap: .5rem; }
.q-sound { display: grid; grid-template-columns: 3.5rem 1fr auto; gap: .6rem; align-items: center; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.q-sound .q-big { font-size: 2rem; text-align: center; }
.q-sound.verified { border-inline-start: 4px solid var(--danger); }
.q-add-error { margin: .5rem 0; }
.q-add-error .input { width: auto; }
.q-added { margin: .3rem 0; padding-inline-start: 1.2rem; }
button[aria-pressed="true"].btn { background: var(--brand-soft); border-color: var(--brand); }

.q-mk-list { display: grid; gap: .6rem; margin-top: 1rem; }
.q-mk { display: grid; grid-template-columns: 2.2rem 1fr; gap: .6rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.q-mk p { margin: .2rem 0 .4rem; }
.q-pair { grid-template-columns: minmax(7.5rem, auto) 1fr; }
.q-pair-letters { letter-spacing: 0; }

/* ---------------------------------------------------------------- learning card: one flow for every item */
.q-learn { display: grid; gap: .6rem; }
.q-path { display: flex; gap: .3rem; list-style: none; margin: 0; padding: .2rem 0 .4rem; overflow-x: auto; scrollbar-width: thin; }
.q-path li { flex: none; padding: .25rem .7rem; border-radius: 999px; font-size: .82rem; background: var(--surface-2); color: var(--muted); border: 1px solid transparent; white-space: nowrap; }
.q-path li + li::before { content: '←'; margin-inline-end: .35rem; opacity: .5; }
.q-path li.done { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.q-path li.done::after { content: ' ✓'; }
.q-path li.on { background: var(--brand); color: var(--brand-ink, #fff); border-color: var(--brand); animation: q-nudge 1.6s ease-in-out infinite; }
@keyframes q-nudge { 50% { transform: translateY(-2px); } }
.q-learn-top { text-align: center; display: grid; justify-items: center; gap: .3rem; }
.q-listen-row { justify-content: center; align-items: center; }
.q-listen { font-size: 1.15rem; padding: .7rem 1.6rem; border-radius: 999px; }
.q-plays { font-size: .8rem; color: var(--muted); }
.q-sum { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: .4rem; font-size: 1.6rem; direction: rtl; }
.q-sum .q-sum-op { font-size: 1.1rem; color: var(--muted); }
.q-sum strong { color: var(--brand); font-size: 2rem; }

/* Enlarged diagram: the picture fills the card width, then the explanation below */
.q-art.big { grid-template-columns: 1fr; justify-items: stretch; }
.q-art.big .q-art-fig { max-width: 520px; width: 100%; margin-inline: auto; position: relative; cursor: zoom-in; }
.q-art.big .mouth { max-width: none; }
.q-art.pop .q-art-fig { animation: q-pop .45s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes q-pop { from { transform: scale(.72); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.q-zoom-btn { position: absolute; inset-block-start: .4rem; inset-inline-start: .4rem; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1.2rem; cursor: pointer; box-shadow: var(--shadow); }
.q-art-fig:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.q-art-review { display: grid; gap: .3rem; margin-top: .4rem; }
.q-badge.rv-ok { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); border: 1px solid var(--ok); }
.q-teacher-check summary { cursor: pointer; font-size: .85rem; color: var(--brand); }
.q-go { justify-self: center; font-size: 1.1rem; padding: .7rem 1.6rem; border-radius: 999px; background: var(--danger); border-color: var(--danger); color: #fff; }
.q-practice { border: 2px dashed var(--line); border-radius: var(--radius); padding: .8rem; display: grid; gap: .4rem; }
.q-practice h3 { margin: 0; }
.q-progress-row { justify-content: space-between; align-items: center; }

/* Full-screen enlarged view */
.q-zoom { position: fixed; inset: 0; z-index: 200; background: rgba(10, 20, 16, .72); display: grid; place-items: center; padding: max(8px, env(safe-area-inset-top)) 8px; animation: q-fade .2s ease-out; }
@keyframes q-fade { from { opacity: 0; } }
.q-zoom-panel { background: var(--surface); border-radius: var(--radius); width: min(980px, 100%); max-height: 100%; overflow: auto; padding: .8rem; display: grid; gap: .5rem; animation: q-pop .35s cubic-bezier(.2, .9, .3, 1.2); }
.q-zoom-head { display: flex; align-items: center; gap: .8rem; direction: rtl; }
.q-zoom-letter { font-size: 3rem; line-height: 1.2; color: var(--brand); }
.q-zoom-where { flex: 1; font-weight: 600; }
.q-zoom-fig { display: grid; place-items: center; }
.q-zoom-fig .mouth { max-width: none; width: 100%; max-height: 70vh; }
.q-zoom-fig .mouth .m-label { font-size: 7px; }
.q-zoom-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; direction: rtl; }
.q-zoom-nav { text-align: center; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .q-art.pop .q-art-fig, .q-zoom, .q-zoom-panel, .q-path li.on { animation: none; } }

/* Learning state on lesson tiles: seen (opened) and learned (3 good readings in a row) */
.q-syl, .q-letter-btn, .q-word, .q-sign-btn, .q-pair-btn, .q-forms td { position: relative; }
:is(.q-syl, .q-letter-btn, .q-word, .q-sign-btn, .q-pair-btn, .q-forms td).seen::before { content: ""; position: absolute; top: 5px; inset-inline-end: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
:is(.q-syl, .q-letter-btn, .q-word, .q-sign-btn, .q-pair-btn, .q-forms td).learned::before { content: "★"; position: absolute; top: 1px; inset-inline-end: 4px; font-size: .75rem; color: var(--ok); }
.q-sign-btn.has-ref::after, .q-pair-btn.has-ref::after { content: "🔊"; position: absolute; top: 2px; inset-inline-start: 4px; font-size: .62rem; }
.q-tile-legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .8rem; color: var(--muted); }
.q-tile-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-inline-end: .3rem; }
.q-tile-legend b { color: var(--ok); margin-inline-end: .3rem; }
/* Bigger touch targets in the learning card on phones */
@media (max-width: 520px) {
  .q-learn .q-listen-row .btn, .q-learn .q-pr-actions .btn { flex: 1 1 auto; justify-content: center; }
  .q-learn .q-pr-text { font-size: 3.6rem; }
}
.q-rv-tick { font-size: .7rem; color: var(--ok); vertical-align: super; margin-inline-start: 2px; }

/* ---------------------------------------------------------------- learning panel: everything in one box
   About 10 × 8 inches on a desktop; shrinks to the window. Columns (RTL, right to left):
   [word + audio + practice]  [illustration + Tajweed rules beneath it]  [how to pronounce]
   Only long text inside a box scrolls, never the panel. On phones the lower part becomes tabs. */
.sheet.q-panel-sheet {
  width: min(10in, calc(100vw - 24px)); max-width: none; height: min(8in, calc(100dvh - 24px)); max-height: none;
  overflow: hidden; display: flex; flex-direction: column; padding: .55rem .9rem .7rem; border-radius: 20px;
}
.sheet.q-panel-sheet .sheet-grip { display: none; }
.sheet.q-panel-sheet .sheet-head { margin-bottom: .2rem; align-items: center; }
.sheet.q-panel-sheet .sheet-head h2 { font-size: 1.05rem; font-family: var(--q-font, var(--ur-font)); }
body:is(.qlang-ur, .qlang-ar) .sheet.q-panel-sheet .sheet-head { direction: rtl; }
.q-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .45rem; text-align: start; }
.q-panel .q-path { flex: none; padding: 0 0 .1rem; scrollbar-width: none; }
.q-panel .q-path li { font-size: .74rem; padding: .15rem .55rem; }
.q-pn-grid {
  flex: 1; min-height: 0; display: grid; gap: .6rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr) minmax(0, .95fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "word fig explain" "practice rules explain";
}
.q-pn-box { min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: .35rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .55rem .65rem; }
.q-pn-word { grid-area: word; align-items: center; justify-content: center; text-align: center; background: var(--surface); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.q-pn-fig { grid-area: fig; align-items: center; }
.q-pn-rules { grid-area: rules; }
.q-pn-explain { grid-area: explain; }
.q-pn-practice { grid-area: practice; }
.q-pn-tabs { display: none; }
.q-pn-h { margin: 0; font-size: .98rem; font-family: var(--q-font, var(--ur-font)); color: var(--brand); }
.q-pn-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.q-panel .q-pr-text { font-size: clamp(2.4rem, 7vh, 3.8rem); line-height: 1.55; padding: 0 .8rem; }
.q-pn-word { overflow: hidden; }
.q-panel .q-pr-say { font-size: .95rem; }
.q-panel .q-sum { font-size: 1.3rem; gap: .3rem; }
.q-panel .q-sum strong { font-size: 1.55rem; }
.q-pn-source { margin: 0; }
.q-panel .q-listen-row { gap: .4rem; }
.q-panel .q-listen-row .btn { font-family: var(--q-font, var(--ur-font)); }
.btn.q-play-btn { font-size: 1.08rem; padding: .5rem .95rem; border-radius: 999px; min-width: 5.5rem; justify-content: center; }
.q-pn-word .q-listen-row { flex-wrap: nowrap; justify-content: center; max-width: 100%; min-width: 0; }
.q-pn-word .q-listen-row .btn { flex: 0 1 auto; min-width: 0; }
.q-pn-word .q-listen-row .btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body:not(.qlang-ur) .q-pn-word .btn.q-play-btn { font-size: 1rem; padding: .5rem .8rem; min-width: 0; }
body:not(.qlang-ur) .q-pn-word .q-listen-row .btn.subtle { font-size: .82rem; padding: .45rem .5rem; }
.q-pn-word .q-listen-row .btn.subtle { padding: .45rem .6rem; font-size: .88rem; white-space: nowrap; }
.btn.q-play-btn svg { width: 1.3rem; height: 1.3rem; }
.btn.q-play-btn.attention { animation: q-pulse 1s infinite; }
.q-pn-audio-foot { display: flex; gap: .5rem; align-items: baseline; justify-content: center; flex-wrap: wrap; min-height: 1.3em; }
.q-audio-msg { margin: 0; font-size: .8rem; color: var(--muted); }
.q-audio-msg.bad { color: var(--danger); font-weight: 600; background: color-mix(in srgb, var(--danger) 8%, transparent); padding: .2rem .5rem; border-radius: 8px; }
.q-audio-msg.warn { color: var(--gold); }
/* the illustration fills its box; its height follows the window */
.q-pn-fig .q-art-fig { position: relative; width: 100%; flex: 1; min-height: 0; display: grid; place-items: center; cursor: zoom-in; background: var(--surface); }
.q-pn-fig .q-art-fig.pop { animation: q-pop .45s cubic-bezier(.2, .9, .3, 1.2); }
.q-pn-fig .mouth { max-width: none; width: auto; height: 100%; max-height: min(34vh, 290px); }
.q-pn-fig .q-seg-chips { display: flex; flex-wrap: wrap; gap: .25rem; justify-content: center; }
.q-pn-fig .q-seg { font-size: 1.4rem; padding: 0 .55rem; min-width: 2.4rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; line-height: 1.6; }
.q-pn-fig .q-seg.on { border-color: var(--brand); background: var(--brand-soft); }
.q-pn-fig .q-seg.silent { opacity: .55; }
.q-pn-explain .q-art-info { display: grid; gap: .3rem; }
.q-pn-explain .q-art-letter { font-size: 2.1rem; }
.q-pn-explain .q-art-info p, .q-pn-explain .q-art-info li { font-size: .88rem; }
.q-pn-rule { border-inline-start: 4px solid var(--rule-color, var(--brand)); background: var(--surface); border-radius: 8px; padding: .3rem .5rem; margin-bottom: .35rem; }
.q-pn-rule.sign { border-inline-start-color: var(--gold); }
.q-pn-rule p { margin: .15rem 0; }
.q-pn-rule-head { display: flex; gap: .4rem; align-items: baseline; flex-wrap: wrap; }
.q-pn-swatch { width: .8rem; height: .8rem; border-radius: 3px; background: var(--rule-color, var(--brand)); display: inline-block; }
.q-pn-signs { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: .2rem 0; }
.q-pn-q { margin: .2rem 0; padding-inline-start: 1.1rem; }
.q-pn-practice .q-pr-actions { justify-content: flex-start; gap: .4rem; }
.q-pn-practice .q-pr-actions .btn { min-width: 0; }
.q-pn-practice .q-progress-row { gap: .4rem; flex-wrap: wrap; }
.q-pn-practice .q-pr-status { min-height: 1.2em; font-size: .85rem; }
.q-pr-scoreline { display: grid; grid-template-columns: auto 1fr; gap: .5rem; align-items: center; }
.q-pr-scoreline .q-pr-score { padding: 0 .3rem; }
.q-pr-scoreline .q-pr-score strong { font-size: 1.9rem; }
.q-pn-practice .q-compare { display: grid; gap: .2rem; }
.q-pn-practice .q-pr-result { gap: .35rem; text-align: start; }
.q-dots { display: inline-flex; gap: .25rem; align-items: center; }
.q-dots i { width: .7rem; height: .7rem; border-radius: 50%; border: 2px solid var(--ok); }
.q-dots i.on { background: var(--ok); }

/* Medium windows (tablets): two columns; "how to pronounce" and "Tajweed rules" share a tabbed box */
@media (min-width: 701px) and (max-width: 980px) and (min-height: 561px) {
  .q-pn-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "word fig" "practice tabs" "practice explain";
  }
  .q-pn-fig .mouth { max-height: 21vh; }
  .q-pn-rules { display: none; grid-area: explain; }
  .q-panel[data-tab="rules"] .q-pn-rules { display: flex; }
  .q-panel[data-tab="rules"] .q-pn-explain { display: none; }
  .q-pn-tabs { display: flex; grid-area: tabs; gap: .3rem; }
  .q-pn-tab { flex: 1; font: inherit; font-family: var(--q-font, var(--ur-font)); font-size: .9rem; padding: .25rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; }
  .q-pn-tab[data-tab="fig"], .q-pn-tab[data-tab="practice"] { display: none; }
  .q-panel:not([data-tab="rules"]) .q-pn-tab[data-tab="explain"], .q-panel[data-tab="rules"] .q-pn-tab[data-tab="rules"] { background: var(--brand); color: var(--brand-ink, #fff); border-color: var(--brand); }
}
/* Phones and small windows: full screen; word + audio stay on top, the rest are tabs (no long page) */
@media (max-width: 700px), (max-height: 560px) {
  .sheet.q-panel-sheet { width: 100vw; height: 100dvh; border-radius: 0; padding: .4rem .6rem calc(.5rem + env(safe-area-inset-bottom)); }
  .q-pn-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "word" "tabs" "pane"; gap: .4rem; }
  .q-pn-tabs { display: flex; grid-area: tabs; gap: .3rem; }
  .q-pn-tab { flex: 1; font: inherit; font-family: var(--q-font, var(--ur-font)); font-size: .95rem; padding: .35rem .2rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; }
  .q-pn-tab.on { background: var(--brand); color: var(--brand-ink, #fff); border-color: var(--brand); }
  .q-pn-box[data-pane] { display: none; grid-area: pane; }
  .q-panel[data-tab="fig"] .q-pn-fig, .q-panel[data-tab="explain"] .q-pn-explain,
  .q-panel[data-tab="rules"] .q-pn-rules, .q-panel[data-tab="practice"] .q-pn-practice { display: flex; }
  .q-panel[data-tab="rules"] .q-pn-explain { display: none; }
  .q-panel[data-tab] .q-pn-box[data-pane] { grid-area: pane; }
  .q-pn-fig .mouth { max-height: 100%; }
  .q-panel .q-pr-text { font-size: clamp(2.4rem, 11vw, 3.4rem); line-height: 1.5; }
  .q-pn-word { gap: .2rem; padding: .4rem; }
  .q-pn-word .q-listen-row .btn { flex: 1 1 auto; justify-content: center; padding-inline: .6rem; }
  .btn.q-play-btn { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { .q-pn-fig .q-art-fig.pop, .btn.q-play-btn.attention { animation: none; } }
.q-pn-practice .q-pr-result .row { flex-wrap: wrap; gap: .3rem; }
.q-pn-practice .q-pr-result .row .btn { font-size: .8rem; padding: .3rem .6rem; }
.q-pn-practice .q-pr-result .q-pr-feedback { padding-inline-start: 1rem; }
.q-pn-scroll > *, .q-pr-result > * { min-width: 0; }
.q-pr-scoreline { grid-template-columns: auto minmax(0, 1fr); }
.q-pn-practice .q-wave-bars { overflow: hidden; }
.q-pn-tab { min-width: 0; }
.q-pn-tab { text-align: center; padding-inline: .2rem; }


/* ---------------------------------------------------------------- Noorani Qaida in several languages
   Interface text uses the learner's language font; Arabic (letters, Quranic words) keeps its own. */
:root { --bn-font: "Noto Sans Bengali", "Nirmala UI", "Vrinda", var(--ui-font); --q-font: var(--ur-font); }
body.qlang-ur { --q-font: var(--ur-font); }
body.qlang-ar { --q-font: var(--ar-ui-font); }
body.qlang-hi { --q-font: var(--hi-font); }
body.qlang-bn { --q-font: var(--bn-font); }
body:is(.qlang-en, .qlang-fr, .qlang-id) { --q-font: var(--ui-font); }
.t-bn { font-family: var(--bn-font); line-height: 1.75; }
.t-q { font-family: var(--q-font); }
.t-q.t-ur { line-height: 2.25; }
.t-q:is(.t-en, .t-fr, .t-id) { line-height: 1.55; }
.t-q.t-hi, .t-q.t-bn { line-height: 1.75; }
.t-q.t-ar { line-height: 1.9; }
body:not(.qlang-ur) :is(.q-name, .q-hijje, .q-unit small, .q-say, .q-opt, .q-heavy, .q-num) { line-height: 1.5; }
body:not(.qlang-ur) .q-hijje { font-size: .72rem; }
[dir="ltr"] .q-path li + li::before { content: '→'; }
.q-lang { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-inline-start: auto; }
.q-lang-label { display: inline-flex; align-items: center; gap: .3rem; font-size: .9rem; }
.q-lang-select { width: auto; min-width: 9rem; padding: .3rem .5rem; font-size: .95rem; }
.q-lang-select option[lang="ur"] { font-family: var(--ur-font); }
.q-lang-note { color: var(--gold); max-width: 28rem; }
.q-bulk-list { display: grid; gap: .2rem; max-height: 16rem; overflow: auto; margin: .4rem 0; }
.q-bulk-row { display: flex; gap: .6rem; align-items: baseline; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: .1rem 0; }
.q-bulk-row.miss { opacity: .6; }
.q-bulk-ar { font-family: var(--quran-font); font-size: 1.4rem; line-height: 1.6; }
.q-pn-tab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body:not(.qlang-ur):not(.qlang-ar) .q-pn-tab { font-size: .82rem; }
.q-pn-fig .q-art-fig > svg { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.q-pn-word .q-listen-row .btn.q-play-btn { flex-shrink: 0; }
body.qlang-ar .q-pn-word .q-listen-row .btn.subtle { font-size: .78rem; padding-inline: .45rem; }
body.qlang-ar .q-pn-word .btn.q-play-btn { padding-inline: .7rem; }
.q-pn-word .q-listen-row .btn svg { flex-shrink: 0; }

/* ---- Qari audio manager (teachers/admins) */
.chip.red { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); border-color: transparent; }
.q-aud-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; margin: .6rem 0; }
.q-aud-tile { display: grid; gap: .1rem; text-align: center; padding: .55rem .4rem; border-radius: var(--radius-sm, 10px); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; font-family: var(--q-font, var(--ur-font)); }
.q-aud-tile strong { font-family: system-ui, sans-serif; font-size: 1.5rem; line-height: 1.2; }
.q-aud-tile span { font-size: .85rem; }
.q-aud-tile.on { outline: 3px solid var(--brand); }
.q-aud-tile.st-missing strong { color: var(--danger); }
.q-aud-tile.st-computer strong { color: var(--gold); }
.q-aud-tile.st-qari strong, .q-aud-tile.st-reciter strong { color: var(--brand); }
.q-aud-filters { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .5rem 0; }
.q-aud-filters select, .q-aud-filters input[type="search"] { flex: 1 1 170px; min-width: 0; width: auto; }
.q-aud-who { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .5rem; }
.q-studio-row { grid-template-columns: 5rem 1fr auto; }
.q-studio-row > .q-ref-history { grid-column: 1 / -1; }
.q-studio-row.st-missing { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.q-studio-text.word { font-size: 1.5rem; }
.q-ref-history { display: grid; gap: .3rem; padding: .4rem .6rem; border-radius: 10px; background: var(--surface-2); }
.q-ref-version { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .2rem 0; border-bottom: 1px dashed var(--line); }
.q-ref-version:last-child { border-bottom: 0; }
.q-pager { justify-content: center; align-items: center; margin: .4rem 0; }
.q-pn-source .q-ref-kind { font-weight: 650; }
.q-pn-word .q-audio-msg.bad { font-size: .74rem; line-height: 1.4; }
body.qlang-ur .q-pn-word .q-audio-msg.bad { line-height: 1.9; }
.q-pn-audio-foot:has(.q-audio-msg.bad) .q-plays { display: none; }

/* ---------------------------------------------------------------- accounts, My learning, admin panel */
.banner-info { background: var(--brand-soft); color: var(--brand); }
.admin-note { border-radius: var(--radius-sm); text-align: start; margin: 0 0 1rem; }
.admin-tabs a { padding: .7rem 1rem; font-weight: 650; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.admin-tabs a:hover { text-decoration: none; color: var(--ink); }
.admin-tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.admin-body { min-height: 40vh; }
.admin-filters { margin-bottom: .8rem; }
.admin-filters .input { width: auto; min-width: 10rem; flex: 0 1 auto; }
.admin-filters input[type=search] { flex: 1 1 14rem; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th, .admin-table td { padding: .5rem .65rem; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.admin-table thead th { background: var(--surface-2); font-size: .8rem; font-weight: 700; color: var(--ink-soft); white-space: nowrap; position: sticky; top: 0; }
.admin-table tbody tr:last-child > * { border-bottom: 0; }
.admin-table tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.admin-center { text-align: center !important; }
.admin-perm { font-weight: 500; min-width: 16rem; }
.admin-sort { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; padding: 0; }
.admin-pager { justify-content: center; margin-top: .7rem; }
.admin-switches { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .7rem; }
.admin-switches p { margin: .15rem 0 0 3rem; }
.admin-fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .8rem 1rem; margin: 0; }
.admin-fieldset legend { font-weight: 700; font-size: .85rem; color: var(--muted); padding: 0 .3rem; }
.admin-options .input { flex: 1; }
.admin-rule-picks { display: flex; flex-wrap: wrap; gap: .4rem; }
.admin-rule-picks .chip { cursor: pointer; }
.admin-savebar { position: sticky; bottom: 0; background: var(--bg); padding: .7rem 0; border-top: 1px solid var(--line); z-index: 2; }
.admin-sheet { padding: 0 1.2rem 1.2rem; max-width: 560px; }
.admin-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.admin-swatch { display: inline-block; width: 1.4rem; height: 1.4rem; border-radius: 6px; border: 1px solid var(--line); vertical-align: middle; }
.admin-pre { white-space: pre-wrap; word-break: break-word; font-size: .82rem; padding: 0 1.2rem 1.2rem; margin: 0; }
.admin-mini { display: grid; gap: .2rem; min-width: 7rem; font-size: .8rem; }
.admin-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.admin-chips .ar { font-size: 1.3rem; }
.linklike { border: 0; background: none; padding: 0; font: inherit; color: var(--brand); cursor: pointer; text-align: start; }
.linklike:hover { text-decoration: underline; }
select.input.sm { min-height: 32px; padding: .2rem .5rem; width: auto; font-size: .85rem; }
.ml-course.done { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.ml-course h3 .ar { font-size: 1.1rem; }
.ml-list { list-style: none; padding: 0; margin: 0; }
.ml-list li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.ml-list li:last-child { border-bottom: 0; }
.ml-stats .stat .v { font-size: 1.4rem; }
@media (max-width: 640px) {
  .admin-filters .input { flex: 1 1 100%; }
  .admin-table { font-size: .82rem; }
}
@media (min-width: 641px) { .admin-tabs { flex-wrap: wrap; overflow: visible; } }
.admin-tabs a { padding: .6rem .8rem; }
.ml-course h3 .ar, .admin-table .ar { margin-inline-start: .4rem; }
.setup-callout { border-color: var(--brand); background: var(--brand-soft); }

/* ---------------------------------------------------------------- Masnoon duas */
.dua-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.dua-chips .chip { text-decoration: none; }
.dua-search { max-width: 420px; margin-bottom: 1.2rem; }
.dua-cat { margin-bottom: 1.6rem; }
.dua-cat-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.dua-cat-head .t-ur { font-size: 1.05rem; font-weight: 400; }
.dua-cat-icon { font-size: 1.6rem; }
.dua-card { display: grid; gap: .35rem; }
.dua-card.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.dua-card-ur { font-size: 1.05rem; color: var(--ink-soft); line-height: 2; }
.dua-crumbs { margin: 0 0 .5rem; font-size: .9rem; }
.dua-head h1 { margin-bottom: 0; }
.dua-title-ur { font-size: 1.35rem; margin: .1rem 0 .6rem; color: var(--ink-soft); }
.dua-when { background: var(--gold-soft); border-radius: var(--radius-sm); padding: .7rem 1rem; margin-bottom: 1rem; }
.dua-when .t-ur { margin: .3rem 0 0; }
.dua-main { margin-bottom: 1rem; }
.dua-arabic { font-family: var(--quran-font); font-size: calc(var(--quran-size) * 1.15); line-height: 2.3; text-align: center; color: var(--ink); padding: .4rem 0 .8rem; word-spacing: .1em; }
.dua-word { border-radius: 8px; padding: 0 .08em; transition: background .15s; }
.dua-word.playable { cursor: pointer; }
.dua-word.playable:hover, .dua-word.playable:focus-visible { background: var(--surface-2); outline: none; }
.dua-word.on, .dua-arabic.playing .dua-word { background: color-mix(in srgb, var(--gold-soft) 85%, transparent); }
.dua-translit { text-align: center; font-style: italic; color: var(--ink-soft); margin: 0 0 1rem; }
.dua-tr { border-top: 1px solid var(--line); padding-top: .8rem; }
.dua-tr .t-ur { font-size: 1.12rem; margin: 0; }
.dua-tr p { margin: 0; }
.dua-listen { margin-bottom: 1rem; }
.dua-listen .row { gap: .6rem; align-items: end; }
.dua-play { min-width: 8rem; justify-content: center; }
.dua-opt { display: grid; gap: .15rem; }
.dua-noaudio { background: var(--gold-soft); color: var(--ink); border-radius: var(--radius-sm); padding: .6rem .8rem; margin: .6rem 0 0; font-size: .92rem; }
.dua-kids { margin-bottom: 1rem; background: color-mix(in srgb, var(--brand-soft) 55%, var(--surface)); }
.dua-kids .t-ur { font-size: 1.12rem; }
.dua-rules { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.dua-rules li { display: flex; gap: .6rem; align-items: flex-start; }
.dua-rules p { margin: .15rem 0; }
.dua-dot { font-size: 1.2rem; line-height: 1.3; }
.dua-refs { list-style: none; padding: 0; margin: 0 0 .6rem; display: grid; gap: .45rem; }
.dua-refs li { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.dua-nav { margin: 1rem 0 2rem; }
.dua-mem { min-height: 4rem; }
.dua-hidden { font-family: var(--quran-font); font-size: .8em; min-width: 2.4em; border: 1px dashed var(--line); background: var(--surface-2); border-radius: 10px; padding: 0 .4em; cursor: pointer; color: var(--muted); }
.dua-word.peeked { background: var(--gold-soft); }
.dua-built { min-height: 3.6rem; border: 1px dashed var(--line); border-radius: var(--radius-sm); margin: .6rem 0; }
.dua-pool { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: .6rem 0; }
.dua-chip { font-family: var(--quran-font); font-size: 1.5rem; line-height: 1.9; padding: .1rem .8rem; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink); }
.dua-chip:hover { border-color: var(--brand); }
.dua-chip.shake { animation: dua-shake .35s; border-color: var(--danger); }
@keyframes dua-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.dua-result { font-weight: 700; font-size: 1.1rem; color: var(--ok); }
.dua-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; margin-top: .8rem; }
.dua-compare audio { width: 100%; }
button.done { border-color: var(--ok); color: var(--ok); }
@media (max-width: 640px) { .dua-arabic { font-size: calc(var(--quran-size) * .95); } }
.admin-ref-row { grid-template-columns: 1.4fr .7fr 1fr 1.6fr auto; gap: .5rem; align-items: end; }
@media (max-width: 760px) { .admin-ref-row { grid-template-columns: 1fr 1fr; } }
.dua-arabic-input { font-family: var(--quran-font); font-size: 1.6rem; line-height: 2; }
.sheet.wide { max-width: 860px; }
.dua-pron { margin-bottom: 1rem; } .dua-pron .t-ur { font-size: 1.08rem; }

/* ---------------------------------------------------------------- Salah illustrations */
:root { --fig: #2f6b57; --fig-cloth: #4c9a7f; --fig-mat: #e9d8b0; }
[data-theme="dark"] { --fig: #9fd8c2; --fig-cloth: #5fb595; --fig-mat: #4a4130; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] { --fig: #9fd8c2; --fig-cloth: #5fb595; --fig-mat: #4a4130; } }
.sf { width: 100%; height: auto; display: block; }
.sf .f-fig { fill: var(--fig); } .sf .s-fig { stroke: var(--fig); }
.sf .s-cloth { stroke: var(--fig-cloth); } .sf .f-cloth { fill: var(--fig-cloth); }
.sf .f-water { fill: #2b8fd6; } .sf .s-water { stroke: #2b8fd6; }
.sf .f-mat { fill: var(--fig-mat); } .sf .s-muted { stroke: var(--muted); } .sf .f-muted { fill: var(--muted); }

/* ---------------------------------------------------------------- Salah */
.salah-prefs { gap: 1rem; margin-bottom: 1rem; padding: .6rem .8rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.salah-prefs .t-ur, .salah-prefs select { line-height: 1.6; }
.salah-sec { margin: 1.6rem 0; }
.salah-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: .7rem; }
.salah-step-card { position: relative; display: grid; gap: .25rem; justify-items: center; text-align: center; padding: .6rem .5rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; color: var(--ink); font: inherit; transition: border-color .15s, transform .15s; }
.salah-step-card:hover, .salah-step-card:focus-visible { border-color: var(--brand); transform: translateY(-2px); outline: none; }
.salah-step-card .sf, .salah-step-card img { width: 100%; max-width: 120px; aspect-ratio: 210 / 185; object-fit: contain; }
.salah-step-card.done { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.salah-step-n { position: absolute; top: .4rem; inset-inline-start: .5rem; font-size: .75rem; font-weight: 700; color: var(--muted); }
.salah-step-card.done .salah-step-n { color: var(--ok); }
.salah-step-t { font-weight: 650; font-size: .88rem; line-height: 1.3; }
.salah-prayer-card { display: grid; gap: .5rem; }
.salah-prayer-card.done { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.salah-units { display: flex; flex-wrap: wrap; gap: .3rem; }
.salah-unit { display: inline-flex; align-items: baseline; gap: .15rem; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; border: 1px solid var(--line); background: var(--surface-2); }
.salah-unit.k-fard { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.salah-unit.k-fard .muted { color: inherit; opacity: .85; }
.salah-unit.k-wajib { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.salah-unit.k-sunnah { background: var(--brand-soft); }
.salah-unit-box { margin-bottom: 1rem; }
.salah-rakahs { display: grid; gap: .8rem; margin-top: .7rem; }
.salah-rakah-h { font-weight: 700; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
.salah-seq { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; }
.salah-seq-step { flex: 0 0 92px; display: grid; justify-items: center; gap: .15rem; padding: .3rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font: inherit; font-size: .72rem; line-height: 1.25; color: var(--ink); text-align: center; }
.salah-seq-step:hover, .salah-seq-step:focus-visible { border-color: var(--brand); outline: none; }
.salah-seq-step .sf, .salah-seq-step img { width: 80px; height: 70px; object-fit: contain; }
.salah-notes { list-style: none; padding: 0; margin: .4rem 0; display: grid; gap: .55rem; }
.salah-notes li { display: grid; gap: .2rem; padding: .5rem .7rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.salah-notes li.other { opacity: .72; }
.salah-tags { display: flex; flex-wrap: wrap; gap: .25rem; }
.admin-table tr.on th, .admin-table tr.on td { background: color-mix(in srgb, var(--brand-soft) 70%, transparent); }
.salah-video { padding: .6rem; }
.salah-video h3 { font-size: 1rem; margin: .5rem 0 .2rem; }
.salah-video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.salah-video-frame iframe, .salah-video-frame video { width: 100%; height: 100%; border: 0; display: block; }
.salah-video-thumb { all: unset; position: absolute; inset: 0; cursor: pointer; display: grid; place-items: center; }
.salah-video-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.salah-video-ph { font-size: 2.5rem; }
.salah-video-play { position: relative; width: 58px; height: 58px; border-radius: 50%; background: rgba(0,0,0,.6); display: grid; place-items: center; }
.salah-video-play svg { width: 30px; height: 30px; fill: #fff; }
.salah-video-thumb:focus-visible .salah-video-play { outline: 3px solid var(--focus); }

/* The learning panel: about 10 × 8 inches on a desktop, full screen on a phone. */
body.sp-open { overflow: hidden; }
.sp-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(9, 15, 12, .55); display: grid; place-items: center; padding: 12px; }
.sp-panel { width: min(10in, 100%); height: min(8in, calc(100vh - 24px)); background: var(--surface); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.35); display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.sp-head { display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.sp-titles { flex: 1; min-width: 0; }
.sp-titles h2 { margin: 0; font-size: 1.2rem; line-height: 1.5; }
.sp-titles h2 .t-ur { font-size: 1rem; color: var(--ink-soft); margin-inline-start: .4rem; }
.sp-nav { flex-wrap: nowrap; }
.sp-body { display: grid; grid-template-columns: minmax(220px, 36%) 1fr; min-height: 0; }
.sp-left { padding: 1rem; border-inline-end: 1px solid var(--line); display: grid; align-content: start; gap: .6rem; overflow: auto; background: var(--surface-2); }
.sp-fig { background: var(--surface); border-radius: var(--radius); padding: .4rem; }
.sp-fig img { width: 100%; height: auto; display: block; border-radius: 10px; }
.sp-posture { margin: 0; text-align: center; }
.sp-ruling { background: var(--surface); border-radius: var(--radius-sm); padding: .5rem .7rem; font-size: .9rem; }
.sp-ruling .t-ur { display: block; margin-top: .2rem; }
.sp-right { display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.sp-tabs { margin: 0; padding: 0 1rem; }
.sp-tabbody { overflow: auto; padding: .8rem 1.1rem 1rem; }
.sp-arabic { font-size: calc(var(--quran-size) * .95); line-height: 2.1; padding: .2rem 0 .4rem; }
.sp-controls { gap: .45rem; margin: .2rem 0 .4rem; }
.sp-when { background: var(--gold-soft); border-radius: var(--radius-sm); padding: .4rem .7rem; display: grid; gap: .2rem; }
.sp-tr { display: grid; gap: .3rem; border-top: 1px solid var(--line); padding-top: .5rem; }
.sp-tr p { margin: 0; }
.sp-tr .t-ur { font-size: 1.05rem; }
.sp-pron { margin-top: .6rem; background: var(--surface-2); border-radius: var(--radius-sm); padding: .45rem .7rem; }
.sp-pron summary { cursor: pointer; font-weight: 650; }
.sp-recchoice { margin-bottom: .4rem; }
.sp-recchoice .chip { cursor: pointer; font: inherit; font-size: .8rem; }
.sp-videos { display: grid; gap: .8rem; }
.sp-done, .sp-quizbody { padding: 1.5rem; overflow: auto; }
.sp-done { text-align: center; display: grid; align-content: center; gap: .6rem; }
.sp-quiz { height: auto; max-height: calc(100vh - 24px); }
.salah-quiz-built { min-height: 2rem; padding-inline-start: 1.4rem; }
.salah-quiz-built li { padding: .15rem 0; font-weight: 600; }
.salah-quiz-pool { display: flex; flex-wrap: wrap; gap: .5rem; }
.salah-quiz-chip { display: grid; justify-items: center; gap: .1rem; width: 96px; padding: .3rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font: inherit; font-size: .72rem; color: var(--ink); }
.salah-quiz-chip .sf, .salah-quiz-chip img { width: 70px; height: 60px; object-fit: contain; }
.salah-quiz-chip.shake { animation: dua-shake .35s; border-color: var(--danger); }
@media (max-width: 760px) {
  .sp-backdrop { padding: 0; }
  .sp-panel { width: 100%; height: 100%; border-radius: 0; }
  .sp-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow: auto; }
  .sp-left { border-inline-end: 0; border-bottom: 1px solid var(--line); grid-template-columns: 120px 1fr; align-items: center; padding: .6rem; overflow: visible; }
  .sp-left .sp-fig { grid-row: span 3; }
  .sp-right { min-height: 60vh; }
}
.admin-thumb .sf { width: 56px; height: 48px; }
.admin-figbox { max-width: 240px; background: var(--surface-2); border-radius: var(--radius-sm); padding: .4rem; margin-bottom: .6rem; }
.admin-figbox img { width: 100%; display: block; border-radius: 8px; }
.admin-step-grid { display: grid; grid-template-columns: 250px 1fr; gap: 1.2rem; }
@media (max-width: 760px) { .admin-step-grid { grid-template-columns: 1fr; } }
.admin-ruling-row { grid-template-columns: 7rem 1fr 1fr; gap: .5rem; align-items: end; }
.admin-unit-row { grid-template-columns: 1.4fr .6fr 1fr auto 1.2fr 1.2fr auto; gap: .5rem; align-items: end; padding: .4rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
@media (max-width: 900px) { .admin-unit-row, .admin-ruling-row { grid-template-columns: 1fr 1fr; } }
.admin-recs { padding-inline-start: 1.4rem; display: grid; gap: .3rem; }
.admin-recs li span { font-weight: 600; }
.admin-vthumb { width: 120px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; }
.admin-suggest { background: var(--surface-2); }
.salah-unit-box, .salah-rakahs, .salah-rakah { min-width: 0; }
.salah-unit-box > summary { cursor: pointer; list-style: none; }
.salah-unit-box > summary::-webkit-details-marker { display: none; }
.salah-unit-box > summary::before { content: "▸"; color: var(--muted); }
.salah-unit-box[open] > summary::before { content: "▾"; }
main { min-width: 0; }

/* ---------------------------------------------------------------- dua audio management */
.dua-quickplay { min-height: 28px; padding: .1rem .6rem; font-size: .78rem; }
.dua-quickplay svg { width: 14px; height: 14px; }
.dua-audio-tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1rem; }
.dua-audio-tiles .card.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.dua-audio-tiles .card { text-align: start; }
tr.dua-row-missing td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.dua-row-actions { white-space: nowrap; }
.dua-row-actions .btn { margin-inline-end: .25rem; }
.dua-audio-tabs { margin-bottom: .6rem; }
.dua-audio-tabs .badge { margin-inline-start: .2rem; }
.dua-current { margin-bottom: .6rem; }
.dua-rec-line { display: grid; gap: .3rem; }
.dua-rec-line audio { width: 100%; max-width: 420px; height: 36px; }
.dua-newrec { border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .4rem; }
.dua-take-box { display: grid; gap: .4rem; margin-top: .6rem; padding: .6rem .8rem; border: 1px dashed var(--brand); border-radius: var(--radius-sm); background: var(--brand-soft); }
.dua-take-box audio { width: 100%; }
.dua-rec-sheet { max-width: 760px; }
.dua-rec-arabic { font-size: 1.7rem; padding: .2rem 0; }
.dua-more { margin-top: .8rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.dua-more .row { gap: .6rem; }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.small-h.row { display: flex; align-items: center; gap: .3rem; }

/* ---- Salah photographs & step audio (learner panel) */
.sp-fig.sp-photo { padding: 0; overflow: hidden; background: #000; }
.sp-fig.sp-photo a { display: block; }
.sp-fig.sp-photo img { width: 100%; height: auto; max-height: 52vh; object-fit: contain; border-radius: 0; margin: 0 auto; }
.sp-thumbs { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .2rem; }
.sp-thumbs button { flex: 0 0 auto; width: 64px; height: 48px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--surface); cursor: pointer; }
.sp-thumbs button.on { border-color: var(--brand); }
.sp-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-photo-cap { display: grid; gap: .2rem; }
.sp-photo-cap p { margin: 0; }
.sp-photo-cap .chip { justify-self: start; }
.sp-stepaudio { display: grid; gap: .35rem; padding: .55rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.sp-stepaudio .row { gap: .4rem; flex-wrap: wrap; }
.sp-noaudio { display: grid; gap: .3rem; padding: .6rem .7rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); color: var(--ink); }
.sp-noaudio .btn { justify-self: start; }
@media (max-width: 760px) {
  .sp-left.has-photo { grid-template-columns: 1fr; align-items: stretch; }
  .sp-left.has-photo .sp-fig { grid-row: auto; }
  .sp-left.has-photo .sp-fig.sp-photo img { max-height: 46vh; }
}

/* ---- Admin → Salah → Photos & audio */
.badge.bad { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
.chip.chip-missing { border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.card.stat.stat-warn .v { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sm-thumb { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; display: block; background: var(--surface-2); }
.sm-thumb-empty { display: grid; place-items: center; font-size: 1.3rem; border: 1px dashed color-mix(in srgb, var(--danger) 50%, var(--line)); opacity: .8; }
.sm-intro h2 { margin-top: 0; }
.sm-warnings { margin: .4rem 0 0; padding: .6rem .8rem .6rem 1.8rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); display: grid; gap: .2rem; }
.sm-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; margin: .6rem 0; }
.sm-photo { margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); display: grid; grid-template-rows: auto 1fr; }
.sm-photo.main { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.sm-photo.hidden-photo img { opacity: .45; }
.sm-photo > a img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--surface-2); }
.sm-photo figcaption { padding: .5rem .6rem; display: grid; gap: .3rem; min-width: 0; }
.sm-photo figcaption .row { gap: .3rem; flex-wrap: wrap; }
.sm-photo-actions .btn, .sm-photo-actions .icon-btn { font-size: .78rem; }
.sm-photo-actions label.btn { cursor: pointer; }
.sm-upload { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .6rem; padding: .7rem; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.sm-upload .input { flex: 1 1 220px; }
.sm-new-form { display: grid; grid-template-columns: minmax(180px, 320px) 1fr; gap: 1rem; margin-top: .8rem; padding: .8rem; border: 1px solid var(--brand); border-radius: var(--radius-sm); }
.sm-preview { width: 100%; height: auto; border-radius: 8px; display: block; background: #000; }
@media (max-width: 760px) { .sm-new-form { grid-template-columns: 1fr; } }
.sm-recs { display: grid; gap: .7rem; }
.sm-rec { display: grid; gap: .3rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.sm-rec-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.sm-rec-ar { font-family: var(--quran-font); font-size: 1.4rem; line-height: 2; margin: 0; }
.sm-rec audio { max-width: 100%; }
.sm-thumb-cell { width: 80px; }
.admin-thumb img { width: 56px; height: 48px; object-fit: cover; border-radius: 6px; display: block; }

/* ---- Windows desktop edition: "This computer" */
.dk-mode { display: grid; gap: .25rem; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
.dk-mode.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.dk-mode input { justify-self: start; }
.dk-reciter { display: grid; gap: .35rem; padding: .5rem 0; }
.dk-reciter .bar { height: 6px; }
.desktop-app .install-hint { display: none; }

/* ---------------------------------------------------------------- downloads for offline use */
.chip.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); border-color: transparent; }
.chip svg { width: 14px; height: 14px; fill: currentColor; }
.dl-page { display: grid; gap: 1rem; }
.dl-status .row { margin-bottom: .4rem; }
.dl-groups { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: .6rem; }
.dl-group { display: grid; gap: .3rem; }
.dl-modes { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.dl-mode { display: flex; flex-direction: column; gap: .5rem; }
.dl-mode h2 { margin: 0; font-size: 1.15rem; }
.dl-mode p { margin: 0; }
.dl-mode .btn { align-self: flex-start; margin-top: auto; }
.dl-mode select { max-width: 100%; }
.dl-checks { display: grid; gap: .25rem; }
.dl-progress h2 { margin-top: 0; }
.dl-bar { height: 12px; margin: .5rem 0; }
.dl-bar > i { transition: width .25s; }
.dl-errors ul { max-height: 14rem; overflow: auto; padding-inline-start: 1.1rem; }
.dl-errors code { word-break: break-all; }
.dl-notes ul { padding-inline-start: 1.1rem; display: grid; gap: .3rem; }
.dl-maint-out { margin-top: .6rem; }
.row.wrap { flex-wrap: wrap; }

/* ---------------------------------------------------------------- media library */
.media-grid { gap: 1rem; }
.media-section { margin-top: 1.25rem; }
.media-card { display: flex; flex-direction: column; gap: .35rem; padding: .75rem; }
.media-card h3 { margin: .2rem 0 0; font-size: 1.02rem; }
.media-card p { margin: 0; }
.media-box { border-radius: 12px; overflow: hidden; }
.media-box audio { width: 100%; }
.media-box video, .media-box iframe { width: 100%; aspect-ratio: 16 / 9; display: block; background: #000; border: 0; }
.media-thumb, .media-img { position: relative; display: block; width: 100%; padding: 0; border: 0; background: var(--surface-2); cursor: pointer; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; }
.media-thumb img, .media-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-ph { display: grid; place-items: center; height: 100%; font-size: 2.4rem; }
.media-play { position: absolute; inset-inline-start: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: .35rem;
  padding: .45rem .9rem; border-radius: 999px; background: rgba(0, 0, 0, .65); color: #fff; font-weight: 650; }
[dir="rtl"] .media-play { transform: translate(50%, -50%); }
.media-play svg { width: 20px; height: 20px; fill: currentColor; }
.media-source { color: var(--muted); }
.media-err { margin-top: .4rem; }
.media-full { max-width: 100%; height: auto; display: block; margin: 0 auto; border-radius: 10px; }
.media-preview { border: 1px dashed var(--line); border-radius: 12px; padding: .6rem; }
.media-preview video, .media-preview audio { width: 100%; max-height: 320px; }
.media-card.compact { padding: .5rem; }
img.admin-thumb { width: 64px; height: 40px; object-fit: cover; border-radius: 6px; display: block; }
.admin-log { white-space: pre-wrap; max-height: 18rem; overflow: auto; background: var(--surface-2); padding: .75rem; border-radius: 10px; font-size: .8rem; margin-top: 1rem; }
@media (min-width: 900px) { .sheet.sheet-wide { max-width: 860px; width: 92vw; } }
.sp-play-video { margin-top: .8rem; }
.sp-videos { display: grid; gap: .8rem; }
.lib-tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
.lib-tabs a { padding: .35rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: .9rem; }
.lib-tabs a.active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.topbar-actions a.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
/* keep the app name and the menu on one line on laptop screens */
.brand-name, .nav a { white-space: nowrap; }
@media (min-width: 900px) and (max-width: 1440px) { .nav { gap: 0; margin-left: .5rem; } .nav a { padding: .4rem .5rem; font-size: .88rem; } }
@media (min-width: 900px) and (max-width: 1180px) { .brand-name { display: none; } }
@media (min-width: 900px) { .nav { min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; } .nav::-webkit-scrollbar { display: none; } }
@media (min-width: 900px) and (max-width: 1440px) { .nav a[data-nav="legend"] { display: none; } }

/* ---------------------------------------------------------------- spoken translation in the player */
.player-opts .tr-audio-select { max-width: 13rem; }
.tr-remember { font-size: .78rem; white-space: nowrap; display: inline-flex; align-items: center; gap: .2rem; }
.tr-chip { white-space: nowrap; font-size: .72rem; }
.tr-now { display: block; color: var(--brand); font-weight: 650; font-size: .8rem; }
.ayah.tr-speaking { position: relative; }
.ayah.tr-speaking::after { content: "🔊 " attr(data-tr-lang); position: absolute; inset-inline-end: .75rem; top: -.65rem; font-size: .72rem; font-weight: 650;
  background: var(--brand); color: var(--brand-ink); padding: .1rem .55rem; border-radius: 999px; }
@media (max-width: 899px) {
  .player-opts { flex-wrap: wrap; overflow-x: visible; row-gap: .35rem; }
  .player-opts select { flex: 1 1 42%; min-width: 8rem; }
  .player-opts .tr-audio-select { max-width: none; }
}

/* ---------- Install App, updates, installed-app layout ---------- */
.install-btn {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; padding: .35rem .8rem; border-radius: 999px;
  border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink, #fff); font-weight: 700; font-size: .9rem; cursor: pointer; white-space: nowrap;
}
.install-btn:hover { filter: brightness(1.08); }
.install-btn svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
/* small phones: the button shrinks to its icon, then the name beside the logo gives way — the buttons never leave the screen */
@media (max-width: 899px) { .install-label-app { display: none; } }
@media (max-width: 460px) { .install-label { display: none; } .install-btn { width: 44px; height: 44px; padding: 0; justify-content: center; } .install-btn svg { width: 22px; height: 22px; } .topbar { gap: .5rem; } }
@media (max-width: 359px) { .brand-name { display: none; } }
@media (min-width: 360px) and (max-width: 374px) { .brand-name { font-size: .94rem; } .brand { gap: .4rem; } .topbar-actions { gap: .3rem; } }
.brand { min-width: 0; }
.brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { flex: none; }
.update-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem .75rem; }
.update-banner[hidden] { display: none !important; }
.install-status.ok { border-left: 4px solid var(--brand); }
.install-status.ready { border-left: 4px solid var(--gold); }
.install-status.warn { border-left: 4px solid var(--gold); background: color-mix(in srgb, var(--gold-soft) 45%, var(--surface)); }
.install-now { min-height: 48px; padding-inline: 1.5rem; font-size: 1.05rem; }
.install-steps, .install-other ol { padding-inline-start: 1.4rem; margin: .5rem 0; display: grid; gap: .4rem; }
.install-list { padding-inline-start: 1.2rem; display: grid; gap: .45rem; margin: 0; }
.install-other { border-top: 1px solid var(--line); padding: .55rem 0; }
.install-other summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
/* the top bar clears notches and rounded corners when installed (iPhone, Android edge-to-edge) */
.topbar { padding-top: max(.6rem, env(safe-area-inset-top)); padding-right: max(1rem, env(safe-area-inset-right)); }
/* the installed app has no browser address bar to fall back on: keep a little more room for touch */
@media (display-mode: standalone) and (pointer: coarse) { .topbar-actions { gap: .35rem; } }
/* touch screens: never let a tap target shrink below a comfortable size */
@media (pointer: coarse) { .topbar .icon-btn { width: 44px; height: 44px; } }
/* computers with a narrower window: the menu needs the room, so the button shows its icon only */
@media (min-width: 900px) and (max-width: 1180px) { .install-label { display: none; } .install-btn { width: 40px; height: 40px; padding: 0; justify-content: center; } }
@media (max-width: 374px) { .tabs button { padding: .7rem .55rem; } }

/* ---------- Lesson plans ---------- */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: .35rem .8rem; min-height: 34px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.crumbs { margin-bottom: .6rem; color: var(--muted); }
.pl-bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.pl-bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.pl-pct { font-weight: 750; font-variant-numeric: tabular-nums; min-width: 3ch; text-align: end; }
.pl-cat { display: grid; gap: .35rem; }
.pl-cat p { margin: 0; }
.pl-mini { display: grid; gap: .3rem; margin-top: .4rem; }
.pl-mini-row { display: grid; grid-template-columns: minmax(7rem, 11rem) 1fr 3.2rem; align-items: center; gap: .5rem; }
.pl-mini-row .pl-bar { height: 8px; }
.pl-student h3, .pl-plan h3 { margin: 0; }
.pl-warn { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.pl-filters { margin-bottom: 1rem; }
.pl-filters .input[type=search] { flex: 1 1 14rem; }
.pl-filters select.input { flex: 0 1 12rem; }
.pl-section { margin-top: 1rem; }
.pl-plan.archived { opacity: .75; }
.pl-list { display: grid; }
.pl-list-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .6rem .2rem; border-bottom: 1px solid var(--line); color: var(--ink); }
.pl-list-row:last-child { border-bottom: 0; }
.pl-list-row:hover { text-decoration: none; background: var(--surface-2); }
.pl-facts { margin-top: .75rem; }
.pl-days { display: flex; gap: 3px; align-items: flex-end; margin-top: .9rem; overflow-x: auto; padding-bottom: .2rem; }
.pl-day { flex: 1 0 18px; display: grid; justify-items: center; gap: 2px; font-size: .7rem; color: var(--muted); }
.pl-day-bars { height: 56px; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.pl-day-bars i, .pl-legend i { display: inline-block; width: 7px; min-height: 2px; border-radius: 2px; background: var(--brand); }
.pl-day-bars i.p, .pl-legend i.p { background: var(--gold); }
.pl-legend i { height: 9px; vertical-align: middle; }
.pl-details summary { cursor: pointer; font-weight: 600; margin-top: .6rem; }
.pl-cat-sec h2 { margin: 0; }
.pl-items { display: grid; gap: .5rem; margin-top: .75rem; }
.pl-item { display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: start; padding: .7rem .75rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); border-inline-start: 4px solid var(--line); }
.pl-item.st-done { border-inline-start-color: var(--brand); }
.pl-item.st-need { border-inline-start-color: var(--gold); }
.pl-item.st-prog { border-inline-start-color: #5b8db8; }
.pl-item-box { display: grid; place-items: center; min-width: 44px; min-height: 44px; margin: -.5rem 0 -.5rem -.4rem; cursor: pointer; }
.pl-done { width: 24px; height: 24px; accent-color: var(--brand); cursor: pointer; }
.pl-done:disabled { cursor: default; }
.pl-item-main { min-width: 0; }
.pl-item-main .row { gap: .4rem; }
.pl-item-title { overflow-wrap: anywhere; }
.pl-item-meta { margin-top: .2rem; }
.pl-checks { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.pl-check-chip { font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.pl-remarks { margin: .35rem 0 0; padding: .35rem .6rem; background: var(--surface-2); border-radius: 8px; }
.chip.st-done { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip.st-need { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.chip.st-prog { background: #e3edf6; color: #2f5f88; border-color: transparent; }
:root[data-theme="dark"] .chip.st-prog { background: #1c2b38; color: #9cc3e6; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .chip.st-prog { background: #1c2b38; color: #9cc3e6; } }
.pl-form { display: grid; gap: .25rem; }
.pl-fieldset { border: 1px solid var(--line); border-radius: 10px; padding: .4rem .8rem; margin: 0 0 .8rem; }
.pl-fieldset legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.pl-sugg { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .8rem; }
.pl-sugg p { flex-basis: 100%; margin: 0; }
.pl-sugg-chip { cursor: pointer; text-align: start; }
.pl-weights summary { cursor: pointer; font-weight: 600; margin: .4rem 0; }
.pl-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.pl-table th, .pl-table td { text-align: start; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; }
.pl-events { padding-inline-start: 1.1rem; display: grid; gap: .3rem; font-size: .9rem; }
.pl-guardians { padding-inline-start: 1.1rem; }
.ur { font-family: var(--ur-font); }
@media (max-width: 640px) {
  .pl-mini-row { grid-template-columns: 6.5rem 1fr 2.8rem; }
  .pl-item { grid-template-columns: auto 1fr; }
  .pl-item .pl-edit { grid-column: 2; justify-self: start; }
}

/* ---------- Progress report (always printed on white paper) ---------- */
.rep-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .8rem; }
.rep-edit { margin-bottom: 1rem; }
.rep-edit summary { cursor: pointer; }
.rep-wrap { overflow-x: auto; }
.rep-doc { background: #ffffff; color: #1d2a24; max-width: 820px; margin: 0 auto; padding: 28px 30px; border: 1px solid #ddd5c4; border-radius: 6px; font-size: 14px; line-height: 1.5; position: relative; }
.rep-doc.lang-ur { font-family: "Noto Nastaliq Urdu", var(--ur-font), serif; line-height: 2.1; font-size: 15px; }
.rep-doc h1 { font-size: 22px; margin: 0; color: #0f5741; }
.rep-doc h2 { font-size: 16px; margin: 0 0 8px; color: #0f5741; border-bottom: 2px solid #e2efe8; padding-bottom: 4px; }
.rep-doc p { margin: 0 0 4px; }
.rep-head { display: flex; gap: 14px; align-items: center; border-bottom: 3px solid #0f5741; padding-bottom: 12px; margin-bottom: 14px; }
.rep-head img { border-radius: 12px; }
.rep-brand { font-weight: 700; color: #a87b2f; font-size: 13px; letter-spacing: .02em; }
.rep-draft { background: #f4e9d2; color: #7a5717; font-weight: 700; text-align: center; padding: 4px; border-radius: 4px; margin-bottom: 10px; }
.rep-info { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.rep-info th, .rep-info td { border: 1px solid #ddd5c4; padding: 5px 8px; text-align: start; vertical-align: top; }
.rep-info th { background: #f6f1e6; width: 18%; font-weight: 600; }
.rep-sec { margin: 0 0 16px; }
.rep-tiles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.rep-tile { flex: 1 1 110px; border: 1px solid #ddd5c4; border-radius: 8px; padding: 8px 10px; background: #fbf8f1; }
.rep-tile b { display: block; font-size: 22px; color: #0f5741; }
.rep-tile span { font-size: 12px; color: #5c6b63; }
.rep-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rep-table th, .rep-table td { border: 1px solid #e3dccd; padding: 5px 7px; text-align: start; vertical-align: top; }
.rep-table th { background: #f6f1e6; font-weight: 600; }
.rep-table tr.done td:first-child { color: #0f5741; font-weight: 700; }
.rep-table tr.need td { background: #fdf6e6; }
.rep-c { width: 28px; text-align: center !important; }
.rep-bar { display: inline-block; vertical-align: middle; width: 140px; max-width: 60%; height: 10px; background: #ece6d8; border-radius: 5px; overflow: hidden; }
.rep-bar > i { display: block; height: 100%; background: #0f5741; }
.rep-barcell { white-space: nowrap; }
.rep-catline { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.rep-catbar { display: grid; gap: 3px; flex: 1; }
.rep-catbar .rep-bar { width: 100%; max-width: none; }
.rep-big { font-size: 26px; font-weight: 800; color: #0f5741; min-width: 70px; }
.rep-small { font-size: 12.5px; color: #4b5a52; }
.rep-ar { font-family: "Amiri Quran Local", "Amiri", serif; font-size: 1.15em; }
.rep-text .rep-line { white-space: pre-wrap; }
.rep-sign { display: flex; gap: 30px; margin-top: 30px; }
.rep-sign > div { flex: 1; }
.rep-sign span { display: block; border-bottom: 1px solid #555; height: 34px; }
.rep-sign p { font-size: 12px; color: #4b5a52; margin-top: 4px; }
@media (max-width: 640px) {
  .rep-doc { padding: 14px 12px; font-size: 13px; }
  .rep-info th { width: auto; }
  .rep-info, .rep-info tbody, .rep-info tr { display: block; }
  .rep-info tr { display: grid; grid-template-columns: auto 1fr; }
}
/* while the PDF is made the report is laid out at A4 width */
body.rep-making-pdf .rep-doc { width: 794px; max-width: none; border: 0; border-radius: 0; padding: 0; font-size: 14px; }
body.rep-making-pdf .rep-info, body.rep-making-pdf .rep-info tbody { display: table; } 
body.rep-making-pdf .rep-info tbody { display: table-row-group; }
body.rep-making-pdf .rep-info tr { display: table-row; }
@media print {
  .no-print, .site-announcement, #offline-banner, #update-banner, .toast, #sheet-root, .rep-edit, .crumbs, .rep-toolbar { display: none !important; }
  main { padding: 0 !important; }
  .rep-doc { border: 0; padding: 0; max-width: none; font-size: 12px; }
  .rep-sec, .rep-table tr { break-inside: avoid; }
  .rep-info, .rep-info tbody { display: table !important; }
  .rep-info tbody { display: table-row-group !important; }
  .rep-info tr { display: table-row !important; }
  @page { size: A4; margin: 14mm; }
}
.rep-text .rep-line { padding: 2px 0; }
.rep-doc h1, .rep-doc h2, .rep-doc h3 { letter-spacing: normal; } /* letter spacing would break the joining of Urdu letters in the PDF */
.rep-barline { display: flex; align-items: center; gap: 8px; }
.rep-barline .rep-bar { display: block; flex: 1 1 auto; width: auto; max-width: 220px; }
.rep-barline span { min-width: 3.2em; font-variant-numeric: tabular-nums; }
.row > input[type=date].input { width: auto; flex: 0 1 11rem; }

/* ==========================================================================
   About menu: About the Developer (3D design) · Audio settings · player states
   ========================================================================== */
.about-link {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; min-width: 40px; padding: .3rem .7rem; border-radius: 999px;
  color: var(--ink-soft); font-weight: 650; font-size: .9rem; justify-content: center;
}
.about-link svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.about-link:hover { background: var(--surface-2); text-decoration: none; }
.about-link.active { background: var(--brand-soft); color: var(--brand); }
@media (max-width: 899px) { .about-link { padding: 0; width: 40px; } .about-label { display: none; } }

.about-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 1rem; padding: .3rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; width: fit-content; max-width: 100%; }
.about-tab { display: inline-flex; align-items: baseline; gap: .45rem; padding: .45rem 1rem; border-radius: 999px; color: var(--ink-soft); font-weight: 650; font-size: .92rem; }
.about-tab .t-ur { font-size: .85rem; line-height: 1.6; color: var(--muted); }
.about-tab:hover { text-decoration: none; background: var(--surface); }
.about-tab.on { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow); }
.about-tab.on .t-ur { color: inherit; opacity: .85; }
@media (max-width: 480px) { .about-tabs { border-radius: 16px; width: 100%; } .about-tab { flex: 1 1 100%; justify-content: center; } }

/* ---------- developer page ---------- */
.dev-page { --dev-gold: var(--gold); --dev-emerald: var(--brand); max-width: 1080px; margin: 0 auto; }
.dev-page .t-ur, .dev-ur { font-family: var(--ur-font); }
.dev-hero {
  --rx: 0deg; --ry: 0deg;
  position: relative; display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 1.5rem; align-items: center;
  padding: clamp(1.25rem, 3vw, 2.25rem); border-radius: 24px; overflow: hidden; isolation: isolate;
  color: #f8f3e6;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(214, 170, 92, .28), transparent 55%),
    radial-gradient(90% 80% at 100% 100%, rgba(72, 179, 140, .30), transparent 60%),
    linear-gradient(135deg, #0b3d2e 0%, #0f5741 48%, #123c33 100%);
  box-shadow: 0 30px 60px -30px rgba(6, 40, 30, .65), inset 0 1px 0 rgba(255, 255, 255, .12);
  transform: perspective(1200px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .25s ease-out;
}
/* subtle girih-style lattice behind the text (two rotated grids) */
.dev-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .16; pointer-events: none;
  background:
    repeating-linear-gradient(45deg, transparent 0 22px, rgba(255, 238, 200, .55) 22px 23px),
    repeating-linear-gradient(-45deg, transparent 0 22px, rgba(255, 238, 200, .55) 22px 23px),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(255, 238, 200, .35) 31px 32px);
  mask-image: radial-gradient(80% 90% at 30% 50%, #000 20%, transparent 85%);
  -webkit-mask-image: radial-gradient(80% 90% at 30% 50%, #000 20%, transparent 85%);
}
.dev-hero-text { position: relative; z-index: 1; min-width: 0; }
.dev-kicker { margin: 0 0 .25rem; text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 700; color: #e9cf96; }
.dev-kicker .t-ur { text-transform: none; letter-spacing: 0; font-size: .9rem; }
.dev-hero h1 { margin: 0; font-family: "Amiri", Georgia, serif; font-weight: 700; font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.1; color: #fffaf0; text-shadow: 0 2px 18px rgba(0, 0, 0, .25); }
.dev-h1-ur { margin: .15rem 0 .4rem; font-size: clamp(1.25rem, 3vw, 1.6rem); line-height: 2; color: #f1dcaa; }
.dev-name { margin: 0 0 .6rem; font-size: 1.15rem; font-weight: 700; color: #fff; }
.dev-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; }
.dev-name .t-ur { font-weight: 400; color: #f1dcaa; line-height: 1.9; }
.dev-name-sep { color: #e9cf96; font-size: .8rem; }
.dev-h1-ur { text-align: start; direction: rtl; width: fit-content; }
.dev-quals { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .9rem; }
.dev-badge { display: inline-block; padding: .25rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 650; color: #fff8e6;
  background: rgba(255, 255, 255, .10); border: 1px solid rgba(233, 207, 150, .45); backdrop-filter: blur(4px); }
.dev-lead { margin: 0; max-width: 48ch; color: #eef3ee; font-size: 1.02rem; }
.dev-lead strong { color: #f3d58f; }

/* the 3D eight-pointed star */
.dev-scene { position: relative; aspect-ratio: 1; width: 100%; max-width: 300px; margin: 0 auto; perspective: 900px; }
.dev-orbit { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(18deg); }
.dev-star3d { position: absolute; inset: 8%; transform-style: preserve-3d; animation: dev-spin 26s linear infinite; }
.dev-layer { position: absolute; inset: 0; display: grid; place-items: center; transform-style: preserve-3d; }
.dev-layer.l1 { transform: translateZ(-46px) scale(1.04); opacity: .35; }
.dev-layer.l2 { transform: translateZ(0) rotate(22.5deg) scale(.86); opacity: .7; }
.dev-layer.l3 { transform: translateZ(40px) scale(.66); }
.dev-layer.l4 { transform: translateZ(72px); }
.dev-star { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .35)); }
.dev-star rect { fill: rgba(214, 170, 92, .12); stroke: #e3c07a; stroke-width: 1.4; }
.dev-layer.l2 .dev-star rect { fill: rgba(72, 179, 140, .18); stroke: #9fe0c4; }
.dev-layer.l3 .dev-star rect { fill: rgba(255, 246, 224, .16); stroke: #fff1cf; stroke-width: 1.8; }
.dev-star circle { fill: none; stroke: rgba(255, 241, 207, .7); stroke-width: 1; }
.dev-core { display: grid; place-items: center; width: 34%; aspect-ratio: 1; border-radius: 50%; animation: dev-counter 26s linear infinite;
  background: radial-gradient(circle at 35% 30%, #fff6dc, #e2bd6e 55%, #9b7027); box-shadow: 0 0 0 6px rgba(255, 241, 207, .18), 0 12px 30px rgba(0, 0, 0, .4), 0 0 40px rgba(243, 213, 143, .45); }
.dev-core img { width: 64%; height: auto; border-radius: 22%; }
.dev-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #f3d58f; box-shadow: 0 0 12px #f3d58f; top: 50%; left: 50%; margin: -4.5px; }
.dev-dot.d1 { animation: dev-orbit 9s linear infinite; }
.dev-dot.d2 { animation: dev-orbit 13s linear infinite reverse; background: #9fe0c4; box-shadow: 0 0 12px #9fe0c4; }
.dev-dot.d3 { animation: dev-orbit 17s linear infinite; width: 6px; height: 6px; margin: -3px; }
@keyframes dev-spin { from { transform: rotateY(0) rotateZ(0); } to { transform: rotateY(360deg) rotateZ(45deg); } }
@keyframes dev-counter { from { transform: rotateY(0); } to { transform: rotateY(-360deg); } }
@keyframes dev-orbit { from { transform: rotate(0) translateX(140px) rotate(0); } to { transform: rotate(360deg) translateX(140px) rotate(-360deg); } }
@media (max-width: 720px) {
  .dev-hero { grid-template-columns: 1fr; text-align: center; }
  .dev-name { justify-content: center; }
  .dev-h1-ur { margin-inline: auto; }
  .dev-scene { max-width: 190px; }
  .dev-quals { justify-content: center; }
  .dev-lead { margin-inline: auto; }
  @keyframes dev-orbit { from { transform: rotate(0) translateX(92px) rotate(0); } to { transform: rotate(360deg) translateX(92px) rotate(-360deg); } }
}
@media (prefers-reduced-motion: reduce) {
  .dev-star3d, .dev-core, .dev-dot { animation: none !important; }
  .dev-star3d { transform: rotateY(-18deg) rotateZ(10deg); }
  .dev-hero { transition: none; transform: none; }
}

.dev-bar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 .75rem; }
.dev-switch { display: inline-flex; padding: .25rem; gap: .25rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.dev-switch button { border: 0; background: transparent; color: var(--ink-soft); font: inherit; font-weight: 650; font-size: .88rem; padding: .35rem .85rem; border-radius: 999px; cursor: pointer; min-height: 36px; }
.dev-switch button[lang="ur"] { font-family: var(--ur-font); font-weight: 400; }
.dev-switch button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow); }

/* the two languages side by side (stacked on phones); the switch can show one */
.dev-cols { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1rem, 3vw, 2.5rem); }
.dev-page[data-lang="en"] .dev-cols, .dev-page[data-lang="ur"] .dev-cols { grid-template-columns: 1fr; }
.dev-page[data-lang="en"] .dev-ur, .dev-page[data-lang="ur"] .dev-en { display: none; }
@media (max-width: 760px) { .dev-cols { grid-template-columns: 1fr; } .dev-page[data-lang="both"] .dev-ur { border-top: 1px dashed var(--line); padding-top: .75rem; } }
.dev-col { min-width: 0; }
.dev-en p { font-size: 1.04rem; line-height: 1.8; margin: 0 0 .85rem; color: var(--ink); }
.dev-ur { text-align: right; }
.dev-ur p { font-size: 1.2rem; line-height: 2.35; margin: 0 0 .6rem; color: var(--ink); }
.dev-en h2 { font-family: "Amiri", Georgia, serif; font-size: 1.55rem; line-height: 1.3; margin: 0 0 .7rem; color: var(--brand); }
.dev-ur h2 { font-size: 1.45rem; line-height: 2; margin: 0 0 .4rem; color: var(--brand); font-weight: 600; }
.dev-em { font-weight: 650; color: var(--ink) !important; }
.dev-ur .dev-em { font-weight: 600; }

/* the prayer: the first and most visible card, nothing over the text */
.dev-prayer {
  position: relative; padding: clamp(1.2rem, 3vw, 2rem); padding-top: 2.2rem; margin: 0 0 1.25rem; border-radius: 22px;
  background: linear-gradient(180deg, var(--gold-soft), var(--surface) 70%); border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 20px 40px -24px rgba(120, 86, 20, .45), var(--shadow);
  transform: translateZ(0);
}
.dev-prayer::after { content: ""; position: absolute; inset: 8px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent); pointer-events: none; }
.dev-prayer-icon { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #fff6dc, #e2bd6e 60%, #9b7027); box-shadow: 0 8px 18px rgba(120, 86, 20, .35); }
.dev-prayer-icon svg { width: 22px; height: 22px; fill: #7a1f2b; }
.dev-prayer h2 { color: var(--gold) !important; }
.dev-prayer .dev-en p { font-size: 1.1rem; }
.dev-prayer .dev-ur p { font-size: 1.28rem; }

.dev-toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem; margin: 0 0 1.25rem; }
.dev-toc a { display: grid; grid-template-columns: auto 1fr; column-gap: .6rem; align-items: center; padding: .55rem .75rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: .9rem; transition: transform .15s, box-shadow .15s; }
.dev-toc a:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.dev-toc .n { grid-row: span 2; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.dev-toc .dev-ur { font-weight: 400; font-size: .9rem; line-height: 1.9; color: var(--muted); text-align: start; }
.dev-page[data-lang="ur"] .dev-toc a, .dev-page[data-lang="ur"] .dev-toc { direction: rtl; }

.dev-chapter {
  position: relative; margin: 0 0 1.1rem; padding: clamp(1.1rem, 3vw, 1.9rem); padding-top: 2.4rem; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); scroll-margin-top: 80px;
}
.dev-chapter::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; border-radius: 20px 20px 0 0; background: linear-gradient(90deg, var(--brand), var(--gold), var(--brand)); }
.dev-medal { position: absolute; top: -20px; inset-inline-start: 1.25rem; width: 46px; height: 46px; display: grid; place-items: center; }
.dev-medal-star { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .2)); }
.dev-medal-star rect { fill: var(--brand); stroke: var(--gold); stroke-width: 3; }
.dev-medal-star circle { fill: var(--surface); stroke: var(--gold); stroke-width: 2; }
.dev-medal span { position: relative; font-weight: 800; color: var(--brand); font-size: .9rem; }
.dev-basmala { font-style: italic; color: var(--gold) !important; font-weight: 600; }
.dev-ur .dev-basmala { font-style: normal; }

.dev-closing { margin: 1.5rem 0 1rem; padding: clamp(1.2rem, 3vw, 2rem); border-radius: 22px; text-align: center; color: #f8f3e6;
  background: linear-gradient(135deg, #0b3d2e, #0f5741 55%, #123c33); box-shadow: 0 24px 50px -28px rgba(6, 40, 30, .7); }
.dev-closing .dev-col p { color: #f8f3e6 !important; }
.dev-closing .dev-ur { text-align: center; }
.dev-closing .dev-em { color: #fff !important; }
.dev-ameen { font-family: "Amiri", Georgia, serif; font-size: 1.5rem !important; color: #f3d58f !important; margin: .4rem 0 !important; }
.dev-ur .dev-ameen { font-family: var(--ur-font); }
.dev-regards { opacity: .85; margin-bottom: .1rem !important; }
.dev-sign { font-family: "Amiri", Georgia, serif; font-size: 1.6rem !important; font-weight: 700; color: #fff !important; }
.dev-ur .dev-sign { font-family: var(--ur-font); font-size: 1.5rem !important; }
.dev-contact { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: 1rem; }
.dev-contact .btn { background: rgba(255, 255, 255, .1); border-color: rgba(233, 207, 150, .5); color: #fff8e6; word-break: break-all; }
.dev-foot { text-align: center; margin: 0 0 2rem; }
.dev-foot .t-ur { display: block; font-size: 1rem; line-height: 2; }
@media print {
  .dev-hero, .dev-closing { background: none !important; color: #000 !important; box-shadow: none; transform: none; }
  .dev-scene, .dev-bar, .about-tabs, .dev-toc { display: none !important; }
  .dev-hero h1, .dev-name, .dev-lead, .dev-closing .dev-col p, .dev-sign { color: #000 !important; text-shadow: none; }
}

/* ---------- audio settings sheet ---------- */
.audio-settings-sheet { max-width: 640px; }
.as-group { border: 1px solid var(--line); border-radius: 14px; padding: .75rem .9rem .5rem; margin: 0; }
.as-group legend { padding: 0 .4rem; font-weight: 750; color: var(--brand); }
.opt-list { display: grid; gap: .35rem; margin: .25rem 0 .5rem; }
.opt-list.opt-inline { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.opt-row { display: flex; align-items: flex-start; gap: .6rem; padding: .5rem .6rem; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.opt-row:hover { background: var(--surface-2); }
.opt-row.on, .lang-audio.on > .opt-row { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.opt-row input { margin-top: .25rem; width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.opt-text { display: grid; gap: .1rem; min-width: 0; }
.opt-text small { font-size: .8rem; line-height: 1.4; }
.opt-text .t-ur { font-weight: 400; line-height: 1.6; }
.opt-text .chip.small { font-size: .7rem; padding: 0 .4rem; margin-inline-start: .3rem; }
.lang-audio.unavailable .opt-row { cursor: default; opacity: .9; }
.lang-audio.unavailable .opt-row strong { color: var(--muted); }
.lang-note { color: color-mix(in srgb, var(--gold) 80%, var(--ink)); }
.lang-alt { margin: -.15rem 0 .4rem 2.35rem; color: var(--ink-soft); }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .75rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .86rem; font-weight: 600; min-height: 36px; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.pill:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.as-group .field { display: flex; align-items: center; gap: .6rem; margin: .25rem 0 .4rem; flex-wrap: wrap; }
.as-group .field select { min-height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: .25rem .5rem; font: inherit; }

/* ---------- player: status, skip, settings ---------- */
.player-status { display: flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; }
.player-status.loading { color: var(--muted); }
.player-status.error { color: var(--danger); }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: sp-rot .8s linear infinite; flex: none; }
@keyframes sp-rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.tr-skip { white-space: nowrap; }
.player-settings-btn svg { width: 18px; height: 18px; }
.player-opts .tr-audio-select { max-width: 15rem; }
@media (max-width: 520px) { .player-settings-btn span { display: none; } .hide-xs { display: none; } }
.reader-head .btn svg { flex: none; }

/* ==========================================================================
   Animated Quran logo (top bar): a slow golden ring, a soft glow, a gentle 3D turn and a light
   sweep. Only transform and opacity are animated (GPU, no layout work). It calms down while the Quran
   is open, stops for "reduce motion", and can be switched off (html.no-logo-motion).
   ========================================================================== */
.brand-logo { position: relative; width: 40px; height: 40px; flex: none; display: grid; place-items: center; perspective: 220px; isolation: isolate; }
.brand-ring {
  position: absolute; inset: 0; border-radius: 50%; z-index: -1;
  background: conic-gradient(from 0deg, transparent 0 18%, rgba(214, 170, 92, .95) 30%, transparent 42% 60%, rgba(72, 179, 140, .85) 72%, transparent 84%);
  -webkit-mask: radial-gradient(circle, transparent 0 62%, #000 64% 70%, transparent 72%);
          mask: radial-gradient(circle, transparent 0 62%, #000 64% 70%, transparent 72%);
  animation: logo-ring 12s linear infinite; will-change: transform;
}
.brand-glow { position: absolute; inset: 3px; border-radius: 30%; z-index: -1; background: radial-gradient(circle, rgba(214, 170, 92, .55), transparent 70%);
  animation: logo-glow 6s ease-in-out infinite; will-change: opacity, transform; }
.brand-tilt { position: relative; display: block; width: 32px; height: 32px; border-radius: 9px; overflow: hidden; transform-style: preserve-3d;
  animation: logo-turn 9s ease-in-out infinite; will-change: transform; box-shadow: 0 3px 10px rgba(15, 87, 65, .28); }
.brand-logo .brand-mark { width: 32px; height: 32px; border-radius: 9px; display: block; }
.brand-shine { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 248, 225, .75) 50%, transparent 65%);
  transform: translateX(-130%); animation: logo-shine 9s ease-in-out infinite; will-change: transform; }
@keyframes logo-ring { to { transform: rotate(360deg); } }
@keyframes logo-glow { 0%, 100% { opacity: .35; transform: scale(.92); } 50% { opacity: .9; transform: scale(1.08); } }
@keyframes logo-turn { 0%, 100% { transform: rotateY(-14deg) rotateX(4deg); } 50% { transform: rotateY(14deg) rotateX(-4deg); } }
@keyframes logo-shine { 0%, 62% { transform: translateX(-130%); } 80%, 100% { transform: translateX(130%); } }
.brand:hover .brand-tilt { animation-duration: 3.5s; }
/* while reading or listening: only the slow ring and glow, at half strength */
body.reading .brand-tilt, body.reading .brand-shine { animation: none; transform: none; }
body.reading .brand-shine { opacity: 0; }
body.reading .brand-ring { animation-duration: 24s; opacity: .6; }
body.reading .brand-glow { animation-duration: 10s; opacity: .4; }
html.no-logo-motion .brand-ring, html.no-logo-motion .brand-glow, html.no-logo-motion .brand-tilt, html.no-logo-motion .brand-shine { animation: none !important; transform: none !important; }
html.no-logo-motion .brand-shine { opacity: 0; }
html.no-logo-motion .brand-ring { opacity: .55; }
html.no-logo-motion .brand-glow { opacity: .35; }
@media (prefers-reduced-motion: reduce) {
  .brand-ring, .brand-glow, .brand-tilt, .brand-shine { animation: none !important; transform: none !important; }
  .brand-shine { opacity: 0; }
}
@media print { .brand-ring, .brand-glow, .brand-shine { display: none; } }
.logo-motion-toggle { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); cursor: pointer; }
.logo-motion-toggle input { accent-color: var(--brand); width: 16px; height: 16px; }
.player-opts .mode-select { max-width: 13rem; }
.player-opts .tr-audio-select.dim { opacity: .7; }
@media (max-width: 899px) { .player-opts .mode-select { max-width: none; } }

/* Animated Quran logo on the home page: slow 3D sway, breathing golden halo, a light sweep every few
   seconds. Same switch as the top-bar logo; still for "reduce motion". */
.hero-logo-wrap { position: relative; display: grid; place-items: center; perspective: 900px; justify-self: center; }
.hero-logo-tilt { position: relative; border-radius: 22%; overflow: hidden; transform-style: preserve-3d; animation: hero-sway 10s ease-in-out infinite; will-change: transform; box-shadow: 0 18px 40px rgba(0, 0, 0, .38); }
.hero-logo-tilt .hero-logo { display: block; box-shadow: none; }
.hero-logo-halo { position: absolute; inset: -10%; border-radius: 50%; z-index: 0; background: radial-gradient(circle, rgba(231, 201, 139, .5), rgba(231, 201, 139, .12) 45%, transparent 68%);
  animation: hero-halo 7s ease-in-out infinite; will-change: opacity, transform; pointer-events: none; }
.hero-logo-shine { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 38%, rgba(255, 250, 232, .55) 50%, transparent 62%);
  transform: translateX(-140%); animation: hero-shine 10s ease-in-out infinite; will-change: transform; }
@keyframes hero-sway { 0%, 100% { transform: rotateY(-9deg) rotateX(3deg) translateY(0); } 50% { transform: rotateY(9deg) rotateX(-3deg) translateY(-6px); } }
@keyframes hero-halo { 0%, 100% { opacity: .55; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes hero-shine { 0%, 70% { transform: translateX(-140%); } 88%, 100% { transform: translateX(140%); } }
@media (max-width: 640px) { .hero-logo-wrap { order: -1; } }
html.no-logo-motion .hero-logo-tilt, html.no-logo-motion .hero-logo-halo, html.no-logo-motion .hero-logo-shine { animation: none !important; transform: none !important; }
html.no-logo-motion .hero-logo-shine { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .hero-logo-tilt, .hero-logo-halo, .hero-logo-shine { animation: none !important; transform: none !important; }
  .hero-logo-shine { opacity: 0; }
}
.hero-motion { margin-top: .9rem; }
.hero .logo-motion-toggle { color: #cfe0d6; font-size: .8rem; }

/* ==========================================================================
   Islamic (Hijri) calendar
   ========================================================================== */
.cal-link svg { width: 22px; height: 22px; fill: currentColor; }
@media (min-width: 900px) { .cal-link { display: none; } }
.cal-page { max-width: 1000px; margin: 0 auto; display: grid; gap: 1rem; }
.cal-today {
  display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: end; padding: clamp(1.1rem, 3vw, 1.8rem); border-radius: 22px; color: #f8f3e6;
  background: radial-gradient(110% 90% at 0% 0%, rgba(214, 170, 92, .25), transparent 55%), linear-gradient(135deg, #0b3d2e, #0f5741 55%, #123c33);
  box-shadow: 0 24px 48px -28px rgba(6, 40, 30, .65);
}
.cal-today h1 { margin: .1rem 0; font-family: "Amiri", Georgia, serif; font-size: clamp(1.9rem, 5vw, 2.8rem); line-height: 1.15; color: #fffaf0; }
.cal-today h1 small { font-size: .5em; color: #e9cf96; }
.cal-kicker { margin: 0; text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: #e9cf96; }
.cal-kicker .t-ur { text-transform: none; letter-spacing: 0; font-size: .95rem; }
.cal-ur { margin: 0; font-size: 1.35rem; line-height: 2.1; color: #f1dcaa; text-align: left; direction: rtl; width: fit-content; }
.cal-ar { margin: 0; font-family: var(--ar-ui-font); font-size: 1.3rem; color: #fff; width: fit-content; }
.cal-greg { margin: .2rem 0 .5rem; font-weight: 650; color: #fff; }
.cal-today .muted, .cal-today .small { color: #d6e4dc !important; }
.cal-today a { color: #f3d58f; }
.cal-note { max-width: 62ch; }
.cal-occ-today { margin: 0; padding: .5rem .85rem; border-radius: 999px; background: rgba(243, 213, 143, .18); border: 1px solid rgba(243, 213, 143, .5); color: #fff6dc; font-weight: 650; }
.cal-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; border: 1px solid; }
.cal-badge.official { color: #0f5741; background: #e2efe8; border-color: #9fd3bc; }
.cal-badge.calc { color: #7a5a1c; background: #f6ecd6; border-color: #e0c58b; }
.cal-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem; text-align: center; }
.cal-head h2 { margin: 0; font-family: "Amiri", Georgia, serif; font-size: 1.6rem; color: var(--brand); }
.cal-title p { margin: .1rem 0; }
.cal-title-ur { font-size: 1.1rem; line-height: 1.9; color: var(--ink-soft); }
.cal-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .75rem 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { text-align: center; font-size: .78rem; font-weight: 700; color: var(--muted); padding: .3rem 0; display: grid; }
.cal-wd .wd-ur { font-size: .78rem; font-weight: 400; line-height: 1.7; }
.cal-wd.fri { color: var(--brand); }
.cal-cell { position: relative; min-height: 64px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: .35rem .4rem; display: grid; align-content: start; gap: 1px; }
.cal-cell.empty { border-color: transparent; background: transparent; }
.cal-cell.fri { background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); }
.cal-cell .cal-h { font-family: "Amiri", Georgia, serif; font-size: 1.35rem; font-weight: 700; line-height: 1; color: var(--ink); }
.cal-cell .cal-g { font-size: .72rem; color: var(--muted); }
.cal-cell .cal-o { font-size: .66rem; line-height: 1.2; color: var(--gold); font-weight: 700; }
.cal-cell.occ { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.cal-cell.today { background: var(--brand); border-color: var(--brand); box-shadow: 0 6px 16px -6px rgba(15, 87, 65, .55); }
.cal-cell.today .cal-h, .cal-cell.today .cal-g, .cal-cell.today .cal-o { color: var(--brand-ink); }
@media (max-width: 520px) { .cal-cell { min-height: 52px; padding: .25rem; } .cal-cell .cal-h { font-size: 1.1rem; } .cal-cell .cal-o { display: none; } .cal-cell.occ::after { content: ""; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); } .cal-wd .wd-ur { display: none; } }
.cal-months { margin-top: .8rem; } .cal-months ol { columns: 2; margin: .5rem 0 0; } @media (max-width: 560px) { .cal-months ol { columns: 1; } }
.link-btn { border: 0; background: none; color: var(--brand); font: inherit; font-weight: 650; cursor: pointer; padding: 0; text-decoration: underline; }
.cal-conv .field { display: grid; gap: .25rem; }
.cal-hsel { display: grid; grid-template-columns: 1fr 2fr 1.2fr; gap: .5rem; }
@media (max-width: 420px) { .cal-hsel { grid-template-columns: 1fr 1fr; } .cal-hsel .field:nth-child(2) { grid-column: 1 / -1; } }
.cal-result { border-top: 1px dashed var(--line); padding-top: .6rem; min-height: 4.5rem; }
.cal-result p { margin: .15rem 0; }
.cal-res-h { font-family: "Amiri", Georgia, serif; font-size: 1.45rem; font-weight: 700; color: var(--brand); }
.cal-res-u { font-size: 1.2rem; line-height: 2; text-align: right; }
.cal-res-g { font-weight: 650; }
.cal-set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem 1rem; align-items: end; }
.cal-set-grid .field { display: grid; gap: .25rem; }
.cal-adj { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.cal-adj strong { min-width: 2ch; text-align: center; font-size: 1.1rem; }
.cal-card .cal-card-date { font-family: "Amiri", Georgia, serif; font-size: 1.3rem; font-weight: 700; color: var(--brand); margin: .2rem 0 0; }
.cal-card .t-ur { margin: 0; line-height: 2; }
@media (max-width: 640px) { .cal-today { grid-template-columns: 1fr; } }

/* Complete surah recording with translation (Pashto) */
.whole-surah-btn { white-space: nowrap; }
.surah-rec audio { width: 100%; margin: .6rem 0 .2rem; }
.surah-rec .small { font-size: .8rem; }

/* ---------------- Islamic calendar: Gregorian month with the Hijri date under every day, split view, details */
.cal-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.cal-layout button { font-size: .85rem; }
.cal-nav { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin: .75rem 0 .5rem; }
.cal-nav-group { display: inline-flex; align-items: center; gap: .25rem; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--surface); }
.cal-nav-label { font-size: .82rem; font-weight: 650; color: var(--ink-soft); padding: 0 .35rem; white-space: nowrap; }
.cal-pick { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; margin-bottom: .75rem; }
.cal-pick-f { display: grid; gap: .2rem; font-size: .8rem; color: var(--muted); font-weight: 650; }
.cal-pick-f .mini-input { width: auto; text-align: start; }
.cal-pick-h { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.cal-panes { display: grid; gap: 1rem; }
@media (min-width: 900px) { .cal-panes.split { grid-template-columns: 1fr 1fr; } }
.cal-pane-head { text-align: center; margin-bottom: .5rem; }
.cal-pane-head h2 { margin: 0; font-family: "Amiri", Georgia, serif; font-size: 1.6rem; color: var(--brand); }
.cal-pane-sub { margin: .1rem 0; font-weight: 650; color: var(--gold); }
.cal-pane-ur { margin: 0; font-size: 1.05rem; line-height: 1.9; color: var(--ink-soft); }
.btn-cell { font: inherit; text-align: start; cursor: pointer; color: inherit; width: 100%; }
.btn-cell:hover { border-color: var(--brand); }
.btn-cell:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
/* Gregorian number on top, Hijri date underneath (distinct colour, font and weight) */
.cal-cell .cal-gd { font-size: 1.2rem; font-weight: 750; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.cal-cell .cal-hdate { display: block; margin-top: .25rem; font-size: .74rem; line-height: 1.25; color: var(--brand); }
.cal-cell .cal-hd { font-family: "Amiri", Georgia, serif; font-size: 1.05rem; font-weight: 700; }
.cal-cell .cal-hm { font-weight: 600; overflow-wrap: anywhere; }
.cal-cell .cal-hm-ur { display: block; font-size: .78rem; line-height: 1.8; color: var(--ink-soft); direction: rtl; text-align: end; }
.cal-pane-g .cal-cell { min-height: 82px; }
/* each Islamic month gets its own shade, so a Gregorian month that spans two Islamic months is easy to read */
.cal-pane-g .cal-cell.hme { background: color-mix(in srgb, var(--gold) 9%, var(--surface)); }
.cal-pane-g .cal-cell.hnew { border-inline-start: 3px solid var(--gold); }
.cal-cell.fri .cal-gd { color: var(--brand); }
.cal-cell.sel { outline: 3px solid var(--gold); outline-offset: -1px; border-color: var(--gold); box-shadow: 0 6px 16px -8px rgba(168, 123, 47, .7); }
.cal-cell.today .cal-gd, .cal-cell.today .cal-hdate, .cal-cell.today .cal-hm-ur { color: var(--brand-ink); }
.cal-legend { display: flex; align-items: center; gap: .3rem; margin: .5rem 0 0; }
.cal-legend .lg { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface); }
.cal-legend .lg.hme { background: color-mix(in srgb, var(--gold) 18%, var(--surface)); }
/* details of the selected day */
.cal-detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem 1.25rem; margin-top: 1rem; padding: 1rem; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line)); background: color-mix(in srgb, var(--gold) 7%, var(--surface)); }
.cal-detail p { margin: .1rem 0; }
.cal-detail-k { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 750; color: var(--muted); }
.cal-detail-g { font-size: 1.15rem; font-weight: 700; }
.cal-detail-h { font-family: "Amiri", Georgia, serif; font-size: 1.55rem; font-weight: 700; color: var(--brand); line-height: 1.2; }
.cal-detail-u { font-size: 1.2rem; line-height: 2; text-align: right; }
.cal-detail-dl { display: grid; grid-template-columns: auto 1fr; gap: .15rem .75rem; margin: .4rem 0; font-size: .9rem; }
.cal-detail-dl dt { color: var(--muted); }
.cal-detail-dl dd { margin: 0; font-weight: 600; }
.cal-occ-line { color: var(--gold); font-weight: 700; }
@media (max-width: 520px) {
  .cal-pane-g .cal-cell { min-height: 64px; padding: .25rem .2rem; }
  .cal-cell .cal-gd { font-size: 1rem; }
  .cal-cell .cal-hdate { font-size: .66rem; margin-top: .15rem; }
  .cal-cell .cal-hd { font-size: .95rem; display: block; }
  /* phones: the month name only where an Islamic month begins (and on the selected day); the day number always */
  .cal-pane-g .cal-cell:not(.hstart):not(.sel) .cal-hm, .cal-cell .cal-hm-ur { display: none; }
  .cal-pane-g .cal-cell .cal-hm { display: block; font-size: .6rem; line-height: 1.15; }
  .cal-layout button { padding: .3rem .55rem; font-size: .78rem; }
  .cal-pick-h .mini-select { max-width: 9rem; }
}
.cal-cell .cal-hm { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-panes.split .cal-hm-ur { display: none; }
.cal-page:has(.cal-panes.split) { max-width: 1280px; }
@media (max-width: 760px) { .cal-cell .cal-hm-ur { display: none; } }
@media (max-width: 520px) { .cal-pane-g .cal-cell .cal-hm { white-space: normal; overflow: visible; } }

/* ================= Qibla direction finder ================= */
.qb-page { max-width: 1060px; margin: 0 auto; display: grid; gap: 1rem; }
.qb-hero { overflow: hidden; background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--brand) 16%, var(--surface)), var(--surface) 70%); }
.qb-head { text-align: center; }
.qb-head h1 { margin: 0; font-family: "Amiri", Georgia, serif; color: var(--brand); font-size: clamp(1.8rem, 5vw, 2.4rem); }
.qb-ur { margin: 0; font-size: 1.25rem; line-height: 1.9; color: var(--gold); }
.qb-head p.muted { margin: .2rem auto .6rem; max-width: 60ch; }
.qb-stage { display: grid; grid-template-columns: 1.15fr 1fr; gap: 1rem; align-items: center; }
@media (max-width: 760px) { .qb-stage { grid-template-columns: 1fr; } }

/* 3D scene */
.qb-scene { position: relative; height: 300px; border-radius: 18px; overflow: hidden; perspective: 620px; perspective-origin: 50% 38%; isolation: isolate;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 35%, transparent), 0 14px 30px -18px rgba(0, 0, 0, .55); }
.qb-sky { position: absolute; inset: 0 0 42% 0; background: linear-gradient(#0c2c24 0%, #154a3b 45%, #c9a35a 100%); }
.qb-sky::after { content: ""; position: absolute; inset: 0; background: radial-gradient(1.5px 1.5px at 12% 20%, #fff8 50%, transparent 51%), radial-gradient(1px 1px at 30% 12%, #fff9 50%, transparent 51%), radial-gradient(1.5px 1.5px at 72% 18%, #fff7 50%, transparent 51%), radial-gradient(1px 1px at 88% 30%, #fff8 50%, transparent 51%), radial-gradient(1px 1px at 55% 8%, #fff9 50%, transparent 51%); }
.qb-ground { position: absolute; inset: 58% 0 0 0; background: linear-gradient(#e9e2d2, #cfc6b3); }
.qb-world { position: absolute; left: 50%; top: 62%; width: 0; height: 0; transform-style: preserve-3d; transition: transform .12s linear; }
.qb-kpos { position: absolute; transform-style: preserve-3d; transform: translateZ(-430px); }
.qb-kaaba { position: absolute; width: 120px; height: 132px; left: -60px; top: -132px; transform-style: preserve-3d; }
.qb-face { position: absolute; inset: 0; background: repeating-linear-gradient(135deg, #121212 0 3px, #0b0b0b 3px 6px); overflow: hidden; backface-visibility: hidden; }
.qb-face.f-front { transform: translateZ(60px); }
.qb-face.f-back { transform: rotateY(180deg) translateZ(60px); }
.qb-face.f-right { transform: rotateY(90deg) translateZ(60px); }
.qb-face.f-left { transform: rotateY(-90deg) translateZ(60px); }
.qb-face.f-top { width: 120px; height: 120px; top: -60px; inset: auto; left: 0; transform: rotateX(90deg); background: #1b1b1b; }
.qb-band { position: absolute; left: 0; right: 0; top: 24%; height: 11%; background: linear-gradient(#8a6420, #e7c46d 40%, #b38a3a 60%, #7b5617);
  box-shadow: 0 0 0 1px #5a3f10; }
.qb-band::after { content: ""; position: absolute; inset: 22% 4%; background: repeating-linear-gradient(90deg, #3a2a0c 0 2px, transparent 2px 7px, #3a2a0c 7px 8px, transparent 8px 14px); opacity: .55; }
.qb-door { position: absolute; width: 26%; height: 44%; left: 58%; bottom: 0; transform: translateY(-14%); background: linear-gradient(90deg, #8f6a22, #f0d27c 50%, #9a7429); border: 2px solid #5f4413; border-radius: 3px 3px 0 0; }
.qb-door::after { content: ""; position: absolute; inset: 12% 18%; border: 1px solid #6e4f17; }
.qb-light { position: absolute; inset: 0; pointer-events: none; }
.f-front .qb-light { background: linear-gradient(100deg, rgba(255, 236, 190, .16), transparent 55%); }
.f-right .qb-light { background: rgba(0, 0, 0, .35); }
.f-left .qb-light { background: linear-gradient(80deg, rgba(255, 230, 180, .08), rgba(0, 0, 0, .15)); }
.f-back .qb-light { background: rgba(0, 0, 0, .45); }
.qb-mataf { position: absolute; width: 520px; height: 520px; left: -260px; top: -260px; border-radius: 50%; transform: rotateX(90deg);
  background: repeating-radial-gradient(circle, #f7f3ea 0 22px, #e6dfcf 22px 24px); box-shadow: 0 0 60px 20px rgba(247, 243, 234, .35); }
.qb-shadow { position: absolute; width: 190px; height: 190px; left: -95px; top: -95px; border-radius: 50%; transform: rotateX(90deg) translateZ(1px); background: radial-gradient(closest-side, rgba(0, 0, 0, .45), transparent); }
.qb-halo { position: absolute; width: 300px; height: 300px; left: -150px; top: -230px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 220, 140, .45), transparent); opacity: 0; transition: opacity .4s; }
.qb-scene.aligned .qb-halo { opacity: 1; animation: qb-pulse 2.4s ease-in-out infinite; }
@keyframes qb-pulse { 50% { opacity: .55; } }
.qb-world.behind .qb-kpos { visibility: hidden; }
.qb-scene.noloc .qb-face, .qb-scene.noloc .qb-mataf { filter: grayscale(1) brightness(.75); } /* filters on leaves only: a filter on a 3D group flattens it */
.qb-turn { position: absolute; left: 0; right: 0; top: 42%; text-align: center; font-size: 1.4rem; font-weight: 800; color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, .6); pointer-events: none; }
.qb-scene.flat .qb-flat-kaaba { position: absolute; left: 50%; top: 62%; width: 110px; height: 120px; transform: translate(-50%, -100%); background: repeating-linear-gradient(135deg, #121212 0 3px, #0b0b0b 3px 6px); box-shadow: 0 18px 24px -12px rgba(0, 0, 0, .6); }
.qb-flat-kaaba i { position: absolute; left: 0; right: 0; top: 24%; height: 11%; background: linear-gradient(#8a6420, #e7c46d 40%, #7b5617); }
@media (prefers-reduced-motion: reduce) { .qb-world { transition: none; } .qb-scene.aligned .qb-halo { animation: none; } }

/* compass */
.qb-compass-wrap { display: grid; place-items: center; }
.qb-compass { width: min(320px, 82vw); height: auto; overflow: visible; }
.qb-ring { transition: transform .12s linear; }
@media (prefers-reduced-motion: reduce) { .qb-ring { transition: none; } }
.qb-ring-bg { fill: var(--surface); stroke: color-mix(in srgb, var(--gold) 60%, var(--line)); stroke-width: 3; }
.qb-ring-in { fill: none; stroke: var(--line); stroke-width: 1; }
.qb-ring .tk { stroke: var(--muted); stroke-width: 1; }
.qb-ring .tk-mid { stroke: var(--ink-soft); stroke-width: 1.6; }
.qb-ring .tk-major { stroke: var(--ink); stroke-width: 2.6; }
.qb-ring .cl { font: 700 15px/1 system-ui, sans-serif; fill: var(--ink); }
.qb-ring .cl-n { fill: #c0392b; font-size: 20px; }
.qb-ring .cl-ic { font-size: 11px; fill: var(--muted); }
.qb-ring .cdeg { font: 600 9px/1 system-ui, sans-serif; fill: var(--muted); }
.qb-qarrow .qa-line { stroke: var(--gold); stroke-width: 4; stroke-linecap: round; }
.qb-qarrow .qa-head { fill: var(--gold); }
.qb-qarrow .qa-kaaba rect { fill: #111; stroke: #e7c46d; stroke-width: 1; }
.qb-qarrow .qa-kaaba .qa-band { fill: #e7c46d; stroke: none; }
.qb-dev path { fill: var(--brand); }
.qb-dev line { stroke: var(--brand); stroke-width: 2; stroke-dasharray: 3 3; }
.qb-hub { fill: var(--surface); stroke: var(--line); }
.qb-centre { font: 800 15px/1 system-ui, sans-serif; fill: var(--ink); }
.qb-compass.aligned .qb-ring-bg { stroke: var(--ok, #2e9e6a); stroke-width: 6; filter: drop-shadow(0 0 8px rgba(46, 158, 106, .55)); }
.qb-compass.aligned .qb-dev path { fill: var(--ok, #2e9e6a); }
.qb-compass.aligned .qb-centre { fill: var(--ok, #2e9e6a); font-size: 22px; }

/* readout */
.qb-readout { text-align: center; margin-top: .8rem; display: grid; gap: .3rem; justify-items: center; }
.qb-big { display: grid; justify-items: center; }
.qb-big-k { font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 800; color: var(--muted); }
.qb-big strong { font-family: "Amiri", Georgia, serif; font-size: clamp(2.4rem, 9vw, 3.4rem); line-height: 1.05; color: var(--brand); }
.qb-big-p { font-weight: 650; color: var(--gold); }
.qb-status { margin: 0; font-weight: 650; }
.qb-status.ok { color: var(--ok, #2e9e6a); font-size: 1.1rem; }
.qb-status.warn { color: var(--gold); }

/* information, location, map, settings */
.qb-dl { display: grid; grid-template-columns: minmax(9rem, auto) 1fr; gap: .35rem 1rem; margin: 0; }
.qb-dl dt { color: var(--muted); font-size: .9rem; }
.qb-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 520px) { .qb-dl { grid-template-columns: 1fr; gap: 0; } .qb-dl dd { margin-bottom: .45rem; } }
.qb-src { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .82rem; font-weight: 700; border: 1px solid; }
.qb-src.dev { color: #0f5741; background: #e2efe8; border-color: #9fd3bc; }
.qb-src.manual { color: #3a4a8a; background: #e8ebf8; border-color: #b9c2ea; }
.qb-src.saved { color: #7a5a1c; background: #f6ecd6; border-color: #e0c58b; }
.qb-src.none { color: var(--muted); border-color: var(--line); }
.qb-acc { font-weight: 700; }
.qb-acc.good { color: var(--ok, #2e9e6a); } .qb-acc.fair, .qb-acc.unknown { color: var(--gold); } .qb-acc.poor { color: var(--danger, #b4232b); } .qb-acc.none, .qb-acc.manual { color: var(--muted); }
.qb-sun { margin: .75rem 0 0; padding: .55rem .75rem; border-radius: 10px; background: color-mix(in srgb, var(--gold) 9%, var(--surface)); }
.qb-loc-auto { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; justify-content: space-between; }
.qb-loc-auto p { margin: .2rem 0; }
.qb-sec { margin-top: .75rem; border-top: 1px dashed var(--line); padding-top: .6rem; }
.qb-sec summary { cursor: pointer; font-weight: 700; }
.qb-search { display: grid; grid-template-columns: 2fr 1.2fr auto; gap: .5rem; margin-top: .6rem; }
@media (max-width: 620px) { .qb-search { grid-template-columns: 1fr; } }
.qb-res-list { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .35rem; }
.qb-res { display: grid; gap: .1rem; width: 100%; text-align: start; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.qb-res:hover, .qb-res:focus-visible { border-color: var(--brand); }
.qb-coords { display: grid; grid-template-columns: 1fr 1fr auto; gap: .5rem; align-items: end; margin-top: .6rem; }
.qb-coords .field { display: grid; gap: .2rem; }
@media (max-width: 620px) { .qb-coords { grid-template-columns: 1fr 1fr; } .qb-coords .btn { grid-column: 1 / -1; } }
.qb-saved { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; margin-top: .9rem; padding: .6rem .75rem; border-radius: 10px; background: var(--surface-2); }
.qb-saved-btns { display: flex; flex-wrap: wrap; gap: .4rem; }
.qb-privacy { margin: .8rem 0 0; }
.qb-map { height: 380px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); z-index: 0; }
.qb-map.picking { cursor: crosshair; outline: 3px solid var(--gold); }
@media (max-width: 520px) { .qb-map { height: 300px; } }
.qb-map-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .6rem; }
.qb-pin-k span { display: block; width: 26px; height: 26px; border-radius: 4px; background: linear-gradient(#111 0 30%, #e7c46d 30% 42%, #111 42%); border: 2px solid #e7c46d; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.qb-pin-me span { display: block; width: 22px; height: 22px; border-radius: 50%; background: var(--brand, #0f5741); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .45); }
.qb-cal-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 1rem 1.5rem; }
@media (max-width: 760px) { .qb-cal-grid { grid-template-columns: 1fr; } }
.qb-fig8 svg { width: 160px; height: 80px; display: block; margin: 0 auto .4rem; }
.qb-f8 { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-dasharray: 5 5; }
.qb-dot { fill: var(--brand); }
.qb-cal-set { display: grid; gap: .5rem; align-content: start; }
.qb-cal-set p { margin: 0; }
.qb-off { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.qb-manual { display: grid; gap: .3rem; padding: .5rem .7rem; border-radius: 10px; background: var(--surface-2); }
.qb-range { width: 100%; }
.qb-link svg { width: 22px; height: 22px; fill: currentColor; }
@media (min-width: 900px) { .qb-link { display: none; } }
@media (max-width: 760px) { .qb-scene { height: 210px; } .qb-head p.muted { display: none; } .qb-compass { width: min(280px, 78vw); } }

/* ==========================================================================
   Logo emblem — the About Developer animation (3D eight-pointed stars, glow, orbiting lights) around the
   Quran logo everywhere: top bar, home page, About. Transforms and opacity only (GPU-composited).
   ========================================================================== */
.emb { --s: 54px; --core: 64%; --sw: 3.2; --orbit: .58;
  --st1: #c99a45; --fl1: rgba(214, 170, 92, .10); --st2: #2f8f6c; --fl2: rgba(72, 179, 140, .14); --st3: #e2bd6e; --fl3: rgba(255, 246, 224, .25); --dot1: #d9ac52; --dot2: #3fae86;
  position: relative; width: var(--s); height: var(--s); flex: none; display: grid; place-items: center; perspective: calc(var(--s) * 3.2); isolation: isolate; }
html[data-theme="dark"] .emb, .hero .emb { --st1: #e3c07a; --fl1: rgba(214, 170, 92, .12); --st2: #9fe0c4; --fl2: rgba(72, 179, 140, .18); --st3: #fff1cf; --fl3: rgba(255, 246, 224, .16); --dot1: #f3d58f; --dot2: #9fe0c4; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .emb { --st1: #e3c07a; --fl1: rgba(214, 170, 92, .12); --st2: #9fe0c4; --fl2: rgba(72, 179, 140, .18); --st3: #fff1cf; --fl3: rgba(255, 246, 224, .16); --dot1: #f3d58f; --dot2: #9fe0c4; } }
.emb > * { grid-area: 1 / 1; }
.emb-3d { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(18deg); pointer-events: none; z-index: 0; }
.emb-spin { position: absolute; inset: 0; transform-style: preserve-3d; animation: dev-spin 26s linear infinite; will-change: transform; }
.emb-star { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.emb-star rect { stroke-width: var(--sw); }
.emb-star circle { fill: none; stroke: var(--st3); stroke-width: calc(var(--sw) * .7); opacity: .7; }
.emb-star.s1 { transform: translateZ(calc(var(--s) * -.16)) scale(1.04); opacity: .45; }
.emb-star.s1 rect { fill: var(--fl1); stroke: var(--st1); }
.emb-star.s2 { transform: rotate(22.5deg) scale(.86); opacity: .8; }
.emb-star.s2 rect { fill: var(--fl2); stroke: var(--st2); }
.emb-star.s3 { transform: translateZ(calc(var(--s) * .14)) scale(.66); }
.emb-star.s3 rect { fill: var(--fl3); stroke: var(--st3); }
.emb-glow { position: absolute; inset: 6%; border-radius: 50%; z-index: -1; background: radial-gradient(circle, rgba(226, 189, 110, .55), transparent 68%); animation: logo-glow 6s ease-in-out infinite; will-change: opacity, transform; }
.emb-core { position: relative; z-index: 2; width: var(--core); aspect-ratio: 1; display: grid; place-items: center; }
.emb-dot { position: absolute; z-index: 3; top: 50%; left: 50%; width: calc(var(--s) * .07); height: calc(var(--s) * .07); min-width: 3px; min-height: 3px; border-radius: 50%; translate: -50% -50%;
  background: var(--dot1); box-shadow: 0 0 calc(var(--s) * .09) var(--dot1); animation: emb-orbit 9s linear infinite; will-change: transform; }
.emb-dot.d2 { background: var(--dot2); box-shadow: 0 0 calc(var(--s) * .09) var(--dot2); animation-duration: 13s; animation-direction: reverse; }
.emb-dot.d3 { width: calc(var(--s) * .045); height: calc(var(--s) * .045); animation-duration: 17s; }
@keyframes emb-orbit { from { transform: rotate(0) translateX(calc(var(--s) * var(--orbit))) rotate(0); } to { transform: rotate(360deg) translateX(calc(var(--s) * var(--orbit))) rotate(-360deg); } }

/* top bar: the mark in a gold medallion, as in About Developer (slightly larger than before) */
.emb-bar { --s: 56px; }
.emb-bar .emb-core { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6dc, #e2bd6e 55%, #9b7027);
  box-shadow: 0 0 0 2px rgba(255, 241, 207, .35), 0 4px 12px rgba(0, 0, 0, .28), 0 0 14px rgba(243, 213, 143, .45); perspective: 160px; }
.emb-bar .brand-tilt { width: 72%; height: 72%; border-radius: 24%; box-shadow: none; }
.emb-bar .brand-mark { width: 100%; height: 100%; border-radius: 24%; display: block; }
.emb-bar .emb-dot.d3 { display: none; }
@media (max-width: 899px) { .emb-bar { --s: 50px; } }
@media (max-width: 380px) { .emb-bar { --s: 46px; } }

/* home page: the full logo picture, unchanged, in front of the turning stars */
.emb-hero { --s: clamp(250px, 30vw, 330px); --core: 72%; --sw: 1.3; --orbit: .53; }
.emb-hero .hero-logo-tilt { width: 100%; }
.emb-hero .hero-logo { width: 100%; height: auto; }
@media (max-width: 640px) { .emb-hero { --s: min(300px, 82vw); } }
/* About page */
.emb-card { --s: 150px; --core: 80%; --sw: 1.8; --orbit: .54; }
.emb-card .emb-core img { width: 100%; height: auto; border-radius: 22%; box-shadow: 0 8px 22px rgba(0, 0, 0, .3); display: block; }
.dedication .emb-card { margin: .25rem; }

/* while the Quran is open: only a very slow turn, no orbiting lights, softer glow */
body.reading .emb-spin { animation-duration: 90s; }
body.reading .emb-dot { display: none; }
body.reading .emb-glow { animation: none; opacity: .35; }
/* switched off, reduced motion, print: still and calm */
html.no-logo-motion .emb-spin, html.no-logo-motion .emb-glow, html.no-logo-motion .emb-dot { animation: none !important; }
html.no-logo-motion .emb-spin { transform: rotateY(-18deg) rotateZ(10deg); }
html.no-logo-motion .emb-dot { display: none; }
@media (prefers-reduced-motion: reduce) {
  .emb-spin, .emb-glow, .emb-dot { animation: none !important; }
  .emb-spin { transform: rotateY(-18deg) rotateZ(10deg); }
  .emb-dot { display: none; }
}
@media print { .emb-3d, .emb-glow, .emb-dot { display: none; } }
.emb-hero .emb-dot { width: 11px; height: 11px; } .emb-hero .emb-dot.d3 { width: 7px; height: 7px; }
.emb-card .emb-dot { width: 7px; height: 7px; } .emb-card .emb-dot.d3 { width: 5px; height: 5px; }
.emb-bar .emb-star.s1 { opacity: .75; } .emb-bar .emb-star.s2 { opacity: .95; }
@media (min-width: 641px) { .emb-hero { --s: clamp(250px, 24vw, 295px); --core: 80%; } }
/* top bar emblem: closer to the About Developer look — larger, bolder stars */
.emb-bar { --s: 60px; --sw: 4; }
.emb-bar .emb-star.s1 { opacity: .9; } .emb-bar .emb-star.s2 { opacity: 1; }
.emb-bar .emb-glow { inset: 0; }
@media (max-width: 899px) { .emb-bar { --s: 52px; } }
@media (max-width: 380px) { .emb-bar { --s: 48px; } }
.topbar .brand { gap: .6rem; }
