/* Sami' — سامع · design system
   Emerald & Gold: emerald #0E5A47, gold #C8A24A, ivory #FBF8F1.
   Type: Readex Pro (UI), Amiri Quran (ayahs), Amiri (surah names), Reem Kufi (wordmark only). */

:root {
  --emerald: #0E5A47;
  --emerald-deep: #0A4436;
  --emerald-ink: #083A2E;
  --emerald-tint: #E3EFE9;
  --gold: #C8A24A;
  --gold-deep: #9A7626;
  --gold-soft: #F3E7C4;
  --ivory: #FBF8F1;
  --paper: #FFFDF8;
  --rule: #E6DDC8;
  --rule-strong: #D4C7A8;
  --ink: #1B2A25;
  --muted: #5B6A64;
  --faint: #8A958F;
  --ruby: #A8323E;
  --ruby-soft: #F7E1E2;
  --amber: #8A6414;
  --amber-soft: #F6EBCB;
  --slate: #62716C;
  --ok: #1E7A4E;
  --focus: #C8A24A;
  --shadow-lift: 0 18px 40px -18px rgba(8, 58, 46, .45);
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;
  --ui: "Readex Pro", "Segoe UI", system-ui, sans-serif;
  --quran: "Amiri Quran", "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  --naskh: "Amiri", "Noto Naskh Arabic", serif;
  --kufi: "Reem Kufi", "Amiri", serif;
  --fs-xs: .78rem;
  --fs-s: .875rem;
  --fs-m: 1rem;
  --fs-l: 1.25rem;
  --fs-xl: 1.5625rem;
  --fs-xxl: 1.953rem;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --emerald: #3FA586;
  --emerald-deep: #2E8A6F;
  --emerald-ink: #0B1814;
  --emerald-tint: #15302A;
  --gold: #D9B865;
  --gold-deep: #E8CC85;
  --gold-soft: #3A3120;
  --ivory: #0B1814;
  --paper: #11221D;
  --rule: #22392F;
  --rule-strong: #2F4B40;
  --ink: #ECE6D6;
  --muted: #A4B2AB;
  --faint: #7E8C86;
  --ruby: #EF7C86;
  --ruby-soft: #3B1C20;
  --amber: #E3BF6A;
  --amber-soft: #3A2F16;
  --slate: #9AA8A2;
  --ok: #5BC48F;
  --shadow-lift: 0 18px 40px -18px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  font-size: var(--fs-m);
  line-height: 1.5;
  color: var(--ink);
  background: var(--ivory);
  min-height: 100vh;
  padding-bottom: 84px; /* bottom tab bar on phones */
}
@media (min-width: 860px) { body { padding-bottom: 0; } }
img, svg { display: block; }
a { color: var(--emerald); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
[dir="rtl"], .ar { font-family: var(--quran); }

/* ---------------------------------------------------------------- top band */
.band {
  position: relative;
  background: var(--emerald-ink);
  color: #F4EEDD;
  isolation: isolate;
}
.band::before { /* girih-style 8-point star lattice, very faint, only in this band */
  content: "";
  position: absolute; inset: 0; z-index: -1;
  opacity: .09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23C8A24A' stroke-width='1'%3E%3Cpath d='M28 6 34.4 21.6 50 28 34.4 34.4 28 50 21.6 34.4 6 28 21.6 21.6Z'/%3E%3Cpath d='M12.4 12.4H43.6V43.6H12.4Z'/%3E%3Cpath d='M0 0 12.4 12.4M56 0 43.6 12.4M0 56 12.4 43.6M56 56 43.6 43.6'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 56px 56px;
}
:root[data-theme="dark"] .band { background: #07120F; }
.topbar {
  max-width: 1120px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand .mark { width: 38px; height: 38px; }
.avatar-star { width: 46px; height: 46px; flex: none; }
svg.mark { max-width: 72px; max-height: 72px; }
.brand .word { display: flex; align-items: baseline; gap: 8px; line-height: 1; }
.brand .en { font-weight: 600; font-size: 1.2rem; letter-spacing: .01em; }
.brand .kufi { font-family: var(--kufi); font-weight: 600; font-size: 1.35rem; color: var(--gold); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-xs); color: #CFD9D3;
  padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, .06);
  max-width: 44vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.status-pill[data-state="ready"] .dot { background: #5BC48F; }
.status-pill[data-state="loading"] .dot { background: var(--gold); animation: blink 1.1s infinite; }
.status-pill[data-state="error"] .dot { background: #EF7C86; }
@keyframes blink { 50% { opacity: .25; } }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .12); background: transparent; color: #F4EEDD; cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, .08); }

/* desktop nav lives in the band; phones get the bottom tab bar */
.tabs { display: flex; gap: 2px; }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 10px;
  color: #CFD9D3; text-decoration: none; font-weight: 500; font-size: var(--fs-s);
}
.tabs a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.tabs a[aria-current="page"] { color: var(--emerald-ink); background: var(--gold); }
:root[data-theme="dark"] .tabs a[aria-current="page"] { color: #07120F; }
.tabs .icon { width: 18px; height: 18px; }
.desk-nav { max-width: 1120px; margin: 0 auto; padding: 0 16px 10px; display: none; }
@media (min-width: 860px) { .desk-nav { display: block; } }
.phone-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--paper); border-top: 1px solid var(--rule);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.phone-nav .tabs { justify-content: space-around; }
.phone-nav .tabs a { flex-direction: column; gap: 3px; padding: 6px 10px; color: var(--muted); font-size: .72rem; border-radius: 12px; }
.phone-nav .tabs a .icon { width: 22px; height: 22px; }
.phone-nav .tabs a[aria-current="page"] { background: var(--emerald-tint); color: var(--emerald); }
@media (min-width: 860px) { .phone-nav { display: none; } }

/* ---------------------------------------------------------------- page scaffolding */
main { max-width: 1120px; margin: 0 auto; padding: 22px 16px 40px; }
.page-head { margin: 4px 0 18px; max-width: 70ch; }
.page-head h1 { font-size: var(--fs-xxl); line-height: 1.15; margin: 0 0 6px; font-weight: 600; letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--muted); }
h2 { font-size: var(--fs-l); font-weight: 600; margin: 0 0 10px; }
h3 { font-size: var(--fs-m); font-weight: 600; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-s); }
.xs { font-size: var(--fs-xs); }

.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-l); padding: 18px; }
.panel + .panel, .stack > * + * { margin-top: 14px; }
.section { margin-top: 26px; }
.split { display: grid; gap: 18px; }
@media (min-width: 960px) { .split { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- buttons & fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 16px; border-radius: var(--r-m);
  border: 1px solid var(--rule-strong); background: var(--paper); color: var(--ink);
  font-weight: 500; font-size: var(--fs-s); text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--emerald); }
.btn.primary { background: var(--emerald); border-color: var(--emerald); color: #FBF8F1; }
.btn.primary:hover { background: var(--emerald-deep); }
:root[data-theme="dark"] .btn.primary { color: #07120F; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--emerald-ink); }
.btn.danger { color: var(--ruby); }
.btn.danger:hover { border-color: var(--ruby); }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.quiet:hover { background: var(--emerald-tint); border-color: transparent; }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: var(--fs-xs); border-radius: 9px; }
.btn.lg { min-height: 52px; padding: 12px 22px; font-size: var(--fs-m); border-radius: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn .icon { width: 18px; height: 18px; }

.field { display: grid; gap: 5px; font-size: var(--fs-s); color: var(--muted); }
.field input, .field select, .field textarea, select.input, input.input {
  min-height: 42px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--rule-strong); background: var(--paper); color: var(--ink);
}
.field textarea { min-height: 70px; resize: vertical; }
.fields { display: grid; gap: 12px; }
@media (min-width: 640px) { .fields.two { grid-template-columns: 1fr 1fr; } }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 12px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--emerald); background: var(--emerald-tint); }
.choice input { margin-top: 4px; accent-color: var(--emerald); }
.choice b { font-weight: 500; display: block; }
.choice .muted { font-size: var(--fs-xs); }
.choices { display: grid; gap: 8px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { appearance: none; width: 40px; height: 24px; border-radius: 999px; background: var(--rule-strong); position: relative; transition: background .2s; cursor: pointer; margin: 0; flex: none; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--emerald); }
.toggle input:checked::after { transform: translateX(16px); }
.toggles { display: grid; gap: 10px; }
@media (min-width: 640px) { .toggles { grid-template-columns: 1fr 1fr; } }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); padding: 2px 8px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-deep); font-weight: 500; }
.tag.green { background: var(--emerald-tint); color: var(--emerald); }
.tag.red { background: var(--ruby-soft); color: var(--ruby); }

/* ---------------------------------------------------------------- the star (signature element) */
.star-wrap { display: grid; place-items: center; }
.star-btn {
  position: relative; width: 208px; height: 208px;
  border: none; background: none; padding: 0; cursor: pointer; border-radius: 50%;
  color: #FBF8F1; -webkit-tap-highlight-color: transparent;
}
.star-btn > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.star-btn .body { fill: #0E5A47; stroke: #C8A24A; stroke-width: 1.4; transition: fill .3s; filter: drop-shadow(0 14px 22px rgba(8, 58, 46, .28)); }
.star-btn .ghost { fill: none; stroke: #C8A24A; stroke-width: .8; opacity: .55; }
.star-btn .spin { transform-origin: 32px 32px; }
.star-btn .ring { fill: none; stroke: #C8A24A; stroke-width: .6; opacity: 0; transform-origin: 32px 32px; }
.star-btn .core { fill: #FBF8F1; stroke: #C8A24A; stroke-width: 1; }
.star-btn .glyph { position: absolute; inset: 0; display: grid; place-items: center; color: #0E5A47; }
.star-btn .glyph .icon { width: 44px; height: 44px; stroke-width: 1.7; }
.star-btn:hover .body { fill: #0A4436; }
.star-btn:active { transform: scale(.98); }
.star-btn.listening .body { fill: #0A4436; }
.star-btn.listening .spin { animation: turn 9s linear infinite; }
.star-btn.listening .ring { animation: ripple 2.4s ease-out infinite; }
.star-btn.listening .ring.r2 { animation-delay: .8s; }
.star-btn.listening .ring.r3 { animation-delay: 1.6s; }
.star-btn.busy .spin { animation: turn 1.6s linear infinite; }
.star-btn.busy .glyph .icon { animation: pulse 1s ease-in-out infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes ripple { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.75); } }
@keyframes pulse { 50% { opacity: .35; } }
.star-caption { text-align: center; margin-top: 14px; font-weight: 500; font-size: var(--fs-l); }
.star-sub { text-align: center; color: var(--muted); font-size: var(--fs-s); min-height: 1.5em; font-variant-numeric: tabular-nums; }
.meter { display: block; width: min(320px, 80vw); height: 36px; margin: 8px auto 0; }
@media (prefers-reduced-motion: reduce) {
  .star-btn .spin, .star-btn .ring, .star-btn .glyph .icon { animation: none !important; }
}

/* ---------------------------------------------------------------- mushaf frame (ayah text) */
.mushaf {
  position: relative; background: var(--paper);
  border: 1px solid var(--gold); border-radius: 6px;
  padding: 18px 20px;
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px color-mix(in srgb, var(--gold) 55%, transparent);
}
.mushaf .ayah-text { font-family: var(--quran); direction: rtl; text-align: right; font-size: clamp(1.45rem, 1.1rem + 1.4vw, 2rem); line-height: 2.15; margin: 0; }
.mushaf .ayah-text.sm { font-size: 1.35rem; line-height: 2; }
.mushaf .translation { margin: 10px 0 0; color: var(--muted); font-size: var(--fs-s); max-width: 70ch; }
.mushaf .marker { font-family: var(--naskh); color: var(--gold-deep); font-size: .8em; margin-inline-start: .15em; white-space: nowrap; }
.mushaf + .mushaf { margin-top: 10px; }
.surah-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.surah-title .ar-name { font-family: var(--naskh); font-weight: 700; font-size: 1.9rem; direction: rtl; color: var(--emerald); line-height: 1.3; }
.surah-title .en-name { font-weight: 600; font-size: var(--fs-l); }
.surah-title .where { color: var(--muted); font-size: var(--fs-s); }

/* word states in the live view */
.w { border-radius: 6px; padding: 0 2px; transition: background .25s, color .25s, opacity .25s; }
.w.pending { color: var(--faint); }
.w.unread { color: var(--faint); opacity: .6; }
.w.ok { color: var(--ink); }
.w.near { background: var(--amber-soft); color: var(--amber); }
.w.wrong, .w.missed { background: var(--ruby-soft); color: var(--ruby); }
.w.missed { text-decoration: underline dotted; text-underline-offset: 8px; }
.w.skipped { color: var(--ruby); text-decoration: line-through; opacity: .75; }
.w.harakah { box-shadow: inset 0 -2px 0 var(--gold); }
.w.optional { color: var(--faint); opacity: .55; }
.w.current { box-shadow: 0 0 0 1.5px var(--gold); }
/* hifz: hide what hasn't been recited yet */
.hifz .w.pending, .hifz .w.unread { color: transparent; background: repeating-linear-gradient(90deg, var(--rule) 0 6px, transparent 6px 9px); background-size: 100% 3px; background-repeat: no-repeat; background-position: 0 70%; }
.hifz.peek .w.pending, .hifz.peek .w.unread { color: var(--faint); background: none; }

/* ---------------------------------------------------------------- lists, events, stats */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 2px; border-bottom: 1px solid var(--rule); }
.list > li:last-child { border-bottom: none; }
.li-main { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.li-title { font-weight: 500; color: var(--ink); text-decoration: none; }
a.li-title:hover { color: var(--emerald); text-decoration: underline; }
.li-meta { color: var(--muted); font-size: var(--fs-xs); display: flex; gap: 10px; flex-wrap: wrap; }
.li-ar { font-family: var(--quran); direction: rtl; text-align: right; font-size: 1.3rem; line-height: 1.9; margin-top: 6px; color: var(--ink); }

.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ev { display: grid; grid-template-columns: 28px 1fr; gap: 4px 10px; padding: 10px 12px; border-radius: 12px; background: var(--paper); border: 1px solid var(--rule); }
.ev .ev-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--emerald-tint); color: var(--emerald); }
.ev .ev-ico .icon { width: 16px; height: 16px; }
.ev.high .ev-ico { background: var(--ruby-soft); color: var(--ruby); }
.ev.medium .ev-ico { background: var(--amber-soft); color: var(--amber); }
.ev.low .ev-ico { background: var(--rule); color: var(--slate); }
.ev-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ev-title { font-weight: 500; }
.ev-where { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.ev-body { grid-column: 2; }
.cmp { display: grid; grid-template-columns: 5.5em auto; justify-content: start; gap: 0 12px; align-items: baseline; margin-top: 4px; }
.cmp .k { color: var(--muted); font-size: var(--fs-xs); }
.cmp .v { font-family: var(--quran); direction: rtl; text-align: right; font-size: 1.3rem; line-height: 1.8; }
.cmp .v.exp { color: var(--ok); }
.cmp .v.got { color: var(--ruby); }
.ev-note { color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
.ev-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.ev-actions input { flex: 1 1 140px; min-height: 32px; padding: 4px 10px; border-radius: 9px; border: 1px solid var(--rule); background: var(--paper); font-size: var(--fs-xs); }
.ev.dismissed { opacity: .5; }
.ev.confirmed { border-color: var(--emerald); }
.ev.info { background: transparent; border-style: dashed; }

.counts { display: flex; gap: 8px; flex-wrap: wrap; }
.count { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--rule); font-size: var(--fs-xs); color: var(--muted); }
.count b { font-size: var(--fs-m); color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.count.high b { color: var(--ruby); }

.figures { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r-l); overflow: hidden; }
@media (min-width: 720px) { .figures { grid-template-columns: repeat(4, 1fr); } }
.figure { background: var(--paper); padding: 14px 16px; }
.figure b { display: block; font-size: var(--fs-xl); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.figure span { color: var(--muted); font-size: var(--fs-xs); }

.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 36px; gap: 10px; align-items: center; font-size: var(--fs-s); }
.bar i { display: block; height: 8px; border-radius: 4px; background: var(--emerald); min-width: 3px; }
.bar.high i { background: var(--ruby); }
.bar.medium i { background: var(--gold); }
.bar.low i { background: var(--slate); }
.bar b { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }

/* khatm map */
.juz-row { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
@media (min-width: 720px) { .juz-row { grid-template-columns: repeat(15, 1fr); } }
@media (min-width: 1000px) { .juz-row { grid-template-columns: repeat(30, 1fr); } }
.juz { position: relative; height: 46px; border-radius: 6px; background: var(--rule); overflow: hidden; }
.juz i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--emerald); }
.juz span { position: absolute; inset: auto 0 3px; text-align: center; font-size: .68rem; font-weight: 600; color: var(--ink); mix-blend-mode: normal; }
.juz.full span { color: #FBF8F1; }
.juz.full { box-shadow: inset 0 0 0 1.5px var(--gold); }
.pagemap { display: grid; gap: 5px 32px; }
@media (min-width: 900px) { .pagemap { grid-template-columns: 1fr 1fr; grid-auto-flow: column; grid-template-rows: repeat(15, auto); } }
.jrow { display: grid; grid-template-columns: 1.8em 1fr 2.8em; align-items: center; gap: 8px; }
.jrow .jn { font-size: var(--fs-xs); color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.jrow .jp { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.jrow.full .jn, .jrow.full .jp { color: var(--gold-deep); font-weight: 600; }
.jcells { display: grid; grid-template-columns: repeat(23, 1fr); gap: 2px; }
.pg { aspect-ratio: 1; border-radius: 2px; background: var(--rule); }
.pg[data-l="1"] { background: color-mix(in srgb, var(--emerald) 30%, var(--rule)); }
.pg[data-l="2"] { background: color-mix(in srgb, var(--emerald) 60%, var(--rule)); }
.pg[data-l="3"] { background: var(--emerald); }
.pg.gap { box-shadow: inset 0 0 0 2px var(--ruby); }
.pg:hover { outline: 1.5px solid var(--gold); outline-offset: 1px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.progress-ring { width: 120px; height: 120px; }
.progress-ring .track { stroke: var(--rule); }
.progress-ring .fill { stroke: var(--emerald); transition: stroke-dashoffset .6s ease; }
.progress-line { height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.progress-line i { display: block; height: 100%; background: var(--emerald); transition: width .4s; }

/* ---------------------------------------------------------------- live console */
.console-bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin: -4px 0 14px;
  background: color-mix(in srgb, var(--ivory) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.state-chip { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: var(--fs-s); }
.state-chip::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.state-chip[data-s="tracking"]::before { background: var(--ok); animation: blink 1.4s infinite; }
.state-chip[data-s="recognizing"]::before { background: var(--gold); animation: blink .7s infinite; }
.state-chip[data-s="lost"]::before, .state-chip[data-s="idle"]::before { background: var(--gold); }
.state-chip[data-s="paused"]::before { background: var(--slate); }
.state-chip[data-s="error"]::before { background: var(--ruby); }
.timer { font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--fs-s); }
.mini-meter { width: 90px; height: 22px; }
.tail { margin-top: 10px; color: var(--faint); font-family: var(--quran); direction: rtl; text-align: right; font-size: 1.05rem; min-height: 1.6em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.follow-empty { display: grid; place-items: center; min-height: 220px; text-align: center; color: var(--muted); }
.follow-empty .mark { width: 70px; height: 70px; margin: 0 auto 12px; opacity: .8; }

/* ---------------------------------------------------------------- toasts, dialogs */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 60; display: grid; gap: 8px; width: min(92vw, 440px); }
@media (min-width: 860px) { .toasts { bottom: 24px; } }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--emerald-ink); color: #F4EEDD; box-shadow: var(--shadow-lift); font-size: var(--fs-s); animation: toastIn .25s ease; }
.toast.error { background: #5A1C22; }
.toast .icon { width: 18px; height: 18px; margin-top: 2px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
dialog { border: 1px solid var(--rule); border-radius: var(--r-l); padding: 0; background: var(--paper); color: var(--ink); width: min(92vw, 480px); box-shadow: var(--shadow-lift); }
dialog::backdrop { background: rgba(8, 30, 24, .45); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.dlg-head h2 { margin: 0; font-size: var(--fs-l); }
.dlg-body { padding: 16px; }
.qr { width: 220px; height: 220px; margin: 6px auto 12px; background: #fff; border-radius: 12px; padding: 8px; }
.qr svg { width: 100%; height: 100%; }
.url { font-family: var(--ui); font-weight: 600; text-align: center; word-break: break-all; }
.steps { margin: 12px 0 0; padding-left: 20px; color: var(--muted); font-size: var(--fs-s); }
.steps li + li { margin-top: 4px; }
code { font-size: .85em; background: var(--emerald-tint); padding: 1px 6px; border-radius: 6px; }

.empty-state { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty-state .mark { width: 56px; height: 56px; margin: 0 auto 10px; opacity: .7; }
.empty-state p { margin: 0 0 12px; }
.skeleton { background: linear-gradient(90deg, var(--rule) 0%, var(--paper) 50%, var(--rule) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; min-height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

footer.foot { max-width: 1120px; margin: 0 auto; padding: 0 16px 28px; color: var(--faint); font-size: var(--fs-xs); }

@media print {
  .band, .phone-nav, .console-bar, .no-print, .toasts, .ev-actions { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .panel, .mushaf { break-inside: avoid; }
  .ev { break-inside: avoid; }
}

/* ---------------------------------------------------------------- v3: live extras */
.inline-select { min-height: 30px; padding: 2px 8px; margin-inline-start: 4px; width: auto; display: inline-block; }
.link-chip, .voice-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: var(--fs-xs); border: 1px solid var(--rule); color: var(--muted); background: var(--paper); max-width: 100%; }
.link-chip .icon, .voice-chip .icon { width: 15px; height: 15px; flex: none; }
.link-chip[data-s="bad"] { color: var(--ruby); border-color: color-mix(in srgb, var(--ruby) 45%, var(--rule)); background: var(--ruby-soft); }
.link-chip[data-s="wait"] { color: var(--amber); border-color: color-mix(in srgb, var(--gold) 55%, var(--rule)); background: var(--amber-soft); }
.voice-chip { color: var(--emerald); border-color: color-mix(in srgb, var(--emerald) 35%, var(--rule)); }

/* talqeen: the next words, shown when the reciter is stuck */
.prompt-card { margin-top: 10px; display: grid; gap: 2px; padding: 12px 16px 10px; border-radius: 12px; background: var(--gold-soft); border: 1.5px solid var(--gold); color: var(--ink); }
.prompt-card .prompt-label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--gold-deep); font-weight: 600; }
.prompt-card .prompt-label .icon { width: 15px; height: 15px; }
.prompt-card .prompt-words { font-family: var(--quran); direction: rtl; text-align: right; font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.4rem); line-height: 1.9; }
.prompt-card.fresh { animation: promptIn .45s ease-out; }
@keyframes promptIn { 0% { transform: scale(.97); box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 60%, transparent); } 100% { transform: none; box-shadow: 0 0 0 10px transparent; } }
@media (prefers-reduced-motion: reduce) { .prompt-card.fresh { animation: none; } }

/* mushaf page view */
.page-view { padding: 14px 18px 18px; max-height: 70vh; overflow-y: auto; }
.page-view .page-meta { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--gold-deep); border-bottom: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); padding-bottom: 6px; margin-bottom: 8px; }
.page-view .page-text { text-align: justify; text-align-last: right; font-size: clamp(1.3rem, 1rem + 1.1vw, 1.75rem); line-height: 2.2; }
.page-surah { display: block; text-align: center; font-family: var(--naskh); font-weight: 700; color: var(--emerald); font-size: 1.25em; margin: 6px 0 2px; border-block: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); }
.page-ayah.current { background: color-mix(in srgb, var(--gold-soft) 70%, transparent); border-radius: 6px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* pairing */
.pin-input { font-size: 1.6rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; width: 100%; }
.pair-panel { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule); }
.pair-panel h3 { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-m); }
.pin-show { display: grid; gap: 4px; justify-items: center; margin: 12px 0 4px; }
.pin-digits { font-size: 2.2rem; font-weight: 600; letter-spacing: .3em; color: var(--emerald); font-variant-numeric: tabular-nums; }
.pin-dlg h2 { display: inline-flex; align-items: center; gap: 8px; }

/* report timeline player */
.tl-wrap { margin-top: 14px; }
.tl-wrap audio { width: 100%; height: 40px; }
.tl { position: relative; height: 34px; margin-top: 8px; border-radius: 8px; background: var(--rule); cursor: pointer; overflow: hidden; touch-action: none; }
.tl .tl-seg { position: absolute; top: 0; bottom: 0; opacity: .35; }
.tl .tl-mark { position: absolute; top: 6px; bottom: 6px; width: 3px; margin-left: -1px; border-radius: 2px; background: var(--slate); }
.tl .tl-mark.high { background: var(--ruby); }
.tl .tl-mark.medium { background: var(--gold-deep); }
.tl .tl-mark.dismissed { opacity: .3; }
.tl .tl-head { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--emerald-ink); pointer-events: none; }
:root[data-theme="dark"] .tl .tl-head { background: var(--ink); }
.tl-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: var(--fs-xs); color: var(--muted); }
.tl-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.voice-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.voice-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border-radius: 999px; border: 1px solid var(--rule); font-size: var(--fs-xs); }
.voice-pill i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
/* ------------------------------------------------------------------ account */
.err { color: var(--ruby); margin: 0; }
.err:empty { display: none; }
.code-input, .link-code, .recovery-out { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; }
.code-input { flex: 1 1 180px; text-transform: uppercase; font-size: 1.1rem; }
.recovery-out { margin: 0; padding: 10px 12px; border: 1px dashed var(--gold); border-radius: var(--r-s); background: var(--paper);
  font-size: 1rem; word-break: break-word; user-select: all; }
.recovery-new { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold-soft); }
.acct-mark { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 50%;
  background: var(--emerald-tint); color: var(--emerald); box-shadow: inset 0 0 0 1.5px var(--gold); }
.acct-mark svg { width: 24px; height: 24px; }
.link-out { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 14px; }
.link-out .qr { width: 168px; height: 168px; padding: 8px; background: #fff; border-radius: var(--r-s); box-shadow: inset 0 0 0 1px var(--rule); }
.link-out .qr svg { width: 100%; height: 100%; display: block; }
.link-code { margin: 0 0 4px; font-size: 1.9rem; font-weight: 600; color: var(--emerald); }
.link-out.expired .qr, .link-out.expired .link-code { opacity: .3; filter: grayscale(1); }

/* remote config: features the admin switched off; maintenance and announcements under the header */
.feature-off { display: none !important; }
.notices:empty { display: none; }
.notices { max-width: 1120px; margin: 14px auto 0; padding: 0 16px; display: grid; gap: 8px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-m); border: 1px solid var(--rule-strong); border-left: 4px solid var(--emerald); background: var(--paper); color: var(--ink); font-size: var(--fs-s); }
.notice.warn { border-left-color: var(--amber); background: var(--amber-soft); }
.notice > div { flex: 1; min-width: 0; }
.notice > .icon { width: 18px; height: 18px; margin-top: 2px; color: var(--emerald); flex: none; }
.notice.warn > .icon { color: var(--amber); }
.notice .btn { margin: -4px -6px -4px 0; }
