@font-face {
  font-family: 'Orbitron';
  src: url('/assets/fonts/orbitron-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Orbitron';
  src: url('/assets/fonts/orbitron-latin-900-normal.woff2') format('woff2');
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: 'Rajdhani';
  src: url('/assets/fonts/rajdhani-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Rajdhani';
  src: url('/assets/fonts/rajdhani-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #05060f;
  --bg2: #0b0e22;
  --panel: rgba(14, 18, 42, 0.78);
  --line: rgba(120, 160, 255, 0.16);
  --text: #e9f0ff;
  --muted: #8b96c2;
  --blue: #29e3ff;
  --blue-d: #0b8fd6;
  --red: #ff2f6d;
  --red-d: #c4134a;
  --violet: #9b5cff;
  --gold: #ffd166;
  --display: 'Orbitron', 'Segoe UI', system-ui, sans-serif;
  --body: 'Rajdhani', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --radius: 16px;
  /* Spacing scale: panels, stacks and menus all use these. */
  --gap-sm: 10px;
  --gap: 14px;
  --gap-menu: 12px;
  --tap: 44px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-weight: 500;
  font-size: 17px;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

button { font: inherit; color: inherit; }
input { font: inherit; user-select: text; -webkit-user-select: text; }
.hidden { display: none !important; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 14px; }

/* ------------------------------------------------------------ background */
#bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.bg-grid {
  position: absolute;
  left: -50%; right: -50%; bottom: -10%; height: 70%;
  background-image:
    linear-gradient(rgba(41, 227, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(155, 92, 255, 0.22) 1px, transparent 1px);
  background-size: 60px 60px;
  transform: perspective(420px) rotateX(62deg);
  transform-origin: 50% 0;
  mask-image: linear-gradient(to bottom, transparent, #000 35%, #000 70%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 35%, #000 70%, transparent);
  animation: grid-move 6s linear infinite;
}
@keyframes grid-move { to { background-position: 0 60px, 0 60px; } }
.bg-glow { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(40px); opacity: 0.35; }
.bg-glow-a { left: -25vmax; top: -30vmax; background: radial-gradient(circle, rgba(41, 227, 255, 0.55), transparent 60%); animation: drift 14s ease-in-out infinite alternate; }
.bg-glow-b { right: -25vmax; bottom: -35vmax; background: radial-gradient(circle, rgba(255, 47, 109, 0.5), transparent 60%); animation: drift 17s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.08); } }
body.in-game #bg { display: none; }

@media (prefers-reduced-motion: reduce) {
  .bg-grid, .bg-glow { animation: none; }
}

/* ------------------------------------------------------------ screens */
#app { position: fixed; inset: 0; }
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.985);
  transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.32s;
  overflow-y: auto;
}
.screen.active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s;
}

.panel {
  width: min(440px, 100%);
  margin: auto;
  padding: 26px 24px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(22, 28, 64, 0.85), rgba(10, 12, 30, 0.88));
  border: 1px solid var(--line);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02) inset, 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 60px rgba(41, 227, 255, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  text-align: center;
}
/* A vertical group inside a panel that keeps the panel's rhythm (and
   stretches buttons, which otherwise shrink to their content). */
.stack { display: flex; flex-direction: column; gap: var(--gap); }
h2 {
  font-family: var(--display);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 22px;
  margin: 0 0 4px;
  background: linear-gradient(90deg, var(--blue), #fff 50%, var(--red));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ------------------------------------------------------------ logo */
.logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 6px; }
.logo h1 { margin: 0; display: flex; flex-direction: column; line-height: 1; }
.logo-neon {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(44px, 12vw, 62px);
  letter-spacing: 0.14em;
  color: #fff;
  text-shadow: 0 0 6px var(--blue), 0 0 18px var(--blue), 0 0 42px rgba(41, 227, 255, 0.6);
  animation: flicker 6s infinite;
}
.logo-sub {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(14px, 4vw, 18px);
  letter-spacing: 0.55em;
  margin-top: 8px;
  padding-left: 0.55em;
  color: var(--red);
  text-shadow: 0 0 10px rgba(255, 47, 109, 0.8);
}
/* Easter egg (egg.js): hold "NEON" and it charges up, glowing brighter the
   longer it is held (--charge 0..1), then fades back when released. */
.logo-neon {
  --charge: 0;
  display: inline-block;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.logo-neon.charged {
  animation: none;
  color: #fff;
  text-shadow:
    0 0 calc(2px + 6px * var(--charge)) #fff,
    0 0 calc(6px + 14px * var(--charge)) var(--blue),
    0 0 calc(18px + 46px * var(--charge)) var(--blue),
    0 0 calc(42px + 110px * var(--charge)) rgba(41, 227, 255, calc(0.6 + 0.4 * var(--charge))),
    0 0 calc(180px * var(--charge)) rgba(155, 92, 255, var(--charge));
  filter: brightness(calc(1 + 0.8 * var(--charge))) saturate(calc(1 + 0.5 * var(--charge)));
  transform: scale(calc(1 + 0.06 * var(--charge)));
}
body.reduce-fx .logo-neon.charged { transform: none; }
@keyframes flicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.55; }
  94% { opacity: 1; }
  96% { opacity: 0.7; }
}
/* Easter egg: the puck is a joystick (egg.js). The base ring shows while held. */
.logo-stick { position: relative; width: 54px; height: 54px; perspective: 200px; }
.logo-stick::before {
  content: ''; position: absolute; inset: -14px; border-radius: 50%;
  background: radial-gradient(circle, #1a2040 0 45%, #2c3566 46% 58%, #11152e 59% 70%, transparent 71%);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(160, 180, 255, 0.25);
  opacity: 0; transform: scale(0.6);
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.logo-stick.held::before { opacity: 1; transform: scale(1); }
.logo-stick .logo-puck { position: relative; touch-action: none; cursor: grab; will-change: transform; }
.logo-stick.held .logo-puck { animation: none; cursor: grabbing; }
.logo-stick.springing .logo-puck { animation: none; transition: transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1); }
body.reduce-fx .logo-stick.springing .logo-puck { transition: none; }
.logo-puck {
  width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #b9c6ff 30%, #2a2f55 70%);
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.5), 0 0 0 4px rgba(41, 227, 255, 0.35), 0 0 0 9px rgba(255, 47, 109, 0.18);
  animation: puck-spin 3.6s ease-in-out infinite;
}
@keyframes puck-spin { 50% { transform: translateY(-6px); box-shadow: 0 0 32px rgba(255, 255, 255, 0.6), 0 0 0 5px rgba(255, 47, 109, 0.4), 0 0 0 11px rgba(41, 227, 255, 0.2); } }

/* ------------------------------------------------------------ controls */
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.field-label { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
input[type=text] {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type=text]:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(41, 227, 255, 0.18); }
.code-input {
  text-align: center;
  font-family: var(--display) !important;
  font-size: 34px !important;
  letter-spacing: 0.4em;
  padding-left: 0.4em !important;
  text-transform: uppercase;
}
.error-text { min-height: 20px; margin: 0; color: var(--red); font-weight: 700; }

.menu { display: flex; flex-direction: column; gap: var(--gap-menu); }
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-menu); }

.btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(140, 170, 255, 0.22);
  background: linear-gradient(180deg, rgba(40, 48, 100, 0.75), rgba(20, 24, 56, 0.85));
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, border-color 0.2s ease, filter 0.2s;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.12) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.btn:hover::after { transform: translateX(100%); }
.btn:hover { border-color: rgba(41, 227, 255, 0.55); box-shadow: 0 0 22px rgba(41, 227, 255, 0.15); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; filter: grayscale(0.5); }
.btn-title { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; }
.btn-sub { font-size: 14px; color: var(--muted); }
.btn-primary {
  border-color: rgba(41, 227, 255, 0.7);
  background: linear-gradient(135deg, #10a8e8, #6a3df0 55%, #e0215c);
  box-shadow: 0 8px 30px rgba(106, 61, 240, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}
.btn-primary .btn-sub { color: rgba(255, 255, 255, 0.82); }
.btn-primary:hover { box-shadow: 0 10px 40px rgba(106, 61, 240, 0.55), 0 0 30px rgba(41, 227, 255, 0.3); }
.btn-ghost { background: transparent; border-color: rgba(140, 170, 255, 0.14); }
.btn-small { min-height: 38px; padding: 8px 14px; font-weight: 700; font-size: 15px; }
.btn-primary.is-on { background: linear-gradient(135deg, #12c98a, #0fa5c9); border-color: #3cffc0; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg-wrap { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
.seg button {
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.18s ease;
}
.seg button.on {
  border-color: var(--blue);
  background: rgba(41, 227, 255, 0.14);
  box-shadow: 0 0 18px rgba(41, 227, 255, 0.25), 0 0 0 1px rgba(41, 227, 255, 0.4) inset;
  color: #fff;
}

.icon-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(10, 14, 34, 0.7);
  cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; fill: var(--text); stroke: var(--text); stroke-width: 0; }
.icon-btn .snd-wave { fill: none; stroke-width: 2; stroke-linecap: round; }
.icon-btn .orient-dev { fill: none; stroke-width: 2; transition: transform 0.3s ease; transform-origin: 12px 12px; }
.icon-btn .orient-arrow { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke: var(--blue); }
.icon-btn.is-landscape .orient-dev { transform: rotate(90deg); }
.btn-fs path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-fs .fs-out, .btn-fs.is-fs .fs-in { display: none; }
.btn-fs.is-fs .fs-out { display: inline; }
.home-footer .conn-pill { margin-left: auto; }
.home-footer { gap: 10px; }
.icon-btn.muted-on .snd-wave { opacity: 0.15; }

.home-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.conn-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.conn-pill i { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.conn-pill.ok i { background: #3cffa0; box-shadow: 0 0 8px #3cffa0; }
.conn-pill.bad i { background: var(--red); box-shadow: 0 0 8px var(--red); }

.resume-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid rgba(255, 209, 102, 0.4);
  background: rgba(255, 209, 102, 0.08);
}

/* ------------------------------------------------------------ lobby */
.lobby-panel { width: min(520px, 100%); }
.lobby-head { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.room-code {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(40px, 11vw, 56px);
  letter-spacing: 0.22em;
  padding-left: 0.22em;
  color: #fff;
  text-shadow: 0 0 12px rgba(41, 227, 255, 0.8), 0 0 30px rgba(155, 92, 255, 0.5);
}
.invite { display: flex; flex-direction: column; align-items: center; gap: var(--gap-sm); }
.invite > .btn { align-self: stretch; }

/* Copyable link: activating it copies the URL (see clipboard.js / app.js). */
.link-chip {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(41, 227, 255, 0.4);
  background: rgba(41, 227, 255, 0.06);
  color: var(--blue);
  font: 600 15px/1.3 var(--body);
  text-align: left;
  cursor: copy;
  transition: background 0.15s, border-color 0.2s, color 0.2s, transform 0.1s;
}
.link-chip .link-text {
  flex: 1; min-width: 0;
  /* One line; "…" if it doesn't fit (tapping copies the full URL). */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: underline; text-decoration-color: rgba(41, 227, 255, 0.4); text-underline-offset: 3px;
  -webkit-user-select: text; user-select: text; /* manual copy when the clipboard is unavailable */
}
.link-chip svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.link-chip .check-ico { display: none; }
.link-chip:hover { background: rgba(41, 227, 255, 0.12); }
.link-chip:active { transform: scale(0.98); }
.link-chip:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.link-chip.copied { border-style: solid; border-color: #3cffa0; color: #3cffa0; background: rgba(60, 255, 160, 0.08); }
.link-chip.copied .link-text { text-decoration-color: rgba(60, 255, 160, 0.4); }
.link-chip.copied .copy-ico { display: none; }
.link-chip.copied .check-ico { display: block; }
.link-chip-long .link-text { font: 12px/1.35 ui-monospace, Menlo, Consolas, monospace; }
/* Copy failed: show the whole URL (wrapped) so it can be selected by hand. */
.link-chip.expanded .link-text { white-space: normal; overflow-wrap: anywhere; overflow: visible; }

.slots { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 6px 0; }
.vs { font-family: var(--display); font-weight: 900; color: var(--muted); letter-spacing: 0.1em; }
.slot {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 8px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  transition: border-color 0.3s, box-shadow 0.3s, opacity 0.3s;
  min-width: 0;
}
.slot.empty { opacity: 0.55; }
/* You are always on the left: when this device is seat 1 (red), swap the cards. */
.slot-0 { order: 1; } .vs { order: 2; } .slot-1 { order: 3; }
.slots.flip .slot-0 { order: 3; } .slots.flip .slot-1 { order: 1; }
.slot-0.filled { border-color: rgba(41, 227, 255, 0.45); box-shadow: 0 0 24px rgba(41, 227, 255, 0.12) inset; }
.slot-1.filled { border-color: rgba(255, 47, 109, 0.45); box-shadow: 0 0 24px rgba(255, 47, 109, 0.12) inset; }
.slot.is-ready { box-shadow: 0 0 0 2px #3cffa0 inset, 0 0 26px rgba(60, 255, 160, 0.25); }
.avatar { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.avatar-paddle { width: 52px; height: 52px; border-radius: 50%; }
.slot-0 .avatar-paddle { background: radial-gradient(circle, #e6fdff 0 18%, var(--blue) 19% 36%, #06324a 37% 62%, var(--blue) 63% 72%, transparent 73%); box-shadow: 0 0 24px rgba(41, 227, 255, 0.6); }
.slot-1 .avatar-paddle { background: radial-gradient(circle, #ffe6ee 0 18%, var(--red) 19% 36%, #4a0620 37% 62%, var(--red) 63% 72%, transparent 73%); box-shadow: 0 0 24px rgba(255, 47, 109, 0.6); }
.slot.empty .avatar-paddle { filter: grayscale(1); opacity: 0.4; box-shadow: none; }
.slot-name { font-weight: 700; font-size: 18px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-status { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); min-height: 16px; }
.slot-status.ok { color: #3cffa0; }
.slot-status.warn { color: var(--gold); }
.lobby-msg { margin: 0; font-weight: 700; font-size: 18px; }

/* ------------------------------------------------------------ overlays */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 20; }
.overlay.modal {
  padding: 16px;
  background: rgba(3, 4, 12, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.25s ease;
}
.overlay.modal > .panel { animation: pop-in 0.35s cubic-bezier(0.2, 0.9, 0.25, 1.2); max-height: 100%; overflow-y: auto; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(16px) scale(0.94); } }
.conn-overlay { z-index: 40; }

.spinner {
  width: 46px; height: 46px; margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(41, 227, 255, 0.15);
  border-top-color: var(--blue);
  border-right-color: var(--red);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-b));
  transform: translate(-50%, 30px);
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(14, 18, 42, 0.95);
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 60;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ settings */
.settings-panel { width: min(480px, 100%); text-align: left; }
/* Back button on the left, title optically centred: the third column is an
   empty mirror of the button so the heading stays in the middle. */
.settings-head-row { display: grid; grid-template-columns: var(--tap) 1fr var(--tap); align-items: center; gap: 8px; }
.settings-head-row h2 { grid-column: 2; margin: 0; text-align: center; padding-left: 0 !important; }
.settings-head-row .icon-btn { grid-column: 1; }
.settings-head-row .icon-btn svg { width: 24px; height: 24px; fill: none; stroke: var(--text); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.settings-section { display: flex; flex-direction: column; padding-top: var(--gap-sm); border-top: 1px solid var(--line); }
.settings-head {
  margin: 0 0 2px;
  font: 700 12px/1.4 var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
/* One row = text on the left, control on the right, both vertically centred.
   Long labels/descriptions wrap inside the text column; the control stays put. */
.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  min-height: 52px;
  padding: 6px 0;
}
label.setting-row { cursor: pointer; }
.setting-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.setting-label { font-weight: 700; font-size: 16px; line-height: 1.25; color: var(--text); }
.setting-desc { font-size: 14px; line-height: 1.3; color: var(--muted); }
.setting-row-range { grid-template-columns: minmax(6.5em, auto) minmax(0, 1fr); }
.setting-row-range input { width: 100%; min-width: 0; margin: 0; height: var(--tap); accent-color: var(--blue); cursor: pointer; }
.seg-compact { min-width: 124px; gap: 6px; }
.seg-compact button { min-height: 40px; padding: 6px 12px; }
.settings-footer { display: flex; flex-direction: column; gap: var(--gap-sm); padding-top: var(--gap); border-top: 1px solid var(--line); text-align: center; }
.settings-footer p { margin: 0; }

/* Switch: a native checkbox (keyboard, screen readers, label clicks all work). */
.switch {
  appearance: none; -webkit-appearance: none;
  position: relative; flex: none;
  width: 48px; height: 28px; margin: 0;
  border-radius: 14px;
  background: rgba(140, 170, 255, 0.18);
  border: 1px solid rgba(140, 170, 255, 0.28);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.switch::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #cfd8ff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, background 0.2s;
}
.switch:checked { background: linear-gradient(135deg, var(--blue-d), var(--violet)); border-color: rgba(41, 227, 255, 0.6); }
.switch:checked::after { transform: translateX(20px); background: #fff; }
.switch:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
body.reduce-fx .switch, body.reduce-fx .switch::after { transition: none; }

/* ------------------------------------------------------------ voice chat */
.btn-mic svg { width: 22px; height: 22px; }
.btn-mic .mic-body { fill: none; stroke: var(--text); stroke-width: 2; }
.btn-mic .mic-stand { fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.btn-mic .mic-slash { stroke: var(--red); stroke-width: 2.2; stroke-linecap: round; }
.btn-mic.on .mic-slash { display: none; }
.btn-mic.on { border-color: #3cffa0; box-shadow: 0 0 0 1px rgba(60, 255, 160, 0.35) inset; }
.btn-mic.on .mic-body { fill: rgba(60, 255, 160, 0.25); stroke: #3cffa0; }
.btn-mic.on .mic-stand { stroke: #3cffa0; }
.btn-mic.talking { box-shadow: 0 0 0 2px #3cffa0 inset, 0 0 18px rgba(60, 255, 160, 0.55); }
.btn-mic.busy { opacity: 0.6; }
.btn-mic-wide { flex-direction: row; gap: 8px; }
.voice-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.slot.speaking .avatar { box-shadow: 0 0 0 3px #3cffa0, 0 0 24px rgba(60, 255, 160, 0.6); border-radius: 50%; }
.slot .mic-badge { font-size: 12px; letter-spacing: 0.1em; color: #3cffa0; text-transform: uppercase; min-height: 14px; }

/* ------------------------------------------------------------ reduced effects
 * Settings → "Reduce effects", or the OS "reduce motion" preference. */
body.reduce-fx #bg .bg-glow { display: none; }
body.reduce-fx .bg-grid,
body.reduce-fx .logo-neon,
body.reduce-fx .logo-puck,
body.reduce-fx .hud-name.speaking::after { animation: none !important; }
body.reduce-fx .panel,
body.reduce-fx .overlay.modal { backdrop-filter: none; -webkit-backdrop-filter: none; }
body.reduce-fx .panel { background: rgba(14, 18, 42, 0.97); }
body.reduce-fx .overlay.modal { background: rgba(3, 4, 12, 0.82); }
body.reduce-fx .overlay.modal,
body.reduce-fx .overlay.modal > .panel { animation: none; }
body.reduce-fx .screen,
body.reduce-fx .screen.active { transform: none; transition: opacity 0.12s linear, visibility 0s; }
body.reduce-fx .btn::after { display: none; }
body.reduce-fx .btn { transition: none; }
body.reduce-fx .hud-score.bump { animation: none; }
body.reduce-fx .countdown span.tick { animation: fx-fade 0.9s linear both; }
body.reduce-fx .goal-banner span { animation: fx-fade 0.85s linear both; }
@keyframes fx-fade { 0% { opacity: 0; } 10% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }

.btn-settings { flex-direction: row; gap: 8px; }
.btn-settings svg { width: 20px; height: 20px; }
.btn-settings .gear { fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linejoin: round; }

.btn-listen svg { width: 22px; height: 22px; }
.btn-listen .ear { fill: none; stroke: var(--text); stroke-width: 2; stroke-linejoin: round; }
.btn-listen .mic-slash { stroke: var(--red); stroke-width: 2.2; stroke-linecap: round; display: none; }
.btn-listen.deaf .mic-slash { display: inline; }
.btn-listen.deaf .ear { stroke: var(--muted); }
.btn-listen.hearing { box-shadow: 0 0 0 2px #3cffa0 inset, 0 0 14px rgba(60, 255, 160, 0.45); }

/* ------------------------------------------------------------ LAN */
.btn-lan { border-color: rgba(255, 209, 102, 0.45); background: linear-gradient(180deg, rgba(60, 50, 20, 0.6), rgba(28, 24, 12, 0.8)); }
.btn-lan .btn-title { color: #ffe2a0; }
.lan-panel { width: min(460px, 100%); }
.lan-mode { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10, 14, 34, 0.45); }
.lan-mode p { margin: 0; }
.lan-mode-title { font-weight: 700; color: #ffe2a0; }
.lan-mode.server .lan-mode-title { color: #3cffa0; }
.lan-pair { display: flex; flex-direction: column; align-items: center; gap: var(--gap-sm); }
.lan-pair > .btn { align-self: stretch; }
/* Host pairing: the QR code and the camera share one square, so step 2
   replaces step 1 in place instead of appearing below it. The square fits
   short (landscape) screens too. */
.lan-stage { --stage: min(260px, 100%, 52vh); width: var(--stage); aspect-ratio: 1; display: grid; place-items: center; }
.lan-stage > * { grid-area: 1 / 1; }
.lan-stage canvas.qr { width: var(--stage) !important; height: var(--stage) !important; }
.lan-stage .scan-box { width: var(--stage); max-width: none; }
.lan-pair.is-scanning #lan-offer-qr { visibility: hidden; }
.lan-steps { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lan-step-dot { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font: 700 13px/1 var(--display); color: var(--muted); border: 1px solid var(--line); }
.lan-step-dot.on { color: #05060f; background: var(--blue); border-color: var(--blue); box-shadow: 0 0 12px rgba(41, 227, 255, 0.5); }
.lan-step-dot.done { color: #3cffa0; border-color: rgba(60, 255, 160, 0.5); }
.lan-step { margin: 0; font-size: 15px; line-height: 1.35; }
canvas.qr { background: #fff; border-radius: 10px; padding: 0; max-width: 100%; image-rendering: pixelated; }
.scan-box { position: relative; width: min(100%, 320px, 52vh); aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #000; margin: 0 auto; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 14%; border: 3px solid rgba(60, 255, 160, 0.85); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.25); }
.lan-manual { text-align: left; font-size: 14px; color: var(--muted); width: 100%; }
.lan-manual summary { cursor: pointer; padding: 4px 0; }
.lan-manual textarea, .lan-manual input { width: 100%; margin: 6px 0; font: 12px/1.3 ui-monospace, Menlo, Consolas, monospace; color: var(--text); background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.lan-manual textarea { height: 70px; resize: none; }
.conn-pill.lan i { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.ok-text { color: var(--green, #3cffa0); }
#pause-lan-slot .lan-pair { margin: 8px 0 12px; }
#ov-pause .panel { max-height: 92vh; overflow-y: auto; }
