/* Fonts are bundled (SIL Open Font License, see fonts/): the app works offline and loads nothing from third parties. */
@font-face { font-family: "Scheherazade New"; font-weight: 400; font-display: swap; src: url(fonts/scheherazade-new-arabic-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Scheherazade New"; font-weight: 700; font-display: swap; src: url(fonts/scheherazade-new-arabic-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/newsreader-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/newsreader-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 600; font-style: normal; font-display: swap; src: url(fonts/newsreader-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 400; font-display: swap; src: url(fonts/outfit-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 500; font-display: swap; src: url(fonts/outfit-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 600; font-display: swap; src: url(fonts/outfit-latin-600-normal.woff2) format("woff2"); }

/* Layout: one narrow reading column; the verse is the hero of every screen, actions sit in a bottom bar under the thumb. */
:root {
  --bg: #E1F5F2; --surface: #FFFFFF; --sunk: #CFEBE6; --ink: #002921; --muted: #4E6863; --line: #BFDDD7;
  --accent: #007A62; --accent-ink: #FFFFFF; --accent-soft: #C9EFE7; --brand: #01B693;
  --miss: #B4462F; --miss-soft: #F6E1DA; --good: #2D7A4D; --good-soft: #DDEFE3; --gold: #A8741E;
  --f-ar: "Scheherazade New", "Amiri", "Noto Naskh Arabic", "Geeza Pro", serif;
  --f-read: "Newsreader", Georgia, "Times New Roman", serif;
  --f-ui: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 14px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #131817; --surface: #1B2321; --sunk: #222D2A; --ink: #E3F2EE; --muted: #93AAA4; --line: #2C3B37;
  --accent: #3CD3B0; --accent-ink: #00201A; --accent-soft: #173A33; --brand: #01A383;
  --miss: #E5826A; --miss-soft: #3A2620; --good: #6CC28D; --good-soft: #1D3326; --gold: #D9A54A; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #131817; --surface: #1B2321; --sunk: #222D2A; --ink: #E3F2EE; --muted: #93AAA4; --line: #2C3B37;
  --accent: #3CD3B0; --accent-ink: #00201A; --accent-soft: #173A33; --brand: #01A383;
  --miss: #E5826A; --miss-soft: #3A2620; --good: #6CC28D; --good-soft: #1D3326; --gold: #D9A54A; color-scheme: dark }

[hidden] { display: none !important; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-ui); font-size: 15px; line-height: 1.45; }
.wrap { max-width: 640px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 18px 120px; display: flex; flex-direction: column; gap: 22px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, .chunk:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* buttons */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 11px 18px; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 13px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: default; }
.iconbtn { border: 0; background: transparent; padding: 8px; border-radius: 999px; font-size: 20px; line-height: 1; color: var(--muted); }

/* home */
.top { display: flex; align-items: baseline; gap: 12px; }
.brand { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.brand-ar { font-family: var(--f-ar); font-size: 26px; color: var(--accent); margin-inline-start: auto; }
.today { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.today .plan { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.3; }
.btn.big { width: 100%; padding: 15px 18px; font-size: 17px; }
.learned { display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; color: var(--muted); }
.learned b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sync { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--good); }

.surahs { display: flex; flex-direction: column; }
.surah { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.surah .num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; text-align: right; }
.surah .names { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.surah .nm { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.surah .tr { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.surah .frn { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.surah .arn { font-family: var(--f-ar); font-size: 20px; margin-inline-start: auto; flex: none; }
.bar { height: 5px; border-radius: 3px; background: var(--sunk); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar .m { background: var(--accent); }
.bar .l { background: var(--accent-soft); }
.surah .meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.surah.current .num { color: var(--accent); font-weight: 600; }

.settings { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 12px; font-size: 13px; font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* session */
.sbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); display: flex; align-items: center; gap: 10px; padding-block: 6px; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.prog { flex: 1; height: 4px; background: var(--sunk); border-radius: 2px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kind { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: var(--sunk); color: var(--muted); }
.kind.new { background: var(--accent-soft); color: var(--accent); }
.kind.fix { background: var(--miss-soft); color: var(--miss); }
.ref { font-size: 13px; color: var(--muted); }

.prev { font-family: var(--f-ar); font-size: 19px; direction: rtl; text-align: right; color: var(--muted); opacity: .7; line-height: 1.8; }
.verse { direction: rtl; display: flex; flex-wrap: wrap; gap: 8px 6px; align-items: flex-start; justify-content: flex-start; }
.chunk { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 8px 6px; border-radius: 10px; border: 1px solid transparent; background: transparent; max-width: 100%; }
.chunk .a { font-family: var(--f-ar); font-size: 30px; line-height: 1.6; }
.chunk .g { direction: ltr; font-family: var(--f-read); font-size: 14px; color: var(--muted); text-align: center; line-height: 1.25; max-width: 15em; }
.verse.hideg .chunk .g { display: none; }
.chunk.tap { border-color: var(--line); background: var(--surface); }
.chunk.tap:hover { border-color: var(--accent); }
.chunk.target { border-color: var(--accent); background: var(--accent-soft); }
.chunk.missed { border-color: var(--miss); background: var(--miss-soft); }
.chunk.missed .g { color: var(--miss); }
.chunk.right { border-color: var(--good); background: var(--good-soft); }
.chunk.known .g::after { content: " ✓"; color: var(--good); }
.vnum { font-family: var(--f-ar); color: var(--gold); font-size: 24px; align-self: center; }
.trans { font-family: var(--f-read); font-size: 18px; line-height: 1.55; border-inline-start: 3px solid var(--accent-soft); padding-inline-start: 14px; }
.hint { font-size: 14px; color: var(--muted); }
.question { font-family: var(--f-read); font-size: 17px; }
.opts { display: flex; flex-direction: column; gap: 9px; }
.opt { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 13px 15px; font-family: var(--f-read); font-size: 16.5px; display: flex; gap: 12px; align-items: baseline; }
.opt kbd { font-family: var(--f-ui); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; flex: none; }
.opt.right { border-color: var(--good); background: var(--good-soft); }
.opt.wrong { border-color: var(--miss); background: var(--miss-soft); }
.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.actions .in { max-width: 640px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 12px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.actions .in .note { margin-inline-end: auto; font-size: 13px; color: var(--muted); }

/* reading */
.rhead { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; padding-block: 8px 4px; }
.rhead .arn { font-family: var(--f-ar); font-size: 40px; color: var(--accent); line-height: 1.4; }
.rhead .tr { font-family: var(--f-read); font-size: 20px; font-weight: 600; }
.rverse { display: flex; flex-direction: column; gap: 8px; padding-block: 12px; border-bottom: 1px solid var(--line); }
.rverse .tools { display: flex; gap: 8px; justify-content: flex-start; }
.rverse .chunk.hes { box-shadow: inset 0 -2px 0 var(--gold); }

.done { text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; padding-top: 30px; }
.done .big { font-family: var(--f-read); font-size: 30px; font-weight: 600; }
.confirm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-width: 420px) { .chunk .a { font-size: 27px; } }

/* standalone page shell */
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; }
body { margin: 0; -webkit-text-size-adjust: 100%; }
.langbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; }
.top .langbtn { margin-inline-start: 8px; align-self: center; }

/* sign-in, licence, loading */
.gate { max-width: 440px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 40px 60px; display: flex; flex-direction: column; gap: 18px; }
.gate .mark { display: flex; align-items: center; gap: 12px; }
.gate .mark img { width: 44px; height: 44px; border-radius: 11px; }
.gate h1 { font-size: 28px; font-weight: 600; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: var(--sunk); }
.tabs button { border: 0; background: transparent; padding: 10px 8px; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.gate .lead { font-family: var(--f-read); font-size: 17px; color: var(--muted); margin: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.field input { font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; }
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field input.code { letter-spacing: .4em; font-variant-numeric: tabular-nums; text-align: center; font-size: 22px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); line-height: 1.4; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.field input.key { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .03em; }
.msg { font-size: 14px; padding: 10px 12px; border-radius: 10px; }
.msg.err { background: var(--miss-soft); color: var(--miss); }
.msg.ok { background: var(--good-soft); color: var(--good); }
.msg.info { background: var(--sunk); color: var(--ink); }
.upsell { background: var(--accent-soft); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.upsell p { margin: 0; }
.surah.locked .tr, .surah.locked .arn, .surah.locked .num { color: var(--muted); }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.linkbtn { border: 0; background: transparent; color: var(--accent); padding: 0; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.gate .foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--sunk); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.acct { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acct .em { font-weight: 600; overflow-wrap: anywhere; }

/* Qasida Pro shell: splash, green header, bottom tab bar */
.splash { min-height: 100vh; background: var(--brand); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }
.splash img { width: 150px; height: auto; }
.splash h1 { font-size: 30px; font-weight: 600; }
.splash p { margin: 0; opacity: .9; max-width: 22em; }
.splash .spin { border-color: rgba(255,255,255,.35); border-top-color: #fff; }
.splash .btn { color: #002921; background: #fff; border-color: #fff; }
.apphead { position: sticky; top: 0; z-index: 7; background: var(--brand); color: #fff; display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
.apphead img { width: 30px; height: auto; }
.apphead .langbtn { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.4); color: #fff; }
#home .wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.panel { display: flex; flex-direction: column; gap: 22px; }
.ptitle { font-size: 26px; font-weight: 600; }
.top { align-items: center; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabbar button { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button[aria-selected="true"] { color: var(--accent); }
a.setrow.link { color: var(--ink); text-decoration: none; font-weight: 500; }
.socials { display: flex; flex-wrap: wrap; gap: 8px; }
.socials a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; }

/* Qaçîda library */
.qlist { display: flex; flex-direction: column; gap: 10px; }
.qrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--surface); border-radius: 18px; padding: 12px 10px 12px 14px; border: 1px solid transparent; text-align: start; width: 100%; color: inherit; }
.qrow.open { cursor: pointer; }
.qrow.open:hover { border-color: var(--brand); }
.qrow .num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; text-align: right; }
.qrow .names { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.qrow .nm { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.qrow .tr { font-weight: 600; min-width: 0; line-height: 1.3; }
.qrow .ar { font-family: var(--f-ar); font-size: 21px; direction: rtl; text-align: right; line-height: 1.5; flex: none; max-width: 58%; }
.qrow .st { font-size: 12px; font-weight: 600; color: var(--accent); }
.qrow.soon { opacity: .6; }
.qrow.locked { cursor: pointer; }
.qrow.locked .st { color: var(--muted); }
.qrow.soon .st { color: var(--muted); font-weight: 500; }
.fav { border: 0; background: transparent; font-size: 22px; line-height: 1; padding: 6px; color: var(--line); }
.fav[aria-pressed="true"] { color: var(--brand); }
.fav[disabled] { opacity: .35; cursor: default; }
.qlast { background: var(--brand); color: #fff; border-radius: 18px; padding: 16px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.qlast .book { font-size: 34px; }
.qlast .eyebrow { color: rgba(255,255,255,.85); }
.qlast .ar { font-family: var(--f-ar); font-size: 22px; line-height: 1.5; }
.qlast .sub { font-size: 13px; opacity: .9; }
.qlast .btn { background: #fff; color: #002921; border-color: #fff; }   /* fixed colours: white button in light and dark mode */

/* reader: full screen, pages side by side, swipe or scroll horizontally */
#qread { position: fixed; inset: 0; z-index: 20; background: #1E2422; color: #fff; display: flex; flex-direction: column; }
.qbar { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 6px) 12px 6px; background: rgba(0,0,0,.25); }
.qbar .iconbtn { color: #fff; }
.qbar .qt { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: center; font-size: 13px; opacity: .9; }
.qbar .qt .ar { font-family: var(--f-ar); font-size: 18px; line-height: 1.4; }
.qbar .count { color: rgba(255,255,255,.8); min-width: 4em; text-align: end; }
.qpages { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; }
.qpage { flex: 0 0 100%; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; padding: 8px; overflow: auto; }
.qpage canvas { max-width: 100%; max-height: 100%; height: auto; box-shadow: 0 4px 18px rgba(0,0,0,.4); background: #fff; }
#qread .msg { margin: 16px; }

/* onboarding choices: big tappable options, the selected one outlined */
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; text-align: left; border: 2px solid var(--line); background: var(--surface); border-radius: 14px; padding: 13px 15px; }
.choice b { font-weight: 600; }
.choice span { color: var(--muted); font-size: 13.5px; }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
