/* === CSS Variables === */
:root {
  --color-bg-deep: #0a0806;
  --color-bg-primary: #12100e;
  --color-bg-elevated: #1a1714;
  --color-bg-card: #221e1a;
  --color-border: #3d362e;
  --color-border-glow: #8b6914;
  
  --color-gold: #d4a418;
  --color-gold-bright: #ffd54f;
  --color-gold-muted: #a68212;
  --color-saffron: #ff7b00;
  --color-vermillion: #e23a3a;
  
  --color-text-primary: #f5efe6;
  --color-text-secondary: #c4b8a5;
  --color-text-muted: #8c8175;
  --color-sanskrit: #ffe6a3;
  
  --font-sanskrit: 'Noto Sans Devanagari', sans-serif;
  --font-english: 'Cormorant Garamond', serif;
  
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-glow: 0 0 40px rgba(212, 164, 24, 0.15);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-english);
  background: var(--color-bg-deep);
  color: var(--color-text-primary);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === Sacred Background Pattern === */
.sacred-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.03;
  background-image: 
    radial-gradient(circle at 50% 50%, var(--color-gold) 1px, transparent 1px),
    radial-gradient(circle at 0% 0%, var(--color-gold) 1px, transparent 1px);
  background-size: 60px 60px, 30px 30px;
}

/* === Header === */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, var(--color-bg-deep) 0%, rgba(10, 8, 6, 0.95) 100%);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 1rem 0.75rem;
  /* For the floating toggle button */
  position: sticky;
}

.header-collapsible {
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
  opacity: 1;
  margin-bottom: 1rem;
}

.header.collapsed .header-collapsible {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
}

.header-toggle {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: var(--transition-smooth);
  z-index: 101;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header-toggle:hover {
  color: var(--color-gold);
  border-color: var(--color-gold-muted);
  background: var(--color-bg-card);
}

.header-toggle .toggle-arrow {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.header.collapsed .header-toggle .toggle-arrow {
  transform: rotate(180deg);
}

.header-content {
  text-align: center;
  margin-bottom: 1rem;
}

.om-symbol {
  font-family: var(--font-sanskrit);
  font-size: 3rem;
  color: var(--color-gold);
  text-shadow: 0 0 30px rgba(212, 164, 24, 0.5);
  animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; text-shadow: 0 0 50px rgba(212, 164, 24, 0.8); }
}

.title {
  font-family: var(--font-sanskrit);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--color-gold-bright);
  letter-spacing: 0.05em;
  margin: 0.5rem 0;
}

.subtitle {
  font-family: var(--font-english);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  font-style: italic;
}

.tagline {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}

/* === Text Navigation === */
.text-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0 0.5rem;
  padding: 0 1rem;
}

.text-btn {
  font-family: var(--font-sanskrit);
  font-size: 1.2rem;
  padding: 0.8rem 1.5rem;
  background: var(--color-bg-elevated);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.text-btn:hover:not(:disabled) {
  background: var(--color-bg-card);
  border-color: var(--color-gold-muted);
  color: var(--color-text-primary);
  transform: translateY(-2px);
}

.text-btn.active {
  background: linear-gradient(135deg, rgba(212, 164, 24, 0.15), rgba(255, 123, 0, 0.1));
  border-color: var(--color-gold);
  color: var(--color-gold-bright);
  box-shadow: 0 4px 20px rgba(212, 164, 24, 0.3);
}

.text-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.text-btn .text-name {
  font-family: var(--font-english);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.text-btn.active .text-name {
  color: var(--color-gold-muted);
}

/* === Canto/Section Navigation === */
.canto-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem 0 1.5rem;
  padding: 0 1rem;
}

.canto-btn {
  font-family: var(--font-english);
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.canto-btn:hover:not(:disabled) {
  background: var(--color-bg-card);
  border-color: var(--color-gold-muted);
  color: var(--color-text-primary);
}

.canto-btn.active {
  background: linear-gradient(135deg, rgba(212, 164, 24, 0.2), rgba(255, 123, 0, 0.1));
  border-color: var(--color-gold);
  color: var(--color-gold-bright);
  box-shadow: 0 0 20px rgba(212, 164, 24, 0.2);
}

.canto-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.canto-btn .verse-count {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.canto-btn.active .verse-count {
  color: var(--color-gold-muted);
}

/* === Global Audio Controls === */
.global-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.control-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--color-gold);
  background: linear-gradient(145deg, var(--color-bg-elevated), var(--color-bg-primary));
  color: var(--color-gold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.control-btn:hover {
  background: var(--color-gold);
  color: var(--color-bg-deep);
  box-shadow: var(--shadow-glow);
  transform: scale(1.05);
}

.control-btn svg {
  width: 24px;
  height: 24px;
}

.control-btn .hidden {
  display: none;
}

.progress-container {
  flex: 1;
  min-width: 200px;
  max-width: 350px;
}

.progress-bar {
  height: 6px;
  background: var(--color-bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-gold-muted), var(--color-gold-bright));
  width: 0%;
  transition: width 0.2s ease;
  border-radius: 3px;
}

.verse-indicator {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
  display: block;
}

/* === Mode Toggle === */
/* === Audio Mode Selector === */
.audio-mode-selector {
  display: flex;
  gap: 0.25rem;
  background: var(--color-bg-elevated);
  border-radius: 8px;
  padding: 0.2rem;
  border: 1px solid var(--color-border);
}

.mode-btn {
  font-family: var(--font-english);
  font-size: 0.75rem;
  padding: 0.4rem 0.6rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.mode-btn:hover {
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.mode-btn.active {
  background: linear-gradient(135deg, rgba(212, 164, 24, 0.3), rgba(255, 123, 0, 0.2));
  color: var(--color-gold-bright);
  box-shadow: 0 0 10px rgba(212, 164, 24, 0.2);
}

.mode-btn .mode-icon {
  font-weight: 500;
}

.mode-btn[data-mode="sanskrit"] .mode-icon {
  font-family: var(--font-sanskrit);
  font-size: 0.7rem;
}

/* Audio Source Toggle (Yatharth) */
.audio-source-toggle {
  display: flex;
  background: var(--color-bg-elevated);
  border-radius: 8px;
  padding: 0.2rem;
  border: 1px solid var(--color-border);
}

.source-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-english);
  font-size: 0.7rem;
  padding: 0.4rem 0.6rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.source-btn:hover {
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.source-btn.active {
  background: linear-gradient(135deg, rgba(100, 180, 100, 0.3), rgba(74, 156, 74, 0.2));
  color: #7cdb7c;
  box-shadow: 0 0 10px rgba(74, 156, 74, 0.2);
}

.source-btn .source-icon {
  font-size: 0.9rem;
}

.source-btn .source-label {
  font-weight: 500;
}

/* Speed Selector */
.speed-selector {
  display: flex;
  gap: 0.15rem;
  background: var(--color-bg-elevated);
  border-radius: 8px;
  padding: 0.2rem;
  border: 1px solid var(--color-border);
}

/* Script Toggle (Devanagari/IAST) */
.script-toggle {
  display: flex;
  gap: 0.15rem;
  background: var(--color-bg-elevated);
  border-radius: 8px;
  padding: 0.2rem;
  border: 1px solid var(--color-border);
}

.script-btn {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.script-btn:hover {
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.script-btn.active {
  background: linear-gradient(135deg, rgba(255, 180, 100, 0.3), rgba(255, 140, 50, 0.2));
  color: #ffb464;
  box-shadow: 0 0 10px rgba(255, 180, 100, 0.2);
}

.script-btn[data-script="devanagari"] {
  font-family: var(--font-sanskrit);
}

.speed-btn {
  font-family: var(--font-english);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.speed-btn:hover {
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.speed-btn.active {
  background: linear-gradient(135deg, rgba(100, 200, 150, 0.3), rgba(50, 150, 100, 0.2));
  color: #7dd3a0;
  box-shadow: 0 0 10px rgba(100, 200, 150, 0.2);
}

/* Old toggle styles (keeping for reference) */
.mode-toggle {
  display: flex;
  align-items: center;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.toggle-label input {
  display: none;
}

.toggle-switch {
  width: 44px;
  height: 24px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  position: relative;
  transition: var(--transition-smooth);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--color-text-muted);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: var(--transition-smooth);
}

.toggle-label input:checked + .toggle-switch {
  background: var(--color-gold-muted);
  border-color: var(--color-gold);
}

.toggle-label input:checked + .toggle-switch::after {
  transform: translateX(20px);
  background: var(--color-gold-bright);
}

.toggle-text {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.toggle-label input:checked ~ .toggle-text {
  color: var(--color-gold);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-muted);
}

.volume-control input[type="range"] {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  background: var(--color-border);
  border-radius: 2px;
  cursor: pointer;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-gold);
  cursor: pointer;
}

/* === Main Content === */
.main-content {
  position: relative;
  z-index: 1;
  padding: 2.5rem 1rem 4rem;
  max-width: 900px;
  margin: 0 auto;
}

.verses-container {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* === Loading State === */
.loading {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-text-muted);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

/* === Verse Card === */
.verse-card {
  background: var(--color-bg-card);
  border-radius: 16px;
  border: 1px solid var(--color-border);
  overflow: visible;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-card);
}

.verse-card:hover {
  border-color: var(--color-border-glow);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.verse-card.playing {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 2px rgba(212, 164, 24, 0.2), var(--shadow-glow);
}

.verse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: linear-gradient(90deg, var(--color-bg-elevated), transparent);
  border-bottom: 1px solid var(--color-border);
}

.verse-number {
  font-family: var(--font-sanskrit);
  font-size: 1.1rem;
  color: var(--color-gold);
  font-weight: 600;
}

.verse-number span {
  font-family: var(--font-english);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-left: 0.5rem;
  font-weight: 400;
}

.verse-body {
  padding: 1.5rem;
}

/* === Sanskrit Section === */
.sanskrit-section {
  margin-bottom: 1.5rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  padding: 0.5rem;
  margin: -0.5rem;
  margin-bottom: 1.5rem;
  border-radius: 8px;
}

.sanskrit-section:hover {
  background: rgba(212, 164, 24, 0.05);
}

.section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--color-border), transparent);
}

.sanskrit-text {
  font-family: var(--font-sanskrit);
  font-size: 1.4rem;
  line-height: 2;
  color: var(--color-sanskrit);
}

/* IAST display mode (when toggle is on IAST) */
.iast-display {
  font-family: var(--font-english);
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1.9;
  color: var(--color-gold);
  letter-spacing: 0.02em;
}

.iast-display .iast-text {
  font-size: inherit;
}

.sanskrit-word {
  display: inline;
  padding: 0.1em 0.15em;
  border-radius: 4px;
  transition: var(--transition-smooth);
  position: relative;
}

.sanskrit-word.has-audio {
  cursor: pointer;
  border-bottom: 1px dotted rgba(212, 164, 24, 0.3);
}

.sanskrit-word.has-audio:hover {
  background: rgba(212, 164, 24, 0.15);
  color: var(--color-gold-bright);
  border-bottom-color: var(--color-gold);
}

.sanskrit-word.playing-word {
  background: rgba(212, 164, 24, 0.3);
  color: var(--color-gold-bright);
  animation: word-pulse 0.5s ease;
}

/* Audio sync highlighting - follows along as audio plays */
.sanskrit-word.audio-highlight {
  background: linear-gradient(135deg, rgba(212, 164, 24, 0.4), rgba(255, 193, 7, 0.3));
  color: var(--color-gold-bright);
  box-shadow: 0 0 12px rgba(212, 164, 24, 0.5);
  /* No transform to avoid layout shifts */
}

/* IAST text highlighting for audio sync */
.iast-text .audio-highlight,
.iast-word.audio-highlight {
  background: linear-gradient(135deg, rgba(212, 164, 24, 0.4), rgba(255, 193, 7, 0.3));
  color: var(--color-gold-bright);
  box-shadow: 0 0 10px rgba(212, 164, 24, 0.4);
}

.iast-word {
  cursor: pointer;
  /* Pre-apply padding so size doesn't change on highlight */
  padding: 0 4px;
  border-radius: 3px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.iast-word:hover {
  color: var(--color-gold-bright);
}

/* Nirukta word highlighting for audio sync */
.nirukta-word {
  border-radius: 2px;
  transition: background 0.12s ease-out, color 0.12s ease-out, box-shadow 0.12s ease-out;
}

.nirukta-word.audio-highlight {
  background: linear-gradient(135deg, rgba(139, 69, 19, 0.4), rgba(205, 133, 63, 0.3));
  color: #f0e6d2;
  box-shadow: 0 0 8px rgba(205, 133, 63, 0.5);
}

/* Sanskrit terms in tooltips when highlighted during audio playback */
.term-iast.nirukta-word.audio-highlight,
.term-iast-plain.nirukta-word.audio-highlight {
  background: linear-gradient(135deg, rgba(212, 164, 24, 0.5), rgba(255, 193, 7, 0.4));
  color: #fff;
  box-shadow: 0 0 12px rgba(212, 164, 24, 0.6);
  text-decoration: none;
}

@keyframes word-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.sanskrit-word::after {
  content: attr(data-iast);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-bg-deep);
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  font-family: var(--font-english);
  font-style: italic;
  border: 1px solid var(--color-border);
}

.sanskrit-word:hover::after {
  opacity: 1;
}

/* === IAST Section === */
.iast-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border-left: 3px solid var(--color-gold-muted);
}

.iast-text {
  font-family: var(--font-english);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--color-text-secondary);
  line-height: 1.9;
}

/* === Translation Sections === */
.translation-section {
  margin-bottom: 1.5rem;
}

.translation-section:last-child {
  margin-bottom: 0;
}

.translation-text {
  font-size: 1.05rem;
  color: var(--color-text-primary);
  line-height: 1.8;
}

.yogic-section {
  background: linear-gradient(135deg, rgba(255, 123, 0, 0.05), rgba(226, 58, 58, 0.05));
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 123, 0, 0.2);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.yogic-section:hover {
  background: linear-gradient(135deg, rgba(255, 123, 0, 0.1), rgba(226, 58, 58, 0.1));
  border-color: rgba(255, 123, 0, 0.4);
}

/* === Nirukta Annotated Terms === */
/* Grouped annotation — Sanskrit term floating above English phrase */
.nirukta-term.grouped {
  position: relative;
  display: inline;
  cursor: pointer;
}

/* The annotation pseudo-element (Sanskrit term) */
/* JS-Based Bracket Styles */
/* Base container injected by JS - absolute positioned */
.annotation-bracket {
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

/* First line fragment - has the label and top border gap */
.annotation-bracket.first-line {
  display: flex;
  align-items: flex-start; /* Align to top */
  line-height: 1; /* Reset line height */
}

/* Line segments */
.bracket-line {
  height: 1px;
  background-color: rgba(212, 175, 55, 0.4);
  flex-grow: 1;
  margin-top: 0.8em; /* Push line down to align with label bottom */
}

/* Ticks at ends */
.bracket-tick {
  width: 1px;
  height: 6px; /* Shorter ticks */
  background-color: rgba(212, 175, 55, 0.4);
  flex-shrink: 0;
  margin-top: 0.8em; /* Push ticks down with line */
}

.bracket-tick.left {
  margin-right: 1px;
}

.bracket-tick.right {
  margin-left: 1px;
}

/* The label (Sanskrit term) */
.annotation-label {
  font-family: var(--font-english);
  font-style: italic;
  font-size: 0.75em;
  color: var(--color-gold);
  padding: 0 6px;
  white-space: nowrap;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  /* Sit above the line */
  margin-bottom: 0;
}

/* Wrapped lines - using JS-injected ticks like first line */
.annotation-bracket.wrapped-line {
  display: flex;
  align-items: flex-start;
  line-height: 1;
}

/* Remove CSS borders since we use DOM elements now */
.annotation-bracket.wrapped-line {
  border: none;
  height: auto;
  margin-top: 0;
}

/* Hide ticks based on classes */
.annotation-bracket.middle .bracket-tick.left,
.annotation-bracket.middle .bracket-tick.right,
.annotation-bracket.last .bracket-tick.left {
  display: none;
}

/* Make sure ticks are visible where they should be */
.annotation-bracket.last .bracket-tick.right {
  display: block;
}

/* First line in a multiline group - closes on left but open on right */
.annotation-bracket.first-line.multiline .bracket-tick.right {
  display: none;
}

/* Hover state - applied by JS when hovering the term */
.annotation-bracket.hover .bracket-line,
.annotation-bracket.hover .bracket-tick,
.annotation-bracket.hover.wrapped-line {
  background-color: var(--color-saffron);
  border-color: var(--color-saffron);
}

.annotation-bracket.hover .annotation-label {
  color: var(--color-saffron);
}

/* Clean up old CSS styles we are replacing */
.nirukta-term.grouped::before { display: none; }
.nirukta-phrase { 
  border-top: none; 
  background-image: none; 
  padding-top: 0; 
  border-bottom: none; /* Removed phrase underline */
}
.nirukta-text { 
  position: relative; 
  line-height: 2.8; 
  margin-top: 1.5em; /* Space for top labels */
} /* Needs relative for absolute children */

/* Extra line height for annotations */
.nirukta-text {
  line-height: 3.4; /* Increased to prevent overlap */
  padding-top: 0.8em;
}

/* Hover states for grouped terms */
.nirukta-term.grouped:hover .nirukta-phrase {
  background-color: rgba(212, 175, 55, 0.08);
  border-radius: 2px;
  border-top-color: var(--color-saffron);
  /* Update gradient ticks on hover */
  background-image: 
    linear-gradient(to bottom, var(--color-saffron), var(--color-saffron)), 
    linear-gradient(to bottom, var(--color-saffron), var(--color-saffron));
}

.nirukta-term.grouped:hover::before {
  color: var(--color-saffron);
}

.nirukta-term.grouped:hover::before {
  color: var(--color-saffron);
}

/* Non-grouped / old format terms */
.nirukta-term:not(.grouped) {
  display: inline;
  cursor: pointer;
}

.nirukta-term:not(.grouped) .term-iast {
  color: var(--color-gold-bright);
  font-style: italic;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.nirukta-term:not(.grouped):hover .term-iast {
  color: var(--color-saffron);
  text-decoration-style: solid;
}

.term-iast-plain {
  color: var(--color-gold);
  font-style: italic;
}

/* Inline notes like [[Muladhara to Manipura]] */
.inline-note {
  color: var(--color-gold);
  font-style: italic;
  opacity: 0.85;
}

/* Tooltip container */
.nirukta-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #1a1a2e 0%, #16162a 100%);
  border: 2px solid var(--color-gold);
  border-radius: 12px;
  padding: 0;
  min-width: 280px;
  max-width: 380px;
  z-index: 9999;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(212, 175, 55, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  pointer-events: none;
  text-align: left;
  font-style: normal;
  overflow: visible;
}

.nirukta-tooltip::before {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-top-color: var(--color-gold);
  border-bottom: none;
}

.nirukta-tooltip::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: #1a1a2e;
  border-bottom: none;
}

/* Hover tooltips removed - now using click-based modal */
/* .nirukta-term:hover .nirukta-tooltip { display: block; } */

/* Tooltip rows - using span with display:block since we're inside a span container */
.tooltip-row {
  display: block;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  font-size: 0.8rem;
  line-height: 1.5;
}

.tooltip-row:last-of-type {
  border-bottom: none;
}

.tooltip-row:first-of-type {
  background: rgba(212, 175, 55, 0.1);
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}

.tooltip-label {
  font-weight: 700;
  color: var(--color-gold-bright);
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 0.2rem;
}

.tooltip-value {
  color: var(--color-text-primary);
  display: block;
}

/* YOGIC field - yogic system mapping (tattva, prana, kosha, etc.) */
.tooltip-yogic {
  background: rgba(255, 150, 50, 0.1);
  border-left: 3px solid #ff9632;
}

.tooltip-yogic .tooltip-label {
  color: #ff9632;
}

/* ADHARA field - anatomical/energetic location */
.tooltip-adhara {
  background: rgba(230, 100, 180, 0.1);
  border-left: 3px solid #e664b4;
}

.tooltip-adhara .tooltip-label {
  color: #e664b4;
}

/* LOGIC field - the reasoning chain */
.tooltip-logic {
  background: rgba(100, 180, 255, 0.1);
  border-left: 3px solid #64b4ff;
}

.tooltip-logic .tooltip-label {
  color: #64b4ff;
}

/* REF field - scriptural references */
.tooltip-ref {
  background: rgba(180, 130, 255, 0.1);
  border-left: 3px solid #b482ff;
}

.tooltip-ref .tooltip-label {
  color: #b482ff;
}

.tooltip-ref .tooltip-value {
  font-style: italic;
}

/* Sanskrit in REF that toggles with global script mode */
.ref-sanskrit {
  font-weight: 600;
  color: var(--color-gold);
}

.ref-sanskrit.iast-mode {
  font-style: italic;
}

/* Mobile: tooltip styles (now handled by modal) */
/* Inline tooltips no longer used - kept for reference */

.yogic-section .section-label {
  color: var(--color-saffron);
}

.yogic-section .translation-text {
  color: var(--color-text-secondary);
}

/* === ĀKHYĀNA Panel (Word-level secondary tooltip) === */

.nirukta-term.has-akhyana .term-iast {
  text-decoration-color: #4a9c4a;
}

.nirukta-term.has-akhyana .term-iast::after {
  content: '📖';
  font-size: 0.6em;
  margin-left: 2px;
  vertical-align: super;
}

/* Container needs to hold both tooltips */
.nirukta-term.has-akhyana {
  position: relative;
}

.akhyana-panel {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  left: calc(50% + 360px);
  transform: translateX(-50%);
  background: linear-gradient(135deg, #1a2a1a 0%, #162a16 100%);
  border: 2px solid #4a9c4a;
  border-radius: 12px;
  padding: 0;
  min-width: 280px;
  max-width: 340px;
  z-index: 10000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 20px rgba(74, 156, 74, 0.15);
  text-align: left;
  font-style: normal;
  pointer-events: none;
}

/* Hover akhyana panel removed - now using click-based modal */
/* .nirukta-term.has-akhyana:hover .akhyana-panel { display: block; } */

.akhyana-panel-header {
  display: block;
  padding: 0.6rem 1rem;
  background: rgba(74, 156, 74, 0.2);
  border-bottom: 1px solid rgba(74, 156, 74, 0.3);
  font-weight: 700;
  color: #7cdb7c;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.akhyana-row {
  display: block;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(74, 156, 74, 0.15);
  font-size: 0.8rem;
  line-height: 1.5;
}

.akhyana-row:last-of-type {
  border-bottom: none;
}

.akhyana-label {
  display: block;
  font-weight: 600;
  color: #7cdb7c;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.akhyana-value {
  display: block;
  color: var(--color-text-primary);
}

.akhyana-nirukta {
  background: rgba(100, 180, 100, 0.1);
  border-left: 3px solid #64b464;
}

.akhyana-ref {
  background: rgba(74, 156, 74, 0.05);
}

.akhyana-sanskrit {
  display: block;
  font-weight: 600;
  color: var(--color-gold);
  margin: 0.3rem 0;
}

.akhyana-translation {
  display: block;
  font-style: italic;
  color: var(--color-text-secondary);
  font-size: 0.75rem;
}

/* Mobile: ĀKHYĀNA panel as modal */
@media (max-width: 768px) {
  .akhyana-panel {
    position: fixed;
    top: 50%;
    left: 50% !important;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    min-width: 0;
    width: 90vw;
  }
}

/* === Nirukta/Akhyana Modal === */
.nirukta-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.nirukta-modal.hidden {
  display: none;
}

.nirukta-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.nirukta-modal-content {
  position: relative;
  background: linear-gradient(135deg, #1a1a2e 0%, #16162a 100%);
  border: 2px solid var(--color-gold);
  border-radius: 16px;
  max-width: 680px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(212, 175, 55, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: modalSlideIn 0.25s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.nirukta-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 1;
}

.nirukta-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-text-primary);
}

.nirukta-modal-term {
  padding: 1.25rem 1.5rem 0.75rem;
  font-size: 1.5rem;
  font-style: italic;
  color: var(--color-gold-bright);
  text-align: center;
  font-family: var(--font-english);
}

.nirukta-modal-tabs {
  display: flex;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  padding: 0 1rem;
}

.nirukta-tab {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.nirukta-tab:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nirukta-tab.active {
  color: var(--color-gold-bright);
  border-bottom-color: var(--color-gold);
  background: rgba(212, 175, 55, 0.1);
}

.nirukta-tab[data-tab="akhyana"].active {
  color: #7cdb7c;
  border-bottom-color: #4a9c4a;
  background: rgba(74, 156, 74, 0.1);
}

.nirukta-modal-body {
  overflow-y: auto;
  max-height: calc(80vh - 140px);
}

.nirukta-tab-content {
  display: none;
  padding: 0;
}

.nirukta-tab-content.active {
  display: block;
}

/* Reuse tooltip styling inside modal */
.nirukta-tab-content[data-tab="word"] .tooltip-row {
  display: block;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  font-size: 0.9rem;
  line-height: 1.6;
}

.nirukta-tab-content[data-tab="word"] .tooltip-row:first-child {
  background: rgba(212, 175, 55, 0.1);
}

.nirukta-tab-content[data-tab="word"] .tooltip-row:last-child {
  border-bottom: none;
}

.nirukta-tab-content[data-tab="word"] .tooltip-label {
  display: block;
  font-weight: 700;
  color: var(--color-gold-bright);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.3rem;
}

.nirukta-tab-content[data-tab="word"] .tooltip-value {
  display: block;
  color: var(--color-text-primary);
}

.proof-map {
  display: grid;
  gap: 0.9rem;
  padding: 1rem 1.25rem 1.25rem;
}

.proof-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.proof-source-word,
.proof-final-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  max-width: 100%;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  line-height: 1.2;
}

.proof-source-word {
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--color-gold-bright);
  font-family: var(--font-english);
  font-style: italic;
  background: rgba(212, 175, 55, 0.08);
}

.proof-final-pill {
  border: 1px solid rgba(122, 210, 162, 0.35);
  color: #b7f0d0;
  background: rgba(62, 152, 102, 0.12);
}

.proof-uml {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  align-items: stretch;
}

.proof-uml-node {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.4rem;
  min-width: 0;
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: 8px;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.035);
  color: var(--color-text-primary);
  font-size: 0.84rem;
  line-height: 1.4;
}

.proof-flow-step {
  position: relative;
}

.proof-flow-step::after {
  content: "↓";
  position: absolute;
  left: 50%;
  bottom: -0.86rem;
  transform: translateX(-50%);
  color: var(--color-gold-bright);
  font-weight: 700;
  z-index: 1;
}

.proof-uml-node strong {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 700;
  color: var(--color-text-primary);
}

.proof-uml-node span:not(.proof-node-label) {
  display: block;
  overflow-wrap: anywhere;
  color: var(--color-text-secondary);
}

.proof-node-label {
  display: block;
  color: var(--color-gold-bright);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.proof-uml-evidence {
  border-style: dashed;
  border-color: rgba(212, 175, 55, 0.55);
  background: rgba(212, 175, 55, 0.07);
}

.proof-uml-scripture {
  border-color: rgba(88, 172, 214, 0.42);
  background: rgba(88, 172, 214, 0.1);
}

.proof-bridge-group {
  display: grid;
  gap: 0.45rem;
}

.proof-bridge-label {
  justify-self: center;
  border: 1px solid rgba(88, 172, 214, 0.36);
  border-radius: 999px;
  padding: 0.18rem 0.65rem;
  color: #a7d8f2;
  background: rgba(88, 172, 214, 0.08);
  font-family: var(--font-english);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.proof-source-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
}

.proof-source-card {
  gap: 0.5rem;
}

.proof-merge-label {
  justify-self: center;
  color: var(--color-gold-bright);
  font-family: var(--font-english);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.proof-verse-sanskrit {
  color: var(--color-text-primary);
  font-family: var(--font-devanagari);
  font-size: 0.94rem;
  line-height: 1.55;
}

.proof-verse-iast {
  color: var(--color-text-secondary);
  font-family: var(--font-english);
  font-size: 0.8rem;
  font-style: italic;
  line-height: 1.45;
}

.proof-verse-translation {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 0.1rem;
  padding-top: 0.45rem;
  color: var(--color-text-primary);
}

.proof-verse-evidence,
.proof-verse-supports {
  color: var(--color-text-secondary);
  font-size: 0.78rem;
}

.proof-verse-supports {
  color: #b7f0d0;
}

.proof-uml-final {
  border-color: rgba(122, 210, 162, 0.42);
  background: rgba(62, 152, 102, 0.12);
}

/* Akhyana tab content styling */
.nirukta-tab-content[data-tab="akhyana"] {
  background: linear-gradient(135deg, #1a2a1a 0%, #162a16 100%);
}

.nirukta-tab-content[data-tab="akhyana"] .akhyana-row {
  display: block;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(74, 156, 74, 0.15);
  font-size: 0.9rem;
  line-height: 1.6;
}

.nirukta-tab-content[data-tab="akhyana"] .akhyana-row:last-child {
  border-bottom: none;
}

.nirukta-tab-content[data-tab="akhyana"] .akhyana-label {
  display: block;
  font-weight: 600;
  color: #7cdb7c;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

.nirukta-tab-content[data-tab="akhyana"] .akhyana-value {
  display: block;
  color: var(--color-text-primary);
}

.nirukta-tab-content[data-tab="akhyana"] .akhyana-nirukta {
  background: rgba(100, 180, 100, 0.1);
  border-left: 3px solid #64b464;
}

.nirukta-tab-content[data-tab="akhyana"] .akhyana-sanskrit {
  display: block;
  font-weight: 600;
  color: var(--color-gold);
  margin: 0.3rem 0;
}

.nirukta-tab-content[data-tab="akhyana"] .akhyana-translation {
  display: block;
  font-style: italic;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}

.nirukta-tab-content .no-content {
  padding: 2rem;
  text-align: center;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Mobile adjustments for modal */
@media (max-width: 768px) {
  .nirukta-modal-content {
    max-width: 95vw;
    max-height: 85vh;
  }
  
  .nirukta-modal-body {
    max-height: calc(85vh - 140px);
  }
  
  .nirukta-modal-term {
    font-size: 1.3rem;
    padding: 1rem 1.25rem 0.5rem;
  }

  .proof-map {
    padding: 0.85rem 1rem 1rem;
  }

  .proof-map-head {
    align-items: flex-start;
  }

  .proof-uml {
    gap: 0.85rem;
  }

  .proof-source-list {
    grid-template-columns: 1fr;
  }
}

/* === Footer === */
.footer {
  background: var(--color-bg-primary);
  border-top: 1px solid var(--color-border);
  padding: 3rem 1.5rem;
  text-align: center;
}

.footer-content {
  max-width: 700px;
  margin: 0 auto;
}

.mantra {
  font-family: var(--font-sanskrit);
  font-size: 1.2rem;
  color: var(--color-gold);
  margin-bottom: 1rem;
  line-height: 1.8;
}

.translation {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* === Responsive === */

/* Tablet */
@media (max-width: 1024px) {
  .canto-nav {
    gap: 0.4rem;
  }
  
  .canto-btn {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .header {
    padding: 0.75rem 0.75rem 0.5rem;
  }
  
  .header-content {
    margin-bottom: 0.75rem;
  }
  
  .om-symbol {
    font-size: 2rem;
  }
  
  .title {
    font-size: 1.5rem;
  }
  
  .subtitle {
    font-size: 0.9rem;
  }
  
  .tagline {
    font-size: 0.75rem;
    display: none;
  }
  
  /* Text navigation */
  .text-nav {
    gap: 0.5rem;
    margin: 0.75rem 0 0.5rem;
  }
  
  .text-btn {
    font-size: 1rem;
    padding: 0.5rem 1rem;
  }
  
  .text-btn .text-name {
    font-size: 0.65rem;
  }
  
  /* Section navigation - horizontal scroll */
  .canto-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 0.4rem;
    padding: 0 0.5rem 0.5rem;
    margin: 0.5rem 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  
  .canto-nav::-webkit-scrollbar {
    display: none;
  }
  
  .canto-btn {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
    white-space: nowrap;
  }
  
  .canto-btn .verse-count {
    font-size: 0.6rem;
  }
  
  /* Global controls */
  .global-controls {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 0.25rem;
  }
  
  .control-btn {
    width: 44px;
    height: 44px;
  }
  
  .progress-container {
    order: 3;
    width: 100%;
    margin-top: 0.25rem;
  }
  
  .verse-indicator {
    font-size: 0.7rem;
  }
  
  .audio-mode-selector {
    order: 2;
  }
  
  .mode-btn {
    font-size: 0.65rem;
    padding: 0.35rem 0.5rem;
  }
  
  .mode-btn[data-mode="sanskrit"] .mode-icon {
    font-size: 0.6rem;
  }
  
  .audio-source-toggle {
    order: 2;
  }
  
  .source-btn {
    font-size: 0.6rem;
    padding: 0.35rem 0.5rem;
  }
  
  .source-btn .source-label {
    display: none;
  }
  
  .speed-selector {
    order: 3;
  }
  
  .speed-btn {
    font-size: 0.6rem;
    padding: 0.3rem 0.4rem;
  }
  
  .script-toggle {
    order: 4;
  }
  
  .script-btn {
    font-size: 0.6rem;
    padding: 0.3rem 0.4rem;
  }
  
  .volume-control {
    display: none;
  }
  
  /* Verses */
  .verses-container {
    padding: 1rem 0.75rem;
    gap: 1.25rem;
  }
  
  .verse-card {
    padding: 1rem;
    border-radius: 12px;
  }
  
  .verse-number {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }
  
  .sanskrit-text {
    font-size: 1.1rem;
    line-height: 1.8;
  }
  
  .iast-text {
    font-size: 0.8rem;
  }
  
  .translation-label {
    font-size: 0.65rem;
  }
  
  .literal-translation,
  .yogic-translation {
    font-size: 0.9rem;
  }
  
  .yogic-section {
    padding: 0.75rem;
  }
  
  /* Footer */
  .footer {
    padding: 1.5rem 1rem;
  }
  
  .mantra {
    font-size: 0.9rem;
  }
  
  .translation {
    font-size: 0.75rem;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .header-content {
    margin-bottom: 0.5rem;
  }
  
  .om-symbol {
    font-size: 1.5rem;
  }
  
  .title {
    font-size: 1.25rem;
  }
  
  .subtitle {
    font-size: 0.8rem;
  }
  
  .text-nav {
    gap: 0.4rem;
  }
  
  .text-btn {
    font-size: 0.9rem;
    padding: 0.4rem 0.75rem;
  }
  
  .sanskrit-text {
    font-size: 1rem;
  }
  
  .toggle-label {
    gap: 0.4rem;
  }
  
  .toggle-switch {
    width: 36px;
    height: 20px;
  }
  
  .toggle-switch::before {
    width: 16px;
    height: 16px;
  }
}

/* === Word Audio Playing Indicator === */
.word-audio-indicator {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-bg-card);
  border: 1px solid var(--color-gold);
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  display: none;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-glow);
  z-index: 1000;
}

.word-audio-indicator.visible {
  display: flex;
}

.word-audio-indicator .wave {
  display: flex;
  gap: 2px;
  height: 16px;
  align-items: flex-end;
}

.word-audio-indicator .wave span {
  width: 3px;
  background: var(--color-gold);
  animation: wave-animation 0.5s ease-in-out infinite alternate;
}

.word-audio-indicator .wave span:nth-child(2) { animation-delay: 0.1s; }
.word-audio-indicator .wave span:nth-child(3) { animation-delay: 0.2s; }
.word-audio-indicator .wave span:nth-child(4) { animation-delay: 0.3s; }

@keyframes wave-animation {
  from { height: 4px; }
  to { height: 16px; }
}

.word-audio-indicator .word-text {
  font-family: var(--font-sanskrit);
  color: var(--color-sanskrit);
  font-size: 1.1rem;
}

/* === Verse Table of Contents Dropdown === */
.verse-nav-container {
  position: relative;
}

.verse-toc-btn {
  padding: 0.5rem;
}

.verse-toc-btn svg {
  opacity: 0.8;
  transition: opacity 0.2s;
}

.verse-toc-btn:hover svg {
  opacity: 1;
}

.verse-toc-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  width: 320px;
  max-height: 400px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), var(--shadow-glow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.verse-toc-dropdown.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.verse-toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.verse-toc-header span {
  font-family: var(--font-english);
  color: var(--color-gold);
  font-size: 0.9rem;
  font-weight: 600;
}

.verse-jump-input {
  width: 60px;
  padding: 0.4rem 0.6rem;
  background: var(--color-bg-deep);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text-primary);
  font-size: 0.9rem;
  text-align: center;
}

.verse-jump-input:focus {
  outline: none;
  border-color: var(--color-gold);
  box-shadow: 0 0 8px rgba(212, 164, 24, 0.3);
}

.verse-jump-input::placeholder {
  color: var(--color-text-muted);
}

/* Hide number input spinners */
.verse-jump-input::-webkit-outer-spin-button,
.verse-jump-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.verse-jump-input[type=number] {
  -moz-appearance: textfield;
}

.verse-toc-list {
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem;
}

.verse-toc-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.verse-toc-item:hover {
  background: rgba(212, 164, 24, 0.1);
}

.verse-toc-item.playing {
  background: rgba(212, 164, 24, 0.2);
}

.verse-toc-item.playing .verse-toc-num {
  color: var(--color-gold-bright);
}

.verse-toc-num {
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-elevated);
  border-radius: 6px;
  color: var(--color-gold);
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}

.verse-toc-preview {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  font-family: var(--font-english);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Highlight flash animation when jumping to verse */
.verse-card.highlight-flash {
  animation: highlight-flash 1.5s ease-out;
}

@keyframes highlight-flash {
  0% {
    box-shadow: 0 0 0 3px var(--color-gold), var(--shadow-card);
  }
  100% {
    box-shadow: var(--shadow-card);
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .verse-toc-dropdown {
    width: 280px;
    max-height: 350px;
    right: -50px;
  }
}

/* === Floating Jump to Playing Verse Button === */
.jump-to-verse-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: linear-gradient(135deg, var(--color-bg-card), var(--color-bg-elevated));
  border: 1px solid var(--color-gold);
  padding: 0.75rem 1.25rem;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), var(--shadow-glow);
  z-index: 1000;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, 
              background 0.2s ease, box-shadow 0.2s ease;
}

.jump-to-verse-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.jump-to-verse-btn:hover {
  background: linear-gradient(135deg, var(--color-bg-elevated), var(--color-bg-card));
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.6), 0 0 30px rgba(212, 164, 24, 0.25);
  border-color: var(--color-gold-bright);
}

.jump-to-verse-btn:active {
  transform: translateY(2px);
}

.jump-to-verse-btn .jump-icon {
  color: var(--color-gold-bright);
  font-size: 0.9rem;
  animation: pulse-icon 1.5s ease-in-out infinite;
}

@keyframes pulse-icon {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.jump-to-verse-btn .jump-text {
  color: var(--color-text-primary);
  font-family: var(--font-english);
  font-size: 0.95rem;
  white-space: nowrap;
}

.jump-to-verse-btn .jump-verse-num {
  color: var(--color-gold-bright);
  font-weight: 600;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .jump-to-verse-btn {
    bottom: 1rem;
    right: 1rem;
    padding: 0.6rem 1rem;
  }
  
  .jump-to-verse-btn .jump-text {
    font-size: 0.85rem;
  }
}
