:root {
  color-scheme: dark;
  --bg: #141615; --text: #f0f3eb; --muted: #a9ada3; --panel: #191c1b;
  --lime: #ccfa73; --line: #383d35; --violet: #c9a9fc; --heart: #ff9aaf;
  --live: #ff858b; --live-bg: #462026; --timeline: #171a18e8;
  --wave-before: #686e6a; --mix: #ad86f42f; --trim: #191b18c9;
  background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, sans-serif;
}
:root[data-theme="day"] {
  color-scheme: light;
  --bg: #e6e9dc; --text: #1d271b; --muted: #53614c; --panel: #f2f4ea;
  --lime: #356819; --line: #b6c2ab; --violet: #7441ab; --heart: #b73056;
  --live: #a82131; --live-bg: #f7d8d8; --timeline: #f4f6e8ed;
  --wave-before: #7e887b; --mix: #a474ca43; --trim: #eceee0d1;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
body::before {
  content: ""; z-index: -1; position: absolute; inset: 0 0 auto; height: 410px; pointer-events: none;
  background: linear-gradient(90deg, var(--bg) 10%, transparent 95%),
              linear-gradient(0deg, var(--bg) 8%, transparent 88%),
              url("forest.jpg") top right / auto 100% no-repeat;
  opacity: .76;
}
[data-theme="day"] body::before { opacity: .29; }
.station { display: grid; grid-template-columns: minmax(48px, 1fr) minmax(0, 1220px) minmax(48px, 1fr); padding: 38px 0 30px; }
.station > * { grid-column: 2; min-width: 0; }
.masthead, .masthead-side, .brand, .controls, .position, .volume { display: flex; align-items: center; }
.masthead { justify-content: space-between; gap: 12px; }
.masthead-side { flex: none; gap: 16px; }
.brand { gap: 12px; }
.brand svg { width: 42px; fill: none; stroke: var(--lime); stroke-width: 1.4; flex: none; }
.brand h1 { font-size: 1.34rem; margin: 0; font-weight: 850; letter-spacing: -.04em; }
.brand p { font-size: .84rem; color: var(--muted); margin: 3px 0 0; }
.theme { color: var(--muted); display: flex; align-items: center; gap: 7px; font-size: .87rem; }
button, select, summary, input[type="password"] {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 9px;
  min-height: 42px; font: inherit; padding: 7px 12px;
}
button, summary, select { cursor: pointer; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 4px; }
.station > .now { grid-column: 1 / -1; margin: 34px 0 21px; }
.ticker { overflow: hidden; min-width: 0; }
.ticker-flow { display: inline-flex; white-space: nowrap; }
.ticker-flow > span { flex: none; padding-inline-end: 2.7rem; }
.track-ticker { width: 100%; font-size: clamp(1.05rem, 3.25vw, 2.85rem); font-stretch: condensed; letter-spacing: -.047em; font-weight: 760; }
.track-ticker .ticker-flow { animation: headline 19s linear infinite; }
.listeners { flex: none; white-space: nowrap; color: var(--muted); font-size: .87rem; }
.listeners span { display: inline-block; vertical-align: 2px; margin-right: 5px; background: var(--lime); width: 7px; height: 7px; border-radius: 50%; }
.listeners strong { color: var(--text); }
@keyframes headline {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}
.timeline { background: var(--timeline); border: 1px solid var(--line); border-radius: 17px; overflow: hidden; }
.track-labels { display: grid; grid-template-columns: 24fr 52fr 24fr; border-bottom: 1px solid var(--line); }
.track-labels > div { min-width: 0; padding: 12px 15px; }
.track-labels > div + div { border-left: 1px solid var(--line); }
.column-label { display: block; font-size: .76rem; color: var(--muted); margin-bottom: 4px; }
.track-labels strong { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-labels > :last-child strong { color: var(--violet); }
.live-label {
  display: inline-flex; gap: .38em; align-items: center; border-radius: 99px;
  color: var(--live); background: var(--live-bg); font-size: .8rem; font-weight: 760; padding: .3em .65em;
  animation: live-pulse 2s ease-in-out infinite;
}
.live-label::before { content: ""; width: .44em; height: .44em; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
@keyframes live-pulse { 50% { opacity: .64; } }
.scope { position: relative; height: clamp(185px, 26vw, 270px); overflow: hidden; }
#wave { width: 100%; height: 100%; display: block; }
.event-ticker { position: absolute; inset: 0 0 auto; z-index: 1; background: var(--panel); color: var(--muted); border-bottom: 1px solid var(--line); height: 29px; line-height: 28px; font: .78rem/28px ui-monospace, monospace; }
.event-ticker .ticker-flow { animation: headline 29s linear infinite; }
.event-ticker span { padding-inline-start: .65rem; }
.bpm, .transition, .cursor time {
  position: absolute; border: 1px solid var(--line); border-radius: 5px; background: var(--panel);
  font: .76rem ui-monospace, monospace; padding: 4px 6px; white-space: nowrap; pointer-events: none;
}
.bpm { top: 39px; left: 10px; color: var(--muted); }
.transition { top: 39px; color: var(--violet); transform: translateX(-50%); }
.transition:empty { display: none; }
.cursor { position: absolute; top: 31px; bottom: 23px; width: 1px; background: var(--lime); pointer-events: none; }
.cursor time { color: var(--lime); bottom: -16px; left: 50%; transform: translateX(-50%); }
.controls { gap: clamp(13px, 3vw, 33px); margin: 18px 0 12px; }
#play { flex: none; width: 62px; height: 62px; border-radius: 50%; background: var(--lime); color: var(--bg); border: 0; display: grid; place-items: center; }
#play svg { fill: currentColor; width: 25px; }
.position { flex: 1; gap: 10px; min-width: 0; }
time { font: .8rem ui-monospace, monospace; color: var(--muted); }
progress { flex: 1; accent-color: var(--lime); min-width: 0; height: 7px; }
.volume { gap: 8px; color: var(--muted); font-size: .82rem; }
.volume input { width: clamp(54px, 9.5vw, 118px); accent-color: var(--lime); margin: 0; }
.tools { display: flex; flex-wrap: wrap; align-items: start; gap: 13px 17px; font-size: .88rem; }
.tools summary { line-height: 26px; }
#like[aria-pressed="true"] { color: var(--heart); border-color: var(--heart); }
#like:disabled { opacity: .6; }
.tools strong { color: var(--lime); }
.favorites, .mixer { min-width: 0; max-width: min(100%, 460px); }
#like-total, #status, #mix-status { color: var(--muted); font-size: .86rem; }
#status[data-error="true"] { color: var(--live); }
#like-list { padding: 0; margin: 0; list-style: none; max-height: 270px; overflow: auto; }
#like-list li { padding: 7px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
#mix-form { width: min(100%, 300px); display: grid; gap: 6px; padding-top: 10px; }
#mix-form input, #mix-form select { min-width: 0; width: 100%; }
#mix-form p { margin: 2px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 650px) {
  .station { grid-template-columns: 13px minmax(0, 1fr) 13px; padding-top: max(19px, env(safe-area-inset-top)); }
  .masthead-side { flex-direction: column; align-items: flex-end; gap: 5px; }
  .station > .now { margin: 22px 0 16px; }
  .track-ticker { font-size: 1.45rem; }
  .track-labels { grid-template-columns: 21fr 58fr 21fr; }
  .track-labels > div { padding: 8px 6px; }
  .track-labels strong { font-size: .73rem; }
  .scope { height: 190px; }
  #play { width: 52px; height: 52px; }
  .volume span, .theme { font-size: .72rem; }
  .volume span { display: none; }
  .controls { gap: 10px; }
  .position { gap: 6px; }
  .transition { font-size: .69rem; }
}
@media (prefers-reduced-motion: reduce) {
  .live-label { animation: none; }
}

.autoplay { min-height: 42px; display: inline-flex; align-items: center; gap: .55rem; padding: 7px 10px; }
.autoplay input { width: 18px; height: 18px; accent-color: var(--lime); }
.chat { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 10px; }
.chat summary { width: fit-content; }
#chat-feed { list-style: none; margin: .6rem 0; padding: 0; max-height: 17rem; overflow: auto; }
#chat-feed li { padding: .5rem .3rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; white-space: pre-wrap; }
#chat-feed strong, #chat-profile { color: var(--lime); }
.chat time { margin-left: .5rem; }
.chat form { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }
.chat input { min-width: 0; padding: .5rem; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; font: inherit; }
#chat-message { flex: 1 1 12rem; }
#chat-status { color: var(--muted); font-size: .86rem; margin-bottom: 0; }

.chat-message-header { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .75rem; margin-bottom: .28rem; }
.chat-message-header time { margin-left: 0; }
.chat-delete { margin-inline-start: auto; font-size: .8rem; color: var(--muted); }
