/* ============ Design tokens ============ */
:root {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --surface-2: #f0ede7;
  --text: #1d1b18;
  --text-2: #5f5a52;
  --text-3: #8f897f;
  --line: rgba(29, 27, 24, 0.10);
  --accent: #b4552d;
  --accent-ink: #ffffff;
  --accent-soft: rgba(180, 85, 45, 0.12);
  --chrome: rgba(247, 245, 241, 0.72);
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.08);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.06), 0 24px 60px rgba(0,0,0,.18);
  --scrim: rgba(20, 18, 15, 0.38);
  --hl-yellow: rgba(255, 214, 10, 0.38);
  --hl-green: rgba(52, 199, 89, 0.28);
  --hl-blue: rgba(10, 132, 255, 0.24);
  --hl-pink: rgba(255, 55, 140, 0.24);
  --hl-orange: rgba(255, 149, 0, 0.32);
  --radius: 14px;
  --reader-size: 1.15rem;
  --reader-leading: 1.8;
  --reader-font: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --ui-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --spring: cubic-bezier(.2, .9, .25, 1);
  color-scheme: light;
}
:root[data-theme="sepia"] {
  --bg: #f3e9d7; --surface: #fbf4e6; --surface-2: #ecdfc8;
  --text: #3b2f22; --text-2: #6b5a45; --text-3: #957f63;
  --line: rgba(59, 47, 34, 0.14); --chrome: rgba(243, 233, 215, 0.75);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="sepia"]):not([data-theme="winter"]):not([data-theme="sakura"]):not([data-theme="autumn"]) {
    --bg: #121110; --surface: #1c1b19; --surface-2: #262421;
    --text: #f2efe9; --text-2: #b7b0a5; --text-3: #847d72;
    --line: rgba(255,255,255,0.10); --accent: #e0835a; --accent-soft: rgba(224,131,90,0.16);
    --chrome: rgba(18,17,16,0.72); --scrim: rgba(0,0,0,0.55);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
    --hl-yellow: rgba(255, 214, 10, 0.30); --hl-green: rgba(52,199,89,.28);
    --hl-blue: rgba(64,156,255,.30); --hl-pink: rgba(255,80,160,.28); --hl-orange: rgba(255,159,10,.30);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121110; --surface: #1c1b19; --surface-2: #262421;
  --text: #f2efe9; --text-2: #b7b0a5; --text-3: #847d72;
  --line: rgba(255,255,255,0.10); --accent: #e0835a; --accent-soft: rgba(224,131,90,0.16);
  --chrome: rgba(18,17,16,0.72); --scrim: rgba(0,0,0,0.55);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
  --hl-yellow: rgba(255, 214, 10, 0.30); --hl-green: rgba(52,199,89,.28);
  --hl-blue: rgba(64,156,255,.30); --hl-pink: rgba(255,80,160,.28); --hl-orange: rgba(255,159,10,.30);
  color-scheme: dark;
}

/* ---- Giao diện theo mùa ---- */
:root[data-theme="winter"] {
  --bg: #16202c; --surface: #1e2a38; --surface-2: #283646;
  --text: #eef3f8; --text-2: #b3c2d1; --text-3: #7d90a3;
  --line: rgba(255,255,255,0.10); --accent: #7cb8e8; --accent-soft: rgba(124,184,232,0.16);
  --chrome: rgba(22,32,44,0.75); --scrim: rgba(0,0,0,0.55);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
  color-scheme: dark;
}
:root[data-theme="sakura"] {
  --bg: #fdf2f5; --surface: #fff8fa; --surface-2: #f8e3ea;
  --text: #3d2a31; --text-2: #6e5560; --text-3: #a08591;
  --line: rgba(61,42,49,0.12); --accent: #d6457a; --accent-soft: rgba(214,69,122,0.12);
  --chrome: rgba(253,242,245,0.75);
}
:root[data-theme="autumn"] {
  --bg: #f6ecdc; --surface: #fcf5ea; --surface-2: #eedcc2;
  --text: #3a2618; --text-2: #6d4c34; --text-3: #9c7a5c;
  --line: rgba(58,38,24,0.14); --accent: #c2410c; --accent-soft: rgba(194,65,12,0.12);
  --chrome: rgba(246,236,220,0.75);
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 100%/1.5 var(--ui-font);
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; -webkit-tap-highlight-color: transparent; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
svg { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* press feedback lives on pointer-down */
.press { transition: transform .12s ease-out, background-color .2s ease, opacity .2s; }
.press:active { transform: scale(.96); }

/* ============ Top bar (translucent chrome) ============ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 20px;
  background: var(--chrome);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; font-size: 1.05rem; color: var(--text); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.nav { display: flex; gap: 4px; margin-left: 24px; }
.nav a {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  color: var(--text-2); text-decoration: none; font-weight: 550; font-size: .95rem;
  transition: background-color .2s, color .2s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.topbar .spacer { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }

/* bottom tab bar on phones */
.tabbar { display: none; }
@media (max-width: 760px) {
  .nav { display: none; }
  .topbar { padding: 0 12px; height: 54px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--chrome);
    -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--line);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: .7rem; color: var(--text-3); text-decoration: none; font-weight: 600; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  main { padding-bottom: 84px; }
}

/* ============ Layout ============ */
main { min-height: calc(100vh - 60px); }
.view { display: none; animation: viewIn .35s var(--spring); }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.container { max-width: 1080px; margin: 0 auto; padding: 32px 20px 64px; }
.container.narrow { max-width: 760px; }
h1.page-title { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; letter-spacing: -0.025em; margin: 8px 0 6px; }
.page-sub { color: var(--text-2); margin: 0 0 28px; }
.section-title { font-size: 1.25rem; letter-spacing: -0.015em; margin: 40px 0 14px; display: flex; align-items: center; justify-content: space-between; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  background: var(--surface-2); color: var(--text);
  transition: transform .12s ease-out, background-color .2s, filter .2s;
}
.btn:active { transform: scale(.96); }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.small { height: 34px; padding: 0 14px; font-size: .85rem; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* ============ Home ============ */
.votd {
  position: relative; overflow: hidden; border-radius: 22px; padding: 64px 40px 32px;
  color: #fff; min-height: 300px; display: flex; flex-direction: column; justify-content: flex-end;
  background: var(--votd-bg, linear-gradient(135deg, #8a3d1f, #d9844e));
  box-shadow: var(--shadow-lg);
}
.votd::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 80% at 100% 0%, rgba(255,255,255,.18), transparent 60%); pointer-events: none; }
.votd .eyebrow { position: absolute; top: 24px; left: 40px; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; opacity: .85; }
.votd blockquote { margin: 0; font-family: var(--reader-font); font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.35; letter-spacing: -0.01em; text-wrap: pretty; position: relative; z-index: 1; }
.votd .ref { margin-top: 16px; font-weight: 700; opacity: .92; position: relative; z-index: 1; }
.votd .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; position: relative; z-index: 1; }
.votd .btn { background: rgba(255,255,255,.18); color: #fff; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.votd .btn:hover { background: rgba(255,255,255,.28); }
@media (max-width: 600px) { .votd { padding: 56px 22px 24px; } .votd .eyebrow { left: 22px; } }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tile { padding: 20px; display: flex; flex-direction: column; gap: 6px; text-align: left; cursor: pointer; transition: transform .15s ease-out, box-shadow .2s; }
.tile:hover { box-shadow: var(--shadow-lg); }
.tile:active { transform: scale(.98); }
.tile .k { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 700; }
.tile .v { font-weight: 650; font-size: 1.05rem; letter-spacing: -0.01em; }
.tile .s { color: var(--text-2); font-size: .9rem; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .5s var(--spring); }

/* ============ Reader ============ */
.reader-bar {
  position: sticky; top: 60px; z-index: 20;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 12px; background: var(--chrome);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line);
}
@media (max-width: 760px) { .reader-bar { top: 54px; } }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-weight: 650; font-size: .95rem; box-shadow: 0 1px 2px rgba(0,0,0,.04);
  white-space: nowrap; max-width: 60vw; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 480px) { #btnFocus { display: none; } #btnVersion { height: 34px; padding: 0 10px; font-size: .78rem; } #btnPicker { max-width: 42vw; } .reader-bar { gap: 2px; padding: 8px 6px; } .reader-bar .icon-btn { width: 36px; } .reader-bar > span { display: none; } }
.chip:hover { background: var(--surface-2); }
.chip .muted { color: var(--text-3); font-weight: 600; }
.ver-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.ver-seg button { height: 36px; padding: 0 14px; border-radius: 999px; background: var(--surface-2); font-weight: 650; font-size: .88rem; transition: transform .12s ease-out, background-color .2s; }
.ver-seg button:active { transform: scale(.94); }
.ver-seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.reader { max-width: 720px; margin: 0 auto; padding: 40px 24px 140px; }
.reader h2.chapter-title { font-family: var(--reader-font); font-weight: 600; font-size: 1rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); text-align: center; margin: 0; }
.reader .chapter-num { font-family: var(--reader-font); text-align: center; font-size: 4rem; line-height: 1; letter-spacing: -0.03em; margin: 8px 0 32px; color: var(--text); font-weight: 500; }
.scripture { font-family: var(--reader-font); font-size: var(--reader-size); line-height: var(--reader-leading); text-wrap: pretty; }
.scripture.sans { font-family: var(--ui-font); }
.scripture.lines .v { display: block; margin-bottom: .35em; }
.v {
  cursor: pointer; border-radius: 4px; padding: 1px 0;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
  transition: background-color .2s ease;
}
.v sup { font-family: var(--ui-font); font-size: .62em; font-weight: 700; color: var(--text-3); margin: 0 .25em 0 .1em; vertical-align: .55em; user-select: none; }
.scripture.no-nums .v sup { display: none; }
.v.sel { text-decoration: underline dotted var(--accent); text-decoration-thickness: 2px; text-underline-offset: .28em; }
.v.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }
.v[data-hl="yellow"] { background: var(--hl-yellow); }
.v[data-hl="green"] { background: var(--hl-green); }
.v[data-hl="blue"] { background: var(--hl-blue); }
.v[data-hl="pink"] { background: var(--hl-pink); }
.v[data-hl="orange"] { background: var(--hl-orange); }
.v .mark { display: inline-block; vertical-align: .1em; margin-left: .2em; color: var(--accent); }
.v.speaking { background: var(--accent-soft); }
.chapter-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 56px; }
.fab-nav {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 15;
  width: 48px; height: 48px; border-radius: 999px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--text-2);
}
.fab-nav:hover { color: var(--text); }
.fab-nav.prev { left: 24px; } .fab-nav.next { right: 24px; }
@media (max-width: 1000px) { .fab-nav { display: none; } }
.version-note { text-align: center; color: var(--text-3); font-size: .8rem; margin-top: 40px; }

/* audio bar */
.audio-bar {
  position: fixed; left: 50%; bottom: 24px; z-index: 25;
  transform: translate(-50%, 140%); opacity: 0;
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 16px; border-radius: 999px;
  background: var(--chrome); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transition: transform .45s var(--spring), opacity .3s;
}
.audio-bar.show { transform: translate(-50%, 0); opacity: 1; }
.audio-bar .lbl { font-weight: 650; font-size: .9rem; white-space: nowrap; }
.audio-bar select { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 8px; font-size: .85rem; }
.audio-bar #audioVoice { max-width: 170px; min-width: 0; text-overflow: ellipsis; }
@media (max-width: 480px) { .audio-bar .lbl { display: none; } .audio-bar #audioVoice { max-width: 130px; } }
@media (max-width: 760px) { .audio-bar { bottom: 84px; } }

/* verse action sheet */
.verse-sheet {
  position: fixed; left: 50%; bottom: 20px; z-index: 40; width: min(560px, calc(100% - 24px));
  transform: translate(-50%, calc(100% + 40px)); opacity: 0; pointer-events: none;
  padding: 14px; border-radius: 22px;
  background: var(--chrome); -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transition: transform .45s var(--spring), opacity .25s;
  touch-action: none;
}
.verse-sheet.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.verse-sheet .grab { width: 36px; height: 5px; border-radius: 99px; background: var(--text-3); opacity: .4; margin: -4px auto 10px; }
.verse-sheet .ref { font-weight: 700; font-size: .95rem; display: flex; justify-content: space-between; align-items: center; padding: 0 4px 10px; }
.swatches { display: flex; gap: 10px; padding: 4px 4px 12px; align-items: center; }
.swatch { width: 34px; height: 34px; border-radius: 999px; border: 2px solid transparent; transition: transform .12s ease-out; }
.swatch:active { transform: scale(.88); }
.swatch[data-c="yellow"] { background: #ffd60a; } .swatch[data-c="green"] { background: #34c759; }
.swatch[data-c="blue"] { background: #0a84ff; } .swatch[data-c="pink"] { background: #ff378c; }
.swatch[data-c="orange"] { background: #ff9500; }
.swatch.none { background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); }
.swatch.on { border-color: var(--text); }
.sheet-actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sheet-actions button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px; border-radius: 12px; font-size: .75rem; font-weight: 600; color: var(--text-2); }
.sheet-actions button:hover { background: var(--surface-2); color: var(--text); }
.sheet-actions button[aria-pressed="true"] { color: var(--accent); }

/* ============ Popovers & modals ============ */
.scrim { position: fixed; inset: 0; z-index: 45; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.scrim.show { opacity: 1; pointer-events: auto; }
.modal {
  position: fixed; z-index: 50; left: 50%; top: 50%;
  width: min(640px, calc(100% - 24px)); max-height: min(80vh, 760px);
  transform: translate(-50%, -46%) scale(.96); opacity: 0; pointer-events: none;
  display: flex; flex-direction: column; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transition: transform .4s var(--spring), opacity .22s ease;
}
.modal.show { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
.modal header { display: flex; align-items: center; gap: 8px; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--line); }
.modal header h3 { margin: 0; font-size: 1.1rem; letter-spacing: -0.01em; flex: 1; }
.modal .body { overflow: auto; padding: 16px 22px 22px; overscroll-behavior: contain; }
@media (max-width: 600px) {
  .modal { top: auto; bottom: 0; transform: translate(-50%, 100%); border-radius: 22px 22px 0 0; width: 100%; max-height: 88vh; }
  .modal.show { transform: translate(-50%, 0); }
}
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 999px; gap: 2px; }
.seg button { padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: .88rem; color: var(--text-2); transition: background-color .2s, color .2s; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.book-list { list-style: none; margin: 12px 0 0; padding: 0; }
.book-list > li > button { width: 100%; text-align: left; padding: 12px 6px; border-bottom: 1px solid var(--line); font-weight: 550; display: flex; justify-content: space-between; }
.book-list > li > button .muted { color: var(--text-3); font-weight: 500; font-size: .85rem; }
.book-list > li > button:hover { color: var(--accent); }
.book-list > li.open > button { color: var(--accent); }
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; padding: 12px 0 16px; }
.ch-grid button { height: 46px; border-radius: 12px; background: var(--surface-2); font-weight: 650; transition: transform .12s ease-out, background-color .15s; }
.ch-grid button:hover { background: var(--accent-soft); color: var(--accent); }
.ch-grid button:active { transform: scale(.92); }
.ch-grid button.cur { background: var(--accent); color: var(--accent-ink); }
.filter-input { width: 100%; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 14px; outline: none; }
.filter-input:focus { border-color: var(--accent); }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .lbl { font-weight: 600; }
.setting-row .hint { color: var(--text-3); font-size: .85rem; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 38px; height: 38px; border-radius: 999px; background: var(--surface-2); font-weight: 700; }
.stepper output { min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; color: var(--text-2); }
.theme-dots { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-dots button { width: 34px; height: 34px; border-radius: 999px; border: 2px solid var(--line); }
.theme-dots button[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.switch { position: relative; width: 50px; height: 30px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); transition: background-color .25s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .3s var(--spring); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

textarea.note { width: 100%; min-height: 140px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); padding: 12px 14px; resize: vertical; outline: none; line-height: 1.5; }
textarea.note:focus { border-color: var(--accent); }
.quote-preview { font-family: var(--reader-font); color: var(--text-2); border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; margin: 0 0 14px; font-size: .98rem; }

/* image composer */
.img-canvas-wrap { border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.img-canvas-wrap canvas { width: 100%; height: auto; display: block; }
.bg-picks { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.bg-picks button { width: 40px; height: 40px; border-radius: 10px; border: 2px solid transparent; }
.bg-picks button[aria-pressed="true"] { border-color: var(--text); }

/* ============ Search ============ */
.search-box { position: relative; }
.search-box input { width: 100%; height: 54px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); padding: 0 18px 0 50px; font-size: 1.05rem; outline: none; box-shadow: var(--shadow); }
.search-box input:focus { border-color: var(--accent); }
.search-box svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 6px; }
.filters select { height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); padding: 0 12px; }
.filters label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: .9rem; }
.result-meta { color: var(--text-3); font-size: .9rem; margin: 16px 0 8px; }
.result { display: block; width: 100%; text-align: left; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.result:hover .r-ref { color: var(--accent); }
.r-ref { font-weight: 700; font-size: .9rem; margin-bottom: 2px; transition: color .15s; }
.r-text { font-family: var(--reader-font); color: var(--text-2); line-height: 1.55; }
.r-text mark { background: var(--hl-yellow); color: inherit; border-radius: 3px; padding: 0 1px; }
.empty { text-align: center; color: var(--text-3); padding: 48px 12px; }
.empty svg { margin: 0 auto 12px; opacity: .5; }

/* ============ Plans ============ */
.plan-card { overflow: hidden; display: flex; flex-direction: column; }
.plan-card .cover { height: 120px; display: flex; align-items: flex-end; padding: 14px 18px; color: #fff; font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.plan-card .meta { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.plan-card .meta p { margin: 0; color: var(--text-2); font-size: .92rem; flex: 1; }
.day-list { list-style: none; padding: 0; margin: 0; }
.day-list li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.day-list .check { width: 28px; height: 28px; flex: none; border-radius: 999px; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; transition: background-color .2s, border-color .2s, transform .12s; }
.day-list .check:active { transform: scale(.88); }
.day-list .check.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.day-list .day-k { font-weight: 700; min-width: 72px; }
.day-list .day-v { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; }
.day-list .day-v button { font-size: .88rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-weight: 600; }
.day-list .day-v button:hover { background: var(--accent-soft); color: var(--accent); }
.day-list li.today { background: var(--accent-soft); border-radius: 12px; padding-left: 10px; padding-right: 10px; }

/* ============ My library ============ */
.lib-item { padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; gap: 14px; align-items: flex-start; }
.lib-item .dot { width: 12px; height: 12px; border-radius: 99px; margin-top: 6px; flex: none; }
.lib-item .body { flex: 1; min-width: 0; cursor: pointer; }
.lib-item .when { color: var(--text-3); font-size: .8rem; }
.lib-item .note-text { margin-top: 6px; white-space: pre-wrap; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
.stat { padding: 16px; }
.stat b { display: block; font-size: 1.6rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--text-3); font-size: .85rem; }
@media (max-width: 600px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* toast */
.toast {
  position: fixed; left: 50%; top: 76px; z-index: 60;
  transform: translate(-50%, -20px) scale(.96); opacity: 0; pointer-events: none;
  padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  transition: transform .4s var(--spring), opacity .2s;
}
.toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; }

/* focus mode hides chrome */
body.focus .topbar, body.focus .tabbar { transform: translateY(-100%); opacity: 0; pointer-events: none; }
body.focus .tabbar { transform: translateY(100%); }
body.focus .reader-bar { top: 0; }
.topbar, .tabbar { transition: transform .4s var(--spring), opacity .3s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .15s !important; }
  .verse-sheet, .modal, .audio-bar, .toast { transition-property: opacity !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar, .tabbar, .reader-bar, .verse-sheet, .audio-bar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
}
@media print {
  .topbar, .tabbar, .reader-bar, .fab-nav, .chapter-nav, .audio-bar, .verse-sheet { display: none !important; }
  .reader { padding: 0; }
}
