/* milkwave — fullscreen Butterchurn canvas, overlay card, drawer, transport. */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #000;
  color: #f2f2f2;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}
button {
  font: inherit;
  color: inherit;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 0.45em 0.8em;
  cursor: pointer;
}
button:hover { background: rgba(255, 255, 255, 0.22); }
button[aria-pressed="false"] { opacity: 0.65; }

#visualizer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  background: #000;
}

/* --- Now-playing overlay card (top left, above the visualization) --- */
.card {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 5;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  max-width: min(430px, calc(100vw - 32px));
  padding: 14px;
  border-radius: 14px;
  background: rgba(10, 10, 14, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.card-art {
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  object-fit: cover;
  border-radius: 10px;
  background: #222;
}
.card-art[src=""] { visibility: hidden; }
.card-body { min-width: 0; }
.card-top { display: flex; gap: 8px; align-items: center; }
.card-station {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #bdbdbd;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-dot {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  background: #d32f2f;
  border-radius: 4px;
  padding: 1px 6px;
}
.live-dot::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  background: #fff;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }
.card-title {
  margin: 4px 0 2px;
  font-size: 1.25rem;
  line-height: 1.2;
  overflow-wrap: break-word;
}
.card-artist { margin: 0; font-size: 1rem; color: #e0e0e0; overflow-wrap: break-word; }
.card-meta { margin: 6px 0 0; font-size: 0.8rem; color: #bdbdbd; }
.card-status { margin: 4px 0 0; font-size: 0.8rem; color: #ffb74d; }
.card-status:empty { display: none; }

/* --- Preset bar (top right) --- */
.preset-bar {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 5;
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: calc(100vw - 32px);
  flex-wrap: wrap;
  justify-content: flex-end;
}
.preset-name {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  color: #ddd;
  background: rgba(10, 10, 14, 0.6);
  border-radius: 8px;
  padding: 0.45em 0.8em;
}
.preset-name:empty { display: none; }

/* --- Start screen --- */
.start-screen {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: rgba(0, 0, 0, 0.55);
}
.start-screen[hidden] { display: none; }
.start-screen h1 { margin: 0; font-size: 3rem; letter-spacing: 0.08em; }
.start-screen p { margin: 0; max-width: 480px; color: #ddd; }
.start-screen button { font-size: 1.2rem; padding: 0.7em 1.4em; }
.start-note { color: #ffb74d !important; }
.start-note:empty { display: none; }
.start-hint { font-size: 0.9rem; color: #bbb !important; }

/* --- Station drawer --- */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
  width: min(380px, 92vw);
  display: flex;
  flex-direction: column;
  background: rgba(12, 12, 16, 0.96);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  transform: translateX(-102%);
  transition: transform 0.25s ease;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.drawer-head h2 { margin: 0; font-size: 1.1rem; flex: 1 1 auto; }
.drawer-head input[type="search"] {
  flex: 1 1 100%;
  font: inherit;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 0.5em 0.7em;
}
.station-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.station-list li { margin: 0; }
.station-list button {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 8px;
}
.station-list button:hover { background: rgba(255, 255, 255, 0.1); }
.station-list button.active { background: rgba(120, 170, 255, 0.25); }
.station-list img {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  object-fit: cover;
  border-radius: 7px;
  background: #222;
}
.station-list .st-name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.station-list .st-tags { display: block; font-size: 0.8rem; color: #bdbdbd; }
.http-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #000;
  background: #ffb74d;
  border-radius: 4px;
  padding: 0 5px;
  margin-left: 6px;
  vertical-align: middle;
}
.youtube-only { padding: 12px 14px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.youtube-only h3 { margin: 0 0 4px; font-size: 0.95rem; }
.youtube-only p { margin: 0 0 6px; font-size: 0.85rem; color: #bdbdbd; }
.youtube-only .station-list { padding: 0; overflow: visible; }
.drawer-foot { margin: 0; padding: 12px 14px; font-size: 0.8rem; color: #999; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.drawer-foot code { color: #ccc; }

/* --- Bottom transport --- */
.transport {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: calc(100vw - 24px);
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(10, 10, 14, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.transport .volume { display: flex; gap: 6px; align-items: center; font-size: 0.85rem; }
.transport input[type="range"] { width: 90px; accent-color: #7aaaff; }
.transport-station {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  color: #ddd;
}
.transport-station:empty { display: none; }

.noscript {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  margin: 0;
  padding: 12px;
  text-align: center;
  background: #d32f2f;
  color: #fff;
}

@media (max-width: 640px) {
  .card { top: 10px; left: 10px; padding: 10px; }
  .card-art { width: 64px; height: 64px; flex-basis: 64px; }
  .card-title { font-size: 1.05rem; }
  .preset-bar { top: auto; bottom: 86px; right: 10px; }
  .preset-name { display: none; }
  .transport { bottom: 10px; flex-wrap: wrap; justify-content: center; }
  .transport-station { display: none; }
  .start-screen h1 { font-size: 2.2rem; }
}

/* Inactive playback leaves only the radio card above the visualization. */
.preset-bar, .transport {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.drawer {
  transition: transform 0.25s ease, opacity 0.3s ease, visibility 0.3s ease;
}
body.controls-idle .preset-bar,
body.controls-idle .transport,
body.controls-idle .drawer {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
body.controls-idle { cursor: none; }
@media (prefers-reduced-motion: reduce) {
  .preset-bar, .transport, .drawer { transition: none; }
}
