/* ============================================================
   Ryan Wong — Music Zone · "CH·01, the CRT room"
   While the main site is the daytime field notebook, the music
   zone is the room after hours: one CRT glowing in the dark.
   Fixed night palette by design — no light theme here.
   ============================================================ */

@font-face {
  font-family: 'Cormorant';
  src: url('assets/fonts/cormorant-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Manrope';
  src: url('assets/fonts/manrope-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Manrope';
  src: url('assets/fonts/manrope-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/fonts/jetbrains-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/fonts/jetbrains-mono-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0d14;
  --panel: #10141e;
  --panel-2: #151a27;
  --line: #222a3c;
  --line-strong: #333e59;
  --text: #e9e5d8;
  --muted: #8f8b7c;
  --neon: #ff7a3c;
  --neon-soft: rgba(255, 122, 60, 0.14);
  --amber: #ffc857;
  --cyan: #52d8e8;
  --screen: #05070d;
  /* Read by music-player.js for canvas spectrum colors */
  --accent: #ff7a3c;

  --font-display: 'Cormorant', Georgia, serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --font-zh: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --topbar-h: 60px;
  --sidebar-w: 304px;
  --radius: 3px;
  --speed: 200ms;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(255, 122, 60, 0.05), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(82, 216, 232, 0.045), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

html[lang='zh-CN'] body { font-family: var(--font-zh); line-height: 1.75; }

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
video, canvas { height: auto; }

a { color: inherit; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

h1, h2, p, pre, figure { margin: 0; }

::selection { background: var(--neon); color: #0a0d14; }

:focus-visible {
  outline: 2px solid var(--neon);
  outline-offset: 2px;
  border-radius: var(--radius);
}

.icon { fill: currentColor; flex: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  text-decoration: none;
  transform: translateY(-260%);
  transition: transform 160ms ease;
}
.skip-link:focus { transform: translateY(0); }

/* The room: scanlines + vignette over everything, never interactive */
.room-light {
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.016) 0 1px,
    transparent 1px 4px
  );
}
.room-light::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 40%, transparent 62%, rgba(0, 0, 0, 0.42) 100%);
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: rgba(10, 13, 20, 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(18px, 3vw, 32px);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  margin-right: auto;
  white-space: nowrap;
  min-width: 0;
}
.brand-mark {
  align-self: center;
  width: 9px;
  height: 9px;
  background: var(--neon);
  box-shadow: 0 0 10px rgba(255, 122, 60, 0.65);
  margin-right: 8px;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  color: var(--text);
}
html[lang='zh-CN'] .brand-tag { font-family: var(--font-mono); }
.brand-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  transform: translateY(-1px);
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.language-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.lang-divider { color: var(--line-strong); }
.language-option {
  padding: 4px 2px;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}
.language-option:hover { color: var(--text); }
.language-option.is-active { color: var(--neon); border-bottom-color: var(--neon); }

.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: color var(--speed) ease, border-color var(--speed) ease;
}
.home-btn:hover { color: var(--neon); border-color: var(--neon); }

/* ---------- Layout ---------- */
.broadcast {
  margin-left: var(--sidebar-w);
  max-width: 1160px;
  padding: clamp(20px, 3.4vh, 36px) clamp(20px, 3.4vw, 44px) 130px;
}

.zone-heading { margin-bottom: clamp(14px, 2.4vh, 22px); }
.zone-heading h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(34px, 4.4vw, 54px);
  line-height: 1.02;
  color: var(--text);
  text-shadow: 0 0 26px rgba(255, 122, 60, 0.18);
}
html[lang='zh-CN'] .zone-heading h1 { font-family: var(--font-zh); font-size: clamp(30px, 3.8vw, 44px); }

/* ---------- Channel strip ---------- */
.channel-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--neon);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 9px 14px;
  margin-bottom: clamp(14px, 2.4vh, 22px);
  min-width: 0;
}

.ch-no {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--neon);
  text-shadow: 0 0 12px rgba(255, 122, 60, 0.5);
  flex: none;
}

.marquee {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.marquee-track {
  display: inline-flex;
  white-space: nowrap;
  animation: marquee 26s linear infinite;
}
.marquee-text {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text);
  opacity: 0.86;
}
@keyframes marquee {
  to { transform: translateX(-50%); }
}

.on-air {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--muted);
  flex: none;
}
.on-air i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}
.on-air.live { color: var(--neon); text-shadow: 0 0 12px rgba(255, 122, 60, 0.55); }
.on-air.live i {
  background: var(--neon);
  box-shadow: 0 0 10px rgba(255, 122, 60, 0.9);
  animation: on-air-blink 1.6s ease-in-out infinite;
}
@keyframes on-air-blink {
  50% { opacity: 0.35; box-shadow: none; }
}

/* ---------- Main CRT screen ---------- */
.crt-tv {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--screen);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px #000,
    0 0 44px rgba(82, 216, 232, 0.07),
    0 26px 70px rgba(0, 0, 0, 0.6);
  transform-origin: 50% 50%;
  animation: crt-on 850ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}
@keyframes crt-on {
  0% { transform: scaleY(0.004) scaleX(0.65); filter: brightness(5); }
  38% { transform: scaleY(0.012) scaleX(1); filter: brightness(3.2); }
  62% { transform: scaleY(1.015); filter: brightness(1.5); }
  100% { transform: none; filter: none; }
}

.crt-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 400ms ease;
}
/* Slight zoom trims the top-left source watermark out of frame */
.crt-tv.has-mv .crt-video {
  opacity: 1;
  object-fit: cover;
  transform: scale(1.16);
  transform-origin: 72% 72%;
}

.crt-scope {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 400ms ease;
}
.crt-tv.scope-mode .crt-scope { opacity: 1; }

/* Big spectrum lives inside the screen, bottom third */
.spectrum-bar {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 6%;
  width: 92%;
  height: 30%;
  opacity: 0;
  transition: opacity 400ms ease;
  z-index: 2;
}
.crt-tv.scope-mode .spectrum-bar { opacity: 0.92; }

.crt-tv.scope-mode::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px);
  pointer-events: none;
  z-index: 3;
}

.static-noise {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}
.static-noise.is-playing { opacity: 0.1; animation: noise-shift 0.45s steps(3) infinite; }
@keyframes noise-shift {
  0% { background-position: 0 0; }
  33% { background-position: -46px 22px; }
  66% { background-position: 30px -38px; }
  100% { background-position: 0 0; }
}

/* Curved glass: vignette + reflection */
.crt-vignette {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.055) 0%, transparent 26%),
    radial-gradient(115% 100% at 50% 46%, transparent 60%, rgba(0, 0, 0, 0.5) 100%);
}

.crt-status {
  position: absolute;
  left: 18px;
  top: 14px;
  z-index: 6;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(82, 216, 232, 0.75);
  opacity: 0.9;
}
.crt-tv.signal-received .crt-status { color: var(--neon); text-shadow: 0 0 12px rgba(255, 122, 60, 0.8); }

.crt-tv.channel-flick { animation: flick 0.42s steps(2, end); }
@keyframes flick {
  0% { filter: brightness(2.2) contrast(1.35); }
  40% { filter: brightness(0.72); }
  100% { filter: none; }
}

/* ---------- Transport console ---------- */
.console {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px 18px 18px;
  margin-top: clamp(14px, 2.4vh, 22px);
}

.console-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.time-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.time-display .time-sep { color: var(--line-strong); font-weight: 400; }
#totalTimeDisplay { color: var(--muted); font-weight: 400; }

.seek-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
/* Segmented "tape teeth" track */
input[type='range']::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  background: repeating-linear-gradient(90deg, #1a2130 0 7px, #0a0d14 7px 10px);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 22px;
  margin-top: -6px;
  border-radius: 2px;
  background: var(--neon);
  box-shadow: 0 0 12px rgba(255, 122, 60, 0.7);
}
input[type='range']::-moz-range-track {
  height: 12px;
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  background: repeating-linear-gradient(90deg, #1a2130 0 7px, #0a0d14 7px 10px);
}
input[type='range']::-moz-range-thumb {
  width: 10px;
  height: 22px;
  border: 0;
  border-radius: 2px;
  background: var(--neon);
  box-shadow: 0 0 12px rgba(255, 122, 60, 0.7);
}

.transport {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pixel-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 44px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.55);
  transition: color var(--speed) ease, border-color var(--speed) ease, transform 90ms ease, box-shadow 90ms ease;
}
.pixel-btn:hover {
  color: var(--neon);
  border-color: var(--neon);
  text-shadow: 0 0 10px rgba(255, 122, 60, 0.6);
}
.pixel-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0.55);
}
.pixel-btn.random,
.pixel-btn.single {
  color: var(--amber);
  border-color: var(--amber);
}

.play-btn {
  width: 66px;
  height: 58px;
  background: var(--neon);
  border-color: var(--neon);
  color: #140b06;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.6), 0 0 26px rgba(255, 122, 60, 0.4);
}
.play-btn:hover { color: #140b06; }
.play-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 26px rgba(255, 122, 60, 0.4); }

.mode-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  background: var(--amber);
  color: #140b06;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(255, 200, 87, 0.6);
}

.volume-control {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 180px;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity var(--speed) ease, transform var(--speed) ease;
  z-index: 30;
}
.volume-control.show { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- Now playing: turntable + ticket ---------- */
.now-playing {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(24px, 3.4vw, 44px);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(600px 220px at 0% 0%, rgba(255, 122, 60, 0.05), transparent 60%),
    var(--panel);
  padding: clamp(20px, 3.4vh, 32px) clamp(20px, 3.4vw, 36px);
  margin-top: clamp(14px, 2.4vh, 22px);
}

.vinyl-wrapper {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
}

.vinyl {
  position: relative;
  width: 218px;
  height: 218px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #262626 0%, #191919 58%, #101010 100%);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 34px rgba(255, 122, 60, 0.08);
  animation: vinyl-spin 3.2s linear infinite;
  animation-play-state: paused;
}
.vinyl.playing { animation-play-state: running; }
@keyframes vinyl-spin {
  to { transform: rotate(360deg); }
}

.vinyl-grooves {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 5px);
}
.vinyl-grooves::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg, rgba(255, 255, 255, 0.055) 14deg, transparent 30deg,
    transparent 160deg, rgba(255, 255, 255, 0.045) 175deg, transparent 190deg,
    transparent 300deg, rgba(255, 255, 255, 0.05) 318deg, transparent 335deg
  );
}

.vinyl-label {
  position: absolute;
  inset: 31%;
  border-radius: 50%;
  background: var(--neon);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.vinyl-label::after {
  content: 'B1 · 33⅓ RPM';
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.14em;
  color: rgba(10, 13, 20, 0.85);
  text-align: center;
  width: 130%;
  transform: rotate(-14deg);
}
.vinyl-hole {
  position: absolute;
  width: 9%;
  height: 9%;
  border-radius: 50%;
  background: var(--screen);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
  z-index: 1;
}

.tonearm {
  position: absolute;
  top: -2%;
  right: -4%;
  width: 46%;
  height: 46%;
  transform-origin: 82% 18%;
  transform: rotate(-30deg);
  transition: transform 600ms cubic-bezier(0.3, 0.7, 0.2, 1);
  pointer-events: none;
}
.vinyl-wrapper:has(.vinyl.playing) .tonearm { transform: rotate(4deg); }
.tonearm-arm {
  position: absolute;
  top: 14%;
  left: 44%;
  width: 4px;
  height: 86%;
  background: linear-gradient(#5a5f6b, #3a3f4a);
  border-radius: 2px;
}
.tonearm-head {
  position: absolute;
  top: 4%;
  left: 32%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #454a56;
  box-shadow: inset 0 0 0 2px #2c313b;
}

.track-data {
  font-family: var(--font-mono);
  font-size: 14.5px;
  line-height: 2.15;
  letter-spacing: 0.045em;
  color: var(--muted);
  white-space: pre-wrap;
  min-width: 0;
}
.ticket-key {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.26em;
  color: var(--neon);
  text-shadow: 0 0 12px rgba(255, 122, 60, 0.5);
  border: 1px solid rgba(255, 122, 60, 0.4);
  padding: 4px 12px;
  margin-bottom: 10px;
}
.track-data .track-title { color: var(--text); font-weight: 600; }
.track-data .track-artist,
.track-data .track-duration { color: var(--amber); }

/* ---------- Resident DJ ---------- */
.ai-terminal {
  border: 1px solid var(--line);
  border-top: 3px solid var(--cyan);
  border-radius: var(--radius);
  background: var(--screen);
  overflow: hidden;
  margin-top: clamp(14px, 2.4vh, 22px);
}

.ai-terminal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.ai-terminal-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-right: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(82, 216, 232, 0.5);
}
.ai-terminal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(82, 216, 232, 0.8);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.terminal-toggle {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--muted);
}
.terminal-toggle:hover { color: var(--text); }
.terminal-toggle[aria-expanded='false'] .icon { transform: rotate(180deg); }

.mood-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px 4px;
}
.mood-presets:empty { display: none; }

.mood-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 7px 14px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
  transition: color var(--speed) ease, border-color var(--speed) ease, transform 90ms ease, box-shadow 90ms ease;
}
.mood-chip:hover { color: var(--amber); border-color: var(--amber); }
.mood-chip:active { transform: translate(2px, 2px); box-shadow: none; }

.terminal-log {
  height: 158px;
  overflow-y: auto;
  padding: 10px 16px 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.8;
  color: #b9b5a6;
  overscroll-behavior: contain;
}
.terminal-log.collapsed { display: none; }

.terminal-line { margin-bottom: 4px; overflow-wrap: anywhere; }
.terminal-line.user { color: var(--muted); }
.terminal-line.ai { color: var(--neon-2, var(--amber)); }

.terminal-line.typing::after {
  content: '';
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 2px;
  background: var(--cyan);
  vertical-align: text-bottom;
  animation: caret 0.9s steps(1) infinite;
}
@keyframes caret {
  50% { opacity: 0; }
}

.chip-line { margin-top: 6px; }
.terminal-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 6px 10px;
  transition: border-color var(--speed) ease, color var(--speed) ease;
}
.terminal-chip:hover { border-color: var(--neon); color: var(--neon); }
.chip-play { color: var(--neon); font-size: 9px; }
.chip-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-artist {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12em;
}

/* ---------- Playlist sidebar ---------- */
.playlist-sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  z-index: 90;
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.playlist-tab { display: none; }

.playlist-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  padding: 20px 18px 16px;
}

.playlist-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.playlist-head h2 {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  margin-right: auto;
}
.playlist-head p {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--neon);
}

.playlist-search { padding: 12px 0 10px; }
.playlist-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0 8px 0 10px;
}
.playlist-search-row:focus-within { border-color: var(--neon); }
.playlist-search-icon { color: var(--muted); }
.playlist-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 9px 0;
}
.playlist-search-input:focus { outline: none; }
.playlist-search-input::placeholder { color: var(--muted); }
.playlist-search-clear {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--muted);
  border-radius: var(--radius);
}
.playlist-search-clear:hover { color: var(--neon); }
.playlist-search-clear:disabled { opacity: 0.35; cursor: default; }

.playlist-items {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  overscroll-behavior: contain;
}

.playlist-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 10px 8px 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
  align-items: baseline;
  transition: background var(--speed) ease, border-color var(--speed) ease;
}
.playlist-item:hover { background: var(--panel-2); }
.playlist-item.active {
  border-left-color: var(--neon);
  background: var(--neon-soft);
}
.playlist-item-number {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
}
.playlist-item.active .playlist-item-number { color: var(--neon); }
.playlist-item-info { display: block; min-width: 0; }
.playlist-item-title {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlist-item.active .playlist-item-title { text-shadow: 0 0 14px rgba(255, 122, 60, 0.35); }
.playlist-item-artist {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-empty-state {
  padding: 18px 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- Mascot sticker ---------- */
.mascot-container {
  position: fixed;
  right: clamp(14px, 2.6vw, 34px);
  bottom: clamp(14px, 3.4vh, 30px);
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 500ms ease, transform 500ms ease;
}
.mascot-container.visible {
  opacity: 1;
  transform: translateY(0);
  animation: mascot-bob 1.8s ease-in-out infinite;
}
.mascot-container.visible::after {
  content: '♪';
  position: absolute;
  top: -18px;
  right: 6%;
  font-size: 20px;
  color: var(--amber);
  text-shadow: 0 0 12px rgba(255, 200, 87, 0.8);
  animation: note-float 2.1s ease-in-out infinite;
}
@keyframes mascot-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
@keyframes note-float {
  0% { opacity: 0; transform: translateY(4px) rotate(-8deg); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-16px) rotate(10deg); }
}
.mascot-container img {
  width: clamp(130px, 14vw, 190px);
  height: auto;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.6));
}

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .now-playing { grid-template-columns: 200px minmax(0, 1fr); }
  .vinyl { width: 170px; height: 170px; }
}

@media (max-width: 900px) {
  .brand-tag { display: none; }
  .home-btn span { display: none; }
  .home-btn { padding: 8px 10px; }

  .playlist-sidebar {
    width: min(84vw, 340px);
    transform: translateX(-102%);
    transition: transform 320ms cubic-bezier(0.3, 0.7, 0.2, 1);
    box-shadow: none;
  }
  .playlist-sidebar.open {
    transform: none;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  }

  .playlist-tab {
    position: fixed;
    left: 14px;
    bottom: 14px;
    z-index: 95;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 12px 18px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: var(--neon);
    color: #140b06;
    border-radius: 999px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5), 0 0 22px rgba(255, 122, 60, 0.35);
  }
  .playlist-tab:hover { color: #140b06; }

  .broadcast { margin-left: 0; padding-top: 18px; }

  .now-playing { grid-template-columns: 1fr; justify-items: center; text-align: left; }
  .now-playing .track-data { width: 100%; }

  .mascot-container { opacity: 0.24; }
  .mascot-container.visible { opacity: 0.85; }
  .mascot-container img { width: 100px; }
}

@media (max-width: 560px) {
  :root { --topbar-h: 56px; }

  .zone-heading h1 { font-size: clamp(30px, 8.6vw, 40px); }

  .channel-bar { gap: 10px; padding: 8px 10px; }
  .ch-no { font-size: 11px; }
  .on-air span { display: none; }

  .transport { flex-wrap: wrap; }
  .pixel-btn { width: 44px; height: 42px; }
  .play-btn { width: 60px; height: 54px; }

  .mascot-container { display: none; }

  .terminal-log { height: 130px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .vinyl { animation: none; }
  .tonearm { transform: rotate(4deg); }
  .static-noise.is-playing { animation: none; opacity: 0.1; }
  .crt-tv { animation: none; }
  .marquee-track { animation: none; }
  .mascot-container.visible { animation: none; }
}
