@property --red-tint { syntax: "<number>"; inherits: true; initial-value: 0; }

:root {
  color-scheme: dark;
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
  color: #f4f1fa;
  background: #101017;
  --surface: #191821;
  --muted: #aaa3bb;
  --radius: 18px;
  --theme-transition: 5s ease-in-out;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  --red-tint: 0;
  --red-share: calc(var(--red-tint) * 100%);
  --page: color-mix(in srgb, #101017, #120a0d var(--red-share));
  --page-glow: color-mix(in srgb, #241a33, #38131c var(--red-share));
  --page-bottom: color-mix(in srgb, #20142e, #2b0b14 var(--red-share));
  --header: color-mix(in srgb, #111017ed, #160c10ed var(--red-share));
  --line: color-mix(in srgb, #312c3e, #4b2b35 var(--red-share));
  --hero-surface: color-mix(in srgb, #191420, #221016 var(--red-share));
  --hero-border: color-mix(in srgb, #42344d, #62313d var(--red-share));
  --hero-shade: color-mix(in srgb, #130e1b, #19090e var(--red-share));
  --panel-top: color-mix(in srgb, #1c1a25ec, #21161cec var(--red-share));
  --panel-bottom: color-mix(in srgb, #17161ecf, #1b1115cf var(--red-share));
  --accent: color-mix(in srgb, #c7b5ff, #ffa6aa var(--red-share));
  --ink: color-mix(in srgb, #211332, #351016 var(--red-share));
  --accent-hover: color-mix(in srgb, #ddcfff, #ffc9c4 var(--red-share));
  --accent-border: color-mix(in srgb, #d7c8ff, #ffbeba var(--red-share));
  --accent-text: color-mix(in srgb, #ddd1fa, #ffd0cd var(--red-share));
  --accent-shadow: color-mix(in srgb, #c0a5ffad, #ff667bba var(--red-share));
  --tint-border: color-mix(in srgb, #675382, #7e414b var(--red-share));
  --tint-surface: color-mix(in srgb, #302541, #46252e var(--red-share));
  --badge-surface: color-mix(in srgb, #1a1125df, #2a1118df var(--red-share));
  --led-base: color-mix(in srgb, #6542a0, #a12e4b var(--red-share));
  --led-tip: color-mix(in srgb, #bd9af1, #ff776d var(--red-share));
  margin: 0; min-height: 100vh; isolation: isolate;
  background:
    radial-gradient(ellipse at 67% 2%, var(--page-glow), transparent 45rem),
    radial-gradient(ellipse at 50% 100%, var(--page-bottom), transparent 65%),
    var(--page);
  transition: --red-tint var(--theme-transition);
}
body[data-mood="energetic"] { --red-tint: 1; }

.led-backdrop {
  position: fixed; z-index: -1; left: 50%; bottom: 0; transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: clamp(3px, .43vw, 8px);
  width: min(108vw, 1900px); height: clamp(155px, 40vh, 440px);
  padding-inline: 1.6vw; opacity: .56; pointer-events: none;
  mask-image: linear-gradient(0deg, transparent, #000 16%, #000 77%, transparent);
}
.led-backdrop span {
  --visible-height: var(--level);
  flex: 1; min-width: 0; height: 100%;
  background: linear-gradient(0deg, var(--led-base), var(--led-tip) 68%);
  mask-image: repeating-linear-gradient(to top, #000 0 4px, transparent 4px 8px);
  clip-path: inset(calc(100% - var(--visible-height)) 0 0);
}
.led-backdrop[data-playing="true"] span {
  --visible-height: var(--live-height, 0px);
}

h1, h2, h3, p, ul { margin: 0; }
ul { list-style: none; padding: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .53; cursor: default; }
a { color: var(--accent); }
button, a, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.site-header { border-bottom: 1px solid var(--line); background: var(--header); }
.header-inner, .shell { width: min(calc(100% - 64px), 1180px); margin-inline: auto; }
.header-inner { min-height: 72px; display: flex; align-items: center; gap: 38px; }
.brand { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-content: center; grid-auto-flow: column; align-items: center; gap: 3px;
  border: 1px solid var(--tint-border); border-radius: 11px; background: var(--tint-surface);
}
.brand-mark i { width: 3px; height: 10px; border-radius: 4px; background: var(--accent); }
.brand-mark i:nth-child(2) { height: 17px; }
.brand-mark i:nth-child(3) { height: 7px; }
.brand h1 { font-size: .93rem; font-weight: 750; line-height: 1.14; letter-spacing: .015em; }
.brand h1 span { display: block; color: #bbb2cc; font-size: .69rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; margin-top: 2px; }
nav { display: flex; gap: 23px; align-items: center; }
nav a { color: var(--muted); text-decoration: none; font-size: .87rem; font-weight: 620; }
nav a:hover { color: #f4f1fa; }
.listener-count {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px; border-radius: 100px;
  padding: 5px 10px; border: 1px solid var(--line); color: #cfc7df; font-size: .77rem; white-space: nowrap;
}
.listener-count::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.shell { padding: 26px 0 50px; }
.hero {
  position: relative; isolation: isolate; overflow: hidden; min-height: 372px; display: grid; align-items: center;
  grid-template-rows: 1fr auto;
  border: 1px solid var(--hero-border); border-radius: 23px; background: var(--hero-surface);
  box-shadow: 0 18px 55px #07050d6b;
}
.hero-art {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2;
  object-fit: cover; object-position: 50% 56%;
}
.hero-art-red {
  opacity: var(--red-tint);
  filter: grayscale(1) sepia(.92) saturate(2.65) hue-rotate(310deg);
}
.hero::after {
  position: absolute; inset: 0; z-index: -1; content: "";
  background: linear-gradient(90deg, color-mix(in srgb, var(--hero-shade) 95%, transparent) 0%,
                              color-mix(in srgb, var(--hero-shade) 80%, transparent) 28%,
                              color-mix(in srgb, var(--hero-shade) 34%, transparent) 51%, transparent 76%),
              linear-gradient(0deg, color-mix(in srgb, var(--hero-shade) 79%, transparent), transparent 37%),
              linear-gradient(270deg, rgb(174 19 35 / calc(var(--red-tint) * .24)), transparent 75%);
}
.hero-content { padding: 43px clamp(22px, 4.1vw, 54px) 35px; min-width: 0; max-width: 660px; }
.air-label {
  color: var(--accent-text); display: flex; align-items: center; gap: 9px;
  font-size: .73rem; font-weight: 740; letter-spacing: .125em; text-transform: uppercase;
}
.air-label span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 15px var(--accent-shadow); }
#track {
  margin-top: 14px; color: #f8f5ff; max-width: 14ch; overflow-wrap: anywhere;
  font-size: clamp(2.1rem, 5.6vw, 4.35rem); font-weight: 760; line-height: 1.02; letter-spacing: -.055em;
}
.track-artist { margin-top: 10px; color: #c9bbd9; font-size: clamp(1rem, 1.8vw, 1.18rem); font-weight: 540; }
.hero-mode {
  position: absolute; top: 22px; right: 22px; padding: 5px 12px; border: 1px solid var(--tint-border); border-radius: 100px;
  background: var(--badge-surface); color: var(--accent-text); font-size: .76rem; font-weight: 650;
}
.playback { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-top: 27px; }
#chat-join { width: min(100%, 410px); margin-top: 24px; }
#chat-join label { display: block; margin-bottom: 8px; color: var(--accent-text); font-size: .86rem; }
#chat-join input, #chat-join button {
  min-width: 0; min-height: 44px; border: 1px solid var(--tint-border); border-radius: 10px;
  padding: 8px 11px; font: inherit; font-size: .87rem;
}
#chat-join input { color: #f8f5ff; background: var(--badge-surface); }
#chat-join input::placeholder { color: #c2b5cd; }
#chat-join button {
  white-space: nowrap; color: var(--ink); background: var(--accent);
  border-color: var(--accent-border); font-weight: 700;
}
#chat-join button:not(:disabled):hover { background: var(--accent-hover); }
#listener-join-feedback { color: var(--accent-text); font-size: .82rem; }
#toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 142px; min-height: 48px;
  padding: 0 17px; border: 1px solid var(--accent-border); border-radius: 12px; background: var(--accent); color: var(--ink);
  box-shadow: 0 7px 17px #03010766; font-weight: 750;
}
#toggle:hover { background: var(--accent-hover); }
#toggle::before { content: ""; width: 10px; height: 12px; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
#toggle[aria-pressed="true"]::before { height: 9px; width: 9px; border-radius: 1px; clip-path: none; }
.volume { display: inline-flex; align-items: center; gap: 9px; color: #d6c9e8; font-size: .81rem; font-weight: 600; }
#volume { width: clamp(70px, 9vw, 116px); accent-color: var(--accent); margin: 0; cursor: pointer; }
#volume-value { min-width: 34px; color: #b8abc8; font-variant-numeric: tabular-nums; }
.playback-status { min-height: 1.4em; margin-top: 10px; color: #d1c5df; font-size: .82rem; }
.playback-status:empty { display: none; }
.track-timeline { align-self: end; min-width: 0; padding: 0 clamp(14px, 2.3vw, 24px) 12px; }
.track-wave { display: block; width: 100%; height: clamp(26px, 4vw, 42px); }
.track-wave-remaining { fill: color-mix(in srgb, var(--accent-text) 57%, transparent); }
.track-wave-played { fill: var(--accent); }
#track-wave-cursor {
  stroke: #fff8fb; stroke-width: 2; stroke-linecap: round;
  filter: drop-shadow(0 0 2px #10090e);
}
.track-times {
  display: flex; justify-content: space-between; margin-top: 3px;
  color: var(--accent-text); font-size: .74rem; font-weight: 600; font-variant-numeric: tabular-nums;
}

.panels { display: grid; grid-template-columns: minmax(0, .91fr) minmax(0, 1.09fr); gap: 18px; margin-top: 18px; }
.panel {
  --panel-padding: clamp(18px, 2vw, 24px);
  min-width: 0; padding: var(--panel-padding); border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-top), var(--panel-bottom) 95%);
}
.panel:not([open]) { align-self: start; }
.panel-title {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  list-style: none; cursor: pointer;
}
.panel-title::-webkit-details-marker { display: none; }
.panel-title::after {
  content: ""; flex: 0 0 8px; height: 8px; margin-right: 3px;
  border: solid var(--accent-text); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg);
}
.panel[open] > .panel-title { margin-bottom: 17px; }
.panel[open] > .panel-title::after { transform: translateY(-2px) rotate(45deg); }
.panel-title h2 {
  display: flex; align-items: center; gap: 11px;
  font-size: 1.16rem; font-weight: 720; letter-spacing: -.022em;
}
.panel-title:hover h2 { color: var(--accent-text); }
.panel-icon {
  position: relative; display: grid; place-items: center; flex: 0 0 31px; width: 31px; height: 31px;
  border: 1px solid var(--tint-border); border-radius: 9px; background: var(--tint-surface); color: var(--accent); font-size: 1rem;
}
.panel-icon-chat::before { content: ""; width: 12px; height: 9px; border: 1.5px solid currentColor; border-radius: 3px; }
.panel-icon-chat::after { content: ""; width: 4px; height: 4px; position: absolute; left: 9px; bottom: 9px; border-bottom: 1px solid currentColor; transform: rotate(-36deg); background: var(--tint-surface); }
.panel-icon-music { font-size: 1.03rem; }
.panel-icon-discovery { font-size: 1.16rem; }
.panel h3 { font-size: .88rem; font-weight: 710; color: #e1d9ed; }
.panel button {
  padding: 6px 12px; min-height: 34px; border-radius: 9px; border: 1px solid #4a3f5a; background: #292238;
  color: #e9e1f4; font-size: .82rem; font-weight: 620; white-space: nowrap;
}
.panel button:not(:disabled):hover { background: #3b2e51; }
.panel button[aria-pressed="true"] { border-color: #bda7f4; color: #f7efff; background: #4b3b66; }
.panel button.action { color: var(--ink); background: var(--accent); border-color: var(--accent-border); }
.panel button.action:not(:disabled):hover { background: var(--accent-hover); }
.panel input, .panel select {
  min-width: 0; width: 100%; min-height: 41px; border: 1px solid #40364b; border-radius: 10px;
  padding: 7px 11px; background: #14121a; color: #f4edf9; font-size: .9rem;
}
.panel input::placeholder { color: #aaa0b8; opacity: 1; }
.search-field { position: relative; }
.search-field::before, .search-field::after { content: ""; position: absolute; pointer-events: none; }
.search-field::before { inset: 12px auto auto 14px; width: 9px; height: 9px; border: 1.5px solid #b5a6c8; border-radius: 100%; }
.search-field::after { inset: 23px auto auto 24px; width: 6px; height: 1.5px; border-radius: 3px; background: #b5a6c8; transform: rotate(45deg); }
#song-search { padding-left: 36px; }
.artist-field { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 8px; }
.artist-field label { color: var(--muted); font-size: .85rem; }
#song-results { max-height: 23rem; overflow-y: auto; }
.queue { margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.rows:empty, .feedback:empty { display: none; }
.rows li { padding: 9px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; font-size: .88rem; }
.rows li:last-child { border-bottom: 0; }
.rows button, #chat-vote-actions button, #discovery-results button { margin: 7px 6px 0 0; }
.muted, .empty-note, .panel small, .feedback { color: var(--muted); font-size: .83rem; }
.empty-note, .feedback { margin-top: 7px; }

.proposal { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.proposal summary { cursor: pointer; color: var(--accent); font-size: .85rem; font-weight: 650; }
.proposal[open] summary { margin-bottom: 9px; }
#proposal-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
#media-catch-picker { grid-column: 1 / -1; font-size: .82rem; }
.media-catch-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 6px; }

.join-line, #chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.chat-panel[open], #chat-room {
  display: flex; flex-direction: column;
}
.chat-panel[open]::details-content { display: flex; flex: 1; flex-direction: column; }
#chat-room { flex: 1; }
#chat-controls { margin-bottom: 12px; }
#chat-mode { margin-bottom: 8px; color: #e4daef; font-size: .87rem; font-weight: 650; }
.mode-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
#chat-hint { display: block; margin-top: 5px; }
#chat-vote { margin-bottom: 10px; padding: 10px; border: 1px solid #514366; background: #251d34; border-radius: 10px; font-size: .84rem; }
.chat-transcript {
  position: relative; flex: 1; min-height: 160px; margin-bottom: 10px; padding: 9px 11px;
  border: 1px solid #31273c; border-radius: 10px; background: #15131b;
}
.chat-transcript .empty-note { margin-top: 0; }
#chat-messages { position: absolute; inset: 9px 11px; overflow-y: auto; overflow-wrap: anywhere; font-size: .86rem; }
#chat-messages li { padding: 4px 0; }
#chat-messages strong { color: #dbc7ff; font-weight: 680; }

.discovery-panel { margin-top: 18px; }
.discovery-panel .panel-title { margin-bottom: 5px; }
#discovery-status { margin-bottom: 12px; }
#discovery-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
#discovery-results li { min-width: 0; padding: 14px; background: #15131d; border: 1px solid #3a3047; border-radius: 11px; overflow-wrap: anywhere; }
#discovery-results a { color: #ede3ff; font-size: .9rem; font-weight: 680; text-decoration: none; }
#discovery-results a:hover { text-decoration: underline; color: var(--accent); }

@media (max-width: 860px) {
  .header-inner, .shell { width: calc(100% - 38px); }
  .header-inner { gap: 24px; }
  nav { gap: 16px; }
  .panels { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  #discovery-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
  .header-inner, .shell { width: calc(100% - 26px); }
  .header-inner { gap: 7px 15px; min-height: 65px; padding: 10px 0; flex-wrap: wrap; }
  .header-inner nav { order: 3; flex-basis: 100%; gap: 18px; padding: 1px 0 2px; }
  .shell { padding-top: 13px; }
  .hero { align-items: end; min-height: 371px; border-radius: 17px; }
  .hero-art { left: auto; width: 140%; height: 222px; object-position: 100% 48%; }
  .hero::after {
    background: linear-gradient(0deg, var(--hero-shade) 0%, var(--hero-shade) 36%,
                                color-mix(in srgb, var(--hero-shade) 82%, transparent) 52%,
                                color-mix(in srgb, var(--hero-shade) 8%, transparent) 71%),
                linear-gradient(90deg, color-mix(in srgb, var(--hero-shade) 39%, transparent), transparent 62%),
                linear-gradient(270deg, rgb(174 19 35 / calc(var(--red-tint) * .24)), transparent 75%);
  }
  .led-backdrop { width: 132vw; height: min(38vh, 240px); opacity: .45; }
  .hero-content { padding: 142px 20px 17px; }
  #track { margin-top: 9px; font-size: clamp(2rem, 8.7vw, 3.25rem); max-width: 17ch; }
  .hero-mode { top: 12px; right: 12px; font-size: .69rem; }
  .playback { gap: 12px; margin-top: 20px; }
  .volume-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #volume { width: clamp(76px, 22vw, 120px); }
  .panels, #discovery-results { grid-template-columns: minmax(0, 1fr); }
  .panels, .discovery-panel { margin-top: 12px; }
  .panel { --panel-padding: 16px; border-radius: 14px; }
  .chat-transcript { min-height: clamp(170px, 26vh, 260px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  :root { --theme-transition: 0s; }
}
