:root {
  color-scheme: dark;
  --bg: #080a10;
  --text: #f1f5fb;
  --muted: #8994a4;
  --dim: #8994a4;
  --accent: #6df5ec;
  --cyan: var(--accent);
  --line: rgba(225, 235, 248, 0.12);
  --side: clamp(22px, 5.4vw, 76px);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 5px;
}

.page-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
  padding: 0 var(--side);
}

.player-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 78px;
  align-items: center;
  column-gap: 18px;
  padding: 9px 0;
}

.listener-icon svg,
.volume-icon {
  display: block;
  width: 100%;
  height: 100%;
}

.broadcast {
  display: flex;
  width: min(100%, 1120px);
  flex: 1;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding: 42px 0;
}

.now-playing {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 430px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(46px, 8vw, 116px);
}

.artwork-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #141920 url('/assets/cover-placeholder.svg') center / cover no-repeat;
  box-shadow: 0 24px 58px rgba(0, 0, 0, 0.2);
}

.album-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transition: opacity 300ms ease;
}

.album-art[hidden] {
  display: none;
}

.album-art.is-changing {
  opacity: 0;
}

.track-copy {
  min-height: 120px;
}

.track-title {
  max-width: 100%;
  margin: 0;
  color: var(--text);
  font-size: clamp(38px, 6.2vw, 76px);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1.03;
  text-wrap: balance;
  overflow-wrap: anywhere;
  transition: opacity 220ms ease, transform 220ms ease;
}

.track-title.is-changing {
  opacity: 0;
  transform: translateY(5px);
}

.track-artist {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 1.6vw, 19px);
  font-weight: 400;
  letter-spacing: 0.015em;
  line-height: 1.45;
  transition: opacity 220ms ease;
}

.track-artist.is-changing {
  opacity: 0;
}

.reaction-button {
  display: inline-grid;
  width: 52px;
  height: 54px;
  place-items: center;
  margin-top: 27px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 34px;
  line-height: 1;
  transition: transform 180ms ease, background-color 180ms ease;
}

.reaction-button:hover {
  transform: scale(1.14) rotate(-8deg);
  background: rgba(255, 255, 255, 0.06);
}

.reaction-button:active {
  transform: scale(0.9);
}

.reaction-layer {
  position: fixed;
  z-index: 10;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  contain: layout paint;
}

.reaction-particle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-size: clamp(28px, 5vw, 56px);
  line-height: 1;
  opacity: 0;
  transform: translate3d(0, 24px, 0) scale(0.5) rotate(-12deg);
  animation: reaction-float var(--duration) ease-out var(--delay) forwards;
  user-select: none;
  will-change: transform, opacity;
}

@keyframes reaction-float {
  0% { opacity: 0; transform: translate3d(0, 24px, 0) scale(0.5) rotate(-12deg); }
  16% { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(6deg); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--drift), -76px, 0) scale(1.2) rotate(16deg); }
}

.autoplay-prompt {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 12px;
}

.autoplay-prompt[hidden] {
  display: none;
}

.autoplay-prompt p {
  margin: 0;
}

.start-listening {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: transparent;
  color: var(--cyan);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.start-listening:hover {
  border-color: var(--cyan);
  background: var(--cyan);
  color: var(--bg);
}

.player-footer {
  min-height: 78px;
  border-top: 1px solid var(--line);
}

.footer-meta {
  display: flex;
  align-items: center;
}

.listener-names {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 2px 14px;
  max-height: 42px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  color: #b9c2cd;
  font-size: 11px;
  line-height: 18px;
  list-style: none;
}

.listener-names[hidden] {
  display: none;
}

.listener-names li {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.listener-names li:first-child {
  color: var(--text);
}

.listener-names li + li::before {
  margin-right: 14px;
  color: var(--muted);
  content: "·";
}

.listener-line {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.03em;
}

.listener-icon {
  width: 16px;
  height: 16px;
  color: var(--dim);
}

.listener-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.2;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mute-button {
  display: grid;
  width: 30px;
  height: 34px;
  place-items: center;
  padding: 3px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.volume-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.volume-icon > path:first-child {
  fill: currentColor;
  stroke: none;
}

.mute-cross {
  display: none;
}

.mute-button[aria-pressed="true"] .volume-wave {
  display: none;
}

.mute-button[aria-pressed="true"] .mute-cross {
  display: block;
}

.volume-slider {
  width: clamp(88px, 10vw, 130px);
  height: 20px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.volume-slider::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(to right, var(--cyan) 0 var(--volume-progress, 72%), rgba(241, 245, 251, 0.25) var(--volume-progress, 72%) 100%);
}

.volume-slider::-moz-range-track {
  height: 2px;
  background: rgba(241, 245, 251, 0.25);
}

.volume-slider::-moz-range-progress {
  height: 2px;
  background: var(--cyan);
}

.volume-slider::-webkit-slider-thumb {
  width: 10px;
  height: 10px;
  margin-top: -4px;
  appearance: none;
  border: 0;
  border-radius: 50%;
  background: var(--cyan);
}

.volume-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 50%;
  background: var(--cyan);
}

.name-dialog {
  width: min(440px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100svh - 32px);
  margin: auto;
  padding: clamp(28px, 6vw, 44px);
  overflow-y: auto;
  border: 1px solid var(--line);
  background: #11161d;
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.name-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.name-dialog form {
  display: flex;
  flex-direction: column;
}

.name-eyebrow {
  margin: 0 0 21px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.name-dialog h2 {
  margin: 0;
  font-size: clamp(32px, 8vw, 43px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.name-description {
  margin: 14px 0 34px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.name-dialog label {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.name-dialog input {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid rgba(225, 235, 248, 0.28);
  border-radius: 2px;
  background: #0b0e14;
  color: var(--text);
  font-size: 16px;
}

.name-submit {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: filter 160ms ease;
}

.name-submit:hover {
  filter: brightness(1.12);
}

.history-panel {
  width: min(100%, 470px);
  margin-top: clamp(34px, 6vh, 62px);
}

.history-panel h2 {
  margin: 0 0 18px;
  color: #aeb9c6;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.history-empty {
  margin: 0;
  color: #aeb9c6;
  font-size: 13px;
  opacity: 0.75;
}

.history-empty[hidden] {
  display: none;
}

.history-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  opacity: 0.72;
}

.history-art {
  width: 42px;
  height: 42px;
  background: #202832 url('/assets/cover-placeholder.svg') center / cover no-repeat;
}

.history-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-song {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-artist {
  overflow: hidden;
  margin-top: 3px;
  color: #d6dce6;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-time {
  align-self: start;
  padding-top: 3px;
  color: #d6dce6;
  font-size: 10px;
  white-space: nowrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (max-width: 860px) {
  .player-footer {
    min-height: 68px;
  }

  .broadcast {
    padding: 22px 0;
  }

  .now-playing {
    display: flex;
    flex-direction: column;
    gap: clamp(22px, 4vh, 36px);
    text-align: center;
  }

  .artwork-frame {
    width: min(100%, 320px, 36svh);
  }

  .track-area {
    width: 100%;
  }

  .track-copy {
    min-height: 103px;
  }

  .track-title {
    font-size: clamp(36px, 10vw, 55px);
  }

  .track-artist {
    margin-top: 10px;
    font-size: 15px;
  }

  .reaction-button {
    margin-top: 17px;
  }

  .autoplay-prompt {
    flex-direction: column;
    gap: 10px;
    padding: 0 12px;
    line-height: 1.45;
  }

  .history-panel {
    width: min(100%, 440px);
    margin: 25px auto 0;
    text-align: left;
  }
}

@media (max-height: 700px) and (max-width: 860px) {
  .player-footer {
    min-height: 58px;
  }

  .broadcast {
    padding: 18px 0;
  }

  .artwork-frame {
    width: min(100%, 240px, 34svh);
  }

  .now-playing {
    gap: 20px;
  }

  .track-copy {
    min-height: 90px;
  }

  .history-panel {
    margin-top: 17px;
  }

  .history-list {
    gap: 8px;
  }

  .history-item:nth-child(n + 3) {
    display: none;
  }
}

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