/* ============ Tokens ============ */
:root {
  --bg: #f7f3ea;
  --bg-grad: radial-gradient(1200px 500px at 50% -120px, #efe6d1 0%, rgba(239,230,209,0) 70%);
  --surface: #fffdf8;
  --surface-2: #f3eee2;
  --surface-3: #ebe4d3;
  --ink: #1c2326;
  --ink-2: #48535a;
  --ink-3: #7b858a;
  --line: #e4dccb;
  --line-strong: #d4c9b2;
  --accent: #0e6b5c;
  --accent-2: #0b5a4d;
  --accent-ink: #ffffff;
  --accent-soft: #e2efe9;
  --gold: #a07a2c;
  --gold-soft: #f4ead2;
  --select: rgba(14, 107, 92, .12);
  --hover: rgba(14, 107, 92, .07);
  --shadow-sm: 0 1px 2px rgba(40, 32, 12, .06);
  --shadow-md: 0 6px 24px rgba(40, 32, 12, .08), 0 1px 3px rgba(40, 32, 12, .06);
  --shadow-lg: 0 24px 64px rgba(30, 24, 10, .18), 0 2px 8px rgba(30, 24, 10, .08);

  --tj-silent: #9aa0a6;
  --tj-madd6: #a3122d;
  --tj-madd45: #e0323e;
  --tj-madd246: #e2730b;
  --tj-madd2: #b07d06;
  --tj-ghunnah: #13923a;
  --tj-qalqalah: #1b6fd0;
  --tj-tafkhim: #3240a8;
  --tj-heavy: #7a4cc4;

  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-read: "Literata", Georgia, "Times New Roman", serif;
  --font-quran: "Amiri Quran", "Amiri", "Scheherazade New", "Traditional Arabic", serif;
  --font-ar: "Amiri", "Amiri Quran", "Traditional Arabic", serif;

  --ar-size: 2.2rem;
  --radius: 16px;
  --radius-sm: 10px;
  --panel-w: 440px;
  --topbar-h: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1517;
    --bg-grad: radial-gradient(1200px 500px at 50% -120px, #18302b 0%, rgba(24,48,43,0) 70%);
    --surface: #151d20;
    --surface-2: #1b2529;
    --surface-3: #223035;
    --ink: #ece7dc;
    --ink-2: #b8b3a8;
    --ink-3: #848a8c;
    --line: #26323a;
    --line-strong: #33424a;
    --accent: #4fc4a8;
    --accent-2: #6fd6bd;
    --accent-ink: #08201b;
    --accent-soft: #163029;
    --gold: #d8b45f;
    --gold-soft: #2c2616;
    --select: rgba(79, 196, 168, .16);
    --hover: rgba(79, 196, 168, .08);
    --shadow-md: 0 6px 24px rgba(0,0,0,.35);
    --shadow-lg: 0 24px 64px rgba(0,0,0,.55);
    --tj-silent: #7c848b;
    --tj-madd6: #ff5c72;
    --tj-madd45: #ff8270;
    --tj-madd246: #ffaa4d;
    --tj-madd2: #e6c55a;
    --tj-ghunnah: #4fd07c;
    --tj-qalqalah: #63adff;
    --tj-tafkhim: #93a0ff;
    --tj-heavy: #c4a6ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1517;
  --bg-grad: radial-gradient(1200px 500px at 50% -120px, #18302b 0%, rgba(24,48,43,0) 70%);
  --surface: #151d20;
  --surface-2: #1b2529;
  --surface-3: #223035;
  --ink: #ece7dc;
  --ink-2: #b8b3a8;
  --ink-3: #848a8c;
  --line: #26323a;
  --line-strong: #33424a;
  --accent: #4fc4a8;
  --accent-2: #6fd6bd;
  --accent-ink: #08201b;
  --accent-soft: #163029;
  --gold: #d8b45f;
  --gold-soft: #2c2616;
  --select: rgba(79, 196, 168, .16);
  --hover: rgba(79, 196, 168, .08);
  --shadow-md: 0 6px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 64px rgba(0,0,0,.55);
  --tj-silent: #7c848b;
  --tj-madd6: #ff5c72;
  --tj-madd45: #ff8270;
  --tj-madd246: #ffaa4d;
  --tj-madd2: #e6c55a;
  --tj-ghunnah: #4fd07c;
  --tj-qalqalah: #63adff;
  --tj-tafkhim: #93a0ff;
  --tj-heavy: #c4a6ff;
  color-scheme: dark;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 400 16px/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
svg { display: block; }
[lang="ar"] { font-family: var(--font-ar); }
.skip { position: absolute; left: 8px; top: 8px; transform: translateY(-300%); background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { transform: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ============ Top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: var(--topbar-h);
  max-width: 1200px; margin: 0 auto;
  padding: 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -.01em; margin-right: 4px; }
.brand img { border-radius: 8px; box-shadow: var(--shadow-sm); }
.brand-name { font-size: 1.05rem; }
.surah-switch {
  display: flex; align-items: center; gap: 4px;
  margin: 0 auto;
  padding: 7px 10px 7px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface);
  font-weight: 600; font-size: .95rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, background .15s;
}
.surah-switch:hover { border-color: var(--line-strong); }
.surah-switch svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.topbar-actions { display: flex; gap: 4px; }

.icon-btn {
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  border: 0; border-radius: 12px;
  background: transparent; cursor: pointer;
  color: var(--ink-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.small { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn.small svg { width: 19px; height: 19px; }
#tajweedBtn .dot1 { fill: var(--tj-madd45); stroke: none; }
#tajweedBtn .dot2 { fill: var(--tj-ghunnah); stroke: none; }
#tajweedBtn .dot3 { fill: var(--tj-qalqalah); stroke: none; }
#tajweedBtn .dot4 { fill: var(--tj-madd246); stroke: none; }
#tajweedBtn[aria-pressed="false"] circle { fill: var(--ink-3); opacity: .45; }
#tajweedBtn[aria-pressed="true"] { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }

@media (max-width: 560px) {
  .brand-name { display: none; }
  .surah-switch { font-size: .9rem; }
  .icon-btn { width: 38px; height: 38px; }
}

/* ============ Main layout ============ */
.main { max-width: 860px; margin: 0 auto; padding: 24px 16px 64px; outline: none; transition: margin .25s ease; }
@media (min-width: 960px) {
  body.panel-open .main { margin-right: calc(var(--panel-w) + 24px); margin-left: max(16px, calc((100vw - var(--panel-w) - 860px) / 2)); }
}
.loading { text-align: center; padding: 18vh 0; color: var(--ink-3); }
.loading-mark { font-family: var(--font-quran); font-size: 2.4rem; color: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ============ Surah header ============ */
.surah-head { text-align: center; margin: 8px 0 22px; }
.surah-plate {
  position: relative;
  margin: 0 auto 14px;
  max-width: 520px;
  padding: 18px 28px;
  border-radius: 18px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, var(--gold), color-mix(in srgb, var(--gold) 30%, transparent) 40%, var(--gold)) border-box;
  border: 1.5px solid transparent;
  box-shadow: var(--shadow-md);
}
.surah-plate::before, .surah-plate::after {
  content: ""; position: absolute; top: 50%; width: 14px; height: 14px;
  background: var(--gold); transform: translateY(-50%) rotate(45deg); border-radius: 2px;
}
.surah-plate::before { left: -8px; }
.surah-plate::after { right: -8px; }
.surah-plate-ar { font-family: var(--font-quran); font-size: 2rem; line-height: 1.6; color: var(--ink); }
.surah-head h1 { margin: 0; font-size: 1.6rem; letter-spacing: -.02em; font-weight: 700; }
.surah-meta { margin: 2px 0 0; color: var(--ink-3); font-size: .95rem; }
.surah-intro { max-width: 620px; margin: 14px auto 0; color: var(--ink-2); font: 400 1rem/1.65 var(--font-read); }
.status-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; letter-spacing: .01em;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.pill.ok { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.draft { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============ Reading toolbar ============ */
.read-bar {
  position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 10;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin: 0 0 18px; padding: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; cursor: pointer;
  padding: 6px 12px; border-radius: 8px;
  font-size: .85rem; font-weight: 550; color: var(--ink-2);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 0 6px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--ink-2); background: none; border: 0; padding: 4px 2px; cursor: pointer; }
.legend-item:hover { color: var(--ink); }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
@media (max-width: 560px) {
  .read-bar { top: calc(var(--topbar-h) + 6px); }
  .seg button { padding: 6px 8px; font-size: .8rem; }
  .read-bar .seg { width: 100%; justify-content: space-between; }
}

/* ============ Basmala ============ */
.basmala { text-align: center; font-family: var(--font-quran); font-size: calc(var(--ar-size) * .95); line-height: 2.1; margin: 4px 0 18px; color: var(--ink); }

/* ============ Verses ============ */
.verses { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.verse {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--topbar-h) + 80px);
  transition: border-color .2s, box-shadow .2s;
}
.verse.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--select); }
.verse-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.vref { font-size: .78rem; font-weight: 600; color: var(--ink-3); text-decoration: none; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.vref:hover { color: var(--accent); }
.ar {
  direction: rtl; text-align: right;
  font-family: var(--font-quran);
  font-size: var(--ar-size);
  line-height: 2.25;
  word-spacing: .06em;
  color: var(--ink);
  font-feature-settings: "calt", "liga";
}
.w {
  cursor: pointer;
  border-radius: 8px;
  padding: 0 .06em;
  transition: background .12s;
  -webkit-tap-highlight-color: transparent;
}
.w:hover { background: var(--hover); }
.w { scroll-margin-top: calc(var(--topbar-h) + 72px); }
.w.selected { background: var(--select); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 45%, transparent); }
.w:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.stop { color: var(--ink-3); font-size: .7em; }
.nowrap { white-space: nowrap; }
.ayah-num {
  display: inline-grid; place-items: center;
  min-width: 1.45em; height: 1.45em;
  margin: 0 .2em;
  padding: 0 .2em;
  font-family: var(--font-ar); font-size: .58em; line-height: 1;
  color: var(--gold);
  border: 1.5px solid color-mix(in srgb, var(--gold) 70%, transparent);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2.5px var(--surface), inset 0 0 0 3.5px color-mix(in srgb, var(--gold) 35%, transparent);
  vertical-align: .18em;
}

.tr { margin-top: 10px; display: grid; gap: 8px; }
.tr-row { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: baseline; }
.tr-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding-top: 3px; }
.tr-row.literal .tr-label { color: var(--accent); }
.tr-text { margin: 0; font: 400 1.04rem/1.65 var(--font-read); color: var(--ink); }
.tr-row.literal .tr-text { font-style: italic; color: var(--ink-2); }
@media (max-width: 560px) {
  .verse { padding: 14px 14px 12px; }
  .tr-row { grid-template-columns: 1fr; gap: 0; }
}
.vnotes { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.vnotes summary {
  cursor: pointer; list-style: none;
  font-size: .8rem; font-weight: 600; color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 6px;
}
.vnotes summary::-webkit-details-marker { display: none; }
.vnotes summary::before { content: ""; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.vnotes[open] summary::before { transform: rotate(45deg); }
.vnotes summary:hover { color: var(--accent); }
.vnotes p { margin: 8px 0 2px; font: 400 .95rem/1.65 var(--font-read); color: var(--ink-2); }

.pending-note {
  margin: 0 0 16px; padding: 12px 16px;
  border-radius: 12px; background: var(--gold-soft); color: var(--ink-2);
  font-size: .9rem;
}
.pending-note strong { color: var(--ink); }

.next-surah { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; }
.next-surah a {
  flex: 1; text-decoration: none; color: var(--ink);
  padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column;
}
.next-surah a:hover { border-color: var(--line-strong); }
.next-surah small { color: var(--ink-3); font-size: .78rem; }
.next-surah .right { text-align: right; }

/* ============ Tajweed colors ============ */
.tj-silent   { color: var(--tj-silent); }
.tj-madd6    { color: var(--tj-madd6); }
.tj-madd45   { color: var(--tj-madd45); }
.tj-madd246  { color: var(--tj-madd246); }
.tj-madd2    { color: var(--tj-madd2); }
.tj-ghunnah  { color: var(--tj-ghunnah); }
.tj-qalqalah { color: var(--tj-qalqalah); }
.tj-tafkhim  { color: var(--tj-tafkhim); }
.tj-heavy    { color: var(--tj-heavy); }
.bg-silent{background:var(--tj-silent)} .bg-madd6{background:var(--tj-madd6)} .bg-madd45{background:var(--tj-madd45)}
.bg-madd246{background:var(--tj-madd246)} .bg-madd2{background:var(--tj-madd2)} .bg-ghunnah{background:var(--tj-ghunnah)}
.bg-qalqalah{background:var(--tj-qalqalah)} .bg-tafkhim{background:var(--tj-tafkhim)} .bg-heavy{background:var(--tj-heavy)}
.bg-info{background:transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3)}

/* ============ Scrim / Panel ============ */
.scrim { position: fixed; inset: 0; background: rgba(10, 14, 16, .32); z-index: 40; opacity: 0; transition: opacity .2s; }
.scrim.show { opacity: 1; }
@media (min-width: 960px) { .scrim.panel-scrim { display: none; } }

.panel {
  position: fixed; z-index: 45;
  background: var(--surface);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s linear .28s;
  visibility: hidden;
}
.panel.open { visibility: visible; transition: transform .28s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 760px) {
  .panel { top: 0; right: 0; bottom: 0; width: var(--panel-w); border-left: 1px solid var(--line); transform: translateX(105%); }
  .panel.open { transform: none; }
  .panel-grip { display: none; }
}
@media (min-width: 960px) {
  .panel { top: var(--topbar-h); box-shadow: none; }
}
@media (max-width: 759px) {
  /* Phones: the word page takes the whole screen and slides up from the bottom */
  .panel { inset: 0; height: 100vh; height: 100dvh; border-radius: 0; transform: translateY(100%); box-shadow: none;
           padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .panel.open { transform: none; }
  .panel-grip { display: none; }
  .panel-top { padding: 8px 10px; background: var(--surface); }
  .panel-body { flex: 1; }
  body.panel-open { overflow: hidden; }
}
.panel-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex: none; }
.panel-nav { display: flex; gap: 2px; }
.panel-loc { flex: 1; text-align: center; font-size: .82rem; font-weight: 600; color: var(--ink-3); }
.panel-body { overflow-y: auto; padding: 18px 20px 32px; overscroll-behavior: contain; }

.wp-word { text-align: center; direction: rtl; font-family: var(--font-quran); font-size: 3.2rem; line-height: 2.5; margin: -6px 0 2px; }
.wp-translit { text-align: center; font: italic 500 1.1rem/1.3 var(--font-read); color: var(--ink-2); }
.wp-gloss { text-align: center; font-size: 1.15rem; font-weight: 650; margin: 4px 0 12px; letter-spacing: -.01em; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 12px; }
.chip { font-size: .76rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.chip.lemma { font-family: var(--font-ar); font-size: 1rem; font-weight: 400; padding: 0 10px; }
.wp-morph { font-size: .92rem; color: var(--ink-2); margin: 0 0 14px; text-align: center; line-height: 1.55; }
.parts { display: flex; flex-direction: row-reverse; justify-content: center; gap: 8px; margin: 0 0 16px; flex-wrap: wrap; }
.part { text-align: center; border: 1px dashed var(--line-strong); border-radius: 10px; padding: 2px 12px 6px; min-width: 64px; }
.part .p-ar { font-family: var(--font-quran); font-size: 1.6rem; line-height: 1.8; direction: rtl; }
.part .p-en { font-size: .74rem; color: var(--ink-3); }

.card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 0 0 14px; background: var(--surface); }
.root-card { background: linear-gradient(180deg, var(--accent-soft), var(--surface) 140px); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
.card-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin: 0 0 8px; }
.root-letters { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 4px 0 4px; }
.root-letter {
  width: 56px; height: 56px; display: grid; place-items: center;
  font-family: var(--font-ar); font-size: 2rem; line-height: 1;
  background: var(--surface); border: 1.5px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 14px;
  color: var(--accent); box-shadow: var(--shadow-sm);
  padding-bottom: 6px;
}
.root-dir { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 6px 0 2px; font-size: .72rem; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; }
.root-dir svg { width: 34px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.root-dash { width: 10px; height: 2px; background: color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 1px; }
.root-tr { text-align: center; font: italic 500 1rem var(--font-read); color: var(--ink-2); margin-bottom: 10px; }
.root-core { text-align: center; font: 600 1.08rem/1.45 var(--font-read); margin: 0 0 12px; color: var(--ink); }
.prose { font: 400 .98rem/1.7 var(--font-read); color: var(--ink-2); margin: 0 0 10px; }
.reading { border-left: 3px solid var(--gold); background: var(--gold-soft); padding: 10px 12px; border-radius: 0 10px 10px 0; font: italic 400 .98rem/1.65 var(--font-read); color: var(--ink); margin: 6px 0 0; }
.h4 { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 18px 0 8px; }
.senses { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.senses li { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: baseline; padding: 8px 10px; background: var(--surface-2); border-radius: 10px; }
.senses .s-ar { font-family: var(--font-quran); font-size: 1.35rem; line-height: 1.5; direction: rtl; grid-row: span 2; color: var(--accent); min-width: 64px; text-align: center; }
.senses .s-tr { font: italic 500 .9rem var(--font-read); color: var(--ink); }
.senses .s-en { font-size: .86rem; color: var(--ink-2); line-height: 1.45; }
.kv { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: var(--surface); }
.kv-ar { direction: rtl; text-align: right; font-family: var(--font-quran); font-size: 1.35rem; line-height: 2; color: var(--ink-2); }
.kv-ar mark { background: var(--select); color: var(--ink); border-radius: 6px; padding: 0 .1em; }
.kv-en { font: 400 .92rem/1.55 var(--font-read); color: var(--ink); margin: 2px 0 0; }
.kv-ref { font-size: .75rem; font-weight: 600; color: var(--ink-3); text-decoration: none; }
.kv-ref:hover { color: var(--accent); }
.siblings { display: flex; flex-wrap: wrap; gap: 6px; direction: rtl; }
.sib { font-family: var(--font-quran); font-size: 1.3rem; line-height: 1.7; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.sib:hover { border-color: var(--accent); }
.sib small { font-family: var(--font-ui); font-size: .7rem; color: var(--ink-3); margin-inline-start: 6px; direction: ltr; display: inline-block; }
.sources { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.sources li { font-size: .85rem; color: var(--ink-2); line-height: 1.45; }
.sources b { color: var(--ink); font-weight: 600; }
.draft-note { display: flex; gap: 8px; align-items: flex-start; font-size: .8rem; color: var(--gold); background: var(--gold-soft); border-radius: 10px; padding: 8px 10px; margin-top: 14px; line-height: 1.45; }

.tj-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.tj-item { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.tj-item .swatch { width: 12px; height: 12px; border-radius: 4px; margin-top: 4px; }
.tj-name { font-weight: 650; font-size: .92rem; }
.tj-name .tj-ar { font-family: var(--font-ar); font-weight: 400; color: var(--ink-3); margin-left: 6px; font-size: 1rem; }
.tj-sum { font-size: .86rem; color: var(--ink-2); margin: 2px 0 0; line-height: 1.5; }
.ar-inline { font-family: var(--font-quran); font-size: 1.18em; font-style: normal; line-height: 1; unicode-bidi: isolate; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; font-size: .85rem; }
.link-btn:hover { text-decoration: underline; }
.empty-root { text-align: center; color: var(--ink-2); font-size: .92rem; }

/* ============ Drawer ============ */
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(380px, 92vw); z-index: 50;
  background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(-105%); visibility: hidden;
  transition: transform .26s cubic-bezier(.2,.8,.2,1), visibility 0s linear .26s;
}
.drawer.open { transform: none; visibility: visible; transition: transform .26s cubic-bezier(.2,.8,.2,1); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 20px; }
.drawer-head h2 { margin: 0; font-size: 1.15rem; }
.drawer-search { padding: 6px 16px 10px; }
.drawer-search input {
  width: 100%; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; font-size: .95rem;
}
.drawer-search input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.surah-list { list-style: none; margin: 0; padding: 0 8px 24px; overflow-y: auto; }
.surah-list a {
  display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: 12px; text-decoration: none; color: var(--ink);
}
.surah-list a:hover { background: var(--hover); }
.surah-list a.current { background: var(--select); }
.s-num { width: 34px; height: 34px; display: grid; place-items: center; font-size: .8rem; font-weight: 650; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; transform: rotate(45deg); }
.s-num span { transform: rotate(-45deg); }
.s-name { font-weight: 600; font-size: .95rem; line-height: 1.3; }
.s-sub { font-size: .78rem; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.s-ar { font-family: var(--font-ar); font-size: 1.25rem; color: var(--ink-2); }
.s-badge { font-size: .66rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 999px; }

/* ============ Popover (settings) ============ */
.popover {
  position: fixed; top: calc(var(--topbar-h) + 6px); right: 12px; z-index: 50;
  width: min(340px, calc(100vw - 24px));
  max-height: calc(100vh - var(--topbar-h) - 24px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 16px;
  opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none; visibility: hidden;
  transition: opacity .16s, transform .16s, visibility 0s linear .16s;
}
.popover.open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity .16s, transform .16s; }
.set-group { margin-bottom: 16px; }
.set-group:last-child { margin-bottom: 0; }
.set-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 8px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: .9rem; }
.set-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.range { width: 100%; accent-color: var(--accent); }
.size-preview { font-family: var(--font-quran); direction: rtl; text-align: center; color: var(--ink-2); line-height: 2; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 999px; transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============ Guide ============ */
.guide {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg-grad), var(--bg);
  overflow-y: auto;
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .2s, transform .2s, visibility 0s linear .2s;
}
.guide.open { opacity: 1; visibility: visible; transform: none; transition: opacity .2s, transform .2s; }
.guide-inner { max-width: 860px; margin: 0 auto; padding: 18px 16px 64px; }
.guide-head { display: flex; justify-content: space-between; align-items: flex-start; position: sticky; top: 0; padding: 10px 0; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); z-index: 2; }
.guide-head h2 { margin: 0; font-size: 1.6rem; letter-spacing: -.02em; }
.eyebrow { margin: 0; font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.guide-intro { font: 400 1.02rem/1.7 var(--font-read); color: var(--ink-2); margin: 6px 0 18px; }
.g-group { margin: 26px 0 0; }
.g-group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.g-group-head .swatch { width: 16px; height: 16px; border-radius: 5px; }
.g-group-head h3 { margin: 0; font-size: 1.1rem; }
.g-group-head small { color: var(--ink-3); font-size: .85rem; }
.g-rule { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; scroll-margin-top: 90px; }
.g-rule.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--select); }
.g-rule h4 { margin: 0; font-size: 1rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.g-rule h4 .g-ar { font-family: var(--font-ar); font-weight: 400; font-size: 1.2rem; color: var(--ink-2); }
.g-rule h4 .g-tr { font: italic 400 .9rem var(--font-read); color: var(--ink-3); }
.g-sum { margin: 6px 0 4px; font-weight: 550; font-size: .95rem; }
.g-detail { margin: 0; font: 400 .95rem/1.65 var(--font-read); color: var(--ink-2); }
.g-examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.g-ex {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 12px; padding: 0 12px;
  background: var(--surface-2); text-decoration: none; color: var(--ink);
}
.g-ex:hover { border-color: var(--accent); }
.g-ex .g-ex-ar { font-family: var(--font-quran); font-size: 1.5rem; line-height: 1.9; direction: rtl; }
.g-ex small { font-size: .72rem; color: var(--ink-3); font-weight: 600; }
/* ============ Credit ============ */
.set-credit { margin: 4px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .75rem; line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============ Recitation ============ */
.verse-play {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--ink-3); cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.verse-play:hover { color: var(--accent); border-color: var(--accent); }
.verse-play svg { width: 14px; height: 14px; }
.verse.playing { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 3px var(--select); }
.verse.playing .verse-play { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.w.playing { background: var(--accent-soft); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.w.playing.selected { background: var(--select); }
.bw { border-radius: 8px; padding: 0 .06em; transition: background .12s; }
.bw.playing { background: var(--accent-soft); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }

svg .fill { fill: currentColor; stroke: none; }

.player {
  position: sticky; bottom: 12px; z-index: 12;
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0 0; padding: 8px 12px 8px 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-md);
}
.pl-controls { display: flex; align-items: center; gap: 2px; }
.pl-play {
  width: 46px; height: 46px; display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  transition: background .15s, transform .1s;
}
.pl-play:hover { background: var(--accent-2); }
.pl-play:active { transform: scale(.95); }
.pl-play svg { width: 22px; height: 22px; }
.player.is-loading .pl-play { animation: pulse 1.2s ease-in-out infinite; }
.pl-info { flex: 1; min-width: 0; }
.pl-now { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player.is-error .pl-now { color: var(--tj-madd6); font-weight: 500; white-space: normal; }
.pl-credit { font-size: .75rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-credit a { color: inherit; }
.pl-opts { display: flex; align-items: center; gap: 2px; }
.pl-opt {
  min-width: 46px; height: 30px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); cursor: pointer;
  font-size: .8rem; font-weight: 650; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.pl-opt:hover { color: var(--ink); border-color: var(--line-strong); }
.player .toggle[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 560px) {
  .player { flex-wrap: wrap; gap: 6px 10px; bottom: 8px; padding: 8px; }
  .pl-info { order: 3; flex-basis: 100%; padding: 0 4px; }
  .pl-opts { margin-left: auto; }
}

.wp-head { display: flex; flex-direction: column; align-items: center; }
.wp-listen {
  display: inline-flex; align-items: center; gap: 6px;
  margin: -14px 0 10px; padding: 5px 14px 5px 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--accent); cursor: pointer;
  font-size: .85rem; font-weight: 600;
}
.wp-listen:hover { border-color: var(--accent); background: var(--accent-soft); }
.wp-listen svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ============ Statistics ============ */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 560px; margin: 14px auto 0; padding: 0; }
.stat { display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; padding: 10px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.stat dd { margin: 0; font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat dt { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); text-align: center; line-height: 1.25; }
.stats-note { max-width: 560px; margin: 6px auto 0; text-align: center; }
.stats-note summary { cursor: pointer; display: inline; font-size: .78rem; font-weight: 600; color: var(--ink-3); }
.stats-note summary:hover { color: var(--accent); }
.stats-note p { text-align: left; margin: 8px 0 0; font-size: .85rem; line-height: 1.6; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.freq { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.freq > div { display: flex; flex-direction: column; gap: 2px; padding: 10px; background: var(--surface-2); border-radius: 10px; }
.freq b { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; color: var(--accent); font-variant-numeric: tabular-nums; }
.freq span { font-size: .76rem; line-height: 1.35; color: var(--ink-2); }
.occ { margin-top: 10px; }
.occ summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--accent); }
.occ-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; max-height: 220px; overflow-y: auto; }
.occ-chip { font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-variant-numeric: tabular-nums; }
.occ-chip:hover { border-color: var(--accent); color: var(--accent); }
.occ-chip.here { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.occ-more { font-size: .78rem; color: var(--ink-3); align-self: center; }
.freq-note { margin: 10px 0 0; font-size: .78rem; line-height: 1.5; color: var(--ink-3); }

/* ============ Progress page ============ */
.drawer-link { margin-left: auto; margin-right: 6px; font-size: .82rem; font-weight: 600; color: var(--accent); text-decoration: none; padding: 5px 10px; border-radius: 999px; background: var(--accent-soft); }
.drawer-link:hover { background: var(--select); }
.progress-page { max-width: 760px; margin: 0 auto; padding: 0 0 48px; }
.progress-page .surah-meta { max-width: 520px; margin: 6px auto 0; line-height: 1.5; }
.pg-stats { max-width: 640px; }
.pg-stats dd small { font-size: .75rem; font-weight: 600; color: var(--ink-3); }
.pg-overall { max-width: 640px; margin: 16px auto 0; }
.pg-overall-bar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.pg-overall-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.pg-overall p { margin: 6px 0 0; text-align: center; font-size: .82rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pg-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; margin: 22px 0 10px; font-size: .8rem; color: var(--ink-2); }
.pg-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pg-key { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.pg-key.done, .pg-tile.done { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pg-key.partial { background: linear-gradient(90deg, var(--accent) 50%, var(--accent-soft) 50%); }
.pg-key.todo { background: var(--surface); border: 1px solid var(--line-strong); }
.pg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.pg-tile { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3); font-size: .8rem; font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; overflow: hidden; }
.pg-tile.partial { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.pg-tile.partial::before { content: ""; position: absolute; left: 0; bottom: 0; height: 5px; width: var(--fill); background: var(--accent); }
.pg-tile span { position: relative; }
.pg-tile:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.pg-h { font-size: 1rem; margin: 28px 0 8px; }
.pg-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.pg-list li + li { border-top: 1px solid var(--line); }
.pg-list a { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) 90px auto; align-items: center; gap: 12px; padding: 10px 14px; color: var(--ink); text-decoration: none; }
.pg-list a:hover { background: var(--hover); }
.pg-n { font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pg-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-name small { font-weight: 400; color: var(--ink-3); }
.pg-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.pg-bar span { display: block; height: 100%; background: var(--accent); }
.pg-state { font-size: .78rem; color: var(--ink-2); white-space: nowrap; }
.pg-state.done { color: var(--accent); font-weight: 600; }
.pg-note { margin: 18px 0 0; font-size: .8rem; color: var(--ink-3); text-align: center; }
@media (max-width: 560px) {
  .pg-list a { grid-template-columns: 2em minmax(0, 1fr) auto; }
  .pg-bar { display: none; }
}

/* ============ Home screen ============ */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 22px; }
.mod { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s, border-color .12s; }
.mod:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.mod:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mod-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.mod-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mod.soon .mod-icon { background: var(--surface-3); color: var(--ink-3); }
.mod.soon { background: var(--surface-2); }
.mod-title { font-weight: 650; font-size: 1.02rem; }
.mod-blurb { font-size: .84rem; line-height: 1.45; color: var(--ink-2); }
.mod-badge { display: inline-block; align-self: flex-start; font-size: .68rem; font-weight: 700; letter-spacing: .03em; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.mod .mod-badge { position: absolute; top: 14px; right: 14px; }
.mod-badge.soon { background: var(--surface-3); color: var(--ink-2); }
.mod-badge.hold { background: transparent; color: var(--ink-3); border: 1px dashed var(--line-strong); }
.mod-badge.partial { background: var(--gold-soft); color: var(--gold); }
.mod-badge.live { background: var(--accent-soft); color: var(--accent); }
.mod-features { list-style: none; margin: 22px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.mod-features li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; }
.mod-features li + li { border-top: 1px solid var(--line); }
.mod-features .mod-badge { flex: none; min-width: 5.6em; text-align: center; margin-top: 1px; }
.mod-features small { display: block; margin-top: 2px; color: var(--ink-3); font-size: .78rem; }
.eyebrow a { color: inherit; text-decoration: none; }

/* ============ Tab bar layout (Settings, Layout, Tab bar) ============ */
.tabbar { display: none; }
:root[data-layout="tabs"] .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
:root[data-layout="tabs"] .main { padding-bottom: 84px; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: .7rem; font-weight: 600; color: var(--ink-3); text-decoration: none; border-radius: 10px; }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current] { color: var(--accent); }
.tabbar a:hover { background: var(--hover); }

/* ============ Book view: plain Arabic, like a printed page ============ */
:root[data-view="book"] .surah-head > :not(.surah-plate),
:root[data-view="book"] .read-bar,
:root[data-view="book"] .pending-note,
:root[data-view="book"] .player { display: none; }
.book-basmala { text-align: center; font-family: var(--font-quran); font-size: calc(var(--ar-size) * 1.05); line-height: 2.2; margin: 6px 0 14px; color: var(--ink); }
.book-text { font-family: var(--font-quran); font-size: var(--ar-size); line-height: 2.6; text-align: justify; text-align-last: center; color: var(--ink); max-width: 640px; margin: 0 auto; padding: 22px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.book-verse.flash { background: var(--select); border-radius: 6px; }
.icon-btn.toggle[aria-pressed="true"] { color: var(--accent); }

/* ============ Restyle: deep-teal hero, shortcuts, root of the day, splash ============ */
.hero { margin-top: 8px; padding: 22px 18px 20px; border-radius: 22px; text-align: center; color: #eafff6; background: radial-gradient(120% 90% at 50% 0%, #17a08a 0%, #0b6a66 45%, #083f43 100%); box-shadow: var(--shadow-md); }
.hero-logo { display: block; width: min(300px, 80%); height: auto; margin: 0 auto; border-radius: 20px; background: #fff; }
.hero-tag { margin: 14px auto 0; max-width: 420px; font-size: .9rem; line-height: 1.5; color: #d3f3e8; }
.hero-search { display: flex; align-items: center; gap: 10px; max-width: 460px; margin: 16px auto 0; padding: 11px 16px; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #eafff6; text-decoration: none; font-size: .92rem; }
.hero-search:hover { background: rgba(255, 255, 255, .24); }
.hero-search svg, .quick-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.quick-row { display: flex; justify-content: center; gap: 18px; margin-top: 18px; flex-wrap: wrap; }
.quick { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; color: #eafff6; text-decoration: none; font-size: .74rem; font-weight: 600; }
.quick-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.quick:hover .quick-icon { background: rgba(255, 255, 255, .28); }
.daily { display: grid; gap: 2px; margin-top: 14px; padding: 16px 18px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--line); text-decoration: none; color: var(--ink); text-align: center; }
.daily:hover { border-color: var(--accent); }
.daily-label { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.daily-ar { font-family: var(--font-quran); font-size: 2rem; line-height: 1.5; }
.daily-tr { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.daily-core { font-size: .92rem; color: var(--ink-2); }
#splash { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: radial-gradient(60% 45% at 50% 50%, #f4fffb 0%, #7fd9c0 38%, #0b6a66 72%, #052f33 100%); transition: opacity .5s ease; }
#splash.done { opacity: 0; pointer-events: none; }
#splash img { width: min(300px, 72vw); height: auto; border-radius: 24px; background: #fff; box-shadow: var(--shadow-lg); }
@media (prefers-reduced-motion: reduce) { #splash { transition: none; } }
:root { --accent: #0c7a69; --accent-2: #096655; --accent-soft: #dff2ea; }

/* ============ Mockup look: teal header, cream page, two-button word panel, docked surah list ============ */
.topbar { background: linear-gradient(135deg, #17a08a 0%, #0b6a66 60%, #083f43 100%); border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
  color: #eafff6; --ink: #eafff6; --ink-2: #d9f5ec; --ink-3: #bfe8dc; --line: rgba(255, 255, 255, .26); --line-strong: rgba(255, 255, 255, .42);
  --hover: rgba(255, 255, 255, .16); --surface: rgba(255, 255, 255, .14); --accent: #ffffff; --accent-soft: rgba(255, 255, 255, .22); }
.topbar .surah-switch { box-shadow: none; }
.topbar-actions { margin-left: auto; }
.surah-switch { margin: 0 auto; }
.book-text { background: color-mix(in srgb, var(--gold-soft) 14%, var(--surface)); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.book-text .w { cursor: pointer; border-radius: 8px; padding: 0 2px; transition: background .15s, box-shadow .15s; }
.book-text .w:hover { background: var(--hover); }
.book-text .w.selected { background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft), 0 0 16px rgba(25, 185, 160, .55); }

.wp-secs { display: grid; gap: 10px; margin-top: 16px; }
.wp-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: .95rem; border: 1px solid var(--accent); color: var(--accent); background: var(--surface); }
.wp-sec > summary::-webkit-details-marker { display: none; }
.wp-sec > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; margin-top: -3px; }
.wp-sec[open] > summary::after { transform: rotate(225deg); margin-top: 3px; }
.wp-root > summary { background: var(--accent); color: var(--accent-ink); }
.wp-sec[open] > summary { margin-bottom: 12px; }

@media (min-width: 1100px) {
  #contents.drawer { transform: none; visibility: visible; top: var(--topbar-h); width: 270px; box-shadow: none; border-right: 1px solid var(--line); z-index: 20; transition: none; }
  #contents .drawer-head [data-close], #surahSwitch { display: none; }
  body { padding-left: 270px; }
  .topbar { margin-left: -270px; }
  body.panel-open .main { margin-left: max(16px, calc((100vw - 270px - var(--panel-w) - 860px) / 2)); }
}

/* ============ Home like the mockup: title, search field, two-column tiles ============ */
.home-title { margin: 6px 2px 10px; font-size: 1.6rem; letter-spacing: -.01em; }
.home-search { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); text-decoration: none; font-size: .92rem; }
.home-search:hover { background: var(--surface-2); outline: 1px solid var(--line-strong); }
.home-search svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mod-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (min-width: 760px) { .mod-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; } }
.mod.featured { border: 2px solid var(--accent); }
.mod .mod-badge { top: 12px; right: 12px; }
.mod.live .mod-icon, .mod.partial .mod-icon { background: var(--accent-soft); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: .7rem; font-weight: 600; color: var(--ink-3); background: none; border: 0; border-radius: 10px; cursor: pointer; }
.tabbar button:hover { background: var(--hover); }
@media (min-width: 1100px) {
  :root[data-layout="tabs"] .tabbar { display: none; }
  :root[data-layout="tabs"] .main { padding-bottom: 64px; }
}
@media (min-width: 1100px) {
  .topbar-inner { max-width: none; padding: 0 20px; }
}

/* ============ Jump box, bookmarks, library ============ */
.home-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--ink); }
.home-search input::placeholder { color: var(--ink-2); }
.home-search:focus-within { outline: 2px solid var(--accent); }
.home-hint { margin: 8px 6px 0; font-size: .84rem; color: var(--ink-2); }
.wp-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.bm-btn { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: .8rem; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.bm-btn:hover { border-color: var(--accent); color: var(--accent); }
.bm-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.verse-bm { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-left: auto; margin-right: 6px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3); cursor: pointer; }
.verse-bm svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.verse-bm:hover { color: var(--accent); border-color: var(--accent); }
.verse-bm[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.verse-bm[aria-pressed="true"] svg { fill: currentColor; }
.bm-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.bm-list li { display: flex; align-items: center; }
.bm-list li + li { border-top: 1px solid var(--line); }
.bm-list a { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 12px 14px; color: var(--ink); text-decoration: none; }
.bm-list a:hover { background: var(--hover); }
.bm-ref { font-weight: 600; font-size: .9rem; }
.bm-ar { font-family: var(--font-quran); font-size: 1.3rem; line-height: 1.8; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-remove { flex: none; width: 40px; height: 40px; margin-right: 6px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-3); font-size: 1.4rem; cursor: pointer; }
.bm-remove:hover { background: var(--hover); color: var(--ink); }

/* ============ Per-letter tajweed explanations ============ */
.tj-item { grid-template-columns: 44px 1fr; align-items: start; }
.tj-glyph { display: grid; place-items: center; min-height: 44px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-family: var(--font-quran); font-size: 1.6rem; line-height: 1.6; padding-top: 4px; }
.tj-why { font-size: .88rem; color: var(--ink); margin: 3px 0 0; line-height: 1.5; }
.tj-sum b { font-weight: 650; color: var(--ink-2); }
.tj-draft { margin: 10px 2px 0; font-size: .76rem; color: var(--ink-3); }

/* ============ Tajweed guide, simplified: start here, color key, collapsed groups ============ */
.g-start { background: var(--accent-soft); border-radius: var(--radius); padding: 14px 16px; margin-top: 8px; }
.g-start h3, .g-h { margin: 0 0 6px; font-size: 1.05rem; }
.g-h { margin: 24px 0 10px; }
.g-start .guide-intro { margin: 0 0 8px; font-size: 1rem; }
.g-steps { margin: 0; padding-left: 20px; font-size: .92rem; line-height: 1.6; color: var(--ink-2); }
.g-glance { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.g-chip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; color: var(--ink); }
.g-chip:hover { border-color: var(--accent); }
.g-chip .swatch { width: 14px; height: 14px; border-radius: 5px; flex: none; }
.g-chip b { display: block; font-size: .88rem; font-weight: 650; }
.g-chip small { color: var(--ink-3); font-size: .78rem; }
details.g-group { margin: 0 0 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; scroll-margin-top: 80px; }
details.g-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
details.g-group > summary::-webkit-details-marker { display: none; }
details.g-group > summary .swatch { width: 16px; height: 16px; border-radius: 5px; flex: none; }
.g-gtext { flex: 1; min-width: 0; }
.g-gtext b { display: block; font-size: .98rem; }
.g-gtext small { color: var(--ink-3); font-size: .8rem; }
.g-count { font-size: .75rem; font-weight: 700; color: var(--ink-3); background: var(--surface-3); border-radius: 999px; padding: 2px 9px; }
details.g-group > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); transition: transform .15s; }
details.g-group[open] > summary::after { transform: rotate(225deg); }
.g-rules { border-top: 1px solid var(--line); }
details.g-rule { margin: 0; border: 0; border-radius: 0; padding: 0; background: none; }
details.g-rule + details.g-rule { border-top: 1px solid var(--line); }
details.g-rule > summary { list-style: none; cursor: pointer; display: grid; gap: 2px; padding: 11px 14px; }
details.g-rule > summary::-webkit-details-marker { display: none; }
details.g-rule > summary:hover { background: var(--hover); }
.g-rname { font-weight: 650; font-size: .93rem; }
.g-rname .g-ar { font-family: var(--font-ar); font-weight: 400; color: var(--ink-3); margin-left: 6px; font-size: 1.05rem; }
details.g-rule .g-sum { margin: 0; font-weight: 400; font-size: .85rem; color: var(--ink-2); }
.g-body { padding: 0 14px 14px; }
.g-body .g-tr { margin: 0 0 4px; font: italic 400 .85rem var(--font-read); color: var(--ink-3); }
details.g-rule.flash { box-shadow: inset 0 0 0 2px var(--accent); }
.g-foot { margin: 22px 2px 0; font-size: .78rem; line-height: 1.55; color: var(--ink-3); }

/* ---------- Search results ---------- */
.sr-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 4px; font-size: .84rem; color: var(--ink-2); }
.sr-modes a { padding: 5px 14px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); text-decoration: none; font-weight: 600; }
.sr-modes a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sr-modes span { flex-basis: 100%; }
@media (min-width: 640px) { .sr-modes span { flex-basis: auto; margin-left: 6px; } }
.sr-group, .sr-empty { margin-top: 18px; }
.sr-count { font-size: .75rem; font-weight: 600; color: var(--ink-3); margin-left: 6px; }
.sr-note { margin: 0 0 10px; font-size: .84rem; color: var(--ink-2); }
.sr-scope { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--gold-soft); color: var(--ink); }
.sr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sr-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.sr-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.sr-ref { font-weight: 700; color: var(--accent); text-decoration: none; font-size: .9rem; }
.sr-kind { margin-left: auto; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.sr-kind.normalized { background: var(--gold-soft); color: var(--gold); }
.sr-kind.translation, .sr-kind.root { background: var(--surface-3); color: var(--ink-2); }
.sr-ar { display: block; font-family: var(--font-quran); font-size: 1.45rem; line-height: 2.1; color: var(--ink); text-decoration: none; }
.sr-ar mark, .sr-tr mark { background: var(--select); color: inherit; border-radius: 6px; padding: 0 .1em; box-shadow: inset 0 -2px 0 var(--accent); }
.sr-root { font-family: var(--font-quran); font-size: 1.5rem; color: var(--accent); }
.sr-core { margin: 0 0 4px; font-weight: 600; }
.sr-why { margin: 0 0 6px; font-size: .84rem; color: var(--ink-2); }
.sr-tr { margin: 0 0 4px; line-height: 1.5; }
.sr-tr small { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-right: 4px; }
.occ-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sr-more { margin: 12px auto 0; display: block; padding: 9px 20px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.sr-more:hover { background: var(--hover); }

/* ---------- Prayer times (#/prayer) ---------- */
.prayer-page { max-width: 560px; }
.pt-dim { color: var(--ink-3); font-size: .85em; }
.pt-nav { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
.pt-nav > button { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.pt-nav > button:hover { border-color: var(--accent); color: var(--accent); }
.pt-date { flex: 1; display: grid; justify-items: center; gap: 2px; text-align: center; font-size: .95rem; }
.pt-date span { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.pt-link { border: 0; background: none; padding: 2px 6px; color: var(--accent); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; text-decoration: underline; }
.pt-hero { display: grid; justify-items: center; gap: 2px; padding: 18px; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); text-align: center; }
.pt-hero .daily-label { color: inherit; opacity: .85; }
.pt-hero-name { font-size: 1.5rem; font-weight: 700; }
.pt-hero-name small { font-size: .9rem; font-weight: 500; opacity: .9; margin-left: 4px; }
.pt-count { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.pt-hero-sub { font-size: .78rem; opacity: .85; }
.pt-sun { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 12px 0; padding: 14px 16px; border-radius: var(--radius); background: var(--gold-soft); border: 1px solid var(--line); text-align: center; }
.pt-sun strong { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.pt-sun-l { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.pt-sun-mid { font-size: .78rem; color: var(--ink-3); }
.pt-sun-mid span { display: block; }
.pt-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.pt-list li { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; }
.pt-list li + li { border-top: 1px solid var(--line); }
.pt-list li.next { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); font-weight: 700; }
.pt-n small { display: block; font-size: .72rem; font-weight: 400; color: var(--ink-3); }
.pt-t { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.pt-using, .pt-tz, .pt-note, .pt-warn, .pt-help, .pt-msg { font-size: .82rem; line-height: 1.5; color: var(--ink-2); }
.pt-using { margin: 10px 0 0; font-weight: 600; text-align: center; }
.pt-tz { margin: 6px 0 0; text-align: center; color: var(--ink-3); }
.pt-tz b { color: var(--gold); }
.pt-note { margin: 16px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-3, var(--surface)); border: 1px solid var(--line); }
.pt-warn { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--gold-soft); border: 1px solid var(--line); }
.pt-empty { margin: 14px 0; padding: 18px; text-align: center; border-radius: var(--radius); background: var(--accent-soft); color: var(--ink-2); }
.pt-empty p { margin: 0; }
.pt-settings { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 0 14px 14px; }
.pt-settings summary { padding: 14px 0; font-weight: 700; cursor: pointer; }
.pt-grid { display: grid; gap: 10px; }
.pt-settings label { display: grid; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.pt-settings label small { font-weight: 400; color: var(--ink-3); }
.pt-settings select, .pt-settings input[type="text"] { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); font: inherit; font-size: 1rem; }
.pt-box { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pt-form { display: grid; gap: 10px; }
.pt-btn { min-height: 44px; padding: 8px 16px; border: 0; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; cursor: pointer; }
.pt-btn:disabled { opacity: .6; cursor: progress; }
.pt-help { margin: 8px 0 0; color: var(--ink-3); }
.pt-help a { color: var(--accent); }
.pt-msg { margin: 8px 0 0; font-weight: 600; color: var(--ink); }
.pt-results { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.pt-results li + li { border-top: 1px solid var(--line); }
.pt-results button { display: grid; gap: 2px; width: 100%; padding: 10px 12px; border: 0; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.pt-results button:hover { background: var(--hover); }
.pt-results small { color: var(--ink-3); }
@media (min-width: 760px) { .pt-grid { grid-template-columns: 1fr 1fr 1fr; } .prayer-page { max-width: 620px; } }
.surah-switch[hidden] { display: none; }

/* ============ Guide: Arabic names lead each tile; madd gathered as one family ============ */
.g-ar-name { display: block; font-family: var(--font-ar); font-weight: 700; font-size: 1.25rem; line-height: 1.6; text-align: left; color: var(--ink); }
.g-trl { display: block; font-size: .8rem; font-weight: 600; color: var(--accent); }
.g-chip-text { min-width: 0; }
.g-chip-text small { display: block; margin-top: 1px; }
.g-chip .g-ar-name { font-size: 1.15rem; line-height: 1.5; }
.g-gtext .g-ar-name { font-size: 1.2rem; }
.g-rname .g-ar-name { font-size: 1.2rem; line-height: 1.5; }
.g-rname .g-trl { color: var(--ink-3); font-weight: 500; }
.g-family { margin: 0 0 10px; padding: 12px 12px 4px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.g-family-head { margin: 0 0 2px; display: flex; align-items: baseline; gap: 10px; font-size: 1rem; }
.g-family-head [lang="ar"] { font-family: var(--font-ar); font-size: 1.5rem; color: var(--accent); }
.g-family-note { margin: 0 0 10px; font-size: .85rem; line-height: 1.5; color: var(--ink-2); }
.g-family details.g-group { background: var(--surface); }

/* Settings: tajweed color switches use the same Arabic-first names as the guide */
.set-name { display: block; min-width: 0; }
.set-name .g-ar-name { font-size: 1.1rem; line-height: 1.5; }
.set-name small { display: block; color: var(--ink-3); font-size: .78rem; line-height: 1.35; }

/* ---- Notes, copy verse, juz marks, toast, status chip ---- */
.verse-share { margin-left: auto; }
.verse-share + .verse-bm { margin-left: 0; }
.juz-mark, .note-mark { margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: .7rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.note-mark { background: var(--gold-soft); color: var(--gold); }
.note-text { color: var(--ink-2); font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.status-chip.draft { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.wp-notes { margin-top: 10px; }
.note-label { display: block; margin: 8px 0; font-size: .78rem; font-weight: 600; color: var(--ink-3); }
.note-box { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; box-sizing: border-box; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; font-weight: 400; resize: vertical; }
.note-box:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 12px); padding: 8px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: .85rem; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 80; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.juz-link { text-align: left; }

/* ============ Home banner: Najmul Quran (full width, teal; variants: teal, white, mist) ============ */
:root { --side: 0px; }
@media (min-width: 1100px) { :root { --side: 270px; } }
body { overflow-x: clip; }
.nur-banner { --nb-bg: linear-gradient(135deg, #17a08a 0%, #0b6a66 60%, #083f43 100%); --nb-title: #fff3c4; --nb-verse: #ffffff; --nb-tr: #eafff6; --nb-ref: #b8ece0; --nb-rule: rgba(255, 255, 255, .35); --nb-tag: #d3f3e8; --nb-glow: rgba(255, 243, 196, .5);
  display: grid; justify-items: center; gap: 6px; box-sizing: border-box; width: calc(100vw - var(--side)); margin: -24px 0 18px calc(50% - (100vw - var(--side)) / 2); padding: 26px 20px 22px; border-radius: 0 0 26px 26px; text-align: center; text-decoration: none; color: var(--nb-tr); background: var(--nb-bg); box-shadow: var(--shadow-md); }
.nur-banner.nur-white { --nb-bg: #ffffff; --nb-title: #0b6a66; --nb-verse: #0a5a52; --nb-tr: #24323a; --nb-ref: #3d8f84; --nb-rule: rgba(14, 107, 92, .3); --nb-tag: #3d6f68; --nb-glow: rgba(14, 107, 92, .18); border-bottom: 1px solid var(--line); }
.nur-banner.nur-mist { --nb-bg: linear-gradient(180deg, #e3f5ee 0%, #cfeee3 100%); --nb-title: #0a5a52; --nb-verse: #08403f; --nb-tr: #14403e; --nb-ref: #2f7f73; --nb-rule: rgba(8, 64, 63, .25); --nb-tag: #2c6a62; --nb-glow: rgba(255, 255, 255, .8); }
.nur-title { font-family: var(--font-quran); font-size: 2.1rem; line-height: 1.6; color: var(--nb-title); text-shadow: 0 0 18px var(--nb-glow); }
.nur-verse { font-family: var(--font-quran); font-size: clamp(1.1rem, 4.6vw, 2.2rem); line-height: 2.1; color: var(--nb-verse); text-wrap: balance; }
.nur-tr { max-width: 560px; font-family: "Literata", Georgia, serif; font-size: clamp(.95rem, 3.6vw, 1.15rem); line-height: 1.5; color: var(--nb-tr); }
.nur-ref { font-size: .75rem; color: var(--nb-ref); }
.nur-rule { width: 100%; max-width: 560px; height: 1px; margin: 8px 0 2px; background: var(--nb-rule); }
.nur-tag { max-width: 480px; font-size: .84rem; line-height: 1.5; color: var(--nb-tag); }

/* Banner in dark mode: deep green with gold text (all variants) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nur-banner { --nb-bg: radial-gradient(120% 100% at 85% 0%, #14463f 0%, #0a2b29 55%, #071d1d 100%); --nb-title: #f3d98a; --nb-verse: #f6e3a1; --nb-tr: #f5f1e3; --nb-ref: #b9c9c2; --nb-rule: rgba(214, 190, 120, .55); --nb-tag: #d9e6df; --nb-glow: rgba(243, 217, 138, .55); border-bottom: 0; }
}
:root[data-theme="dark"] .nur-banner { --nb-bg: radial-gradient(120% 100% at 85% 0%, #14463f 0%, #0a2b29 55%, #071d1d 100%); --nb-title: #f3d98a; --nb-verse: #f6e3a1; --nb-tr: #f5f1e3; --nb-ref: #b9c9c2; --nb-rule: rgba(214, 190, 120, .55); --nb-tag: #d9e6df; --nb-glow: rgba(243, 217, 138, .55); border-bottom: 0; }

/* Root notes with Arabic script (js/notes-ar.js): Arabic first, transliteration muted after it */
.vnotes p .ar-inline { font-size: 1.3em; color: var(--ink); white-space: nowrap; }
.vnotes p .tl { color: var(--ink-3, var(--ink-2)); font-size: .88em; }

/* Pashto translation (test, surah 1 only) */
.tr-row.pashto .tr-label { color: var(--accent); }
.tr-row.pashto .tr-text { font-family: var(--font-ar, 'Amiri', serif); font-size: 1.25rem; line-height: 2; text-align: right; }
/* In Pashto notes the Latin transliteration after an Arabic term is hidden: Arabic only */
[lang="ps"] .tl { display: none; }

/* Right-to-left interface languages (Pashto): off-canvas parts parked to the left would otherwise make the page scroll sideways */
html[dir="rtl"] { overflow-x: clip; }

/* Home screen "Dock": search, verse of the moment, six main tiles, then a "More" row */
.dock-top { margin-top: 4px; }
.dock-grid { grid-template-columns: repeat(2, 1fr); margin-top: 14px; }
@media (min-width: 760px) { .dock-grid { grid-template-columns: repeat(3, 1fr); } }
.dock-grid .mod { align-items: center; text-align: center; padding: 14px 10px 16px; }
.dock-grid .mod-badge { position: static; align-self: center; margin-top: 2px; }
.dock-grid .mod-blurb { display: none; }
.dock-grid .mod.featured .mod-blurb { display: block; }
.dock-more-title { margin: 20px 2px 8px; font-size: 1rem; color: var(--ink-2); }
.dock-more { display: flex; flex-wrap: wrap; gap: 8px; }
.dock-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: .88rem; }
.dock-chip small { font-size: .7rem; color: var(--ink-3); }
.dock-chip:hover { border-color: var(--accent); }
.dock-chip.soon { background: var(--surface-2); color: var(--ink-2); }

/* Home hero, big tiles and guidance banner (matches the 2026 home mockup) */
.nur-hero { position: relative; display: block; min-height: 250px; padding: 18px 18px 20px; border-radius: 22px; overflow: hidden; color: #fff; text-decoration: none; background: linear-gradient(135deg, #14a094 0%, #0b6a72 55%, #0a4a55 100%); box-shadow: var(--shadow-md); }
.nur-hero-brand { display: block; font-size: 1.7rem; font-weight: 700; letter-spacing: -.01em; }
.nur-hero-brand [lang="ar"] { font-family: var(--font-quran); font-weight: 400; margin-inline-start: 8px; color: #fff3c4; }
.nur-hero-tag { display: block; font-size: .85rem; opacity: .9; }
@media (min-width: 760px) { .nur-hero { min-height: 280px; padding: 24px 28px; } }

.dock-top { margin-top: 14px; }
.dock-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
@media (min-width: 760px) { .dock-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
.dock-grid .mod { align-items: center; text-align: center; gap: 4px; padding: 16px 12px 14px; min-height: 170px; border-radius: 22px; }
.dock-grid .mod .mod-icon { width: 56px; height: 56px; border-radius: 18px; background: transparent; margin-bottom: 2px; }
.dock-grid .mod .mod-icon svg { width: 40px; height: 40px; stroke-width: 1.5; }
.dock-grid .mod-title { font-size: 1.12rem; }
.dock-grid .mod-sub { font-size: .82rem; line-height: 1.35; }
.dock-grid .mod-badge { position: static; align-self: center; }
.dock-grid .mod-go { margin-top: auto; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; }
.dock-grid .mod-go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dock-grid .mod.tone-teal { background: linear-gradient(160deg, #14a094, #0b6a72); border-color: transparent; color: #fff; }
.dock-grid .mod.tone-teal .mod-icon { color: #f3dfa0; }
.dock-grid .mod.tone-teal .mod-sub { color: rgba(255, 255, 255, .92); }
.dock-grid .mod.tone-teal .mod-go { background: rgba(255, 255, 255, .25); }
.dock-grid .mod.tone-teal .mod-badge { background: rgba(255, 255, 255, .22); color: #fff; }
.dock-grid .mod.tone-cream { background: linear-gradient(160deg, #fffaf0, #f3e9d3); color: #1c2326; }
.dock-grid .mod.tone-cream .mod-icon { color: #0b6a72; }
.dock-grid .mod.tone-cream .mod-sub { color: #48535a; }
.dock-grid .mod.tone-cream .mod-go { background: #e9dec4; color: #0b6a72; }
:root[data-theme="dark"] .dock-grid .mod.tone-cream { background: var(--surface-2); color: var(--ink); }
:root[data-theme="dark"] .dock-grid .mod.tone-cream .mod-sub { color: var(--ink-2); }
:root[data-theme="dark"] .dock-grid .mod.tone-cream .mod-icon { color: var(--accent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dock-grid .mod.tone-cream { background: var(--surface-2); color: var(--ink); }
  :root:not([data-theme="light"]) .dock-grid .mod.tone-cream .mod-sub { color: var(--ink-2); }
  :root:not([data-theme="light"]) .dock-grid .mod.tone-cream .mod-icon { color: var(--accent); }
}

.dock-guide { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 14px 16px; border-radius: 20px; text-decoration: none; color: #0b4f55; background: linear-gradient(100deg, #d7f0ee, #f6efd8); border: 1px solid var(--line); }
.dock-guide-body { display: grid; gap: 2px; min-width: 0; }
.dock-guide-label { font-weight: 700; color: #0b6a72; }
.dock-guide-tr { font-style: italic; font-size: .92rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dock-guide-ref { font-size: .78rem; opacity: .8; }
.dock-guide-go { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .7); font-weight: 600; font-size: .88rem; }
.dock-guide-go svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="dark"] .dock-grid .mod.tone-cream .mod-go { background: rgba(255, 255, 255, .12); color: var(--accent); }
:root[data-theme="dark"] .dock-guide { background: linear-gradient(100deg, #12302d, #2a2618); color: var(--ink); }
:root[data-theme="dark"] .dock-guide-label { color: var(--accent); }
:root[data-theme="dark"] .dock-guide-go { background: rgba(255, 255, 255, .12); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dock-grid .mod.tone-cream .mod-go { background: rgba(255, 255, 255, .12); color: var(--accent); }
  :root:not([data-theme="light"]) .dock-guide { background: linear-gradient(100deg, #12302d, #2a2618); color: var(--ink); }
  :root:not([data-theme="light"]) .dock-guide-label { color: var(--accent); }
  :root:not([data-theme="light"]) .dock-guide-go { background: rgba(255, 255, 255, .12); }
}

/* Illustrated hero and tile art */
.nur-hero { background: #12998f url('../assets/home/hero.webp') 72% center / cover no-repeat; min-height: 190px; padding-bottom: 24px; }
.mod-art { width: 96px; height: auto; margin: -4px 0 -2px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .18)); }
@media (min-width: 760px) { .nur-hero { min-height: 230px; background-position: 70% 40%; } }

/* Today's guidance banner: sapling on dunes */
.dock-guide { position: relative; overflow: hidden; min-height: 112px; background: linear-gradient(100deg, #d4efec 0%, #e4f2ee 45%, #f3ecd3 100%); }
.dock-guide::after { content: ''; position: absolute; inset: 0 0 0 auto; width: 58%; background: url('../assets/home/guidance.svg') right bottom / cover no-repeat; pointer-events: none; }
.dock-guide-body, .dock-guide-go { position: relative; z-index: 1; }
.dock-guide-body { max-width: 56%; }
.dock-guide-label { display: flex; align-items: center; gap: 6px; font-size: 1.05rem; }
.dock-guide-label svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.dock-guide-quote { display: grid; gap: 2px; margin-top: 4px; padding-inline-start: 10px; border-inline-start: 2px solid #0b6a72; }
.dock-guide-tr { font-size: .84rem; line-height: 1.35; -webkit-line-clamp: 3; }
.dock-guide-go { background: rgba(255, 255, 255, .88); box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .dock-guide::after { opacity: .55; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dock-guide::after { opacity: .55; } }

.dock-guide::after { width: 52%; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 42%); mask-image: linear-gradient(90deg, transparent 0, #000 42%); }
.dock-guide-body { max-width: 62%; }
.dock-guide-tr { font-size: .8rem; -webkit-line-clamp: 4; }

.dock-guide::after { width: 56%; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22%); mask-image: linear-gradient(90deg, transparent 0, #000 22%); }

.dock-guide::after { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16%); mask-image: linear-gradient(90deg, transparent 0, #000 16%); }
@media (max-width: 479px) {
  .dock-guide-go { padding: 0; width: 38px; height: 38px; justify-content: center; }
  .dock-guide-go-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .dock-guide-body { max-width: 66%; }
}
@media (min-width: 480px) {
  .dock-guide::after { width: auto; height: 100%; aspect-ratio: 2 / 1; background-size: 100% 100%; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 30%); mask-image: linear-gradient(90deg, transparent 0, #000 30%); }
  .dock-guide-body { max-width: 58%; }
}
@media (min-width: 480px) {
  .dock-guide { min-height: 132px; }
  .dock-guide::after { background-image: url('../assets/home/guidance-wide.svg'); }
}

/* Gradient plate behind each tile illustration */
.mod-art-wrap { display: grid; place-items: center; width: 112px; height: 112px; border-radius: 50%; margin-bottom: 2px; }
.mod-art-wrap .mod-art { width: 88px; margin: 0; }
.dock-grid .mod.tone-teal .mod-art-wrap { background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, .34), rgba(243, 223, 160, .14) 55%, rgba(255, 255, 255, 0) 75%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.dock-grid .mod.tone-cream .mod-art-wrap { background: radial-gradient(circle at 50% 35%, rgba(20, 160, 148, .26), rgba(229, 190, 92, .2) 60%, rgba(229, 190, 92, 0) 78%); box-shadow: inset 0 0 0 1px rgba(14, 107, 92, .1); }
:root[data-theme="dark"] .dock-grid .mod.tone-cream .mod-art-wrap { background: radial-gradient(circle at 50% 35%, rgba(79, 196, 168, .3), rgba(216, 180, 95, .16) 60%, rgba(216, 180, 95, 0) 78%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dock-grid .mod.tone-cream .mod-art-wrap { background: radial-gradient(circle at 50% 35%, rgba(79, 196, 168, .3), rgba(216, 180, 95, .16) 60%, rgba(216, 180, 95, 0) 78%); } }


/* Root of the day: a compact bar under the hero */
.rootbar { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 9px 14px; border-radius: 18px; text-decoration: none; color: var(--ink); background: linear-gradient(100deg, var(--accent-soft), var(--surface)); border: 1px solid var(--line); }
.rootbar:hover { border-color: var(--accent); }
.rootbar-ar { flex: none; font-family: var(--font-quran); font-size: 1.7rem; line-height: 1.4; color: var(--accent); min-width: 4.2rem; text-align: center; }
.rootbar-txt { display: grid; gap: 1px; min-width: 0; flex: 1; }
.rootbar-label { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.rootbar-line { font-size: .84rem; line-height: 1.35; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rootbar-line b { color: var(--ink); font-weight: 650; }
.rootbar-go { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nur-hero { background: linear-gradient(90deg, rgba(10, 106, 112, .8) 0%, rgba(10, 106, 112, .45) 38%, rgba(10, 106, 112, 0) 62%), #12998f url('../assets/home/hero.webp') 80% center / cover no-repeat; }
.nur-hero-brand, .nur-hero-tag { text-shadow: 0 1px 6px rgba(0, 60, 66, .45); }

/* Smaller home tiles on phones */
@media (max-width: 759px) {
  .dock-grid { gap: 10px; margin-top: 12px; }
  .dock-grid .mod { min-height: 128px; padding: 10px 8px 10px; gap: 2px; border-radius: 18px; }
  .mod-art-wrap { width: 76px; height: 76px; margin-bottom: 0; }
  .mod-art-wrap .mod-art { width: 60px; }
  .dock-grid .mod-title { font-size: .98rem; }
  .dock-grid .mod-sub { font-size: .74rem; line-height: 1.25; }
  .dock-grid .mod-badge { font-size: .62rem; padding: 1px 7px; }
  .dock-grid .mod-go { width: 26px; height: 26px; }
  .dock-grid .mod-go svg { width: 15px; height: 15px; }
}

/* Lighter turquoise for the teal tiles and the hero */
.dock-grid .mod.tone-teal { background: linear-gradient(160deg, #3cc7b7 0%, #1a9f98 100%); }
.dock-grid .mod.tone-teal .mod-title { text-shadow: 0 1px 4px rgba(0, 70, 74, .25); }
.dock-grid .mod.tone-teal .mod-sub { color: #fff; text-shadow: 0 1px 4px rgba(0, 70, 74, .3); }
.nur-hero { background: linear-gradient(90deg, rgba(40, 180, 168, .85) 0%, rgba(40, 180, 168, .5) 38%, rgba(40, 180, 168, 0) 62%), #2bb5a8 url('../assets/home/hero.webp') 80% center / cover no-repeat; }

/* Dark mode: deeper, calmer teal (the bright turquoise is for the light theme only) */
:root[data-theme="dark"] .dock-grid .mod.tone-teal { background: linear-gradient(160deg, #177d76 0%, #0c4f55 100%); }
:root[data-theme="dark"] .nur-hero { background: linear-gradient(90deg, rgba(8, 70, 76, .88) 0%, rgba(8, 70, 76, .5) 38%, rgba(8, 70, 76, 0) 62%), linear-gradient(rgba(6, 22, 26, .28), rgba(6, 22, 26, .28)), #0d5a5e url('../assets/home/hero.webp') 80% center / cover no-repeat; }
:root[data-theme="dark"] .dock-grid .mod.tone-teal .mod-title, :root[data-theme="dark"] .dock-grid .mod.tone-teal .mod-sub { text-shadow: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dock-grid .mod.tone-teal { background: linear-gradient(160deg, #177d76 0%, #0c4f55 100%); }
  :root:not([data-theme="light"]) .nur-hero { background: linear-gradient(90deg, rgba(8, 70, 76, .88) 0%, rgba(8, 70, 76, .5) 38%, rgba(8, 70, 76, 0) 62%), linear-gradient(rgba(6, 22, 26, .28), rgba(6, 22, 26, .28)), #0d5a5e url('../assets/home/hero.webp') 80% center / cover no-repeat; }
  :root:not([data-theme="light"]) .dock-grid .mod.tone-teal .mod-title, :root:not([data-theme="light"]) .dock-grid .mod.tone-teal .mod-sub { text-shadow: none; }
}

/* Surah title plate and stat cards in the turquoise gradient (deeper teal in dark mode) */
.surah-plate { background: linear-gradient(160deg, #3cc7b7 0%, #1a9f98 100%) padding-box, linear-gradient(135deg, var(--gold), color-mix(in srgb, var(--gold) 30%, transparent) 40%, var(--gold)) border-box; }
.surah-plate-ar { color: #fff; text-shadow: 0 1px 6px rgba(0, 70, 74, .3); }
.stat { background: linear-gradient(160deg, #3cc7b7 0%, #1a9f98 100%); border-color: transparent; }
.stat dd { color: #fff; text-shadow: 0 1px 4px rgba(0, 70, 74, .25); }
.stat dt { color: rgba(255, 255, 255, .92); }
:root[data-theme="dark"] .surah-plate { background: linear-gradient(160deg, #177d76 0%, #0c4f55 100%) padding-box, linear-gradient(135deg, var(--gold), color-mix(in srgb, var(--gold) 30%, transparent) 40%, var(--gold)) border-box; }
:root[data-theme="dark"] .stat { background: linear-gradient(160deg, #177d76 0%, #0c4f55 100%); }
:root[data-theme="dark"] .surah-plate-ar, :root[data-theme="dark"] .stat dd { text-shadow: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .surah-plate { background: linear-gradient(160deg, #177d76 0%, #0c4f55 100%) padding-box, linear-gradient(135deg, var(--gold), color-mix(in srgb, var(--gold) 30%, transparent) 40%, var(--gold)) border-box; }
  :root:not([data-theme="light"]) .stat { background: linear-gradient(160deg, #177d76 0%, #0c4f55 100%); }
  :root:not([data-theme="light"]) .surah-plate-ar, :root:not([data-theme="light"]) .stat dd { text-shadow: none; }
}

/* Top bar: surah name on the left, the Najmul Quran logo centred, actions on the right */
.topbar-inner { position: relative; }
.brand { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; z-index: 1; }
.surah-switch { order: -1; margin: 0 auto 0 0; max-width: calc(50% - 24px); }
#surahSwitchLabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; }
@media (max-width: 560px) {
  .topbar-actions { gap: 0; }
  .topbar-actions .icon-btn { width: 34px; height: 36px; }
  .topbar-actions .icon-btn svg { width: 20px; height: 20px; }
}

/* Bigger centred logo; with the docked surah list the centre is the page column, not the whole window */
.brand { gap: 12px; }
.brand img { width: 40px; height: 40px; border-radius: 11px; }
.brand-name { font-size: 1.3rem; }
.surah-switch { max-width: calc(50% - 36px); }
@media (min-width: 1100px) {
  .brand { left: calc(50% + 135px); }
}
@media (max-width: 360px) {
  .topbar-actions .icon-btn { width: 30px; }
  .topbar-inner { padding: 0 8px; }
}

/* Reader bar: teal buttons, language dropdown, individual tajweed pills */
.seg button { color: var(--accent); }
.seg button:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.lang-select {
  font: inherit; font-size: .85rem; font-weight: 600; color: var(--accent);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 10px; cursor: pointer;
}
.lang-select:hover { border-color: var(--accent); }
.legend { gap: 6px; flex: 1 1 100%; padding: 0; }
.legend-item {
  gap: 7px; padding: 5px 12px; font-size: .8rem; font-weight: 600; color: var(--accent);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
}
.legend-item:hover { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
@media (max-width: 560px) {
  .read-bar .lang-select { width: 100%; }
}
.legend-item .legend-en { font-size: .74rem; font-weight: 500; color: var(--ink-3); }
.legend-item .legend-en::before { content: "· "; }

/* Reader bar buttons: filled teal like the stat cards */
.seg { background: transparent; padding: 0; gap: 6px; }
.seg button, .legend-item, .lang-select {
  background: linear-gradient(160deg, #3cc7b7 0%, #1a9f98 100%);
  color: #fff; border: 1px solid transparent;
  text-shadow: 0 1px 3px rgba(0, 70, 74, .25);
}
.seg button { padding: 7px 14px; border-radius: 10px; opacity: .72; }
.seg button:hover, .legend-item:hover, .lang-select:hover { color: #fff; border-color: transparent; filter: brightness(1.06); opacity: 1; }
.seg button[aria-pressed="true"] { color: #fff; opacity: 1; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #1a9f98; background: linear-gradient(160deg, #3cc7b7 0%, #1a9f98 100%); }
.legend-item .legend-en, .legend-item .legend-en::before { color: rgba(255, 255, 255, .9); }
.lang-select option { color: #12332f; background: #fff; text-shadow: none; }
:root[data-theme="dark"] .seg button, :root[data-theme="dark"] .legend-item, :root[data-theme="dark"] .lang-select,
:root[data-theme="dark"] .seg button[aria-pressed="true"] { background: linear-gradient(160deg, #177d76 0%, #0c4f55 100%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .seg button, :root:not([data-theme="light"]) .legend-item, :root:not([data-theme="light"]) .lang-select,
  :root:not([data-theme="light"]) .seg button[aria-pressed="true"] { background: linear-gradient(160deg, #177d76 0%, #0c4f55 100%); }
}

/* Solid green buttons (like the play button) and a separate tajweed section */
.seg button, .legend-item, .lang-select,
:root[data-theme="dark"] .seg button, :root[data-theme="dark"] .legend-item, :root[data-theme="dark"] .lang-select,
:root[data-theme="dark"] .seg button[aria-pressed="true"], .seg button[aria-pressed="true"] {
  background: var(--accent); color: var(--accent-ink); text-shadow: none;
}
.seg button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.legend-item .legend-en, .legend-item .legend-en::before { color: inherit; opacity: .85; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .seg button, :root:not([data-theme="light"]) .legend-item, :root:not([data-theme="light"]) .lang-select,
  :root:not([data-theme="light"]) .seg button[aria-pressed="true"] { background: var(--accent); }
}
.legend-section { flex: 1 1 100%; margin-top: 2px; padding: 10px; background: var(--surface-2); border-radius: 12px; }
.legend-title { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px 2px; }
.legend-section .legend { flex: none; }
.legend-item .swatch { box-shadow: 0 0 0 1.5px rgba(255,255,255,.85); }
#tjSection .legend-section { margin: 0 0 12px; border: 1px solid var(--line); }

/* Flat turquoise buttons; tajweed section as a tidy grid */
:root { --turq: #2bb3a7; --turq-hover: #22a094; }
:root[data-theme="dark"] { --turq: #1c8f87; --turq-hover: #22a096; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --turq: #1c8f87; --turq-hover: #22a096; } }
.seg button, .legend-item, .lang-select,
:root[data-theme="dark"] .seg button, :root[data-theme="dark"] .legend-item, :root[data-theme="dark"] .lang-select,
:root[data-theme="dark"] .seg button[aria-pressed="true"], .seg button[aria-pressed="true"] {
  background: var(--turq); background-image: none; color: #fff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .seg button, :root:not([data-theme="light"]) .legend-item, :root:not([data-theme="light"]) .lang-select,
  :root:not([data-theme="light"]) .seg button[aria-pressed="true"] { background: var(--turq); }
}
.seg button:hover, .legend-item:hover, .lang-select:hover { background: var(--turq-hover); filter: none; }
.seg button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--turq); }
.legend-section { padding: 14px 16px 16px; }
.legend-title { margin-bottom: 10px; }
.legend-section .legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.legend-section .legend-item {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 1px;
  align-items: center; text-align: left; padding: 9px 14px; border-radius: 12px; font-size: .85rem; font-weight: 700;
}
.legend-section .legend-item .swatch { grid-row: 1 / span 2; width: 14px; height: 14px; }
.legend-section .legend-item .legend-en { display: block; font-size: .74rem; font-weight: 500; opacity: .92; }
.legend-section .legend-item .legend-en::before { content: none; }

/* Tajweed cards: centred black title, clearer text */
.legend-title { text-align: center; color: #000; font-size: .85rem; font-weight: 800; letter-spacing: .14em; margin: 0 0 12px; }
:root[data-theme="dark"] .legend-title { color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .legend-title { color: #fff; } }
.legend-section .legend-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.legend-section .legend-item .swatch { width: 16px; height: 16px; border-radius: 5px; flex: none; }
.legend-text { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; text-align: left; }
.legend-ar { font-family: var(--font-ar); font-size: 1.25rem; font-weight: 700; line-height: 1.5; }
.legend-trl { font-size: .92rem; font-weight: 700; line-height: 1.3; }
.legend-section .legend-item .legend-en { font-size: .78rem; font-weight: 500; opacity: .95; line-height: 1.35; }
.legend-ar { line-height: 1.9; padding-top: 2px; } .legend-section .legend-item { overflow: visible; }

/* Tajweed cards stay visible on phones: two per row */
@media (max-width: 560px) {
  .legend-section { padding: 12px; }
  .legend-section .legend { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .legend-section .legend-item { padding: 8px 10px; gap: 8px; }
  .legend-trl { font-size: .86rem; }
  .legend-section .legend-item .legend-en { font-size: .72rem; }
}

/* ============ Najmul Quran: new banner hero and dark splash (last section wins) ============ */
#splash, :root[data-theme] #splash { background: #101c1d; }
#splash img { width: min(320px, 76vw); border-radius: 0; background: none; box-shadow: none; }
.brand img { background: #101c1d; }

/* Splash shows the wide banner; its edges fade into the splash colour */
#splash img, :root[data-theme] #splash img { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: max(100vw, 680px); max-width: none; -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 40%, transparent 100%); mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 40%, transparent 100%); }

/* Home hero: mosque background back, big logo top left */
.nur-hero { min-height: 174px; }
.nur-hero-logo { position: absolute; top: 12px; left: 12px; width: 150px; height: 150px; border-radius: 26px; box-shadow: 0 6px 20px rgba(0, 20, 24, .5); }
@media (min-width: 760px) { .nur-hero { min-height: 266px; } .nur-hero-logo { top: 18px; left: 18px; width: 230px; height: 230px; border-radius: 34px; } }

/* Top bar on the home screen: just "Home" (the hero below already has the logo) */
.brand-home { display: none; width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.is-home .brand img, body.is-home .brand-name { display: none; }
body.is-home .brand-home { display: block; }
