/* ---------- Tokens ---------- */
:root {
  --bg: #faf8f4;
  --bg-elevated: #ffffff;
  --bg-sunken: #f1efe9;
  --text: #211f1c;
  --text-muted: #6f6a62;
  --border: rgba(33, 31, 28, 0.1);
  --accent: #6446e0;
  --accent-contrast: #ffffff;
  --wj: #a6321f;
  --danger: #b3261e;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --selection-underline: #000000;
  --verse-hover: var(--bg-sunken);

  --hl-yellow: 250 204 21;
  --hl-orange: 251 146 60;
  --hl-green: 74 222 128;
  --hl-pink: 244 114 182;
  --hl-blue: 96 165 250;
  --hl-purple: 168 130 246;
  --hl-alpha: 0.35;

  --font-serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17161a;
    --bg-elevated: #201f24;
    --bg-sunken: #131215;
    --text: #ece9e4;
    --text-muted: #a19c93;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #9b86ff;
    --accent-contrast: #17161a;
    --wj: #ff8f7a;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    --hl-alpha: 0.28;
    --selection-underline: #ffffff;
    /* --bg-sunken is barely distinguishable from --bg on dark backgrounds
       (a small hex gap reads as much smaller once both colors are already
       dark) — a translucent white overlay stays visibly different
       regardless of the exact underlying shade. */
    --verse-hover: rgba(255, 255, 255, 0.14);
  }
}
:root[data-theme="dark"] {
  --bg: #17161a;
  --bg-elevated: #201f24;
  --bg-sunken: #131215;
  --text: #ece9e4;
  --text-muted: #a19c93;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #9b86ff;
  --accent-contrast: #17161a;
  --wj: #ff8f7a;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  --hl-alpha: 0.28;
  --selection-underline: #ffffff;
  --verse-hover: rgba(255, 255, 255, 0.14);
}

/* ---------- Reset ---------- */
/* The gray/blue flash mobile Safari/Chrome show on tap for any clickable
   element — unrelated to :focus-visible below, which only concerns the
   (already-desired) keyboard-navigation outline. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
[x-cloak] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}
.brand:hover { color: var(--accent); text-decoration: none; }
.topnav { display: flex; align-items: center; gap: 1.1rem; }
.topnav a { color: var(--text-muted); font-size: 0.92rem; }
.topnav a:hover { color: var(--text); text-decoration: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--text); }
.icon { width: 18px; height: 18px; }

.settings-menu { position: relative; }
.settings-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  max-width: calc(100vw - 2rem);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  z-index: 35;
}
.settings-group { display: flex; flex-direction: column; gap: 0.5rem; }
.settings-row { flex-direction: row; align-items: center; justify-content: space-between; }
.settings-label { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.settings-dropdown .mode-toggle { width: 100%; }
.settings-dropdown .mode-toggle button { flex: 1; }

.search-menu { position: relative; }
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 2rem);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.6rem;
  z-index: 35;
}
.search-input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}
.search-results { margin-top: 0.5rem; max-height: 340px; overflow-y: auto; }
.search-status { font-size: 0.82rem; color: var(--text-muted); text-align: center; padding: 0.6rem 0; margin: 0; }
.search-result {
  display: block;
  padding: 0.55rem 0.5rem;
  border-radius: 8px;
  color: var(--text);
}
.search-result:hover { background: var(--bg-sunken); text-decoration: none; }
.search-result-ref { display: block; font-family: var(--font-sans); font-size: 0.76rem; font-weight: 700; color: var(--accent); margin-bottom: 0.15rem; }
.search-result-text { display: block; font-family: var(--font-serif); font-size: 0.88rem; line-height: 1.4; }

.account-menu { position: relative; }
.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 160px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  z-index: 35;
}
.account-dropdown form { margin: 0; }
.account-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
}
.account-link:hover { background: var(--bg-sunken); text-decoration: none; }

/* On narrow screens, these dropdowns are anchored (right:0) to their own
   small icon button — but that button often isn't near the screen's right
   edge, so a fixed-width box anchored there can run off the left side of
   the viewport entirely. Pin them to the viewport instead of the button. */
@media (max-width: 640px) {
  .search-dropdown, .settings-dropdown, .account-dropdown {
    position: fixed;
    top: 60px;
    left: 1rem;
    right: 1rem;
    width: auto;
    max-width: none;
  }
}

.switch {
  position: relative;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  border: none;
  background: var(--bg-sunken);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-elevated);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.switch.on { background: var(--accent); }
.switch.on .switch-thumb { transform: translateX(16px); }

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 0.92rem;
}
.link-btn:hover { color: var(--text); text-decoration: underline; }
.btn-danger-outline { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.inline-form { display: inline; }

/* ---------- Layout ---------- */
.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}
.page.has-bottom-nav { padding-bottom: 6rem; }

/* ---------- Reader ---------- */
.mode-toggle {
  display: inline-flex;
  background: var(--bg-sunken);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.mode-toggle button {
  border: none;
  background: transparent;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
}
.mode-toggle button.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.chapter-heading {
  font-family: var(--font-serif);
  font-size: 1.9rem;
  margin: 0 0 1.5rem;
  text-align: center;
}

.reader-content { font-family: var(--font-serif); font-size: 1.15rem; }
.section-heading { margin: 1.5rem 0 0.9rem; }
.section-heading h2 {
  font-size: 1.15rem;
  font-family: var(--font-sans);
  font-weight: 700;
  margin: 0 0 0.15rem;
}
.section-heading h3 {
  font-size: 0.95rem;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 0.15rem;
}
.ref-line, .ms-line, .mr-line {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
}
.superscription {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 0.8rem;
}

.para { margin: 0 0 0.5rem; }
.para-q1, .para-q2, .para-q3 { text-align: left; margin: 0 0 0.2rem; }
.para-q1 { padding-left: 1.25rem; }
.para-q2 { padding-left: 2.5rem; }
.para-q3 { padding-left: 3.75rem; }
.para-pc { text-align: center; }
.para-pmo { padding-left: 1.25rem; font-style: italic; }
.para-qa { text-align: center; font-weight: 700; font-family: var(--font-sans); font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.para-qr { text-align: right; }
.para-li1 { padding-left: 1.25rem; }
.para-li2 { padding-left: 2.5rem; }
.stanza-break { height: 0; }

.vnum {
  font-family: var(--font-sans);
  font-size: 0.68em;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 0.2em;
  vertical-align: super;
}
.verse-mode .verse-line { margin: 0 0 0.75rem; }
.verse-mode .vnum { margin-right: 0.4em; }

.wj { color: var(--wj); }
.no-red-letter .wj { color: inherit; }

.verse {
  cursor: pointer;
  border-radius: 4px;
  padding: 0.05em 0;
  transition: background-color 0.15s ease;
}
/* Not CSS :hover — driven by hoveredVerse in verseClasses() (see app.js) so
   a verse split across multiple DOM blocks (a mid-verse paragraph break)
   highlights as one whole verse on hover, the same as selecting it does.
   Mobile still sets hoveredVerse on tap (mouseenter fires there too) —
   scoping the rule out entirely below this width is simpler and more
   reliable than trying to distinguish tap from hover in JS. */
@media (min-width: 641px) {
  .verse.is-hovered { background: var(--verse-hover); }
}
/* A tinted background here was too close to the purple highlight color
   (and needed a separate outline variant to stay visible over an already-
   highlighted verse) — a dotted underline instead reads clearly as
   "selected" regardless of whatever highlight color, if any, sits under it. */
.verse.is-selected {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--selection-underline);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.verse.hl-yellow { background: rgb(var(--hl-yellow) / var(--hl-alpha)); }
.verse.hl-orange { background: rgb(var(--hl-orange) / var(--hl-alpha)); }
.verse.hl-green { background: rgb(var(--hl-green) / var(--hl-alpha)); }
.verse.hl-blue { background: rgb(var(--hl-blue) / var(--hl-alpha)); }
.verse.hl-pink { background: rgb(var(--hl-pink) / var(--hl-alpha)); }
.verse.hl-purple { background: rgb(var(--hl-purple) / var(--hl-alpha)); }
/* Briefly recolors the verse text so it's clear which verse was jumped to.
   A background or outline flash would momentarily paper over any existing
   highlight color underneath (or draw an odd box around it); just
   recoloring the text avoids disturbing the verse itself. */
.verse.flash, .verse.flash .wj {
  /* .wj sets its own explicit color (red-letter), which otherwise wins over
     the inherited flash color on plain text — animate it directly too so
     words-of-Jesus text flashes the same as everything else. */
  animation: flash-verse 2s ease-out forwards;
}
@keyframes flash-verse {
  0%, 70% { color: var(--accent); }
  100% { color: var(--text); }
}

/* ---------- Sign-in hint ---------- */
.signin-hint {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}
.signin-hint span { flex: 1; color: var(--text-muted); }

/* ---------- Highlight toolbar ---------- */
.highlight-toolbar {
  position: fixed;
  left: 50%;
  bottom: 5rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  z-index: 30;
  max-width: calc(100vw - 2rem);
}
.toolbar-swatches, .toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
/* Below this width the hint + 6 swatches + action buttons don't fit on one
   line — rather than let flex-wrap pack them wherever they happen to
   break (arbitrary, and it still looked cramped), stack them as three
   deliberate rows: selection, then colors, then actions. */
@media (max-width: 640px) {
  .highlight-toolbar {
    flex-direction: column;
    align-items: stretch;
    border-radius: 20px;
    width: calc(100vw - 2rem);
  }
  .toolbar-hint { text-align: center; }
  .toolbar-swatches, .toolbar-actions { justify-content: center; flex-wrap: wrap; }
}
.toolbar-hint { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.swatch-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.swatch-count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.6rem;
  line-height: 14px;
  text-align: center;
  pointer-events: none;
}
.swatch-yellow { background: rgb(var(--hl-yellow)); }
.swatch-orange { background: rgb(var(--hl-orange)); }
.swatch-green { background: rgb(var(--hl-green)); }
.swatch-pink { background: rgb(var(--hl-pink)); }
.swatch-blue { background: rgb(var(--hl-blue)); }
.swatch-purple { background: rgb(var(--hl-purple)); }
.swatch.active { outline: 2px solid var(--accent); outline-offset: 2px; }

.highlight-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 1rem; }
.highlight-color-heading { margin-bottom: 1rem; }
.color-chip-name {
  background: none;
  border: none;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-sans);
}
.color-chip-name:hover { color: var(--accent); text-decoration: underline; }
.color-chip-input {
  width: 12rem;
  max-width: 100%;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg-sunken);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
}
.highlight-color-tag { font-weight: 600; }
.filter-all {
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}
.filter-all.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.toolbar-text-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom));
  z-index: 25;
}
.bottom-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--text);
  background: var(--bg-sunken);
}
.bottom-nav-btn svg { width: 20px; height: 20px; }
.bottom-nav-btn.is-disabled { opacity: 0.3; }
.bottom-nav-title {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: none;
  background: var(--bg-sunken);
  border-radius: 999px;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  padding: 0.4rem 1rem;
}
.bottom-nav-title-caret { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }

/* ---------- Book/chapter picker ---------- */
.picker-overlay { position: fixed; inset: 0; z-index: 40; }
.picker-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
/* Anchored near the top rather than flush to the bottom edge — a bottom
   sheet that grows up from the very bottom of the screen ends up mostly (or
   entirely) hidden behind the on-screen keyboard once the filter input is
   focused. Sitting higher up keeps it clear of that regardless of how tall
   any given phone's keyboard is. */
.picker-sheet {
  position: absolute;
  left: 0;
  right: 0;
  top: 6vh;
  top: 6dvh;
  bottom: auto;
  max-height: 72vh;
  max-height: 72dvh;
  background: var(--bg-elevated);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  flex-shrink: 0;
}
.picker-close { font-size: 1.3rem; }
/* flex:1 + min-height:0 makes this the scrollable region within the
   flex-column sheet — without min-height:0, a flex child defaults to
   min-height:auto and grows to its content's natural size instead of
   shrinking to fit, so the sheet's overflow:hidden just clips content
   that's too tall (e.g. the New Testament section) rather than letting
   you scroll to it. */
.picker-body { padding: 1rem 1.25rem 1.5rem; overflow-y: auto; flex: 1; min-height: 0; }
.picker-filter {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}
.book-group h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 1rem 0 0.6rem;
}
.book-group:first-child h4 { margin-top: 0; }
.book-grid, .chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 0.5rem;
}
.chapter-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
.book-chip, .chapter-chip {
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  border-radius: 8px;
  text-align: center;
  color: var(--text);
  cursor: pointer;
}
.book-chip {
  padding: 0.6rem 0.5rem;
  font-size: 0.82rem;
  line-height: 1.25;
}
.chapter-chip { padding: 0.55rem 0.4rem; font-size: 0.85rem; }
.book-chip:hover, .chapter-chip:hover { background: var(--accent); color: var(--accent-contrast); text-decoration: none; }

@media (min-width: 640px) {
  .picker-sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: 680px; max-height: 80vh; border-radius: 16px; }
}

/* Referenced via x-transition:enter but was never defined — plain opacity
   only, so it doesn't fight the desktop centering transform above. */
.picker-enter { animation: picker-enter-anim 0.18s ease-out; }
@keyframes picker-enter-anim {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Forms ---------- */
.auth-card, .note-card, .account-card {
  max-width: 420px;
  margin: 2rem auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}
.note-card { max-width: 640px; }
.auth-card h1, .note-card h1, .account-card h1 { font-family: var(--font-serif); margin-top: 0; }
.account-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.account-field:last-of-type { border-bottom: none; }
.account-field-label { font-size: 0.85rem; color: var(--text-muted); }
.account-field-value { font-size: 0.92rem; font-weight: 600; }
.account-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; }
.account-password { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.field input, .field textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}
.field textarea { min-height: 140px; resize: vertical; font-family: var(--font-serif); white-space: pre-wrap; }
.field-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
  margin-bottom: 1.1rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.4rem;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.btn:hover { opacity: 0.92; text-decoration: none; }
.btn-secondary { background: var(--bg-sunken); color: var(--text); }
.btn-small { padding: 0.45rem 1rem; font-size: 0.82rem; }
.btn-danger { background: var(--danger); color: #fff; }
.form-actions { display: flex; gap: 0.6rem; align-items: center; margin-top: 1.3rem; }
.auth-switch { margin-top: 1.3rem; font-size: 0.88rem; color: var(--text-muted); text-align: center; }

/* ---------- Notes ---------- */
.notes-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.notes-header h1 { font-family: var(--font-serif); margin: 0; }
.notes-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1rem; }
.note-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  background: var(--bg-elevated);
}
.note-item h3 { margin: 0 0 0.4rem; font-family: var(--font-serif); font-size: 1.1rem; }
.note-body { white-space: pre-wrap; font-family: var(--font-serif); line-height: 1.4; margin: 0 0 0.7rem; }
.note-body .ref-link { font-weight: 600; }
.note-meta { display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; color: var(--text-muted); }
.note-actions { display: flex; gap: 0.8rem; }
.note-actions button, .note-actions a { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.78rem; padding: 0; }
.note-actions button:hover, .note-actions a:hover { color: var(--accent); }
.empty-state { color: var(--text-muted); text-align: center; padding: 3rem 1rem; }

/* ---------- Highlights ---------- */
.highlight-item {
  border: 1px solid var(--border);
  border-left: 4px solid transparent;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
}
.highlight-item.hl-yellow { border-left-color: rgb(var(--hl-yellow)); }
.highlight-item.hl-orange { border-left-color: rgb(var(--hl-orange)); }
.highlight-item.hl-green { border-left-color: rgb(var(--hl-green)); }
.highlight-item.hl-blue { border-left-color: rgb(var(--hl-blue)); }
.highlight-item.hl-pink { border-left-color: rgb(var(--hl-pink)); }
.highlight-item.hl-purple { border-left-color: rgb(var(--hl-purple)); }
.highlight-item-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.highlight-ref { font-family: var(--font-sans); font-weight: 700; font-size: 0.92rem; }
.highlight-item-header button { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.78rem; padding: 0; }
.highlight-item-header button:hover { color: var(--accent); }
.highlight-text { font-family: var(--font-serif); line-height: 1.6; margin: 0 0 0.5rem; }
.highlight-date { font-size: 0.78rem; color: var(--text-muted); margin: 0; }

/* ---------- Reading plans ---------- */
.section-subheading { font-family: var(--font-sans); font-size: 0.95rem; margin: 1.75rem 0 0.9rem; }
.plan-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  background: var(--bg-elevated);
  color: var(--text);
}
.plan-card:hover { border-color: var(--accent); text-decoration: none; }
.plan-card h3 { margin: 0 0 0.3rem; font-family: var(--font-serif); }
.plan-progress-text { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--text-muted); }
.plan-progress-bar { height: 8px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.plan-progress-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.plan-meta { margin: 0.5rem 0 0; font-size: 0.78rem; color: var(--text-muted); }

.plans-catalog { display: flex; flex-direction: column; gap: 0.75rem; }
.plan-catalog-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  margin: 0;
}
.plan-catalog-item h3 { margin: 0 0 0.2rem; font-family: var(--font-serif); font-size: 1.05rem; }
.plan-catalog-desc { margin: 0 0 0.3rem; font-size: 0.85rem; color: var(--text-muted); }

.plan-history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.plan-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
}
.plan-history-name { font-family: var(--font-serif); font-size: 0.92rem; }
.plan-history-dates { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }

.plan-show-meta { margin: -0.75rem 0 1.25rem; }
.plan-day-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.plan-day {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  border: 1px solid transparent;
}
.plan-day.is-done { opacity: 0.55; }
.plan-day.is-next { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.plan-day-check { margin: 0; }
.plan-day-checkbox {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--accent-contrast);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.plan-day.is-done .plan-day-checkbox { background: var(--accent); border-color: var(--accent); }
.plan-day-meta { display: flex; flex-direction: column; width: 3.4rem; flex-shrink: 0; }
.plan-day-num { font-family: var(--font-sans); font-size: 0.78rem; color: var(--text-muted); }
.plan-day-date { font-family: var(--font-sans); font-size: 0.7rem; color: var(--text-muted); }
.plan-day-label { font-family: var(--font-serif); font-size: 0.95rem; color: var(--text); }
.plan-day-label:hover { text-decoration: underline; }
span.plan-day-label { cursor: default; }

/* ---------- Error pages ---------- */
.error-page { text-align: center; padding: 4rem 1rem; }
.error-page h1 { font-family: var(--font-serif); font-size: 2.2rem; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
