:root {
  --bg: #0e1015;
  --bg-2: #14171e;
  --surface: #1a1e27;
  --line: #262b36;
  --ink: #f2f3f6;
  --ink-2: #a3a9b6;
  --accent: #fa225b;
  --accent-soft: rgba(250, 34, 91, 0.14);
  --good: #4cd08a;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  background: rgba(14, 16, 21, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.brand img { border-radius: 8px; }
.brand em { font-style: normal; color: var(--ink); }
.site-header nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.site-header nav a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.92rem;
}
.site-header nav a:hover { color: var(--ink); }

/* Hero / player */
.hero {
  display: flex;
  justify-content: center;
  padding: 3rem 1.25rem 3.5rem;
  background:
    radial-gradient(60rem 30rem at 50% -10%, var(--accent-soft), transparent 60%),
    linear-gradient(var(--bg-2), var(--bg));
}
.player {
  width: min(34rem, 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.cover-wrap { position: relative; margin-bottom: 1rem; }
.cover {
  width: min(280px, 62vw);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  background: var(--surface);
}
.playing .cover { border-color: var(--accent); }

.eq {
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  display: none;
  gap: 4px;
  align-items: flex-end;
  height: 26px;
  padding: 5px 9px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.playing .eq { display: flex; }
.eq i {
  width: 4px;
  height: 6px;
  background: var(--accent);
  border-radius: 2px;
  animation: eq 0.9s ease-in-out infinite alternate;
}
.eq i:nth-child(2) { animation-delay: 0.15s; }
.eq i:nth-child(3) { animation-delay: 0.35s; }
.eq i:nth-child(4) { animation-delay: 0.1s; }
.eq i:nth-child(5) { animation-delay: 0.25s; }
@keyframes eq { from { height: 5px; } to { height: 16px; } }

/* Bars driven by the live audio spectrum: the script scales each one per frame,
   so the fixed animation above is only the fallback when analysis is unavailable. */
.eq.reactive i {
  animation: none;
  height: 16px;
  transform-origin: bottom;
  transform: scaleY(0.3);
  will-change: transform;
}

.live-row {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  color: var(--ink-2);
  min-height: 1.4rem;
}
.live-badge {
  display: none;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
}
.is-live .live-badge { display: inline-flex; }
.live-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

.station-name {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.now-title {
  margin: 0.1rem 0 0;
  font-size: clamp(1.4rem, 4.5vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.now-artist {
  margin: 0.15rem 0 0;
  color: var(--ink-2);
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.controls {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin-top: 1.4rem;
  flex-wrap: wrap;
  justify-content: center;
}
.play-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 10px 30px rgba(250, 34, 91, 0.35);
}
.play-btn:hover { transform: scale(1.05); }
.play-btn:active { transform: scale(0.97); }
.spin { animation: rotate 0.9s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }

.volume { display: flex; align-items: center; gap: 0.5rem; }
.volume button {
  background: none;
  border: none;
  color: var(--ink-2);
  cursor: pointer;
  padding: 0.4rem;
}
.volume button:hover { color: var(--ink); }
input[type="range"] {
  width: 130px;
  accent-color: var(--accent);
}
.player-msg {
  min-height: 1.3rem;
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-2);
}

/* Sections */
.section {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
  border-top: 1px solid var(--line);
}
.section h2 {
  margin: 0 0 0.3rem;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
.section-lede { margin: 0 0 1.2rem; color: var(--ink-2); }
.section p { color: var(--ink); }
.section p strong { color: var(--ink); }
.stream-links { font-size: 0.92rem; }

/* History */
.history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.history li {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.9rem;
}
.history img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-2);
  flex-shrink: 0;
}
.history .h-meta { min-width: 0; }
.history .h-title {
  font-weight: 600;
  font-size: 0.96rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history .h-artist {
  color: var(--ink-2);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history .h-time {
  margin-left: auto;
  color: var(--ink-2);
  font-size: 0.8rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.history-empty { justify-content: center; color: var(--ink-2); }

/* Badges + social */
.badges { display: flex; gap: 0.9rem; flex-wrap: wrap; align-items: center; }
.badges img { display: block; height: 48px; width: auto; }
.social-links { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 0.8rem; }
.social-links a {
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-size: 0.92rem;
}
.social-links a:hover { border-color: var(--accent); color: var(--accent); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.6rem 1.25rem 2.2rem;
  text-align: center;
  color: var(--ink-2);
  font-size: 0.85rem;
}
.site-footer p { margin: 0; }

@media (max-width: 480px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .site-header nav { gap: 0.9rem; }
}
