:root {
  --bg: #050505;
  --panel: #101010;
  --panel-2: #171717;
  --text: #f6f6f0;
  --muted: #8d8d87;
  --line: #2b2b2b;
  --accent: #baff00;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: min(1160px, calc(100% - 32px));
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 0 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
}

.brand,
.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-mark {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent), transparent 82%);
}

.ghost-link,
.icon-link,
.small-button,
.round-button,
.wide-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.ghost-link,
.icon-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ghost-link {
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
}

.icon-link {
  width: 38px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}

.ghost-link:hover,
.icon-link:hover,
.small-button:hover,
.round-button:hover,
.wide-button:hover {
  border-color: color-mix(in srgb, var(--accent), white 12%);
  background: color-mix(in srgb, var(--accent), transparent 88%);
}

.player-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.72fr);
  gap: 18px;
  padding-top: 20px;
}

.player-panel,
.library-panel,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.player-panel {
  min-height: calc(100svh - 120px);
  display: grid;
  grid-template-rows: minmax(220px, 1fr) auto auto auto;
  gap: 22px;
  padding: clamp(18px, 4vw, 44px);
  overflow: hidden;
}

.visual {
  min-height: 240px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: end;
  gap: clamp(4px, 1vw, 12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 0 28px;
}

.visual span {
  display: block;
  min-height: 22px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, var(--accent), rgba(255, 255, 255, 0.16));
  opacity: 0.42;
  transform-origin: bottom;
  animation: signal 1400ms ease-in-out infinite;
}

.visual span:nth-child(1) { height: 24%; animation-delay: 0ms; }
.visual span:nth-child(2) { height: 64%; animation-delay: 90ms; }
.visual span:nth-child(3) { height: 38%; animation-delay: 180ms; }
.visual span:nth-child(4) { height: 86%; animation-delay: 270ms; }
.visual span:nth-child(5) { height: 52%; animation-delay: 360ms; }
.visual span:nth-child(6) { height: 72%; animation-delay: 450ms; }
.visual span:nth-child(7) { height: 31%; animation-delay: 540ms; }
.visual span:nth-child(8) { height: 91%; animation-delay: 630ms; }
.visual span:nth-child(9) { height: 42%; animation-delay: 720ms; }
.visual span:nth-child(10) { height: 69%; animation-delay: 810ms; }
.visual span:nth-child(11) { height: 28%; animation-delay: 900ms; }
.visual span:nth-child(12) { height: 58%; animation-delay: 990ms; }

body:not(.is-playing) .visual span {
  animation-play-state: paused;
  opacity: 0.25;
}

@keyframes signal {
  0%, 100% { transform: scaleY(0.55); }
  50% { transform: scaleY(1); }
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.now h1,
.library-head h2,
.form-head h1 {
  margin: 0;
  letter-spacing: 0;
}

.now h1 {
  max-width: 12ch;
  font-size: clamp(48px, 9vw, 108px);
  line-height: 0.9;
}

.now p:last-child {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
}

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

.round-button,
.play-button,
.small-button,
.wide-button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.round-button {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 30px;
}

.play-button {
  width: 86px;
  height: 86px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #050505;
  font-size: 38px;
  cursor: pointer;
  box-shadow: 0 18px 44px color-mix(in srgb, var(--accent), transparent 72%);
}

.play-button:hover {
  transform: translateY(-1px) scale(1.015);
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.volume {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 156px;
}

.volume input {
  width: 116px;
  accent-color: var(--accent);
}

.library-panel {
  min-height: calc(100svh - 120px);
  padding: 22px;
  overflow: hidden;
}

.library-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.library-head h2,
.form-head h1 {
  font-size: 30px;
  line-height: 1;
}

.small-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
}

.genres {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0;
}

.genre-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

.genre-button.is-active {
  border-color: var(--accent);
  color: var(--text);
  background: color-mix(in srgb, var(--accent), transparent 90%);
}

.tracks {
  display: grid;
  gap: 8px;
  max-height: calc(100svh - 270px);
  overflow: auto;
  padding-right: 4px;
}

.track {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.track:hover,
.track.is-active {
  border-color: color-mix(in srgb, var(--accent), white 10%);
  background: color-mix(in srgb, var(--accent), transparent 91%);
}

.track-index {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.track strong,
.track small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track small {
  color: var(--muted);
  margin-top: 3px;
}

.track-genre {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
}

.player-shell {
  width: min(760px, calc(100% - 32px));
}

.public-topbar {
  position: relative;
  justify-content: center;
}

.public-topbar .brand {
  justify-content: center;
}

.public-topbar .top-actions {
  position: absolute;
  right: 0;
}

.radio-stage {
  min-height: calc(100svh - 82px);
  display: grid;
  align-items: center;
}

.player-shell .player-panel {
  min-height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: clamp(20px, 5vw, 48px) 0 32px;
  overflow: visible;
  text-align: center;
}

.player-shell .visual {
  width: min(360px, 100%);
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  padding: 0;
}

.player-shell .visual span {
  width: 6px;
  min-height: 0;
  border-radius: 0;
  background: var(--accent);
  opacity: 0.5;
  transform-origin: center;
  animation: pixelPulse 920ms steps(2, end) infinite;
}

.player-shell .visual span:nth-child(1),
.player-shell .visual span:nth-child(2),
.player-shell .visual span:nth-child(3),
.player-shell .visual span:nth-child(4),
.player-shell .visual span:nth-child(5),
.player-shell .visual span:nth-child(6),
.player-shell .visual span:nth-child(7),
.player-shell .visual span:nth-child(17),
.player-shell .visual span:nth-child(18),
.player-shell .visual span:nth-child(19),
.player-shell .visual span:nth-child(20),
.player-shell .visual span:nth-child(21),
.player-shell .visual span:nth-child(22),
.player-shell .visual span:nth-child(23),
.player-shell .visual span:nth-child(24) {
  height: 6px;
}

.player-shell .visual span:nth-child(8),
.player-shell .visual span:nth-child(16) {
  height: 14px;
}

.player-shell .visual span:nth-child(9),
.player-shell .visual span:nth-child(15) {
  height: 26px;
}

.player-shell .visual span:nth-child(10),
.player-shell .visual span:nth-child(14) {
  height: 10px;
}

.player-shell .visual span:nth-child(11),
.player-shell .visual span:nth-child(13) {
  height: 36px;
}

.player-shell .visual span:nth-child(12) {
  height: 48px;
}

body:not(.is-playing) .player-shell .visual span {
  animation-play-state: paused;
  opacity: 0.36;
}

@keyframes pixelPulse {
  0%, 100% { transform: scaleY(0.72); }
  50% { transform: scaleY(1.18); }
}

.player-shell .now h1 {
  max-width: 13ch;
  margin: 0 auto;
  font-size: clamp(38px, 9vw, 76px);
  line-height: 0.95;
}

.player-shell .now p:last-child {
  font-size: 17px;
}

.player-shell .transport {
  justify-content: center;
}

.player-shell .play-button {
  width: 104px;
  height: 104px;
  box-shadow: none;
}

.queue-peek {
  width: min(620px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.queue-peek section {
  min-width: 0;
  background: var(--bg);
  padding: 14px;
}

.queue-peek span,
.queue-peek strong,
.queue-peek small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-peek span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.queue-peek strong {
  margin-top: 7px;
}

.queue-peek small {
  margin-top: 3px;
  color: var(--muted);
}

.genre-panel {
  width: min(620px, 100%);
}

.player-shell .genres {
  justify-content: center;
  margin: 12px 0 0;
}

.player-shell .genre-button {
  min-width: 72px;
}

.player-shell .meta-row {
  width: min(620px, 100%);
}

.admin-shell {
  width: min(1160px, calc(100% - 32px));
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding-top: 20px;
}

.admin-panel {
  padding: 22px;
}

.track-admin {
  grid-column: 1 / -1;
}

.admin-panel label {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.admin-panel input[type="text"],
.admin-panel input[type="url"],
.admin-panel input[type="password"] {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070707;
  color: var(--text);
  padding: 0 12px;
  outline: 0;
}

.admin-panel input:focus {
  border-color: var(--accent);
}

.admin-panel input[type="color"] {
  width: 72px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  padding: 4px;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 10px !important;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.file-drop {
  min-height: 92px;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.wide-button {
  width: 100%;
  min-height: 50px;
  margin-top: 18px;
  border-radius: 8px;
  font-weight: 800;
}

.secondary-button {
  margin: 18px 0;
}

.status-line {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
}

.delete-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  min-height: 34px;
  padding: 0 12px;
  cursor: pointer;
}

.delete-button:hover {
  border-color: #ff5b5b;
  color: #ff9d9d;
}

.login-grid {
  min-height: calc(100svh - 96px);
  display: grid;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
}

@media (max-width: 840px) {
  .shell,
  .admin-shell {
    width: min(100% - 20px, 680px);
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 52px;
  }

  .ghost-link {
    display: none;
  }

  .player-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .player-panel,
  .library-panel {
    min-height: auto;
  }

  .player-panel {
    grid-template-rows: auto auto auto auto;
    padding: 18px;
  }

  .visual {
    min-height: 160px;
  }

  .now h1 {
    max-width: 11ch;
    font-size: clamp(44px, 17vw, 76px);
  }

  .transport {
    justify-content: center;
  }

  .meta-row {
    align-items: stretch;
    flex-direction: column;
  }

  .volume,
  .volume input {
    width: 100%;
  }

  .tracks {
    max-height: none;
  }

  .player-shell .player-panel {
    gap: 18px;
    padding: 22px 0 24px;
  }

  .player-shell .visual {
    min-height: 48px;
  }

  .player-shell .now h1 {
    font-size: clamp(38px, 14vw, 62px);
  }

  .queue-peek {
    grid-template-columns: 1fr;
  }

  .player-shell .meta-row {
    align-items: center;
    flex-direction: column;
    text-align: center;
  }

  .public-topbar .top-actions {
    display: none;
  }
}

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