/* ═══════════════════════════════════════════════════════════════════════════
   RIDESYNC
   Deep purple, moving. Two themes share one layout: every colour below is a
   token, and the only thing a theme does is redefine the tokens.

   The condensed type and the "a name and a time, nothing else" rows stay
   exactly as they were. Motion is transform/opacity only, so it stays cheap on
   a phone that's been playing music for three hours.
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

/* ── Theme tokens ────────────────────────────────────────────────────────── */

:root,
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0b0614;
  --bg-grad: linear-gradient(155deg, #0b0614 0%, #1b0b35 38%, #2e0f52 64%, #170a2c 100%);
  --blob-a: rgba(139, 92, 246, 0.55);
  --blob-b: rgba(217, 70, 239, 0.38);
  --blob-c: rgba(79, 70, 229, 0.5);

  --glass: rgba(14, 7, 28, 0.62);
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.09);
  --surface-solid: #170d2b;
  --input: rgba(255, 255, 255, 0.06);

  --text: #f4edff;
  --text-dim: #a797c6;
  --placeholder: rgba(244, 237, 255, 0.32);
  --line: rgba(196, 168, 255, 0.14);
  --line-strong: rgba(196, 168, 255, 0.34);

  --accent-a: #a855f7;
  --accent-b: #ec4899;
  --accent-c: #6366f1;
  --accent-soft: rgba(168, 85, 247, 0.2);
  --on-accent: #ffffff;
  --glow: 0 10px 34px -10px rgba(168, 85, 247, 0.75);
  --glow-strong: 0 0 0 1px rgba(233, 213, 255, 0.35), 0 14px 44px -8px rgba(192, 38, 211, 0.75);

  --now-bg: linear-gradient(90deg, rgba(168, 85, 247, 0.42), rgba(236, 72, 153, 0.3));
  --now-text: #ffffff;
  --played-bg: #2a2632;
  --played-text: #d9d3e4;

  --danger: #fb7185;
  --danger-grad: linear-gradient(135deg, #f43f5e, #be123c);
  --rail: rgba(255, 255, 255, 0.08);
  --scrim: rgba(4, 1, 10, 0.66);
  --toast: #22133d;
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f6f1ff;
  --bg-grad: linear-gradient(155deg, #fcfaff 0%, #efe4ff 42%, #fbe4f4 72%, #ece6ff 100%);
  --blob-a: rgba(167, 139, 250, 0.5);
  --blob-b: rgba(244, 114, 182, 0.34);
  --blob-c: rgba(129, 140, 248, 0.38);

  --glass: rgba(255, 255, 255, 0.66);
  --surface: rgba(255, 255, 255, 0.5);
  --surface-2: rgba(255, 255, 255, 0.78);
  --surface-solid: #fbf8ff;
  --input: rgba(255, 255, 255, 0.8);

  --text: #1d1030;
  --text-dim: #6c5a88;
  --placeholder: rgba(29, 16, 48, 0.32);
  --line: rgba(91, 33, 182, 0.13);
  --line-strong: rgba(91, 33, 182, 0.3);

  --accent-a: #7c3aed;
  --accent-b: #db2777;
  --accent-c: #4f46e5;
  --accent-soft: rgba(124, 58, 237, 0.12);
  --on-accent: #ffffff;
  --glow: 0 10px 30px -12px rgba(124, 58, 237, 0.6);
  --glow-strong: 0 0 0 1px rgba(124, 58, 237, 0.2), 0 14px 38px -10px rgba(192, 38, 211, 0.55);

  --now-bg: linear-gradient(90deg, #7c3aed, #c026d3);
  --now-text: #ffffff;
  --played-bg: #3b3843;
  --played-text: #ebe6f3;

  --danger: #e11d48;
  --danger-grad: linear-gradient(135deg, #f43f5e, #be123c);
  --rail: rgba(91, 33, 182, 0.1);
  --scrim: rgba(29, 12, 58, 0.42);
  --toast: #2a1747;
}

:root {
  --accent: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  --r: 16px;
  --r-sm: 11px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --display: 'Archivo', 'Arial Narrow', Impact, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabs-h: 64px;
  --dock-h: 150px; /* measured by the app: mini player + tabs + any notices */
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--display);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
body {
  background: transparent;
  /* An app, not a page: no text selection, no long-press menus, no double-tap zoom. */
  user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
input { user-select: text; -webkit-user-select: text; }
::selection { background: var(--accent-a); color: #fff; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, h3, p { margin: 0; }
ol, ul { list-style: none; margin: 0; padding: 0; }

/* Condensed display voice, used for everything that isn't a number. */
.slab, .now-title, .section-h, .tune-head h3, .tab, .btn, .sheet-btn,
.row-title, .listener-name, .empty b, .sheet-head b, .field, .confirm-panel h3 {
  font-family: var(--display);
  font-stretch: 62%;
  font-weight: 900;
  text-transform: uppercase;
}

/* ═══ LIVING BACKGROUND ════════════════════════════════════════════════════ */

.bg {
  position: fixed; inset: 0; z-index: -1;
  overflow: hidden;
  background: var(--bg-grad);
  contain: strict;
}

/* Soft colour fields drifting behind everything. Pre-softened gradients rather
   than blur filters: animating a transform on these costs almost nothing. */
.blobs {
  position: absolute; inset: 0;
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0);
  transition: transform 1.2s var(--ease);
}
.blob {
  position: absolute;
  width: 78vmax; height: 78vmax;
  border-radius: 50%;
  will-change: transform;
}
.b1 { left: -28vmax; top: -30vmax; background: radial-gradient(circle, var(--blob-a) 0%, transparent 62%); animation: drift-1 24s ease-in-out infinite alternate; }
.b2 { right: -32vmax; top: 18vh; background: radial-gradient(circle, var(--blob-b) 0%, transparent 60%); animation: drift-2 30s ease-in-out infinite alternate; }
.b3 { left: -10vmax; bottom: -40vmax; background: radial-gradient(circle, var(--blob-c) 0%, transparent 62%); animation: drift-3 34s ease-in-out infinite alternate; }
@keyframes drift-1 { to { transform: translate3d(22vmax, 18vmax, 0) scale(1.18); } }
@keyframes drift-2 { to { transform: translate3d(-24vmax, 14vmax, 0) scale(0.86); } }
@keyframes drift-3 { to { transform: translate3d(18vmax, -22vmax, 0) scale(1.12); } }

/* Slow light sweeping across, and a whisper of grain so the gradient never bands. */
.bg::after {
  content: '';
  position: absolute; inset: -50%;
  background:
    linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.05) 50%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E");
  animation: sweep 14s linear infinite;
  pointer-events: none;
}
@keyframes sweep { from { transform: translateX(-30%); } to { transform: translateX(30%); } }

/* A ring of light where you tap on empty background. */
.burst {
  position: absolute;
  width: 280px; height: 280px; margin: -140px 0 0 -140px;
  border-radius: 50%;
  border: 2px solid var(--accent-a);
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 65%);
  pointer-events: none;
  animation: burst 0.9s var(--ease) forwards;
}
@keyframes burst {
  from { transform: scale(0.1); opacity: 0.9; }
  to { transform: scale(1); opacity: 0; }
}

/* ═══ SHARED CONTROLS ══════════════════════════════════════════════════════ */

.btn, .slab, .tbtn, .vbtn, .tab, .barbtn, .theme-toggle, .sheet-btn, .toast-btn, .forget, .row-more {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* Every press leaves a ripple where the finger landed. */
.ripple {
  position: absolute; z-index: -1;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.28;
  transform: scale(0);
  pointer-events: none;
  animation: ripple 0.6s var(--ease) forwards;
}
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 0 18px;
  font-size: 22px; line-height: 1; letter-spacing: 0.01em;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: transform 0.18s var(--ease), box-shadow 0.25s var(--ease), background-color 0.25s, border-color 0.25s;
}
.btn:active, .slab:active, .tbtn:active, .vbtn:active, .barbtn:active, .theme-toggle:active { transform: scale(0.95); }
.btn:disabled, .slab:disabled { opacity: 0.4; pointer-events: none; }

.btn-primary {
  background: var(--accent); background-size: 180% 180%;
  color: var(--on-accent); border-color: transparent;
  box-shadow: var(--glow);
  animation: shimmer-bg 6s ease-in-out infinite alternate;
}
.btn-dark { background: var(--toast); color: #fff; border-color: transparent; }
.btn-danger { background: var(--danger-grad); color: #fff; border-color: transparent; box-shadow: 0 10px 28px -12px rgba(244, 63, 94, 0.8); }
.btn-ghost { background: transparent; }
.btn-tall { min-height: 62px; font-size: 28px; padding: 0 22px; }
@keyframes shimmer-bg { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }

@media (hover: hover) {
  .btn:hover, .tbtn:hover, .vbtn:hover, .barbtn:hover, .theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-strong);
    border-color: var(--accent-a);
  }
  .slab:hover { transform: translateY(-3px); box-shadow: var(--glow-strong); }
  .row-main:hover, .row-more:hover { background: var(--accent-soft); }
  .tab:not(.on):hover { color: var(--text); }
}

.wide { width: 100%; }
.grow { flex: 1; }
.gap-top { margin-top: 30px; }
.btnrow { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }

.err {
  font-family: var(--mono); font-size: 12px; font-weight: 800; text-transform: uppercase;
  background: var(--danger-grad); color: #fff; padding: 11px 14px; border-radius: var(--r-sm);
  animation: pop-in 0.35s var(--spring);
}

.section-h {
  font-size: 32px; line-height: 1;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 6px; margin: 26px 0 0;
}
.section-h-first { margin-top: 0; }

@keyframes pop-in { from { transform: scale(0.92); opacity: 0; } }
@keyframes rise-in { from { transform: translateY(14px); opacity: 0; } }

/* ── Theme switch, always in the top-right corner ────────────────────────── */

.theme-toggle {
  position: fixed; z-index: 40;
  top: calc(var(--safe-t) + 10px);
  right: max(12px, calc((100vw - 520px) / 2 + 12px));
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: var(--glass); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 14px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform 0.18s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s;
}
.theme-toggle svg {
  position: absolute; width: 22px; height: 22px; fill: currentColor;
  transition: transform 0.55s var(--spring), opacity 0.3s;
}
:root[data-theme='dark'] .theme-toggle .ic-sun { transform: rotate(-120deg) scale(0.4); opacity: 0; }
:root[data-theme='dark'] .theme-toggle .ic-moon { transform: none; opacity: 1; }
:root[data-theme='light'] .theme-toggle .ic-moon { transform: rotate(120deg) scale(0.4); opacity: 0; }
:root[data-theme='light'] .theme-toggle .ic-sun { transform: none; opacity: 1; }

/* The theme change itself sweeps out from the switch as a circle. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ═══ ROOMS (home) ═════════════════════════════════════════════════════════ */

.home {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 16px) 18px calc(var(--safe-b) + 40px);
  display: flex; flex-direction: column; gap: 18px;
}
.home > * { animation: rise-in 0.6s var(--ease) both; }
.home > *:nth-child(2) { animation-delay: 0.05s; }
.home > *:nth-child(3) { animation-delay: 0.1s; }
.home > *:nth-child(4) { animation-delay: 0.15s; }
.home > *:nth-child(5) { animation-delay: 0.2s; }
.home > *:nth-child(6) { animation-delay: 0.25s; }
.home > *:nth-child(7) { animation-delay: 0.3s; }

/* The energy bar at the top, where the theme switch doesn't sit. */
.hazard {
  height: 12px; margin: 17px 58px 0 0;
  border-radius: 999px;
  background: repeating-linear-gradient(-45deg, var(--accent-a) 0 12px, var(--accent-b) 12px 24px, var(--accent-c) 24px 36px);
  background-size: 51px 51px;
  box-shadow: var(--glow);
  animation: stripes 1.4s linear infinite, rise-in 0.6s var(--ease) both;
}
@keyframes stripes { to { background-position: 51px 0; } }

.wordmark {
  display: flex; flex-direction: column;
  font-family: var(--display); font-stretch: 62%; font-weight: 900;
  font-size: clamp(96px, 34vw, 172px);
  line-height: 0.8;
  letter-spacing: -0.02em;
  margin: 6px 0 4px;
}
.wm-a { color: var(--text); }
.wm-b {
  margin-left: 0.12em;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b), var(--accent-c), var(--accent-a));
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 26px rgba(168, 85, 247, 0.45));
  animation: shimmer-text 5s linear infinite;
}
@keyframes shimmer-text { to { background-position: 300% 0; } }

.field, .searchrow input {
  width: 100%;
  min-height: 62px;
  padding: 0 16px;
  font-size: 30px;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.25s, box-shadow 0.25s, background-color 0.25s;
}
.searchrow input { font-family: var(--display); font-stretch: 62%; font-weight: 900; text-transform: uppercase; }
.field::placeholder, .searchrow input::placeholder { color: var(--placeholder); }
.field:focus, .searchrow input:focus {
  border-color: var(--accent-a);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--glow);
}

.slab {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 96px; padding: 0 24px;
  font-size: clamp(44px, 14vw, 60px); line-height: 1;
  color: var(--on-accent);
  background: var(--accent); background-size: 200% 200%;
  border: 0; border-radius: 22px;
  box-shadow: var(--glow-strong);
  transition: transform 0.2s var(--ease), box-shadow 0.3s var(--ease);
  animation: shimmer-bg 5s ease-in-out infinite alternate, rise-in 0.6s var(--ease) both;
}
.slab b { font-size: 1.1em; display: inline-block; transition: transform 0.5s var(--spring); }
.slab:hover b { transform: rotate(90deg); }
/* A band of light crossing it every few seconds. */
.slab::after {
  content: '';
  position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-18deg);
  animation: glint 3.8s var(--ease) infinite;
}
@keyframes glint { 0%, 60% { left: -60%; } 100% { left: 130%; } }

.joinrow { display: flex; gap: 12px; }

.plate-field {
  flex: 1; min-width: 0; min-height: 62px;
  text-align: center;
  font-family: var(--mono); font-weight: 800; font-size: 32px;
  letter-spacing: 0.32em; text-indent: 0.32em; text-transform: uppercase;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.plate-field::placeholder { color: var(--placeholder); letter-spacing: 0.2em; }
.plate-field:focus { border-color: var(--accent-b); box-shadow: 0 0 0 4px var(--accent-soft), var(--glow); }

/* Install prompt, shown only where installing is possible. */
.install {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.install-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.install-text b {
  font-family: var(--display); font-stretch: 62%; font-weight: 900; font-size: 30px; line-height: 0.9;
  background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.install-text span { font-family: var(--mono); font-size: 11px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-dim); }
.install .btn { min-height: 44px; font-size: 20px; }

.rooms { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.rooms li {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 10px 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  cursor: pointer;
  transition: background-color 0.25s, transform 0.2s var(--ease);
  animation: rise-in 0.5s var(--ease) both;
}
.rooms li:nth-child(2) { animation-delay: 0.06s; }
.rooms li:nth-child(3) { animation-delay: 0.12s; }
.rooms li:nth-child(4) { animation-delay: 0.18s; }
.rooms li:nth-child(n + 5) { animation-delay: 0.24s; }
.rooms li:active { background: var(--accent-soft); transform: scale(0.99); }
@media (hover: hover) { .rooms li:hover { background: var(--accent-soft); } }
.rooms .room-meta {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-dim);
}
.rooms .room-live { display: block; color: var(--accent-b); margin-top: 3px; }
.rooms .room-live::before {
  content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%;
  background: var(--accent-b); vertical-align: 1px;
  animation: live-dot 1.4s ease-in-out infinite;
}
@keyframes live-dot { 50% { transform: scale(1.6); opacity: 0.4; } }
.forget {
  flex: none; width: 40px; height: 40px;
  display: grid; place-items: center;
  color: var(--text-dim);
  background: transparent; border: 1px solid var(--line-strong); border-radius: 12px;
  transition: color 0.2s, border-color 0.2s;
}
.forget svg { width: 14px; height: 14px; fill: currentColor; }
@media (hover: hover) { .forget:hover { color: var(--danger); border-color: var(--danger); } }

/* ── Room codes ──────────────────────────────────────────────────────────── */

.plate {
  position: relative; overflow: hidden;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  flex: none;
  color: var(--on-accent);
  background: var(--accent); background-size: 200% 200%;
  border: 0; border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), var(--glow);
  padding: 5px 12px 6px;
  line-height: 1;
  isolation: isolate;
  animation: shimmer-bg 7s ease-in-out infinite alternate;
}
.plate small { font-family: var(--mono); font-size: 8px; font-weight: 800; letter-spacing: 0.2em; opacity: 0.85; }
.plate b { font-family: var(--mono); font-weight: 800; font-size: 20px; letter-spacing: 0.16em; margin-right: -0.16em; }

.plate-xl {
  display: flex; width: 100%;
  padding: 16px 12px 18px;
  margin: 22px 0 18px;
  border-radius: 22px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3), var(--glow-strong);
}
.plate-xl::after {
  content: '';
  position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: skewX(-18deg);
  animation: glint 4.5s var(--ease) infinite;
}
.plate-xl small { font-size: 11px; }
.plate-xl b { font-size: clamp(52px, 17vw, 76px); letter-spacing: 0.12em; margin: 6px -0.12em 0 0; }

/* ═══ INSIDE A ROOM ════════════════════════════════════════════════════════ */

.room { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }

/* Header, ticker and player stay put; the tab content scrolls beneath them,
   blurred through the glass. */
.room-top {
  position: sticky; top: 0; z-index: 20;
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 18px 40px -26px rgba(0, 0, 0, 0.6);
}

.bar {
  display: flex; align-items: center; gap: 10px;
  /* Room on the right for the theme switch, which floats above this bar. */
  padding: calc(var(--safe-t) + 10px) 70px 8px 12px;
}
.barbtn {
  flex: none; width: 46px; height: 46px;
  display: grid; place-items: center;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 14px;
  transition: transform 0.18s var(--ease), box-shadow 0.25s, border-color 0.25s;
}
.barbtn svg { width: 24px; height: 24px; fill: currentColor; transition: transform 0.3s var(--spring); }
#backBtn:active svg { transform: translateX(-4px); }

.tag {
  font-family: var(--mono); font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
  padding: 7px 9px; line-height: 1; white-space: nowrap;
  background: var(--danger-grad); color: #fff; border-radius: 999px;
  animation: pop-in 0.4s var(--spring);
}

/* Who's in the room: a stack of initials. */
.faces {
  margin-left: auto;
  display: flex; align-items: center;
  background: none; border: 0; padding: 0;
}
.face {
  width: 36px; height: 36px; margin-left: -9px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 15px; font-weight: 800;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--line-strong); border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg);
  transition: transform 0.25s var(--spring);
}
.face:first-child { margin-left: 0; }
.face-you { color: #fff; background: var(--accent); border-color: transparent; }
.face-more { color: #fff; background: var(--toast); font-size: 12px; }
@media (hover: hover) { .faces:hover .face { transform: translateY(-2px); } }

.ticker {
  overflow: hidden; white-space: nowrap;
  color: #fff;
  background: var(--accent); background-size: 200% 100%;
  font-family: var(--mono); font-size: 12px; font-weight: 800; letter-spacing: 0.06em;
  height: 30px; display: flex; align-items: center;
  animation: shimmer-bg 3s linear infinite alternate;
}
.ticker-track { display: inline-block; padding-left: 100%; animation: marquee 9s linear forwards; }
.ticker-track b { background: rgba(0, 0, 0, 0.35); color: #fff; padding: 2px 7px; margin-right: 8px; border-radius: 6px; }
@keyframes marquee { to { transform: translateX(-100%); } }

/* ── Player ──────────────────────────────────────────────────────────────── */


.now-title {
  font-size: clamp(34px, 10.5vw, 48px);
  line-height: 0.88;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  animation: rise-in 0.5s var(--ease);
}

.scrub { position: relative; height: 22px; margin-top: 14px; }
.scrub-rail {
  position: absolute; inset: 0;
  background: var(--rail);
  border: 1px solid var(--line); border-radius: 999px;
  overflow: hidden;
}
.scrub-fill {
  position: absolute; top: 0; bottom: 0; left: 0; width: 0;
  background: var(--accent);
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(236, 72, 153, 0.55);
  overflow: hidden;
}
/* Light running along the bar while the music plays. */
.is-playing .scrub-fill::after {
  content: '';
  position: absolute; top: 0; bottom: 0; width: 60px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: run 1.8s linear infinite;
}
@keyframes run { from { left: -60px; } to { left: 100%; } }
.scrub-ticks { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(10, 1fr); pointer-events: none; }
.scrub-ticks i { border-right: 1px solid var(--line); height: 6px; align-self: end; }
.scrub input {
  position: absolute; inset: -12px 0; width: 100%; height: calc(100% + 24px);
  margin: 0; opacity: 0; cursor: pointer;
}
.scrub-times {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-family: var(--mono); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.transport { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 12px; margin-top: 12px; }
.tbtn {
  height: 64px;
  display: grid; place-items: center;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 18px;
  transition: transform 0.18s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s;
}
.tbtn svg { width: 26px; height: 26px; fill: currentColor; transition: transform 0.35s var(--spring); }
.tbtn:active svg { transform: scale(0.85); }
.tbtn-main {
  color: var(--on-accent);
  background: var(--accent); background-size: 200% 200%;
  border-color: transparent;
  box-shadow: var(--glow-strong);
  animation: shimmer-bg 4s ease-in-out infinite alternate;
}
.tbtn-main svg { width: 34px; height: 34px; }
/* A heartbeat of light around play while the music is going. */
.is-playing .tbtn-main { animation: shimmer-bg 4s ease-in-out infinite alternate, heartbeat 1.9s ease-out infinite; }
@keyframes heartbeat {
  0% { box-shadow: var(--glow-strong), 0 0 0 0 rgba(236, 72, 153, 0.6); }
  100% { box-shadow: var(--glow-strong), 0 0 0 20px rgba(236, 72, 153, 0); }
}
.tbtn:disabled { opacity: 0.4; }

/* Volume, this phone only: mute, and a bar you can drag. */
.volrow { display: grid; grid-template-columns: 50px 1fr; gap: 10px; margin-top: 12px; }
.vbtn {
  height: 44px;
  display: grid; place-items: center;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 14px;
  transition: transform 0.18s var(--ease), background-color 0.25s, box-shadow 0.25s;
}
.vbtn svg { width: 22px; height: 22px; fill: currentColor; }
.vbtn.is-muted { color: #fff; background: var(--danger-grad); border-color: transparent; animation: pop-in 0.35s var(--spring); }

.volbar {
  position: relative; height: 44px;
  background: var(--rail);
  border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden;
}
.volbar i {
  position: absolute; top: 0; bottom: 0; left: 0; width: 100%;
  background: linear-gradient(90deg, var(--accent-c), var(--accent-a), var(--accent-b));
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.45);
}
.volbar span {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--text);
  pointer-events: none;
}
.volbar input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.volbar.is-muted i { opacity: 0.2; }
.vol-hint {
  align-self: center;
  font-family: var(--mono); font-size: 11px; font-weight: 800; letter-spacing: 0.06em; color: var(--text-dim);
}

.alert {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 8px; padding: 6px 6px 6px 14px; min-height: 48px;
  color: #fff;
  background: var(--danger-grad);
  border-radius: var(--r);
  font-family: var(--mono); font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  animation: pop-in 0.4s var(--spring);
}
.alert .btn { min-height: 38px; font-size: 18px; }
.alert-ink { color: var(--text); background: var(--surface-2); border: 1px solid var(--accent-a); }

/* ── Panes ───────────────────────────────────────────────────────────────── */

.panes { padding: 18px var(--gutter) calc(var(--dock-h) + 28px); }
.pane { animation: rise-in 0.4s var(--ease); }

/* ── The dock: pinned to the bottom, like Spotify ─────────────────────────── */

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  max-width: 520px; margin: 0 auto;
  padding: 0 8px calc(var(--safe-b) + 6px);
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%);
  border-top: 1px solid var(--line-strong);
}

/* The minimal player: what's on, play/pause, next, and a hairline of progress. */
.mini {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0 4px; padding: 6px 6px 10px 6px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 14px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.25s;
}
.mini:active { transform: scale(0.985); }
@media (hover: hover) { .mini:hover { border-color: var(--accent-a); } }
.mini-art {
  flex: none; width: 44px; height: 44px;
  display: grid; place-items: center;
  color: #fff;
  background: var(--accent); background-size: 200% 200%;
  border-radius: 10px;
  box-shadow: var(--glow);
  animation: shimmer-bg 5s ease-in-out infinite alternate;
}
.mini-art .eq { width: 20px; height: 18px; }
.mini-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mini-text b {
  font-family: var(--display); font-stretch: 62%; font-weight: 900; text-transform: uppercase;
  font-size: 21px; line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-text small {
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-text small:empty { display: none; }
.mini-btn {
  position: relative; overflow: hidden; isolation: isolate;
  flex: none; width: 42px; height: 42px;
  display: grid; place-items: center;
  color: var(--text);
  background: transparent; border: 0; border-radius: 50%;
  transition: transform 0.18s var(--ease);
}
.mini-btn svg { width: 22px; height: 22px; fill: currentColor; }
.mini-btn:active { transform: scale(0.86); }
.mini-btn:disabled { opacity: 0.35; }
.mini-play { width: 44px; height: 44px; color: var(--on-accent); background: var(--accent); box-shadow: var(--glow); }
.mini-play svg { width: 20px; height: 20px; }
.is-playing .mini-play { animation: heartbeat 1.9s ease-out infinite; }
.mini-prev { display: none; }
@media (min-width: 420px) { .mini-prev { display: grid; } }
.mini-progress {
  position: absolute; left: 10px; right: 10px; bottom: 3px; height: 3px;
  background: var(--rail); border-radius: 999px; overflow: hidden;
}
.mini-progress i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; }

.tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding-top: 2px;
}
.tab {
  height: 50px;
  color: var(--text-dim);
  background: transparent;
  border: 0; border-radius: 14px;
  font-size: 24px; line-height: 1;
  transition: color 0.3s, transform 0.2s var(--ease);
}
.tab::before {
  content: '';
  position: absolute; inset: 0; z-index: -2;
  border-radius: inherit;
  background: var(--accent);
  box-shadow: var(--glow);
  opacity: 0; transform: scale(0.7);
  transition: opacity 0.3s var(--ease), transform 0.4s var(--spring);
}
.tab.on { color: var(--on-accent); }
.tab.on::before { opacity: 1; transform: none; }
.tab:active { transform: scale(0.95); }
.badge {
  position: absolute; top: 8px; right: 12px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-b);
  box-shadow: 0 0 0 2px var(--bg);
  animation: live-dot 1.6s ease-in-out infinite;
}

/* ── Rows: a name and a time, nothing else ───────────────────────────────── */

.rows { margin: 0; }
.row {
  display: flex; align-items: center; gap: 4px;
  min-height: 64px; padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.row-main {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 12px;
  align-self: stretch;
  padding: 4px 6px;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.row-main:active { background: var(--accent-soft); }
.row-title {
  flex: 1; min-width: 0;
  font-size: 26px; line-height: 0.92;
  overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.row-time {
  flex: none;
  font-family: var(--mono); font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

/* Drag from the grip only, so scrolling never moves a song by accident. */
.row-grip {
  flex: none; width: 34px; align-self: stretch;
  display: grid; place-items: center;
  color: var(--text-dim);
  touch-action: none; cursor: grab;
  transition: color 0.2s;
}
.row-grip svg { width: 18px; height: 18px; fill: currentColor; }
@media (hover: hover) { .row-grip:hover { color: var(--accent-a); } }
.row-grip-none { width: 34px; flex: none; }

.row-more {
  flex: none; width: 42px; align-self: stretch;
  display: grid; place-items: center;
  color: var(--text-dim);
  background: none; border: 0; border-radius: 12px;
}
.row-more svg { width: 20px; height: 20px; fill: currentColor; }
.row-more:active { background: var(--accent-soft); }

/* What's on right now: glowing, full-bleed, with a little equaliser. */
.row-now {
  position: relative;
  margin: 0 calc(var(--gutter) * -1);
  padding-left: var(--gutter); padding-right: calc(var(--gutter) - 4px);
  color: var(--now-text);
  background: var(--now-bg);
  border-bottom-color: transparent;
  box-shadow: inset 3px 0 0 var(--accent-b);
}
.row-now .row-time, .row-now .row-more, .row-now .row-grip { color: var(--now-text); opacity: 0.9; }
.row-now .row-main { cursor: default; }
.row-now .row-main:active, .row-now .row-more:active { background: transparent; }

.eq { flex: none; display: flex; align-items: flex-end; gap: 3px; width: 18px; height: 18px; }
.eq i { flex: 1; height: 30%; background: currentColor; border-radius: 2px; }
.is-playing .eq i { animation: eq 0.9s ease-in-out infinite alternate; }
.is-playing .eq i:nth-child(2) { animation-delay: -0.3s; animation-duration: 0.7s; }
.is-playing .eq i:nth-child(3) { animation-delay: -0.6s; animation-duration: 1.1s; }
@keyframes eq { 0% { height: 20%; } 100% { height: 100%; } }

/* Recently played: dark grey, sitting above the song that's on. */
.row-played {
  margin: 0 calc(var(--gutter) * -1);
  padding-left: var(--gutter); padding-right: calc(var(--gutter) - 4px);
  color: var(--played-text);
  background: var(--played-bg);
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
}
.row-played .row-time, .row-played .row-more { color: var(--played-text); opacity: 0.75; }
.row-played .row-main:active, .row-played .row-more:active { background: rgba(255, 255, 255, 0.08); }

/* In the library but not in the queue: the songs someone took out. */
.row-tag {
  flex: none;
  font-family: var(--mono); font-size: 10px; font-weight: 800; letter-spacing: 0.06em;
  padding: 4px 6px; line-height: 1; white-space: nowrap;
  color: var(--text-dim);
  border: 1px solid var(--line-strong); border-radius: 6px;
}
.row-now .row-tag { color: var(--now-text); border-color: rgba(255, 255, 255, 0.5); }
.lib-count {
  align-self: center; margin-left: auto;
  font-family: var(--mono); font-size: 12px; font-weight: 800; letter-spacing: 0.06em;
  color: var(--text-dim);
}

/* Not saved on this phone yet. */
.row-missing .row-title, .row-missing .row-time { opacity: 0.38; }

/* Section labels between the playing song, Up Next and the rest. */
.sec-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 16px 2px 6px;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--mono); font-size: 11px; font-weight: 800; letter-spacing: 0.14em;
  color: var(--text-dim);
}
.sec-head span:first-child {
  background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sec-head.is-empty, .drop-hint { display: none; }
.is-dragging .sec-head.is-empty { display: flex; }
.is-dragging .drop-hint {
  display: block; padding: 12px 6px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; color: var(--text-dim);
}

/* Dragging. */
.row-lifted {
  position: fixed; z-index: 45; margin: 0;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--accent-a); border-radius: var(--r);
  box-shadow: var(--glow-strong);
  transform: scale(1.03) rotate(-0.6deg);
  pointer-events: none;
}
.row-slot {
  list-style: none;
  border: 2px dashed var(--accent-a); border-radius: var(--r);
  background: var(--accent-soft);
  animation: slot-breathe 1.2s ease-in-out infinite alternate;
}
@keyframes slot-breathe { to { background: transparent; } }
.is-dragging .row-main { cursor: grabbing; }

.spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid var(--accent-a); border-right-color: transparent;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  padding: 22px;
  border: 2px dashed var(--line-strong); border-radius: 20px;
  background: var(--surface);
}
.empty b {
  font-size: 56px; line-height: 0.85;
  background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.filebtn { cursor: pointer; }

.meter { margin: 0 0 16px; animation: rise-in 0.3s var(--ease); }
.meter-row {
  display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim);
}
.meter-rail { height: 10px; background: var(--rail); border-radius: 999px; overflow: hidden; }
.meter-rail i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.3s var(--ease); }

.searchrow { display: flex; gap: 12px; margin-bottom: 16px; }
.searchrow input { flex: 1; min-width: 0; }
.searchrow input[type='search']::-webkit-search-cancel-button { display: none; }

.hint {
  font-family: var(--mono); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-dim);
  margin: -4px 0 14px;
}
.hint-red { color: var(--danger); }

/* ── Tune ────────────────────────────────────────────────────────────────── */

.tune-head {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 5px; margin: 26px 0 8px;
}
.tune-head:first-child { margin-top: 0; }
.tune-head h3 { font-size: 32px; line-height: 1; }
.readout { font-family: var(--mono); font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; color: var(--accent-b); }

.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 44px; margin: 4px 0 10px; background: transparent;
}
.slider::-webkit-slider-runnable-track { height: 10px; background: var(--rail); border: 1px solid var(--line); border-radius: 999px; }
.slider::-moz-range-track { height: 10px; background: var(--rail); border-radius: 999px; }
.slider::-moz-range-progress { height: 10px; background: var(--accent); border-radius: 999px; }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; margin-top: -10px;
  background: var(--accent); border: 3px solid #fff; border-radius: 50%;
  box-shadow: var(--glow-strong);
  transition: transform 0.25s var(--spring);
}
.slider:active::-webkit-slider-thumb { transform: scale(1.25); }
.slider::-moz-range-thumb { width: 24px; height: 24px; background: var(--accent-a); border: 3px solid #fff; border-radius: 50%; }

.toggle { display: flex; align-items: center; gap: 14px; padding: 10px 0; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-box {
  flex: none; position: relative; width: 58px; height: 32px;
  background: var(--rail); border: 1px solid var(--line-strong); border-radius: 999px;
  transition: background-color 0.3s, box-shadow 0.3s;
}
.toggle-box::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: left 0.35s var(--spring);
}
.toggle input:checked + .toggle-box { background: var(--accent); border-color: transparent; box-shadow: var(--glow); }
.toggle input:checked + .toggle-box::after { left: 29px; }
.toggle input:focus-visible + .toggle-box { outline: 3px solid var(--accent-b); outline-offset: 2px; }
.toggle-text { font-family: var(--mono); font-size: 14px; font-weight: 800; letter-spacing: 0.04em; }

/* ═══ FULL PLAYER ══════════════════════════════════════════════════════════ */

.player-sheet { position: fixed; inset: 0; z-index: 55; background: var(--bg); }
.player-panel {
  position: absolute; inset: 0;
  max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 12px) 22px calc(var(--safe-b) + 26px);
  background: var(--bg-grad);
  overflow-y: auto;
  animation: player-up 0.5s var(--spring);
  touch-action: pan-y;
}
@keyframes player-up { from { transform: translateY(100%); } }
.player-sheet.is-closing { background: transparent; }
.player-sheet.is-closing .player-panel { animation: player-down 0.28s var(--ease) forwards; }
@keyframes player-down { to { transform: translateY(100%); } }

.player-top { display: flex; align-items: center; gap: 12px; flex: none; }
.player-label {
  flex: 1; text-align: center; margin-right: 46px;
  font-family: var(--mono); font-size: 11px; font-weight: 800; letter-spacing: 0.22em; color: var(--text-dim);
}

.player-art {
  position: relative; overflow: hidden; flex: none;
  width: min(100%, 42vh, 340px); aspect-ratio: 1;
  margin: auto auto 24px;
  display: grid; place-items: center;
  color: #fff;
  background: var(--accent); background-size: 220% 220%;
  border-radius: 28px;
  box-shadow: var(--glow-strong);
  animation: shimmer-bg 6s ease-in-out infinite alternate;
}
.player-art::after {
  content: '';
  position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-18deg);
  animation: glint 5s var(--ease) infinite;
}
.eq-big { width: 36%; height: 30%; gap: 8px; }
.eq-big i { border-radius: 6px; }
.is-playing .eq-big i:nth-child(4) { animation-delay: -0.45s; animation-duration: 0.8s; }
.is-playing .eq-big i:nth-child(5) { animation-delay: -0.15s; animation-duration: 1s; }

.player-panel .now-title { font-size: clamp(36px, 11vw, 54px); flex: none; }
.now-sub {
  margin-top: 6px;
  font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.now-sub:empty { display: none; }
.player-panel .scrub { margin-top: 22px; flex: none; }
.player-panel .transport { margin-top: 18px; flex: none; }
.player-panel .tbtn { height: 72px; }
.player-panel .volrow { margin: 16px 0 auto; flex: none; }

/* ═══ SHEETS, SIDE PANEL, CONFIRM ══════════════════════════════════════════ */

.sheet, .drawer, .confirm { position: fixed; inset: 0; z-index: 50; }
.sheet-scrim, .drawer-scrim, .confirm-scrim {
  position: absolute; inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.3s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } }

.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 520px; margin: 0 auto;
  max-height: 90vh; overflow-y: auto;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong); border-bottom: 0;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -20px 60px -20px rgba(168, 85, 247, 0.45);
  padding: 10px 16px calc(var(--safe-b) + 12px);
  animation: sheet-up 0.45s var(--spring);
}
.sheet-panel::before {
  content: ''; display: block; width: 44px; height: 5px; margin: 0 auto 12px;
  border-radius: 999px; background: var(--line-strong);
}
@keyframes sheet-up { from { transform: translateY(100%); } }

.sheet-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding-bottom: 12px;
}
.sheet-head b {
  font-size: 34px; line-height: 0.9; min-width: 0;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sheet-head span { flex: none; font-family: var(--mono); font-size: 15px; font-weight: 800; color: var(--text-dim); }

.sheet-btn {
  display: block; width: 100%; text-align: left;
  padding: 15px 10px; font-size: 32px; line-height: 1;
  color: var(--text);
  background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0;
  transition: background-color 0.2s, padding-left 0.25s var(--ease), color 0.2s;
}
.sheet-panel .sheet-btn { animation: rise-in 0.4s var(--ease) both; }
.sheet-panel .sheet-btn:nth-of-type(2) { animation-delay: 0.04s; }
.sheet-panel .sheet-btn:nth-of-type(3) { animation-delay: 0.08s; }
.sheet-panel .sheet-btn:nth-of-type(4) { animation-delay: 0.12s; }
.sheet-panel .sheet-btn:nth-of-type(5) { animation-delay: 0.16s; }
.sheet-btn:active { background: var(--accent-soft); }
@media (hover: hover) { .sheet-btn:hover { background: var(--accent-soft); padding-left: 18px; } }
.sheet-btn:disabled { opacity: 0.28; }
.sheet-danger { color: var(--danger); }
.sheet-cancel { color: var(--text-dim); }

.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(88vw, 380px);
  overflow-y: auto;
  background: var(--surface-solid);
  border-left: 1px solid var(--line-strong);
  border-radius: 26px 0 0 26px;
  box-shadow: -20px 0 60px -20px rgba(168, 85, 247, 0.45);
  padding: calc(var(--safe-t) + 14px) 16px calc(var(--safe-b) + 20px);
  animation: drawer-in 0.45s var(--spring);
}
@keyframes drawer-in { from { transform: translateX(100%); } }
.drawer-head { display: flex; align-items: flex-end; gap: 12px; }
.drawer-head .section-h { flex: 1; }
.barbtn-light { color: var(--text); background: var(--surface-2); }

.listeners { margin-bottom: 8px; }
.listener {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.listener-name { flex: 1; min-width: 0; font-size: 30px; line-height: 0.9; overflow-wrap: anywhere; }
.listener-away .listener-name { color: var(--text-dim); }
.listener-you {
  font-family: var(--mono); font-size: 11px; font-weight: 800; letter-spacing: 0.08em;
  color: #fff; background: var(--toast); padding: 4px 7px; border-radius: 6px;
}
.status {
  flex: none;
  font-family: var(--mono); font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
  padding: 6px 9px; line-height: 1; white-space: nowrap;
  border: 1px solid var(--line-strong); border-radius: 999px;
}
.st-on { color: #fff; background: var(--accent); border-color: transparent; box-shadow: var(--glow); }
.st-on::before {
  content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%;
  background: #fff; vertical-align: 1px; animation: live-dot 1.4s ease-in-out infinite;
}
.st-muted { color: #fff; background: var(--danger-grad); border-color: transparent; }
.st-idle { color: var(--text); background: var(--surface-2); }
.st-lost { color: var(--danger); background: transparent; border-color: var(--danger); }
.status-sub {
  width: 100%;
  font-family: var(--mono); font-size: 11px; font-weight: 800; letter-spacing: 0.04em; color: var(--text-dim);
}

/* Are-you-sure: centred, and nothing like a browser's own dialog. */
.confirm { display: grid; place-items: center; padding: 24px; }
.confirm-panel {
  position: relative; width: min(100%, 400px);
  padding: 24px 20px 20px;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong); border-radius: 26px;
  box-shadow: var(--glow-strong);
  animation: dialog-in 0.45s var(--spring);
}
@keyframes dialog-in { from { transform: scale(0.85) translateY(20px); opacity: 0; } }
.confirm-icon {
  width: 56px; height: 56px; margin-bottom: 14px;
  display: grid; place-items: center;
  color: #fff; background: var(--danger-grad);
  border-radius: 18px;
  box-shadow: 0 10px 30px -10px rgba(244, 63, 94, 0.8);
  animation: wobble 0.6s var(--spring) 0.15s both;
}
.confirm-icon svg { width: 28px; height: 28px; fill: currentColor; }
@keyframes wobble { 0% { transform: rotate(-14deg) scale(0.6); } 100% { transform: none; } }
.confirm-panel h3 { font-size: 36px; line-height: 0.92; }
.confirm-panel p {
  margin: 8px 0 20px;
  font-family: var(--mono); font-size: 13px; font-weight: 700; line-height: 1.45;
  color: var(--text-dim);
  overflow-wrap: anywhere;
}
.confirm-panel .btnrow { margin: 0; }

/* ═══ TOAST ════════════════════════════════════════════════════════════════ */

.toast {
  position: fixed; left: 12px; right: 12px; z-index: 60;
  bottom: calc(var(--dock-h) + 12px);
  max-width: 496px; margin: 0 auto;
  color: #fff;
  background: var(--toast);
  border: 1px solid rgba(233, 213, 255, 0.25); border-radius: var(--r);
  box-shadow: var(--glow-strong);
  padding: 10px 10px 10px 16px;
  font-family: var(--mono); font-size: 13px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  display: flex; align-items: center; gap: 12px;
  animation: toast-in 0.45s var(--spring);
}
@keyframes toast-in { from { transform: translateY(30px) scale(0.95); opacity: 0; } }
.toast:not([hidden]) { display: flex; }
#toastText { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-btn {
  flex: none; min-height: 42px; padding: 0 16px;
  font-family: var(--display); font-stretch: 62%; font-weight: 900; font-size: 22px;
  color: #fff; background: var(--accent);
  border: 0; border-radius: 12px;
}
body:not(.in-room) .toast { bottom: calc(var(--safe-b) + 18px); }

/* ═══ WIDE SCREENS ═════════════════════════════════════════════════════════ */

@media (min-width: 560px) {
  .room { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .dock { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .ticker-track { padding-left: 12px; }
}
