:root {
  /* Colors - OKLCH */
  --bg-ground: oklch(0.15 0 0);
  --bg-surface: oklch(0.18 0 0);
  
  --color-accent: oklch(0.75 0.15 60); /* Warm Amber */
  --color-live: oklch(0.65 0.2 20); /* Red/Pink for LIVE */
  
  --text-primary: oklch(0.95 0 0);
  --text-secondary: oklch(0.6 0 0);
  --text-muted: oklch(0.5 0 0);
  
  --border-subtle: oklch(0.25 0 0);
  --border-hover: oklch(0.4 0 0);

  /* Typography */
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-mono: 'Space Mono', monospace;

  /* Easing */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

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

body {
  background-color: var(--bg-ground);
  color: var(--text-primary);
  font-family: var(--font-display);
  min-height: 100dvh;
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  width: 100%;
  height: 100dvh;
}

/* ================= Left Panel ================= */
.player-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 64px 80px;
  border-right: 1px solid var(--border-subtle);
  position: relative;
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.live-label {
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.mode-tabs {
  display: flex;
  gap: 16px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 16px;
  cursor: pointer;
  transition: color 160ms var(--ease-out);
}

.tab-btn.active {
  color: var(--text-primary);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.city-info {
  margin-top: 80px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.city-name {
  font-size: 96px;
  font-weight: 300;
  letter-spacing: -2px;
  line-height: 1;
  color: var(--text-primary);
}

.country-name {
  font-size: 24px;
  font-weight: 300;
  color: var(--text-secondary);
}

/* Tuning / Loading placeholder state */
.is-tuning .city-name,
.is-tuning .massive-freq,
.is-tuning .station-title {
  opacity: 0.55;
  animation: pulse-tuning 2s ease-in-out infinite;
}

@keyframes pulse-tuning {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.75; }
}

.tuner-display {
  margin-top: auto;
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
}

.frequency-group {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap; /* allow wrapping if frequency text is too long */
}

.massive-freq {
  font-family: var(--font-mono);
  font-size: 140px; /* Reduced slightly to prevent cramping */
  font-weight: 400;
  letter-spacing: -2px; /* Reduced negative spacing */
  color: var(--color-accent);
  line-height: 1; /* Normal line height */
  word-break: break-word;
}

.freq-unit {
  font-size: 32px;
  color: var(--color-accent);
}

.station-title {
  font-size: 24px;
  color: var(--text-primary);
  margin-top: 16px;
  font-weight: 400;
}

.playback-controls {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-top: 48px;
}

.play-btn {
  background: transparent;
  border: none;
  color: var(--color-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 140ms var(--ease-out);
}

.play-btn:active {
  transform: scale(0.9);
}

.player-fav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: color 160ms var(--ease-out), transform 140ms var(--ease-out);
}

.player-fav-btn:hover {
  color: var(--text-primary);
}

.player-fav-btn.favorited {
  color: var(--color-accent);
}

.player-fav-btn:active {
  transform: scale(0.85);
}

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

.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--color-accent) 0%,
    var(--color-accent) var(--volume-percent, 80%),
    var(--border-subtle) var(--volume-percent, 80%),
    var(--border-subtle) 100%
  );
  outline: none;
  cursor: pointer;
  transition: opacity 160ms var(--ease-out);
  padding: 0;
  margin: 0;
  vertical-align: middle;
}

/* Chrome, Safari, Edge, WebKit track */
.vol-slider::-webkit-slider-runnable-track {
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: transparent; /* Background handled by input gradient */
}

/* Chrome, Safari, Edge, WebKit thumb */
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  margin-top: -4px; /* Center 12px thumb on 4px track: (4 - 12) / 2 = -4px */
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transition: transform 140ms var(--ease-out), background-color 140ms ease;
}

.vol-slider:hover::-webkit-slider-thumb,
.vol-slider:active::-webkit-slider-thumb {
  transform: scale(1.3);
}

/* Firefox track */
.vol-slider::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--border-subtle);
  border: none;
}

.vol-slider::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--color-accent);
}

/* Firefox thumb */
.vol-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transition: transform 140ms var(--ease-out);
}

.vol-slider:hover::-moz-range-thumb,
.vol-slider:active::-moz-range-thumb {
  transform: scale(1.3);
}

/* ================= Right Panel ================= */
.library-panel {
  width: 480px;
  display: flex;
  flex-direction: column;
  padding: 64px 80px;
  background-color: var(--bg-ground);
}

.library-header {
  display: flex;
  flex-direction: column;
  gap: 40px;
  margin-bottom: 40px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 2px solid var(--border-subtle);
  padding-bottom: 12px;
  color: var(--text-muted);
}

.search-bar:focus-within {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 16px;
  width: 100%;
}

.genre-filters {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.genre-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 16px;
  padding-bottom: 8px;
  cursor: pointer;
  transition: color 160ms var(--ease-out);
}

.genre-btn.active {
  color: var(--text-primary);
  border-bottom: 2px solid var(--color-accent);
}

.genre-btn:hover {
  color: var(--text-primary);
}

/* Stations List */
.stations-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Hide scrollbar for a cleaner look */
.stations-list::-webkit-scrollbar {
  display: none;
}

.station-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: transform 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.station-item:hover {
  border-color: var(--border-hover);
  transform: translateX(4px);
}

.station-item.active {
  border-color: var(--color-accent);
}

.station-info {
  display: flex;
  align-items: center;
  gap: 24px;
}

.station-freq {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-muted);
  width: 56px;
}

.station-item.active .station-freq {
  color: var(--color-accent);
}

.station-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.station-name {
  font-size: 18px;
  color: var(--text-primary);
}

.station-item.active .station-name {
  color: var(--text-primary);
}

.station-city {
  font-size: 14px;
  color: var(--text-muted);
}

.station-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.fav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  transition: color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.fav-btn:hover {
  color: var(--text-primary);
}
.fav-btn.favorited {
  color: var(--color-accent);
}
.fav-btn:active {
  transform: scale(0.9);
}

.live-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-accent);
  display: none;
}

.station-item.active.playing .live-indicator {
  display: block;
}

/* Mobile Nav (Hidden on Desktop) */
.mobile-nav {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: row;
  }
  .player-panel {
    padding: 48px;
  }
  .library-panel {
    padding: 48px;
  }
  .massive-freq {
    font-size: 120px;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    overflow-y: hidden;
  }
  
  /* Mobile UI toggle logic */
  .player-panel, .library-panel {
    width: 100%;
    height: calc(100dvh - 80px); /* Leave room for bottom nav */
    padding: 40px 24px 24px;
    border: none;
    display: none;
  }

  /* When the view is set via JS (default player) */
  .app-container:not(.show-library) .player-panel {
    display: flex;
  }
  
  .app-container.show-library .library-panel {
    display: flex;
  }

  /* Specific mobile adjustments */
  .city-name {
    font-size: 56px;
  }

  .massive-freq {
    font-size: 100px;
  }
  
  .tuner-display {
    flex: 1;
    margin-top: 40px;
    align-items: center;
  }

  .station-title {
    text-align: center;
    margin-top: 16px;
    margin-bottom: 36px;
  }

  .city-info {
    margin-top: 40px;
  }
  
  .playback-controls {
    margin-top: auto;
    padding-top: 24px;
    width: 100%;
    justify-content: center;
    gap: 20px;
  }

  .library-header {
    gap: 24px;
    margin-bottom: 24px;
  }
  
  /* Show and style mobile nav */
  .mobile-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 80px;
    background-color: var(--bg-ground);
    border-top: 1px solid var(--border-subtle);
    padding-bottom: 12px;
  }

  .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    cursor: pointer;
  }

  .nav-item span {
    font-size: 10px;
    font-family: var(--font-display);
  }

  .nav-item.active {
    color: var(--text-primary);
  }
}
