/* ==========================================================================
   Mutūn — calm, editorial study interface
   ========================================================================== */

:root {
  --bg: #f6f3ec;
  --bg-2: #efebe1;
  --surface: #fffdf8;
  --ink: #1e1b16;
  --ink-2: #575045;
  --ink-3: #8c8476;
  --line: #e5dfd2;
  --line-2: #d6cfbf;
  --accent: #2f5d50;
  --accent-ink: #f6f3ec;
  --accent-soft: #e3ebe5;
  --gold: #a9853b;
  --shadow: 0 1px 2px rgba(30, 27, 22, .04), 0 6px 24px -12px rgba(30, 27, 22, .12);
  --shadow-lg: 0 2px 6px rgba(30, 27, 22, .05), 0 24px 48px -24px rgba(30, 27, 22, .25);
  --focus-bg: #12110e;
  --focus-ink: #f2ede3;

  --f-ar: "Amiri", "Noto Naskh Arabic", "Traditional Arabic", serif;
  --f-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --f-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 14px;
  --radius-sm: 10px;
  --wrap: 1120px;
  --player-h: 76px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #13120f;
    --bg-2: #1a1915;
    --surface: #1c1b17;
    --ink: #ede7db;
    --ink-2: #b7afa0;
    --ink-3: #7f786c;
    --line: #2b2924;
    --line-2: #3a3731;
    --accent: #86bba8;
    --accent-ink: #12110e;
    --accent-soft: #1f2c27;
    --gold: #c9a55c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 48px -24px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #13120f;
  --bg-2: #1a1915;
  --surface: #1c1b17;
  --ink: #ede7db;
  --ink-2: #b7afa0;
  --ink-3: #7f786c;
  --line: #2b2924;
  --line-2: #3a3731;
  --accent: #86bba8;
  --accent-ink: #12110e;
  --accent-soft: #1f2c27;
  --gold: #c9a55c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 48px -24px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.6 var(--f-ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body.has-player { padding-bottom: calc(var(--player-h) + env(safe-area-inset-bottom)); }
::selection { background: var(--accent-soft); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
#app:focus { outline: none; }
.muted { color: var(--ink-3); }
.ar { font-family: var(--f-ar); direction: rtl; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

/* ---------- Topbar ---------- */
.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 transparent;
  transition: border-color .2s;
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar__inner { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; justify-content: space-between; }
@media (max-width: 600px) { .topbar__inner { padding: 0 12px 0 16px; } }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand__mark { font-family: var(--f-ar); font-size: 26px; line-height: 1; color: var(--accent); }
.brand__name { font-family: var(--f-display); font-size: 19px; letter-spacing: -.01em; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a { padding: 8px 12px; border-radius: 999px; color: var(--ink-2); font-size: 14px; font-weight: 500; transition: color .15s, background .15s; }
.topnav a:hover { color: var(--ink); }
.topnav a.is-active { color: var(--ink); background: var(--bg-2); }
body.focus-mode .topbar { display: none; }

/* ---------- Buttons ---------- */
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px;
  display: inline-grid; place-items: center;
  color: var(--ink-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.is-on { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; padding: 0 22px; border-radius: 999px;
  font-weight: 500; font-size: 15px; letter-spacing: .005em;
  border: 1px solid var(--line-2); background: var(--surface);
  transition: transform .12s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; }
.btn--primary { background: var(--ink); color: var(--bg); border-color: var(--ink); box-shadow: var(--shadow); }
.btn--primary:hover { background: color-mix(in srgb, var(--ink) 88%, var(--accent)); border-color: transparent; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); padding: 0 14px; }
.btn--ghost:hover { color: var(--ink); background: var(--bg-2); border-color: transparent; }
.btn--sm { height: 36px; padding: 0 14px; font-size: 13.5px; }

.chip-btn {
  height: 30px; min-width: 44px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line-2); font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  font-variant-numeric: tabular-nums; transition: all .15s;
}
.chip-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.chip-btn.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Home: hero ---------- */
.hero { padding: 72px 0 40px; text-align: center; position: relative; }
.hero__ornament { width: 56px; height: 56px; margin: 0 auto 22px; color: var(--gold); opacity: .85; }
.hero__ar { font-family: var(--f-ar); font-size: clamp(44px, 8vw, 76px); line-height: 1.3; margin: 0; font-weight: 400; }
.hero__en { font-family: var(--f-display); font-weight: 300; font-style: italic; font-size: clamp(19px, 2.6vw, 24px); color: var(--ink-2); margin: 6px 0 0; }
.hero__lede { max-width: 560px; margin: 18px auto 0; color: var(--ink-2); font-size: 15.5px; }
.hero__stats { display: flex; justify-content: center; gap: 28px; margin-top: 28px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat__n { font-family: var(--f-display); font-size: 26px; font-weight: 400; line-height: 1.1; font-variant-numeric: lining-nums; }
.stat__l { font-size: 11.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); margin-top: 4px; }
@media (max-width: 600px) { .hero { padding: 44px 0 28px; } .hero__stats { gap: 20px; } }

/* ---------- Continue card ---------- */
.resume {
  display: flex; align-items: center; gap: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin: 8px auto 36px; max-width: 640px; box-shadow: var(--shadow);
}
.resume__play { flex: none; width: 48px; height: 48px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; transition: transform .12s; }
.resume__play:hover { transform: scale(1.05); }
.resume__play svg { width: 20px; height: 20px; }
.resume__body { flex: 1; min-width: 0; }
.resume__label { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); }
.resume__title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.resume__title .ar { font-size: 22px; line-height: 1.5; }
.resume__title .en { color: var(--ink-2); font-size: 14px; }
.resume__bar { height: 3px; background: var(--line); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.resume__bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.resume__time { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Toolbar (search + filters) ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; }
.search { position: relative; flex: 0 1 300px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 40px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface); padding: 0 14px 0 38px; font-size: 14px; outline: none; transition: border-color .15s;
}
.search input:focus { border-color: var(--accent); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter {
  height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; color: var(--ink-2);
  border: 1px solid transparent; transition: all .15s;
}
.filter:hover { color: var(--ink); background: var(--bg-2); }
.filter.is-on { color: var(--ink); background: var(--surface); border-color: var(--line-2); box-shadow: var(--shadow); }
@media (max-width: 700px) {
  .search { flex: 1 1 100%; }
  .filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filter { flex: none; }
}

/* ---------- Levels & cards ---------- */
.level { margin-top: 44px; }
.level__head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.level__num { font-family: var(--f-display); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.level__name { font-family: var(--f-display); font-size: 24px; font-weight: 400; margin: 0; letter-spacing: -.01em; white-space: nowrap; }
.level__rule { flex: 1; height: 1px; background: var(--line); align-self: center; min-width: 20px; }
.level__meta { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .level__name { font-size: 20px; } .level__rule { display: none; } .level__head { flex-wrap: wrap; row-gap: 2px; } .level__meta { flex-basis: 100%; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
@media (max-width: 540px) { .grid { grid-template-columns: 1fr; gap: 12px; } }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; min-height: 212px; overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.card:hover { border-color: var(--line-2); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card.is-playing { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.card__link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card__top { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }
.card__tag { display: inline-flex; align-items: center; gap: 6px; }
.card__tag::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: var(--dot, var(--ink-3)); }
.card__ar { font-family: var(--f-ar); font-size: 27px; line-height: 1.55; text-align: right; direction: rtl; margin: 14px 0 2px; }
.card__tr { font-family: var(--f-display); font-style: italic; font-size: 15px; color: var(--ink); line-height: 1.35; }
.card__en { font-size: 13px; color: var(--ink-2); margin-top: 2px; line-height: 1.4; }
.card__foot { margin-top: auto; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card__author { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__play {
  position: relative; z-index: 2; flex: none;
  width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center;
  border: 1px solid var(--line-2); color: var(--ink); transition: all .15s;
}
.card__play svg { width: 15px; height: 15px; }
.card__play:hover, .card.is-playing .card__play { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.card__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.card__bar > i { display: block; height: 100%; background: var(--accent); opacity: .8; }
.card__badge { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; }
.card__badge svg { width: 13px; height: 13px; }

.empty-search { text-align: center; color: var(--ink-3); padding: 60px 0; }

/* discipline colours (subtle) */
[data-group="aqidah"] { --dot: #2f5d50; }
[data-group="hadith"] { --dot: #a9853b; }
[data-group="fiqh"]   { --dot: #7a5c99; }
[data-group="arabic"] { --dot: #3b6ea8; }
[data-group="tajwid"] { --dot: #2e8a8a; }
[data-group="adab"]   { --dot: #b0603f; }

/* ---------- Footer ---------- */
.foot { margin: 80px 0 40px; padding-top: 28px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot a { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.foot a:hover { color: var(--ink); }

/* ---------- Book page ---------- */
.back { display: inline-flex; align-items: center; gap: 8px; margin-top: 28px; color: var(--ink-3); font-size: 13px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.back:hover { color: var(--ink); }
.back svg { width: 16px; height: 16px; }

.book-hero { text-align: center; padding: 36px 0 32px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: var(--dot, var(--ink-3)); }
.book-hero__ar { font-family: var(--f-ar); font-weight: 400; font-size: clamp(46px, 9vw, 84px); line-height: 1.35; margin: 18px 0 0; }
.book-hero__tr { font-family: var(--f-display); font-style: italic; font-weight: 300; font-size: clamp(20px, 3vw, 28px); margin: 4px 0 0; }
.book-hero__en { color: var(--ink-2); margin: 4px 0 0; }
.book-hero__author { margin-top: 20px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.book-hero__author .ar { font-size: 19px; color: var(--ink-2); }
.book-hero__author small { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

.actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 28px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

.book-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; margin-top: 40px; align-items: start; }
@media (max-width: 900px) { .book-grid { grid-template-columns: 1fr; } }

.progress-card { padding: 22px; }
.progress-card h3, .side h3 { margin: 0 0 12px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.progress-big { display: flex; align-items: baseline; justify-content: space-between; }
.progress-big b { font-family: var(--f-display); font-size: 40px; font-weight: 300; line-height: 1; }
.progress-big span { color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--line); border-radius: 6px; margin: 14px 0 16px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .6s ease; }
.toggles { display: grid; gap: 8px; }
.toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); font-size: 14px; text-align: left; transition: all .15s;
}
.toggle:hover { border-color: var(--line-2); }
.toggle .check { width: 22px; height: 22px; border-radius: 99px; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: transparent; transition: all .15s; }
.toggle .check svg { width: 13px; height: 13px; }
.toggle.is-on { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
.toggle.is-on .check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.side { display: grid; gap: 16px; }
.side .panel { padding: 20px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; padding: 12px 14px; font-size: 14px; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.is-on { color: var(--ink); }
.tab.is-on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--ink); border-radius: 2px; }
.tab .count { font-size: 11px; color: var(--ink-3); margin-left: 4px; font-variant-numeric: tabular-nums; }

/* bookmarks */
.marks-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.marks-head p { margin: 0; color: var(--ink-3); font-size: 13.5px; }
.mark-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mark {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
}
.mark__time {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.mark__time svg { width: 11px; height: 11px; }
.mark__label { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 14px; padding: 4px 6px; border-radius: 6px; }
.mark__label:focus { background: var(--bg-2); }
.mark__label::placeholder { color: var(--ink-3); }
.mark .icon-btn { width: 32px; height: 32px; }
.mark .icon-btn svg { width: 16px; height: 16px; }

.empty {
  text-align: center; padding: 40px 24px; border: 1px dashed var(--line-2); border-radius: var(--radius);
  color: var(--ink-2);
}
.empty__icon { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--ink-3); }
.empty h4 { font-family: var(--f-display); font-weight: 400; font-size: 20px; margin: 0 0 6px; color: var(--ink); }
.empty p { margin: 0 auto; max-width: 440px; font-size: 14px; }
.empty .actions { margin-top: 18px; }

/* layer status */
.layers { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 13.5px; }
.layers li { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 99px; background: var(--line-2); }
.state--ok { color: var(--accent); }
.state--ok::before { background: var(--accent); }
.state--wait::before { background: var(--gold); }

/* sources */
.sources { display: grid; gap: 12px; }
.source { padding: 16px 18px; }
.source__type { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; display: flex; justify-content: space-between; gap: 10px; }
.source__title { font-family: var(--f-display); font-size: 17px; margin: 6px 0 2px; line-height: 1.35; }
.source__by { color: var(--ink-2); font-size: 13.5px; }
.source__link { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 13px; color: var(--accent); font-weight: 500; }
.source__link svg { width: 13px; height: 13px; }
.source__link:hover { text-decoration: underline; text-underline-offset: 3px; }
.quote { font-family: var(--f-display); font-style: italic; color: var(--ink-2); border-left: 2px solid var(--gold); padding: 2px 0 2px 16px; margin: 0 0 20px; font-size: 15px; }
.quote .ar { display: block; font-style: normal; font-size: 20px; color: var(--ink); text-align: left; margin-bottom: 4px; }

/* reader (for verified segmented content, when available) */
.reader__section { margin-bottom: 40px; }
.reader__section h3 { text-align: center; font-family: var(--f-ar); font-weight: 400; font-size: 30px; margin: 0; }
.reader__section h4 { text-align: center; font-family: var(--f-display); font-style: italic; font-weight: 300; color: var(--ink-2); margin: 0 0 20px; }
.seg { padding: 16px 18px; border-radius: var(--radius); transition: background .3s; cursor: default; }
.seg[data-start] { cursor: pointer; }
.seg:hover { background: var(--bg-2); }
.seg.is-active { background: var(--accent-soft); }
.seg__ar { font-family: var(--f-ar); font-size: clamp(24px, 3.4vw, 32px); line-height: 2.1; direction: rtl; text-align: right; }
.seg__en { color: var(--ink-2); font-family: var(--f-display); font-size: 17px; margin-top: 6px; }
.reader.hide-en .seg__en { display: none; }

/* ---------- About ---------- */
.prose { max-width: 680px; margin: 0 auto; padding: 48px 0 0; }
.prose h1 { font-family: var(--f-display); font-weight: 300; font-size: clamp(32px, 5vw, 44px); letter-spacing: -.015em; margin: 0 0 8px; }
.prose h2 { font-family: var(--f-display); font-weight: 400; font-size: 22px; margin: 40px 0 10px; }
.prose p, .prose li { color: var(--ink-2); font-size: 15.5px; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; align-items: center; font-size: 14px; color: var(--ink-2); }
kbd { font: 600 12px var(--f-ui); background: var(--surface); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 3px 8px; color: var(--ink); min-width: 26px; text-align: center; display: inline-block; }

/* ---------- Scrubber ---------- */
.scrub { position: relative; height: 18px; display: flex; align-items: center; --p: 0%; }
.scrub::before { content: ""; position: absolute; left: 0; right: 0; height: 4px; border-radius: 4px; background: var(--line); }
.scrub__fill { position: absolute; left: 0; height: 4px; width: var(--p); border-radius: 4px; background: var(--accent); pointer-events: none; }
.scrub__region { position: absolute; height: 10px; border-radius: 3px; background: color-mix(in srgb, var(--gold) 35%, transparent); pointer-events: none; display: none; }
.scrub__region.is-on { display: block; }
.scrub__marks { position: absolute; inset: 0; pointer-events: none; }
.scrub__marks i { position: absolute; top: 50%; width: 2px; height: 10px; margin-left: -1px; transform: translateY(-50%); background: var(--gold); border-radius: 2px; }
.scrub input { position: relative; width: 100%; margin: 0; height: 18px; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.scrub input::-webkit-slider-runnable-track { height: 18px; background: transparent; }
.scrub input::-moz-range-track { height: 18px; background: transparent; }
.scrub input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: 2px; border-radius: 99px; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.25); opacity: 0; transition: opacity .15s, transform .15s; }
.scrub input::-moz-range-thumb { width: 12px; height: 12px; border-radius: 99px; background: var(--accent); border: 2px solid var(--surface); opacity: 0; }
.scrub:hover input::-webkit-slider-thumb, .scrub input:focus-visible::-webkit-slider-thumb { opacity: 1; }
.scrub:hover input::-moz-range-thumb, .scrub input:focus-visible::-moz-range-thumb { opacity: 1; }

/* ---------- Player bar ---------- */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  animation: rise .35s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { transform: translateY(100%); } }
body.focus-mode .player { display: none; }
.player__scrub { position: absolute; left: 0; right: 0; top: -9px; padding: 0; }
.player__scrub .scrub::before, .player__scrub .scrub__fill { height: 3px; border-radius: 0; }
.player__inner { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; height: var(--player-h); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.player__info { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.player__ar { font-family: var(--f-ar); font-size: 20px; line-height: 1.5; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player__meta { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player__controls { display: flex; align-items: center; gap: 8px; }
.play-btn { width: 46px; height: 46px; border-radius: 999px; background: var(--ink); color: var(--bg); display: grid; place-items: center; transition: transform .12s; }
.play-btn:hover { transform: scale(1.05); }
.play-btn svg { width: 18px; height: 18px; }
.player__right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.player__time { font-size: 12.5px; font-variant-numeric: tabular-nums; margin-right: 6px; white-space: nowrap; }
.player.is-looping [data-icon="repeat"] { color: var(--gold); }
@media (max-width: 700px) {
  .player__inner { grid-template-columns: 1fr auto; padding: 0 12px 0 16px; gap: 8px; }
  .player__controls { order: 3; }
  .player__right { display: contents; }
  .player__right .player__time, .player__right [data-icon] { display: none; }
  .hide-sm { display: none; }
}

/* ---------- Focus / memorisation mode ---------- */
.focus {
  min-height: 100vh; min-height: 100dvh; background: var(--focus-bg); color: var(--focus-ink);
  display: flex; flex-direction: column;
  --line: #2a2823; --line-2: #3a3731; --ink-2: #b9b1a2; --ink-3: #7c7568; --accent: #86bba8; --accent-ink: #12110e; --surface: #1b1a16; --bg-2: #22201b; --ink: #f2ede3; --bg: #12110e; --gold: #c9a55c;
  color-scheme: dark;
}
.focus__top { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; }
.focus__top .label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.focus__main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 8px 20px 40px; display: flex; flex-direction: column; align-items: center; }
.focus__title { font-family: var(--f-ar); font-size: clamp(36px, 7vw, 60px); line-height: 1.4; text-align: center; margin: 4px 0 0; font-weight: 400; }
.focus__sub { color: var(--ink-3); font-size: 13.5px; text-align: center; }

.ring { position: relative; width: 220px; height: 220px; margin: 28px 0 8px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring .ring__track { stroke: var(--line); }
.ring .ring__val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .12s linear; }
.ring.is-gap .ring__val { stroke: var(--gold); }
.ring__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring__time { font-family: var(--f-display); font-size: 40px; font-weight: 300; font-variant-numeric: tabular-nums lining-nums; line-height: 1; }
.ring__hint { font-size: 12px; color: var(--ink-3); margin-top: 8px; letter-spacing: .06em; text-transform: uppercase; }
.ring.is-gap .ring__hint { color: var(--gold); }

.reps { display: flex; gap: 6px; justify-content: center; min-height: 10px; margin-bottom: 18px; }
.reps i { width: 8px; height: 8px; border-radius: 99px; background: var(--line-2); transition: background .2s; }
.reps i.done { background: var(--accent); }
.reps i.now { background: var(--gold); }
.reps .inf { font-size: 12px; color: var(--ink-3); }

.focus__controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0 22px; }
.mark-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px; width: 92px; padding: 10px 6px; border-radius: var(--radius);
  border: 1px solid var(--line-2); color: var(--ink-2); font-size: 12px; transition: all .15s;
}
.mark-btn b { font-family: var(--f-display); font-size: 17px; font-weight: 400; color: var(--ink); font-variant-numeric: tabular-nums; }
.mark-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.mark-btn.is-set { border-color: color-mix(in srgb, var(--gold) 60%, transparent); }
.big-play { width: 76px; height: 76px; border-radius: 999px; background: var(--focus-ink); color: var(--focus-bg); display: grid; place-items: center; box-shadow: 0 0 0 8px rgba(255,255,255,.04); transition: transform .12s; }
.big-play:hover { transform: scale(1.04); }
.big-play svg { width: 28px; height: 28px; }

.nudges { display: flex; gap: 6px; justify-content: center; margin-top: -10px; margin-bottom: 18px; }
.nudges .chip-btn { height: 26px; font-size: 11.5px; min-width: 0; padding: 0 8px; }

.focus__panel { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.opt:last-child { border-bottom: 0; }
.opt__l { font-size: 13.5px; color: var(--ink-2); }
.opt__r { display: flex; gap: 6px; flex-wrap: wrap; }
.focus__row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 18px 0; }
.focus__row .btn { background: transparent; border-color: var(--line-2); color: var(--ink); }
.focus__row .btn:hover { border-color: var(--ink-3); }
.focus__row .btn--primary { background: var(--focus-ink); color: var(--focus-bg); border-color: transparent; }
.focus__scrub { width: 100%; margin-top: 22px; }
.focus__scrub .times { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; margin-top: 4px; }
.focus__help { margin-top: 26px; color: var(--ink-3); font-size: 13px; text-align: center; max-width: 520px; line-height: 1.7; }
@media (max-width: 480px) {
  .ring { width: 180px; height: 180px; }
  .ring__time { font-size: 32px; }
  .mark-btn { width: 80px; }
  .focus__controls { gap: 10px; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--player-h) + 20px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 13.5px; box-shadow: var(--shadow-lg);
  transition: opacity .2s, transform .2s; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
body.focus-mode .toast { bottom: 24px; background: var(--focus-ink); color: var(--focus-bg); }

/* ---------- Motion ---------- */
.fade-in { animation: fade .35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Small-screen refinements ---------- */
.btn { white-space: nowrap; }
@media (max-width: 600px) {
  .marks-head { flex-direction: column; align-items: stretch; }
  .hero__stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: center; gap: 18px; }
  .stat__l { font-size: 10px; letter-spacing: .08em; text-align: center; max-width: 72px; }
}

/* ---------- Read-along study materials ---------- */
.read-intro { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }
.study-list { display: grid; gap: 12px; }
.study { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.study__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.study__label { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; display: inline-flex; align-items: baseline; gap: 8px; }
.study__label .ar { font-size: 16px; letter-spacing: 0; text-transform: none; font-weight: 400; color: var(--ink-3); }
.study__title { font-family: var(--f-display); font-size: 17px; line-height: 1.35; margin-top: 6px; }
.study__by { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.study__note { margin: 8px 0 0; color: var(--ink-3); font-size: 13px; line-height: 1.55; }
.study__links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.study__host { font-size: 12px; color: var(--ink-3); }
.read-more { font-size: 13.5px; color: var(--ink-3); margin: 16px 2px 0; }
.read-more a { color: var(--accent); }
.read-more a:hover { text-decoration: underline; text-underline-offset: 3px; }
.layers-panel { padding: 18px 20px; margin-top: 16px; }
.layers-panel h3 { margin: 0 0 12px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.card__en-tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: var(--accent); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; margin-left: 4px; line-height: 1.5; vertical-align: 1px; }
.card__nl-tag { color: #c2410c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card__nl-tag { color: #fb923c; } }
:root[data-theme="dark"] .card__nl-tag { color: #fb923c; }

/* ---------- Preliminary (al-Adhkar wa-l-Adab) ---------- */
.prelim {
  margin-top: 36px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 20px 22px; border-radius: var(--radius); border: 1px dashed var(--line-2); background: var(--bg-2);
}
.prelim__body { flex: 1 1 360px; min-width: 0; }
.prelim__title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.prelim__title .ar { font-size: 26px; line-height: 1.5; }
.prelim__title span:last-child { font-family: var(--f-display); font-style: italic; font-size: 17px; color: var(--ink-2); }
.prelim p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.prelim__links { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Synchronised reader ---------- */
.rd-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; position: sticky; top: 64px; z-index: 5;
  padding: 8px 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.rd-tools__sp { flex: 1; }
.rd-loading { padding: 48px 0; text-align: center; color: var(--ink-3); }
.rd {
  --rd-scale: 1;
  font-family: var(--f-ar); font-size: calc(25px * var(--rd-scale)); line-height: 2.15; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px 34px 34px; text-align: justify; text-justify: inter-word;
}
@media (max-width: 600px) { .rd { padding: 18px 16px 22px; font-size: calc(22px * var(--rd-scale)); border-radius: var(--radius-sm); } }
.rd-sec + .rd-sec { margin-top: 1.1em; }
.rd-h {
  font-family: var(--f-ar); font-weight: 700; font-size: 1.08em; line-height: 1.8; text-align: center; color: var(--accent);
  margin: 0.4em 0 0.5em; cursor: pointer; text-wrap: balance;
}
.rd-h:hover { opacity: .8; }
.rd-p { margin: 0 0 0.55em; }
.rd-seg { cursor: pointer; border-radius: 6px; transition: background-color .25s, box-shadow .25s; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.rd-seg:hover { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.rd-seg.is-active { background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.qv { font-family: "Amiri Quran", var(--f-ar); color: var(--accent); }
.qv--img img { height: 1.15em; vertical-align: -0.3em; display: inline-block; }
:root[data-theme="dark"] .qv--img img { filter: invert(1) hue-rotate(180deg) brightness(1.1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .qv--img img { filter: invert(1) hue-rotate(180deg) brightness(1.1); } }
.qref { font-family: var(--f-ui); font-size: 0.45em; color: var(--ink-3); margin-inline: 0.25em; vertical-align: 0.35em; white-space: nowrap; direction: rtl; unicode-bidi: isolate; }
.fnref { font-family: var(--f-ui); font-size: 0.5em; color: var(--gold); cursor: pointer; padding: 0 2px; }
.rd-notes { list-style: none; margin: 1em 0 0; padding: 0.8em 0 0; border-top: 1px solid var(--line); font-size: 0.68em; line-height: 1.9; color: var(--ink-2); }
.rd-notes li { padding: 2px 6px; border-radius: 6px; transition: background .4s; }
.rd-notes li.is-flash { background: color-mix(in srgb, var(--gold) 22%, transparent); }
.rd-notes__n { color: var(--gold); font-family: var(--f-ui); font-size: .85em; }

/* poems: one bayt per row, two hemistichs */
.rd--poem { text-align: center; }
.rd-bayt { display: grid; grid-template-columns: 2.2em 1fr 1fr; align-items: baseline; gap: 0 1.2em; padding: 0.15em 0.5em; margin: 0 -0.5em; }
.rd-bayt .rd-hem:nth-of-type(2) { text-align: right; }
.rd-bayt .rd-hem:nth-of-type(3) { text-align: left; }
.rd-n { font-size: 0.55em; color: var(--ink-3); font-family: var(--f-ui); text-align: center; }
@media (max-width: 720px) {
  .rd-bayt { grid-template-columns: 1.8em 1fr; }
  .rd-bayt .rd-hem:nth-of-type(2) { text-align: right; }
  .rd-bayt .rd-hem:nth-of-type(3) { grid-column: 2; text-align: left; padding-inline-start: 1.5em; }
}
.rd-source { font-size: 12.5px; color: var(--ink-3); margin: 12px 4px 0; }
.rd-more { margin-top: 28px; }
.rd-more > summary { cursor: pointer; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; padding: 8px 0; list-style: none; }
.rd-more > summary::-webkit-details-marker { display: none; }
.rd-more > summary::before { content: "+ "; }
.rd-more[open] > summary::before { content: "− "; }
.rd-more[open] > summary { margin-bottom: 12px; }

/* memorisation: current part */
.focus__title--sm { font-size: clamp(26px, 5vw, 36px); }
.fpart { position: relative; width: 100%; margin: 18px 0 4px; padding: 22px 22px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.fpart__text { font-family: var(--f-ar); font-size: clamp(24px, 4.4vw, 34px); line-height: 2; text-align: center; min-height: 2em; transition: filter .3s, opacity .3s; }
.fpart__hem { display: block; }
.fpart__hem + .fpart__hem { color: var(--ink-2); }
.fpart__reveal { display: none; position: absolute; inset: 0 0 52px; color: var(--ink-3); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.fpart.is-hidden .fpart__text { filter: blur(9px); opacity: .5; user-select: none; }
.fpart.is-hidden .fpart__reveal { display: block; }
.fpart__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.fpart__meta { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.fpart__hide { position: absolute; top: 10px; left: 10px; height: 26px; font-size: 11.5px; }
.ring--sm { width: 150px; height: 150px; margin: 18px 0 6px; }
.ring--sm .ring__time { font-size: 30px; }
.ring--sm .ring__hint { font-size: 10.5px; }
.rd-seg.is-nr { color: var(--ink-3); text-decoration: underline dotted var(--line-2); text-underline-offset: 6px; cursor: help; }

/* ---------- review batch: levels, search hits, reader tools ---------- */
.level__name.ar { font-family: var(--f-ar); font-size: 26px; }
.upcoming { margin-top: 48px; }
.upcoming__h, .hits__h { font-family: var(--f-display); font-weight: 400; font-size: 20px; margin: 0 0 14px; }
.upcoming__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.upcoming__lvl { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 14px 16px; color: var(--ink-2); }
.upcoming__name { font-size: 20px; color: var(--ink); margin: 2px 0 6px; }
.upcoming__lvl ul { margin: 0; padding: 0 1.1em 0 0; direction: rtl; font-size: 17px; line-height: 1.8; }
.hits { margin: 26px 0 8px; }
.hit { display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 8px; }
.hit:hover { border-color: var(--line-2); }
.hit__book { font-size: 12px; color: var(--ink-3); letter-spacing: .04em; }
.hit__text { font-size: 19px; line-height: 1.8; direction: rtl; text-align: right; }
.rd-div { text-align: center; font-family: var(--f-ar); font-weight: 700; color: var(--gold); font-size: 1em; margin: 1.4em 0 .6em; padding-top: .8em; border-top: 1px solid var(--line); }
.rd-notes__h { margin-top: 1em; padding-top: .6em; border-top: 1px solid var(--line); font-size: .55em; color: var(--ink-3); font-family: var(--f-ui); }
.rd-notes__h + .rd-notes { border-top: 0; margin-top: 0; padding-top: .3em; }
.rd-seg.is-mem { text-decoration: underline 2px color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 8px; }
.rd-seg.is-flash { background: color-mix(in srgb, var(--gold) 22%, transparent); }
.progress-parts { margin: -6px 0 12px; font-size: 13px; color: var(--ink-3); }
.fpart__mem.is-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.prerender { padding: 40px 16px; font-family: var(--f-ar); font-size: 22px; line-height: 2; }

/* ---------- English layer, sharh ---------- */
.rd-lang { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; margin-bottom: 10px; background: var(--surface); }
.rd-lang button { height: 30px; padding: 0 14px; border-radius: 999px; font-size: 13px; color: var(--ink-2); }
.rd-lang button.is-on { background: var(--ink); color: var(--bg); }
.rd-pair { display: block; padding: .35em .5em; margin: 0 -.5em .35em; }
.rd-pair .rd-ar { text-align: justify; }
.rd-en { display: block; direction: ltr; text-align: left; font-family: var(--f-display); font-size: .62em; line-height: 1.6; color: var(--ink-2); margin-top: .15em; }
.rd-bayt .rd-en { grid-column: 2 / -1; font-size: .55em; }
.rd-sharh { margin: .6em 0 .2em; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); font-size: .62em; }
.rd-sharh summary { cursor: pointer; padding: .5em .9em; font-family: var(--f-ui); font-size: .85em; color: var(--accent); }
.rd-sharh__by { padding: 0 .9em; font-size: .8em; color: var(--ink-3); font-family: var(--f-ui); }
.rd-sharh p { margin: .5em .9em .7em; line-height: 1.7; font-family: var(--f-display); }
.rd-sharh[dir="rtl"] p { font-family: var(--f-ar); font-size: 1.25em; line-height: 2; }
.rd-sharh__q { font-weight: 600; color: var(--ink); font-family: var(--f-ui); font-size: .9em; margin-bottom: .2em !important; }
.rd-tools { row-gap: 6px; }
.reciter { font: inherit; font-size: 13px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); max-width: 190px; }

.further__h{font-size:15px;margin:22px 0 10px}
.further__h .muted{font-weight:400;font-size:12px}

/* work-in-progress notice */
.wip { display: flex; gap: 14px; margin: 18px 0 26px; padding: 16px 18px; border-radius: 14px;
  background: #fbf3e2; border: 1px solid #ecd9ae; color: #5a4520; line-height: 1.6; font-size: 14.5px; }
.wip p { margin: 0 0 8px; } .wip p:last-child { margin: 0; }
.wip__icon { font-size: 22px; line-height: 1.2; }
.wip__title { font-weight: 700; font-size: 16px; color: #4a3712; }
.wip__ar { font-weight: 500; opacity: .8; }
.wip__nl { font-size: 13px; opacity: .85; }
.wip-line { margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: #fbf3e2; border: 1px solid #ecd9ae;
  color: #5a4520; font-size: 13px; line-height: 1.5; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wip, :root:not([data-theme="light"]) .wip-line { background: #2a2416; border-color: #4a3f22; color: #e8d9b5; }
  :root:not([data-theme="light"]) .wip__title { color: #f3e4be; } }
:root[data-theme="dark"] .wip, :root[data-theme="dark"] .wip-line { background: #2a2416; border-color: #4a3f22; color: #e8d9b5; }
:root[data-theme="dark"] .wip__title { color: #f3e4be; }

/* interface language switcher + Arabic interface */
.langsw { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin: 0 4px; }
.langsw button { background: none; border: 0; padding: 4px 9px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.langsw button.is-on { background: var(--accent); color: var(--bg); }
.langsw button[lang="ar"] { font-family: "Amiri", serif; font-size: 15px; line-height: 1; }
html[lang="ar"] body { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", "Amiri", sans-serif; }
html[dir="rtl"] .back svg, html[dir="rtl"] .icon-flip { transform: scaleX(-1); }
html[dir="rtl"] .card__en-tag { margin-left: 0; margin-right: 4px; }
html[dir="rtl"] [lang="en"], html[dir="rtl"] [lang="nl"] { direction: ltr; unicode-bidi: isolate; }
html:not([lang="en"]) .wip__nl { display: none; }
html[lang="ar"] .wip__ar { display: none; }

/* ---------- original-page view (PDF + overlay) ---------- */
.rd-view { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin: 0 0 10px; }
.rd-view button { background: none; border: 0; padding: 6px 14px; font: inherit; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.rd-view button.is-on { background: var(--accent); color: var(--bg); }
.pgv { padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 14px; background: var(--bg-2); }
.pgv__page { position: relative; width: 100%; max-width: 760px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 6px 18px rgba(0,0,0,.06); border-radius: 4px; overflow: hidden; }
.pgv__page canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pgv__hs { position: absolute; border-radius: 4px; cursor: pointer; transition: background .15s, box-shadow .15s; }
.pgv .pgv__hs:hover { background: rgba(47, 93, 80, .08); }
.pgv .pgv__hs.is-active { background: rgba(214, 170, 60, .22); box-shadow: 0 0 0 2px rgba(214, 170, 60, .35); }
.pgv .pgv__hs.is-nr { cursor: not-allowed; }
.pgv__badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; margin-right: 4px; }
.pgbar { position: sticky; top: 64px; z-index: 5; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin: 0 0 12px; box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.pgbar__row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pgbar__opts { margin-top: 6px; font-size: 13px; }
.pgbar__opts .opt__l { color: var(--ink-2); font-size: 12px; margin: 0 2px 0 8px; }
.pgbar__opts .opt__l:first-child { margin-left: 0; }
.pgbar__play { width: 40px; height: 40px; }
.pgbar__part { font-size: 13px; color: var(--ink-2); margin-left: 4px; }
.pgbar__tr { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.55; color: var(--ink-2); max-height: 7.5em; overflow: auto; }
.pgbar .reciter { margin-left: 8px; }
@media (max-width: 600px) {
  .pgv { padding: 6px; gap: 8px; }
  .pgbar { top: 56px; padding: 6px 8px; }
  .pgbar__opts { font-size: 12px; }
}
/* skip link: clipped rather than parked off-screen (left:-999px overflows RTL pages) */
.skip { left: 8px !important; right: auto; clip-path: inset(50%); }
.skip:focus { clip-path: none; }
@media (max-width: 480px) {
  .brand__name { display: none; }
  .topnav { gap: 2px; }
  .topnav a { padding-inline: 8px; }
  .langsw button { padding: 4px 7px; }
}
@media (max-width: 600px) {
  .pgbar__row { gap: 4px; }
  .pgbar .chip-btn { padding: 3px 8px; font-size: 12px; min-height: 0; }
  .pgbar__opts .opt__l { margin-left: 4px; }
  .pgbar__play { width: 36px; height: 36px; }
  .pgbar__tr { max-height: 4.8em; font-size: 13px; }
}
.pgbar, .pgv { min-width: 0; max-width: 100%; }
.pgbar { overflow: hidden; }
