:root {
  color-scheme: dark;
  --chrome: #7b7d78;
  --chrome-hi: #d6d7ce;
  --chrome-mid: #9b9c96;
  --chrome-lo: #343632;
  --chrome-black: #111310;
  --lcd: #071009;
  --green: #79f16d;
  --green-dim: #386c35;
  --yellow: #d9d35a;
  --orange: #ef8e30;
  --mono: "Monaco", "Lucida Console", "Courier New", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #050505; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: #0b0c0b;
  font-family: var(--mono);
  font-size: 12px;
  background: #050505;
}

button, input { font: inherit; }

.photo-stage, .photo, .chroma, .scanlines, .glitch-slices {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.photo-stage { z-index: 0; overflow: hidden; background: #050505; }

.photo-stage::after {
  content: "";
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    rgba(3, 4, 3, .05) 20%,
    rgba(3, 4, 3, .18) 58%,
    rgba(3, 4, 3, .68) 100%
  );
}

.photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: contrast(1.15) saturate(1.2);
  transform: scale(1.06);
  opacity: 0;
  transition: opacity 900ms steps(7, end), filter 450ms linear;
  animation: ken-burns 28s ease-in-out infinite alternate;
}

.photo.visible { opacity: .62; }

.chroma {
  z-index: 3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: .11;
  mix-blend-mode: screen;
}

.chroma-r {
  transform: translateX(-3px) scale(1.006);
  filter: hue-rotate(285deg) saturate(2.6) contrast(1.2);
}

.chroma-c {
  transform: translateX(3px) scale(1.006);
  filter: hue-rotate(105deg) saturate(2.3) contrast(1.2);
}

.glitch-slices { z-index: 5; }

.glitch-slices i {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  opacity: .63;
  clip-path: inset(var(--slice-top, 20%) 0 var(--slice-bottom, 75%) 0);
  transform: translateX(var(--slice-shift, 14px)) scale(1.01);
  filter: contrast(1.2) saturate(1.35);
  mix-blend-mode: screen;
}

.scanlines {
  z-index: 9;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0 2px,
    rgba(0, 0, 0, .18) 2px 4px
  );
}

.vhs-bar {
  position: fixed;
  z-index: 10;
  top: -8vh;
  left: 0;
  width: 100%;
  height: 5vh;
  pointer-events: none;
  opacity: .38;
  border-top: 1px solid rgba(223, 255, 230, .2);
  background: linear-gradient(transparent, rgba(207, 255, 222, .3), transparent);
  filter: blur(1px);
  animation: tracking 12s linear infinite;
}

@keyframes tracking { to { transform: translateY(116vh); } }

@keyframes ken-burns {
  from { transform: scale(1.06) translate3d(-.8%, -.5%, 0); }
  to { transform: scale(1.12) translate3d(1.2%, .8%, 0); }
}

.station-shell {
  position: relative;
  z-index: 3;
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(32px, 8vh, 88px) 0 28px;
}

.window {
  border: 2px solid;
  border-color: var(--chrome-hi) var(--chrome-black) var(--chrome-black) var(--chrome-hi);
  box-shadow:
    0 0 0 1px #000,
    9px 12px 28px rgba(0, 0, 0, .72);
  background: var(--chrome);
}

.titlebar {
  min-height: 26px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 5px;
  color: #f5f4e7;
  border-bottom: 2px solid #292a27;
  background:
    repeating-linear-gradient(to bottom, rgba(255,255,255,.1) 0 1px, transparent 1px 3px),
    linear-gradient(90deg, #171b3b, #384c82 65%, #101429);
  text-shadow: 1px 1px #000;
  letter-spacing: .08em;
}

.titlebar h1, .titlebar h2 {
  min-width: 0;
  flex: 1;
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player > .titlebar h1 {
  text-shadow: -1px 0 #f0f, 1px 0 #0ff, 1px 1px #000;
}

.title-icon {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  color: #111;
  background: var(--green);
  border: 1px solid #020;
  font-size: 10px;
  text-shadow: none;
}

.win-buttons { display: flex; gap: 3px; }

.win-buttons i {
  width: 17px;
  height: 15px;
  border: 2px solid;
  border-color: #ddd #292929 #292929 #ddd;
  background: #999;
}

.win-buttons .close::after {
  content: "×";
  position: relative;
  top: -4px;
  left: 2px;
  color: #222;
  text-shadow: none;
  font: 700 13px Arial, sans-serif;
}

.player-face {
  position: relative;
  padding: 12px;
  border: 2px solid;
  border-color: #bcbdb7 #464743 #464743 #bcbdb7;
  background:
    linear-gradient(rgba(255,255,255,.07), transparent 40%),
    repeating-linear-gradient(135deg, transparent 0 2px, rgba(0,0,0,.025) 2px 4px),
    #777974;
}

.status-led {
  position: absolute;
  z-index: 2;
  top: 17px;
  right: 20px;
  color: #c5cac1;
  font-size: 9px;
  letter-spacing: .08em;
}

.status-led i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: #4e594a;
}

body.playing .status-led i {
  background: #70ff63;
  box-shadow: 0 0 6px #70ff63;
}

.lcd {
  position: relative;
  display: grid;
  grid-template-columns: 180px 112px 1fr;
  grid-template-rows: 55px 22px;
  gap: 6px 12px;
  min-height: 92px;
  padding: 9px 12px;
  color: var(--green);
  overflow: hidden;
  border: 3px solid;
  border-color: #20231f #c1c3bb #c1c3bb #20231f;
  background:
    radial-gradient(circle at 35% 45%, rgba(63,115,61,.13), transparent 50%),
    repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0,0,0,.45) 3px),
    var(--lcd);
  box-shadow: inset 0 0 20px #000, 0 0 8px rgba(121, 241, 109, .14);
  font-variant-numeric: tabular-nums;
  image-rendering: pixelated;
  text-shadow: 0 0 4px rgba(121, 241, 109, .48);
}

.lcd::after {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
  mix-blend-mode: screen;
}

.time-block { display: flex; align-items: center; gap: 8px; }

.play-glyph {
  color: var(--green-dim);
  font-size: 14px;
}

body.playing .play-glyph { color: var(--green); }

#elapsed {
  font-family: "Courier New", monospace;
  font-size: 45px;
  font-weight: 700;
  letter-spacing: -.11em;
  line-height: 1;
  text-shadow: 0 0 5px rgba(121,241,109,.45);
}

.stream-spec {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: center;
  column-gap: 6px;
}

.stream-spec b { font-size: 17px; line-height: 1; }
.stream-spec small { color: var(--green-dim); font-size: 8px; letter-spacing: .05em; }

.marquee-viewport {
  align-self: center;
  min-width: 0;
  overflow: hidden;
  border-left: 1px solid #31572f;
}

.marquee {
  width: max-content;
  min-width: 100%;
  padding-left: 8px;
  white-space: nowrap;
  font-weight: 700;
  font-size: 12px;
  animation: marquee 15s linear infinite;
}

@keyframes marquee { to { transform: translateX(-55%); } }

.mode-line {
  grid-column: 1 / -1;
  padding: 4px 6px 2px;
  overflow: hidden;
  border-top: 1px solid #274326;
  color: var(--green-dim);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mode-line strong {
  color: var(--green);
  font-size: 15px;
  text-shadow: 0 0 6px rgba(121, 241, 109, .55);
}

.analyzer-wrap {
  position: relative;
  margin-top: 8px;
  height: 112px;
  overflow: hidden;
  border: 3px solid;
  border-color: #252824 #bbbdb5 #bbbdb5 #252824;
  background: #050805;
}

#analyzer {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.analyzer-label {
  position: absolute;
  left: 7px;
  bottom: 4px;
  color: rgba(121,241,109,.45);
  font-size: 8px;
  letter-spacing: .12em;
}

.transport {
  display: grid;
  grid-template-columns: auto minmax(125px, 1fr) auto auto;
  align-items: end;
  gap: 8px;
  margin-top: 9px;
}

.transport-buttons { display: flex; }

button {
  min-width: 42px;
  min-height: 40px;
  padding: 5px 8px;
  color: #141512;
  border: 2px solid;
  border-color: #e2e3db #292b27 #292b27 #e2e3db;
  border-radius: 0;
  background: #999b95;
  box-shadow: inset 1px 1px rgba(255,255,255,.2);
  font-weight: 700;
  cursor: pointer;
}

button:active:not(:disabled) {
  border-color: #292b27 #e2e3db #e2e3db #292b27;
  transform: translate(1px, 1px);
}

button:focus-visible, input:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
button:disabled { color: #555751; cursor: not-allowed; text-shadow: 1px 1px #bfc0ba; }

.volume {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #22231f;
  font-size: 9px;
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  height: 18px;
  margin: 0 0 8px;
  accent-color: #213748;
  cursor: pointer;
}

.quality {
  min-height: 40px;
  margin: 0;
  padding: 3px 7px 5px;
  border: 2px solid;
  border-color: #454743 #c6c7bf #c6c7bf #454743;
  color: #171815;
}

.quality legend { padding: 0 3px; font-size: 8px; font-weight: 700; }
.quality label { display: inline-flex; align-items: center; min-height: 24px; cursor: pointer; }
.quality input { accent-color: #1e263c; }

.vibe {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.vibe > span {
  color: #22231f;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
}

.vibe button { min-width: 72px; }
.vibe button.on {
  color: #10210f;
  background: #79f16d;
  border-color: #d8ffd4 #1d5a18 #1d5a18 #d8ffd4;
}

.playlist, .exhibit { margin-top: 9px; }

.exhibit-title {
  background: linear-gradient(90deg, #26172b, #62305f 70%, #211322);
}

.exhibit-title a { color: inherit; text-decoration: none; }
.exhibit-title > span { color: #f2bce9; font-size: 9px; }

.filmstrip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(112px, 1fr);
  gap: 4px;
  padding: 6px;
  overflow-x: auto;
  border: 3px solid;
  border-color: #24251f #b1b2aa #b1b2aa #24251f;
  background: #090809;
  scrollbar-color: #777 #171717;
}

.filmstrip button {
  position: relative;
  min-width: 112px;
  height: 60px;
  min-height: 60px;
  padding: 0;
  overflow: hidden;
  border: 2px solid #3c3b3c;
  background: #080808;
}

.filmstrip button::after {
  content: attr(data-label);
  position: absolute;
  right: 2px;
  bottom: 1px;
  padding: 1px 3px;
  color: #ddd;
  background: rgba(0, 0, 0, .75);
  font-size: 8px;
}

.filmstrip button.active {
  border-color: #f1f079;
  box-shadow: 0 0 0 1px #f1f079, 0 0 9px rgba(255, 58, 220, .6);
}

.filmstrip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.25) contrast(1.15);
  image-rendering: pixelated;
}

.playlist-title { background: linear-gradient(90deg, #2a281b, #5e5b32 70%, #272618); }

.playlist-title > span {
  padding: 1px 4px;
  color: #15150f;
  background: #a6a36a;
  text-shadow: none;
}

.playlist-head, .history li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 55px;
}

.playlist-head {
  padding: 5px 10px 4px;
  color: #76744b;
  border-top: 1px solid #44452f;
  border-bottom: 1px solid #34351f;
  background: #0b0c08;
  font-size: 9px;
}

.history {
  height: 286px;
  margin: 0;
  padding: 5px 8px;
  overflow-y: auto;
  color: var(--yellow);
  border: 3px solid;
  border-color: #24251f #b1b2aa #b1b2aa #24251f;
  background:
    repeating-linear-gradient(to bottom, rgba(255,255,255,.02) 0 1px, transparent 1px 19px),
    rgba(4, 5, 3, .96);
  list-style: none;
  scrollbar-color: #6f7069 #171812;
}

.history li {
  min-height: 24px;
  align-items: center;
  padding: 2px 4px;
  gap: 6px;
  border-bottom: 1px dotted rgba(217,211,90,.12);
}

.history li > span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.history time { text-align: right; color: #a9a565; }

.history .current {
  color: #10120d;
  background: var(--yellow);
  box-shadow: inset 0 0 0 1px #f4ed81;
}

.history .current time { color: #10120d; }
.history .empty { color: #77754a; }

.playlist-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  color: #24251f;
  border-top: 1px solid #cacbc4;
  font-size: 9px;
  font-weight: 700;
}

.playlist-foot b { color: #343b1e; }

footer {
  padding: 18px 3px;
  color: rgba(235,232,225,.72);
  font-size: 10px;
  line-height: 1.7;
  text-shadow: 1px 1px 2px #000;
}

footer a { color: #ebe8e1; }

.listen-gate {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  margin: 0;
  padding: 24px;
  border: 0;
  color: var(--green);
  background: rgba(5, 8, 5, .62);
  cursor: pointer;
  font: inherit;
  letter-spacing: .08em;
  text-shadow: 0 0 8px rgba(121, 241, 109, .45);
}

.listen-gate[hidden] { display: none; }

.listen-gate span {
  padding: 10px 16px;
  border: 2px solid var(--green);
  background: rgba(7, 16, 9, .92);
  font-size: 16px;
  font-weight: 700;
}

.listen-gate small {
  color: #c5cac1;
  font-size: 11px;
  letter-spacing: .04em;
  text-shadow: 1px 1px 2px #000;
}

body.glitching .window { animation: window-jitter var(--glitch-duration, 330ms) steps(3, end); }
body.glitching .photo-stage { animation: frame-jump var(--glitch-duration, 330ms) steps(3, end); }
body.glitching .photo { filter: contrast(1.42) saturate(1.7); }
body.glitching .chroma-r { transform: translateX(-11px) scale(1.012); opacity: .2; }
body.glitching .chroma-c { transform: translateX(9px) scale(1.012); opacity: .18; }
body.glitching .glitch-slices i {
  transform: translateX(var(--burst-shift, -22px)) scale(1.025);
  opacity: .85;
}
body.glitching .lcd { animation: lcd-double var(--glitch-duration, 330ms) steps(2, end); }
body.glitching .scanlines { animation: line-slip var(--glitch-duration, 330ms) steps(3, end); }

@keyframes frame-jump {
  0% { clip-path: inset(0); transform: translate(0); }
  20% { clip-path: polygon(0 0,100% 0,100% 28%,0 34%,0 61%,100% 56%,100% 100%,0 100%); transform: translate(-3px, 2px); }
  45% { clip-path: polygon(0 0,100% 0,100% 48%,0 43%,0 73%,100% 79%,100% 100%,0 100%); transform: translate(4px, -2px); }
  70% { clip-path: inset(1% 0 0); transform: translate(-2px, 3px); }
  100% { clip-path: inset(0); transform: translate(0); }
}

@keyframes window-jitter {
  20% { transform: translate(1px, -1px); }
  45% { transform: translate(-2px, 1px); }
  70% { transform: translate(1px, 1px); }
}

@keyframes lcd-double {
  35% { text-shadow: -3px 0 rgba(255, 0, 255, .75), 3px 0 rgba(0, 255, 255, .75); }
  70% { text-shadow: 2px 0 rgba(255, 0, 255, .5), -2px 0 rgba(0, 255, 255, .5); }
}

@keyframes line-slip {
  30% { transform: translateY(9px) scaleY(.96); }
  65% { transform: translateY(-5px) scaleY(1.03); }
}

@media (max-width: 640px) {
  .station-shell { width: calc(100% - 16px); padding-top: 14px; }
  .lcd {
    grid-template-columns: minmax(145px, 1fr) 92px;
    grid-template-rows: 50px 28px 22px;
  }
  #elapsed { font-size: 38px; }
  .marquee-viewport { grid-column: 1 / -1; grid-row: 2; border-left: 0; }
  .mode-line { grid-row: 3; }
  .status-led { display: none; }
  .transport { grid-template-columns: 1fr auto auto; }
  .transport-buttons { grid-column: 1 / -1; }
  .transport-buttons button { flex: 1; }
  .filmstrip { grid-auto-columns: 108px; }
  .history { height: 250px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .marquee { width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .photo { animation: none; }
  body.glitching .window,
  body.glitching .photo-stage,
  body.glitching .lcd,
  body.glitching .scanlines { animation: none; }
}
