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

:root {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-raised: #242440;
  --text: #f0f0f0;
  --text-dim: #8888aa;
  --accent: #f54997;
  --accent-dim: rgba(245, 73, 151, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-h: 64px;
  --player-h: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Layout */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: calc(var(--player-h) + var(--nav-h) + var(--safe-bottom) + 16px);
}

/* Nav */
nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-card);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  z-index: 100;
}

nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}

nav a.active { color: var(--accent); }

nav a svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Mini Player */
#player {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  left: 0;
  right: 0;
  height: var(--player-h);
  background: var(--bg-raised);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: none;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 99;
}

#player.active { display: flex; }

#player-art {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-card);
  flex-shrink: 0;
}

#player-info {
  flex: 1;
  min-width: 0;
}

#player-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#player-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#player-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s;
}

#player-btn:active { transform: scale(0.92); }

#player-btn svg { width: 22px; height: 22px; fill: white; }

/* Station Grid */
.station-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

.station-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  gap: 16px;
}

.station-card:active { transform: scale(0.98); }
.station-card.playing { background: var(--accent-dim); }

.station-card.featured {
  grid-column: 1;
  padding: 28px 24px;
}

.station-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.station-card.playing .station-dot {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.station-name {
  font-size: 16px;
  font-weight: 600;
}

.station-card.featured .station-name {
  font-size: 20px;
}

.station-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Now Playing */
.now-playing {
  max-width: 600px;
  margin: 24px auto 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  display: none;
}

.now-playing.active { display: block; }

.now-playing-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 16px;
  font-weight: 600;
}

.now-playing-show {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.now-playing-show img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.now-playing-show-title {
  font-size: 18px;
  font-weight: 700;
}

.now-playing-show-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

.track-list {
  list-style: none;
}

.track-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.track-item:first-child { border-top: none; }

.track-art {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
}

.track-info { flex: 1; min-width: 0; }

.track-artist {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-name {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-time {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* Search */
.search-bar {
  max-width: 600px;
  margin: 0 auto 20px;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--bg-card);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.search-bar input:focus {
  border-color: var(--accent);
}

.search-bar input::placeholder { color: var(--text-dim); }

.search-bar svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  fill: var(--text-dim);
}

/* Result cards */
.result-list {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.result-card:active { background: var(--bg-raised); }

.result-card img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
}

.result-card-info { flex: 1; min-width: 0; }

.result-card-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-card-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.result-card-badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--accent-dim);
  color: var(--accent);
  flex-shrink: 0;
  font-weight: 600;
}

/* Section headers */
.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 24px auto 12px;
  max-width: 600px;
  font-weight: 600;
}

.section-title:first-child { margin-top: 0; }

/* Schedule */
.schedule-header {
  max-width: 600px;
  margin: 0 auto 16px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.schedule-header select,
.schedule-header input[type="date"] {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state-text {
  font-size: 15px;
  line-height: 1.5;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-dim);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

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

/* View header */
.view-title {
  font-size: 28px;
  font-weight: 700;
  max-width: 600px;
  margin: 0 auto 20px;
}

/* Library episode card */
.episode-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.episode-card:active { background: var(--bg-raised); }

.episode-card-info { flex: 1; min-width: 0; }

.episode-card-title {
  font-size: 14px;
  font-weight: 600;
}

.episode-card-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
}

/* Subscribe button */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s;
}

.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--accent); color: white; }
.btn-ghost { background: rgba(255,255,255,0.06); color: var(--text); }

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  max-width: 600px;
}

.back-link svg { width: 16px; height: 16px; fill: currentColor; }

/* Responsive */
@media (min-width: 500px) {
  .station-grid {
    grid-template-columns: 1fr 1fr;
  }
  .station-card.featured {
    grid-column: 1 / -1;
  }
}
