/* Theme Variables */
:root {
  /* Light Theme (Default) — Warm teal accent */
  --bg-color: #FAF8F5;
  --surface-color: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --accent-color: #2A9D8F;
  --accent-secondary: #3DBAA9;
  --accent-darker: #228179;
  --accent-contrast: #ffffff;
  --active-bg: rgba(42, 157, 143, 0.06);
  --active-border: #2A9D8F;
  --border-color: #e2e8f0;
  --success-color: #16a34a;
  --success-tint: rgba(22, 163, 74, 0.1);
  --error-color: #dc2626;
  --error-bg: #fef2f2;
  --loading-color: #2A9D8F;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --accent-glow: rgba(42, 157, 143, 0.2);
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* Apply Dark Theme variables if body has .dark-theme OR by media query if body has no class */
@media (prefers-color-scheme: dark) {
  body:not(.light-theme) {
    --bg-color: #1A1B2E;
    --surface-color: #242538;
    --text-primary: #F0F0F8;
    --text-secondary: #8B8CA7;
    --accent-color: #2DD4A8;
    --accent-secondary: #5EEAD4;
    --accent-darker: #25B08D;
    --accent-contrast: #1A1B2E;
    --active-bg: #2A2B40;
    --active-border: #2DD4A8;
    --border-color: rgba(255, 255, 255, 0.08);
    --success-color: #4ade80;
    --success-tint: rgba(74, 222, 128, 0.1);
    --error-color: #f87171;
    --error-bg: #450a0a;
    --loading-color: #2DD4A8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
    --accent-glow: rgba(45, 212, 168, 0.3);
  }
}

body.dark-theme {
  --bg-color: #1A1B2E;
  --surface-color: #242538;
  --text-primary: #F0F0F8;
  --text-secondary: #8B8CA7;
  --accent-color: #2DD4A8;
  --accent-secondary: #5EEAD4;
  --accent-darker: #25B08D;
  --accent-contrast: #1A1B2E;
  --active-bg: #2A2B40;
  --active-border: #2DD4A8;
  --border-color: rgba(255, 255, 255, 0.08);
  --success-color: #4ade80;
  --success-tint: rgba(74, 222, 128, 0.1);
  --error-color: #f87171;
  --error-bg: #450a0a;
  --loading-color: #2DD4A8;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --accent-glow: rgba(45, 212, 168, 0.3);
}

/* CSS Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base Typography - Large text for elderly users */
body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 20px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-color);
  padding: 24px;
  max-width: 800px;
  margin: 0 auto;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Gradient header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 20px;
  margin: -24px -24px 24px -24px;
  background: linear-gradient(135deg, #FAF8F5 0%, #F0E6D6 100%);
  border-bottom: 2px solid rgba(42, 157, 143, 0.25);
}

@media (prefers-color-scheme: dark) {
  body:not(.light-theme) header {
    background: linear-gradient(135deg, #1A1B2E 0%, #1E2040 100%);
    border-bottom-color: rgba(45, 212, 168, 0.2);
  }
}

body.dark-theme header {
  background: linear-gradient(135deg, #1A1B2E 0%, #1E2040 100%);
  border-bottom-color: rgba(45, 212, 168, 0.2);
}

h1 {
  font-size: 36px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  margin-bottom: 0;
}

/* Settings button in header */
.settings-btn {
  background: var(--surface-color);
  border: 1.5px solid var(--border-color);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  color: var(--accent-color);
}

.settings-btn:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-color);
  box-shadow: var(--shadow-md);
}

.settings-btn:active {
  transform: scale(0.95);
}

/* Preferences overlay + popup */
.prefs-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.prefs-popup {
  background: var(--surface-color);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  max-width: 400px;
  width: 90%;
  padding: 32px;
}

.prefs-popup h2 {
  margin: 0 0 24px 0;
  font-size: 24px;
  font-weight: 800;
}

.prefs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.prefs-label {
  font-size: 18px;
  font-weight: 600;
}

.pref-toggle {
  min-height: 48px;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 700;
  border: 1.5px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.pref-toggle.active {
  background: var(--accent-color);
  color: var(--accent-contrast);
  border-color: var(--accent-color);
}

.prefs-hint {
  margin: 16px 0 24px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.pref-close-btn {
  width: 100%;
  min-height: 52px;
  padding: 14px;
  font-size: 18px;
  font-weight: 700;
  border: 1.5px solid var(--border-color);
  background: var(--active-bg);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.pref-close-btn:active {
  transform: scale(0.98);
}

.prefs-version {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  opacity: 0.7;
}

/* Instrument picker — pill-shaped toggles */
.instrument-options {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 20px 0 24px;
}

.instrument-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 88px;
  min-height: 88px;
  padding: 16px 12px;
  background: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.instrument-option:active {
  transform: scale(0.95);
}

.instrument-option.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--accent-contrast);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.instrument-option.active .instrument-label {
  color: var(--accent-contrast);
}

.instrument-icon {
  font-size: 28px;
  line-height: 1;
}

.instrument-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.prefs-instrument-options {
  padding: 0 0 16px;
}

/* Tempo / Pitch picker */
.tempo-pitch-picker {
  max-width: 400px;
}

.tempo-options,
.pitch-options {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 8px 0;
}

.tempo-options:first-of-type {
  margin-top: 20px;
}

.tempo-options:last-of-type,
.pitch-options:last-of-type {
  margin-bottom: 24px;
}

.tempo-option,
.pitch-option {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 56px;
  padding: 12px 8px;
  font-size: 16px;
  font-weight: 600;
  background: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.tempo-option:active,
.pitch-option:active {
  transform: scale(0.95);
}

.tempo-option.active,
.pitch-option.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--accent-contrast);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Tempo gradient intensity — deeper tint for more extreme values */
.tempo-option[data-tempo="10"],
.tempo-option[data-tempo="-10"] {
  background: rgba(42, 157, 143, 0.08);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.tempo-option[data-tempo="20"],
.tempo-option[data-tempo="-20"] {
  background: rgba(42, 157, 143, 0.15);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.tempo-option[data-tempo="30"],
.tempo-option[data-tempo="-30"] {
  background: rgba(42, 157, 143, 0.25);
  border-color: var(--accent-color);
  color: var(--accent-darker);
}

/* Dark mode tempo intensity overrides */
@media (prefers-color-scheme: dark) {
  body:not(.light-theme) .tempo-option[data-tempo="10"],
  body:not(.light-theme) .tempo-option[data-tempo="-10"] {
    background: rgba(45, 212, 168, 0.08);
    color: var(--accent-color);
  }
  body:not(.light-theme) .tempo-option[data-tempo="20"],
  body:not(.light-theme) .tempo-option[data-tempo="-20"] {
    background: rgba(45, 212, 168, 0.15);
    color: var(--accent-color);
  }
  body:not(.light-theme) .tempo-option[data-tempo="30"],
  body:not(.light-theme) .tempo-option[data-tempo="-30"] {
    background: rgba(45, 212, 168, 0.25);
    color: var(--accent-color);
  }
}

body.dark-theme .tempo-option[data-tempo="10"],
body.dark-theme .tempo-option[data-tempo="-10"] {
  background: rgba(45, 212, 168, 0.08);
  color: var(--accent-color);
}
body.dark-theme .tempo-option[data-tempo="20"],
body.dark-theme .tempo-option[data-tempo="-20"] {
  background: rgba(45, 212, 168, 0.15);
  color: var(--accent-color);
}
body.dark-theme .tempo-option[data-tempo="30"],
body.dark-theme .tempo-option[data-tempo="-30"] {
  background: rgba(45, 212, 168, 0.25);
  color: var(--accent-color);
}

/* Active tempo/pitch override stays filled */
.tempo-option.active,
.pitch-option.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--accent-contrast);
}

/* Song items — left accent border + warm styling */
.song-item {
  min-height: 72px;
  min-width: 100%;
  padding: 20px 24px;
  margin-bottom: 16px;
  font-size: 22px;
  font-weight: 500;
  border: 1.5px solid var(--border-color);
  border-left: 4px solid var(--accent-color);
  background: var(--surface-color);
  color: var(--text-primary);
  cursor: pointer;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Visual feedback within 100ms */
.song-item:active {
  background-color: var(--active-bg);
  transform: scale(0.98);
}

.song-item:hover {
  background-color: var(--active-bg);
  border-left-color: var(--accent-darker);
  box-shadow: var(--shadow-md);
}

/* Active song highlighting */
.song-item.active {
  background-color: var(--active-bg);
  border-left-color: var(--accent-darker);
  border-color: var(--active-border);
  border-left-color: var(--accent-darker);
  box-shadow: var(--shadow-md);
  font-weight: 700;
}

/* Dark mode glow on active song */
@media (prefers-color-scheme: dark) {
  body:not(.light-theme) .song-item.active {
    box-shadow: 0 0 16px rgba(45, 212, 168, 0.15), inset 0 0 0 1px rgba(45, 212, 168, 0.3);
  }
}

body.dark-theme .song-item.active {
  box-shadow: 0 0 16px rgba(45, 212, 168, 0.15), inset 0 0 0 1px rgba(45, 212, 168, 0.3);
}

/* Cache indicators for offline availability */
.cache-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 12px;
  font-size: 18px;
  font-weight: 800;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cache-indicator.cached {
  color: var(--success-color);
  background: var(--success-tint);
}

.cache-indicator.not-cached {
  color: var(--text-secondary);
  opacity: 0.5;
}

/* Make cache indicators more visible on active songs */
.song-item.active .cache-indicator.cached {
  background: var(--success-tint);
  opacity: 1;
}

/* Control buttons — gradient "stage" background */
.controls {
  display: none;
  margin: 32px 0;
  gap: 16px;
  padding: 16px;
  background: var(--active-bg);
  border-radius: var(--radius-lg);
  justify-content: center;
}

/* Dark mode: subtle accent gradient overlay on controls */
@media (prefers-color-scheme: dark) {
  body:not(.light-theme) .controls {
    background: linear-gradient(180deg, rgba(45, 212, 168, 0.06) 0%, rgba(45, 212, 168, 0.02) 100%);
  }
}

body.dark-theme .controls {
  background: linear-gradient(180deg, rgba(45, 212, 168, 0.06) 0%, rgba(45, 212, 168, 0.02) 100%);
}

.controls.visible {
  display: flex;
}

/* Base control button style */
.control-btn {
  min-width: 72px;
  min-height: 72px;
  font-size: 18px;
  font-weight: 600;
  padding: 12px 24px;
  border: 1.5px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-primary);
  cursor: pointer;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.control-btn:active {
  background: var(--active-bg);
  transform: scale(0.95);
  border-color: var(--accent-color);
}

.control-btn:focus {
  outline: 3px solid var(--accent-secondary);
  outline-offset: 2px;
}

.control-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
}

.control-btn.active {
  background: var(--accent-color);
  color: var(--accent-contrast);
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Button hierarchy — Primary: Play/Pause (filled accent) */
#btn-pause,
#btn-resume {
  background: var(--accent-color);
  color: var(--accent-contrast);
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px var(--accent-glow);
}

#btn-pause:active,
#btn-resume:active {
  background: var(--accent-darker);
  border-color: var(--accent-darker);
}

/* Dark mode glow on play button */
@media (prefers-color-scheme: dark) {
  body:not(.light-theme) #btn-pause,
  body:not(.light-theme) #btn-resume {
    box-shadow: 0 0 20px rgba(45, 212, 168, 0.25);
  }
}

body.dark-theme #btn-pause,
body.dark-theme #btn-resume {
  box-shadow: 0 0 20px rgba(45, 212, 168, 0.25);
}

/* Button hierarchy — Secondary: Piano, Metronome, Tempo (outlined accent) */
#btn-piano,
#btn-metronome,
#btn-tempo {
  background: transparent;
  color: var(--accent-color);
  border: 2px solid var(--accent-color);
  box-shadow: none;
}

#btn-piano:hover,
#btn-metronome:hover,
#btn-tempo:hover {
  background: var(--active-bg);
}

#btn-piano.active,
#btn-metronome.active,
#btn-tempo.active {
  background: var(--accent-color);
  color: var(--accent-contrast);
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Button hierarchy — Tertiary: Restart, Jump-back, Slow (light tint + subtle border) */
#btn-restart,
#btn-jump-back,
#btn-slow {
  background: var(--surface-color);
  color: var(--accent-color);
  border: 1.5px solid var(--border-color);
  box-shadow: none;
}

#btn-restart:hover,
#btn-jump-back:hover,
#btn-slow:hover {
  background: var(--active-bg);
  border-color: var(--accent-color);
}

#btn-restart:active,
#btn-jump-back:active,
#btn-slow:active {
  background: var(--active-bg);
  border-color: var(--accent-color);
  transform: scale(0.95);
}

/* Error messages - large, high contrast */
.error {
  font-size: 18px;
  font-weight: 500;
  color: var(--error-color);
  background: var(--error-bg);
  padding: 24px;
  border: 1.5px solid var(--error-color);
  border-radius: var(--radius-md);
  margin: 24px 0;
}

/* Loading indicator */
.loading {
  font-size: 20px;
  font-weight: 600;
  color: var(--loading-color);
  padding: 32px;
  text-align: center;
}

/* Progress bar */
#progress-container {
  display: none;
  margin: 32px 0;
  padding: 24px;
  background: var(--surface-color);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

#progress-container.visible {
  display: block;
}

#current-song-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* Progress bar wrapper with thumb */
.progress-bar-wrapper {
  position: relative;
  padding: 8px 0;
}

progress {
  width: 100%;
  height: 8px;
  border-radius: 100px;
  border: none;
  background-color: var(--active-bg);
  overflow: hidden;
  display: block;
}

.progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-color);
  border: 3px solid var(--accent-color);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  transition: left 0.3s ease;
}

/* Dark mode: glowing thumb */
@media (prefers-color-scheme: dark) {
  body:not(.light-theme) .progress-thumb {
    background: var(--accent-secondary);
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(45, 212, 168, 0.4);
  }
}

body.dark-theme .progress-thumb {
  background: var(--accent-secondary);
  border-color: var(--accent-color);
  box-shadow: 0 0 8px rgba(45, 212, 168, 0.4);
}

progress::-webkit-progress-bar {
  background-color: var(--active-bg);
  border-radius: 100px;
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent-color), var(--accent-secondary));
  border-radius: 100px;
  transition: width 0.3s ease;
}

progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent-color), var(--accent-secondary));
  border-radius: 100px;
}

#time-display {
  font-size: 16px;
  font-weight: 500;
  margin-top: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  display: flex;
  justify-content: space-between;
}

/* Status indicator */
.status-indicator {
  font-size: 18px;
  font-weight: 500;
  margin: 16px 0;
  padding: 16px;
  background: var(--active-bg);
  color: var(--accent-color);
  border-radius: var(--radius-md);
  text-align: center;
}

/* Navigation Button */
.nav-btn {
  font-size: 18px;
  font-weight: 600;
  padding: 12px 24px;
  margin-bottom: 24px;
  background-color: var(--surface-color);
  color: var(--accent-color);
  border: 1.5px solid var(--accent-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 60px;
  /* Touch target */
  transition: all 0.2s ease;
}

.nav-btn:active {
  background-color: var(--active-bg);
  transform: translateX(-4px);
}

/* Voice List Header */
.voice-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

#selected-song-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 0;
  color: var(--text-primary);
  padding: 0 4px;
  line-height: 1.2;
}

.pitch-header-btn {
  min-height: 48px;
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 600;
  border: 1.5px solid var(--accent-color);
  background: transparent;
  color: var(--accent-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.pitch-header-btn:active {
  transform: scale(0.95);
  background: var(--active-bg);
}

/* Voice Items Container */
#voice-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Responsive design - portrait */
@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  header {
    margin: -12px -12px 24px -12px;
    padding: 12px 16px;
  }

  h1 {
    font-size: 28px;
  }

  .song-item {
    font-size: 20px;
    padding: 18px;
  }

  /* 2x2 Grid for controls on mobile */
  .controls.visible {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  /* Ensure buttons fill the grid cells */
  .control-btn {
    width: 100%;
    min-width: 0;
  }
}

/* Responsive design - landscape */
@media (min-width: 601px) and (max-width: 1024px) {
  .controls {
    justify-content: center;
  }
}

/* Touch-action to prevent unwanted zoom */
button,
.song-item {
  touch-action: manipulation;
}

/* High visibility focus indicators */
*:focus {
  outline: 3px solid var(--accent-secondary);
  outline-offset: 2px;
}

/* Download spinner for first-time R2 downloads */
.download-spinner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 32px;
  background: var(--accent-color);
  color: var(--accent-contrast);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px var(--accent-glow);
  z-index: 1000;
  font-size: 18px;
  font-weight: 600;
}

.spinner-icon {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--accent-contrast);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
}

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

/* Pulsing animation for voice button loading state */
.song-item.voice-loading {
  animation: pulse-loading 1.2s ease-in-out infinite;
  background-color: var(--active-bg);
  border-color: var(--loading-color);
  color: var(--loading-color);
  pointer-events: none;
}

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

.spinner-text {
  font-weight: 500;
  white-space: nowrap;
}

/* Visible state for download spinner */
.download-spinner.visible {
  display: flex;
}

/* Responsive adjustments for spinner */
@media (max-width: 600px) {
  .download-spinner {
    bottom: 16px;
    left: 16px;
    right: 16px;
    transform: none;
    justify-content: center;
  }
}

/* PDF Styles */
.song-info {
  display: flex;
  align-items: center;
  flex-grow: 1;
}

.pdf-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  background-color: var(--surface-color);
  color: var(--text-secondary);
  margin-left: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  z-index: 2;
}

.pdf-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background-color: var(--active-bg);
}

.pdf-btn:active {
  transform: scale(0.95);
}

.song-item:hover .pdf-btn {
  border-color: var(--accent-secondary);
}

body.dark-theme .pdf-btn {
  background-color: rgba(255, 255, 255, 0.05);
}

body.dark-theme .pdf-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Organization Landing Page */
.org-landing-content {
  text-align: center;
  padding: 32px 0;
}

.org-logo {
  margin-bottom: 24px;
}

.org-logo img {
  max-width: 200px;
  max-height: 150px;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.org-landing-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.org-landing-description {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 600px;
  margin: 0 auto 32px;
  white-space: pre-line;
}

.org-projects {
  margin-top: 32px;
  text-align: left;
}

.org-projects h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.project-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card {
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 20px 24px;
  font-size: 22px;
  font-weight: 500;
  border: 1.5px solid var(--border-color);
  border-left: 4px solid var(--accent-color);
  background: var(--surface-color);
  color: var(--text-primary);
  cursor: pointer;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.project-card:hover {
  background-color: var(--active-bg);
  border-left-color: var(--accent-darker);
  box-shadow: var(--shadow-md);
}

.project-card:active {
  background-color: var(--active-bg);
  transform: scale(0.98);
}

@media (max-width: 600px) {
  .org-landing-title {
    font-size: 26px;
  }

  .org-landing-description {
    font-size: 16px;
  }

  .project-card {
    font-size: 20px;
    padding: 18px;
  }
}

/* Landing Page */
.landing-page {
  padding: 32px 0;
}

.landing-hero {
  text-align: center;
  margin-bottom: 48px;
}

.landing-title {
  font-size: 48px;
  font-weight: 800;
  color: var(--accent-color);
  margin-bottom: 16px;
  letter-spacing: -0.025em;
}

.landing-subtitle {
  font-size: 22px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

.landing-cta-container {
  margin-top: 24px;
}

.landing-instruction {
  font-size: 18px;
  color: var(--text-primary);
  font-weight: 600;
  padding: 16px 24px;
  background: var(--active-bg);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  display: inline-block;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.feature-card {
  padding: 24px;
  background: var(--surface-color);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: all 0.2s ease;
}

.feature-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-secondary);
}

.feature-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

@media (max-width: 600px) {
  .landing-title {
    font-size: 36px;
  }

  .landing-subtitle {
    font-size: 18px;
  }

  .landing-features {
    grid-template-columns: 1fr;
  }
}

/* Landing Legal Footer */
.landing-legal {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  align-items: start;
}

.landing-legal-section h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.landing-legal-section p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.landing-legal-copy {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 8px;
  opacity: 0.6;
}

.legal-email {
  color: var(--accent-color);
  text-decoration: none;
}

.legal-email:hover {
  text-decoration: underline;
}

/* Passcode Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  z-index: 3000;
  backdrop-filter: blur(4px);
}

.modal-overlay.visible {
  display: flex;
}

.modal-card {
  background: var(--surface-color);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  max-width: 400px;
  width: 90%;
  padding: 40px 32px;
  text-align: center;
}

.modal-title {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 12px 0;
  color: var(--text-primary);
}

.modal-description {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 20px;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-color);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease;
}

.modal-input:focus {
  border-color: var(--accent-color);
  outline: none;
}

.modal-btn {
  width: 100%;
  min-height: 52px;
  margin-top: 16px;
  padding: 14px;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  background: var(--accent-color);
  color: var(--accent-contrast);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.modal-btn:hover {
  background: var(--accent-darker);
}

.modal-btn:active {
  transform: scale(0.98);
}

/* YouTube example links on voice-list page */
.youtube-links-section {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.youtube-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #FF0000;
  color: white;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.youtube-link-btn:hover {
  opacity: 0.85;
}
