/* ═══════════════════════════════════════════════════════════════
   PSALMS & PROVERBS PWA — Premium Bible Book Design
   ═══════════════════════════════════════════════════════════════ */

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --leather-dark: #2a1810;
  --leather-mid: #3d2817;
  --leather-light: #4a3020;
  --leather-highlight: #5a3a28;
  --gold: #c9a84c;
  --gold-bright: #e0c468;
  --gold-dim: #a08838;
  --cream: #f5f0e1;
  --cream-dark: #ebe4d0;
  --cream-shadow: #d8cdb5;
  --ink: #2a1810;
  --ink-light: #4a3525;
  --charcoal: #1a1a1a;
  --charcoal-light: #252525;
  --serif: Georgia, "Times New Roman", "Iowan Old Style", "Palatino Linotype", serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--charcoal);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

/* ═══════════════════════════════════════════════════════════════
   COVER SCREEN — Closed Book
   ═══════════════════════════════════════════════════════════════ */

#cover-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #2a2a2a 0%, #1a1a1a 50%, #0d0d0d 100%);
  z-index: 100;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#cover-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* The book cover */
#book-cover {
  cursor: pointer;
  width: 300px;
  height: 420px;
  perspective: 1200px;
  animation: cover-breathe 5s ease-in-out infinite;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
}

#book-cover:active {
  transform: scale(0.97);
}

#book-cover:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 8px;
  border-radius: 4px;
}

@keyframes cover-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.01); }
}

.cover-leather {
  width: 100%;
  height: 100%;
  border-radius: 3px 6px 6px 3px;
  background:
    /* Subtle leather grain via noise */
    radial-gradient(ellipse 60% 40% at 30% 20%, rgba(90,58,40,0.3) 0%, transparent 100%),
    radial-gradient(ellipse 50% 60% at 70% 80%, rgba(42,24,16,0.4) 0%, transparent 100%),
    /* Leather color base */
    linear-gradient(135deg, var(--leather-light) 0%, var(--leather-mid) 40%, var(--leather-dark) 80%, var(--leather-mid) 100%);
  box-shadow:
    /* Spine effect on left */
    inset 8px 0 15px -5px rgba(0,0,0,0.6),
    /* Edge highlight */
    inset -2px 0 4px rgba(90,58,40,0.3),
    /* Bottom shadow for depth */
    0 20px 50px -10px rgba(0,0,0,0.8),
    /* Ambient */
    0 4px 10px rgba(0,0,0,0.4),
    /* Subtle gold edge glow */
    0 0 30px rgba(201,168,76,0.08);
  position: relative;
  overflow: hidden;
}

/* Leather texture overlay */
.cover-leather::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      37deg,
      transparent 0px,
      transparent 2px,
      rgba(0,0,0,0.02) 2px,
      rgba(0,0,0,0.02) 3px
    ),
    repeating-linear-gradient(
      -53deg,
      transparent 0px,
      transparent 3px,
      rgba(255,255,255,0.015) 3px,
      rgba(255,255,255,0.015) 4px
    );
  border-radius: inherit;
  pointer-events: none;
}

/* Gold border frame */
.cover-border {
  position: absolute;
  inset: 18px;
  border: 1.5px solid var(--gold);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-shadow:
    inset 0 0 0 3px var(--leather-mid),
    inset 0 0 0 4px var(--gold-dim);
  text-align: center;
}

/* Inner decorative frame line */
.cover-border::after {
  content: '';
  position: absolute;
  inset: 6px;
  border: 0.5px solid var(--gold-dim);
  border-radius: 1px;
  pointer-events: none;
  opacity: 0.5;
}

.cover-icon {
  margin-bottom: 20px;
  opacity: 0.85;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.cover-title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--gold-bright);
  text-shadow:
    0 1px 0 rgba(255,220,120,0.3),
    0 -1px 0 rgba(0,0,0,0.5),
    0 2px 4px rgba(0,0,0,0.6);
  line-height: 1.3;
  margin-bottom: 8px;
}

.cover-subtitle {
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  color: var(--gold);
  letter-spacing: 2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  margin-bottom: 16px;
}

.cover-divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin-bottom: 14px;
}

.cover-tagline {
  font-family: var(--serif);
  font-size: 11px;
  color: var(--gold-dim);
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* "Tap to open" hint */
.tap-hint {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--serif);
  font-size: 13px;
  color: var(--gold-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  animation: tap-fade 2.5s ease-in-out infinite;
}

@keyframes tap-fade {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.9; }
}

/* ═══════════════════════════════════════════════════════════════
   BOOK SCREEN — Open Book
   ═══════════════════════════════════════════════════════════════ */

#book-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--charcoal);
  z-index: 50;
}

#book-screen[hidden] { display: none; }

/* Top bar */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(180deg, #2a2a2a, #1a1a1a);
  border-bottom: 1px solid #333;
  min-height: 48px;
  flex-shrink: 0;
  padding-top: max(10px, env(safe-area-inset-top));
}

#top-bar button {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

#top-bar button:active {
  background: rgba(201,168,76,0.15);
}

#top-bar-title {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--gold);
  letter-spacing: 1px;
  font-style: italic;
}

/* Book container */
#book-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  padding: 8px;
}

#book {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 900px;
}

/* Page-turn arrow buttons */
.page-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 70;
  width: 44px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.06);
  border: none;
  color: var(--gold, #b8924a);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s ease, opacity 0.15s ease;
  opacity: 0.55;
}
.page-nav:hover {
  background: rgba(0, 0, 0, 0.14);
  opacity: 1;
}
.page-nav[disabled] {
  opacity: 0.15;
  cursor: default;
  pointer-events: none;
}
#page-prev { left: 12px; }
#page-next { right: 12px; }

/* StPageFlip overrides */
.stf__parent {
  margin: 0 auto;
}

.stf__item {
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   PAGE STYLES — Content pages
   ═══════════════════════════════════════════════════════════════ */

.page {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 60% at 50% 50%, var(--cream) 0%, var(--cream-dark) 90%, var(--cream-shadow) 100%);
  padding: 0;
  overflow: hidden;
  position: relative;
  font-family: var(--serif);
  color: var(--ink);
  user-select: text;
}

/* Scrollable inner content — doesn't intercept corner touches */
.page-scroll {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  padding: 28px 22px 20px 22px;
  box-sizing: border-box;
}

/* Parchment texture overlay */
.page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 80px,
      rgba(180,160,120,0.03) 80px,
      rgba(180,160,120,0.03) 81px
    );
  pointer-events: none;
  z-index: 0;
}

.page > * { position: relative; z-index: 1; }

/* Spine shadow on right edge of left pages, left edge of right pages */
.stf__item.--left .page::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 30px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.08));
  pointer-events: none;
  z-index: 2;
}

.stf__item.--right .page::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 30px;
  background: linear-gradient(270deg, transparent, rgba(0,0,0,0.08));
  pointer-events: none;
  z-index: 2;
}

/* ─── Cover Page (first page) ─── */
.page-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 60% 40% at 30% 20%, rgba(90,58,40,0.3) 0%, transparent 100%),
    radial-gradient(ellipse 50% 60% at 70% 80%, rgba(42,24,16,0.4) 0%, transparent 100%),
    linear-gradient(135deg, var(--leather-light) 0%, var(--leather-mid) 40%, var(--leather-dark) 80%, var(--leather-mid) 100%);
  color: var(--gold-bright);
  padding: 30px;
  text-align: center;
}

.page-cover::before { display: none; }
.page-cover::after { display: none; }

.page-cover .cover-icon-large {
  margin-bottom: 24px;
  opacity: 0.7;
}

.page-cover h2 {
  font-size: 26px;
  letter-spacing: 4px;
  color: var(--gold-bright);
  text-shadow: 0 1px 0 rgba(255,220,120,0.3), 0 -1px 0 rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.6);
  line-height: 1.3;
  margin-bottom: 10px;
}

.page-cover .cover-subtitle-large {
  font-size: 14px;
  font-style: italic;
  color: var(--gold);
  letter-spacing: 2px;
  margin-bottom: 20px;
}

.page-cover .cover-divider-large {
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 16px 0;
}

.page-cover .cover-credit {
  font-size: 11px;
  color: var(--gold-dim);
  letter-spacing: 1px;
}

/* ─── Table of Contents Page ─── */
.page-toc {
  padding: 32px 24px 20px 24px;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.page-toc::before { display: none; }

.toc-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(201,168,76,0.3);
}

.toc-header h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  font-style: italic;
  color: var(--ink);
  letter-spacing: 2px;
}

.toc-header .toc-decoration {
  width: 50px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 8px auto 0;
}

.toc-section {
  margin-bottom: 18px;
}

.toc-section-title {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold-dim);
  margin-bottom: 6px;
  padding-bottom: 3px;
  border-bottom: 0.5px solid rgba(201,168,76,0.25);
}

.toc-entry {
  display: flex;
  align-items: baseline;
  padding: 4px 0;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  transition: color 0.2s;
}

.toc-entry:active {
  color: var(--gold-dim);
}

.toc-entry .psalm-num {
  font-weight: 700;
  min-width: 30px;
  color: var(--ink-light);
}

.toc-entry .psalm-title-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-entry .dot-leaders {
  flex: 1;
  border-bottom: 1px dotted rgba(74,53,37,0.3);
  margin: 0 6px 4px 6px;
  min-width: 20px;
}

.toc-entry .psalm-page {
  font-size: 11px;
  color: var(--gold-dim);
  font-style: italic;
}

/* ─── TOC Book Sections & Dividers ─── */
.toc-book-section {
  margin-bottom: 8px;
}

.toc-book-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  letter-spacing: 3px;
  margin: 16px 0 8px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(201,168,76,0.4);
  text-transform: uppercase;
}

.toc-book-divider {
  width: 60%;
  height: 1px;
  margin: 14px auto;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  opacity: 0.5;
}

/* Coming soon entries in TOC */
.toc-entry-coming {
  opacity: 0.45;
  cursor: default;
}

.psalm-title-coming {
  font-style: italic;
}

.psalm-page-coming {
  font-size: 10px;
  color: var(--gold-dim);
  font-style: italic;
}

/* Coming soon body in reader */
.psalm-body-coming {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

/* ─── Search Book Labels ─── */
.search-book-label {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 12px 4px 6px 4px;
  border-bottom: 1px solid rgba(201,168,76,0.2);
  margin-top: 4px;
}

.search-result-coming {
  opacity: 0.4;
  cursor: default;
}

.search-result-coming .search-result-book {
  font-size: 10px;
  color: var(--gold-dim);
}

/* ─── Psalm Reader Page ─── */
.page-psalm {
  padding: 24px 22px 28px 22px;
}

.page-psalm::before { display: none; }

.psalm-header {
  text-align: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
}

.psalm-header h3 {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--ink);
  text-transform: uppercase;
}

.psalm-header .psalm-title-line {
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 6px auto 0;
}

.psalm-subtitle {
  text-align: center;
  font-size: 12px;
  font-style: italic;
  color: var(--ink-light);
  margin-bottom: 14px;
  line-height: 1.4;
}

.psalm-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.psalm-body p {
  margin-bottom: 10px;
}

.psalm-body strong {
  font-weight: 700;
  color: #1a0e08;
}

.psalm-body em {
  font-style: italic;
  color: var(--ink-light);
}

/* Translation Notes — collapsible */
.notes-section {
  margin-top: 16px;
  border-top: 1px solid rgba(201,168,76,0.25);
  padding-top: 8px;
}

.notes-tab {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: var(--leather-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 3px 3px 0 0;
  cursor: pointer;
  margin-top: -8px;
  margin-left: 0;
}

.notes-content {
  font-size: 12px;
  font-style: italic;
  color: var(--ink-light);
  line-height: 1.5;
  padding: 10px 4px 4px 4px;
  display: none;
}

.notes-content.open {
  display: block;
}

.notes-content em {
  font-style: italic;
  color: var(--ink-light);
}

/* ═══════════════════════════════════════════════════════════════
   AUDIO RIBBON — Gold bookmark
   ═══════════════════════════════════════════════════════════════ */

#audio-ribbon {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  z-index: 60;
  pointer-events: auto;
}

#audio-ribbon[hidden] { display: none; }

.ribbon-top {
  width: 30px;
  height: 12px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  margin: 0 auto;
  clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%);
  box-shadow: 0 -2px 6px rgba(0,0,0,0.3);
}

.ribbon-body {
  background: linear-gradient(180deg, var(--gold-dim), #8a7430);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

#audio-play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--cream);
  background: radial-gradient(circle, var(--gold-bright), var(--gold));
  color: var(--leather-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s;
}

#audio-play:active { transform: scale(0.92); }

.audio-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#audio-title {
  font-family: var(--serif);
  font-size: 12px;
  color: var(--cream);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-seek-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

#audio-current, #audio-duration {
  font-size: 10px;
  color: var(--cream-dark);
  font-family: monospace;
  min-width: 32px;
  text-align: center;
}

#audio-seek {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: rgba(245,240,225,0.3);
  border-radius: 2px;
  cursor: pointer;
}

#audio-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

#audio-seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cream);
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.speed-toggle button {
  background: rgba(245,240,225,0.15);
  border: 1px solid rgba(245,240,225,0.3);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  min-width: 32px;
}

.speed-toggle button:active {
  background: rgba(245,240,225,0.25);
}

#audio-coming-soon {
  background: linear-gradient(180deg, var(--gold-dim), #8a7430);
  padding: 10px 16px;
  text-align: center;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
}

#audio-coming-soon em {
  font-family: var(--serif);
  font-size: 12px;
  color: var(--cream);
  font-style: italic;
  letter-spacing: 1px;
}

/* ═══════════════════════════════════════════════════════════════
   SEARCH OVERLAY
   ═══════════════════════════════════════════════════════════════ */

#search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,0.95);
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}

#search-overlay[hidden] { display: none; }

/* ─── TOC Overlay ─── */
#toc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,0.97);
  z-index: 250;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

#toc-overlay[hidden] { display: none; }

.toc-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(201,168,76,0.25);
  flex-shrink: 0;
}

.toc-overlay-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--gold);
  letter-spacing: 2px;
}

#toc-close-btn {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

#toc-overlay-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 20px 24px 40px 24px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

#toc-overlay-content .toc-book-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  margin: 16px 0 8px 0;
  letter-spacing: 1px;
}

#toc-overlay-content .toc-section-title {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold-dim);
  margin: 12px 0 4px 0;
  padding-bottom: 3px;
  border-bottom: 0.5px solid rgba(201,168,76,0.2);
}

#toc-overlay-content .toc-entry {
  display: flex;
  align-items: baseline;
  padding: 6px 0;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.5;
  color: var(--cream);
  transition: color 0.2s;
}

#toc-overlay-content .toc-entry:active,
#toc-overlay-content .toc-entry:hover {
  color: var(--gold);
}

#toc-overlay-content .toc-entry .psalm-num {
  font-weight: 700;
  min-width: 32px;
  color: var(--gold-dim);
}

#toc-overlay-content .toc-entry .psalm-title-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#toc-overlay-content .toc-entry .dot-leaders {
  flex: 0 0 auto;
  width: 20px;
  border-bottom: 1px dotted rgba(201,168,76,0.3);
  margin: 0 6px 4px 6px;
}

#toc-overlay-content .toc-entry.toc-entry-coming {
  opacity: 0.4;
  cursor: default;
}

#toc-overlay-content .toc-book-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,168,76,0.3), transparent);
  margin: 16px 0;
}

.search-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #333;
}

#search-input {
  flex: 1;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 10px 14px;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--cream);
  outline: none;
}

#search-input:focus {
  border-color: var(--gold);
}

#search-input::placeholder {
  color: #666;
  font-style: italic;
}

#search-close {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  padding: 6px;
}

#search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

.search-result-item {
  display: flex;
  align-items: baseline;
  padding: 12px 4px;
  border-bottom: 1px solid #2a2a2a;
  cursor: pointer;
  color: var(--cream);
  font-family: var(--serif);
}

.search-result-item:active {
  background: rgba(201,168,76,0.1);
}

.search-result-num {
  font-weight: 700;
  color: var(--gold);
  min-width: 40px;
  font-size: 15px;
}

.search-result-title {
  font-size: 14px;
  color: var(--cream);
}

.search-result-book {
  font-size: 11px;
  color: #666;
  font-style: italic;
  margin-left: 8px;
}

.search-no-results {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-style: italic;
  font-family: var(--serif);
}

/* ═══════════════════════════════════════════════════════════════
   LOADING INDICATOR
   ═══════════════════════════════════════════════════════════════ */

#loading-indicator {
  position: fixed;
  inset: 0;
  background: var(--charcoal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

#loading-indicator[hidden] { display: none; }

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading-indicator p {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--gold-dim);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 600px) {
  #book-cover {
    width: 240px;
    height: 336px;
  }
  .cover-title { font-size: 20px; letter-spacing: 3px; }
  .cover-subtitle { font-size: 11px; }
  .cover-tagline { font-size: 10px; }

  .page { padding: 20px 16px 16px 16px; }
  .page-toc { padding: 24px 16px 16px 16px; }
  .toc-header h2 { font-size: 18px; }
  .toc-entry { font-size: 12px; }
  .toc-section-title { font-size: 11px; }

  .psalm-body { font-size: 13px; line-height: 1.6; }
  .psalm-header h3 { font-size: 14px; }
  .psalm-subtitle { font-size: 11px; }

  #top-bar-title { font-size: 13px; }
}

@media (min-width: 900px) {
  #book-cover {
    width: 340px;
    height: 476px;
  }
  .cover-title { font-size: 28px; }

  .page { padding: 36px 32px 28px 32px; }
  .psalm-body { font-size: 15px; line-height: 1.7; }
  .toc-entry { font-size: 14px; }
}

/* Scrollbar styling for pages */
.page::-webkit-scrollbar {
  width: 4px;
}
.page::-webkit-scrollbar-track {
  background: transparent;
}
.page::-webkit-scrollbar-thumb {
  background: rgba(201,168,76,0.3);
  border-radius: 2px;
}

/* Prevent text selection on cover, allow on pages */
#cover-screen, #top-bar, #search-overlay, #audio-ribbon {
  user-select: none;
}

.page-psalm .psalm-body, .page-psalm .notes-content {
  user-select: text;
  -webkit-user-select: text;
}