    :root {
      --bg: #0a0a0b;
      --panel: #131315;
      --panel-2: #0b0b0d;
      --panel-border: #22232a;
      --fg: #ededef;
      --muted: #8a8a91;
      --dim: #484850;
      /* Monochrome: the "accent" is a light neutral, so buttons/tabs/title/
         mentions/dot all render grayscale (on-accent text stays dark #0a0a0a). */
      --accent: #d9d9de;
      --accent-rgb: 217, 217, 222;
      --accent-glow: rgba(217, 217, 222, 0.20);
      --ok: #4ade80;
      --neutral-btn-bg: #23232a;
      --neutral-btn-bg-hover: #2e2e37;
      --neutral-btn-fg: #d6d6dc;
      --error: #ffa040;
      /* Broadcast red — the one deliberate splash of color, for the live dot. */
      --live: #ff453a;
      --live-glow: rgba(255, 69, 58, 0.55);
      --chat-w: 420px;            /* right sidebar width (grid track + slide) */
      --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    }
    * { box-sizing: border-box; }
    html, body { height: 100%; margin: 0; }
    body {
      background: var(--bg); color: var(--fg);
      font-family: var(--font-body);
      font-feature-settings: 'ss01', 'cv11';
      -webkit-font-smoothing: antialiased;
      display: grid;
      grid-template-columns: minmax(0, 1fr) var(--chat-w);
      grid-template-rows: 100vh;
      overflow: hidden;  /* scrolling belongs to the chat pane, not the page */
    }

    /* ── Collapsed right sidebar ──────────────────────────────────
       Collapsing animates the chat's grid track from --chat-w to 0. The
       panel keeps its full width (justify-self:start pins its left edge to
       the shrinking track's start, which slides right) so its content slides
       off the right edge intact rather than reflowing; body overflow:hidden
       clips it. The audio panel's 1fr column grows into the freed space.
       The transition is gated behind .anim-ready so the restored-from-storage
       state applies instantly on load instead of sliding in. JS fires a
       resize when the slide settles so the viz/FX canvases relayout. */
    .chat-panel { width: var(--chat-w); justify-self: start; }
    body.anim-ready { transition: grid-template-columns 0.32s cubic-bezier(0.4, 0, 0.2, 1); }
    body.chat-collapsed { grid-template-columns: minmax(0, 1fr) 0; }
    /* Reopen affordance — a compact pill that reads clearly as a button but
       stays understated (toned-down opacity, no heavy shadow) so it doesn't
       compete with the visuals; comes to full strength on hover/focus.
       Always in the DOM (fixed position, so no layout cost) and animated
       in/out on collapse: it slides in from the right edge rather than
       popping. Resting/hidden state (chat expanded) lives on the base rule. */
    #chat-reopen-btn {
      display: inline-flex; align-items: center; gap: 0.35em;
      position: fixed; top: 0.7em; right: 0.7em; z-index: 60;
      padding: 0.4em 0.6em;
      background: color-mix(in srgb, var(--panel) 70%, transparent);
      color: var(--muted);
      border: 1px solid var(--panel-border); border-radius: 7px;
      cursor: pointer;
      font-family: var(--font-body); font-size: 0.8em; font-weight: 600;
      /* hidden: faded, slid off past the right edge, and non-interactive.
         visibility flips after the fade (0.2s delay) so it stays animatable
         on the way out but leaves the tab order once gone. */
      opacity: 0; transform: translateX(calc(100% + 0.7em));
      visibility: hidden; pointer-events: none;
      transition: opacity 0.2s ease, transform 0.2s ease,
                  visibility 0s linear 0.2s,
                  color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    }
    body.chat-collapsed #chat-reopen-btn {
      opacity: 0.7; transform: translateX(0);
      visibility: visible; pointer-events: auto;
      /* Delay the entrance so it lands after the sidebar has slid clear of
         the top-right corner, avoiding an overlap during the transition. */
      transition: opacity 0.2s ease 0.18s, transform 0.2s ease 0.18s,
                  visibility 0s linear 0s,
                  color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    }
    body.chat-collapsed #chat-reopen-btn:hover,
    body.chat-collapsed #chat-reopen-btn:focus-visible {
      opacity: 1; color: var(--fg);
      background: var(--panel); border-color: var(--muted);
      outline: none;
    }
    /* Respect reduced-motion: keep a gentle fade, drop the slides. */
    @media (prefers-reduced-motion: reduce) {
      #chat-reopen-btn,
      body.chat-collapsed #chat-reopen-btn { transform: none; }
      body.anim-ready { transition: none; }
    }

    /* Collapse chevron sits at the sidebar's top-left, next to the title. */
    .chat-header-left { display: inline-flex; align-items: center; gap: 0.4em; }
    #chat-collapse-btn {
      background: transparent; border: none; color: var(--muted);
      cursor: pointer; padding: 2px 4px; margin-left: -4px;
      display: inline-flex; align-items: center;
      border-radius: 4px;
      transition: color 0.15s ease, background 0.15s ease;
    }
    #chat-collapse-btn:hover { color: var(--fg); background: var(--neutral-btn-bg); }

    /* ── Fullscreen blurred album-art background ─────────────────── */
    #bg-layer {
      position: fixed; inset: 0;
      z-index: -1;
      background: var(--bg);
      overflow: hidden;
    }
    .bg-art {
      position: absolute; inset: -10%;
      background-size: cover;
      background-position: center center;
      background-repeat: no-repeat;
      filter: blur(60px) saturate(1.25);
      transform: scale(1.15);
      opacity: 0;
      transition: opacity 1.2s ease;
      will-change: opacity;
    }
    .bg-art.active { opacity: 0.65; }
    #bg-dim {
      position: absolute; inset: 0;
      background:
        radial-gradient(ellipse at center, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.65) 85%),
        rgba(8, 8, 10, 0.35);
    }

    /* ── Typographic primitives ──────────────────────────────────── */
    .num { font-variant-numeric: tabular-nums; }
    @media (max-width: 900px) {
      body {
        grid-template-columns: 1fr;
        /* minmax(0, 1fr) lets the chat row shrink below its content size so
           the inner overflow-y: auto actually kicks in; plain "1fr" with an
           auto-height body was letting the page grow forever on mobile. */
        grid-template-rows: auto minmax(0, 1fr);
        /* dvh accounts for the iOS/Safari URL bar collapse — vh fallback
           for older browsers (later declaration wins). */
        height: 100vh;
        height: 100dvh;
      }
      /* Mobile stacks vertically, so the desktop horizontal-slide setup
         (fixed panel width + column track) doesn't apply — the panel fills
         its row and collapsing just drops the row and hides it. */
      .chat-panel { width: auto; justify-self: stretch; }
      body.chat-collapsed { grid-template-rows: minmax(0, 1fr); }
      body.chat-collapsed .chat-panel { display: none; }
    }

    /* ── Audio panel ─────────────────────────────────────────────── */
    .audio-panel {
      display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      padding: 2em 1em;
      border-right: 1px solid var(--panel-border);
      position: relative;
      overflow: hidden;
      background: transparent;  /* let the blurred-art bg show through */
      /* Isolate so our mix-blend-mode FX layers only composite with content
         inside this panel (viz canvas, laser canvas, shake-root). Without
         this, a difference-blend layer could tint the chat or the
         page-level blurred background. */
      isolation: isolate;
    }
    /* Put non-canvas children (UI: shake-root/now-playing) above the viz. */
    .audio-panel > :not(canvas) { position: relative; z-index: 1; }
    /* …but the .fx-layer div overlays (invert/strobe/whiteout/blackout) must stay
       ABSOLUTE full-panel overlays — the rule above was forcing them to
       position:relative (in-flow, ~0 height) so they never covered the screen.
       Scoped to keep specificity low so it doesn't disturb .shake-root's z-index. */
    .audio-panel > .fx-layer { position: absolute; }
    /* FX root — lives above the viz canvas, wraps everything shakeable in
       the audio panel. rumble/zoom write these custom properties. */
    .shake-root {
      display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      --fx-tx: 0px;
      --fx-ty: 0px;
      --fx-scale: 1;
      transform: translate(var(--fx-tx), var(--fx-ty)) scale(var(--fx-scale));
      will-change: transform, filter;
    }
    /* Panel UI (now-playing card, status, waiting room) sits ABOVE every viz/fx
       layer — incl. the opaque post-processing output (#fx-postout) — so it stays
       readable over the visuals. (Higher specificity than the generic z-index:1.) */
    .audio-panel > .shake-root { z-index: 6; }
    /* FX overlays — scoped to the audio panel so nothing leaks into chat.
       Each layer's opacity tracks an intensity envelope (see initFx JS). */
    .fx-layer {
      position: absolute; inset: 0;
      pointer-events: none;
      opacity: 0;
      will-change: opacity;
    }
    /* Radial invert: difference-blend a radial-gradient of white, so pixels
       under the bright center read as inverted and edges are untouched.
       Far less epilepsy-inducing than a full-frame filter:invert flip. */
    #fx-invert-layer {
      background: radial-gradient(
        circle at center,
        rgba(255,255,255,0.95) 0%,
        rgba(255,255,255,0.8) 18%,
        rgba(255,255,255,0.4) 40%,
        rgba(255,255,255,0) 62%
      );
      mix-blend-mode: difference;
      z-index: 3;
    }
    /* Beat-synced strobe: additive white pulses locked to BPM subdivisions. */
    #fx-strobe-layer {
      background: rgba(255, 255, 255, 1);
      mix-blend-mode: screen;
      z-index: 4;
    }
    /* Whiteout / blackout — flat full-panel washes, above the lights (z 5) so
       they actually cover everything the DJ wants gone. Normal blend. */
    #fx-whiteout-layer { background: #fff; mix-blend-mode: normal; z-index: 7; }
    #fx-blackout-layer { background: #000; mix-blend-mode: normal; z-index: 7; }
    /* Beat flash: a full-panel wash the handler drives white→black each beat.
       Base #000 so it reads as black between paints; JS sets backgroundColor. */
    #fx-beatflash-layer { background: #000; mix-blend-mode: normal; z-index: 7; }
    /* Laser/beam light sim — drawn to its own canvas so we can composite
       with additive blend and bloom. */
    .audio-panel.drag { outline: 2px dashed var(--muted); outline-offset: -10px; }
    #fx-lasers, #fx-clublasers, #fx-paparazzi, #fx-strobewash, #fx-beamrow, #fx-squares,
    #fx-versewash, #fx-feedbacktunnel, #fx-blockglitch, #fx-gridtunnel, #fx-asciimap,
    #fx-cloudfield, #fx-thermal, #fx-liquid, #fx-swirl, #fx-mosaic, #fx-filmgrain, #fx-lightleak,
    #fx-nodeweb, #fx-trackboxes, #fx-movingheads, #fx-roofglow, #fx-noisemap, #fx-postout, #fx-glout {
      position: absolute; inset: 0;
      width: 100%; height: 100%;   /* canvas is a replaced element: inset:0 alone
                                      doesn't stretch it — without this it keeps
                                      its (growing) intrinsic size and overflows. */
      pointer-events: none;
      z-index: 2;
      opacity: 0;
      mix-blend-mode: screen;
      will-change: opacity;
    }
    /* The post-processing chain resolves to this single output canvas — it shows
       the fully-processed frame (normal blend, above the base visuals). The
       individual post canvases are hidden intermediates driven by runPostChain. */
    #fx-postout, #fx-glout {
      mix-blend-mode: normal;
      z-index: 3;
    }
    /* Lighting / laser / flash overlays sit ABOVE the post-processing output
       (#fx-postout, z-index 3) so they're never hidden when a post effect is on —
       they read as real lights layered on top of the processed scene, and they
       aren't themselves datamoshed/warped (which fell apart). */
    #fx-lasers, #fx-clublasers, #fx-paparazzi, #fx-strobewash, #fx-beamrow, #fx-squares,
    #fx-invert-layer, #fx-strobe-layer,
    /* New overlays that read as real lights / HUD graphics — above the post
       output so they aren't datamoshed/warped by the post chain. */
    #fx-nodeweb, #fx-trackboxes, #fx-movingheads, #fx-roofglow {
      z-index: 5;
    }
    /* Noise map sits just below those but above the post output, and uses an
       exclusion blend so it inverts/distorts the processed scene beneath it. */
    #fx-noisemap {
      z-index: 4;
      mix-blend-mode: exclusion;
    }
    /* Searchlights + moving heads: soft-blur the whole beam field so the stacked
       wedges read as one feathered volumetric beam instead of hard/stepwise
       triangles. Moving heads blur a touch less (they're colored + wider). */
    #fx-roofglow {
      filter: blur(6px);
    }
    #fx-movingheads {
      filter: blur(13px);
    }
    #viz-canvas {
      position: absolute; inset: 0;
      width: 100%; height: 100%;
      z-index: 0;
      pointer-events: none;
    }
    @media (max-width: 900px) {
      .audio-panel { border-right: none; border-bottom: 1px solid var(--panel-border); }
    }
    #status {
      font-size: 1.35em;
      font-weight: 500;
      letter-spacing: -0.01em;
      margin-bottom: 1em;
    }
    #status .connected {
      color: var(--accent);
      text-shadow: 0 0 14px var(--accent-glow);
      font-weight: 600;
    }
    #start-btn {
      font-size: 0.95em;
      font-weight: 500;
      padding: 0.6em 1.4em;
      cursor: pointer;
      background: var(--accent); border: none; color: #0a0a0a;
      border-radius: 6px;
    }
    #start-btn:disabled { background: #2a2d33; cursor: default; color: #5a5d66; }

    /* Waiting room — shown in the audio panel when the DJ isn't live. */
    #waiting-room {
      display: flex; flex-direction: column; align-items: center; text-align: center;
      gap: 0.5em; padding: 2.2em 1.4em; max-width: 320px;
    }
    #waiting-room[hidden] { display: none; }
    .wr-dot {
      width: 9px; height: 9px; border-radius: 50%; background: var(--muted);
      box-shadow: 0 0 0 0 rgba(138,138,145,0.5); animation: wrPulse 2.4s ease-out infinite;
      margin-bottom: 0.3em;
    }
    @keyframes wrPulse {
      0%   { box-shadow: 0 0 0 0 rgba(138,138,145,0.45); opacity: 1; }
      70%  { box-shadow: 0 0 0 10px rgba(138,138,145,0); opacity: 0.6; }
      100% { box-shadow: 0 0 0 0 rgba(138,138,145,0); opacity: 1; }
    }
    .wr-title { font-size: 1.15em; font-weight: 700; letter-spacing: -0.01em; color: var(--fg);
                text-wrap: balance; }
    .wr-sub { font-size: 0.9em; color: var(--muted); max-width: 30ch; text-wrap: balance; }
    .wr-countdown {
      margin-top: 1em; padding: 0.9em 1.3em; border: 1px solid var(--panel-border);
      border-radius: 12px; background: rgba(13,13,15,0.6);
    }
    .wr-countdown[hidden] { display: none; }
    .wr-cd-label { font-size: 0.72em; letter-spacing: 0.08em; text-transform: uppercase;
                   color: var(--muted); font-weight: 600; margin-bottom: 0.25em; }
    .wr-cd-time { font-size: 1.5em; font-weight: 800; font-variant-numeric: tabular-nums;
                  letter-spacing: 0.01em; color: var(--fg); }
    #now-playing {
      display: none;
      margin-top: 1.2em;
      padding: 1em 1.2em 1.1em;
      background: rgba(13, 13, 15, 0.72);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border: 1px solid var(--panel-border);
      /* Left accent color follows the album palette when we have one,
         falls back to the theme accent (neutral gray) before any track loads. */
      border-left: 2px solid rgba(var(--art-1, var(--accent-rgb)), 1);
      border-radius: 3px;
      text-align: left;
      width: min(480px, 88vw);
      transition: border-left-color 0.8s ease;
    }
    .np-row { display: flex; gap: 1.1em; align-items: stretch; }
    .np-art-wrap {
      position: relative;
      width: 140px; height: 140px; flex: 0 0 140px;
      border-radius: 6px; overflow: hidden;
      border: 1px solid var(--panel-border);
      background: var(--panel);
    }
    #np-art {
      position: absolute; inset: 0;
      width: 100%; height: 100%;
      object-fit: cover;
      opacity: 0; transition: opacity 0.35s ease;
    }
    #np-art.loaded { opacity: 1; }
    /* Placeholder shown when a track has no art — a hash-derived gradient
       with the title/artist initials, so something always renders. */
    #np-art-placeholder {
      position: absolute; inset: 0;
      display: flex; align-items: center; justify-content: center;
      font-size: 2.6em; font-weight: 700; letter-spacing: -0.02em;
      color: rgba(255, 255, 255, 0.88);
      text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
      background: linear-gradient(135deg, #2a2a32, #11111a);
      user-select: none;
    }
    #np-art-placeholder[hidden] { display: none; }
    /* Like heart, pinned bottom-right of the art tile. */
    #np-like {
      position: absolute;
      bottom: 6px; right: 6px;
      z-index: 2;
      display: flex; align-items: center; gap: 0.35em;
      background: rgba(10, 10, 12, 0.72);
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 999px;
      padding: 0.28em 0.65em 0.28em 0.55em;
      color: var(--fg);
      font-size: 0.78em; font-weight: 600;
      cursor: pointer;
      transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
      font-variant-numeric: tabular-nums;
    }
    #np-like:hover { background: rgba(20, 20, 24, 0.85); border-color: rgba(255, 255, 255, 0.18); }
    #np-like:active { transform: scale(0.94); }
    #np-like svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; transition: fill 0.15s ease, color 0.15s ease, transform 0.2s ease; }
    #np-like.liked svg { fill: var(--fg); color: var(--fg); }
    #np-like.bump svg { transform: scale(1.35); }
    /* Float-up +1 for each local tap. */
    .like-pop {
      position: absolute;
      bottom: 30px; right: 18px;
      color: var(--fg);
      font-size: 0.85em; font-weight: 700;
      pointer-events: none;
      animation: likePop 0.9s ease forwards;
    }
    @keyframes likePop {
      from { opacity: 1; transform: translateY(0) scale(0.9); }
      to   { opacity: 0; transform: translateY(-28px) scale(1.1); }
    }
    .np-text {
      flex: 1 1 auto; min-width: 0;
      display: flex; flex-direction: column; justify-content: center;
    }
    #np-title  { color: var(--fg);   font-size: 1.3em;  font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; word-wrap: break-word; }
    #np-artist { color: var(--muted); font-size: 1em; margin-top: 0.4em; word-wrap: break-word; }
    #np-bpm    {
      color: var(--muted);
      font-size: 0.85em;
      margin-top: 0.9em;
      font-variant-numeric: tabular-nums;
    }
    #volume-control {
      display: none;
      align-items: center;
      gap: 0.7em;
      margin-top: 0.85em;
      padding-top: 0.8em;
      border-top: 1px solid var(--panel-border);
    }
    #volume-control label {
      font-size: 0.82em; color: var(--muted);
      flex: 0 0 auto;
    }
    #volume-slider {
      flex: 1 1 auto; width: auto;
      accent-color: #6b6b73;
    }
    #volume-val {
      font-size: 0.82em; color: var(--muted);
      min-width: 3ch; text-align: right;
      flex: 0 0 auto;
      font-variant-numeric: tabular-nums;
    }
    .connected { color: var(--accent); }
    .error { color: var(--error); }

    /* ── Chat panel ──────────────────────────────────────────────── */
    .chat-panel {
      display: flex; flex-direction: column;
      background: var(--panel);
      min-height: 0;  /* allow grid child to shrink */
    }
    .chat-header {
      padding: 0.85em 1.1em;
      border-bottom: 1px solid var(--panel-border);
      display: flex; justify-content: space-between; align-items: center;
      font-size: 0.88em;
    }
    .chat-header .title {
      color: var(--fg);
      font-weight: 600;
      font-size: 0.95em;
      letter-spacing: -0.005em;
    }
    .chat-header .meta {
      color: var(--muted);
      font-size: 0.82em;
    }
    .chat-header .meta .status-dot {
      display: inline-block; width: 8px; height: 8px; border-radius: 50%;
      background: var(--dim); margin-right: 0.4em;
      vertical-align: middle;
    }
    .chat-header .meta.online .status-dot {
      background: var(--ok);
      box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
    }
    .chat-header .meta.error .status-dot { background: var(--error); }

    /* Settings gear + popover, pinned to chat header. */
    .chat-header .actions { display: flex; align-items: center; gap: 0.5em; position: relative; }
    #settings-btn {
      background: transparent; border: none; color: var(--muted);
      cursor: pointer; padding: 2px 4px; display: inline-flex; align-items: center;
      border-radius: 4px;
      transition: color 0.15s ease, background 0.15s ease;
    }
    #settings-btn:hover { color: var(--fg); background: var(--neutral-btn-bg); }
    #settings-popover {
      position: absolute; top: calc(100% + 8px); right: 0;
      background: var(--panel);
      border: 1px solid var(--panel-border);
      border-radius: 8px;
      padding: 0.6em 0.75em;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
      z-index: 50;
      min-width: 220px;
      font-size: 0.85em;
      /* Cap to the viewport and scroll — the effect list outgrew the screen.
         top is ~header height below the top edge, so leave a matching margin. */
      max-height: calc(100vh - 72px);
      overflow-y: auto;
      overscroll-behavior: contain;
    }
    #settings-popover[hidden] { display: none; }
    #settings-popover h4 {
      /* Keep the title pinned while the list scrolls under it. */
      position: sticky; top: 0;
      background: var(--panel);
      margin: 0 0 0.5em 0;
      padding-bottom: 0.4em;
      font-size: 0.78em;
      font-weight: 600;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }
    #settings-popover h5 {
      margin: 0.55em 0 0.1em 0;
      font-size: 0.68em;
      font-weight: 600;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.08em;
      opacity: 0.75;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
      padding-top: 0.6em;
    }
    #settings-popover h5:first-of-type { border-top: none; padding-top: 0; }
    #settings-popover label {
      display: flex; align-items: center; gap: 0.55em;
      padding: 0.2em 0;
      cursor: pointer;
      color: var(--fg);
    }
    #settings-popover label:hover { color: var(--fg); }
    #settings-popover input[type="checkbox"] { accent-color: var(--accent); }
    #settings-popover .hint {
      color: var(--dim); font-size: 0.78em;
      margin-top: 0.4em; line-height: 1.3;
    }

    /* Who's-here list, anchored to the "N here" meta in the chat header. */
    #chat-meta[role="button"] { cursor: pointer; user-select: none; }
    #whos-caret { display: none; margin-left: 0.35em; font-size: 0.7em; vertical-align: middle; }
    #whos-caret.show { display: inline; }
    #whos-caret::before { content: "\25be"; } /* ▾ */
    #whos-here-popover {
      position: absolute; top: calc(100% + 6px); right: 0;
      background: var(--panel);
      border: 1px solid var(--panel-border);
      border-radius: 8px;
      padding: 0.6em 0.75em;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
      z-index: 50;
      min-width: 200px; max-width: 260px;
      font-size: 0.85em;
    }
    #whos-here-popover[hidden] { display: none; }
    #whos-here-popover h4 {
      margin: 0 0 0.5em 0;
      font-size: 0.78em;
      font-weight: 600;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }
    #whos-here-list { list-style: none; margin: 0; padding: 0; }
    #whos-here-list li {
      display: flex; justify-content: space-between; align-items: baseline;
      gap: 1em; padding: 0.3em 0; color: var(--fg);
    }
    #whos-here-list li .wh-nick { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    #whos-here-list li .wh-you { color: var(--muted); font-weight: 400; }
    #whos-here-list li .wh-time { color: var(--dim); font-variant-numeric: tabular-nums; flex: none; }
    #whos-here-list li.empty { color: var(--dim); justify-content: flex-start; }

    /* Live banner at the top of the chat panel. Mirrors audio panel status. */
    #chat-live-banner {
      padding: 0.55em 1.1em;
      border-bottom: 1px solid var(--panel-border);
      background: var(--panel-2);
      font-size: 0.85em;
      color: var(--muted);
      display: flex; align-items: center; justify-content: center; gap: 0.5em;
      min-height: 1.85em;
    }
    #chat-live-banner .live-dot {
      position: relative;
      display: inline-block; width: 8px; height: 8px; border-radius: 50%;
      background: var(--dim);
    }
    /* When live: a red broadcast dot with an expanding "on air" ring. */
    #chat-live-banner.state-live .live-dot {
      background: var(--live);
      box-shadow: 0 0 10px var(--live-glow);
      animation: liveDot 2s ease-in-out infinite;
    }
    #chat-live-banner.state-live .live-dot::after {
      content: ''; position: absolute; inset: 0; border-radius: 50%;
      background: var(--live);
      animation: livePing 1.8s ease-out infinite;
    }
    #chat-live-banner.state-live .live-text {
      color: var(--live);
      font-weight: 600;
      letter-spacing: 0.06em; text-transform: uppercase;
    }
    #chat-live-banner.state-error .live-dot { background: var(--error); }
    #chat-live-banner.state-error .live-text { color: var(--error); }
    @keyframes liveDot {
      0%, 100% { opacity: 1; }
      50%      { opacity: 0.8; }
    }
    @keyframes livePing {
      0%        { transform: scale(1);   opacity: 0.6; }
      70%, 100% { transform: scale(3.2); opacity: 0; }
    }

    /* EQ bars + set clock — only shown while actually streaming (.is-live).
       Bar heights are driven per-frame from the audio analyser in app.js, so
       the meter reflects the real spectrum; a short height transition just
       smooths between frames. */
    #chat-live-banner .live-extra { display: none; }
    #chat-live-banner.is-live .live-extra {
      display: inline-flex; align-items: center; gap: 0.55em;
    }
    #chat-live-banner .live-eq {
      display: inline-flex; align-items: flex-end; gap: 2px; height: 12px;
    }
    #chat-live-banner .live-eq i {
      width: 3px; height: 14%;
      background: var(--fg);
      transition: height 0.07s linear;
    }
    #chat-live-banner .live-timer {
      color: var(--muted); font-weight: 600;
      font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
    }
    @media (prefers-reduced-motion: reduce) {
      #chat-live-banner.state-live .live-dot { animation: none; }
      #chat-live-banner.state-live .live-dot::after { display: none; }
      /* EQ bars: JS skips the analyser loop under reduced motion and sets a
         flat height inline; no per-frame transition either. */
      #chat-live-banner .live-eq i { transition: none; }
    }

    #chat-messages {
      flex: 1 1 0;
      min-height: 0;           /* let the flex item shrink below content so overflow kicks in */
      overflow-y: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      padding: 0.85em 1.1em;
      display: flex; flex-direction: column; gap: 0.45em;
      font-size: 0.93em; line-height: 1.4;
    }
    @media (min-width: 901px) {
      #chat-messages { min-height: 260px; }
    }
    .msg {
      word-wrap: break-word; overflow-wrap: anywhere;
      transition: opacity 0.6s ease;
    }
    .msg.faded { opacity: 0.42; }
    .msg .body .emote {
      display: inline-block;
      height: 1.85em; width: auto;
      vertical-align: middle;
      margin: -0.2em 0.12em 0 0.12em;
      user-select: none;
      -webkit-user-drag: none;
    }
    .msg .ts {
      color: var(--dim); margin-right: 0.55em;
      font-size: 0.78em;
      font-variant-numeric: tabular-nums;
    }
    .msg .nick { margin-right: 0.4em; font-weight: 600; }
    .msg .body { color: var(--fg); }
    .msg.system .body { color: var(--muted); font-style: italic; }
    .msg.error .body { color: var(--error); }
    .msg.self .nick { font-weight: 700; }

    /* Set boundary: "──── Title ────" divider between DJ sets. */
    .session-divider {
      display: flex; align-items: center; gap: 0.7em;
      margin: 0.9em 0 0.5em;
      color: var(--muted);
      font-size: 0.78em; font-weight: 600;
      text-transform: uppercase; letter-spacing: 0.06em;
    }
    .session-divider::before, .session-divider::after {
      content: ""; flex: 1 1 auto; height: 1px;
      background: var(--panel-border);
    }
    .session-divider span { flex: 0 0 auto; }

    /* Mentions: generic tag style; .self highlights mentions of you. */
    .mention {
      color: var(--accent);
      font-weight: 600;
      padding: 0 2px;
      border-radius: 3px;
    }
    .mention.self {
      background: rgba(var(--accent-rgb), 0.18);
      color: var(--fg);
    }
    .msg.mention-self {
      background: rgba(var(--accent-rgb), 0.08);
      border-left: 2px solid var(--accent);
      padding-left: 6px;
      animation: mentionPing 1.2s ease-out;
    }
    @keyframes mentionPing {
      0%   { background: rgba(var(--accent-rgb), 0.35); }
      100% { background: rgba(var(--accent-rgb), 0.08); }
    }

    /* Autocomplete popover above the message input. */
    #mention-ac {
      position: absolute;
      bottom: calc(100% + 6px);
      left: 0;
      z-index: 25;
      background: var(--panel);
      border: 1px solid var(--panel-border);
      border-radius: 8px;
      padding: 4px;
      min-width: 160px;
      max-height: 200px;
      overflow-y: auto;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    #mention-ac[hidden] { display: none; }
    #mention-ac .ac-item {
      padding: 0.4em 0.6em;
      border-radius: 4px;
      cursor: pointer;
      font-size: 0.9em;
      color: var(--fg);
    }
    #mention-ac .ac-item.active,
    #mention-ac .ac-item:hover {
      background: var(--panel-2);
    }

    .chat-footer {
      border-top: 1px solid var(--panel-border);
      padding: 0.85em 1.1em;
    }
    #nickname-form, #message-form { display: flex; gap: 0.5em; position: relative; }
    #message-form { display: none; }
    #nickname-form.hidden, #message-form.hidden { display: none !important; }
    #message-form:not(.hidden) { display: flex; }

    /* ── Emote picker ────────────────────────────────────────────── */
    #emote-btn {
      background: var(--neutral-btn-bg);
      border: 1px solid var(--panel-border);
      color: var(--muted);
      border-radius: 6px;
      padding: 0 0.7em;
      cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    }
    #emote-btn:hover { background: var(--neutral-btn-bg-hover); color: var(--fg); border-color: #33333c; }
    #emote-btn.active { color: var(--fg); background: var(--neutral-btn-bg-hover); border-color: #33333c; }

    #emote-picker {
      position: absolute;
      bottom: calc(100% + 8px);
      right: 0;
      z-index: 20;
      background: var(--panel);
      border: 1px solid var(--panel-border);
      border-radius: 8px;
      padding: 0.5em;
      display: grid;
      grid-template-columns: repeat(6, 1fr);
      gap: 0.3em;
      width: 282px;
      max-height: 260px;
      overflow-y: auto;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    }
    #emote-picker[hidden] { display: none; }
    #emote-picker.empty {
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 1.4em 1em;
      font-size: 0.85em;
      color: var(--muted);
      line-height: 1.45;
    }
    #emote-picker button {
      all: unset;
      cursor: pointer;
      padding: 0.25em;
      border-radius: 4px;
      display: flex; align-items: center; justify-content: center;
      aspect-ratio: 1 / 1;
      transition: background 0.1s ease;
    }
    #emote-picker button:hover { background: var(--panel-2); }
    #emote-picker img {
      width: 32px; height: 32px;
      object-fit: contain;
      display: block;
    }

    /* ── Emote hover preview (singleton, fixed-positioned) ───────── */
    #emote-hover {
      position: fixed;
      z-index: 200;
      background: var(--panel);
      border: 1px solid var(--panel-border);
      border-radius: 8px;
      padding: 0.55em 0.65em 0.5em;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
      pointer-events: none;  /* don't intercept hover / block other elements */
      display: flex; flex-direction: column; align-items: center;
      gap: 0.4em;
      animation: emoteHoverIn 0.12s ease;
    }
    #emote-hover[hidden] { display: none; }
    #emote-hover img {
      width: 96px; height: 96px;
      object-fit: contain;
      display: block;
    }
    #emote-hover .name {
      font-size: 0.78em;
      color: var(--fg);
      font-weight: 500;
      max-width: 120px;
      word-break: break-all;
      text-align: center;
    }
    @keyframes emoteHoverIn {
      from { opacity: 0; transform: translateY(2px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .chat-footer input[type="text"] {
      flex: 1; background: var(--panel-2); color: var(--fg);
      border: 1px solid var(--panel-border); border-radius: 6px;
      padding: 0.55em 0.85em; font-family: var(--font-body); font-size: 0.95em;
    }
    .chat-footer input[type="text"]::placeholder { color: var(--dim); }
    .chat-footer input[type="text"]:focus {
      outline: none; border-color: #3a3a44;
      box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
    }
    .chat-footer button {
      background: var(--neutral-btn-bg); border: 1px solid var(--panel-border);
      color: var(--neutral-btn-fg);
      border-radius: 6px; padding: 0.55em 1.1em; cursor: pointer;
      font-size: 0.9em; font-weight: 500;
      transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    }
    .chat-footer button:hover { background: var(--neutral-btn-bg-hover); border-color: #33333c; color: var(--fg); }
    .chat-footer button:disabled { background: #1a1a1f; color: #5a5d66; border-color: var(--panel-border); cursor: default; }

    .nickname-line {
      margin-top: 0.7em;
      font-size: 0.82em;
      color: var(--muted);
    }
    .nickname-line .change {
      color: var(--neutral-btn-fg); cursor: pointer;
      text-decoration: underline; text-decoration-color: var(--dim);
      text-underline-offset: 3px;
    }
    .nickname-line .change:hover { text-decoration-color: var(--muted); color: var(--fg); }
    #logout-link[hidden], #login-link[hidden], #admin-link[hidden] { display: none; }
    #admin-link { text-decoration: underline; text-decoration-color: var(--dim); }
    /* Compact color swatch for signed-in users to pick their chat color. */
    #nick-color {
      width: 14px; height: 14px; padding: 0; margin-left: 0.4em;
      border: 1px solid var(--panel-border); border-radius: 4px;
      background: none; cursor: pointer; vertical-align: -0.15em;
    }
    #nick-color[hidden] { display: none; }
    #nick-color::-webkit-color-swatch-wrapper { padding: 0; }
    #nick-color::-webkit-color-swatch { border: none; border-radius: 3px; }
    /* Separate the links with · ; hidden ones (per auth state) show no separator. */
    #logout-link::before, #login-link::before, #admin-link::before { content: " · "; color: var(--dim); }

    /* Registered-account check — small, muted-accent, non-selectable. */
    .auth-badge {
      display: inline-flex; align-items: center;
      margin-right: 0.28em; color: var(--muted); vertical-align: -0.14em;
      cursor: default; user-select: none;
    }
    .auth-badge svg { width: 0.95em; height: 0.95em; }

    /* ── Welcome modal ───────────────────────────────────────────── */
    #welcome-modal {
      position: fixed; inset: 0;
      background: rgba(7, 7, 10, 0.92);
      backdrop-filter: blur(2px);
      display: flex; align-items: center; justify-content: center;
      z-index: 100;
    }
    #welcome-modal.hidden { display: none; }
    .welcome-content {
      background: var(--panel);
      border: 1px solid var(--panel-border);
      padding: 2.4em 2.4em 2.2em;
      border-radius: 12px;
      text-align: left;
      max-width: 380px; width: 90%;
      box-shadow: 0 20px 80px rgba(0,0,0,0.6);
    }
    .welcome-content h1 {
      margin: 0 0 0.35em 0;
      font-size: 1.7em; color: var(--fg);
      letter-spacing: -0.025em; font-weight: 600;
    }
    .welcome-content .welcome-sub {
      margin: 0 0 1.2em 0;
      font-size: 0.9em; color: var(--muted);
      font-weight: 400;
    }
    /* Guest / Log in / Sign up segmented control. */
    #welcome-tabs {
      display: flex; gap: 3px; margin: 0.2em 0 1.1em;
      background: var(--panel-2); border-radius: 8px; padding: 3px;
    }
    #welcome-tabs.hidden { display: none; }
    .welcome-tab {
      flex: 1; padding: 0.55em 0; border: none; background: transparent;
      color: var(--muted); font-family: var(--font-body); font-size: 0.9em;
      font-weight: 600; border-radius: 6px; cursor: pointer;
      transition: background 0.12s ease, color 0.12s ease;
    }
    .welcome-tab.is-active { background: var(--accent); color: #0a0a0a; }
    .welcome-tab:not(.is-active):hover { color: var(--fg); }
    #welcome-form { display: flex; flex-direction: column; gap: 0.6em; }
    #welcome-form input {
      background: var(--panel-2); color: var(--fg);
      border: 1px solid var(--panel-border); border-radius: 6px;
      padding: 0.7em 0.9em; font-family: var(--font-body); font-size: 1em;
    }
    #welcome-form input::placeholder { color: var(--dim); }
    #welcome-form input:focus {
      outline: none; border-color: #3a3a44;
      box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
    }
    .welcome-hint {
      color: var(--dim); font-size: 0.78em; line-height: 1.4;
      margin: -0.1em 0 0.1em;
    }
    .welcome-error {
      color: #ff6b6b; font-size: 0.85em; margin: 0;
    }
    .welcome-error[hidden] { display: none; }
    #welcome-form button {
      background: var(--accent); color: #0a0a0a;
      border: none; padding: 0.7em; border-radius: 6px; cursor: pointer;
      font-size: 0.95em; font-weight: 600;
      letter-spacing: -0.005em;
      transition: opacity 0.15s ease;
    }
    #welcome-form button:hover { opacity: 0.9; }
    #welcome-form button:disabled { background: #2a2d33; color: #5a5d66; cursor: default; }

    /* ── FPS meter (perf debugging) ─────────────────────────────────
       Fixed to the top-left corner, above everything, click-through so it
       never steals interaction. Colored by health: green ≥50, amber ≥30,
       red below. */
    #fps-meter {
      position: fixed; top: 6px; left: 6px; z-index: 2147483647;
      pointer-events: none; user-select: none;
      font: 600 12px/1.25 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      color: #4ade80; background: rgba(0, 0, 0, 0.62);
      padding: 3px 7px; border-radius: 5px;
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
      white-space: nowrap;
    }
    #fps-meter[hidden] { display: none; }
    #fps-meter.warn .fps-top { color: #ffd24a; }
    #fps-meter.bad  .fps-top { color: #ff6b6b; }
    #fps-detail { color: #9aa0a6; font-weight: 500; }
    /* Per-effect cost breakdown, priciest first. */
    #fps-fx {
      color: #c8ccd2; font-weight: 500;
      margin-top: 3px; white-space: pre; font-size: 11px; line-height: 1.35;
    }
    #fps-fx:empty { display: none; }

    /* ── FX debug panel (opt-in per-viewer effect override) ───────────── */
    #fx-debug {
      position: fixed; top: 6px; right: 6px; z-index: 2147483646;
      width: 240px; max-height: 82vh; overflow-y: auto;
      background: rgba(10, 10, 12, 0.92); border: 1px solid var(--panel-border);
      border-radius: 8px; padding: 10px; color: var(--fg);
      font-size: 12px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    }
    #fx-debug[hidden] { display: none; }
    #fx-debug .fxd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
    #fx-debug .fxd-title { font-weight: 600; font-size: 12px; }
    #fx-debug .fxd-head-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
    #fx-debug-reset, #fx-debug-close {
      background: var(--neutral-btn-bg); color: var(--neutral-btn-fg);
      border: 1px solid var(--panel-border); border-radius: 5px;
      padding: 3px 7px; font-size: 10.5px; cursor: pointer; line-height: 1;
    }
    #fx-debug-close { padding: 3px 6px; font-size: 12px; }
    #fx-debug-reset:hover, #fx-debug-close:hover { background: var(--neutral-btn-bg-hover); }
    #fx-debug .fxd-hint { color: var(--muted); font-size: 10.5px; line-height: 1.3; margin-bottom: 8px; }
    #fx-debug-grid { display: flex; flex-direction: column; gap: 4px; }
    .fxd {
      display: flex; align-items: center; justify-content: space-between; gap: 8px;
      text-align: left; padding: 5px 8px; border-radius: 5px; cursor: pointer;
      background: var(--panel); border: 1px solid var(--panel-border); color: var(--fg);
      font: inherit; font-size: 11.5px;
    }
    .fxd:hover { border-color: #33343d; }
    .fxd-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .fxd-state { font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--dim); flex: 0 0 auto; }
    .fxd[data-ov="on"]  { background: #123522; border-color: #4ade80; }
    .fxd[data-ov="on"]  .fxd-state { color: #4ade80; }
    .fxd[data-ov="off"] { background: #331416; border-color: #ff6b6b; }
    .fxd[data-ov="off"] .fxd-state { color: #ff6b6b; }

