/* مثاني — classic theme: cream paper, gold frame, deep green */
@font-face { font-family: "Amiri"; src: url("../fonts/Amiri-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Amiri"; src: url("../fonts/Amiri-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Naskh"; src: url("../fonts/NotoNaskhArabic.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Hafs"; src: url("../fonts/UthmanicHafs.woff2") format("woff2"); font-display: swap; }

:root {
  --paper: #fbf5e6;
  --paper-2: #f3e9d0;
  --paper-3: #ebdcb8;
  --ink: #1f1a12;
  --ink-2: #5d5443;
  --ink-3: #8a7f69;
  --gold: #a9853a;
  --gold-2: #c9a95e;
  --gold-soft: rgba(169, 133, 58, .18);
  --green: #0e3b2e;
  --green-2: #1d5a45;
  --on-green: #f6efd9;
  --accent: #0e3b2e;
  --select: rgba(201, 169, 94, .32);
  --play: rgba(29, 90, 69, .16);
  --note: #b4522d;
  --line: rgba(31, 26, 18, .12);
  --shadow: 0 10px 30px rgba(40, 30, 10, .18);
  --surface: #fffaf0;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #13120f; --paper-2: #1c1a15; --paper-3: #2a261d;
    --ink: #ece4cf; --ink-2: #b9ae95; --ink-3: #8b8270;
    --gold: #c7a45a; --gold-2: #9c7e3e; --gold-soft: rgba(199, 164, 90, .16);
    --green: #0b2a21; --green-2: #3f9474; --on-green: #ece4cf; --accent: #c7a45a;
    --select: rgba(199, 164, 90, .26); --play: rgba(63, 148, 116, .22);
    --note: #e08a62; --line: rgba(236, 228, 207, .12); --surface: #1a1814;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #13120f; --paper-2: #1c1a15; --paper-3: #2a261d;
  --ink: #ece4cf; --ink-2: #b9ae95; --ink-3: #8b8270;
  --gold: #c7a45a; --gold-2: #9c7e3e; --gold-soft: rgba(199, 164, 90, .16);
  --green: #0b2a21; --green-2: #3f9474; --on-green: #ece4cf; --accent: #c7a45a;
  --select: rgba(199, 164, 90, .26); --play: rgba(63, 148, 116, .22);
  --note: #e08a62; --line: rgba(236, 228, 207, .12); --surface: #1a1814;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); overflow: hidden; }
body { font-family: "Naskh", "Amiri", system-ui, sans-serif; font-size: 16px; -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 24px; height: 24px; flex: none; }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; }

/* ---------- reader: horizontal pages, right to left ---------- */
.reader {
  position: absolute; inset: 0;
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  background: var(--paper);
}
.reader::-webkit-scrollbar { display: none; }
.slide {
  flex: 0 0 100%; width: 100%; height: 100%;
  scroll-snap-align: center; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--safe-top) + 10px) 10px calc(var(--safe-bottom) + 10px);
}
.page {
  position: relative; height: 100%; width: 100%; min-width: 0;
  max-width: calc((100vh - var(--safe-top) - var(--safe-bottom) - 20px) * .66);
  display: flex; flex-direction: column;
  padding: 12px 12px 8px;
  background: var(--paper);
  border: 1.5px solid var(--gold);
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px var(--gold-2);
  border-radius: 3px;
}
.page-head, .page-foot {
  display: flex; justify-content: space-between; align-items: center;
  font-family: "Amiri", serif; font-size: 13px; color: var(--ink-2);
  padding: 0 6px; height: 22px; flex: none;
}
.page-foot { justify-content: center; }
.page-num {
  min-width: 34px; height: 20px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--gold-2); border-radius: 10px; font-size: 13px; color: var(--ink-2);
}
.lines { flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding: 4px 2px; min-height: 0; min-width: 0; overflow: hidden; }
.ln { display: flex; align-items: center; justify-content: space-between; white-space: nowrap; line-height: 1; flex: 1; min-height: 0; min-width: 0; color: var(--ink); }
.ln.center { justify-content: center; gap: .18em; }
.w { display: inline-block; padding: .06em 0; border-radius: 4px; cursor: pointer; transition: background-color .15s; }
.w.sel { background: var(--select); }
.w.playing { background: var(--play); }
.w.has-note { text-decoration: underline 1.5px var(--note); text-underline-offset: .28em; }
.w.end { color: var(--ink); }

/* opening pages (al-Fatiha and the start of al-Baqarah) */
.page.opening .lines { justify-content: center; gap: 4%; padding: 8% 10%; }
.page.opening .ln { flex: none; }
.page.opening { box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px var(--gold-2), inset 0 0 0 10px var(--paper), inset 0 0 0 11px var(--gold-soft); }

/* surah name frame and basmala */
.ln.sura { justify-content: center; }
.sura-frame {
  position: relative; width: 100%; height: 86%; display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-family: "Amiri", serif; font-weight: 700;
}
.sura-frame svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sura-frame span { position: relative; font-size: .8em; letter-spacing: 0; padding-bottom: .12em; }
.ln.bsm { justify-content: center; gap: .2em; }

/* ---------- chrome ---------- */
.topbar, .toolbar {
  position: absolute; left: 0; right: 0; z-index: 10;
  background: var(--green); color: var(--on-green);
  transition: transform .25s ease, opacity .25s ease;
}
.topbar {
  top: 0; padding: calc(var(--safe-top) + 6px) 8px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-bottom: 1px solid var(--gold);
}
.topbar-title { text-align: center; font-family: "Amiri", serif; line-height: 1.2; }
.topbar-title span { display: block; font-size: 18px; font-weight: 700; }
.topbar-title small { color: var(--gold-2); font-size: 12.5px; }
.toolbar {
  bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(var(--safe-bottom) + 6px);
  border-top: 1px solid var(--gold);
}
.toolbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px; font-size: 11px; border-radius: 10px; }
.toolbar button svg { color: var(--gold-2); }
.toolbar button:active { background: rgba(255, 255, 255, .08); }
.chrome-hidden .topbar { transform: translateY(-100%); opacity: 0; pointer-events: none; }
.chrome-hidden .toolbar { transform: translateY(100%); opacity: 0; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; }
.icon-btn:active { background: rgba(255, 255, 255, .1); }
.icon-btn-space { width: 40px; }

/* ---------- panels ---------- */
.panel { position: absolute; inset: 0; z-index: 30; background: var(--paper); display: flex; flex-direction: column; animation: rise .22s ease; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 6px) 8px 8px; background: var(--green); color: var(--on-green);
  border-bottom: 1px solid var(--gold);
}
.panel-head h2 { margin: 0; font-family: "Amiri", serif; font-size: 20px; }
.panel-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 14px calc(var(--safe-bottom) + 24px); user-select: text; -webkit-user-select: text; }

.tabs { display: flex; gap: 6px; background: var(--paper-2); padding: 4px; border-radius: 12px; margin-bottom: 12px; position: sticky; top: -12px; z-index: 2; }
.tabs button { flex: 1; padding: 8px 4px; border-radius: 9px; font-size: 14px; color: var(--ink-2); }
.tabs button.on { background: var(--surface); color: var(--accent); font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: right;
  padding: 11px 6px; border-bottom: 1px solid var(--line);
}
.row:active { background: var(--gold-soft); }
.row .num {
  width: 38px; height: 38px; flex: none; display: flex; align-items: center; justify-content: center;
  font-family: "Amiri", serif; font-size: 14px; color: var(--accent);
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23a9853a' stroke-width='1.3'%3E%3Crect x='8' y='8' width='24' height='24' rx='2'/%3E%3Crect x='8' y='8' width='24' height='24' rx='2' transform='rotate(45 20 20)'/%3E%3C/g%3E%3C/svg%3E");
}
.row .main { flex: 1; min-width: 0; }
.row .title { font-family: "Amiri", serif; font-size: 19px; font-weight: 700; color: var(--ink); }
.row .meta { font-size: 12.5px; color: var(--ink-3); }
.row .side { font-size: 13px; color: var(--ink-3); }

.field { display: flex; gap: 8px; margin-bottom: 12px; }
.input {
  flex: 1; font: inherit; font-size: 16px; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--gold-2); background: var(--surface); color: var(--ink); outline: none;
}
.input:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px var(--gold-soft); }
.btn {
  padding: 10px 16px; border-radius: 12px; background: var(--green); color: var(--on-green);
  font-weight: 700; border: 1px solid var(--gold);
}
.btn.ghost { background: transparent; color: var(--accent); }
.hint { color: var(--ink-3); font-size: 13.5px; line-height: 1.7; }
.empty { text-align: center; color: var(--ink-3); padding: 40px 10px; line-height: 1.9; }

.result { display: block; width: 100%; text-align: right; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.result .ref { font-size: 12.5px; color: var(--gold); font-weight: 700; margin-bottom: 4px; }
.result .txt { font-family: "Hafs", "Amiri", serif; font-size: 21px; line-height: 1.9; color: var(--ink); }
.result mark { background: var(--select); color: inherit; border-radius: 3px; }

.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.setting .label { font-weight: 700; }
.setting .desc { font-size: 12.5px; color: var(--ink-3); }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 10px; padding: 3px; }
.seg button { padding: 6px 12px; border-radius: 8px; font-size: 13.5px; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--accent); font-weight: 700; }

/* ---------- ayah sheet ---------- */
.scrim { position: absolute; inset: 0; z-index: 40; background: rgba(10, 8, 4, .28); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 41;
  max-height: 86vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow);
  border-top: 1px solid var(--gold-2);
  padding-bottom: var(--safe-bottom);
  animation: up .24s cubic-bezier(.2, .8, .2, 1);
}
@keyframes up { from { transform: translateY(100%); } }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--paper-3); margin: 8px auto 4px; flex: none; }
.sheet-body { overflow-y: auto; padding: 4px 16px 16px; user-select: text; -webkit-user-select: text; }
.sheet-ref { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.sheet-ref b { font-family: "Amiri", serif; font-size: 19px; color: var(--accent); }
.sheet-ref small { color: var(--ink-3); }
.ayah-text { font-family: "Hafs", "Amiri", serif; font-size: 23px; line-height: 2; color: var(--ink); margin: 2px 0 12px; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.actions button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px;
  border-radius: 14px; background: var(--paper-2); font-size: 12px; color: var(--ink-2);
}
.actions button svg { color: var(--accent); }
.actions button.on svg { color: var(--note); }
.actions button:active { background: var(--paper-3); }

.toast {
  position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 90px); z-index: 60; transform: translateX(-50%);
  background: var(--green); color: var(--on-green); border: 1px solid var(--gold); padding: 10px 18px;
  border-radius: 14px; font-size: 14px; box-shadow: var(--shadow); white-space: nowrap; animation: fade .2s ease;
}

/* tafsir reader inside the sheet */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 10px; margin: 0 -16px; padding-inline: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; padding: 7px 14px; border-radius: 18px; background: var(--paper-2); color: var(--ink-2); font-size: 14px; border: 1px solid transparent; }
.chips button.on { background: var(--green); color: var(--on-green); border-color: var(--gold); }
.tafsir { font-family: "Naskh", serif; font-size: 17.5px; line-height: 2.05; color: var(--ink); text-align: justify; }
.tafsir p { margin: 0 0 .8em; }
.tafsir h2, .tafsir h3, .tafsir h4 { font-family: "Amiri", serif; color: var(--accent); margin: .8em 0 .3em; }
.sheet-ref .btn.ghost { padding: 4px 10px; font-size: 13px; border-color: var(--gold-2); }
.sep { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); vertical-align: middle; margin: 0 7px; font-style: normal; }
.input { min-width: 0; }
.boot { position: absolute; inset: 0; margin: 0; z-index: 5; display: flex; align-items: center; justify-content: center; font-family: "Amiri", serif; font-size: 20px; color: var(--ink-3); pointer-events: none; }
/* index finder */
#finder-out { margin: -4px 0 12px; }
.jump {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: right; margin-bottom: 8px;
  padding: 12px 14px; border-radius: 14px; background: var(--green); color: var(--on-green);
  border: 1px solid var(--gold); font-size: 16px; font-weight: 700;
}
.jump svg { color: var(--gold-2); order: 2; margin-inline-start: auto; }
.ayah-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px; border-radius: 14px; background: var(--paper-2); border: 1px solid var(--gold-soft); }
.ayah-pick span { flex: 1 0 100%; font-size: 15px; color: var(--ink-2); }
.ayah-pick b { font-family: "Amiri", serif; font-size: 18px; color: var(--accent); }
.ayah-pick .input { flex: 1; }
/* ---------- mini player ---------- */
.player {
  position: absolute; left: 10px; right: 10px; z-index: 12;
  bottom: calc(var(--safe-bottom) + 74px);
  display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 6px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--gold-2); border-radius: 18px;
  box-shadow: var(--shadow); transition: bottom .25s ease; animation: up .24s ease;
}
.chrome-hidden .player { bottom: calc(var(--safe-bottom) + 10px); }
.p-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 40px; border-radius: 12px; color: var(--accent); }
.p-btn:active { background: var(--paper-2); }
.player > .p-btn { flex: 1; min-width: 0; justify-content: flex-start; padding: 0 6px; }
.p-info { display: flex; flex-direction: column; text-align: right; min-width: 0; line-height: 1.35; }
.p-info b { font-family: "Amiri", serif; font-size: 16px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-info small { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-controls { display: flex; align-items: center; gap: 2px; flex: none; }
.p-main { width: 44px; height: 44px; border-radius: 50%; background: var(--green); color: var(--on-green); border: 1px solid var(--gold); }
.p-main svg { color: var(--gold-2); }
.w.playing { background: var(--play); box-shadow: 0 0 0 2px var(--play); }

/* recitation options */
.opt { padding: 10px 0; border-bottom: 1px solid var(--line); }
.opt .label { font-weight: 700; margin-bottom: 8px; color: var(--ink-2); font-size: 14.5px; }
.seg.wrap { display: flex; flex-wrap: wrap; gap: 4px; }
.seg.wrap button { flex: 1 0 auto; }
.reciter { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; background: var(--paper-2); border: 1px solid var(--gold-2); }
.reciter b { font-family: "Amiri", serif; font-size: 18px; color: var(--accent); }
.reciter small { color: var(--ink-3); }
.custom-range { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.custom-range .input { width: 70px; flex: none; text-align: center; padding: 8px; }
.btn.wide { width: 100%; margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px; font-size: 16px; }
.btn.wide svg { color: var(--gold-2); }
.listening .slide { padding-bottom: calc(var(--safe-bottom) + 72px); }

/* top bar: index on the right, search + settings on the left */
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; }
.topbar > .icon-btn { justify-self: start; }
.tb-group { justify-self: end; display: flex; gap: 2px; }

/* ---------- surah context ---------- */
.ctx { font-size: 16px; line-height: 1.9; }
.ctx-here { background: var(--paper-2); border: 1px solid var(--gold-2); border-radius: 16px; padding: 12px 14px; margin: 4px 0 14px; }
.ctx-k { font-size: 12.5px; color: var(--gold); font-weight: 700; margin-bottom: 4px; }
.ctx-sec { display: flex; flex-direction: column; padding: 6px 0 6px 0; border-inline-start: 3px solid var(--gold-2); padding-inline-start: 10px; margin-bottom: 6px; }
.ctx-sec.lvl1 { margin-inline-start: 12px; }
.ctx-sec.lvl2 { margin-inline-start: 24px; }
.ctx-sec b { font-family: "Amiri", serif; font-size: 18px; color: var(--accent); line-height: 1.5; }
.ctx-sec small { color: var(--ink-3); font-size: 12.5px; }
.btn.small { padding: 6px 12px; font-size: 13.5px; margin-top: 4px; border-color: var(--gold-2); }
.ctx-block { padding: 10px 0; border-bottom: 1px solid var(--line); }
.ctx-block h3, .ctx-block summary { font-family: "Amiri", serif; font-size: 18px; color: var(--accent); margin: 0 0 4px; cursor: pointer; }
.ctx-block p { margin: 0; color: var(--ink-2); }
.ctx-text { color: var(--ink); text-align: justify; }
.ctx-text p { margin: 0 0 .6em; }
.q { font-family: "Hafs", "Amiri", serif; font-size: 1.12em; color: var(--accent); }
.ctx-map { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.ctx-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; text-align: right; padding: 8px 10px; border-radius: 10px; background: transparent; }
.ctx-row span { flex: 1; }
.ctx-row small { color: var(--ink-3); white-space: nowrap; }
.ctx-row.on { background: var(--select); font-weight: 700; }
.ctx-row:active { background: var(--paper-2); }
.ctx-src { font-size: 12px; color: var(--ink-3); margin: 8px 0 0; }
.tb-sec { display: block; color: var(--on-green); opacity: .85; font-size: 12px; max-width: 62vw; margin: 1px auto 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-sec:empty { display: none; }

.panel-body.doc { font-size: 16.5px; line-height: 1.95; }
.panel-body.doc h2 { font-family: "Amiri", serif; color: var(--accent); font-size: 20px; margin: 20px 0 4px; }
.panel-body.doc ul { padding-inline-start: 20px; }

/* no desktop-style scrollbars inside panels and sheets */
.panel-body, .sheet-body { scrollbar-width: none; }
.panel-body::-webkit-scrollbar, .sheet-body::-webkit-scrollbar { display: none; }

/* the ayah being recited: tinted words, no boxes */
.w.playing { background: var(--play); color: var(--accent); box-shadow: none; border-radius: 3px; }

/* ---------- search ---------- */
.s-total { margin: 0 0 4px; font-size: 15px; color: var(--ink-2); }
.s-total b { color: var(--accent); font-size: 17px; }
.s-filter { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 0 10px; margin: 0 -14px; padding-inline: 14px; }
.s-filter::-webkit-scrollbar { display: none; }
.s-filter button { flex: none; padding: 6px 12px; border-radius: 16px; background: var(--paper-2); color: var(--ink-2); font-size: 13.5px; }
.s-filter button small { color: var(--ink-3); }
.s-filter button.on { background: var(--green); color: var(--on-green); }
.s-filter button.on small { color: var(--gold-2); }
.s-chips { margin-bottom: 14px; }
.result .ref { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: var(--ink-3); font-weight: 400; font-size: 12.5px; }
.result .ref b { font-family: "Amiri", serif; font-size: 16.5px; color: var(--accent); }
.result .txt mark { background: rgba(201, 169, 94, .4); color: inherit; border-radius: 4px; padding: 0 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.result .anum { font-family: "Hafs", serif; }
#s-jump .jump { margin-bottom: 10px; }
/* ---------- «موضوع السورة» ---------- */
.sura-frame .sura-i { position: absolute; left: calc(12.5% - .5em); top: 50%; transform: translateY(-50%); width: 1.05em; height: 1.05em; color: var(--gold); font-style: normal; display: flex; }
.sura-frame .sura-i svg { width: 100%; height: 100%; }
.ln.sura { cursor: pointer; }
.si-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 4px 0 12px; border-bottom: 1px solid var(--gold-soft); margin-bottom: 8px; }
.si-title { display: flex; flex-direction: column; line-height: 1.2; }
.si-title small { color: var(--gold); font-weight: 700; font-size: 13px; }
.si-title b { font-family: "Amiri", serif; font-size: 32px; color: var(--accent); }
.si-meta { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.si-meta span { font-size: 12px; padding: 3px 9px; border-radius: 10px; background: var(--paper-2); color: var(--ink-2); }
.si-block { padding: 10px 0; border-bottom: 1px solid var(--line); }
.si-block h3, .si-block summary { font-family: "Amiri", serif; font-size: 19px; color: var(--accent); margin: 0 0 6px; cursor: pointer; }
.si-block .ctx-text { font-size: 16.5px; line-height: 2; }
.si-topics { margin: 0; padding: 0; list-style: none; counter-reset: t; }
.si-topics li { counter-increment: t; }
.si-topics button { display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: right; padding: 8px 4px; border-bottom: 1px dashed var(--line); }
.si-topics button::before { content: counter(t, arabic-indic); flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--green); color: var(--gold-2); font-size: 12px; }
.si-topics span { flex: 1; font-size: 15.5px; line-height: 1.7; }
.si-topics small { color: var(--ink-3); white-space: nowrap; font-size: 12px; }
.si-more { text-align: center; text-decoration: none; display: block; margin-top: 8px; }
.memory.intro em { font-style: normal; font-size: 12.5px; color: var(--gold); margin-top: 2px; }
.memory.intro .mem-text { -webkit-line-clamp: 3; }
.topbar-title { cursor: pointer; }
/* iPhone: let sheets and panels scroll to the very end.
   - dvh follows the visible screen (Safari's vh includes the area under its toolbars)
   - a flex child that scrolls needs min-height: 0, older Safari does not infer it
   - contain the scroll so it never moves the page behind */
.sheet { max-height: 86vh; max-height: 86dvh; overflow: hidden; }
.sheet-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; touch-action: pan-y; padding-bottom: calc(var(--safe-bottom) + 28px);
}
.panel { height: 100%; height: 100dvh; }
.panel-body { flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }
.chips, .lib-groups, .s-filter { touch-action: pan-x; overscroll-behavior-x: contain; }