:root {
  color-scheme: light;
  --canvas: #faf7f0;
  --surface: #ffffff;
  --surface-muted: #f5e9cf;
  --ink: #2b1b12;
  --ink-muted: #766b61;
  --line: #ded6c9;
  --gold: #c88a17;
  --gold-soft: #f8ebce;
  --selection: #e9edf2;
  --selection-line: #667b92;
  --focus: #ad7310;
  --reader-size: 19px;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --canvas: #0d0502;
  --surface: #160a04;
  --surface-muted: #211108;
  --ink: #f4f0e8;
  --ink-muted: #afa094;
  --line: #28170d;
  --gold: #f2b83f;
  --gold-soft: #160a04;
  --selection: #24313d;
  --selection-line: #b5ccdd;
  --focus: #f2b83f;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: 'Nunito Sans', system-ui, sans-serif;
}
body.menu-open {
  overflow: hidden;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.icon-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  flex: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 70px;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1580px;
  height: 100%;
  margin: auto;
  padding: 0 28px;
}
.header-start,
.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  white-space: nowrap;
  font-family: Literata, Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.055em;
}
.brand img {
  display: block;
}
.brand .brand-wordmark {
  width: auto;
  height: 22px;
}
:root[data-theme='dark'] .brand .brand-wordmark {
  filter: invert(1);
}
.header-divider {
  width: 1px;
  height: 25px;
  background: var(--line);
}
.section-name {
  font-weight: 800;
  color: var(--ink-muted);
}
.back-link {
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.back-link:hover {
  color: var(--gold);
}
.icon-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
}
.icon-button:hover {
  background: var(--surface-muted);
}
.mobile-menu-button,
.mobile-close-button {
  display: none;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(250px, 294px) minmax(0, 1fr);
  max-width: 1580px;
  min-height: calc(100svh - 70px);
  margin: auto;
}
.book-sidebar {
  position: sticky;
  top: 70px;
  display: flex;
  flex-direction: column;
  height: calc(100svh - 70px);
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--canvas);
}
.sidebar-search-row {
  display: flex;
  gap: 8px;
  padding: 18px 18px 15px;
}
.search-field {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 9px;
  min-height: 43px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-muted);
}
.search-field:focus-within {
  border-color: var(--gold);
}
.search-field .icon {
  width: 18px;
  height: 18px;
}
.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}
.search-field input::placeholder {
  color: var(--ink-muted);
}
.testament-tabs {
  display: flex;
  gap: 4px;
  margin: 0 18px 14px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
}
.testament-tab {
  flex: 1;
  min-height: 31px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 800;
}
.testament-tab.active {
  background: var(--surface);
  color: var(--ink);
}
.marks-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin: 0 18px 10px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}
.marks-toggle:hover {
  border-color: var(--gold);
  color: var(--ink);
}
.marks-toggle .icon {
  width: 16px;
  height: 16px;
  color: var(--gold);
}
.marks-count {
  margin-left: auto;
  color: var(--gold);
}
.book-sidebar.marks-mode .search-field,
.book-sidebar.marks-mode .testament-tabs,
.book-sidebar.marks-mode .book-list {
  display: none;
}
.marks-list {
  min-height: 0;
  overflow: auto;
  padding: 0 12px 18px;
}
.mark-entry {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}
.mark-entry:hover {
  background: var(--gold-soft);
}
.empty-marks {
  padding: 12px 10px;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.6;
}
.book-list {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 12px 18px;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}
.book-group-label {
  margin: 19px 10px 7px;
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.book-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-muted);
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}
.book-button:hover {
  background: var(--surface-muted);
  color: var(--ink);
}
.book-button.active {
  background: var(--gold-soft);
  color: var(--ink);
}
.book-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book-button .book-count {
  flex: none;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 600;
}
.empty-books {
  padding: 14px 10px;
  color: var(--ink-muted);
  font-size: 13px;
}
.sidebar-foot {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 11px;
}

.reader-main {
  min-width: 0;
}
.reader-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 62px;
  margin: 0 36px;
  border-bottom: 1px solid var(--line);
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.breadcrumb .icon {
  width: 17px;
  height: 17px;
  color: var(--gold);
}
.breadcrumb span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}
.breadcrumb-separator {
  opacity: 0.4;
}
.reading-tools {
  display: flex;
  gap: 3px;
}
.text-size-button {
  min-width: 32px;
  height: 32px;
  padding: 0 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  font-family: Literata, Georgia, serif;
  font-size: 16px;
}
.text-size-button:hover {
  background: var(--surface-muted);
  color: var(--ink);
}
.text-size-button span {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 12px;
  vertical-align: top;
}
.text-size-large {
  font-size: 20px;
}
.reading-column {
  width: min(100% - 64px, 744px);
  margin: 0 auto;
}
.chapter-intro {
  padding-top: 50px;
}
.chapter-intro h1 {
  margin: 12px 0 8px;
  font-family: Literata, Georgia, serif;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 500;
  line-height: 1.17;
  letter-spacing: -0.06em;
}
.chapter-subtitle {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14px;
}
.chapter-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  margin: 39px 0 31px;
}
.chapter-picker > span {
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 800;
}
.chapter-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 3px;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}
.chapter-chip {
  flex: none;
  min-width: 36px;
  height: 36px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 800;
}
.chapter-chip:hover {
  background: var(--surface-muted);
  color: var(--ink);
}
.chapter-chip.active {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--ink);
}
.chapter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 800;
}
.quiet-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 800;
}
.quiet-button:hover {
  background: var(--surface-muted);
  color: var(--ink);
}
.quiet-button .icon {
  width: 16px;
  height: 16px;
}
.reading-status {
  min-height: 50px;
  padding: 14px 0;
  color: var(--ink-muted);
  font-size: 13px;
}
.reading-status:empty {
  display: none;
}
.verses {
  padding: 16px 0 35px;
  font-family: Literata, Georgia, serif;
  font-size: var(--reader-size);
  line-height: 1.95;
  overflow-wrap: break-word;
}
.verse {
  margin: 0 0 0.82em;
  padding: 0 7px;
  border-left: 2px solid transparent;
  scroll-margin-top: 90px;
}
.verse.selected {
  border-left-color: var(--selection-line);
  border-radius: 0 7px 7px 0;
  background: var(--selection);
}
.verse.marked {
  border-left-color: var(--gold);
  border-radius: 0 7px 7px 0;
  background: var(--gold-soft);
}
.verse.selected.marked {
  background: var(--gold-soft);
  outline: 1px solid var(--selection-line);
  outline-offset: -1px;
}
.verse-number {
  margin-right: 0.58em;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gold);
  font-family: 'Nunito Sans', sans-serif;
  font-size: 0.62em;
  font-weight: 800;
  vertical-align: 0.42em;
}
.verse-number:hover {
  text-decoration: underline;
}
.verse-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 5px 0 5px 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  vertical-align: middle;
}
.selection-count {
  padding: 0 5px;
  color: var(--ink-muted);
  font-family: 'Nunito Sans', sans-serif;
  font-size: 10px;
  font-weight: 800;
}
.verse-action {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-muted);
  font-family: 'Nunito Sans', sans-serif;
  font-size: 11px;
  font-weight: 800;
}
.verse-action:hover,
.verse-action[aria-pressed='true'] {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--ink);
}
.verse-action-clear {
  min-width: 26px;
  padding: 1px 6px 3px;
  border-color: transparent;
  font-size: 18px;
  line-height: 1;
}
.verse-action.whatsapp-share {
  display: inline-grid;
  width: 30px;
  height: 28px;
  padding: 4px;
  place-items: center;
  border-color: #cdebd7;
  background: #edf8f0;
  color: #16833f;
}
.verse-action.whatsapp-share:hover {
  border-color: #16833f;
  background: #dff3e5;
}
.verse-action.whatsapp-share .icon {
  width: 17px;
  height: 17px;
  fill: currentColor;
  stroke: none;
  fill-rule: evenodd;
}
:root[data-theme='dark'] .verse-action.whatsapp-share {
  border-color: #245539;
  background: #14281b;
  color: #58d982;
}
:root[data-theme='dark'] .verse-action.whatsapp-share:hover {
  border-color: #58d982;
  background: #1c3926;
}
.chapter-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 30px 0 42px;
  border-top: 1px solid var(--line);
}
.chapter-nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}
.chapter-nav-button:hover:not(:disabled) {
  border-color: var(--gold);
  background: var(--surface-muted);
}
.chapter-nav-button:disabled {
  opacity: 0.4;
  cursor: default;
}
.chapter-nav-button .icon {
  color: var(--gold);
}
.chapter-nav-button span {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.chapter-nav-button small {
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
}
.chapter-nav-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Literata, Georgia, serif;
  font-size: 14px;
  font-weight: 500;
}
.chapter-nav-button.next {
  justify-content: flex-end;
  text-align: right;
}
.reader-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0 35px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 11px;
}
.reader-footer a {
  color: var(--gold);
  font-weight: 800;
  text-decoration: none;
}
.reader-footer a:hover {
  text-decoration: underline;
}
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: min(90vw, 330px);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--ink);
  color: var(--canvas);
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 246px minmax(0, 1fr);
  }
  .reading-column {
    width: min(100% - 48px, 744px);
  }
  .reader-topline {
    margin: 0 24px;
  }
}

@media (max-width: 700px) {
  .site-header {
    height: 60px;
  }
  .site-header-inner {
    padding: 0 13px;
  }
  .header-start {
    gap: 10px;
  }
  .brand {
    font-size: 21px;
  }
  .brand img {
    width: 30px;
    height: 30px;
  }
  .brand .brand-wordmark {
    width: auto;
    height: 20px;
  }
  .header-divider,
  .back-link {
    display: none;
  }
  .section-name {
    font-size: 13px;
  }
  .mobile-menu-button,
  .mobile-close-button {
    display: grid;
  }
  .app-shell {
    display: block;
    min-height: calc(100svh - 60px);
  }
  .book-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 42;
    width: min(330px, calc(100vw - 52px));
    height: 100dvh;
    border-right: 1px solid var(--line);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
  }
  .sidebar-search-row {
    padding-top: 18px;
  }
  .mobile-close-button {
    flex: 0 0 auto;
  }
  .book-sidebar.open {
    transform: translateX(0);
  }
  .mobile-scrim:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgb(20 9 3 / 56%);
  }
  .reader-topline {
    height: 51px;
    margin: 0 18px;
  }
  .reading-column {
    width: min(100% - 36px, 744px);
  }
  .chapter-intro {
    padding-top: 36px;
  }
  .chapter-picker {
    gap: 10px;
    margin: 30px 0 24px;
  }
  .verses {
    line-height: 1.86;
  }
  .reader-footer {
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 400px) {
  .section-name {
    display: none;
  }
  .chapter-navigation {
    gap: 8px;
  }
  .chapter-nav-button {
    gap: 5px;
    padding: 8px;
  }
  .chapter-nav-button strong {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .book-sidebar,
  .toast {
    transition: none;
  }
}
