:root {
  --bg: #12131f;
  --bg-elevated: #1a1d2e;
  --bg-card: #1e2236;
  --text: #f3efe3;
  --muted: #b3af9e;
  --accent: #d6a54b;
  --accent-soft: rgba(214, 165, 75, 0.18);
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(214, 165, 75, 0.12), transparent 28%),
    linear-gradient(180deg, #17192a 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
button, input { font: inherit; }
a { word-break: break-word; }

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

/* ===== View toggling ===== */
.view { transition: opacity 0.2s ease; }
.hidden { display: none !important; }

/* ===== HERO ===== */
.hero, .controls {
  background: rgba(26, 29, 46, 0.9);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: 24px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}

.hero-brand {
  display: flex;
  gap: 20px;
  align-items: center;
}

.podcast-logo {
  width: 116px;
  height: 116px;
  object-fit: cover;
  border-radius: 24px;
  border: 1px solid rgba(214, 165, 75, 0.35);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--accent);
  margin: 0 0 8px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(2rem, 4vw, 3.3rem); }
.hero-copy { color: var(--muted); max-width: 60ch; margin-bottom: 0; }

.hero-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.stat {
  min-width: 120px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
}

.stat span {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.stat label { color: var(--muted); font-size: 0.9rem; }

/* ===== STATS DASHBOARD ===== */
.stats-panel {
  margin: 22px 0;
  background: rgba(26, 29, 46, 0.9);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.stats-header {
  margin-bottom: 24px;
}

.stats-header h2 {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.stats-header p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card-compact {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.stat-card-compact h3 {
  font-size: 0.82rem;
  margin-bottom: 10px;
  color: var(--accent);
  white-space: normal;
  line-height: 1.3;
}

.stat-card-compact {
  transition: all 0.2s ease;
}

.stat-card-compact:hover {
  border-color: rgba(214, 165, 75, 0.3);
}

.stat-card-compact.expanded {
  grid-column: 1 / -1;
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(214, 165, 75, 0.3);
}

.stat-card-compact.expanded .stat-list-full {
  columns: 2;
  column-gap: 20px;
}

.expand-hint {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
  margin-left: 6px;
}

/* Host bars */
.host-scoreboard-compact {
  margin-bottom: 16px;
}

.host-bars {
  display: flex;
  gap: 16px;
  align-items: center;
}

.host-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.host-bar-row .host-tag {
  width: 72px;
  min-width: 72px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.host-bar-track {
  flex: 1;
  height: 24px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  overflow: hidden;
}

.host-bar-fill {
  height: 100%;
  border-radius: 12px;
  transition: width 0.6s ease;
}

.host-bar-fill.steve {
  background: linear-gradient(90deg, rgba(99, 162, 255, 0.6), rgba(99, 162, 255, 0.3));
}

.host-bar-fill.windham {
  background: linear-gradient(90deg, rgba(255, 126, 99, 0.6), rgba(255, 126, 99, 0.3));
}

.host-bar-count {
  min-width: 80px;
  text-align: right;
  font-weight: 600;
  font-size: 0.88rem;
}

.host-bar-pct {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.78rem;
}

/* Stat lists */
.stat-list {
  padding: 0;
  margin: 0;
  counter-reset: stat-counter;
}

.stat-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  margin-bottom: 2px;
  counter-increment: stat-counter;
}

.stat-list li:nth-child(odd) {
  background: rgba(0, 0, 0, 0.12);
}

ol.stat-list li::before {
  content: counter(stat-counter) ".";
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
  min-width: 20px;
}

.stat-name {
  flex: 1;
  font-size: 0.82rem;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stat-count {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.85rem;
  min-width: 24px;
  text-align: right;
}

/* ===== CONTROLS ===== */
.controls {
  margin: 22px 0;
  padding: 18px;
  border-radius: 20px;
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
}

.search-wrap { flex: 1 1 340px; }
.search-wrap span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.search-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

.clear-search-btn {
  flex-shrink: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--accent);
  cursor: pointer;
}

.search-wrap input::placeholder { color: var(--muted); opacity: 0.6; }

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-chip {
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
}

.filter-chip.active {
  background: var(--accent);
  color: #1a1307;
  border-color: transparent;
}

/* ===== SECTION HEADING ===== */
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.section-heading p { color: var(--muted); margin-bottom: 0; }

/* ===== EPISODE GRID (browse) ===== */
.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.episode-card {
  background: rgba(26, 29, 46, 0.9);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 20px;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.episode-card:hover {
  transform: translateY(-3px);
  border-color: rgba(214, 165, 75, 0.3);
}

.episode-button {
  width: 100%;
  padding: 0;
  border: 0;
  text-align: left;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.episode-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.art-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
}

.episode-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.type-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(10, 10, 10, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.episode-meta { padding: 14px; }
.episode-kicker, .episode-date { color: var(--muted); font-size: 0.9rem; }
.episode-title { margin: 6px 0 10px; font-size: 1rem; line-height: 1.35; }

.song-count-badge {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 999px;
}

/* ===== DETAIL VIEW ===== */
.detail-nav {
  margin-bottom: 24px;
}

.nav-logo {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(214, 165, 75, 0.35);
  transition: transform 0.15s ease;
}

.nav-logo:hover {
  transform: scale(1.08);
}

.detail-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.back-btn {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 12px 20px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.15s ease;
}

.back-btn:hover {
  background: var(--accent-soft);
}

.detail-content {
  max-width: 900px;
  margin: 0 auto;
}

.detail-header {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin-bottom: 32px;
}

.detail-art {
  width: 260px;
  height: 260px;
  object-fit: cover;
  border-radius: 20px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.detail-header-info {
  flex: 1;
}

.detail-header-info h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin-bottom: 14px;
  line-height: 1.2;
}

.detail-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pill {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.82rem;
}

/* ===== SONG BLOCKS ===== */
.detail-songs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.song-block {
  padding: 20px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
}

.song-block.final-cut {
  background: rgba(214, 165, 75, 0.08);
  border-color: rgba(214, 165, 75, 0.25);
}

.song-block.final-cut h3 {
  color: var(--accent);
}

.song-block h3 {
  margin-bottom: 14px;
  font-size: 1.05rem;
}

.song-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.song-list li {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  margin-bottom: 8px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
}

.track-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.host-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.host-tag.steve {
  background: rgba(99, 162, 255, 0.18);
  color: #7bb8ff;
  border: 1px solid rgba(99, 162, 255, 0.3);
}

.host-tag.windham {
  background: rgba(255, 126, 99, 0.18);
  color: #ff9e8a;
  border: 1px solid rgba(255, 126, 99, 0.3);
}

.host-tag.both {
  background: rgba(180, 140, 255, 0.18);
  color: #c4a8ff;
  border: 1px solid rgba(180, 140, 255, 0.3);
}

.host-tag.unknown {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  border: 1px solid var(--border);
}

.song-info {
  flex: 1;
}

.empty-state {
  color: var(--muted);
  font-style: italic;
  padding: 10px 0;
}

/* ===== DESCRIPTION ===== */
.detail-description-section {
  background: rgba(26, 29, 46, 0.9);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 40px;
}

.detail-description-section h3 {
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.detail-description {
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-line;
}

/* ===== SONG SEARCH RESULTS ===== */
.song-results {
  background: rgba(26, 29, 46, 0.95);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.song-results-header {
  margin-bottom: 20px;
}

.song-results-header h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.song-results-header p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0;
}

.song-results-section {
  margin-bottom: 20px;
}

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

.song-results-section h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--accent);
}

.song-results-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.song-results-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  margin-bottom: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.ep-link {
  margin-left: auto;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  white-space: normal;
  overflow-wrap: anywhere;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.ep-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.result-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-badge.win {
  background: rgba(214, 165, 75, 0.2);
  color: var(--accent);
  border: 1px solid rgba(214, 165, 75, 0.35);
}

.result-badge.nom {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ===== ARTIST LINKS ===== */
.artist-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.15s;
}

.artist-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ===== ARTIST VIEW ===== */
.artist-header {
  margin-bottom: 32px;
}

.artist-hero-img {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.artist-header h2 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin-bottom: 16px;
}

.artist-stats-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.artist-stat {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 20px;
  text-align: center;
  min-width: 100px;
}

.artist-stat-num {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.artist-stat-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.artist-host-split {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

.artist-songs h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--accent);
}

.artist-song-card {
  background: rgba(26, 29, 46, 0.9);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 12px;
}

.artist-song-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.artist-song-name {
  font-size: 1.05rem;
  font-weight: 700;
}

.artist-song-badges {
  display: flex;
  gap: 6px;
}

.artist-song-episodes {
  list-style: none;
  padding: 0;
  margin: 0;
}

.artist-song-episodes li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 0.88rem;
}

.artist-song-episodes li:nth-child(odd) {
  background: rgba(0, 0, 0, 0.12);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .app-shell { padding: 16px; }
  .hero { padding: 18px; flex-direction: column; align-items: flex-start; }
  .hero-brand { flex-direction: column; align-items: flex-start; }
  .podcast-logo { width: 92px; height: 92px; }
  .controls { padding: 14px; }
  .episode-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }

  .stats-panel { padding: 18px; }
  .stats-row { grid-template-columns: 1fr; }
  .host-bars { flex-direction: column; gap: 8px; }
  .host-bar-row { width: 100%; }
  .host-bar-row .host-tag { width: 72px; min-width: 72px; }
  .stat-card-compact.expanded .stat-list-full { columns: 1; }

  .detail-nav { flex-wrap: wrap; }
  .detail-header { flex-direction: column; gap: 16px; }
  .detail-art { width: 100%; height: auto; max-width: 320px; aspect-ratio: 1; }
  .detail-meta { gap: 8px; }
  .pill { font-size: 0.76rem; }

  .detail-songs { grid-template-columns: 1fr; }
  .song-list li, .artist-song-episodes li { flex-wrap: wrap; align-items: flex-start; }
  .artist-stats-row { gap: 10px; }
  .artist-stat { min-width: calc(50% - 6px); flex: 1 1 calc(50% - 6px); padding: 12px; }
  .artist-host-split { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .app-shell { padding: 12px; }
  .hero, .controls, .stats-panel, .detail-description-section, .artist-song-card { border-radius: 16px; }
  .episode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .detail-content { padding: 0; }
  .search-input-row { align-items: stretch; }
  .search-wrap input { padding: 12px 14px; }
  .clear-search-btn { padding: 12px 12px; font-size: 0.82rem; }
  .filter-chip { padding: 9px 12px; }
  .host-bar-count { min-width: 62px; font-size: 0.8rem; }
  .host-bar-row { gap: 8px; }
  .host-bar-row .host-tag { width: 64px; min-width: 64px; font-size: 0.68rem; }
  .artist-stat { min-width: 100%; flex-basis: 100%; }
  .artist-song-header { align-items: flex-start; }
  .artist-song-badges { flex-wrap: wrap; }
  .song-info { min-width: 0; overflow-wrap: anywhere; }
  .ep-link { width: 100%; margin-left: 0; }
}
