:root {
  color-scheme: light;
  --bg: #f6efe3;
  --bg-2: #e4f0dc;
  --ink: #1c2430;
  --muted: #5c665f;
  --accent: #0f6e6b;
  --accent-soft: #b7ddd6;
  --paper: #fffdf9;
  --paper-2: #f3f7f4;
  --line: #e2ddd3;
  --select: #e5f3f1;
  --select-edge: #0f6e6b;
  --pop: #c4653a;
  --gold: #e3b15a;
  --shadow: 0 16px 40px rgba(28, 36, 48, 0.08);
  --sans: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --radius: 18px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12181c;
  --bg-2: #1a2422;
  --ink: #f4efe7;
  --muted: #b7b0a4;
  --accent: #8fd0c4;
  --accent-soft: #2c4f49;
  --paper: #1b2328;
  --paper-2: #243038;
  --line: #334048;
  --select: #1e3334;
  --select-edge: #8fd0c4;
  --pop: #e08a62;
  --gold: #e3b15a;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(900px 420px at 0% -10%, transparent, transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(26, 115, 232, 0.10), transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.45;
  min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus { left: 0.5rem; top: 0.5rem; background: var(--paper); padding: 0.4rem 0.6rem; z-index: 50; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(0.85rem + env(safe-area-inset-top)) 1rem 0.75rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
}
.top-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  max-width: 68rem;
  margin: 0 auto;
}
.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}
#theme-toggle, .text-btn, .nav-btn, .seg button, #study-toggle, .export, .chip, .jump, .close-x {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
}
#theme-toggle {
  padding: 0.45rem 0.9rem;
  min-height: 44px;
}
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-width: 68rem;
  margin: 0.75rem auto 0;
}
.seg button {
  min-width: 3rem;
  min-height: 40px;
  padding: 0.35rem 0.9rem;
}
.seg button[aria-current="page"] {
  background: var(--accent);
  color: #f7f4ee;
  border-color: var(--accent);
}
html[data-theme="dark"] .seg button[aria-current="page"] { color: #14211a; }
#search-form { max-width: 68rem; margin: 0.7rem auto 0; }
#q {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  min-height: 48px;
  outline: none;
}
#q:focus { border-color: var(--accent); }
.search-hint {
  max-width: 68rem;
  margin: 0.35rem auto 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.results {
  list-style: none;
  margin: 0.45rem auto 0;
  padding: 0.35rem;
  max-width: 68rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  max-height: 50vh;
  overflow: auto;
}
.results button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  display: grid;
  gap: 0.15rem;
}
.results button:hover, .results button:focus-visible { background: var(--select); }
.results .k { color: var(--accent); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }
.results .t { font-weight: 600; }
.results .s { color: var(--muted); font-size: 0.88rem; }
mark { background: #efe2a8; color: inherit; border-radius: 3px; padding: 0 0.1em; }
html[data-theme="dark"] mark { background: #5c5330; }

.layout {
  padding: 0.5rem 1rem 6.5rem;
}
.reading { max-width: 40rem; margin: 0 auto; }
.chapter-kicker {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.reading h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: -0.03em;
  margin: 0.15rem 0 0.35rem;
}
.blurb { color: var(--muted); font-size: 0.95rem; max-width: 36rem; }
.trans {
  margin: 0.8rem 0 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.themes-row, .people-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0 0.2rem; }
.chip, .jump, .text-btn, .nav-btn, .export {
  padding: 0.45rem 0.8rem;
  min-height: 40px;
  text-align: left;
}
.chip.person { border-radius: 14px; }
.verse {
  cursor: pointer;
  margin: 0.15rem 0;
  padding: 0.55rem 0.65rem 0.55rem 0.7rem;
  border-radius: 14px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.75;
}
.verse:hover { background: color-mix(in srgb, var(--select) 65%, transparent); }
.verse.selected {
  background: var(--select);
  border-left-color: var(--select-edge);
}
.vn {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--accent);
  margin-right: 0.4rem;
  font-variant-numeric: tabular-nums;
  vertical-align: super;
}
.name {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--accent-soft);
  padding: 0 0.05rem;
  border-radius: 0;
}
.marker {
  margin: 1.1rem 0 0.15rem;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}
.pager {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 1.4rem;
}
.nav-btn[disabled] { opacity: 0.4; cursor: default; }
.fine {
  margin-top: 1.2rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.study {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1rem 1.2rem;
}
.study h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}
.study-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.2rem;
}
.block { margin: 0 0 0.85rem; }
.block p + p { margin-top: 0.45rem; }
.diagram {
  display: grid;
  gap: 0.35rem;
  margin: 0.4rem 0 0.8rem;
}
.diagram-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; }
.diagram button, .beats button {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  padding: 0.55rem 0.6rem;
  min-height: 44px;
  text-align: left;
  font-size: 0.86rem;
}
.beats { display: grid; gap: 0.35rem; margin: 0.4rem 0 0.8rem; }
.beats button.turn { border-color: var(--accent); }
.cardish {
  background: var(--paper-2);
  border-radius: 14px;
  padding: 0.75rem 0.8rem;
  margin: 0 0 0.55rem;
}
.cardish h4 { margin: 0 0 0.25rem; font-size: 0.98rem; }
.ref {
  display: inline-flex;
  border: 0;
  background: none;
  color: var(--accent);
  padding: 0;
  min-height: 44px;
  font-weight: 650;
  text-align: left;
  border-radius: 0;
}
.cardish .ref { margin-bottom: 0.2rem; }
.cardish p { color: var(--ink); font-size: 0.95rem; }
.meta { color: var(--muted); font-size: 0.78rem; margin-bottom: 0.25rem; }
.dim { opacity: 0.72; }
.note-box textarea {
  width: 100%;
  min-height: 7rem;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 0.7rem;
  line-height: 1.5;
}
.note-actions { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-top: 0.45rem; }
.saved { color: var(--muted); font-size: 0.78rem; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.close-x { padding: 0.35rem 0.7rem; min-height: 36px; }

.top-actions { display: flex; gap: 0.4rem; align-items: center; }
#study-toggle {
  display: none;
  padding: 0.45rem 0.9rem;
  min-height: 44px;
  background: var(--accent);
  color: #f7f4ee;
  border-color: var(--accent);
}
#study-toggle[hidden], #scrim[hidden] { display: none !important; }
html[data-theme="dark"] #study-toggle { color: #14211a; }
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 12, 0.4);
  z-index: 20;
}

.theme-page { max-width: 40rem; margin: 0 auto; padding: 0.4rem 1rem 4rem; }
.theme-page h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2.1rem;
  letter-spacing: -0.03em;
  margin: 0.3rem 0 0.4rem;
}
.thread { list-style: none; margin: 1rem 0 0; padding: 0; }
.thread li {
  position: relative;
  padding: 0 0 1rem 1.3rem;
}
.thread li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
}
.thread li::after {
  content: "";
  position: absolute;
  left: 0.24rem;
  top: 1.15rem;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.thread li:last-child::after { display: none; }
.thread .ref {
  display: inline-flex;
  border: 0;
  background: none;
  color: var(--accent);
  padding: 0;
  min-height: 0;
  font-weight: 600;
  border-radius: 0;
  text-align: left;
}
.thread p { margin-top: 0.2rem; }

dialog {
  width: min(36rem, calc(100vw - 1.5rem));
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  padding: 1.1rem 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(20, 16, 12, 0.45); }
dialog h3 { font-family: var(--serif); font-weight: 500; font-size: 1.6rem; margin: 0.1rem 0 0.2rem; }
dialog .role { color: var(--muted); margin-bottom: 0.7rem; }
dialog p { margin: 0 0 0.7rem; font-size: 1.02rem; line-height: 1.55; }
dialog h4 { margin: 0.8rem 0 0.35rem; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.places { display: flex; flex-wrap: wrap; gap: 0.35rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (min-width: 960px) {
  .layout {
    max-width: 68rem;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 23rem;
    gap: 1.25rem;
    align-items: start;
    padding-bottom: 3rem;
  }
  .reading { margin: 0; justify-self: end; width: min(40rem, 100%); }
  .study {
    position: sticky;
    top: 8.6rem;
    max-height: calc(100vh - 9.4rem);
    overflow: auto;
  }
  #study-toggle, #scrim, #close-study { display: none !important; }
}

@media (max-width: 959px) {
  #study-toggle { display: inline-flex; }
  .layout { padding-bottom: 2rem; }
  .study {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    height: min(82dvh, 740px);
    overflow: auto;
    border-radius: 22px 22px 0 0;
    transform: translateY(110%);
    transition: transform 0.24s ease;
    padding-bottom: calc(1.2rem + env(safe-area-inset-bottom));
  }
  body.study-open .study { transform: translateY(0); }
  body.study-open #study-toggle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .study { transition: none; }
}

.word {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-bottom: 1px dotted var(--accent);
  padding: 0 0.08rem;
  border-radius: 0;
}
.verse.in-set { background: color-mix(in srgb, var(--select) 55%, transparent); }
.verse.has-comment .vn::after { content: " · note"; letter-spacing: 0; text-transform: none; }

.verse-panel {
  margin: 0.2rem 0 0.85rem;
  padding: 0.9rem 0.95rem 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--select-edge);
  border-radius: 16px;
}
.verse-panel .verse-text {
  font-family: var(--serif);
  font-size: 1.28rem;
  line-height: 1.6;
  margin: 0.2rem 0 0.7rem;
}
.panel-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.2rem;
  margin: 0.15rem 0 0.4rem;
}
.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: center;
  margin: 0.35rem 0 0.7rem;
}
.panel-actions .trans { margin: 0; }
.body-copy p { margin: 0 0 0.55rem; }
.study details, .verse-panel details {
  border-top: 1px solid var(--line);
  padding: 0.1rem 0 0.35rem;
}
.study summary, .verse-panel summary {
  cursor: pointer;
  padding: 0.55rem 0;
  font-weight: 650;
}
.thread-note > summary {
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.churches {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.15rem 0.75rem 0.45rem;
  margin: 0.45rem 0 0.6rem;
}
.link-list { margin: 0.2rem 0 0.6rem; padding-left: 1.15rem; }
.link-list li { margin: 0 0 0.55rem; }
.study a, .verse-panel a { color: var(--accent); }
.q-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
}
.discuss { margin: 0.4rem 0 0.2rem; padding-left: 1.2rem; }
.discuss li { margin: 0 0 0.75rem; }
.phrase-quote { font-family: var(--serif); font-style: italic; }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
@media (max-width: 640px) { .compare-grid { grid-template-columns: 1fr; } }

#phrase-pop {
  position: fixed;
  z-index: 60;
  width: min(20rem, calc(100vw - 1rem));
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0.75rem;
}
#phrase-pop textarea {
  width: 100%;
  min-height: 5rem;
  margin: 0.35rem 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 0.55rem;
}

#leader {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  background: var(--paper);
  color: var(--ink);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 0.7rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
}
#leader[hidden] { display: none !important; }
.leader-top, .leader-nav { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; }
.leader-q { margin: 0.25rem 0 0.45rem; font-size: 1.02rem; }
.jump.on { background: var(--accent); color: #f7f4ee; border-color: var(--accent); }
html[data-theme="dark"] .jump.on { color: #14211a; }
body.has-leader .layout { padding-bottom: 12rem; }
@media (max-width: 959px) {
  .study { bottom: var(--leader-space, 0px); }
}

.both-page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.4rem 1rem 3rem;
}
.both-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: -0.03em;
  margin: 0.15rem 0 0.35rem;
}
.both-note {
  max-width: 42rem;
  margin: 0.7rem 0 1rem;
  padding: 0.8rem 0.9rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.both-note p + p { margin-top: 0.35rem; }
.both-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem 1.25rem;
  align-items: start;
}
.both-col {
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.7rem 1rem;
  min-width: 0;
}
.both-col h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  margin: 0.1rem 0 0.3rem;
}
.both-col .verse {
  font-size: 1.05rem;
  line-height: 1.65;
}
.seg button[data-chapter="both"] { padding-inline: 0.85rem; }
@media (max-width: 720px) {
  .both-grid { grid-template-columns: 1fr; }
}

.layer > summary {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 500;
}
.listen-set { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.listen-set select {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 0.3rem 0.75rem;
  max-width: 16rem;
}

.brand { display: flex; align-items: center; gap: 0.75rem; }
.logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(20, 48, 44, 0.18);
}
.local-who { color: var(--muted); font-size: 0.78rem; margin-top: 0.1rem; }
.top-actions .text-btn { padding: 0.45rem 0.8rem; min-height: 44px; }

.gate {
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 0.35rem;
  max-width: 28rem;
  margin: 0 auto;
  padding: calc(2rem + env(safe-area-inset-top)) 1.25rem 3rem;
  animation: rise 0.45s ease;
}
.gate,
.gate[hidden] { display: none !important; }
.logo-lg { width: 88px; height: 88px; border-radius: 22px; margin-bottom: 0.6rem; }
.gate h1 { font-family: var(--serif); font-weight: 500; font-size: 2.4rem; letter-spacing: -0.03em; }
.gate .blurb { margin: 0.35rem 0 0.8rem; }
.gate-actions { display: grid; gap: 0.55rem; width: 100%; margin-top: 0.4rem; }
.gate-btn {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  text-align: left;
  padding: 0.75rem 1rem;
}
.gate-go { background: var(--accent); color: #f7f4ee; border-color: var(--accent); margin-top: 0.35rem; }
.gate-skip { text-align: center; font-weight: 650; margin-top: 0; margin-bottom: 0.35rem; }
html[data-theme="dark"] .gate-go { color: #14211a; }
.gate-note { min-height: 1.2rem; color: var(--pop); font-size: 0.92rem; margin: 0.65rem 0; }
#gate-email { width: 100%; display: grid; gap: 0.4rem; }
#gate-name {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 0.7rem 0.9rem;
}
#gate-email label { font-size: 0.82rem; color: var(--muted); }

.art-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.55rem; margin: 0.9rem 0 0.3rem; }
.scene-art {
  margin: 0;
  padding: 0.35rem;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}
.scene-art.is-on {
  border-color: var(--line);
  background: var(--paper);
}
.scene-svg svg { width: 100%; height: auto; display: block; }
.scene-art figcaption {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.scene-art.is-on figcaption { color: var(--accent); }
.orb { transform-origin: 116px 30px; animation: glow 4.8s ease-in-out infinite; }
.leaf { transform-origin: 110px 36px; animation: sway 5.5s ease-in-out infinite; }
.arc { stroke-dasharray: 120; stroke-dashoffset: 0; animation: draw 6s ease-in-out infinite; }

.reading, .both-page, .theme-page { animation: rise 0.4s ease; }
.verse { transition: background 0.2s ease, transform 0.2s ease; }
.verse:hover { transform: translateX(3px); }
.chip, .seg button, .gate-btn { transition: transform 0.2s ease, background 0.2s ease; }
.chip:hover, .gate-btn:hover { transform: translateY(-1px); }
.themes-row .chip:nth-child(3n+1) { background: #e7f4f2; }
.themes-row .chip:nth-child(3n+2) { background: #f8ece4; }
.themes-row .chip:nth-child(3n) { background: #f4edd8; }
html[data-theme="dark"] .themes-row .chip:nth-child(3n+1) { background: #1c3332; }
html[data-theme="dark"] .themes-row .chip:nth-child(3n+2) { background: #3a2a24; }
html[data-theme="dark"] .themes-row .chip:nth-child(3n) { background: #33301f; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes glow {
  0%, 100% { opacity: 0.78; }
  50% { opacity: 1; }
}
@keyframes sway {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(3deg); }
}
@keyframes draw {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .reading, .both-page, .theme-page, .gate, .orb, .leaf, .arc { animation: none; }
  .verse, .chip, .seg button, .gate-btn, .scene-art { transition: none; }
  .verse:hover, .chip:hover, .gate-btn:hover { transform: none; }
}

.seg button[data-chapter="translations"] { padding-inline: 0.85rem; }
.tx-page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.4rem 1rem 3rem;
}
.tx-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: -0.03em;
  margin: 0.15rem 0 0.35rem;
}
.tx-note {
  max-width: 46rem;
  margin: 0.7rem 0 1rem;
  padding: 0.8rem 0.9rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.tx-note p + p { margin-top: 0.35rem; }
.tx-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin: 0 0 1rem;
}
.tx-tools .seg { margin: 0; max-width: none; }
.tx-verse-row {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.8rem 0.9rem;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.tx-verse-row.is-focus {
  border-color: var(--select-edge);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
}
.tx-verse-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.tx-verse-head .vn {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--accent);
}
.tx-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}
.tx-card {
  min-width: 0;
  padding: 0.65rem 0.7rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.tx-card.locked {
  background: var(--paper-2);
  border-style: dashed;
}
.tx-card .meta { margin-bottom: 0.25rem; }
.tx-card .tx-body {
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.55;
}
.tx-card .tx-empty {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
@media (max-width: 960px) {
  .tx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tx-grid { grid-template-columns: 1fr; }
}
.tx-page { animation: rise 0.4s ease; }
@media (prefers-reduced-motion: reduce) {
  .tx-page { animation: none; }
}

.theme-drop { flex: 1 1 100%; }
.theme-drop summary { cursor: pointer; display: inline-block; }
.theme-drop p { margin: 0.35rem 0 0; max-width: 40rem; }
.themes-row .theme-drop:nth-child(3n+1) summary { background: #e7f4f2; }
.themes-row .theme-drop:nth-child(3n+2) summary { background: #f8ece4; }
.themes-row .theme-drop:nth-child(3n) summary { background: #f4edd8; }
html[data-theme="dark"] .themes-row .theme-drop:nth-child(3n+1) summary { background: #1c3332; }
html[data-theme="dark"] .themes-row .theme-drop:nth-child(3n+2) summary { background: #3a2a24; }
html[data-theme="dark"] .themes-row .theme-drop:nth-child(3n) summary { background: #33301f; }

#plan-form { display: grid; gap: 0.45rem; }
#plan-form input, #plan-form select {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 0.45rem 0.7rem;
}
#people-filter {
  width: 100%;
  max-width: 28rem;
  min-height: 44px;
  margin: 0.4rem 0 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 0.45rem 0.7rem;
}

.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-width: 68rem;
  margin: 0.7rem auto 0;
}
.section-nav button {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  min-height: 44px;
}
.section-nav button[aria-current="page"] {
  background: var(--pop);
  color: #fffaf3;
  border-color: var(--pop);
}
#chapter-seg {
  flex-wrap: nowrap;
  overflow-x: auto;
}
.section-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  margin: 1.35rem 0 0.45rem;
  color: var(--accent);
}
.tx-note {
  background: linear-gradient(180deg, #fff8ef, #f2f7ee);
  border-color: #e4d2b8;
  margin: 1rem 0 1.35rem;
}
html[data-theme="dark"] .tx-note {
  background: linear-gradient(180deg, #24312b, #1b2428);
  border-color: #3e564b;
}
.cardish {
  background: color-mix(in srgb, var(--paper) 78%, #f3e2cc);
}
html[data-theme="dark"] .cardish {
  background: color-mix(in srgb, var(--paper) 80%, #3a2a22);
}
.chapter-kicker { color: var(--pop); }
.reading h2, .tx-title { color: var(--ink); }
html[data-theme="dark"] .reading h2,
html[data-theme="dark"] .tx-title { color: #f4efe7; }
.art-row { margin: 1.35rem 0 1.55rem; }
.plan-row.is-current { border-color: var(--pop); box-shadow: 0 0 0 2px color-mix(in srgb, var(--pop) 35%, transparent); }
.day-list { margin: 0.45rem 0 0; padding-left: 1.2rem; }
.day-list li { margin: 0.55rem 0; }
#gen-form { display: grid; gap: 0.45rem; }
#gen-form input, #gen-form select, #group-join input {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 0.45rem 0.7rem;
}
@media (max-width: 720px) {
  .top-row { flex-wrap: wrap; align-items: flex-start; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .search-hint { display: none; }
  .art-row { grid-template-columns: repeat(var(--art-n, 1), minmax(0, 1fr)); }
  .verse { cursor: auto; }
}

#theme-toggle {
  width: 44px;
  min-width: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#theme-toggle svg { width: 22px; height: 22px; display: block; }
.gen-tree, .gen-tree ul { list-style: none; margin: 0.2rem 0; padding-left: 0.9rem; }
.gen-tree { padding-left: 0; }
.gen-tree li { position: relative; border-left: 2px solid var(--accent); padding: 0.28rem 0 0.28rem 0.75rem; }
.gen-tree li::before { content: ""; position: absolute; left: 0; top: 0.95rem; width: 0.65rem; height: 2px; background: var(--accent); }
.gen-node, .gen-tree .ref, .gen-tree .jump {
  display: inline-block;
  background: #e7f4f2;
  border-radius: 10px;
  padding: 0.2rem 0.55rem;
}
html[data-theme="dark"] .gen-node, html[data-theme="dark"] .gen-tree .ref, html[data-theme="dark"] .gen-tree .jump { background: #1c3332; }
.gen-hit { outline: 2px solid #c4653a; outline-offset: 1px; }
.gen-kids { display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; }
.route-wrap { margin: 0.4rem 0 0.7rem; }
.route-map { width: 100%; height: auto; display: block; }

.real-map { height: 320px; border-radius: 16px; margin: 0.5rem 0 0.8rem; }

.real-map-img { width: 100%; height: auto; display: block; border-radius: 16px; }

.book-pick {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.book-pick select {
  min-height: 40px;
  max-width: 16rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
}

.link-shelf { margin: 0.7rem 0 0.2rem; }
#link-panel > details > summary { display: none; }
#link-panel > details { border: 0; margin: 0.35rem 0 0; }
.chip.is-on { outline: 2px solid var(--accent); outline-offset: 1px; }

.dd-plan { background: var(--paper); border-radius: 28px; padding: 1.4rem 1.1rem 1.2rem; box-shadow: var(--shadow); text-align: center; margin: 0.6rem 0 1.2rem; }
.dd-kicker { letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.75rem; color: var(--muted); margin: 0; }
.dd-title { font-family: var(--serif); font-size: 1.7rem; margin: 0.25rem 0 0.7rem; }
.dd-native { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.dd-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin: 0.55rem 0; }
.dd-chip { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 999px; padding: 0.35rem 0.75rem; font: inherit; cursor: pointer; }
.dd-chip.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
html[data-theme="dark"] .dd-chip.is-on { color: #12181c; }
.dd-dial { display: flex; align-items: center; justify-content: center; gap: 0.9rem; margin: 0.8rem 0 0.2rem; }
.dd-dial-mid { width: 9.5rem; height: 9.5rem; border-radius: 50%; border: 10px solid var(--accent-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--paper-2); }
.dd-minutes { font-size: 3.2rem; line-height: 1; margin: 0; font-family: var(--serif); }
.dd-unit { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.85rem; }
.dd-step { width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.dd-days { display: flex; align-items: center; justify-content: center; gap: 0.8rem; margin: 0.35rem 0 0.7rem; }
.dd-day-label { margin: 0; color: var(--muted); }
.dd-start { display: block; width: min(100%, 16rem); margin: 0.4rem auto 0.5rem; background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 0.9rem 1.2rem; font-size: 1.15rem; font-weight: 650; cursor: pointer; }
html[data-theme="dark"] .dd-start { color: #12181c; }
.dd-more { text-align: left; margin-top: 0.4rem; }
.dd-more summary { cursor: pointer; color: var(--muted); }
.dd-type-input, .dd-more select, .dd-more input { width: 100%; margin: 0.25rem 0 0.55rem; }

.flag-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.15rem; }
.flag-row .meta { margin: 0; }

.people-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.4rem 0 0.2rem; }
.people-tools input, .people-tools select { flex: 1 1 12rem; }

.section-search { width: 100%; margin: 0.4rem 0 0.2rem; }
.section-search-wrap { margin: 0.2rem 0 0.8rem; }

.timeline-tools { display: flex; flex-direction: column; gap: 0.65rem; margin: 0.85rem 0 1rem; }
.timeline-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.timeline-filters button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  min-height: 40px;
  padding: 0.35rem 0.8rem;
}
.timeline-filters button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #f7f4ee;
}
html[data-theme="dark"] .timeline-filters button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #14211a;
}
#timeline-search {
  width: 100%;
  max-width: 28rem;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 0.45rem 0.7rem;
}
#timeline-search:focus { border-color: var(--accent); outline: none; }
html[data-theme="dark"] #timeline-search:focus { border-color: var(--accent); }
.timeline {
  position: relative;
  margin: 0.2rem 0 2rem;
  padding: 0 0 0.2rem 1.35rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 0.28rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 3px;
  background: var(--accent);
  border-radius: 3px;
}
html[data-theme="dark"] .timeline::before { background: var(--accent); }
.timeline-era { margin: 0 0 0.4rem; }
.timeline-era h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
  color: var(--accent);
  margin: 0.9rem 0 0.45rem;
}
html[data-theme="dark"] .timeline-era h3 { color: var(--accent); }
.timeline-card {
  position: relative;
  margin: 0.65rem 0;
  padding: 0.75rem 0.9rem 0.85rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.timeline-card::before {
  content: "";
  position: absolute;
  left: calc(-1.35rem + 0.28rem - 5px);
  top: 1.15rem;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
}
html[data-theme="dark"] .timeline-card::before { background: var(--accent); }
.timeline-card h4 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.12rem;
  margin: 0 0 0.4rem;
}
.timeline-card p { margin-top: 0.45rem; }
.timeline-card .meta { color: var(--muted); font-size: 0.88rem; }
.timeline-card .jump { margin-top: 0.15rem; }
@media (max-width: 640px) {
  .timeline { padding-left: 1.15rem; }
  .timeline-card::before { left: calc(-1.15rem + 0.28rem - 5px); }
  .timeline-filters button { padding-inline: 0.65rem; }
}
