/* SyncWave — brand colours from the logo (cyan → electric blue → violet → magenta). No external fonts so it works on offline LANs. */
:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #eceef8;
  --surface-3: #e0e3f2;
  --text: #141633;
  --muted: #5f6487;
  --line: #d8dbec;
  --accent: #5b3df5;
  --accent-ink: #ffffff;
  --accent-soft: #e8e4ff;
  --brand-grad: linear-gradient(100deg, #1f8fff 0%, #5b3df5 50%, #c026d3 100%);
  --good: #1a8a59;
  --warn: #a96500;
  --bad: #c23a2b;
  --shadow: 0 1px 2px rgb(20 22 51 / .06), 0 8px 24px rgb(20 22 51 / .07);
  --r: 14px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
/* Auto follows the device; Day / Night force a scheme (Android: Auto / Day / Night). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070a1a; --surface: #0f1328; --surface-2: #161b36; --surface-3: #20264a; --text: #e9ebff; --muted: #8f95b8;
    --line: #252b4d; --accent: #8f7cff; --accent-ink: #0a0623; --accent-soft: #221c4a; --good: #3ddc97; --warn: #f0b04a; --bad: #ff6b5a;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 30px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}
:root[data-theme="light"] {
  --bg: #f4f5fb; --surface: #ffffff; --surface-2: #eceef8; --surface-3: #e0e3f2; --text: #141633; --muted: #5f6487;
  --line: #d8dbec; --accent: #5b3df5; --accent-ink: #ffffff; --accent-soft: #e8e4ff; --good: #1a8a59; --warn: #a96500; --bad: #c23a2b;
  --shadow: 0 1px 2px rgb(20 22 51 / .06), 0 8px 24px rgb(20 22 51 / .07);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #070a1a; --surface: #0f1328; --surface-2: #161b36; --surface-3: #20264a; --text: #e9ebff; --muted: #8f95b8;
  --line: #252b4d; --accent: #8f7cff; --accent-ink: #0a0623; --accent-soft: #221c4a; --good: #3ddc97; --warn: #f0b04a; --bad: #ff6b5a;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 30px rgb(0 0 0 / .35);
  color-scheme: dark;
}
.theme-btn {
  width: 36px; height: 36px; flex: none;
}
.theme-btn svg { width: 20px; height: 20px; fill: currentColor; display: block; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 550; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand-grad); color: #fff; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px;
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }

input[type="text"], input[type="url"], input[type="search"], input[type="number"], input:not([type]), select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); outline: none;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="number"] { font-family: var(--mono); }
.field { display: grid; gap: 6px; margin: 0 0 12px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 550; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--surface-3) var(--p, 0%)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--surface-3); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--text); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 3px solid var(--surface); }
input[type="range"]:disabled { cursor: default; }
input[type="range"]:disabled::-webkit-slider-thumb { visibility: hidden; }
input[type="range"]:disabled::-moz-range-thumb { visibility: hidden; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.chip.code { font-family: var(--mono); letter-spacing: .06em; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); font: 12.5px var(--mono); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.good::before { background: var(--good); }
.pill.warn::before { background: var(--warn); }
.pill.bad::before { background: var(--bad); }
.pill.host { font-family: inherit; font-weight: 650; background: var(--accent-soft); color: var(--accent); }
.pill.host::before { background: var(--accent); }
.badge { display: inline-block; font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; }
.badge:empty { display: none; }
.badge.is-yt { color: #e2453c; border-color: color-mix(in srgb, #e2453c 40%, var(--line)); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; }
.brand svg, .brand img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.room-title { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; flex: 1; }
.room-title h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.room-title .code { margin-top: 1px; }
.top-right { display: flex; gap: 8px; align-items: center; }
@media (max-width: 640px) {
  .brand span { display: none; }
  .topbar { gap: 10px; padding-left: 12px; padding-right: 12px; }
  .room-title .code { display: inline-flex; }
}

/* ---------- room: one screen, no page scroll ---------- */
html:has(body.room) { height: 100%; overflow: hidden; }
body.room {
  height: 100vh; height: 100dvh; overflow: hidden; overscroll-behavior: none;
  display: grid; grid-template-rows: auto minmax(0, 1fr);
}
.share-btn { gap: 6px; }
@media (max-width: 640px) { .share-btn span { display: none; } .share-btn { padding: 0 9px; } }

.shell { display: grid; grid-template-columns: 88px minmax(0, 1fr); min-height: 0; }

/* side navigation */
.sidenav {
  display: flex; flex-direction: column; gap: 4px; padding: 12px 8px; min-height: 0;
  border-right: 1px solid var(--line); overflow-y: auto; scrollbar-width: none;
}
.sidenav::-webkit-scrollbar { display: none; }
.nav-btn {
  display: grid; justify-items: center; gap: 4px; padding: 8px 2px; border: 0; border-radius: 14px;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 11.5px; font-weight: 600;
}
.nav-btn:hover { color: var(--text); background: var(--surface-2); }
.nav-ico { position: relative; display: grid; place-items: center; width: 52px; height: 32px; border-radius: 16px; transition: background .15s; }
.nav-btn[aria-pressed="true"] { color: var(--text); }
.nav-btn[aria-pressed="true"] .nav-ico { background: var(--accent-soft); color: var(--accent); }
.nav-lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-btn .count {
  position: absolute; top: -3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font: 600 10.5px/18px var(--mono); text-align: center;
}

/* the player canvas */
.canvas { min-height: 0; display: grid; place-items: center; padding: 16px 20px; overflow: hidden; }
.player { width: min(620px, 100%); max-height: 100%; display: grid; gap: 6px; }
.np-art {
  position: relative; aspect-ratio: 16 / 10; border-radius: 20px; overflow: hidden; background: var(--surface-2);
  width: min(100%, calc((100dvh - 360px) * 1.6)); min-width: min(100%, 220px); justify-self: center; box-shadow: var(--shadow);
}
.art-gen { position: absolute; inset: 0; display: grid; place-items: center; }
.art-gen .initials { font: 700 clamp(36px, 7vh, 64px)/1 system-ui, sans-serif; color: rgb(255 255 255 / .92); letter-spacing: -.02em; text-shadow: 0 2px 20px rgb(0 0 0 / .2); }
.art-gen svg.wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 45%; opacity: .35; }
/* YouTube inside the cover: a small (lowest-quality) player scaled up over the thumbnail */
.art-gen.yt-thumb { background-size: cover; background-position: center; }
.art-gen.yt-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgb(0 0 0 / .35), transparent 45%); }
.yt { position: absolute; inset: 0; overflow: hidden; }
.yt-stage {
  position: absolute; left: 50%; top: 50%; width: 256px; height: 144px; transform: translate(-50%, -50%);
  background: #000; opacity: 0; transition: opacity .35s; pointer-events: none;
}
.yt.live .yt-stage { opacity: 1; }
.yt-stage iframe { display: block; width: 100%; height: 100%; border: 0; }
.yt-shield { position: absolute; inset: 0; border: 0; padding: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.yt-tap {
  display: none; padding: 10px 16px; border-radius: 999px; font-weight: 650; font-size: 14px;
  color: #fff; background: rgb(0 0 0 / .65); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.yt.blocked .yt-tap { display: inline-flex; }
/* Background / locked screen: keep YouTube playing but hide the tiny embed under the cover art */
.yt.bg-audio .yt-stage { opacity: 0; pointer-events: none; }
.yt.bg-audio .yt-shield { display: none; }
.yt.yt-audio-only { pointer-events: none; }
.action-countdown {
  margin: 0 0 10px; padding: 8px 12px; border-radius: 12px; text-align: center; font-weight: 700; font-size: 14px;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}

/* video files: a muted picture synced to the room clock (sound comes from the audio engine) */
.vid { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity .3s; }
.vid.has-video { opacity: 1; }
.vid video { width: 100%; height: 100%; object-fit: contain; display: block; }

/* full-screen button on the cover (only for YouTube and video files) */
.np-fs {
  position: absolute; right: 10px; bottom: 10px; z-index: 3; width: 38px; height: 38px; border: 0; border-radius: 50%;
  display: none; place-items: center; cursor: pointer; color: #fff;
  background: rgb(0 0 0 / .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.np-fs:hover { background: rgb(0 0 0 / .75); }
.np-fs svg { width: 22px; height: 22px; fill: currentColor; }
.np-fs .fs-close, .is-fs .np-fs .fs-open { display: none; }
.is-fs .np-fs .fs-close { display: block; }
.np-art:has(> .yt:not([hidden])) .np-fs, .np-art:has(> .vid.has-video:not([hidden])) .np-fs { display: grid; }

/* full-screen player: the picture fills the screen, the room's controls float over it */
.player.is-fs {
  --text: #fff; --muted: rgb(255 255 255 / .72); --surface-2: rgb(255 255 255 / .16); --surface-3: rgb(255 255 255 / .25);
  position: fixed; inset: 0; z-index: 300; width: 100%; height: 100%; max-height: none; margin: 0; background: #000; color: var(--text);
  grid-template-rows: minmax(0, 1fr) auto auto auto auto; gap: 4px; align-content: stretch;
  padding: 0 max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.player.is-fs > .np-art {
  grid-row: 1 / -1; grid-column: 1; justify-self: stretch; align-self: stretch; position: relative; width: auto; height: auto; min-width: 0; margin: 0 calc(-1 * max(16px, env(safe-area-inset-left)))
    calc(-1 * max(14px, env(safe-area-inset-bottom))); aspect-ratio: auto; border-radius: 0; box-shadow: none; background: #000;
}
.player.is-fs > .np-art::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 45%; z-index: 2; pointer-events: none;
  background: linear-gradient(transparent, rgb(0 0 0 / .78)); transition: opacity .3s;
}
.player.is-fs > :not(.np-art) { grid-column: 1; z-index: 4; transition: opacity .3s; }
.player.is-fs > .np-meta { grid-row: 2; margin: 0; }
.player.is-fs > .progress { grid-row: 3; width: min(900px, 100%); justify-self: center; }
.player.is-fs > .transport { grid-row: 4; }
.player.is-fs > .listener-note { grid-row: 5; }
.player.is-fs .np-fs { top: max(12px, env(safe-area-inset-top)); bottom: auto; right: max(12px, env(safe-area-inset-right)); }
.player.is-fs .ctl.big { background: #fff; color: #000; }
.player.is-fs .badge { color: #fff; border-color: rgb(255 255 255 / .4); }
.player.is-fs .art-gen .initials { display: none; }
.player.is-fs.idle { cursor: none; }
.player.is-fs.idle > :not(.np-art), .player.is-fs.idle .np-fs, .player.is-fs.idle > .np-art::after { opacity: 0; pointer-events: none; }
body.player-fs { overflow: hidden; }

.np-meta { margin: 12px 2px 2px; display: grid; gap: 4px; justify-items: center; text-align: center; min-width: 0; }
.np-meta h2 { font-size: clamp(18px, 3vh, 24px); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-meta p { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress { margin: 4px 0 0; }
.times { display: flex; justify-content: space-between; gap: 8px; font: 12px var(--mono); color: var(--muted); }
.times #np-status { font-family: inherit; text-align: center; }

.transport { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 4px 0 0; }
.ctl { width: 48px; height: 48px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--text); }
.ctl:hover { background: var(--surface-2); }
.ctl svg { width: 26px; height: 26px; fill: currentColor; }
.ctl.big { width: 66px; height: 66px; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
.ctl.big:hover { background: var(--accent); filter: brightness(1.07); }
.ctl.big svg { width: 32px; height: 32px; }
.ctl:disabled { opacity: .35; cursor: default; }
.listener-note { text-align: center; font-size: 13px; margin: 6px 0 0; }

/* phones in portrait: the side nav becomes a bottom bar */
@media (max-width: 720px) and (orientation: portrait) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .sidenav {
    grid-row: 2; flex-direction: row; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line); overflow: hidden;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
  }
  .nav-btn { flex: 1 1 0; min-width: 0; padding: 4px 0; font-size: 10px; gap: 2px; }
  .nav-ico { width: min(48px, 100%); height: 30px; }
  .nav-btn .count { right: -2px; }
  .canvas { padding: 12px 14px; }
  .np-art { width: min(100%, calc((100dvh - 420px) * 1.6)); border-radius: 16px; }
}
@media (max-height: 560px) { .listener-note { display: none; } .np-meta { margin-top: 6px; } .np-meta p { display: none; } }

/* device settings */
.kv { display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: center; font-size: 13px; }
.kv > label { color: var(--muted); }
.dev.solo { gap: 14px; }
.devices, .dev, .dev-grid > *, .kv > * { min-width: 0; }

.delay-ctl { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; }
.delay-ctl input[type="number"] { width: 100%; min-height: 32px; padding: 4px 8px; text-align: right; }
.stepper { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stepper button { border: 0; background: var(--surface); min-width: 34px; height: 30px; cursor: pointer; font: 12px var(--mono); }
.stepper button + button { border-left: 1px solid var(--line); }
.stepper button:hover { background: var(--surface-2); }

/* ---------- menu modals (blurred overlay cards) ---------- */
.overlay.modal-wrap { place-items: stretch; padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.modal {
  width: 100%; height: 100%; min-width: 0; display: flex; flex-direction: column; min-height: 0;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: 22px;
  box-shadow: 0 24px 80px rgb(0 0 0 / .35); animation: modal-in .22s cubic-bezier(.2, 0, 0, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 12px 22px; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.modal-head h2 { font-size: 18px; }
.modal-head .icon-btn { width: 38px; height: 38px; border-radius: 50%; }
.modal-body { padding: 18px 22px 22px; overflow-y: auto; overscroll-behavior: contain; min-height: 120px; }
@media (max-width: 720px) {
  .overlay.modal-wrap { padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); }
  .modal { border-radius: 18px; }
  .modal-body { padding: 14px 16px 18px; }
}

/* one-box add */
.add-opts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.smart {
  display: grid; gap: 8px; padding: 10px; border-radius: 16px; border: 1.5px dashed var(--line);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent); transition: border-color .15s, background .15s;
}
.smart.over, body.dragging .smart { border-color: var(--accent); background: var(--accent-soft); }
.smart-row { display: flex; gap: 6px; align-items: center; }
.smart-row input { flex: 1; min-width: 0; border-color: transparent; background: var(--surface); }
.smart-ico { display: grid; place-items: center; width: 30px; color: var(--muted); flex: none; }
.smart-ico svg { fill: currentColor; }
.smart-row label.icon-btn { width: 40px; height: 40px; flex: none; }
.smart-row label.icon-btn svg { width: 20px; height: 20px; }
.smart-hint { padding: 0 4px; }
@media (max-width: 480px) { .smart-ico { display: none; } }
.drop-hint {
  position: fixed; inset: 12px; z-index: 70; display: none; place-items: center; border: 2px dashed var(--accent); border-radius: 24px;
  background: color-mix(in srgb, var(--bg) 55%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-weight: 650; font-size: 18px; color: var(--accent); pointer-events: none;
}
body.dragging:not(.modal-open) .drop-hint { display: grid; }

/* share: compact session card + optional QR / invite details */
.modal-body[data-view="share"] { overflow: auto; display: grid; place-items: start center; padding-top: 12px; }
.share {
  display: flex; flex-direction: column; align-items: stretch; gap: 14px;
  width: min(100%, 420px); max-height: 100%; min-height: 0;
}
.share-card {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #1a1040));
  color: #fff; border-radius: 16px; padding: 12px 14px; cursor: pointer;
  box-shadow: var(--shadow);
}
.share-card-top { display: flex; align-items: center; gap: 8px; }
.share-card-names { flex: 1; min-width: 0; }
.share-card .share-name { color: #fff; font-size: 16px; font-weight: 700; }
.share-card .share-code {
  border: 0; background: none; padding: 0; cursor: copy; color: rgb(255 255 255 / .9);
  font: 600 13px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase;
}
.share-card .badge { background: rgb(255 255 255 / .2); color: #fff; border: 0; }
.share-chev { font-size: 14px; opacity: .85; flex: none; }
.share-hint { margin: 8px 0 0; color: rgb(255 255 255 / .7) !important; }
.share-qr {
  width: clamp(140px, min(64vw, 280px), 300px); aspect-ratio: 1; padding: 8px; margin: 0 auto;
  background: #fff; border-radius: 18px; box-shadow: var(--shadow);
}
.share-qr svg { width: 100%; height: 100%; display: block; }
.share-info { display: grid; gap: 8px; min-width: 0; justify-items: center; text-align: center; }
.share-name { font-size: 15px; font-weight: 650; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.share-code {
  border: 0; background: none; padding: 0; cursor: copy; color: var(--accent);
  font: 700 clamp(28px, 5vh, 40px)/1.05 var(--mono); letter-spacing: .14em; text-transform: uppercase;
}
.share-link {
  border: 0; background: none; padding: 0; cursor: copy; text-align: center; font-size: 12.5px; color: var(--muted);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.share-link:hover, .share-code:hover { text-decoration: underline; }
.share-lan button { font-size: 12px; padding: 4px 9px; }
.share-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.share-actions:first-of-type { margin-top: 6px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h3 { font-size: 15px; }
.empty { padding: 36px 12px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.item {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px 8px; border-radius: 10px;
}
.item:hover { background: var(--surface-2); }
.item.current { background: var(--accent-soft); }
.item.past { opacity: .55; }
.item .idx { font: 12px var(--mono); color: var(--muted); text-align: center; }
.item.current .idx { color: var(--accent); }
.item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; }
.item .acts { display: flex; gap: 2px; opacity: .85; }
@media (hover: hover) { .item .acts { opacity: 0; } .item:hover .acts, .item:focus-within .acts { opacity: 1; } }
.status-dl { color: var(--warn); }
.status-err { color: var(--bad); }
.spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.list-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* add / sources */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 10px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .1); }
.src-tabs { margin-bottom: 14px; }
.dropzone {
  display: grid; place-items: center; gap: 6px; text-align: center; padding: 28px 16px; border-radius: 14px;
  border: 1.5px dashed var(--line); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 30px; height: 30px; fill: var(--muted); }
.uploads { display: grid; gap: 6px; margin-top: 10px; }
.upl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; }
.upl .bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.upl .bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.note { font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.note.warn { color: var(--text); background: color-mix(in srgb, var(--warn) 14%, var(--surface)); }
.results { margin-top: 12px; }
.results .item { grid-template-columns: minmax(0, 1fr) auto; }

/* suggestions */
.vote { display: inline-flex; flex-direction: column; align-items: center; gap: 0; min-width: 36px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; font: 12px var(--mono); }
.vote svg { width: 14px; height: 14px; fill: currentColor; }
.vote.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.sug { grid-template-columns: auto minmax(0, 1fr) auto; }
.sug .noteline { font-size: 13px; color: var(--text); font-style: italic; white-space: normal; }

/* speakers: toolbar + room map that fills the modal */
.modal-body[data-view="speakers"] { display: flex; flex-direction: column; }
.spk { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.spk-tools { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }
.tool {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600; font-size: 13.5px;
}
.tool:hover { background: var(--surface-2); }
.tool svg { color: var(--accent); flex: none; }
.tool b { font-family: var(--mono); color: var(--accent); }
.tool[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.tool-note { font-size: 13px; color: var(--muted); margin-right: 4px; }
@media (max-width: 640px) { .tool { padding: 0 11px; height: 36px; font-size: 12.5px; } .tool span { white-space: nowrap; } }
.spk-note { margin: 0; text-align: center; }
.spk-hint { text-align: center; }

.spk-map {
  position: relative; flex: 1; min-height: 380px; border-radius: 20px; overflow: hidden;
  background: radial-gradient(circle at 50% 52%, color-mix(in srgb, var(--accent) 7%, var(--surface-2)), var(--surface-2) 70%);
}
@media (max-width: 640px) { .spk-map { min-height: 520px; } }
.map-front {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); font-size: 11px; font-weight: 650;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.map-mix { position: absolute; left: 14px; bottom: 10px; font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.map-area { position: absolute; inset: 52px 80px 112px; }
@media (max-width: 640px) { .map-area { inset: 48px 46px 96px; } }
.map-ring {
  position: absolute; left: 10%; right: 10%; top: 2%; bottom: 2%; border: 1.5px dashed var(--line); border-radius: 50%; pointer-events: none;
}
.map-you { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 4px; }
.you-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 6px color-mix(in srgb, var(--muted) 18%, transparent); }

.node, .slot {
  position: absolute; transform: translate(-50%, -26px); width: 118px; display: grid; justify-items: center; gap: 1px;
  text-align: center; border: 0; background: none; padding: 0; color: var(--text); font: inherit;
}
button.node { cursor: pointer; }
.node-ico {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 4px;
  background: var(--accent); color: var(--accent-ink); font: 700 13px var(--mono); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
button.node:hover .node-ico, button.node:focus-visible .node-ico { transform: scale(1.08); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.node.self .node-ico { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 3px; }
.node.offline { opacity: .5; }
.node.offline .node-ico { background: var(--surface-3); color: var(--muted); }
.slot .node-ico { background: transparent; color: var(--muted); border: 2px dashed var(--line); box-shadow: none; }
.node-name { font-weight: 650; font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-det { font-size: 11px; line-height: 1.3; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-det.good { color: var(--good); }
.node-det.warn { color: var(--warn); }
.node-det.bad { color: var(--bad); }
@media (max-width: 640px) {
  .node, .slot { width: 60px; transform: translate(-50%, -17px); }
  .node-ico { width: 34px; height: 34px; font-size: 10.5px; margin-bottom: 2px; }
  .node-name { font-size: 11px; }
  .node-det { font-size: 9.5px; }
  .node-role { display: none; } /* the icon already shows the channel */
}

/* second-level modal (opened from Speakers): smaller card above the full-screen one */
.overlay.sub-wrap { z-index: 52; place-items: center; padding: clamp(10px, 5vw, 64px); }
.sub-wrap .modal { width: min(880px, 100%); height: auto; max-height: 100%; }
.layout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.layout-opt {
  display: grid; gap: 4px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; text-align: left; color: var(--text);
}
.layout-opt b { font: 700 20px var(--mono); }
.layout-opt span { font: 11px var(--mono); color: var(--muted); }
.layout-opt:hover { background: var(--surface-2); }
.layout-opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.layout-opt[aria-pressed="true"] b { color: var(--accent); }
.guide { margin: 0; padding-left: 22px; display: grid; gap: 12px; font-size: 14.5px; line-height: 1.5; }
.guide b { color: var(--text); }
.devices { display: grid; gap: 10px; }
.dev { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; }
.dev.self { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.dev.offline { opacity: .6; }
.dev .head, .dev-head { display: flex; align-items: center; gap: 8px; }
.dev-head {
  width: 100%; border: 0; background: none; padding: 0; margin: 0; cursor: pointer;
  color: inherit; text-align: left; font: inherit;
}
.dev .name, .dev-head .name { font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-chev { color: var(--muted); flex: none; font-size: 13px; }
.dev-level { display: flex; align-items: center; gap: 8px; }
.dev-level .num { font: 11.5px var(--mono); color: var(--muted); min-width: 2.6em; }
.dev-meter { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.dev-meter i { display: block; height: 100%; border-radius: 999px; background: var(--good, #3ecf8e); }
.dev-meter i.boost { background: var(--accent); }
.dev-meter i.off { background: var(--muted); }
.dev-hint { margin: 0; }
.dev-more { display: grid; gap: 10px; padding-top: 4px; }
.dev-more .head-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.stats { font: 11.5px var(--mono); color: var(--muted); display: flex; gap: 4px 12px; flex-wrap: wrap; }
.stats b { color: var(--text); font-weight: 500; }
.sync-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.sync-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sync-table th, .sync-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sync-table th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.sync-table tr:last-child td { border-bottom: 0; }
.sync-table .num { font-variant-numeric: tabular-nums; font-family: var(--mono); white-space: nowrap; }
.sync-st { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface2); color: var(--muted); }
.sync-st.ok { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good); }
.sync-st.drift { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.sync-st.syncing { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.sync-st.offline { opacity: 0.7; }
.dev-grid { display: grid; grid-template-columns: minmax(150px, 200px) minmax(0, 1fr) 120px; gap: 10px; align-items: center; }
@media (max-width: 680px) { .dev-grid { grid-template-columns: 1fr; } }
.mini { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; margin-bottom: 2px; }

/* history */
.day { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; margin: 14px 8px 4px; }
.day:first-child { margin-top: 0; }
.item .when { font: 12px var(--mono); color: var(--muted); }
.hist { grid-template-columns: 52px minmax(0, 1fr) auto; }

/* overlay */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg) 45%, transparent); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2); animation: fade-in .18s ease; }
@keyframes fade-in { from { opacity: 0; } }
#join { z-index: 55; }
.join-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 26px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.join-card h2 { font-size: 22px; }
.join-mark { width: 56px; height: 56px; border-radius: 14px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); z-index: 60; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); color: #fff; }

body.flash { animation: flash .35s ease 3; }
@keyframes flash { 50% { background: var(--accent); } }

/* ---------- home page ---------- */
/* first screen: two buttons (the sheets hold the rest); below it, the page about the app */
html:has(body.home-page) { scroll-behavior: smooth; }
/* the start page is always the dark neon look of the logo */
body.home-page {
  --bg: #050818; --surface: #0f1328; --surface-2: #161b36; --surface-3: #20264a; --text: #eef0ff; --muted: #9aa0c4;
  --line: #262c50; --accent: #8f7cff; --accent-ink: #0a0623; --accent-soft: #221c4a;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 30px rgb(0 0 0 / .35);
  color-scheme: dark;
  min-height: 100vh; min-height: 100dvh;
  /* the glow lives on its own fixed layer (below): a fixed body background with the blurred top bar
     made Chrome paint the page blank once it was scrolled */
  background: var(--bg);
}
body.home-page::before {
  content: ""; position: fixed; inset: -12%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(48vmax 36vmax at 18% 22%, rgb(34 211 238 / .13), transparent 62%),
    radial-gradient(44vmax 36vmax at 82% 30%, rgb(217 70 239 / .14), transparent 62%),
    radial-gradient(56vmax 40vmax at 50% 100%, rgb(91 61 245 / .22), transparent 62%);
  animation: aurora 28s ease-in-out infinite alternate;
}
@keyframes aurora { 0% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(2%, -2%, 0) scale(1.05); } 100% { transform: translate3d(-2%, 1.5%, 0) scale(1.02); } }
body.home-page .topbar { position: sticky; top: 0; background: rgb(5 8 24 / .7); border-bottom-color: transparent; }
body.home-page .overlay { background: rgb(5 8 24 / .55); }
.grow-x { flex: 1; }
.guide-btn svg { width: 20px; height: 20px; fill: currentColor; }
.home {
  min-height: calc(100dvh - 58px); position: relative; display: grid; place-content: center; justify-items: center; text-align: center;
  gap: clamp(20px, 5vh, 44px); padding: 8px 16px max(20px, env(safe-area-inset-bottom));
}
.home-hero { display: grid; justify-items: center; gap: clamp(6px, 1.6vh, 14px); }
.home-mark {
  width: clamp(84px, 20vh, 150px); height: auto; aspect-ratio: 1; border-radius: 24%;
  box-shadow: 0 0 60px rgb(91 61 245 / .45), 0 0 120px rgb(217 70 239 / .18);
}
.home-word { width: min(300px, 74vw); height: auto; max-height: 9vh; object-fit: contain; margin-top: 4px; }
.home-tag { font-size: 12px; letter-spacing: .42em; text-transform: uppercase; color: #c3c8ec; margin-right: -.42em; }
.home-hero p { font-size: 15px; max-width: 32ch; }
.home-actions { display: grid; gap: 12px; width: min(340px, 100%); }
.home-features {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
  width: min(720px, 100%); margin-top: 8px;
}
.home-features .tv-card {
  min-width: 140px; flex: 1 1 140px; max-width: 200px; padding: 16px 14px;
  text-decoration: none; color: inherit; border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); display: grid; gap: 6px; justify-items: center; text-align: center;
  cursor: pointer; font: inherit;
}
.home-features .tv-card-ico { font-size: 28px; }
.home-features .tv-card strong { font-size: 16px; }
.btn.big { min-height: 56px; font-size: 17px; border-radius: 16px; width: 100%; }
.home-actions .btn.primary { box-shadow: 0 8px 30px rgb(91 61 245 / .45); }
.home-actions .btn:not(.primary) { background: rgb(255 255 255 / .06); border-color: rgb(255 255 255 / .16); }
.home-actions .btn:not(.primary):hover { background: rgb(255 255 255 / .1); }
@media (max-height: 560px) { .home-hero p { display: none; } }
@media (max-height: 440px) { .home-mark { display: none; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); display: grid; gap: 12px; align-content: start; }
.card h2 { font-size: 17px; }
.overlay[data-sheet] { grid-template-columns: minmax(0, 1fr); justify-items: center; } /* lets the sheet use % widths */
.sheet {
  width: min(440px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 24px 80px rgb(0 0 0 / .3); animation: modal-in .22s cubic-bezier(.2, 0, 0, 1);
}
.sheet .field { margin: 0 0 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -6px -8px 0 0; }
.sheet-head h2 { font-size: 19px; }
.sheet-head .icon-btn { width: 38px; height: 38px; border-radius: 50%; }
.sessions { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.sessions h3 { font-size: 13px; color: var(--muted); font-weight: 600; }
.sess { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; text-decoration: none; color: inherit; border: 1px solid var(--line); background: var(--surface); text-align: left; }
.sess + .sess { margin-top: 8px; }
.sess:hover { border-color: var(--accent); }

/* guide: one step at a time */
.guide { width: min(520px, 100%); height: min(480px, 100%); display: flex; flex-direction: column; overflow: hidden; }
.g-count { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 6px; }
.g-steps { flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y; }
.g-step { display: grid; gap: 10px; align-content: start; animation: fade-in .2s ease; }
.g-icon { width: 56px; height: 56px; display: grid; place-items: center; font-size: 28px; border-radius: 16px; background: var(--accent-soft); }
.g-step h3 { font-size: 18px; }
.g-step p { color: var(--muted); font-size: 15px; line-height: 1.55; }
.g-step b { color: var(--text); font-weight: 650; }
.g-foot { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.g-foot .btn { min-width: 92px; }
.g-dots { flex: 1; display: flex; justify-content: center; gap: 6px; }
.g-dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--line); transition: width .2s, background .2s; }
.g-dots i.on { width: 18px; background: var(--accent); }
@media (max-width: 380px) { /* small phones: the step count in the title is enough */
  .g-dots { display: none; }
  .g-foot .btn { min-width: 0; flex: 1; }
  .guide { padding: 16px; }
}

/* calibration */
.cal { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0 0 18px; display: grid; gap: 12px; background: var(--surface-2); }
.cal-head { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.cal-head > div { flex: 1; min-width: 220px; display: grid; gap: 4px; }
.cal-head h3 { font-size: 15px; }
.cal-head p { font-size: 13.5px; }
.cal .note { margin: 0; }
.meter { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.cal-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cal-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 4px 6px; }
.cal-table td { padding: 7px 6px; border-top: 1px solid var(--line); }
.cal-table td:first-child { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- nav + menu windows (stage) ---------- */
/* never wider than the screen: a long session name used to stretch the whole page */
body.room { grid-template-columns: minmax(0, 1fr); }
.topbar, .shell, .stage, .canvas { min-width: 0; }
.top-right { flex: none; }
@media (max-width: 480px) { #host-badge { display: none !important; } .room-title h1 { font-size: 15px; } }

/* menu windows cover the player only, so the side nav stays visible and usable */
.stage { position: relative; display: grid; min-height: 0; }
.stage > .canvas { grid-area: 1 / 1; }
/* Full-bleed menu: flush under the top bar and above the nav (no floating card) */
.stage > .overlay.modal-wrap { position: absolute; inset: 0; z-index: 20; padding: 0; overflow: hidden; background: var(--bg); }
.stage > .overlay.sub-wrap { z-index: 21; padding: 0; background: var(--bg); }
.stage > .overlay.modal-wrap .modal,
.stage > .overlay.sub-wrap .modal {
  width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; box-shadow: none;
}
@media (max-width: 720px) {
  .stage > .overlay.modal-wrap { padding: 0; }
  .stage > .overlay.sub-wrap { padding: 0; }
}
.sub-wrap .modal-body { padding-bottom: 22px; }

.modal-head { padding: 10px 10px 10px 16px; gap: 4px; }
.modal-heading { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; padding: 0 6px; }
.modal-heading h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-step { font: 12px var(--mono); color: var(--muted); flex: none; }
.sub-wrap .modal-head { padding-left: 22px; }

/* swipe between menu windows */
#modal .modal { touch-action: pan-y; will-change: transform; }
#modal .modal.dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; transition: none !important; }

/* selected menu: filled icon pill + an indicator bar beside it */
.nav-btn { position: relative; }
.nav-btn[aria-pressed="true"] { color: var(--accent); }
.nav-btn[aria-pressed="true"] .nav-ico { background: var(--accent); color: var(--accent-ink); }
.nav-btn[aria-pressed="true"] .nav-lbl { font-weight: 750; }
.nav-btn[aria-pressed="true"]::before {
  content: ""; position: absolute; left: -8px; top: 12px; width: 4px; height: 24px; border-radius: 0 4px 4px 0; background: var(--accent);
}
@media (max-width: 720px) and (min-height: 461px) {
  .nav-btn[aria-pressed="true"]::before { left: 50%; top: -6px; width: 28px; height: 3px; border-radius: 0 0 3px 3px; transform: translateX(-50%); }
}
.more-btn[aria-expanded="true"] .nav-ico { background: var(--surface-3); color: var(--text); }

/* "More": a drop-up of small floating buttons above the More button */
.more-menu { position: fixed; z-index: 40; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.more-menu.right { align-items: flex-end; }
.more-menu::before {
  content: ""; position: fixed; inset: 0; z-index: -1; background: color-mix(in srgb, var(--bg) 55%, transparent);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade-in .15s ease;
}
.mini-fab {
  display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; cursor: pointer; color: var(--text);
  transform-origin: 50% 100%; animation: drop-up .26s calc(var(--i) * 45ms) cubic-bezier(.2, .9, .3, 1.25) both;
}
.more-menu:not(.right) .mini-fab { flex-direction: row-reverse; }
@keyframes drop-up { from { opacity: 0; transform: translateY(calc(18px + var(--i) * 14px)) scale(.4); } }
.more-menu.closing::before { animation: fade-out .16s ease both; }
.more-menu.closing .mini-fab { animation: drop-down .15s ease-in both; }
@keyframes drop-down { to { opacity: 0; transform: translateY(16px) scale(.6); } }
@keyframes fade-out { to { opacity: 0; } }
.mf-ico {
  width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; flex: none;
  background: var(--surface); color: var(--accent); border: 1px solid var(--line); box-shadow: 0 6px 18px rgb(0 0 0 / .25);
}
.mf-lbl {
  padding: 7px 12px; border-radius: 10px; font-weight: 650; font-size: 13.5px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 4px 14px rgb(0 0 0 / .18);
}
.mini-fab:hover .mf-ico, .mini-fab:focus-visible .mf-ico { background: var(--accent-soft); }
.mini-fab[aria-pressed="true"] .mf-ico { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.mini-fab[aria-pressed="true"] .mf-lbl { color: var(--accent); }

/* ---------- nav groups + centre Player button ---------- */
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.player-btn { margin: 6px 0; position: relative; z-index: 50; }
.player-btn .nav-ico {
  width: 54px; height: 54px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
}
.player-btn:hover .nav-ico { filter: brightness(1.07); }
.player-btn[aria-pressed="true"] .nav-ico { box-shadow: 0 0 0 4px var(--accent-soft), 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent); }
.player-btn[aria-pressed="true"]::before { display: none; }
.eq-anim { display: flex; align-items: flex-end; gap: 3px; height: 20px; }
.eq-anim i { width: 4px; border-radius: 2px; background: currentColor; animation: eq 0.9s ease-in-out infinite; }
.eq-anim i:nth-child(2) { animation-delay: -.3s; }
.eq-anim i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 6px; } 50% { height: 20px; } }
@media (max-width: 720px) and (min-height: 461px) {
  .sidenav { overflow: visible; align-items: stretch; }
  .nav-group { flex: 1 1 0; min-width: 0; flex-direction: row; gap: 0; }
  .nav-group .nav-btn { flex: 1 1 0; }
  .player-btn { flex: 0 0 74px; margin: 0; }
  .player-btn .nav-ico { width: 58px; height: 58px; margin-top: -24px; border: 4px solid var(--bg); }
}

/* speaker tools sit in the window's footer */
#modal .modal-body { flex: 1 1 auto; min-height: 0; } /* footer stays at the bottom of the window */
.modal-foot {
  flex: none; display: grid; gap: 6px; padding: 8px 10px; margin: 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--surface) 92%, transparent); border-radius: 0 0 22px 22px;
}
.modal-foot > *, .modal-foot form, .modal-foot .field { margin: 0; }
.foot-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.foot-row .grow { flex: 1; min-width: 0; }
.modal-foot .add-opts { margin: 0; }
.modal-foot .smart { padding: 4px; border-radius: 14px; gap: 0; }
.foot-note { min-height: 36px; padding: 6px 12px; font-size: 13.5px; }
.share-foot { justify-content: center; }
.add-intro { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 28px 12px; color: var(--text); }
.add-intro svg { fill: var(--accent); opacity: .85; }
.add-intro p { max-width: 46ch; }
@media (max-width: 720px) {
  .modal-foot { padding: 6px; border-radius: 0 0 18px 18px; }
  .modal-foot .seg button { padding: 5px 9px; }
  .spk-map { min-height: 400px; }
}

/* after a reload the page rejoins by itself; sound starts with the first tap */
.sound-hint {
  position: fixed; left: 50%; top: 62px; transform: translateX(-50%); z-index: 45; border: 0; cursor: pointer;
  padding: 9px 16px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: 13.5px;
  box-shadow: 0 6px 20px rgb(0 0 0 / .25); animation: hint-pulse 1.6s ease-in-out infinite;
}
@keyframes hint-pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 22%, transparent), 0 6px 20px rgb(0 0 0 / .25); } }

/* ---------- footer buttons: equal width, one row, the same in every window ---------- */
.foot-actions { display: flex; gap: 6px; }
.fbtn {
  flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 42px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: 600 13.5px/1.1 inherit; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.fbtn span { overflow: hidden; text-overflow: ellipsis; }
.fbtn svg { color: var(--accent); flex: none; }
.fbtn b { font-family: var(--mono); color: var(--accent); }
.fbtn:hover { background: var(--surface-2); }
.fbtn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.fbtn.primary svg { color: currentColor; }
.fbtn.primary:hover { filter: brightness(1.06); }
.fbtn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.foot-actions.apps .fbtn { height: 34px; font-size: 12.5px; color: var(--muted); }
.foot-actions .tool-note { flex: 2 1 0; align-self: center; font-size: 12px; color: var(--muted); }
@media (max-width: 720px) {
  .foot-actions { gap: 4px; }
  .fbtn { flex-direction: column; gap: 3px; height: auto; min-height: 50px; padding: 6px 2px; font-size: 11px; border-radius: 12px; }
  .fbtn b { display: none; }
  .foot-actions.apps .fbtn { min-height: 0; height: 32px; flex-direction: row; font-size: 11.5px; }
}

/* ---------- host: request cards on any screen ---------- */
.req-pop {
  position: fixed; z-index: 48; top: 60px; right: 12px; width: min(380px, calc(100vw - 24px));
  display: grid; gap: 8px; pointer-events: none;
}
.req-card, .req-more { pointer-events: auto; }
.req-card {
  display: grid; gap: 6px; padding: 12px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 12px 34px rgb(0 0 0 / .3); animation: req-in .28s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes req-in { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
.req-head { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.req-head svg { color: var(--accent); }
.req-head b { color: var(--text); }
.req-head .icon-btn { margin-left: auto; width: 28px; height: 28px; }
.req-head .icon-btn svg { width: 16px; height: 16px; }
.req-title { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-sub { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; overflow: hidden; white-space: nowrap; }
.req-card .fbtn { height: 36px; min-height: 0; flex-direction: row; font-size: 12.5px; }
.req-more { justify-self: end; border: 0; border-radius: 999px; padding: 6px 12px; background: var(--accent); color: var(--accent-ink); font-weight: 650; cursor: pointer; }

/* ---------- device cards fit their window ---------- */
.dev { min-width: 0; max-width: 100%; }
.dev .head { flex-wrap: wrap; row-gap: 6px; }
.dev .head .name { flex: 1 1 120px; }
.dev-grid > div { min-width: 0; }
.delay-ctl { grid-template-columns: auto minmax(0, 1fr) auto; }
.delay-ctl input[type="number"] { min-width: 0; width: 100%; }
.dev input[type="range"] { width: 100%; min-width: 0; margin: 0; padding: 0 8px; box-sizing: border-box; }
.dev .stats { min-width: 0; overflow-wrap: anywhere; }
.sub-wrap .modal { max-width: 100%; min-width: 0; }
.sub-wrap .modal-body { overflow-x: hidden; }

/* ---------- queue: drag to reorder ---------- */
.item.draggable { grid-template-columns: 30px 26px minmax(0, 1fr) auto; }
.drag-handle {
  width: 30px; height: 40px; display: grid; place-items: center; border: 0; background: none; padding: 0;
  color: var(--muted); cursor: grab; touch-action: none; border-radius: 8px;
}
.drag-handle svg { width: 20px; height: 20px; fill: currentColor; }
.drag-handle:hover, .drag-handle:focus-visible { color: var(--accent); background: var(--surface-2); }
.item.dragging {
  cursor: grabbing; background: var(--surface); border-radius: 12px; box-shadow: 0 14px 34px rgb(0 0 0 / .3);
  outline: 2px solid var(--accent); transform: scale(1.02); opacity: .97; pointer-events: none;
}
.item.dragging .acts { opacity: 1; }
.drop-slot { border: 2px dashed color-mix(in srgb, var(--accent) 60%, var(--line)); border-radius: 12px; background: var(--accent-soft); }

/* ---------- search results with preview ---------- */
.res-tip { margin: 0 2px 6px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.res-tip svg { fill: var(--accent); }
.results .item.res { grid-template-columns: 52px minmax(0, 1fr) auto; }
.pv-btn {
  width: 46px; height: 46px; border-radius: 12px; border: 0; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--accent-soft) center / cover no-repeat; color: var(--accent); position: relative; overflow: hidden;
}
.pv-btn svg { width: 22px; height: 22px; fill: currentColor; position: relative; }
.pv-btn.art { color: #fff; }
.pv-btn.art::before { content: ""; position: absolute; inset: 0; background: rgb(0 0 0 / .35); transition: background .15s; }
.pv-btn:hover::before { background: rgb(0 0 0 / .5); }
.pv-btn.folder { cursor: default; background: var(--surface-2); color: var(--muted); }
.res-main { min-width: 0; }
.pv-bar { height: 3px; border-radius: 2px; background: var(--surface-3); margin-top: 5px; overflow: hidden; display: none; }
.pv-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.item.previewing { background: var(--accent-soft); }
.item.previewing .pv-btn { background-color: var(--accent); color: var(--accent-ink); }
.item.previewing .pv-bar { display: block; }
.pv-yt { grid-column: 1 / -1; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; margin-top: 4px; }
.pv-yt iframe { width: 100%; height: 100%; border: 0; display: block; }
.badge.done { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 520px) {
  /* phones: buttons go under the title so the title keeps the full width */
  .results .item.res { grid-template-columns: 52px minmax(0, 1fr) auto; }
}

/* search results: one tab per platform, and a clear "Add to queue" button */
.src-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 0 10px; padding: 2px 0; }
.src-tabs::-webkit-scrollbar { display: none; }
.src-tabs .chip { flex: none; height: 32px; padding: 0 12px; font-size: 13px; font-weight: 600; }
.src-tabs .chip .num { color: var(--muted); font-weight: 500; }
.src-tabs .chip[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.src-tabs .chip[aria-pressed="true"] .num { color: inherit; opacity: .8; }
.src-tabs .yt-chip:not([aria-pressed="true"])::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: #e2453c; }
.btn.add-q svg { width: 14px; height: 14px; fill: currentColor; }

/* ---------- extra player controls ---------- */
.extras { display: flex; justify-content: center; align-items: center; gap: 4px; margin: 2px 0 0; flex-wrap: wrap; }
.xbtn {
  position: relative; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
}
.xbtn:hover { background: var(--surface-2); color: var(--text); }
.xbtn svg { width: 21px; height: 21px; fill: currentColor; }
.xbtn[aria-pressed="true"] { color: var(--accent); }
.xbtn[aria-pressed="true"]::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.xbtn:disabled { cursor: default; opacity: .55; }
.xbtn:disabled:hover { background: transparent; color: var(--muted); }
.xbtn[aria-pressed="true"]:disabled { opacity: .8; color: var(--accent); }
.xbtn .x-one { display: none; position: absolute; top: 9px; left: 50%; transform: translateX(-50%); font: 700 8px/1 var(--mono); }
.xbtn.one .x-one { display: block; }
.xbtn .x-badge { position: absolute; top: 2px; right: 0; font: 600 9px/1 var(--mono); color: var(--accent); }
.xbtn .ico-mute, .xbtn[aria-pressed="true"] .ico-vol { display: none; }
.xbtn[aria-pressed="true"] .ico-mute { display: block; }
.xbtn[hidden] { display: none; }
.np-next { text-align: center; margin: 0; min-height: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.times .t-dur { border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.player.is-fs > .extras { grid-row: 5; }
.player.is-fs > .np-next { display: none; }
.player.is-fs > .listener-note { grid-row: 6; }
.player.is-fs { grid-template-rows: minmax(0, 1fr) auto auto auto auto auto; }

/* visualizer: fills the background of the player; the artwork and the picture step aside
   (a YouTube video keeps playing and sounding, just out of sight) */
.viz-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; background: #05060f; }
.viz-bg[hidden] { display: none; }
.canvas.viz-on .ambient, .canvas.viz-on::after { opacity: 0; }
.np-art.viz-hide { position: absolute !important; width: 2px !important; height: 2px !important; min-width: 0 !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; }
.canvas.viz-on .np-meta, .canvas.viz-on .times, .canvas.viz-on .np-next { text-shadow: 0 1px 8px rgb(0 0 0 / .8); }
.viz-fs { display: none; position: absolute; top: 12px; right: 12px; bottom: auto; z-index: 5; }
.canvas.viz-on .viz-fs { display: grid; }
.canvas.viz-on .player.is-fs { background: transparent; }
.canvas.is-fs .viz-fs { top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 310; }
.canvas.is-fs .viz-fs .fs-open { display: none; }
.canvas.is-fs .viz-fs .fs-close { display: block; }
body.player-fs .viz-bg { position: fixed; z-index: 299; }

/* equalizer, sleep timer, view */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { cursor: pointer; }
.chips .chip[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.eq { display: grid; gap: 14px; }
.eq-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 38px; height: 22px; border-radius: 11px; background: var(--surface-3, var(--line)); position: relative; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.eq-bands { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 2px; justify-items: center; padding: 6px 0; }
.eq-bands.off { opacity: .45; }
.eq-band { display: grid; justify-items: center; gap: 6px; font: 11px var(--mono); color: var(--muted); min-width: 0; }
.eq-band output { font: 600 10.5px var(--mono); color: var(--text); }
.eq-band input[type="range"] { writing-mode: vertical-lr; direction: rtl; width: 28px; height: 150px; margin: 0; padding: 0; accent-color: var(--accent); }
.eq-pre input { width: 100%; accent-color: var(--accent); }
.sleep-opts { gap: 8px; }
.view-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.view-opt {
  display: grid; gap: 4px; text-align: left; padding: 14px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.view-opt span { font-size: 12.5px; color: var(--muted); }
.view-opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* the join card scrolls on a short (sideways) screen */
#join { overflow-y: auto; align-content: safe center; }

/* ---------- phone / tablet on its side (no fullscreen needed): rail + cover left, panel right ---------- */
@media (orientation: landscape) and (max-width: 1100px) {
  .topbar { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 6px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .brand span { display: none; }
  .shell { grid-template-columns: calc(64px + env(safe-area-inset-left)) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .sidenav {
    grid-row: 1; flex-direction: column; padding: 6px 4px 6px calc(4px + env(safe-area-inset-left)); gap: 0; justify-content: space-between;
    border-right: 1px solid var(--line); border-top: 0; overflow-y: auto;
  }
  .nav-group { gap: 0; }
  .nav-btn { flex: none; padding: 3px 0; gap: 0; font-size: 10px; }
  .nav-lbl { display: none; }
  .nav-ico { width: 44px; height: 28px; }
  .player-btn { margin: 2px 0; }
  .player-btn .nav-ico { width: 46px; height: 46px; margin: 0; }
  .canvas { padding: 8px max(12px, env(safe-area-inset-right)) 8px 12px; place-items: center stretch; }
  .player:not(.is-fs) {
    display: grid; height: auto; max-height: 100%; width: min(1100px, 100%);
    grid-template-columns: auto minmax(0, 1fr); column-gap: 20px; row-gap: 2px; align-items: center;
  }
  .player:not(.is-fs) > .np-art {
    grid-row: 1 / span 8; grid-column: 1; width: auto; aspect-ratio: 16 / 10; min-width: 0; margin: 0; align-self: center;
    height: min(calc(100dvh - 64px), 360px, (100vw - 64px - 300px) / 1.6);
  }
  .transport { gap: 4px; }
  .player:not(.is-fs) > :not(.np-art) { grid-column: 2; }
  .np-meta { margin: 0; }
  .np-meta p { display: block; }
  .ctl { width: 42px; height: 42px; }
  .ctl.big { width: 54px; height: 54px; }
  .xbtn { width: 36px; height: 36px; }
  .listener-note { display: none; }
}
@media (orientation: landscape) and (max-width: 1100px) and (max-height: 420px) {
  .player:not(.is-fs) > .np-art { aspect-ratio: 1; height: min(calc(100dvh - 56px), 280px, 100vw - 64px - 280px); }
}

/* ---------- equalizer panel ---------- */
.eqp {
  --eqp-bg: #0d0f17; --eqp-line: rgb(255 255 255 / .1); --eqp-text: #e9ebf3; --eqp-muted: rgb(233 235 243 / .55);
  --spec: rgb(255 255 255 / .12); --grid: rgb(255 255 255 / .25); --curve: var(--accent);
  display: grid; gap: 12px; padding: 14px; border-radius: 18px; background: var(--eqp-bg); color: var(--eqp-text);
}
.eqp .muted { color: var(--eqp-muted); }
.eqp-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.eqt-group { display: flex; gap: 6px; }
.eqt {
  height: 30px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--eqp-line); background: transparent; color: var(--eqp-muted);
  font: 650 12px/1 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; cursor: pointer;
}
.eqt:hover { color: var(--eqp-text); border-color: rgb(255 255 255 / .3); }
.eqt[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
#eq-preset { height: 30px; min-width: 130px; border-radius: 10px; background: #171a25; color: var(--eqp-text); border: 1px solid var(--eqp-line); padding: 0 8px; }
.eqp-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: stretch; }
.eqp-sliders { display: grid; grid-template-columns: 1.25fr repeat(10, minmax(0, 1fr)); gap: 2px; padding: 10px 6px; border-radius: 14px; background: rgb(255 255 255 / .03); border: 1px solid var(--eqp-line); }
.eqp-sliders.off .eqs:not(.pre) { opacity: .4; }
.eqs { display: grid; justify-items: center; gap: 6px; min-width: 0; font: 11px var(--mono); color: var(--eqp-muted); }
.eqs.pre { border-right: 1px solid var(--eqp-line); margin-right: 4px; }
.eqs output { font: 600 10.5px var(--mono); color: var(--eqp-text); }
.eqs span { white-space: nowrap; }
.eqs input[type="range"] {
  -webkit-appearance: none; appearance: none; writing-mode: vertical-lr; direction: rtl;
  width: 30px; height: 170px; margin: 0; padding: 0; background: transparent; accent-color: var(--accent); cursor: pointer;
}
.eqp-knobs { display: grid; gap: 10px; align-content: space-between; justify-items: center; }
.knob-pair { display: grid; gap: 10px; }
.knob-pair.off { opacity: .45; }
.knob-wrap { display: grid; justify-items: center; gap: 2px; font-size: 11.5px; }
.knob-wrap b { font-weight: 650; }
.knob-v { font: 11px var(--mono); color: var(--eqp-muted); }
.knob {
  --size: 76px; position: relative; width: var(--size); height: var(--size); border-radius: 50%; cursor: grab; touch-action: none;
  background:
    radial-gradient(circle at 50% 38%, #2a2f40, #12141c 70%) padding-box,
    conic-gradient(from 225deg, var(--accent) calc(var(--p) * 270deg), rgb(255 255 255 / .1) 0 270deg, transparent 0) border-box;
  border: 4px solid transparent; box-shadow: 0 6px 18px rgb(0 0 0 / .45);
}
.knob:active { cursor: grabbing; }
.knob:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.knob i { position: absolute; inset: 0; transform: rotate(calc(-135deg + var(--p) * 270deg)); }
.knob i::before { content: ""; position: absolute; left: 50%; top: 8px; width: 3px; height: 14px; margin-left: -1.5px; border-radius: 2px; background: #fff; }
.eqp-graph { width: 100%; height: 96px; display: block; border-radius: 12px; background: rgb(255 255 255 / .03); border: 1px solid var(--eqp-line); }
@media (max-width: 560px) {
  .eqp { padding: 10px; }
  .eqp-main { grid-template-columns: minmax(0, 1fr); }
  .eqp-knobs { grid-template-columns: repeat(3, auto); justify-content: space-around; align-items: end; }
  .knob-pair { display: contents; }
  .knob-pair.off .knob-wrap { opacity: .45; }
  .eqs input[type="range"] { height: 150px; width: 24px; }
  .knob { --size: 64px; }
}

.eqs input[type="range"]::-webkit-slider-runnable-track { width: 4px; height: 100%; background: linear-gradient(to top, var(--accent) var(--p, 50%), rgb(255 255 255 / .14) var(--p, 50%)); }
.eqs input[type="range"]::-webkit-slider-thumb { margin-top: 0; margin-left: -10px; width: 24px; height: 14px; border-radius: 4px; background: #e9ebf3; border: 0; box-shadow: 0 2px 6px rgb(0 0 0 / .5); }
.eqs input[type="range"]::-moz-range-track { width: 4px; background: rgb(255 255 255 / .14); }
.eqs input[type="range"]::-moz-range-thumb { width: 22px; height: 12px; border-radius: 4px; background: #e9ebf3; border: 0; }

/* waveform seek bar: the decoded track's peaks, played part in the accent colour */
.progress { position: relative; }
.seek-wave { display: none; position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 44px; pointer-events: none; }
.progress.has-wave { padding-top: 0; }
.progress.has-wave .seek-wave { display: block; }
.progress.has-wave #seek { height: 44px; opacity: 0; margin: 0; }
.player.is-fs .progress.has-wave #seek { opacity: 0; }

/* audio info chip and the long-press hint */
.np-chips { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; min-height: 22px; }
.np-info {
  height: 22px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font: 600 10.5px/1 var(--mono); color: var(--muted); cursor: pointer; letter-spacing: .02em;
}
.np-info:hover { color: var(--text); }
.np-info[hidden] { display: none; }
.player.is-fs .np-info { background: rgb(0 0 0 / .4); color: #fff; border-color: rgb(255 255 255 / .3); }
.pipe { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.pipe li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 10px 0; position: relative; }
.pipe li::before { content: ""; position: absolute; left: 12px; top: 32px; bottom: -4px; width: 2px; background: var(--line); }
.pipe li:last-child::before { display: none; }
.pipe .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font: 700 12px var(--mono); }
.pipe .n.off { background: var(--surface-2); color: var(--muted); }
.pipe b { display: block; }
.pipe span { font-size: 12.5px; color: var(--muted); }
.ctl.scrub { background: var(--surface-2); }

/* ambient background: the artwork blurred behind the player, fading into the page */
.canvas { position: relative; isolation: isolate; }
.ambient {
  position: absolute; inset: -12%; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .6s, background-image .6s;
  background-size: cover; background-position: center; filter: blur(70px) saturate(1.5); transform: translateZ(0);
}
.ambient.on { opacity: .42; }
.canvas::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 35%, transparent 0 35%, var(--bg) 95%);
}
.player { position: relative; z-index: 1; }
.np-art { box-shadow: 0 18px 50px -12px rgb(0 0 0 / .45); }
@media (prefers-color-scheme: dark) { .ambient.on { opacity: .55; } }

/* a device whose sound the host (or its owner) turned off */
.node.muted-dev .node-ico { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.node.muted-dev .node-name { opacity: .6; }

/* install button; the installed app has no browser bar, so the page owns the whole screen */
.install-btn { gap: 6px; }
.install-btn[hidden] { display: none; }
@media (max-width: 640px) { .install-btn span { display: none; } .install-btn { padding: 0 9px; } }
html.standalone body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
html.standalone input, html.standalone textarea, html.standalone [contenteditable] { -webkit-user-select: text; user-select: text; }

/* ---------- the page about the app (below the first screen) ---------- */
.scroll-hint { position: absolute; bottom: max(10px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); font-size: 26px; color: var(--muted); text-decoration: none; animation: hint-bob 2s ease-in-out infinite; }
@keyframes hint-bob { 50% { transform: translate(-50%, 6px); } }
.land { width: min(1040px, 100%); margin: 0 auto; padding: 48px 20px; display: grid; gap: 14px; }
.land h2 { font-size: clamp(22px, 3.2vw, 30px); letter-spacing: -.01em; }
.land > p { max-width: 62ch; font-size: 15px; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 8px; }
.feature { padding: 18px; border-radius: 18px; border: 1px solid var(--line); background: rgb(255 255 255 / .03); display: grid; gap: 8px; align-content: start; }
.feature h3 { font-size: 16px; }
.feature p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.f-ico { width: 44px; height: 44px; display: grid; place-items: center; font-size: 22px; border-radius: 12px; background: var(--accent-soft); }
.how { list-style: none; counter-reset: how; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 0; margin: 6px 0 0; }
.how li { counter-increment: how; padding: 16px 16px 16px 58px; position: relative; border-radius: 16px; border: 1px solid var(--line); background: rgb(255 255 255 / .03); color: var(--muted); font-size: 14.5px; line-height: 1.45; }
.how li::before { content: counter(how); position: absolute; left: 16px; top: 14px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--brand-grad); }
.how b { color: var(--text); }
.get-app { text-align: center; justify-items: center; }
.app-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 280px)); gap: 12px; justify-content: center; width: 100%; }
.app-buttons .btn { gap: 10px; text-decoration: none; }
.app-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 340px)); gap: 16px;
  justify-content: center; width: 100%; text-align: left;
}
.app-card {
  display: grid; gap: 12px; padding: 18px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--surface);
}
.app-card-head { display: flex; gap: 12px; align-items: center; }
.app-card-head h3 { margin: 0; font-size: 18px; }
.app-card-ico { font-size: 28px; line-height: 1; }
.app-card-actions { display: grid; gap: 8px; }
.app-card-actions .btn { text-decoration: none; justify-content: center; }
.app-update-msg { margin: 0; min-height: 1.2em; }
.app-update-msg.ok { color: var(--good, #3ecf8e); }
.app-update-msg.warn { color: var(--warn, #e6a23c); font-weight: 650; }
.app-update-msg.err { color: var(--bad, #e85d5d); }
.app-web-row { margin-top: 8px; }
.app-install-hint { max-width: 52ch; }
.faq { display: grid; gap: 8px; }
.faq details { border: 1px solid var(--line); border-radius: 14px; padding: 4px 16px; background: rgb(255 255 255 / .03); }
.faq summary { cursor: pointer; padding: 12px 0; font-weight: 650; list-style: none; }
.faq summary::after { content: "+"; float: right; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--muted); padding: 0 0 14px; line-height: 1.55; }
.land-foot { width: min(1040px, 100%); margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 24px 20px calc(96px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.land-foot img { border-radius: 8px; }
.land-foot a, .link-btn { color: var(--muted); background: none; border: 0; font: inherit; cursor: pointer; text-decoration: none; }
.land-foot a:hover, .link-btn:hover { color: var(--text); }
.top-link { text-decoration: none; }
@media (max-width: 480px) { .top-link { display: none; } }

/* public rooms */
.public-list { display: grid; gap: 8px; }
.sess.pub { grid-template-columns: auto minmax(0, 1fr) auto; }
.pub-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 8px; }
.pub-ico i { width: 4px; height: 30%; border-radius: 2px; background: var(--accent); }
.pub-ico.on i { animation: eq-bar 1s ease-in-out infinite; }
.pub-ico.on i:nth-child(2) { animation-delay: -.3s; }
.pub-ico.on i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq-bar { 0%, 100% { height: 30%; } 50% { height: 100%; } }
.empty-pub { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px; border: 1px dashed var(--line); border-radius: 14px; }

/* the Player button: back to the last room */
.player-fab {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40;
  display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; max-width: min(320px, calc(100vw - 32px));
  border-radius: 999px; color: #fff; text-decoration: none; background: var(--brand-grad);
  box-shadow: 0 10px 30px rgb(91 61 245 / .5);
}
.player-fab[hidden] { display: none; }
.player-fab .pf-ico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / .18); flex: none; }
.player-fab.playing .pf-ico { animation: fab-pulse 2s ease-in-out infinite; }
@keyframes fab-pulse { 50% { box-shadow: 0 0 0 8px rgb(255 255 255 / .12); } }
.player-fab .pf-text { display: grid; min-width: 0; line-height: 1.2; }
.player-fab .pf-text span { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* join: QR scanner and "or" */
.scan-btn { gap: 8px; min-height: 48px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.scan-view { position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: #000; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid rgb(255 255 255 / .85); border-radius: 18px; box-shadow: 0 0 0 999px rgb(0 0 0 / .35); }

/* privacy choice */
.privacy { border: 0; padding: 0; display: grid; gap: 8px; }
.privacy > span { font-size: 13px; color: var(--muted); }
.field-row { display: flex; gap: 8px; align-items: center; }
.field-row input { flex: 1; min-width: 0; }
.join-icons { display: flex; justify-content: center; gap: 16px; margin: 4px 0 12px; }
.join-ico { width: 52px; height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--accent); }
.privacy-chips { display: flex; gap: 8px; margin: 0 0 14px; }
.privacy-chips .chip { cursor: pointer; }
.privacy-chips .chip:has(input:checked) span,
.privacy-chips .chip input:checked + span {
  background: var(--accent); color: var(--accent-ink); border-color: transparent;
}
.privacy-chips .chip span {
  display: inline-flex; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 650; font-size: 13px;
}
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 14px; }
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio input { margin-top: 3px; accent-color: var(--accent); }

/* equalizer: preset previews, the room's shared sound */
.eq-cards { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 4px; }
.eq-cards::-webkit-scrollbar { display: none; }
.eq-card { flex: none; width: 96px; display: grid; gap: 4px; padding: 8px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--eqp-line); background: rgb(255 255 255 / .03); color: var(--eqp-muted); font: 600 11px/1.2 system-ui, sans-serif; text-align: left; }
.eq-card svg { width: 100%; height: 34px; display: block; }
.eq-card path { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.eq-card path.z { stroke: rgb(255 255 255 / .18); stroke-width: 1; }
.eq-card span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eq-card[aria-pressed="true"] { border-color: var(--accent); background: rgb(143 124 255 / .16); color: var(--eqp-text); }
.eq-current { font: 600 12px var(--mono); color: var(--eqp-muted); }
.eq-share { color: var(--eqp-text); }
.eq-note { margin: 0; }
.eqp.locked .eqp-top, .eqp.locked .eq-cards, .eqp.locked .eqp-main { opacity: .45; pointer-events: none; }

/* over a background visualizer: a soft wash behind the player's text and buttons keeps them readable */
.canvas.viz-on .player:not(.is-fs) { background: transparent; border-radius: 22px; padding: 10px 12px 12px; }
.canvas.viz-on .player.is-fs > :not(.np-art) { text-shadow: 0 1px 10px rgb(0 0 0 / .9); }

/* search results: a thumbnail with a play button for previewing, and small round buttons */
.pv-btn { width: 52px; height: 52px; border-radius: 10px; background-size: cover; background-position: center; }
.results .item.res > .row { gap: 6px; flex-wrap: nowrap; }
.res-btn {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.res-btn svg { width: 18px; height: 18px; fill: currentColor; }
.res-btn:hover { background: var(--surface-2); }
.res-btn.primary { background: var(--brand-grad); color: #fff; border-color: transparent; }
.results .badge.done { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.search-go { gap: 6px; }
.search-go svg { width: 18px; height: 18px; fill: currentColor; }
@media (max-width: 420px) { .search-go span { display: none; } .search-go { padding: 0 12px; } }

/* portrait / wide desktop: controls sit at the bottom; cover and title share the space above */
@media (orientation: portrait), (min-width: 1101px) {
  .canvas { place-items: stretch center; grid-template-columns: minmax(0, 1fr); }
  .player:not(.is-fs) { height: 100%; max-height: none; display: flex; flex-direction: column; gap: 6px; }
  .player:not(.is-fs) > * { min-width: 0; }
  .player:not(.is-fs) > .np-art { align-self: center; margin-top: auto; flex: none; }
  .player:not(.is-fs) > .np-meta { margin-bottom: auto; }
  .player:not(.is-fs) > .progress { margin-top: 10px; }
  .player:not(.is-fs) > .listener-note { margin-bottom: 4px; }
}

/* over a background visualizer the buttons get a dark backing so they stay visible and easy to hit */
.canvas.viz-on .ctl:not(.big), .canvas.viz-on .xbtn { background: rgb(5 6 15 / .55); }
.canvas.viz-on .ctl:not(.big):hover, .canvas.viz-on .xbtn:hover { background: rgb(5 6 15 / .75); }
.canvas.viz-on .extras { gap: 8px; }
/* the visualizer is always dark: the player switches to light text and icons over it, in either theme */
.canvas.viz-on {
  --text: #f2f3ff; --muted: rgb(242 243 255 / .72); --surface: rgb(15 19 40 / .7); --surface-2: rgb(255 255 255 / .12);
  --surface-3: rgb(255 255 255 / .22); --line: rgb(255 255 255 / .2); color: var(--text);
}
.canvas.viz-on .np-meta h2, .canvas.viz-on .ctl, .canvas.viz-on .xbtn { color: var(--text); }
.canvas.viz-on .xbtn[aria-pressed="true"] { color: var(--accent); }

/* ===== TV mode (Smart TV / Android TV browser — mirrors the TV app) ===== */
html.tv-mode, body.tv-mode { font-size: 18px; }
body.tv-mode .phone-home,
body.tv-mode .land,
body.tv-mode .land-foot,
body.tv-mode .scroll-hint.phone-home { display: none !important; }
body.tv-mode .top-link,
body.tv-mode .install-btn,
body.tv-mode .guide-btn { display: none !important; }
body.tv-mode .home { min-height: 100dvh; justify-content: center; padding-bottom: 40px; }
.tv-home { width: min(920px, 100%); display: grid; gap: 22px; justify-items: center; }
.tv-home-hint { margin: 0; }
.tv-cards { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; }
.tv-card {
  width: min(280px, 42vw); min-height: 200px; display: grid; place-content: center; gap: 8px;
  padding: 28px 24px; border-radius: 22px; border: 2px solid var(--line); background: var(--surface);
  color: inherit; text-decoration: none; text-align: center; cursor: pointer; font: inherit;
}
.tv-card:focus, .tv-card:hover { outline: none; border-color: var(--accent); background: var(--accent-soft, rgb(91 61 245 / .16)); transform: scale(1.03); }
.tv-card-ico { font-size: 42px; line-height: 1; }
.tv-card strong { font-size: 22px; }
.tv-player-pick, .tv-room-panel { width: min(920px, 100%); display: grid; gap: 14px; justify-items: center; }
.tv-pick-title { margin: 0; font-size: 28px; }
.tv-room-head { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.tv-room-list { width: 100%; display: grid; gap: 10px; max-height: 52vh; overflow: auto; padding: 4px; }
.tv-room {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  padding: 16px 18px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface);
  color: inherit; text-decoration: none;
}
.tv-room:focus, .tv-room:hover { outline: none; border-color: var(--accent); background: var(--accent-soft, rgb(91 61 245 / .16)); }
.tv-room-name { font-weight: 700; font-size: 17px; }

body.tv-mode.room .drop-hint,
body.tv-mode.room .req-pop,
body.tv-mode.room .share-btn,
body.tv-mode.room #host-badge { display: none !important; }
body.tv-mode.room .listener-note { display: none !important; }
body.tv-mode.room .sidenav .nav-btn { min-height: 64px; }

/* Live TV page: the same player as the Android app (overlay, channel bar, panels, guide) */
body.tv-page { margin: 0; background: #000; color: #fff; overflow: hidden; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.tvp { --red: #E50914; --panel: rgb(16 18 24 / .95); position: relative; height: 100dvh; background: #000; overflow: hidden; }
.tvp.nocursor, .tvp.nocursor * { cursor: none !important; }
.tvp-stage { position: absolute; inset: 0; }
.tvp-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.tvp-logo { position: absolute; inset: 16% 22%; background: center / contain no-repeat; opacity: .85; pointer-events: none; transition: opacity .25s; }
.tvp-status { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); max-width: min(90vw, 640px); text-align: center;
  padding: 10px 18px; border-radius: 999px; background: rgb(0 0 0 / .7); font-weight: 700; pointer-events: none; white-space: pre-line; }
.tvp-status[hidden], .tvp-osd[hidden], .tvp-spin[hidden] { display: none; }
.tvp-osd { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); padding: 10px 18px; border-radius: 14px; background: rgb(0 0 0 / .8);
  font-weight: 800; font-size: clamp(15px, 2.4vw, 24px); text-align: center; white-space: pre-line; pointer-events: none; z-index: 6; }
.tvp-spin { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  border: 4px solid rgb(255 255 255 / .2); border-top-color: var(--red); animation: tvspin .8s linear infinite; pointer-events: none; }
@keyframes tvspin { to { transform: rotate(360deg); } }

/* the overlay */
.tvp-hud { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(to bottom, rgb(0 0 0 / .78), transparent 26%, transparent 62%, rgb(0 0 0 / .88)); }
.tvp-hud[hidden] { display: none; }
.hud-top { display: flex; align-items: center; gap: 12px; padding: clamp(8px, 2vw, 22px) clamp(10px, 2.4vw, 30px) 0; }
.hud-titles { flex: 1; min-width: 0; }
.hud-titles b { display: block; font-size: clamp(17px, 2.6vw, 30px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-titles span { display: block; color: rgb(255 255 255 / .82); font-size: clamp(12px, 1.5vw, 17px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpill { padding: 3px 9px; border-radius: 6px; font: 800 clamp(10px, 1.2vw, 14px)/1.2 system-ui, sans-serif; letter-spacing: .03em; }
.tpill.live { background: var(--red); } .tpill.q { border: 1.5px solid rgb(255 255 255 / .85); }
.tpill[hidden] { display: none; }
.hud-mid { display: flex; align-items: center; justify-content: center; gap: clamp(8px, 3vw, 30px); }
.hud-bottom { padding: 0 clamp(10px, 2.4vw, 30px) clamp(6px, 1.8vw, 20px); display: grid; gap: 6px; }
.hud-prog { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: clamp(11px, 1.3vw, 15px); font-variant-numeric: tabular-nums; }
.hud-prog .track { flex: 1; height: 5px; border-radius: 99px; background: rgb(255 255 255 / .35); overflow: hidden; }
.hud-prog .fill { height: 100%; width: 0; background: var(--red); border-radius: 99px; }
.hud-row { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.hud-row .grow { flex: 1; }
.tb { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; height: 44px; padding: 0 8px; border: 0; border-radius: 12px;
  background: transparent; color: #fff; font: 700 clamp(12px, 1.3vw, 15px)/1 system-ui, sans-serif; cursor: pointer; }
.tb svg { width: 26px; height: 26px; fill: currentColor; flex: none; }
.tb:hover { background: rgb(255 255 255 / .12); }
.tb:focus-visible, .tb.kfocus { outline: 3px solid #fff; outline-offset: 1px; background: rgb(255 255 255 / .16); }
.tb.big { width: clamp(58px, 8vw, 92px); height: clamp(58px, 8vw, 92px); border-radius: 50%; border: 2px solid #fff; background: rgb(0 0 0 / .25); }
.tb.big svg { width: 54%; height: 54%; }
.tb.mid svg { width: clamp(28px, 3.6vw, 44px); height: clamp(28px, 3.6vw, 44px); }
.tb.mid { width: clamp(46px, 6vw, 70px); height: clamp(46px, 6vw, 70px); border-radius: 50%; }
.tb.on { color: #FFC53D; }
.tvp input.vol { flex: 0 0 auto; width: clamp(70px, 10vw, 150px); --accent: var(--red); --surface-3: rgb(255 255 255 / .3); --text: #fff; --surface: var(--red); --line: transparent; }
@media (max-width: 640px) { .tb .lbl { display: none; } .vol { display: none; } }

/* panels (Playback settings, Audio & Subtitles) */
.tvp-panel { position: absolute; inset: 0; z-index: 8; background: rgb(0 0 0 / .45); }
.tvp-panel[hidden] { display: none; }
.tvp-panel .card { position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(420px, calc(100% - 24px)); background: var(--panel);
  border: 1px solid rgb(255 255 255 / .12); border-radius: 18px; padding: 14px 12px 14px 18px; display: flex; flex-direction: column; }
.tvp-panel .card header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tvp-panel .card h2 { flex: 1; margin: 0; font-size: 19px; }
.tvp-panel .body { overflow: auto; padding-right: 6px; }
.tvp-panel h3 { margin: 14px 0 6px; font-size: 15px; }
.opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 12px; margin-bottom: 4px; border: 0; border-radius: 10px;
  background: rgb(255 255 255 / .06); color: #fff; font: 600 14px/1.2 system-ui, sans-serif; text-align: left; cursor: pointer; }
.opt.on { background: rgb(255 255 255 / .14); font-weight: 800; }
.opt small { color: rgb(255 255 255 / .6); font-weight: 500; }
.opt .tick { margin-left: auto; color: var(--red); font-weight: 900; }
.opt:focus-visible, .opt.kfocus { outline: 3px solid #fff; outline-offset: -1px; }
.opt .sw { margin-left: auto; padding: 4px 12px; border-radius: 999px; background: rgb(255 255 255 / .25); font-size: 12px; font-weight: 800; }
.opt .sw.on { background: var(--red); }
.speeds { display: flex; gap: 6px; flex-wrap: wrap; }
.speeds .opt { width: auto; }
.speeds .opt.on { background: var(--red); }
.tvp .note, .tvp-guide .note { color: rgb(255 255 255 / .6); font-size: 13px; margin: 2px 0 6px; padding: 0; background: none; }

/* the channel bar (↓ / Channels) */
.tvp-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; gap: 8px; padding: 12px clamp(10px, 2vw, 22px) 14px;
  background: rgb(9 11 18 / .94); border-top: 1px solid rgb(255 255 255 / .08); max-height: 72%; }
.tvp-bar[hidden] { display: none; }
/* one column no wider than the screen, so the search row, categories and channels scroll inside it instead of running off the edge */
.tvp-bar { grid-template-columns: minmax(0, 1fr); }
.bar-tools .toolbtn:not(.grow) { flex: 0 1 auto; max-width: 42%; }
/* phones: the search gets its own full row, country and language share the one below */
@media (max-width: 600px) {
  .bar-tools { flex-wrap: wrap; gap: 8px; }
  .bar-tools .toolbtn.grow { flex: 1 1 100%; }
  .bar-tools .toolbtn:not(.grow) { flex: 1 1 0; max-width: none; }
  .bar-tools kbd { display: none; }
}
.bar-now { display: flex; align-items: center; gap: 12px; }
.bar-now .lg { width: 46px; height: 46px; border-radius: 10px; background: #161b2e center / contain no-repeat; border: 1px solid rgb(255 255 255 / .12); flex: none; }
.bar-now .tx { flex: 1; min-width: 0; }
.bar-now b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-now span { display: block; color: rgb(255 255 255 / .65); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-tools { display: flex; gap: 8px; align-items: center; }
.bar-tools input { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 12px; border: 1px solid rgb(255 255 255 / .2); background: rgb(255 255 255 / .1); color: #fff; font: inherit; }
.bar-tools select { padding: 9px 10px; border-radius: 12px; border: 1px solid rgb(255 255 255 / .2); background: #161b2e; color: #fff; font: inherit; max-width: 34vw; }
.bar-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.bar-chips .chip { flex: 0 0 auto; border: 1px solid rgb(255 255 255 / .18); background: rgb(255 255 255 / .08); color: #fff; border-radius: 999px; padding: 8px 14px; font: 600 13.5px/1 system-ui, sans-serif; cursor: pointer; }
.bar-chips .chip.on { background: var(--red); border-color: transparent; }
.bar-chips .chip:focus-visible, .bar-chips .chip.kfocus { outline: 3px solid #fff; outline-offset: 1px; }
.bar-info { color: rgb(255 255 255 / .55); font-size: 12px; }
.bar-list { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 6px; min-height: 120px; scroll-snap-type: x proximity; }
.tile { flex: 0 0 150px; scroll-snap-align: start; display: grid; justify-items: center; align-content: start; gap: 5px; padding: 8px 10px;
  border-radius: 14px; border: 1px solid #2a3150; background: #161b2e; color: #fff; cursor: pointer; font: inherit; text-align: center; }
.tile.on { border: 2px solid var(--red); background: #2a1013; }
.tile:focus-visible, .tile.kfocus { outline: none; border: 3px solid #ff4d57; background: #3a1216; }
.tile.bad { opacity: .55; }
.tile .lg { width: 56px; height: 56px; border-radius: 10px; background: #20263d center / contain no-repeat; }
.tile b { font-size: 13px; line-height: 1.2; max-height: 2.4em; overflow: hidden; }
.tile small { font-size: 11px; color: #a3a9bf; }

/* guide */
.tvp-guide { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgb(0 0 0 / .78); padding: 16px; }
.tvp-guide[hidden] { display: none; }
.tvp-guide .card { width: min(880px, 100%); max-height: 92dvh; overflow: auto; background: #0f1220; border: 1px solid rgb(255 255 255 / .12); border-radius: 18px; padding: 18px 20px; }
.tvp-guide header { display: flex; align-items: center; gap: 10px; }
.tvp-guide h2 { flex: 1; margin: 0; font-size: 22px; }
.guide-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 10px; }
@media (max-width: 700px) { .guide-cols { grid-template-columns: 1fr; } }
.guide-connect { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; margin: 12px 0 4px; padding: 16px; border-radius: 16px; background: rgb(255 255 255 / .04); border: 1px solid rgb(255 255 255 / .1); }
.guide-connect[hidden] { display: none; }
.guide-connect h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; }
.rc-qr { width: 168px; height: 168px; background: #fff; border-radius: 14px; padding: 8px; }
.rc-qr svg { width: 100%; height: 100%; display: block; }
.rc-code { font: 700 46px/1.1 ui-monospace, monospace; letter-spacing: .3em; margin: 6px 0 8px; color: #fff; }
.guide-connect ol { margin: 0; padding-left: 20px; color: rgb(255 255 255 / .75); font-size: 14px; line-height: 1.6; }
.rc-state { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; color: #b8acff; background: rgb(143 124 255 / .16); border: 1px solid rgb(143 124 255 / .35); }
.rc-state.ok { color: #6ee7a8; background: rgb(110 231 168 / .14); border-color: rgb(110 231 168 / .35); }
@media (max-width: 700px) { .guide-connect { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.guide-cols h3 { margin: 6px 0 8px; font-size: 15px; color: rgb(255 255 255 / .8); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; font-size: 14px; }
.keys kbd { display: inline-block; min-width: 1.6em; padding: 4px 8px; margin: 0 3px 2px 0; border-radius: 8px; border: 1px solid rgb(255 255 255 / .22);
  background: #1e2436; font: 700 12.5px/1 ui-monospace, monospace; text-align: center; }
.dpad { position: relative; width: 200px; height: 200px; margin: 6px auto 12px; border-radius: 50%; background: #161b2e; border: 1px solid rgb(255 255 255 / .12); }
.dpad span { position: absolute; display: grid; place-items: center; text-align: center; font-weight: 800; font-size: 13px; line-height: 1.1; }
.dpad span small { display: block; font-weight: 500; font-size: 10px; color: rgb(255 255 255 / .6); }
.dpad .u { top: 10px; left: 50%; transform: translateX(-50%); } .dpad .d { bottom: 10px; left: 50%; transform: translateX(-50%); }
.dpad .l { left: 10px; top: 50%; transform: translateY(-50%); } .dpad .r { right: 10px; top: 50%; transform: translateY(-50%); }
.dpad .ok { left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: var(--red, #E50914); }
.tvp-guide .done { display: block; width: 100%; margin-top: 14px; padding: 12px; border: 0; border-radius: 12px; background: #E50914; color: #fff; font: 800 15px system-ui, sans-serif; cursor: pointer; }

/* ======================================================================================
   Live TV page: the bar's tools (buttons, not squeezed fields) and the search dialog
   ====================================================================================== */
.bar-tools { gap: 10px; }
.toolbtn { display: inline-flex; align-items: center; gap: 8px; min-width: 0; padding: 10px 14px; border-radius: 14px; cursor: pointer;
  border: 1px solid rgb(255 255 255 / .16); background: rgb(255 255 255 / .07); color: #fff; font: 600 14px/1.2 system-ui, sans-serif;
  transition: background .18s, border-color .18s, transform .18s, box-shadow .18s; }
.toolbtn[hidden] { display: none; }
.toolbtn.grow { flex: 1; }
.toolbtn .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbtn.grow .t { color: rgb(255 255 255 / .62); font-weight: 500; }
.toolbtn.on { border-color: rgb(229 9 20 / .7); background: rgb(229 9 20 / .16); }
.toolbtn.on .t { color: #fff; font-weight: 700; }
.toolbtn kbd { margin-left: auto; padding: 1px 7px; border-radius: 6px; border: 1px solid rgb(255 255 255 / .25); font: 12px ui-monospace, monospace; opacity: .7; }
.toolbtn .car { opacity: .6; margin-left: 2px; }
.toolbtn:hover { background: rgb(255 255 255 / .12); transform: translateY(-1px); }
.toolbtn:focus-visible { outline: none; border-color: #fff; box-shadow: 0 0 0 3px rgb(255 255 255 / .35); }
.bar-list { scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / .25) transparent; }
.bar-list::-webkit-scrollbar { height: 8px; }
.bar-list::-webkit-scrollbar-thumb { background: rgb(255 255 255 / .22); border-radius: 99px; }
.bar-list::-webkit-scrollbar-track { background: transparent; }
.tvp-bar:not([hidden]) { animation: bar-up .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes bar-up { from { opacity: 0; transform: translateY(24px); } }
.tile { transition: transform .18s, border-color .18s, background .18s, box-shadow .18s; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgb(0 0 0 / .45); }
.tile:focus-visible, .tile.kfocus { transform: translateY(-3px) scale(1.04); box-shadow: 0 12px 28px rgb(229 9 20 / .35); }

.tvp-modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: start center; padding: max(6vh, 16px) 16px 16px;
  background: rgb(0 0 0 / .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in .18s ease; }
.tvp-modal[hidden] { display: none; }
.tvp-modal .card { width: min(620px, 100%); max-height: min(78vh, 720px); display: flex; flex-direction: column; gap: 10px; padding: 16px;
  border-radius: 22px; background: rgb(16 18 28 / .97); border: 1px solid rgb(255 255 255 / .1); color: #fff;
  box-shadow: 0 30px 80px rgb(0 0 0 / .6), 0 0 0 1px rgb(143 124 255 / .12); animation: pop-in .26s cubic-bezier(.2, .9, .25, 1.15); }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.tvp-modal header { display: flex; align-items: center; gap: 10px; }
.tvp-modal h2 { flex: 1; margin: 0; font-size: 19px; }
.pick-field { display: flex; align-items: center; gap: 10px; padding: 4px 14px; border-radius: 14px; background: rgb(255 255 255 / .08); border: 1px solid rgb(255 255 255 / .16); transition: border-color .18s, box-shadow .18s; }
.pick-field:focus-within { border-color: #8f7cff; box-shadow: 0 0 0 4px rgb(143 124 255 / .22); }
.pick-field input { flex: 1; min-width: 0; padding: 12px 0; border: 0; outline: 0; background: none; color: #fff; font: 500 17px/1.2 system-ui, sans-serif; }
.pick-field input[hidden] { display: none; }
.pick-meta { color: rgb(255 255 255 / .55); font-size: 12.5px; padding: 0 4px; }
.pick-list { overflow: auto; display: grid; gap: 4px; padding: 2px; scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / .2) transparent; }
.prow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 1px solid transparent; border-radius: 12px; cursor: pointer;
  background: rgb(255 255 255 / .04); color: #fff; font: inherit; text-align: left; animation: row-in .3s both; animation-delay: var(--d, 0ms);
  transition: background .15s, border-color .15s, transform .15s; }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } }
.prow:hover { background: rgb(255 255 255 / .1); }
.prow:focus-visible { outline: none; border-color: #fff; background: rgb(255 255 255 / .12); transform: translateX(3px); }
.prow.on { background: rgb(229 9 20 / .16); border-color: rgb(229 9 20 / .5); }
.prow .lg { width: 40px; height: 40px; flex: none; border-radius: 9px; background: #20263d center / contain no-repeat; }
.prow .fl { width: 28px; text-align: center; font-size: 20px; flex: none; }
.prow .tx { flex: 1; min-width: 0; display: grid; }
.prow b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow small { color: rgb(255 255 255 / .55); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .now { color: #ff4d57; font-size: 12px; font-weight: 800; }
.prow .tick { color: #ff4d57; font-weight: 900; }
.pick-empty { color: rgb(255 255 255 / .6); text-align: center; padding: 24px 8px; }
.pick-foot { display: flex; justify-content: flex-end; }
.pick-foot[hidden] { display: none; }
.pick-foot .done { padding: 10px 18px; border: 0; border-radius: 12px; background: #E50914; color: #fff; font: 700 14px system-ui, sans-serif; cursor: pointer; }

/* ======================================================================================
   Motion for the website: entrances, hover lift, scroll reveal (all off for reduced motion)
   ====================================================================================== */
.home-mark { animation: mark-in .8s cubic-bezier(.2, .9, .25, 1.2) both, float 6s ease-in-out 1s infinite; filter: drop-shadow(0 18px 40px rgb(91 61 245 / .45)); }
@keyframes mark-in { from { opacity: 0; transform: scale(.7) rotate(-8deg); } }
@keyframes float { 50% { transform: translateY(-8px); } }
.home-word { animation: rise .7s .15s cubic-bezier(.2, .8, .2, 1) both; }
.home-tag { animation: rise .7s .28s cubic-bezier(.2, .8, .2, 1) both; }
.home-hero p { animation: rise .7s .38s cubic-bezier(.2, .8, .2, 1) both; }
.home-actions > *, .home-features > * { animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.home-actions > :nth-child(1) { animation-delay: .48s; } .home-actions > :nth-child(2) { animation-delay: .58s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
body.home-page .btn { transition: transform .18s, box-shadow .2s, background .2s, border-color .2s; }
body.home-page .btn:hover { transform: translateY(-2px); }
body.home-page .btn.primary:hover { box-shadow: 0 12px 34px rgb(143 124 255 / .45); filter: brightness(1.08); }
body.home-page .btn:active { transform: translateY(0) scale(.98); }
.feature, .app-card, .how li, .tv-card, .home-features > *, .public-list > *, .faq details {
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), box-shadow .22s, border-color .22s, background .22s; }
.feature:hover, .app-card:hover, .tv-card:hover, .home-features > :hover, .public-list > :hover {
  transform: translateY(-4px); box-shadow: 0 16px 40px rgb(0 0 0 / .35), 0 0 0 1px rgb(143 124 255 / .35); }
.feature .f-ico { display: inline-grid; transition: transform .3s cubic-bezier(.2, .9, .25, 1.3); }
.feature:hover .f-ico { transform: scale(1.18) rotate(-6deg); }
body.home-page .land h2 { background: linear-gradient(90deg, #fff 0%, #c7d2fe 45%, #f0abfc 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.faq summary { cursor: pointer; transition: color .18s; }
.faq summary:hover { color: #c4b5fd; }
.faq details[open] p { animation: rise .35s both; }
.overlay .modal { animation: pop-in .28s cubic-bezier(.2, .9, .25, 1.15); }
/* scroll reveal: only once the script marked the page (no script: everything simply shows) */
html.fx .reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s cubic-bezier(.2, .8, .2, 1), transform .7s cubic-bezier(.2, .8, .2, 1); transition-delay: var(--rd, 0ms); }
html.fx .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html.fx .reveal { opacity: 1; transform: none; }
}

/* Live TV controls without flicker: the video and the controls keep their own layers, and the
   controls fade instead of being taken out of the page (switching display over a playing video made
   the browser rebuild the video's layer each time, which flashed) */
.tvp-stage video { transform: translateZ(0); backface-visibility: hidden; }
.tvp-hud { transition: opacity .22s ease, visibility 0s linear 0s; will-change: opacity; transform: translateZ(0); }
.tvp-hud[hidden] { display: flex !important; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .22s ease, visibility 0s linear .22s; }
.tvp-hud .tb { transition: background .15s; }
/* the internet speed badge: green when the best quality plays smoothly, amber when Auto stepped down */
.tpill.speed { border: 1.5px solid rgb(74 222 128 / .8); color: #bbf7d0; font-variant-numeric: tabular-nums; }
.tpill.speed.low { border-color: rgb(251 191 36 / .85); color: #fde68a; }
.speed-note { line-height: 1.5; }
.speed-note b { color: #fff; }

/* ======================================================================================
   Start page as one screen (not TV browsers): top bar · one section at a time · footer.
   The top bar's icons switch sections; a long section scrolls inside itself, no scrollbar.
   ====================================================================================== */
html:has(body.home-page:not(.tv-mode)) { height: 100%; overflow: hidden; scrollbar-width: none; }
body.home-page:not(.tv-mode) { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.home-page:not(.tv-mode) .topbar { position: relative; flex: none; gap: 10px; }
body.home-page:not(.tv-mode) main { flex: 1; min-height: 0; position: relative; overflow: hidden; }
body.home-page:not(.tv-mode) main > section[id] {
  position: absolute; inset: 0; width: auto; max-width: none; margin: 0; overflow-y: auto; overflow-x: hidden;
  padding: clamp(16px, 4vh, 40px) max(16px, calc((100% - 1040px) / 2)); scrollbar-width: none; overscroll-behavior: contain;
  display: none; align-content: start;
}
body.home-page:not(.tv-mode) main > section[id]::-webkit-scrollbar { display: none; }
body.home-page:not(.tv-mode) main > section[id].view-on { display: grid; animation: view-in .38s cubic-bezier(.2, .8, .2, 1); }
body.home-page:not(.tv-mode) main > section#home.view-on { min-height: 0; place-content: center; align-content: center; padding-top: 8px; padding-bottom: 8px; }
@keyframes view-in { from { opacity: 0; transform: translateY(14px); } }
/* everywhere: no scrollbar showing (the page still scrolls where it must) */
body.home-page * { scrollbar-width: none; }
body.home-page *::-webkit-scrollbar { width: 0; height: 0; }

/* the section icons in the top bar */
.topnav { display: flex; align-items: center; gap: 2px; margin-left: 6px; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.topnav .nav-ico {
  position: relative; display: inline-flex; align-items: center; gap: 7px; width: auto; height: 38px; padding: 0 10px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 600; white-space: nowrap; flex: none;
  transition: color .18s, background .18s, transform .18s;
}
.topnav .nav-ico svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.topnav .nav-ico:hover { color: var(--text); background: rgb(255 255 255 / .06); transform: translateY(-1px); }
.topnav .nav-ico.on { color: #fff; background: linear-gradient(135deg, rgb(59 130 246 / .28), rgb(217 70 239 / .26)); box-shadow: inset 0 0 0 1px rgb(143 124 255 / .4); }
.topnav .nav-ico.on::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 2px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, #22d3ee, #d946ef); }
@media (max-width: 1100px) { .topnav .nav-ico span { display: none; } .topnav .nav-ico { padding: 0 9px; } }
@media (max-width: 560px) { body.home-page .topbar .brand span { display: none; } .topnav { margin-left: 0; } .topnav .nav-ico { padding: 0 7px; height: 36px; } }

/* when section links no longer fit: hide topnav, show menu → sidebar */
.topbar.nav-in-drawer .topnav { display: none; }
.nav-menu-btn { flex: none; }
.nav-menu-btn svg { width: 22px; height: 22px; fill: currentColor; }
.home-drawer {
  position: fixed; inset: 0; z-index: 80; display: flex; justify-content: flex-start;
  pointer-events: none;
}
.home-drawer:not([hidden]) { pointer-events: auto; }
.home-drawer[hidden] { display: none !important; }
.home-drawer-scrim {
  position: absolute; inset: 0; border: 0; padding: 0; margin: 0; cursor: pointer;
  background: rgb(0 0 0 / .48); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  animation: drawer-scrim .2s ease;
}
.home-drawer-panel {
  position: relative; z-index: 1; width: min(300px, 86vw); height: 100%;
  display: flex; flex-direction: column; gap: 4px; padding: max(12px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg, #050818) 92%, #1a1040); border-right: 1px solid rgb(255 255 255 / .1);
  box-shadow: 12px 0 40px rgb(0 0 0 / .35); animation: drawer-in .22s cubic-bezier(.2, .8, .2, 1);
  overflow-y: auto; overscroll-behavior: contain;
}
.home-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 12px; }
.home-drawer-head strong { font-size: 15px; }
.home-drawer-head .icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.drawer-link {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  color: var(--text); text-decoration: none; font-weight: 650; font-size: 15px;
  transition: background .15s, color .15s;
}
.drawer-link svg { width: 22px; height: 22px; fill: currentColor; flex: none; opacity: .85; }
.drawer-link:hover, .drawer-link:focus-visible { background: rgb(255 255 255 / .06); outline: none; }
.drawer-link.on { background: linear-gradient(135deg, rgb(59 130 246 / .28), rgb(217 70 239 / .22)); color: #fff; }
body.drawer-open { overflow: hidden; }
@keyframes drawer-in { from { transform: translateX(-12px); opacity: .6; } }
@keyframes drawer-scrim { from { opacity: 0; } }

@media (max-width: 480px) {
  body.home-page .install-btn span { display: none; }
  body.home-page .install-btn { padding-inline: 10px; }
  .app-card-actions { grid-template-columns: 1fr; }
  .app-cards { grid-template-columns: 1fr; }
  body.home-page:not(.tv-mode) .home-apps { grid-template-columns: 1fr; }
}

/* home: the hero, then every option in one row, then the apps in one row (fits one screen) */
body.home-page:not(.tv-mode) .home-mark { width: clamp(64px, 15vh, 130px); }
body.home-page:not(.tv-mode) .home { gap: clamp(12px, 3vh, 30px); }
@media (max-height: 640px) { .home-tag, #app-ver-line { display: none; } }
@media (max-height: 520px) { .home-apps { display: none; } }

/* the footer: the developer, always at the bottom */
body.home-page:not(.tv-mode) .site-foot {
  flex: none; width: 100%; max-width: none; margin: 0; padding: 8px max(16px, calc((100% - 1040px) / 2)) max(8px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; font-size: 12.5px; border-top: 1px solid rgb(255 255 255 / .08);
  background: rgb(5 8 24 / .72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.site-foot .foot-brand { font-weight: 700; color: var(--text); }
.site-foot .foot-dev { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-foot a, .site-foot .link-btn { color: var(--muted); text-decoration: none; white-space: nowrap; transition: color .15s; }
.site-foot a:hover, .site-foot .link-btn:hover { color: var(--text); }
@media (max-width: 640px) { .site-foot .foot-tag, .site-foot #foot-mail { display: none; } }

/* the Developer section */
.dev-card { display: flex; gap: 18px; align-items: center; padding: 20px; border-radius: 20px; border: 1px solid rgb(255 255 255 / .1); background: rgb(255 255 255 / .04); }
.dev-mark { width: 72px; height: 72px; flex: none; border-radius: 22px; display: grid; place-items: center; font: 800 26px/1 system-ui, sans-serif; color: #fff;
  background: linear-gradient(135deg, #22d3ee, #8b5cf6 55%, #d946ef); box-shadow: 0 12px 34px rgb(139 92 246 / .4); }
.dev-info h3 { margin: 0 0 4px; font-size: 20px; }
.dev-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dev-links .btn { text-decoration: none; }
@media (max-width: 560px) { .dev-card { flex-direction: column; text-align: center; } .dev-links { justify-content: center; } }
/* home (phone and desktop browsers): the room buttons, the options and the apps share one column width and one card look */
body.home-page:not(.tv-mode) { --home-w: min(480px, 100%); }
body.home-page:not(.tv-mode) .home-actions { grid-auto-flow: column; grid-auto-columns: 1fr; width: var(--home-w); }
body.home-page:not(.tv-mode) .home-actions .btn.big { min-height: 52px; }
body.home-page:not(.tv-mode) .home-features { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; width: var(--home-w); margin: 0; flex: none; }
body.home-page:not(.tv-mode) .home-features[hidden] { display: none; }
body.home-page:not(.tv-mode) .home-apps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: var(--home-w); }
body.home-page:not(.tv-mode) .home-features .tv-card,
body.home-page:not(.tv-mode) .app-pill {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; row-gap: 1px; align-items: center; justify-items: start;
  width: auto; min-width: 0; max-width: none; min-height: 58px; padding: 10px 12px; margin: 0; text-align: left; text-decoration: none; color: var(--text);
  border: 1px solid rgb(255 255 255 / .13); border-radius: 16px; background: rgb(255 255 255 / .05); cursor: pointer; font: inherit;
  transition: transform .2s, border-color .2s, background .2s, box-shadow .2s;
}
body.home-page:not(.tv-mode) .home-features .tv-card:hover,
body.home-page:not(.tv-mode) .app-pill:hover { transform: translateY(-2px); border-color: rgb(143 124 255 / .55); background: rgb(143 124 255 / .1); box-shadow: 0 10px 28px rgb(91 61 245 / .25); }
body.home-page:not(.tv-mode) .home-features .tv-card-ico,
body.home-page:not(.tv-mode) .app-pill > span:first-child { grid-row: 1 / span 2; font-size: 24px; line-height: 1; }
body.home-page:not(.tv-mode) .app-pill > span:last-child { display: contents; }
body.home-page:not(.tv-mode) .home-features .tv-card strong,
body.home-page:not(.tv-mode) .app-pill b { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.home-page:not(.tv-mode) .home-features .tv-card .muted,
body.home-page:not(.tv-mode) .app-pill small { grid-column: 2; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* phones: the options as icon-over-label tiles, the apps as one line each */
@media (max-width: 520px) {
  body.home-page:not(.tv-mode) .home-features .tv-card { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 10px 6px; row-gap: 4px; }
  body.home-page:not(.tv-mode) .home-features .tv-card-ico { grid-row: auto; }
  body.home-page:not(.tv-mode) .home-features .tv-card .muted { display: none; }
  body.home-page:not(.tv-mode) .home-features .tv-card strong { grid-column: 1; }
  body.home-page:not(.tv-mode) .app-pill { padding: 8px 10px; min-height: 52px; }
  body.home-page:not(.tv-mode) .app-pill > span:first-child { font-size: 20px; }
  body.home-page:not(.tv-mode) .app-pill small { display: none; }
  body.home-page:not(.tv-mode) .app-pill b { grid-row: 1 / span 2; }
}
/* the heading over the app downloads: a small label with a line either side, close to its buttons */
body.home-page:not(.tv-mode) .home-apps-title {
  display: flex; align-items: center; gap: 12px; width: var(--home-w); margin: 4px 0 calc(-1 * clamp(4px, 2vh, 20px));
  font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: #c3c8ec;
}
body.home-page:not(.tv-mode) .home-apps-title::before,
body.home-page:not(.tv-mode) .home-apps-title::after { content: ""; flex: 1; height: 1px; background: rgb(255 255 255 / .14); }
body.home-page:not(.tv-mode) .home-apps-title[hidden] { display: none; }
@media (max-height: 520px) { .home-apps-title { display: none !important; } }

/* ---------- settings panels: one screen, help behind an icon, − value + ---------- */
.hint-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; vertical-align: middle; }
.hint-btn svg { fill: currentColor; }
.hint-btn:hover { color: var(--text); background: var(--surface-2); }
#hint-pop { position: fixed; z-index: 90; max-width: min(300px, calc(100vw - 16px)); padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 13px; line-height: 1.4; box-shadow: 0 10px 34px rgb(0 0 0 / .35); }
.step-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 6px 0; }
.step-row + .step-row { border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.step-label { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 14px; }
.step-ctl { display: flex; align-items: center; gap: 6px; }
.step-ctl output { min-width: 92px; text-align: center; font-size: 14px; font-weight: 650; }
.step-btn { width: 40px; height: 40px; flex: none; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; touch-action: manipulation; user-select: none; }
.step-btn:active { background: var(--accent-soft, var(--surface)); }
.vol-ctl { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 6px; }
.vol-ctl output { font-size: 12px; min-width: 38px; text-align: right; }
.vol-ctl .step-btn { width: 32px; height: 32px; font-size: 17px; border-radius: 9px; }
.field-label { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); font-weight: 550; margin: -6px 0; }
.field-pair { display: flex; flex-wrap: wrap; gap: 0 16px; }
.session-end { justify-content: space-between; gap: 8px; margin-top: 4px; }
.guide { gap: 2px; font-size: 14px; }
.guide li { padding: 1px 0; }
.spk-hint { display: flex; justify-content: flex-end; }
.modal-heading #sub-hint { flex: none; }
.sub-wrap .modal-body { padding: 14px 18px 16px; }
@media (max-width: 720px) {
  .eq-cards { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .eq-cards .eq-card { flex: 0 0 84px; }
  .eqp { gap: 8px; }
  .eqp-graph { display: none; }
  .eqp-sliders { padding: 6px 4px; }
  .eqs input[type="range"] { height: 120px; }
}

/* full screen without the browser's own (no tap yet): the room's bars stay out of the picture */
body.player-fs > header, body.player-fs nav, body.player-fs .sound-hint ~ header { visibility: hidden; }
/* visualizer full screen: the song and its progress stay on screen; only the buttons fade when idle */
.canvas.viz-on .player.is-fs.idle > .np-meta, .canvas.viz-on .player.is-fs.idle > .progress { opacity: 1; }
.canvas.viz-on .player.is-fs > .np-meta h2 { font-size: clamp(20px, 2.6vw, 34px); }

/* ---- the record, as in the app: no card behind it, the cover as the label in a lit ring, the app's tonearm ---- */
.np-art:has(> .art-gen.has-disc) { background: transparent; box-shadow: none; overflow: visible; aspect-ratio: 1 / 1; width: min(100%, calc(100dvh - 380px), 560px); }
.art-gen.has-disc { background: transparent !important; }
.art-gen.has-disc > .initials, .art-gen.has-disc > svg.wave { display: none; }
.art-gen.has-disc.yt-thumb::after { display: none; }
.deck { position: relative; width: 100%; aspect-ratio: 1; }
.disc {
  position: absolute; left: 0; top: 7%; width: 86%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, transparent 60%, rgb(255 255 255 / .05) 61%, transparent 62%), repeating-radial-gradient(circle, #101114 0 1.2px, #191a1f 1.8px 3.2px);
  box-shadow: 0 18px 50px rgb(0 0 0 / .55), inset 0 0 0 2px rgb(255 255 255 / .12);
  display: grid; place-items: center; animation: disc-spin 3.6s linear infinite; animation-play-state: paused;
}
.disc::after { content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; background: conic-gradient(from 40deg, transparent 0 10%, rgb(255 255 255 / .09) 15%, transparent 21% 60%, rgb(255 255 255 / .07) 65%, transparent 71%); }
.disc-label { width: 62%; aspect-ratio: 1; border-radius: 50%; background-color: #070910; box-shadow: 0 0 0 3px #19d8ff, 0 0 18px rgb(25 216 255 / .35); }
.disc-hole { position: absolute; width: 3.2%; aspect-ratio: 1; border-radius: 50%; background: #d8dce4; }
.np-art.spinning .disc { animation-play-state: running; }
@keyframes disc-spin { to { transform: rotate(360deg); } }
/* the app's arm picture (pivot at 20.5% 52.3% of it), hanging down beside the record; it swings onto it while playing */
.tonearm { position: absolute; left: 65.9%; top: 3.1%; width: 75%; transform-origin: 20.47% 52.3%; transform: rotate(78deg); transition: transform .9s cubic-bezier(.3,.7,.3,1); pointer-events: none; filter: drop-shadow(4px 8px 8px rgb(0 0 0 / .5)); z-index: 2; }
.np-art.spinning .tonearm { transform: rotate(86deg); }
@media (prefers-reduced-motion: reduce) { .disc { animation: none; } }

/* ---- AUTO MIX (host) beside the song, and its settings as an overlay over the player ---- */
.am-row { display: flex; align-items: center; gap: 6px; margin-top: 10px; justify-content: center; }
.am-btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 12px; border: 0; cursor: pointer; font: 600 14px/1 system-ui, sans-serif; color: var(--text); background: color-mix(in srgb, var(--accent, #19d8ff) 22%, var(--surface-2)); }
.am-btn svg { width: 18px; height: 18px; color: #19d8ff; }
.am-btn.on { color: #2be38b; box-shadow: inset 0 0 0 1.5px #2be38b; }
.am-btn.on svg { color: #2be38b; }
.am-gear { width: 38px; height: 38px; border-radius: 50%; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.am-gear svg { width: 22px; height: 22px; fill: currentColor; }
.am-ov { position: fixed; inset: 0; z-index: 90; background: rgb(0 0 0 / .66); display: grid; place-items: center; padding: 18px; animation: am-in .18s ease-out; }
@keyframes am-in { from { opacity: 0; } }
.am-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px 18px 18px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.am-head { display: flex; align-items: center; justify-content: space-between; font-size: 19px; }
.am-x { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; width: 36px; height: 36px; }
.am-card p { margin: 0; font-size: 13.5px; }
.am-wide { width: 100%; }
.am-lbl { font-size: 13px; margin-top: 4px; }
.am-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
/* auto mix on the seek bar: purple where the next song comes in, green where this one stops, dim after */
.progress { position: relative; }
.mix-mark { position: absolute; top: 0; height: 24px; background: rgb(177 76 255 / .3); border-left: 2px solid #b14cff; border-right: 2px solid #2be38b; pointer-events: none; z-index: 1; border-radius: 2px; }
.mix-mark::after { content: ""; position: absolute; left: 100%; top: 0; bottom: 0; width: var(--rest, 0); background: rgb(0 0 0 / .35); }

/* ---- player fixes: the whole song name, a record that fits (arm included), bigger on desktop ---- */
.np-meta h2 { white-space: normal; overflow: visible; text-overflow: clip; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.2; overflow-wrap: anywhere; }
.np-art:has(> .art-gen.has-disc) { width: min(100%, calc(100dvh - 300px), 520px); min-width: min(100%, 240px); }
.deck { transform: scale(.88); transform-origin: 50% 58%; margin-top: 4%; }
@media (min-width: 721px) { .np-art:has(> .art-gen.has-disc) { width: min(100%, calc(100dvh - 160px), 520px); } }
.mix-mark { top: 50%; transform: translateY(-50%); }
@media (max-width: 720px) and (orientation: portrait) { .player:not(.is-fs) { padding-bottom: 34px; } }
