/* ============ RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a2035;
  --text-primary: #e8e8f0;
  --text-secondary: #9ca3be;
  --text-dim: #7b84a0;
  --accent-gold: #d4b85c;
  --accent-blue: #4a8cc9;
  --accent-purple: #8a6cc9;
  --accent-green: #4caa7c;
  --border: rgba(200, 200, 255, 0.08);
  --glow-gold: rgba(201, 168, 76, 0.4);
  --glow-blue: rgba(74, 140, 201, 0.3);
  --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

html, body {
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  overflow: hidden;
}

/* ============ LAYOUT ============ */
#app {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr;
  height: 100vh;
}

#app.panel-open {
  grid-template-columns: 1fr 380px;
}

#header {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

#header h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

#search-container {
  flex: 1;
  max-width: 500px;
  position: relative;
}

#search-input {
  width: 100%;
  padding: 8px 16px 8px 36px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#search-input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 12px var(--glow-gold);
}

#search-input::placeholder { color: var(--text-dim); }

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 14px;
  pointer-events: none;
}

#search-mode {
  display: flex;
  gap: 4px;
}

#search-mode button {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

#search-mode button.active {
  background: var(--accent-gold);
  color: var(--bg-primary);
  border-color: var(--accent-gold);
}

#search-mode button:hover:not(.active) {
  border-color: var(--accent-gold);
  color: var(--text-primary);
}

/* ============ CONSTELLATION CANVAS ============ */
#constellation-container {
  height: 100%;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
}

#constellation-svg {
  width: 100%;
  height: 100%;
  cursor: grab;
}

#constellation-svg:active { cursor: grabbing; }

/* Stars background */
.bg-star {
  fill: white;
  opacity: 0;
  animation: twinkle 4s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.6; }
}

/* Graph nodes */
.node-group { cursor: pointer; }

.node-nebula {
  transition: r 0.3s ease, opacity 0.3s ease;
}

.node-ring {
  fill: none;
  stroke-width: 1.5;
  opacity: 0.25;
  transition: r 0.3s ease, opacity 0.3s ease;
}

.node-core {
  transition: r 0.2s ease;
}

.node-highlight {
  fill: white;
  opacity: 0.6;
}

.node-label {
  fill: var(--text-secondary);
  font-size: 11px;
  text-anchor: middle;
  pointer-events: none;
  transition: fill 0.2s;
}

.node-sublabel {
  fill: var(--text-dim);
  font-size: 9px;
  text-anchor: middle;
  pointer-events: none;
}

.node-group:hover .node-ring {
  opacity: 0.6;
}

.node-group:hover .node-nebula {
  opacity: 0.5;
}

.node-group:hover .node-label {
  fill: var(--text-primary);
}

.node-group.primary .node-label {
  fill: var(--accent-gold);
  font-size: 13px;
  font-weight: 600;
}

/* Graph edges */
.graph-edge {
  stroke: rgba(200, 200, 255, 0.12);
  stroke-width: 0.8;
  transition: stroke 0.3s, stroke-width 0.3s;
}

.graph-edge.highlighted {
  stroke: rgba(201, 168, 76, 0.35);
  stroke-width: 1.5;
}

/* Loading */
#loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-dim);
  font-size: 14px;
  display: none;
}

#loading.active { display: block; }

/* Welcome message */
#welcome {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-dim);
  max-width: 400px;
}

#welcome h2 {
  font-size: 24px;
  color: var(--accent-gold);
  margin-bottom: 12px;
  font-weight: 400;
}

#welcome p {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}

#welcome .examples {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

#welcome .examples button {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--accent-gold);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

#welcome .examples button:hover {
  background: var(--accent-gold);
  color: var(--bg-primary);
}

/* ============ SIDE PANEL ============ */
#side-panel {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 0;
  display: none;
  flex-direction: column;
}

#side-panel.open {
  display: flex;
  grid-column: 2;
  grid-row: 2;
  height: 100%;
  max-height: none;
}

#side-panel .panel-close {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

#side-panel .panel-close button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 10px;
}

#side-panel .panel-close button:hover {
  color: var(--text-primary);
  border-color: var(--text-dim);
}

#panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* Node detail panel */
.detail-header {
  margin-bottom: 16px;
}

.detail-header .strongs-id {
  font-size: 12px;
  color: var(--accent-blue);
  font-family: var(--font-mono);
}

.detail-header .lemma {
  font-size: 28px;
  color: var(--text-primary);
  margin: 4px 0;
}

.detail-header .transliteration {
  font-size: 14px;
  color: var(--accent-gold);
  font-style: italic;
}

.detail-header .definition {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 8px;
}

.detail-section {
  margin-top: 16px;
}

.detail-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* Verse list */
.verse-item {
  padding: 10px;
  margin-bottom: 6px;
  background: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s;
}

.verse-item:hover {
  border-color: var(--accent-gold);
}

.verse-ref {
  font-size: 11px;
  color: var(--accent-gold);
  font-weight: 600;
  margin-bottom: 4px;
}

.verse-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Word study results */
.word-study-item {
  padding: 10px;
  margin-bottom: 6px;
  background: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.word-study-item:hover {
  border-color: var(--accent-gold);
  transform: translateX(2px);
}

.word-study-item .ws-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-blue);
}

.word-study-item .ws-lemma {
  font-size: 18px;
  margin: 2px 0;
}

.word-study-item .ws-translit {
  font-size: 12px;
  color: var(--accent-gold);
  font-style: italic;
}

.word-study-item .ws-def {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.word-study-item .ws-count {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Search results */
.search-results-header {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* Pattern search */
#pattern-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

#pattern-inputs input {
  padding: 6px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

#pattern-inputs input:focus {
  border-color: var(--accent-blue);
}

/* Tooltip */
#tooltip {
  position: fixed;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--accent-gold);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
  max-width: 250px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

#tooltip.visible { opacity: 1; pointer-events: none; }
#tooltip.visible.interactive { pointer-events: auto; }
#tooltip .tip-close {
  position: absolute;
  top: 4px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  pointer-events: auto;
}
#tooltip .tip-close:hover { color: var(--text-primary); }
#tooltip .tip-lemma { font-size: 16px; padding-right: 16px; }
#tooltip .tip-translit { color: var(--accent-gold); font-style: italic; font-size: 11px; }
#tooltip .tip-def { color: var(--text-secondary); font-size: 11px; margin-top: 4px; line-height: 1.4; }

/* ============ EXPLORE SUB-NAV ============ */
#explore-subnav {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  z-index: 5;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

#explore-subnav button {
  padding: 5px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

#explore-subnav button.active {
  background: var(--accent-gold);
  color: var(--bg-primary);
  border-color: var(--accent-gold);
}

#explore-subnav button:hover:not(.active) {
  color: var(--text-primary);
}

/* ============ HYMNS BROWSER ============ */
#hymns-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  background: var(--bg-primary);
}

#hymns-nav {
  position: sticky;
  top: 0;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 5;
}

#hymns-nav input {
  width: 100%;
  max-width: 500px;
  padding: 8px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

#hymns-nav input:focus {
  border-color: var(--accent-purple);
}

#hymns-content {
  padding: 16px 20px;
  max-width: 800px;
  margin: 0 auto;
}

.hymn-card {
  padding: 14px;
  margin-bottom: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-purple);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.hymn-card:hover {
  border-color: var(--accent-purple);
}

.hymn-card .hymn-title {
  font-size: 15px;
  color: var(--accent-purple);
  font-weight: 600;
}

.hymn-card .hymn-author {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.hymn-card .hymn-first-line {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 6px;
}

.about-credit {
  font-size: 15px;
  color: var(--accent-gold);
  margin-bottom: 16px;
}

/* ============ THEME SWITCHER ============ */
#theme-switcher {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

#theme-switcher button {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
}

#theme-switcher button.active {
  border-color: var(--accent-gold);
}

/* Theme: Midnight (default) */
[data-theme="midnight"] {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a2035;
  --text-primary: #e8e8f0;
  --text-secondary: #9ca3be;
  --text-dim: #7b84a0;
}

/* Theme: Parchment */
[data-theme="parchment"] {
  --bg-primary: #f5f0e8;
  --bg-secondary: #ebe5d8;
  --bg-card: #fff9f0;
  --text-primary: #2a2520;
  --text-secondary: #4a4238;
  --text-dim: #6b6358;
  --border: rgba(0,0,0,0.1);
  --accent-gold: #7a5c0e;
  --accent-blue: #2a6496;
}

/* Theme: Slate */
[data-theme="slate"] {
  --bg-primary: #1e2228;
  --bg-secondary: #282d35;
  --bg-card: #2f353e;
  --text-primary: #d8dce4;
  --text-secondary: #a0a8b8;
  --text-dim: #8890a4;
}

/* Theme: OCC Light (matches ontariocommunitychurch.org) */
[data-theme="occ"] {
  --bg-primary: #f4f6fa;
  --bg-secondary: #e8ecf4;
  --bg-card: #ffffff;
  --text-primary: #1e345d;
  --text-secondary: #3d4654;
  --text-dim: #565e6c;
  --border: rgba(30, 52, 93, 0.1);
  --accent-gold: #755c15;
  --accent-blue: #3D6DA8;
}

/* ============ ABOUT PAGE ============ */
#about-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  background: var(--bg-primary);
}

#about-content {
  max-width: 700px;
  margin: 0 auto;
  padding: 32px 24px;
  line-height: 1.7;
}

#about-content h2 {
  font-size: 24px;
  color: var(--accent-gold);
  font-weight: 400;
  margin-bottom: 16px;
}

#about-content h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin: 28px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

#about-content p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.about-sources {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.about-source {
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.about-source strong {
  color: var(--text-primary);
  font-size: 14px;
}

.about-source span {
  color: var(--text-dim);
  font-size: 12px;
  margin-left: 6px;
}

.about-source p {
  font-size: 12px;
  color: var(--text-dim);
  margin: 4px 0 0;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.about-stat {
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
}

.about-stat span {
  display: block;
  font-size: 20px;
  color: var(--accent-gold);
  font-weight: 600;
}

.about-stat {
  font-size: 11px;
  color: var(--text-dim);
}

.about-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-style: italic;
  color: var(--text-dim);
  font-size: 13px;
}

/* ============ BIBLE READER ============ */
#reader-container {
  overflow-y: auto;
  padding: 0;
  background: var(--bg-primary);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* When panel is open, reader content shouldn't extend behind it */
.panel-open #reader-content,
.panel-open #about-content {
  max-width: 600px;
}

#reader-nav {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 5;
  flex-wrap: wrap;
}

#reader-nav select {
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

#reader-nav select:focus {
  border-color: var(--accent-gold);
}

#reader-book { min-width: 140px; }
#reader-chapter { min-width: 70px; }
#reader-translation { min-width: 100px; }

#interlinear-toggle,
#interlinear-toggle2 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-left: auto;
}

#interlinear-toggle input {
  accent-color: var(--accent-gold);
}

#reader-content {
  padding: 24px 32px;
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.9;
  font-size: 16px;
  color: var(--text-primary);
}

.reader-verse {
  display: inline;
}

.reader-verse-num {
  font-size: 11px;
  color: var(--accent-gold);
  vertical-align: super;
  margin-right: 2px;
  font-weight: 600;
  cursor: default;
}

.reader-verse-text {
  cursor: pointer;
  transition: color 0.15s;
  border-bottom: 1px solid transparent;
}

.reader-verse-text:hover {
  color: var(--accent-gold);
  border-bottom-color: rgba(201, 168, 76, 0.2);
}

.reader-verse-text.active {
  color: var(--accent-gold);
  background: rgba(201, 168, 76, 0.06);
  border-radius: 2px;
}

/* Interlinear word display */
.interlinear-word {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 2px 1px;
  padding: 4px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.15s;
  vertical-align: top;
}

.interlinear-word:hover {
  border-color: var(--accent-gold);
}

.interlinear-word.has-strongs {
  border-color: rgba(201, 168, 76, 0.25);
}

.interlinear-word .iw-english {
  font-size: 14px;
  color: var(--text-primary);
}

.interlinear-word .iw-strongs-id {
  font-size: 9px;
  color: var(--accent-blue);
  font-family: var(--font-mono);
}

.interlinear-word .iw-lemma {
  font-size: 13px;
  color: var(--accent-gold);
}

.interlinear-word .iw-translit {
  font-size: 9px;
  color: var(--text-dim);
  font-style: italic;
}

/* Verse detail in side panel (for reader mode) */
.verse-detail-translations {
  margin-top: 12px;
}

.translation-compare {
  padding: 8px;
  margin-bottom: 6px;
  background: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.translation-compare .tc-label {
  font-size: 11px;
  color: var(--accent-blue);
  font-weight: 600;
  margin-bottom: 4px;
}

.translation-compare .tc-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============ NOTES & HIGHLIGHTS ============ */
.note-section {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.note-section h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.note-textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-main);
  resize: vertical;
  outline: none;
}

.note-textarea:focus {
  border-color: var(--accent-gold);
}

.note-save-btn {
  margin-top: 6px;
  padding: 5px 14px;
  background: var(--accent-gold);
  color: var(--bg-primary);
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}

.note-save-btn:hover {
  opacity: 0.9;
}

.highlight-picker {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.highlight-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}

.highlight-dot:hover {
  transform: scale(1.2);
}

.highlight-dot.active {
  border-color: var(--text-primary);
}

.highlight-dot.clear {
  background: var(--bg-primary);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-dim);
}

.verse-highlighted {
  border-radius: 2px;
  padding: 0 2px;
}

/* Notes browser */
.notes-browser {
  padding: 16px 20px;
  max-width: 800px;
  margin: 0 auto;
}

.notes-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.notes-toolbar button {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}

.notes-toolbar button:hover {
  border-color: var(--accent-gold);
  color: var(--text-primary);
}

.note-card {
  padding: 12px;
  margin-bottom: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.note-card:hover {
  border-color: var(--accent-gold);
}

.note-card .note-ref {
  font-size: 13px;
  color: var(--accent-gold);
  font-weight: 600;
}

.note-card .note-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.note-card .note-date {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ============ AUDIO / TTS FOLLOW-ALONG ============ */

/* Word-by-word highlighting — the "Disney sing-along" effect */
.word-highlight {
  transition: color 0.15s, background 0.15s;
  border-radius: 2px;
  padding: 0 1px;
}

/* Currently spoken word — glowing gold */
.word-active {
  color: var(--bg-primary) !important;
  background: var(--accent-gold) !important;
  border-radius: 3px;
  padding: 1px 3px;
  box-shadow: 0 0 8px var(--glow-gold), 0 0 20px rgba(201, 168, 76, 0.2);
}

/* Already spoken words — softly lit */
.word-spoken {
  color: var(--accent-gold);
  opacity: 0.7;
}

/* Verse currently being read aloud */
.reader-verse-text.audio-active {
  background: rgba(201, 168, 76, 0.04);
  border-radius: 3px;
}

/* ============ PERSISTENT AUDIO BAR ============ */
.audio-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
  user-select: none;
}

.audio-bar.hidden { display: none; }

.audio-bar button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 18px;
  padding: 6px 10px;
  transition: color 0.2s;
}

.audio-bar button.hidden { display: none; }

.audio-bar button:hover { color: var(--accent-gold); }

#audio-progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#audio-status {
  font-size: 12px;
  color: var(--text-dim);
}

#audio-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
}

#audio-progress-bar.hidden { display: none; }

#audio-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gold);
  border-radius: 3px;
  transition: width 0.3s;
}

/* Add padding to reader content when audio bar is visible */
body.audio-bar-visible #reader-content {
  padding-bottom: 72px;
}

/* Shrink audio bar when side panel is open on desktop */
@media (min-width: 769px) {
  .panel-open .audio-bar {
    right: 380px;
  }
}

/* ============ SNAP-BACK BUTTON ============ */
.snap-back {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  padding: 8px 20px;
  background: var(--accent-gold);
  color: var(--bg-primary);
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: opacity 0.3s, transform 0.3s;
}

.snap-back:hover {
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.5);
}

.snap-back.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
}

/* ============ FOCUS / IMMERSIVE MODE ============ */
body.focus-mode {
  overflow: hidden;
}

body.focus-mode #header { display: none; }
body.focus-mode #reader-nav { display: none; }
body.focus-mode #side-panel { display: none !important; }

body.focus-mode #app {
  grid-template-rows: 1fr;
  position: fixed;
  inset: 0;
  z-index: 100;
}

body.focus-mode #reader-container {
  background: #050508;
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow-y: auto;
}

body.focus-mode #reader-content {
  max-width: 750px;
  margin: 0 auto;
  font-size: var(--focus-font-size, 24px);
  line-height: 2.2;
  padding: 80px 40px 120px;
  color: rgba(255, 255, 255, 0.25);
  transition: font-size 0.3s ease;
}

body.focus-mode .reader-verse-text.audio-active {
  color: rgba(255, 255, 255, 0.9);
  background: none;
}

body.focus-mode .reader-verse-text.audio-played {
  color: rgba(255, 255, 255, 0.15);
}

body.focus-mode .reader-verse-text {
  color: rgba(255, 255, 255, 0.25);
}

body.focus-mode .word-active {
  color: #000 !important;
  background: linear-gradient(135deg, #c9a84c, #e8d48b) !important;
  padding: 2px 6px;
  border-radius: 3px;
  box-shadow: 0 0 20px var(--glow-gold), 0 0 50px rgba(201, 168, 76, 0.4);
}

body.focus-mode .word-spoken {
  color: #c9a84c;
  opacity: 0.85;
}

body.focus-mode .audio-bar {
  background: rgba(5, 5, 8, 0.9);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  right: 0 !important;
  z-index: 110;
}

body.focus-mode .reader-verse-num {
  opacity: 0.2;
  font-size: 0.6em;
}

body.focus-mode .chapter-heading {
  color: rgba(255, 255, 255, 0.4);
}

/* Focus controls — top-right overlay */
.focus-controls {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 120;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.focus-mode:hover .focus-controls,
.focus-controls:hover {
  opacity: 1;
}

.focus-controls button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: all 0.2s;
}

.focus-controls button:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.focus-controls.hidden { display: none; }

/* Clickable verse numbers — jump to verse during playback */
.clickable-verse {
  cursor: pointer;
  transition: color 0.2s, text-shadow 0.2s;
}

.clickable-verse:hover {
  color: var(--accent-gold) !important;
  text-shadow: 0 0 6px var(--glow-gold);
}

/* Already-read verse styling */
.reader-verse-text.audio-played {
  color: var(--text-secondary);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  #side-panel {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 40vh;
  }

  #header {
    flex-wrap: wrap;
    padding: 8px 12px;
  }

  #search-container {
    order: 3;
    max-width: 100%;
    flex-basis: 100%;
  }

  .audio-bar {
    padding: 8px 12px;
    gap: 6px;
  }

  .audio-bar button {
    font-size: 20px;
    padding: 8px 10px;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body.focus-mode #reader-content {
    font-size: var(--focus-font-size, 22px);
    line-height: 2;
    padding: 32px 16px 120px;
  }

  .focus-controls {
    top: 10px;
    right: 10px;
  }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
