:root {
  /* Paper Cutout: warm paper ground, thick ink outlines, hard offset shadows, riso pink / blue / yellow */
  --bg: #f6efe3;
  --bg-2: #efe6d6;
  --surface: #fffaf2;
  --surface-2: #ffffff;
  --line: #d9ccb6;
  --ink: #1f1a17;
  --text: #1f1a17;
  --muted: #5e5249;
  --dim: #6d6158;
  --accent: #2f5bea;
  --accent-deep: #1e3fb8;
  --accent-soft: #dfe7ff;
  --accent-line: #8fa8f5;
  --peach: #ff5c8a;
  --peach-ink: #1f1a17;
  --butter: #ffc93c;
  --butter-ink: #1f1a17;
  --good: #1f9d6b;
  --danger: #d6334a;
  --danger-soft: #ffe0e3;
  --danger-ink: #8a1f2b;
  --sky: #dfe7ff;
  --sky-ink: #1e3fb8;
  --rose: #ffe0e9;
  --rose-ink: #8a1f3d;
  --band-2: #ffe08a;
  --band-3: #ffa3bd;
  --band-4: #ff5c8a;
  --band-ink: #1f1a17;
  --pts-4: #e0245e;
  --pts-3: #2f5bea;
  --pts-2: #a87400;
  --face: #ffffff;
  --face-2: #fdf8ef;
  --tick: rgba(31, 26, 23, 0.22);
  --tick-major: rgba(31, 26, 23, 0.5);
  --on-accent: #ffffff;
  --on-pastel: #1f1a17;
  --glass: rgba(246, 239, 227, 0.92);
  --wash: rgba(255, 255, 255, 0.6);
  --scrim: rgba(31, 26, 23, 0.4);
  --edge: #1f1a17;
  --drop: #1f1a17;
  --radius: 22px;
  --radius-sm: 16px;
  --puff: 0 0 0 2.5px var(--edge), 5px 5px 0 2.5px var(--drop);
  --puff-sm: 0 0 0 2px var(--edge), 3px 3px 0 2px var(--drop);
  --puff-press: 0 0 0 2.5px var(--edge), 1px 1px 0 2.5px var(--drop);
  --shadow: var(--puff);
  --font: 'Bricolage Grotesque', ui-rounded, 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --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);
  color-scheme: light;
}

/* Dark: the same cut paper laid on a dark ink table. Opt-in from the theme toggle (public/theme.js). */
:root[data-theme='dark'] {
    --bg: #1d1916;
    --bg-2: #26211d;
    --surface: #2a2420;
    --surface-2: #342d28;
    --line: #51463d;
    --ink: #f6efe3;
    --text: #f6efe3;
    --muted: #cdbfae;
    --dim: #ab9b8b;
    --accent: #7d9bff;
    --accent-deep: #b9c9ff;
    --accent-soft: #253058;
    --accent-line: #5a74d6;
    --peach: #ff6f98;
    --butter: #ffc93c;
    --good: #3fcf94;
    --danger: #ff6b7c;
    --danger-soft: #4a1f26;
    --danger-ink: #ffc9cf;
    --sky: #23305e;
    --sky-ink: #c8d5ff;
    --rose: #4d2230;
    --rose-ink: #ffc2d3;
    --pts-4: #ff6f98;
    --pts-3: #8fa8ff;
    --pts-2: #ffc93c;
    --face: #2c2622;
    --face-2: #312a25;
    --tick: rgba(246, 239, 227, 0.22);
    --tick-major: rgba(246, 239, 227, 0.5);
    --glass: rgba(29, 25, 22, 0.92);
    --wash: rgba(255, 255, 255, 0.06);
    --scrim: rgba(0, 0, 0, 0.55);
    --edge: #0c0a09;
    --drop: #0c0a09;
    color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button,
a,
label,
select,
summary,
input[type='checkbox'] {
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

/* ---------- layout ---------- */

.app {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px calc(16px + var(--safe-r)) calc(28px + var(--safe-b)) calc(16px + var(--safe-l));
  /* Things that slide in from the side (the Clue Giver's cards) must not widen the page: Android zooms the whole
     screen out to fit them, then snaps back when they land, and everything on screen jumps. body's overflow-x
     does not stop that, because it belongs to the viewport. clip (unlike hidden) leaves up-and-down scrolling alone. */
  overflow-x: clip;
}
body[data-phase='home'] .app {
  padding-top: calc(20px + var(--safe-t));
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: rise 0.28s ease-out;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.row {
  display: flex;
  gap: 10px;
}
.row > .input {
  flex: 1;
  min-width: 0;
}
.center {
  text-align: center;
}

.h1 {
  font-size: clamp(26px, 7vw, 36px);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
}
.h2 {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 12px;
}
.eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.sub {
  margin: 0;
  color: var(--muted);
}
.hint {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  min-height: 1.4em;
}
.label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.counter {
  font-size: 13px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- controls ---------- */

.input,
.select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2.5px solid var(--edge);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 18px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus,
.select:focus {
  border-color: var(--accent);
  box-shadow: 3px 3px 0 var(--accent);
}
.input::placeholder {
  color: var(--dim);
}
.input-code {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
}
.input-clue {
  font-size: 20px;
  font-weight: 700;
}
.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  border: 0;
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s, opacity 0.15s;
}
.btn:active:not(:disabled) {
  transform: translate(3px, 3px);
}
.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-block {
  width: 100%;
}
.btn-xl {
  min-height: 60px;
  font-size: 20px;
}
.btn-sm {
  min-height: 44px;
  font-size: 15px;
  padding: 0 16px;
}
.btn-primary {
  background: var(--peach);
  color: var(--peach-ink);
  box-shadow: var(--puff);
}
.btn-primary:active:not(:disabled) {
  box-shadow: var(--puff-press);
}
.btn-secondary {
  background: var(--butter);
  color: var(--butter-ink);
  box-shadow: var(--puff);
}
.btn-secondary:active:not(:disabled) {
  box-shadow: var(--puff-press);
}
.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 0;
  box-shadow: var(--puff-sm);
}
.btn-ghost:active:not(:disabled),
.btn-chip:active:not(:disabled) {
  box-shadow: 0 0 0 2px var(--edge);
}
.btn-chip {
  border-radius: 999px;
  white-space: nowrap;
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
  background: var(--surface-2);
  border: 0;
  color: var(--ink);
  box-shadow: var(--puff-sm);
}
.btn-leave {
  color: var(--muted);
}
.btn-icon {
  min-height: 40px;
  min-width: 40px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  white-space: nowrap;
}
.tag-dim {
  background: var(--bg-2);
  color: var(--dim);
}
/* Practice bots: a tag beside the name, a robot face for an avatar, and the host's Add a bot row in the lobby. */
.tag-bot {
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.avatar-bot {
  font-size: 1.15em;
  letter-spacing: 0;
}
.bot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 12px;
}
.bot-row .btn-add-bot {
  flex: none;
  min-height: 44px;
  padding: 8px 16px;
  font-size: 15px;
}
.bot-row .bot-hint {
  flex: 1 1 180px;
  font-size: 13.5px;
  min-height: 0;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(8px + var(--safe-t)) calc(12px + var(--safe-r)) 8px calc(12px + var(--safe-l));
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 2.5px solid var(--edge);
}
.tb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 900px;
  margin: 0 auto;
}
.tb-spacer {
  flex: 1;
}
.tb-status {
  max-width: 900px;
  margin: 4px auto 0;
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.tb-status-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-mini {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 15px;
  color: var(--ink);
}
.gauge-mark {
  width: 28px;
  height: 18px;
}
.chip {
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--butter);
  color: var(--butter-ink);
  border: 2px solid var(--edge);
  box-shadow: 2px 2px 0 var(--drop);
  transform: rotate(-2deg);
  font-family: var(--mono);
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 14px;
}
@media (max-width: 440px) {
  .brand-mini {
    font-size: 0;
  }
  .tb-row {
    gap: 6px;
  }
  .tb-row .btn-chip {
    padding: 0 11px;
  }
  .tb-row .sound-toggle,
  .tb-row .theme-toggle {
    padding: 0;
  }
}

/* ---------- connection + toast ---------- */

/* A quiet tab that hangs under the top bar (or from the top edge at home), so it never covers the bar's controls.
   Every deploy causes a short reconnect, so it must look calm. app.js keeps --conn-top at the bar's bottom edge. */
.conn {
  position: fixed;
  z-index: 19;
  top: var(--conn-top, 0px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 12px 4px;
  border: 2.5px solid var(--edge);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.2;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  animation: conn-drop 0.25s ease-out;
}
.conn.at-edge {
  padding-top: calc(3px + var(--safe-t));
}
.conn::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: conn-spin 1s linear infinite;
}
@keyframes conn-drop {
  from {
    opacity: 0;
    transform: translate(-50%, -100%);
  }
}
@keyframes conn-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .conn,
  .conn::before {
    animation: none;
  }
}

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(20px + var(--safe-b));
  transform: translateX(-50%);
  width: min(92vw, 440px);
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--danger-soft);
  border: 0;
  color: var(--danger-ink);
  font-weight: 700;
  box-shadow: var(--shadow);
  animation: toast-in 0.2s ease-out;
}
.toast.out {
  opacity: 0;
  transition: opacity 0.2s;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
}

/* ---------- home ---------- */

.hero {
  text-align: center;
  padding: 8px 0 4px;
}
.hero-dial {
  width: min(70vw, 260px);
  display: block;
  margin: 0 auto 10px;
}
.logo {
  margin: 0;
  font-size: clamp(56px, 18vw, 84px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 0.95;
  color: var(--ink);
  text-shadow: 4px 4px 0 var(--peach);
}
.pronounce {
  margin: 4px 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.04em;
}
.tagline {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
}
.resume-note {
  margin: 0;
  text-align: center;
  color: var(--accent);
  font-weight: 700;
}
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--dim);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 0;
  border-top: 2px dashed var(--dim);
}
.howto {
  color: var(--muted);
  font-size: 15px;
  padding: 0 4px;
}
.howto summary {
  cursor: pointer;
  font-weight: 800;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.howto ol {
  margin: 0;
  padding-left: 20px;
}
.howto li + li {
  margin-top: 6px;
}

/* ---------- lobby ---------- */

.join-card {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.join-code {
  min-width: 0;
}
.room-code {
  font-family: var(--mono);
  font-size: clamp(40px, 13vw, 60px);
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--accent);
  line-height: 1.05;
}
.join-url {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
  margin-top: 4px;
}
.qr-wrap {
  flex: none;
  background: #fff;
  box-shadow: var(--puff-sm);
  padding: 6px;
  border-radius: 12px;
  line-height: 0;
}
.qr {
  width: 120px;
  height: 120px;
  image-rendering: pixelated;
}
@media (max-width: 359px) {
  .join-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

.count {
  color: var(--accent);
}
.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.player-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 8px 6px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 2px solid transparent;
  box-shadow: var(--puff-sm);
}
.player-item.me {
  background: var(--accent-soft);
}
.player-item.offline {
  opacity: 0.55;
}
.pl-name {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pl-name em,
.st-name em,
.rr-name em {
  font-style: normal;
  color: var(--dim);
  font-weight: 600;
}
.avatar {
  position: relative;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--on-pastel);
  border: 2px solid var(--edge);
  overflow: hidden;
  line-height: 1;
  letter-spacing: -0.02em;
}
.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  user-select: none;
  -webkit-user-drag: none;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.packs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.pack {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: var(--surface-2);
  box-shadow: var(--puff-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.pack:has(.pack-cb:checked) {
  background: var(--accent-soft);
}
.pack-cb {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}
.pack-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.pack-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pack-name {
  font-weight: 800;
}
.pack-diff {
  display: inline-flex;
  gap: 3px;
}
.pack-diff i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
}
.pack-diff i.on {
  background: var(--accent);
}
.pack-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--dim);
  font-weight: 700;
}
.pack-desc {
  font-size: 14px;
  color: var(--muted);
}
.settings-summary {
  margin: 0;
  color: var(--text);
}
.sticky-actions {
  position: sticky;
  bottom: 0;
  margin: 0 -16px;
  padding: 10px 16px calc(10px + var(--safe-b)) !important;
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.waiting {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}
.waiting.big {
  font-size: 22px;
  color: var(--ink);
}
.dots {
  width: 22px;
  height: 8px;
  flex: none;
  background: radial-gradient(circle, var(--accent) 3px, transparent 3.5px) 0 0 / 8px 8px repeat-x;
  animation: dots 1s steps(3) infinite;
  clip-path: inset(0 100% 0 0);
}
@keyframes dots {
  to {
    clip-path: inset(0 -10% 0 0);
  }
}

/* ---------- choosing / waits ---------- */

.options {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.spectrum-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 108px;
  padding: 18px;
  border-radius: var(--radius);
  border: 3px solid transparent;
  background: linear-gradient(100deg, var(--sky), var(--surface-2) 45%, var(--surface-2) 55%, var(--rose));
  font-weight: 800;
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.1s, border-color 0.15s;
}
.spectrum-card:active,
.spectrum-card.picked {
  transform: translate(3px, 3px);
  box-shadow: var(--puff-press);
}
.sc-left {
  text-align: left;
}
.sc-right {
  text-align: right;
}
.sc-arrow {
  color: var(--accent);
  font-size: 24px;
}
.wait {
  padding-top: 24px;
  align-items: stretch;
}
.wait-art {
  display: flex;
  justify-content: center;
}
.idle-dial {
  width: min(70vw, 280px);
  opacity: 0.6;
}
.idle-dial .needle.own {
  animation: sway 2.4s ease-in-out infinite;
  transform-origin: 120px 120px;
}
@keyframes sway {
  0%,
  100% {
    transform: rotate(-40deg);
  }
  50% {
    transform: rotate(40deg);
  }
}
.spectrum-banner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 0;
  box-shadow: var(--puff-sm);
  font-weight: 700;
  font-size: 20px;
}
.spectrum-banner span:last-child {
  text-align: right;
}
.host-tools {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.host-tools:empty {
  display: none;
}

/* ---------- dial ---------- */

.dial-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}
.dial {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.dial-interactive {
  /* Vertical scrolling stays possible from the margins around the face; touches on the face itself cancel it in JS. */
  touch-action: pan-y;
  cursor: grab;
  outline: none;
}
.dial-interactive.dragging {
  cursor: grabbing;
}
.dial-interactive:focus-visible .dial-rim {
  stroke: var(--accent);
  stroke-width: 5;
}
.face-l {
  fill: var(--face);
}
.face-r {
  fill: var(--face-2);
}
.dial-rim {
  fill: none;
  stroke: var(--edge);
  stroke-width: 5;
}
.tick {
  stroke: var(--tick);
  stroke-width: 1.2;
}
.tick.major {
  stroke: var(--tick-major);
  stroke-width: 2;
}
.band {
  stroke: var(--face-2);
  stroke-width: 0.8;
  animation: band-in 0.45s ease-out;
}
.band-2 {
  fill: var(--band-2);
}
.band-3 {
  fill: var(--band-3);
}
.band-4 {
  fill: var(--band-4);
}
@keyframes band-in {
  from {
    opacity: 0;
  }
}
.band-label {
  font-size: 10px;
  font-weight: 800;
  fill: var(--band-ink);
  pointer-events: none;
}
.dial-hub {
  fill: var(--butter);
  stroke: var(--edge);
  stroke-width: 4;
}
.dial-hub-dot {
  fill: var(--edge);
}
.needle .needle-line {
  stroke: var(--ink);
  stroke-width: 6;
  stroke-linecap: round;
}
.needle .needle-knob {
  fill: var(--peach);
  stroke: var(--edge);
  stroke-width: 3.5;
}
.dial.ghost .needle.own {
  opacity: 0.45;
}
.dial.ghost .needle.own .needle-line {
  stroke-dasharray: 5 6;
}
.dial.ghost .needle.own .needle-knob {
  fill: transparent;
  stroke-dasharray: 4 3;
}
.dial.locked .needle.own .needle-knob {
  fill: var(--good);
}
.dial.locked .needle.own .needle-line {
  stroke: var(--good);
}
.needle.other .needle-line {
  stroke: var(--c);
  stroke-width: 3;
  filter: drop-shadow(0 0 1px var(--edge));
}
.needle.other .needle-knob {
  fill: var(--c);
  stroke: var(--edge);
  stroke-width: 2.5;
}
.needle.other.mine .needle-knob {
  stroke: var(--ink);
  stroke-width: 3;
}
.needle-initial {
  font-size: 9px;
  font-weight: 800;
  fill: var(--on-pastel);
  pointer-events: none;
}
.dial-needles .needle {
  animation: needle-in 0.5s ease-out backwards;
}
@keyframes needle-in {
  from {
    opacity: 0;
  }
}

.ends {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}
.end {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.end-left {
  background: var(--sky);
  color: var(--sky-ink);
  border: 0;
  box-shadow: var(--puff-sm);
  font-weight: 800;
}
.end-right {
  text-align: right;
  background: var(--rose);
  color: var(--rose-ink);
  border: 0;
  box-shadow: var(--puff-sm);
  font-weight: 800;
}

/* ---------- clue / guessing ---------- */

.clue-card {
  text-align: center;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--butter);
  color: var(--butter-ink);
  box-shadow: var(--puff);
  transform: rotate(-0.6deg);
}
.clue-card .label {
  color: var(--butter-ink);
}
.clue-text {
  margin: 2px 0 0;
  font-size: clamp(24px, 7.5vw, 34px);
  font-weight: 800;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.lock-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.lock-status {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.pip {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  border: 2px solid var(--c);
  color: var(--c);
  opacity: 0.55;
}
.pip.on {
  background: var(--c);
  color: var(--on-pastel);
  border-color: var(--edge);
  opacity: 1;
}
.timer-slot:empty {
  display: none;
}
.timer {
  min-width: 72px;
  padding: 6px 12px;
  text-align: center;
  border-radius: 999px;
  background: var(--surface-2);
  border: 2.5px solid var(--edge);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.timer.urgent {
  border-color: var(--danger);
  color: var(--danger);
  animation: pulse 0.8s ease-in-out infinite;
}
.col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.guess-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.guess-actions:empty {
  display: none;
}

/* ---------- reveal ---------- */

.reveal-banner {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
}
.rb-big {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
  animation: pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.rb-big.pts-4 {
  color: var(--pts-4);
  text-shadow: 3px 3px 0 var(--edge);
}
.rb-big.pts-3 {
  color: var(--pts-3);
  text-shadow: 3px 3px 0 var(--edge);
}
.rb-big.pts-2 {
  color: var(--pts-2);
}
.rb-big.pts-0 {
  color: var(--dim);
}
.rb-sub {
  font-size: 20px;
  font-weight: 800;
  color: var(--muted);
}
.rb-label {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
@keyframes pop {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
}
.legend {
  list-style: none;
  padding: 0;
  margin: -6px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-item.me {
  color: var(--ink);
}
.swatch {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.result-row,
.reader-result {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 2px solid transparent;
  box-shadow: var(--puff-sm);
}
.result-row.me,
.reader-result.me {
  background: var(--accent-soft);
}
.reader-result {
  margin-top: 10px;
  border: 2.5px dashed var(--edge);
  box-shadow: none;
}
.rr-name {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rr-guess {
  color: var(--dim);
  font-size: 14px;
  white-space: nowrap;
}
.rr-points {
  min-width: 40px;
  text-align: right;
  font-weight: 800;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.result-row.pts-4 .rr-points {
  color: var(--pts-4);
}
.result-row.pts-3 .rr-points {
  color: var(--pts-3);
}
.result-row.pts-2 .rr-points {
  color: var(--pts-2);
}
.result-row.pts-0 .rr-points {
  color: var(--dim);
}
.reveal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.standings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.standing {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 2px solid var(--edge);
}
.standing.me {
  background: var(--accent-soft);
}
.standing.offline {
  opacity: 0.6;
}
.st-rank {
  width: 22px;
  text-align: center;
  font-weight: 800;
  color: var(--muted);
}
.st-name {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
}
.st-last {
  font-size: 14px;
  color: var(--good);
  font-weight: 800;
}
.st-score {
  min-width: 36px;
  text-align: right;
  font-weight: 800;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

/* ---------- game over ---------- */

.final {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding-top: 8px;
}
.step {
  flex: 1 1 0;
  max-width: 140px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.step-name {
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.step-score {
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
}
.step-block {
  width: 100%;
  display: grid;
  place-items: center;
  border-radius: 20px 20px 8px 8px;
  font-weight: 800;
  font-size: 22px;
  color: var(--on-pastel);
  box-shadow: var(--puff-sm);
  animation: grow 0.6s ease-out backwards;
  transform-origin: bottom;
}
.step-1 .step-block {
  height: 120px;
  background: var(--peach);
}
.step-2 .step-block {
  height: 86px;
  background: var(--butter);
  animation-delay: 0.15s;
}
.step-3 .step-block {
  height: 62px;
  background: var(--accent-line);
  animation-delay: 0.3s;
}
.step.me .step-name {
  color: var(--accent);
}
.step .avatar {
  width: 48px;
  height: 48px;
  font-size: 20px;
}
@keyframes grow {
  from {
    transform: scaleY(0);
  }
}

/* ---------- drawer ---------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 0.2s;
}
.drawer-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 80vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  max-width: 560px;
  margin: 0 auto;
  padding: 8px calc(16px + var(--safe-r)) calc(20px + var(--safe-b)) calc(16px + var(--safe-l));
  background: var(--surface);
  border: 2.5px solid var(--edge);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  transform: translateY(100%);
  transition: transform 0.22s ease-out;
}
.drawer.open .drawer-backdrop {
  opacity: 1;
}
.drawer.open .drawer-sheet {
  transform: none;
}
.drawer-handle {
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  margin: 4px auto 10px;
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.drawer-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

/* ---------- big screen (spectator) ---------- */

body.is-spectator .app {
  max-width: 1200px;
}
body.is-spectator {
  font-size: 20px;
}
body.is-spectator .tb-row,
body.is-spectator .tb-status {
  max-width: 1200px;
}
body.is-spectator .dial-wrap {
  max-width: 760px;
}
body.is-spectator .end {
  font-size: clamp(20px, 3vw, 34px);
}
body.is-spectator .clue-text {
  font-size: clamp(32px, 5vw, 64px);
}
body.is-spectator .room-code {
  font-size: clamp(56px, 10vw, 120px);
}
body.is-spectator .qr {
  width: clamp(140px, 22vw, 260px);
  height: clamp(140px, 22vw, 260px);
}
body.is-spectator .waiting.big {
  font-size: clamp(24px, 3.5vw, 40px);
}
body.is-spectator .lock-status {
  font-size: clamp(22px, 3vw, 36px);
}
body.is-spectator .pip {
  width: 36px;
  height: 36px;
  font-size: 16px;
}
body.is-spectator .timer {
  font-size: clamp(24px, 3vw, 40px);
}
@media (min-width: 900px) {
  body.is-spectator .screen.guessing,
  body.is-spectator .screen.reveal {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    align-items: start;
    column-gap: 32px;
  }
  body.is-spectator .screen.guessing .status-row {
    flex-direction: column;
    align-items: flex-start;
  }
  body.is-spectator .lobby {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
  body.is-spectator .lobby > .join-card {
    grid-column: 1 / -1;
    justify-content: space-around;
  }
}

@media (min-width: 700px) {
  .qr {
    width: 150px;
    height: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- sound toggle ---------- */
.sound-toggle,
.theme-toggle {
  width: 40px;
  min-width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sound-toggle.is-muted {
  color: var(--dim);
}
.home-toggles {
  align-self: flex-end;
  display: flex;
  gap: 8px;
  margin-bottom: -8px;
  position: relative;
  z-index: 2;
}
@media (max-width: 360px) {
  .tb-row .btn-chip {
    padding: 0 9px;
    font-size: 13px;
  }
  .tb-row {
    gap: 4px;
  }
  .tb-row .sound-toggle,
  .tb-row .theme-toggle {
    width: 34px;
    min-width: 34px;
    padding: 0;
  }
  .tb-row .chip {
    letter-spacing: 0.1em;
    padding: 4px 7px;
  }
}

/* ---------- icons ---------- */
.ico {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

/* ---------- lobby toggles ---------- */
.field-wide {
  grid-column: 1 / -1;
}
.toggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.toggle {
  align-items: center;
  min-height: 56px;
}

/* ---------- clue timer ---------- */
.clue-clock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.clue-clock .timer {
  font-size: 16px;
  min-width: 60px;
  padding: 4px 10px;
}
.clue-clock.mine {
  justify-content: space-between;
  padding: 10px 12px 10px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: var(--puff-sm);
  color: var(--ink);
  font-size: 16px;
}
.clue-clock.mine .timer {
  font-size: 24px;
  min-width: 84px;
}
body.is-spectator .clue-clock .timer {
  font-size: clamp(18px, 2.2vw, 28px);
}

/* ---------- bonus word ---------- */
.clue2-text {
  margin: 6px 0 0;
  display: inline-block;
  max-width: 100%;
  padding: 3px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: var(--puff-sm);
  font-size: clamp(18px, 5.5vw, 24px);
  font-weight: 700;
  overflow-wrap: anywhere;
  animation: pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}
body.is-spectator .clue2-text {
  font-size: clamp(24px, 3.5vw, 44px);
}
.bonus-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bonus-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bonus-form .btn {
  flex: none;
}
.power-wide {
  color: var(--accent-deep);
  border-color: var(--accent-line);
}

/* ---------- power tray ---------- */
.power-tray {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 379px) {
  .power-tray {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .power-tray .power-btn {
    min-height: 60px;
  }
}
.power-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 72px;
  min-width: 0;
  padding: 8px 4px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: var(--puff-sm);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.08s, background 0.15s, border-color 0.15s, opacity 0.15s;
}
.power-btn:active:not(:disabled) {
  transform: scale(0.96);
}
.power-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.pw-ico {
  color: var(--accent);
}
.pw-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}
.pw-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
  line-height: 1.15;
  text-align: center;
}
.power-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.power-btn.used {
  box-shadow: 0 0 0 2px var(--line);
  background: var(--bg-2);
}
.power-btn.used .pw-name {
  text-decoration: line-through;
}
.power-btn.active {
  opacity: 1;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.power-note {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.power-note:empty {
  display: none;
}
.sonar-result,
.zoom-note {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
  font-size: 15px;
  box-shadow: var(--puff-sm);
  animation: rise 0.28s ease-out;
}
.sonar-result b {
  text-transform: none;
  font-weight: 800;
}
.sonar-result[data-dir='here'] {
  background: var(--rose);
  color: var(--rose-ink);
}

/* ---------- boosts (speed bonus, double) ---------- */
.boost-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.boost-row:empty {
  display: none;
}
.boost-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--puff-sm);
  animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.fast-chip {
  background: var(--butter);
  color: var(--butter-ink);
}
.fast-chip.ending {
  animation: pulse 0.6s ease-in-out infinite;
}
.double-badge {
  background: var(--accent);
  color: var(--on-accent);
}

/* ---------- dial overlays ---------- */
.zoom-fill {
  fill: var(--accent);
  fill-opacity: 0.2;
  stroke: none;
  animation: band-in 0.45s ease-out;
}
.zoom-rim {
  fill: none;
  stroke: var(--accent);
  stroke-width: 9;
}
.screen.reveal .zoom-fill {
  fill: none;
}
.zoom-edge {
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 4 4;
}
.sonar-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: sonar-ping 1.6s ease-out infinite;
}
.sonar-dot {
  fill: var(--accent);
  stroke: var(--edge);
  stroke-width: 2;
}
.sonar-arrow {
  fill: none;
  stroke: var(--accent-deep);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sonar-marker.dir-here .sonar-dot {
  fill: var(--band-4);
}
@keyframes sonar-ping {
  from {
    transform: scale(0.6);
    opacity: 1;
  }
  to {
    transform: scale(1.8);
    opacity: 0;
  }
}

/* ---------- reveal tags ---------- */
.rr-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rr-main .rr-name {
  flex: none;
}
.rr-tags,
.rb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.rtag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.rtag-double {
  background: var(--accent);
  color: var(--on-accent);
}
.rtag-double.dim {
  background: var(--bg-2);
  color: var(--dim);
}
.rtag-fast {
  background: var(--butter);
  color: var(--butter-ink);
}
.reveal-banner {
  flex-wrap: wrap;
}
.rb-tags {
  flex-basis: 100%;
  justify-content: center;
}
.rb-tags .rtag {
  font-size: 14px;
  padding: 3px 10px;
}

/* ---------- standings power pips ---------- */
.st-powers {
  display: inline-flex;
  gap: 2px;
  flex: none;
}
.st-powers .ico.on {
  color: var(--accent);
}
.st-powers .ico.off {
  color: var(--dim);
  opacity: 0.3;
}

/* ---------- notice toast ---------- */
.toast-notice {
  background: var(--butter);
  color: var(--butter-ink);
  bottom: calc(84px + var(--safe-b));
}

.st-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.st-main .st-name {
  flex: none;
}
@media (max-width: 400px) {
  .reader-result .rr-guess {
    display: none;
  }
}

/* ---------- Clue Giver's live view of guessers' needles ---------- */
.dial-needles .needle.live {
  animation: none;
}
.needle.live-ghost {
  opacity: 0.5;
}
.needle.live-ghost .needle-line {
  stroke-dasharray: 5 5;
}
.needle.live-ghost .needle-knob {
  stroke-dasharray: 3 2;
}
.needle.live-locked {
  opacity: 1;
}

/* ---------- Peek ---------- */
.peek-slot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.peek-slot:empty {
  display: none;
}
.peek-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--butter);
  color: var(--butter-ink);
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--puff-sm);
  animation: rise 0.25s ease-out;
  max-width: 100%;
}
.peek-pill.mine {
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.peek-pill .ico {
  flex: none;
  display: inline-flex;
}

/* ---------- Signature sounds ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.sound-slot:empty {
  display: none;
}
.sound-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sound-card .h2 {
  margin: 0;
}
.sound-copy {
  font-size: 15px;
  margin-top: -6px;
}
.sound-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 80px;
}
.sound-side {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.sound-side .hint {
  min-height: 0;
  font-size: 14px;
}
.sound-status {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.sound-status.rec {
  color: var(--danger);
}
.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 0.9s ease-in-out infinite;
}
.sound-big-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  flex: none;
  display: grid;
  place-items: center;
}
.sound-big {
  flex: none;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: var(--peach);
  color: var(--peach-ink);
  cursor: pointer;
  box-shadow: var(--puff);
  transition: transform 0.08s;
}
.sound-big:active {
  transform: scale(0.95);
}
.sound-big:focus-visible,
.btn-play-mini:focus-visible,
.sound-upload:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.sound-big.is-rec {
  width: 60px;
  height: 60px;
  background: var(--surface-2);
  color: var(--danger);
  box-shadow: var(--puff-sm);
}
.sound-ring {
  position: absolute;
  inset: 0;
  width: 80px;
  height: 80px;
  transform: rotate(-90deg);
  pointer-events: none;
}
.sound-ring circle {
  fill: none;
  stroke-width: 6;
}
.sound-ring .ring-bg {
  stroke: var(--line);
}
.sound-ring .ring-fg {
  stroke: var(--peach);
  stroke-linecap: round;
}
.level {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
  box-shadow: inset 0 0 0 2px var(--edge);
}
.level-fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--good), var(--butter) 65%, var(--peach));
  transform-origin: left center;
  transform: scaleX(0.03);
  transition: transform 0.06s linear;
}
.sound-take {
  display: flex;
  gap: 8px;
  align-items: center;
}
.sound-take .btn {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
}
.sound-take .sound-discard {
  flex: none;
  width: 52px;
  min-height: 52px;
}
.sound-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sound-foot:not(:has(*)) {
  display: none;
}
.sound-upload {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  border-radius: 12px;
}
.secure-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.secure-link {
  text-decoration: none;
  white-space: normal;
  text-align: center;
  line-height: 1.2;
  padding: 8px 16px;
  font-size: 16px;
}
.secure-help {
  font-size: 14px;
  min-height: 0;
}
.sound-check {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--good);
  color: var(--on-accent);
  flex: none;
}
.sound-open {
  align-self: flex-start;
  color: var(--accent-deep);
}
.btn-play-mini {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-deep);
  cursor: pointer;
  box-shadow: var(--puff-sm);
  transition: transform 0.08s;
}
.btn-play-mini:active {
  transform: scale(0.92);
}
.btn-play-mini .ico {
  display: inline-flex;
  margin-left: 2px;
}

.signature-now {
  position: fixed;
  z-index: 55;
  left: 50%;
  bottom: calc(20px + var(--safe-b));
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 8px 16px 8px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  box-shadow: var(--puff);
  animation: sig-in 0.25s ease-out;
  pointer-events: none;
}
.signature-now.out {
  opacity: 0;
  transition: opacity 0.2s;
}
body:not([data-phase='reveal']):not([data-phase='gameover']) .signature-now {
  display: none;
}
.sig-text {
  overflow: hidden;
  text-overflow: ellipsis;
}
.sig-ico {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--c, var(--accent));
  color: var(--on-pastel);
}
.sig-ico .sw {
  animation: sig-wave 0.9s ease-in-out infinite;
}
.sig-ico .sw-2 {
  animation-delay: 0.18s;
}
@keyframes sig-wave {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}
@keyframes sig-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.96);
  }
}
@media (prefers-reduced-motion: reduce) {
  .sig-ico .sw,
  .rec-dot {
    animation: none;
  }
}

/* ---------- pack badge (which pack a spectrum came from) ---------- */
.ends-wrap,
.spectrum-banner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.ends-wrap > .ends,
.spectrum-banner-wrap > .spectrum-banner {
  align-self: stretch;
}
.pack-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--wash);
  color: var(--dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
}
.pack-badge .pb-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.pack-badge .pack-diff {
  flex: none;
}
.pack-badge .pack-diff i {
  width: 6px;
  height: 6px;
}
.spectrum-card .sc-pack {
  grid-column: 1 / -1;
  justify-self: center;
  background: var(--wash);
}

/* Toasts never block taps on what's underneath (they sit over the main buttons) */
.toast {
  pointer-events: none;
}

/* ---------- Team rounds ---------- */
.team-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(100deg, var(--accent-soft), var(--surface-2));
  color: var(--accent-deep);
  box-shadow: var(--puff-sm);
  font-size: 15px;
  line-height: 1.25;
}
.team-banner .team-ico {
  flex: none;
  display: inline-flex;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--accent);
}
.team-banner .tb-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.team-banner .tb-text span {
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}
.screen.reveal > .team-banner,
.screen.guessing > .team-banner {
  grid-column: 1 / -1;
}
.team-moved-by {
  margin: 0;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.team-moved-by::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c, var(--line));
}
.screen.team .col-main {
  align-items: stretch;
}
.screen.team .team-moved-by {
  justify-content: center;
}
.team-powers-note {
  margin: 0;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--dim);
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--wash);
}
.hint.team-cleared {
  color: var(--danger);
  font-weight: 700;
  animation: rise 0.25s ease-out;
}
.needle.own.team .needle-knob {
  fill: var(--accent);
}
.team-result {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
}
.team-result .rr-main {
  flex: 1;
  min-width: 0;
}
.team-result .rr-points {
  white-space: nowrap;
}

/* ---------- Avatar photo ---------- */
.avatar-slot:empty {
  display: none;
}
.avatar-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.avatar-card .h2 {
  margin: 0;
}
.avatar-mine {
  width: 40px;
  height: 40px;
}
.avatar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.avatar-actions > * {
  flex: 1 1 140px;
  min-width: 0;
}
.avatar-pick {
  position: relative;
  cursor: pointer;
}
.avatar-pick:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.crop-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.crop-stage {
  position: relative;
  max-width: 100%;
  border-radius: 24px;
  overflow: hidden;
  background: var(--surface-2);
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.crop-stage:active {
  cursor: grabbing;
}
.crop-stage.is-live {
  cursor: default;
}
.crop-img {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  pointer-events: none;
}
.avatar-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.crop-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  /* dim outside the circle */
  background: radial-gradient(circle closest-side, transparent 99%, rgba(20, 14, 50, 0.5) 100%);
}
.crop-mask::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.9);
}
.crop-zoom {
  width: min(240px, 100%);
  accent-color: var(--accent);
}

/* ---------- Avatars across the game ---------- */
.avatar-xs {
  width: 20px;
  height: 20px;
  font-size: 9px;
}
.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 12px;
}
.avatar-lg {
  width: 72px;
  height: 72px;
  font-size: 28px;
  box-shadow: 0 6px 16px rgba(47, 42, 74, 0.18), 0 0 0 4px var(--surface-2);
}
.waiting:has(.wait-face) {
  flex-direction: column;
  gap: 14px;
}
.waiting:has(.wait-face) > span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.team-moved-by:has(.avatar)::before {
  display: none;
}
.team-moved-by .avatar {
  box-shadow: 0 0 0 2px var(--c, var(--line));
}
.pip.avatar {
  overflow: hidden;
  line-height: 1;
}
.pip .avatar-img {
  border-radius: 50%;
}
.reader-result .avatar,
.result-row .avatar,
.standing .avatar {
  font-size: 12px;
}
.signature-now .avatar {
  width: 32px;
  height: 32px;
}
.needle.has-photo .needle-knob {
  stroke-width: 2.5;
  stroke: var(--c);
  fill: var(--surface-2);
}
.needle.other.mine.has-photo .needle-knob {
  stroke: var(--ink);
  stroke-width: 3;
}
.needle-photo {
  pointer-events: none;
}
.avatar-actions .btn {
  white-space: nowrap;
  padding-left: 12px;
  padding-right: 12px;
  gap: 8px;
}

/* ---------- phase transitions ----------
   Pure transform/opacity, never on buttons, so nothing waits on them. The reveal is timed to the
   drumroll: target sweeps in (0-0.6s), needles land (0.6-1s), points pop with the verdict (1.05s). */

/* The round card. It lands just as the whole screen is swapped (lobby to game on round 1), the heaviest frame
   there is, so on mid-range Android the first frames get dropped. Three things keep it from jumping:
   - it waits 120ms (invisible) for that frame to paint, then eases in slowly at first, so a late start costs little;
   - the sticker is its own layer from the start (will-change) and only transform and opacity ever change;
   - the overlay is sized in svh, so it stays put while Android's address bar slides in or out.
   Every keyframe lists the same transform functions, so each one eases on its own (no matrix blending). */
.round-card {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
  z-index: 85;
  pointer-events: none;
  display: grid;
  place-items: center;
  contain: strict;
}
.rc-inner {
  text-align: center;
  padding: 22px 34px 24px;
  border-radius: var(--radius);
  background: var(--butter);
  color: var(--butter-ink);
  box-shadow: var(--puff);
  transform: translate3d(0, 0, 0) scale(1) rotate(-3deg);
  will-change: transform, opacity;
  backface-visibility: hidden;
  animation:
    rc-in 0.52s linear 0.12s both,
    rc-out 0.3s cubic-bezier(0.4, 0, 1, 1) 1.36s forwards;
}
.round-card.you .rc-inner {
  background: var(--peach);
  color: var(--peach-ink);
}
.rc-kicker {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.rc-title {
  font-size: clamp(44px, 14vw, 88px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}
.rc-sub {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
}
@keyframes rc-in {
  0% {
    opacity: 0;
    transform: translate3d(0, -26px, 0) scale(1.22) rotate(4deg);
    animation-timing-function: cubic-bezier(0.45, 0, 0.3, 1);
  }
  30% {
    opacity: 1;
  }
  62% {
    opacity: 1;
    transform: translate3d(0, 2px, 0) scale(0.97) rotate(-4deg);
    animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1) rotate(-3deg);
  }
}
@keyframes rc-out {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1) rotate(-3deg);
  }
  100% {
    opacity: 0;
    transform: translate3d(0, 22px, 0) scale(0.92) rotate(-6deg);
  }
}

.screen.choosing .spectrum-card {
  animation: card-in 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) 0.35s backwards;
}
.screen.choosing .spectrum-card:nth-child(2) {
  animation-delay: 0.45s;
}
.screen.choosing .spectrum-card:nth-child(3) {
  animation-delay: 0.55s;
}
@keyframes card-in {
  from {
    opacity: 0;
    transform: translateX(48px) rotate(3deg);
  }
}

.screen.guessing .clue-card,
.screen.wait .clue-card {
  animation: clue-drop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}
@keyframes clue-drop {
  from {
    opacity: 0;
    transform: translateY(-30px) rotate(-5deg) scale(1.06);
  }
}
.screen.guessing .dial,
.screen.clue-reader .dial {
  transform-origin: 50% 100%;
  animation: dial-sweep 0.55s cubic-bezier(0.2, 1.2, 0.4, 1) 0.1s backwards;
}
@keyframes dial-sweep {
  from {
    opacity: 0;
    transform: rotate(-14deg) scale(0.86);
  }
}

.screen.reveal .dial-bands {
  transform-origin: 120px 120px;
  animation: target-sweep 0.6s cubic-bezier(0.3, 1.25, 0.5, 1) backwards;
}
@keyframes target-sweep {
  from {
    opacity: 0;
    transform: rotate(-100deg);
  }
  40% {
    opacity: 1;
  }
}
.screen.reveal .dial-needles .needle {
  transform-origin: 120px 120px;
  animation: needle-land 0.4s cubic-bezier(0.2, 1.5, 0.4, 1) 0.6s backwards;
}
.screen.reveal .dial-needles .needle:nth-child(2) { animation-delay: 0.66s; }
.screen.reveal .dial-needles .needle:nth-child(3) { animation-delay: 0.72s; }
.screen.reveal .dial-needles .needle:nth-child(4) { animation-delay: 0.78s; }
.screen.reveal .dial-needles .needle:nth-child(n + 5) { animation-delay: 0.84s; }
@keyframes needle-land {
  from {
    opacity: 0;
    transform: scale(0.2);
  }
}
.screen.reveal .rb-big {
  animation: pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) 1.05s backwards;
}
.screen.reveal .rb-sub,
.screen.reveal .rb-label,
.screen.reveal .rb-tags {
  animation: rise 0.3s ease-out 1.15s backwards;
}
.screen.reveal .result-row,
.screen.reveal .reader-result,
.screen.reveal .team-result {
  animation: rise 0.3s ease-out 1.15s backwards;
}
.screen.reveal .result-row:nth-child(2) { animation-delay: 1.21s; }
.screen.reveal .result-row:nth-child(3) { animation-delay: 1.27s; }
.screen.reveal .result-row:nth-child(n + 4) { animation-delay: 1.33s; }
.screen.reveal .reader-result { animation-delay: 1.4s; }

/* Finale: the podium rises 3rd, 2nd, 1st; each name drops onto its block; the headline lands last.
   Winner confetti follows at SIGNATURE_GAMEOVER_DELAY (celebrate.js). Play again is never animated. */
.screen.gameover .step .step-block {
  animation: grow 0.55s cubic-bezier(0.2, 1.3, 0.4, 1) backwards;
}
.screen.gameover .step-3 .step-block { animation-delay: 0.2s; }
.screen.gameover .step-2 .step-block { animation-delay: 0.7s; }
.screen.gameover .step-1 .step-block { animation-delay: 1.2s; }
.screen.gameover .step > :not(.step-block) {
  animation: name-drop 0.4s cubic-bezier(0.2, 1.5, 0.4, 1) backwards;
}
.screen.gameover .step-3 > :not(.step-block) { animation-delay: 0.55s; }
.screen.gameover .step-2 > :not(.step-block) { animation-delay: 1.05s; }
.screen.gameover .step-1 > :not(.step-block) { animation-delay: 1.6s; }
@keyframes name-drop {
  from {
    opacity: 0;
    transform: translateY(-36px);
  }
}
.screen.gameover > .h1 {
  animation: pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) 1.9s backwards;
}
.screen.gameover .final > .card {
  animation: rise 0.35s ease-out 2.1s backwards;
}

/* ---------- How to play (practice round) ---------- */
.tutorial {
  position: fixed;
  inset: 0;
  z-index: 45;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
}
body.tutorial-open {
  overflow: hidden;
}
.tut-sheet {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(12px + var(--safe-t, 0px)) calc(16px + var(--safe-r)) calc(24px + var(--safe-b)) calc(16px + var(--safe-l));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tut-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.tut-head .label {
  margin: 0;
}
.tut-dots {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 6px;
}
.tut-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
  transition: width 0.2s, background 0.2s;
}
.tut-dots i.done {
  background: var(--accent-line);
}
.tut-dots i.on {
  width: 22px;
  border-radius: 4px;
  background: var(--accent);
}
.tut-step {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: tut-in 0.25s ease-out;
}
@keyframes tut-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .tut-step {
    animation: none;
  }
}
.tut-title {
  margin: 0;
  outline: none;
}
.tut-step .sub {
  margin: 0;
}
.tut-step .dial-wrap {
  margin: 0;
}
.tut-points {
  align-self: center;
}
.tut-bands,
.tut-recap {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tut-bands li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}
.tut-bands b {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid var(--edge);
  color: var(--on-pastel);
  font-size: 17px;
}
.tut-bands .pts-4 b {
  background: var(--band-4);
}
.tut-bands .pts-3 b {
  background: var(--band-3);
}
.tut-bands .pts-2 b {
  background: var(--band-2);
}
.tut-bands .pts-0 b {
  background: var(--surface-2);
}
.tut-recap li {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 2px solid var(--edge);
  font-weight: 600;
}
.tut-powers {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tut-power-result {
  min-height: 1.4em;
  margin: 0;
  font-weight: 700;
}
.tut-power-result[data-points] {
  font-size: 22px;
  color: var(--ink);
}
.tut-more {
  font-size: 15px;
}
.tut-offer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
}
.tut-offer-text {
  flex: 1 1 180px;
  margin: 0;
}
.tut-offer-actions {
  display: flex;
  gap: 6px;
}

/* ---------- Reverse round ---------- */
/* :not(.map-card) outweighs the three-column spectrum layout further down, which otherwise squeezed the word into
   the left third of the card and broke it mid-word. */
.spectrum-card.word-card:not(.map-card) {
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  background: var(--surface-2);
}
.wc-word {
  max-width: 100%;
  font-size: 30px;
  font-weight: 800;
  text-align: center;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.word-clue .clue-text {
  overflow-wrap: anywhere;
}
.ends-preview .end {
  transition: opacity 0.15s;
}
.ends-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.ends-inputs .sc-arrow {
  font-weight: 800;
  color: var(--muted);
}
.input-end {
  min-width: 0;
  font-size: 18px;
  font-weight: 700;
}
#ends-right-input,
.ends-inputs .input-end:last-child {
  text-align: right;
}
.reverse-banner {
  background: linear-gradient(100deg, var(--butter), var(--surface-2));
}
/* Dark: full butter under the pale text washes it out, so the banner goes deep amber with a butter title,
   the same way the team banner goes deep navy with a pale blue one. */
:root[data-theme='dark'] .reverse-banner {
  background: linear-gradient(100deg, #54400f, var(--surface-2));
  color: var(--butter);
}
:root[data-theme='dark'] .reverse-banner .team-ico {
  color: var(--butter);
}

/* ---------- What's new ---------- */
.whatsnew {
  position: fixed;
  inset: 0;
  z-index: 46;
  display: grid;
  place-items: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(16px + var(--safe-t, 0px)) calc(16px + var(--safe-r, 0px)) calc(16px + var(--safe-b, 0px)) calc(16px + var(--safe-l, 0px));
  background: color-mix(in srgb, var(--ink) 35%, transparent);
}
.whatsnew-card {
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: rotate(-0.6deg);
}
.whatsnew-card .label {
  margin: 0;
}
.whatsnew-entry + .whatsnew-entry {
  border-top: 2px dashed var(--line);
  padding-top: 12px;
}
.whatsnew-title {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
}
h3.whatsnew-title {
  font-size: 1.15rem;
}
.whatsnew-date {
  margin: 2px 0 6px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}
.whatsnew-list {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: 6px;
  color: var(--ink);
}
@media (prefers-reduced-motion: no-preference) {
  .whatsnew-card {
    animation: rise 0.3s ease-out;
  }
}

/* ---------- Reactions ---------- */
.tb-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 900px;
  margin: 4px auto 0;
}
.tb-sub .tb-status {
  flex: 1;
  min-width: 0;
  margin: 0;
}
body.is-spectator .tb-sub {
  max-width: 1200px;
}
.react-toggle {
  flex: none;
  width: 34px;
  height: 34px;
  margin: -2px 0;
  border-radius: 50%;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--butter);
  color: var(--butter-ink);
  box-shadow: var(--puff-sm);
  cursor: pointer;
  transition: transform 0.08s;
}
.react-toggle:active {
  transform: scale(0.92);
}
.react-toggle.open {
  background: var(--accent);
  color: #fff;
}
.react-toggle:focus-visible,
.react-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.react-palette {
  position: fixed;
  z-index: 38;
  top: calc(88px + var(--safe-t));
  right: calc(12px + var(--safe-r));
  display: grid;
  grid-template-columns: repeat(4, 46px);
  gap: 6px;
  padding: 8px;
  border-radius: 24px;
  background: var(--surface-2);
  box-shadow: var(--puff);
  animation: react-pop-in 0.16s ease-out;
}
@keyframes react-pop-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
  }
}
.react-btn {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 26px;
  line-height: 1;
  background: var(--accent-soft);
  cursor: pointer;
  transition: transform 0.08s;
}
.react-btn:active {
  transform: scale(0.88);
}
.reaction-layer {
  position: fixed;
  inset: 0;
  z-index: 35;
  pointer-events: none;
  overflow: hidden;
}
.reaction-float {
  position: absolute;
  bottom: calc(70px + var(--safe-b));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  animation: react-float 2.2s ease-out forwards;
  will-change: transform, opacity;
}
.rf-emoji {
  font-size: 44px;
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(47, 42, 74, 0.2));
}
.rf-name {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 2px solid var(--edge);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--puff-sm);
}
body.is-spectator .rf-emoji {
  font-size: 88px;
}
body.is-spectator .rf-name {
  font-size: 22px;
  max-width: 240px;
  padding: 4px 14px;
}
@keyframes react-float {
  0% {
    opacity: 0;
    transform: translate(0, 20px) scale(0.6) rotate(0deg);
  }
  12% {
    opacity: 1;
    transform: translate(calc(var(--drift) * 0.1), 0) scale(1.1) rotate(var(--tilt));
  }
  35% {
    transform: translate(calc(var(--drift) * -0.4), -16vh) scale(1) rotate(calc(var(--tilt) * -1));
  }
  60% {
    opacity: 1;
    transform: translate(calc(var(--drift) * 0.6), -30vh) scale(1) rotate(var(--tilt));
  }
  100% {
    opacity: 0;
    transform: translate(var(--drift), -46vh) scale(0.9) rotate(0deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  /* beats the global reduced-motion reset: a gentle fade in place, no float */
  .reaction-layer .reaction-float {
    animation: react-fade 2.2s ease-out forwards !important;
  }
  @keyframes react-fade {
    0% {
      opacity: 0;
    }
    15%,
    70% {
      opacity: 1;
    }
    100% {
      opacity: 0;
    }
  }
}

/* ---------- home: playful paper motion ----------
   Cutouts drift behind the page, the dial hunts for the target, the title letters bob, and Join gives a
   nudge now and then. Transform/opacity only; the global reduced-motion rule stills all of it. */

.screen.home {
  position: relative;
}
.screen.home > :not(.home-bits) {
  position: relative;
  z-index: 1;
}
.home-bits {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  color: var(--edge);
}
.bit {
  position: absolute;
  overflow: visible;
  will-change: transform;
}
.bit .f-peach { fill: var(--peach); }
.bit .f-accent { fill: var(--accent); }
.bit .f-butter { fill: var(--butter); }
.bit .f-good { fill: var(--good); }
.bit .f-surface { fill: var(--surface-2); }
.bit .s-peach { stroke: var(--peach); }
.bit .s-accent { stroke: var(--accent); }
.bit-1 { width: 74px; top: 6%; left: -22px; animation: drift-a 13s ease-in-out infinite alternate; }
.bit-2 { width: 56px; top: 30%; right: -10px; animation: drift-b 11s ease-in-out infinite alternate; }
.bit-3 { width: 52px; top: 3%; right: 20%; animation: drift-c 9s ease-in-out infinite alternate; }
.bit-4 { width: 86px; bottom: 10%; left: -14px; animation: drift-b 15s ease-in-out -4s infinite alternate; }
.bit-5 { width: 90px; top: 52%; left: -30px; animation: drift-c 12s ease-in-out -2s infinite alternate; }
.bit-6 { width: 64px; bottom: 26%; right: -18px; animation: drift-a 14s ease-in-out -6s infinite alternate; }
.bit-7 { width: 40px; top: 20%; left: 10%; animation: drift-b 10s ease-in-out -3s infinite alternate; }
.bit-8 { width: 46px; bottom: 4%; right: 14%; animation: drift-c 16s ease-in-out -8s infinite alternate; }
@keyframes drift-a {
  from { transform: translate(0, 0) rotate(-10deg); }
  to { transform: translate(26px, 40px) rotate(28deg); }
}
@keyframes drift-b {
  from { transform: translate(0, 0) rotate(8deg); }
  to { transform: translate(-22px, 30px) rotate(-34deg); }
}
@keyframes drift-c {
  from { transform: translate(0, 0) rotate(0deg) scale(1); }
  to { transform: translate(18px, -28px) rotate(60deg) scale(1.12); }
}
@media (min-width: 700px) {
  .bit { transform-origin: center; }
  .bit-1 { width: 120px; }
  .bit-2 { width: 90px; right: 8%; }
  .bit-4 { width: 140px; left: 6%; }
  .bit-6 { width: 110px; right: 6%; }
  .bit-5 { width: 150px; left: 4%; }
}

/* Compact hero so Join sits above the fold on small phones. */
.screen.home .hero-dial {
  width: min(46vw, 190px);
  margin-bottom: 18px;
  cursor: pointer;
}
.screen.home .logo {
  font-size: clamp(52px, 16vw, 80px);
  letter-spacing: 0.02em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.logo-ch {
  display: inline-block;
  animation: letter-bob 2.8s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -0.35s);
}
@keyframes letter-bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-7px) rotate(4deg); }
}
.logo.jump .logo-ch {
  animation: letter-jump 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) both;
  animation-delay: calc(var(--i, 0) * 0.06s);
}
@keyframes letter-jump {
  0% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-26px) rotate(-12deg) scale(1.15); }
  100% { transform: translateY(0) rotate(0) scale(1); }
}
.hero-dial .needle.own {
  transform-origin: 120px 120px;
  animation: hero-hunt 5.5s cubic-bezier(0.5, 0, 0.2, 1) infinite;
}
@keyframes hero-hunt {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-95deg); }
  38% { transform: rotate(-70deg); }
  58% { transform: rotate(-108deg); }
  76% { transform: rotate(4deg); }
  84% { transform: rotate(-3deg); }
  90% { transform: rotate(0deg); }
}
.hero-dial .dial-bands {
  transform-origin: 120px 120px;
  animation: band-breathe 2.75s ease-in-out infinite;
}
@keyframes band-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.home-join [data-testid='join-btn'] {
  animation: nudge 6s ease-in-out 2s infinite;
}
@keyframes nudge {
  0%, 88%, 100% { transform: none; }
  91% { transform: rotate(-2deg) scale(1.03); }
  94% { transform: rotate(2deg) scale(1.03); }
  97% { transform: rotate(-1deg); }
}
.home-join [data-testid='join-btn']:active:not(:disabled) {
  animation: none;
}
.home-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.home-links .btn {
  flex: 1 1 auto;
  white-space: nowrap;
}
.install-steps {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 15px;
  text-align: center;
}
.screen.home .tagline {
  margin-top: 4px;
}
/* ---------- Past games (/history.html) ---------- */
.hist { max-width: 720px; display: flex; flex-direction: column; gap: 16px; padding-top: calc(20px + var(--safe-t)); }
.hist-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hist-top h1 { margin: 0; font-size: 34px; }
.hist-h { margin: 0 0 10px; font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.hist-scroll { overflow-x: auto; }
.hist-board { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.hist-board th, .hist-board td { padding: 8px 5px; text-align: right; }
.hist-board th:nth-child(-n + 2), .hist-board td:nth-child(-n + 2) { text-align: left; }
.hist-board th { font-size: 12px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.hist-board tr + tr td { border-top: 1.5px solid var(--line); }
.hist-games { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.hist-game { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 0; border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: var(--puff-sm); cursor: pointer; font: inherit; color: inherit; }
.hist-game:active { box-shadow: var(--puff-press); transform: translate(2px, 2px); }
.hist-meta { font-size: 13px; color: var(--muted); }
.hist-names { font-weight: 700; overflow-wrap: anywhere; }
.hist-pill { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); margin-left: 6px; }
.hist-pill.abandoned { background: var(--danger-soft); color: var(--danger-ink); }
.hist-round { padding: 12px 0; border-top: 1.5px solid var(--line); overflow-wrap: anywhere; }
.hist-round:first-of-type { border-top: 0; }
.hist-spec { font-weight: 700; }
.hist-clue { margin: 4px 0; }
.hist-round ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); }

/* ---------- polish pass ---------- */

.nowrap {
  white-space: nowrap;
}
.join-url {
  word-break: normal;
  overflow-wrap: normal;
}
.sticky-actions {
  background: var(--bg);
  border-top: 2.5px solid var(--edge);
  margin-top: 4px;
}
.btn-kick {
  min-height: 34px;
  min-width: 34px;
  border-radius: 50%;
  border: 2px solid var(--edge);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
}
.btn-kick:hover {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-danger-text {
  color: var(--danger);
}

/* Polish: Clue Giver tag sits under the name so long names keep room on small phones */
.rtag-reader {
  background: var(--accent-soft);
  color: var(--sky-ink);
  letter-spacing: 0.02em;
}

/* Polish: a calm idle dial while someone else is choosing. Solid, faded needle drifting slowly. */
.idle-dial.dial.ghost .needle.own {
  opacity: 0.5;
  animation: idle-drift 7s ease-in-out infinite;
}
.idle-dial.dial.ghost .needle.own .needle-line,
.idle-dial.dial.ghost .needle.own .needle-knob {
  stroke-dasharray: none;
}
.idle-dial.dial.ghost .needle.own .needle-knob {
  fill: var(--peach);
}
@keyframes idle-drift {
  0%,
  100% {
    transform: rotate(-22deg);
  }
  50% {
    transform: rotate(22deg);
  }
}
.waiting .dots {
  margin-left: -4px;
  align-self: flex-end;
  margin-bottom: 0.35em;
}
@media (prefers-reduced-motion: reduce) {
  .idle-dial.dial.ghost .needle.own {
    animation: none;
  }
}

/* Polish: long spectrum ends stack on small phones instead of wrapping one word per line */
@media (max-width: 440px) {
  .spectrum-card.sc-long {
    grid-template-columns: 1fr;
    gap: 4px;
    font-size: 20px;
    line-height: 1.15;
  }
  .spectrum-card.sc-long .sc-arrow {
    justify-self: center;
    font-size: 20px;
    line-height: 1;
  }
  .spectrum-card.sc-long .sc-left,
  .spectrum-card.sc-long .sc-right {
    text-wrap: balance;
  }
}

/* Polish: big screen guessing uses the side column: a lock-in card, then standings */
@media (min-width: 900px) {
  body.is-spectator .screen.guessing .col-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  body.is-spectator .screen.guessing .status-row {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    gap: 14px;
  }
  body.is-spectator .screen.guessing .lock-status {
    font-size: clamp(32px, 3.4vw, 52px);
    line-height: 1;
  }
  body.is-spectator .screen.guessing .pip {
    width: 52px;
    height: 52px;
    font-size: 22px;
  }
  body.is-spectator .screen.guessing .lock-box {
    gap: 14px;
  }
  body.is-spectator .screen .dial-wrap {
    max-width: 820px;
  }
  body.is-spectator .standing .st-name {
    font-size: 22px;
  }
  body.is-spectator .standing .st-score {
    font-size: 28px;
  }
}

/* Polish: power buttons read at arm's length */
.pw-name {
  font-size: 15px;
}
.pw-sub {
  font-size: 13px;
  color: var(--muted);
  text-wrap: balance;
}
.power-btn.used .pw-sub,
.power-btn:disabled .pw-sub {
  color: var(--dim);
}

/* Polish: Past games page */
.hist-top { flex-direction: column; align-items: flex-start; gap: 10px; }
.hist-top h1 { font-size: clamp(30px, 8vw, 42px); line-height: 1; }
.hist-back { text-decoration: none; white-space: nowrap; gap: 6px; }
.hist-board { font-size: 15px; }
.hist-board th, .hist-board td { padding: 9px 5px; }
.hist-board th { font-size: 11px; white-space: nowrap; }
.hist-player { font-weight: 800; white-space: nowrap; max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.hist-rank { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%; font-weight: 800; font-size: 13px; background: var(--surface-2); box-shadow: 0 0 0 2px var(--edge); }
.hist-board tr.top .hist-rank { background: var(--butter); color: var(--butter-ink); }
.hist-names { display: flex; flex-wrap: wrap; gap: 6px; }
.hist-chip { display: inline-flex; align-items: baseline; gap: 2px; padding: 3px 10px; border-radius: 999px; background: var(--bg); box-shadow: 0 0 0 2px var(--edge); font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.hist-chip b { font-variant-numeric: tabular-nums; }
.hist-chip.win { background: var(--butter); color: var(--butter-ink); }
.hist-winner { font-size: 13px; font-weight: 800; color: var(--ink); }
.hist-game { gap: 8px; }
.hist-game.picked { background: var(--accent-soft); }
.hist-spec { font-size: 17px; text-wrap: balance; }
.hist-clue { margin: 6px 0 0; font-size: 18px; }
.hist-round > .hist-meta { margin: 2px 0 0; }
.hist-guesses { list-style: none; margin: 8px 0 0 !important; padding: 0 !important; display: flex; flex-direction: column; gap: 6px; color: var(--ink) !important; }
.hist-guesses li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 15px; }
.hist-guesses li.giver { border: 2px dashed var(--edge); background: transparent; }
.hist-guesses b { font-variant-numeric: tabular-nums; }
.hist-board th:nth-child(-n + 2), .hist-board td:nth-child(-n + 2) { text-align: right; }
.hist-board th:first-child, .hist-board td:first-child { text-align: left; }
.hist-player { display: flex; align-items: center; gap: 8px; max-width: none; }
.hist-pname { min-width: 0; max-width: 8em; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 440px) {
  .hist-board th, .hist-board td { padding: 9px 3px; }
  .hist-board th { letter-spacing: 0.04em; }
  .hist .card { padding: 16px 12px; }
}
@media (max-width: 360px) {
  .hist-board { font-size: 13px; }
  .hist-board th { font-size: 10px; letter-spacing: 0.02em; }
  .hist-pname { max-width: 6.5em; }
  .hist-player { gap: 5px; }
  .hist-rank { min-width: 22px; height: 22px; font-size: 12px; }
  .hist .card { padding: 14px 8px; }
}

/* ---------- Hot seat (game over) ---------- */
.hot-seat { display: flex; flex-direction: column; gap: 10px; }
.hs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hs-head .h2 { margin: 0; }
.hs-nav { display: flex; gap: 6px; }
.hs-arrow { min-width: 40px; font-size: 22px; line-height: 1; }
.hs-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 0; outline: none; border-radius: var(--radius-sm); }
.hs-track::-webkit-scrollbar { display: none; }
.hs-slide { flex: 0 0 100%; scroll-snap-align: start; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--edge); }
.hs-slide.me { background: var(--accent-soft); }
.hs-who { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.hs-name { overflow-wrap: anywhere; }
.hs-emoji { font-size: 56px; line-height: 1.1; transform: rotate(-6deg); }
.hs-title { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.hs-detail { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.hs-also { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.hs-pair { background: var(--butter); color: var(--butter-ink); }
.hs-pair .hs-detail { color: inherit; }
.hs-pair .hs-who { flex-wrap: wrap; justify-content: center; }
.hs-callout { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--edge); font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.hs-dots { display: flex; justify-content: center; gap: 6px; }
.hs-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); box-shadow: 0 0 0 1.5px var(--edge); }
.hs-dot.on { background: var(--peach); }
@media (prefers-reduced-motion: no-preference) {
  .hs-slide .hs-emoji { animation: hs-pop 0.5s ease-out both; }
}
@keyframes hs-pop { from { transform: scale(0.4) rotate(-20deg); opacity: 0; } }
.hist-h-sub { margin-top: 16px; }
.hist-rivals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.hist-rival { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 0; }
.hist-rival + .hist-rival { border-top: 1.5px solid var(--line); }
.hist-rival[data-you] .hist-rival-names { color: var(--accent-deep); }
.hist-rival-names { font-weight: 700; overflow-wrap: anywhere; }
.hist-rival-score { font-family: var(--mono); font-weight: 500; text-align: right; }
.hist-rival .hist-meta { grid-column: 1 / -1; }
.hist-board tr.hist-you td { color: var(--accent-deep); font-weight: 700; }

/* Polish: Hot seat in the Paper Cutout style. Slides are cutout cards; the emoji sits on the player's colour. */
.hs-arrow { width: 40px; min-width: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.hs-track { padding: 4px 10px 12px 4px; margin: -4px -10px -12px -4px; scroll-padding-left: 4px; gap: 14px; }
.hs-slide { min-width: 0; background: var(--surface-2); box-shadow: var(--puff-sm); padding: 18px 16px 18px; gap: 8px; }
.hs-slide.me { background: var(--accent-soft); }
.hs-who { font-size: 16px; min-width: 0; max-width: 100%; }
.hs-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
.hs-emoji { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; font-size: 50px; line-height: 1; background: color-mix(in srgb, var(--c, var(--peach)) 30%, var(--surface)); box-shadow: 0 0 0 2.5px var(--edge), 4px 4px 0 2.5px var(--drop); margin: 4px 0 6px; }
.hs-title { font-size: clamp(22px, 6vw, 28px); line-height: 1.1; text-wrap: balance; }
.hs-detail { font-size: 16px; text-wrap: balance; }
.hs-also { text-wrap: balance; }
.hs-dots { gap: 8px; }
.hs-dot { width: 10px; height: 10px; background: var(--surface-2); box-shadow: 0 0 0 2px var(--edge); }
.hs-dot.on { background: var(--accent); }
body.is-spectator .hs-emoji { width: 132px; height: 132px; font-size: 74px; }
body.is-spectator .hs-title { font-size: clamp(30px, 3.4vw, 44px); }
body.is-spectator .hs-detail { font-size: 22px; }
body.is-spectator .hs-who { font-size: 22px; }

/* Polish: rivalries read like a scoreboard */
.hist-rival { align-items: center; padding: 10px 0; }
.hist-rival-names { font-size: 17px; }
.hist-rival-score { font-family: inherit; font-weight: 800; font-variant-numeric: tabular-nums; padding: 3px 12px; border-radius: 999px; background: var(--butter); color: var(--butter-ink); box-shadow: 0 0 0 2px var(--edge); white-space: nowrap; }
.hist-rival[data-you] .hist-rival-score { background: var(--accent-soft); color: var(--accent-deep); }
.hist-h-sub { margin-top: 18px; }
/* ---------- Map rounds: a square board, spectrum A across (blue), spectrum B up (pink) ---------- */
.map-wrap {
  display: grid;
  grid-template-columns: fit-content(74px) minmax(0, 1fr) fit-content(74px);
  grid-template-areas:
    '. top .'
    'left field right'
    '. bottom .'
    'packs packs packs';
  align-items: center;
  justify-items: center;
  gap: 6px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}
.map-field {
  grid-area: field;
  width: 100%;
}
.map-end {
  font-weight: 800;
  font-size: 16px;
  line-height: 1.1;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  box-shadow: var(--puff-sm);
  overflow-wrap: anywhere;
  text-align: center;
}
.map-top,
.map-bottom {
  max-width: 80%;
  background: var(--rose);
  color: var(--rose-ink);
}
.map-top {
  grid-area: top;
}
.map-bottom {
  grid-area: bottom;
}
.map-left,
.map-right {
  /* Written upright, like the top and bottom ends. Long ends wrap inside a narrow side column. */
  font-size: 13.5px;
  padding: 6px 7px;
  hyphens: auto;
  background: var(--sky);
  color: var(--sky-ink);
}
.map-left {
  grid-area: left;
}
.map-right {
  grid-area: right;
}
.map-packs {
  grid-area: packs;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.map-packs:empty {
  display: none;
}
.map-board .map-grid {
  fill: none;
  stroke: var(--tick);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}
.map-board .map-axis {
  stroke: var(--tick-major);
  stroke-width: 2;
}
.map-board .map-arrow {
  fill: none;
  stroke: var(--tick-major);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.map-board .map-rim {
  stroke-width: 5;
}
.map-board.dial-interactive:focus-visible .map-rim {
  stroke: var(--accent);
}
.map-board .band {
  stroke: var(--edge);
  stroke-width: 1;
}
.map-board .map-guide {
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-dasharray: 3 4;
  opacity: 0.55;
}
.map-board .map-pin .needle-knob {
  stroke-width: 3;
}
.map-board .map-pin-dot {
  fill: var(--edge);
}
.map-board.ghost .map-pin .map-guide {
  opacity: 0;
}
.map-board.dragging .map-pin .needle-knob {
  r: 13px;
}
.map-board .map-zoom .zoom-rim {
  stroke-width: 3;
}
.map-board .sonar-arrow {
  stroke-width: 3.5;
}
.spectrum-card.map-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  font-size: 19px;
  background: var(--surface-2);
}
.options.map-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.spectrum-card.map-card {
  padding: 10px 6px;
}
.map-wrap.map-preview {
  max-width: 400px;
}
.map-preview .idle-board {
  width: 100%;
}
.map-wrap.map-mini {
  /* A small board in the middle, with the side columns sharing the rest so the ends have room for whole words. */
  grid-template-columns: minmax(0, 1fr) clamp(96px, 34vw, 150px) minmax(0, 1fr);
  gap: 4px 8px;
  max-width: 420px;
  margin: 0 auto;
}
.map-mini .map-end {
  font-size: 14px;
  padding: 4px 8px;
  box-shadow: none;
}
.map-mini .map-top,
.map-mini .map-bottom {
  max-width: 100%;
}
.map-mini .map-board {
  pointer-events: none;
}
body.is-spectator .map-wrap.map-preview {
  --tv-board: clamp(220px, calc(100vh - 500px), 460px);
}
.idle-board {
  width: min(62vw, 240px);
  opacity: 0.6;
}
.idle-board .map-pin {
  animation: idle-wander 9s ease-in-out infinite;
}
.idle-board.ghost .map-pin .needle-knob {
  fill: var(--peach);
  stroke-dasharray: none;
}
@keyframes idle-wander {
  0%, 100% { translate: -28px 18px; }
  33% { translate: 24px -22px; }
  66% { translate: 30px 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .idle-board .map-pin { animation: none; }
}
.screen.clue-reader .map-board {
  max-width: 340px;
  margin: 0 auto;
}
@media (max-width: 380px) {
  .map-end {
    font-size: 14px;
  }
}
body.is-spectator .map-wrap {
  max-width: 820px;
}
body.is-spectator .map-end {
  font-size: clamp(20px, 2.6vw, 32px);
}

/* Polish: map rounds */
.map-end { text-wrap: balance; }
/* Big screen: keep the whole board (and its bottom end) on one screen. */
body.is-spectator .map-wrap {
  --tv-board: clamp(340px, calc(100vh - 440px), 760px);
  grid-template-columns: minmax(0, 1fr) var(--tv-board) minmax(0, 1fr);
  max-width: calc(var(--tv-board) + 2 * min(300px, 22vw));
  gap: 6px 14px;
}
body.is-spectator .map-left { justify-self: end; }
body.is-spectator .map-right { justify-self: start; }
/* Standings: the Clue Giver tag shrinks before it gets cut off on phones. */
@media (max-width: 440px) {
  .st-name .tag { font-size: 9.5px; padding: 2px 6px; letter-spacing: 0.04em; flex: none; }
}
/* Polish: the mind-reader pair slide stays butter in both themes; the rivalry callout is a cutout strip. */
.hs-slide.hs-pair,
.hs-slide.hs-pair.me { background: var(--butter); color: var(--butter-ink); }
.hs-pair .hs-name,
.hs-pair .hs-title,
.hs-pair .hs-detail { color: inherit; }
.hs-pair .hs-emoji { background: var(--surface); }
.hs-pair .hs-who .avatar + .avatar { margin-left: -12px; }
.hs-callout { background: var(--rose); color: var(--rose-ink); box-shadow: var(--puff-sm); font-size: 16px; text-wrap: balance; }
body.is-spectator .hs-callout { font-size: 24px; padding: 14px 18px; }
@media (max-width: 380px) {
  .map-left,
  .map-right { font-size: 12.5px; padding: 5px 5px; }
  .map-mini .map-left,
  .map-mini .map-right { font-size: 13px; }
}

/* ---------- Host controls (features/17) ---------- */
.host-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  margin: -2px 0;
  padding: 0 12px 0 9px;
  border-radius: 999px;
  border: 0;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  box-shadow: var(--puff-sm);
  cursor: pointer;
  transition: transform 0.08s;
}
.host-toggle[hidden] {
  display: none;
}
.host-toggle:active {
  transform: scale(0.94);
}
.host-toggle:focus-visible,
.hm-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.host-menu {
  z-index: 42;
}
.host-menu .drawer-sheet {
  max-height: 86vh;
}
.hm-body {
  display: grid;
  gap: 18px;
}
.hm-group {
  display: grid;
  gap: 8px;
}
.hm-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.hm-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--dim);
}
.hm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.hm-btn {
  min-width: 0;
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hm-btn:disabled {
  opacity: 0.45;
}
.hm-btn.armed {
  background: var(--danger-soft);
  color: var(--danger-ink);
  box-shadow: 0 0 0 2.5px var(--danger), 3px 3px 0 2px var(--drop);
  animation: hm-wiggle 0.3s ease-out;
}
@keyframes hm-wiggle {
  30% {
    transform: rotate(-2deg);
  }
  70% {
    transform: rotate(1.5deg);
  }
}
.hm-players {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.hm-player {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: 0 0 0 2px var(--edge);
}
.hm-player.offline {
  opacity: 0.7;
}
.hm-who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.hm-name {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hm-name em {
  font-weight: 600;
  color: var(--muted);
}
.hm-name .tag {
  margin-left: 6px;
}
.hm-score {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 500;
}
.hm-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hm-acts .hm-btn {
  min-height: 40px;
  font-size: 14px;
}
.hm-acts .hm-pt {
  min-width: 48px;
  font-family: var(--mono);
}
.hm-acts .hm-btn:nth-child(3) {
  margin-left: auto;
}
@media (prefers-reduced-motion: reduce) {
  .hm-btn.armed {
    animation: none;
  }
}

/* Paused: a paper card over the round for everyone; the top bar (and the host menu) stay usable. */
.paused-overlay {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  padding: 120px calc(16px + var(--safe-r)) calc(24px + var(--safe-b)) calc(16px + var(--safe-l));
  background: var(--scrim);
  animation: paused-in 0.2s ease-out;
}
.paused-card {
  width: min(100%, 360px);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 24px 22px 22px;
  text-align: center;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--puff);
  transform: rotate(-1.5deg);
}
.paused-bars {
  display: flex;
  gap: 10px;
}
.paused-bars span {
  width: 16px;
  height: 46px;
  border-radius: 6px;
  background: var(--butter);
  box-shadow: 0 0 0 2.5px var(--edge), 3px 3px 0 2.5px var(--drop);
}
.paused-title {
  margin: 6px 0 0;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.paused-text {
  margin: 0 0 6px;
  color: var(--muted);
  font-weight: 600;
}
.timer.frozen {
  opacity: 0.6;
}
@keyframes paused-in {
  from {
    opacity: 0;
  }
}
body.is-spectator .paused-card {
  width: min(100%, 560px);
  padding: 40px;
}
body.is-spectator .paused-title {
  font-size: 64px;
}

/* Long spectrum ends: wrap between words, never mid-word; fit.js shrinks a word that is still too wide. */
.spectrum-card:not(.map-card) {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}
.spectrum-banner-wrap:not(.map-banners) .spectrum-banner {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}
.spectrum-card:not(.map-card) .sc-left,
.spectrum-card:not(.map-card) .sc-right,
.sb-end,
.ends .end {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
  text-wrap: balance;
}
@media (max-width: 440px) {
  .spectrum-card.sc-long:not(.map-card) {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 440px) {
  .spectrum-banner-wrap:not(.map-banners) .spectrum-banner {
    font-size: 18px;
    gap: 8px;
    padding: 12px 14px;
  }
}

/* Past games: the leaderboard may scroll sideways on a narrow phone, but never up and down. overflow-x: auto alone
   computes overflow-y to auto too, and a vertical swipe that started on the table then latched onto it (Android
   Chrome, large text) instead of scrolling the page. */
.hist-scroll { overflow-y: hidden; overscroll-behavior-x: contain; touch-action: pan-x pan-y; }

/* Past games on phones: a real table again (Tejas preferred it to cards). Number columns have fixed widths, the
   player column takes what is left and long names end in an ellipsis, so all six columns fit without scrolling. */
.hist-scroll { overflow-x: hidden; }
.hist-board { table-layout: fixed; }
.hist-board th, .hist-board td { overflow: hidden; }
.hist-board th:nth-child(n + 2) { width: 5em; }
.hist-board td.hist-player { max-width: none; padding-left: 3px; }
.hist-board th:first-child { padding-left: 3px; }
.hist-board .hist-pname { flex: 1 1 0; max-width: none; white-space: nowrap; }
.hist-board .hist-rank { flex: none; }
.hist-board th[data-short] .th-short { display: none; }
@media (max-width: 480px) {
  .hist-board { font-size: 15px; }
  .hist-board th { font-size: 10px; letter-spacing: 0.03em; width: auto; }
  .hist-board th:nth-child(2), .hist-board th:nth-child(3) { width: 12%; }
  .hist-board th:nth-child(4) { width: 14%; }
  .hist-board th:nth-child(5), .hist-board th:nth-child(6) { width: 12.5%; }
}
@media (max-width: 380px) {
  .hist-board { font-size: 14px; }
  .hist-board th, .hist-board td { padding: 9px 2px; }
  .hist-board th[data-short] .th-full { display: none; }
  .hist-board th[data-short] .th-short { display: inline; }
  .hist-board th:nth-child(2), .hist-board th:nth-child(3) { width: 9%; }
  .hist-board th:nth-child(4) { width: 15%; }
  .hist-board th:nth-child(5) { width: 12%; }
  .hist-board th:nth-child(6) { width: 11%; }
  .hist-board .hist-rank { min-width: 22px; height: 22px; font-size: 12px; }
}

/* ---------- Hot seat slideshow (game over) ---------- */
.showcase {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
}
.showcase.podium {
  justify-content: flex-end;
  background: none;
  backdrop-filter: none;
  pointer-events: none;
}
.showcase.podium .sc-host { pointer-events: auto; }
.sc-box {
  position: relative;
  width: min(100%, 520px);
  min-height: min(62vh, 460px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 26px 20px 30px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 0 0 2.5px var(--edge), var(--shadow);
  text-align: center;
  overflow: hidden;
}
.sc-box.tease { transform: rotate(-1.2deg); }
.sc-box.reveal { transform: rotate(0.8deg); }
.sc-box.reveal.me { background: var(--butter); color: var(--butter-ink); }
.sc-box[data-kind='pair'].reveal:not(.me) { background: var(--accent-soft); }
.sc-count {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.sc-box.me .sc-count { color: inherit; opacity: 0.7; }
.sc-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sc-emoji { font-size: clamp(72px, 22vw, 120px); line-height: 1.05; }
.sc-mystery {
  display: grid;
  place-items: center;
  width: 1.3em;
  height: 1.3em;
  border-radius: 50%;
  font-size: clamp(56px, 16vw, 88px);
  font-weight: 900;
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--edge);
}
.sc-title { margin: 0; font-size: clamp(30px, 8.5vw, 46px); line-height: 1.05; font-weight: 900; letter-spacing: -0.02em; text-wrap: balance; }
.sc-tease { margin: 0; font-size: 20px; color: var(--muted); text-wrap: balance; }
.sc-who { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; font-size: 22px; font-weight: 800; }
.sc-name { overflow-wrap: anywhere; }
.sc-detail { margin: 0; font-size: 19px; overflow-wrap: anywhere; text-wrap: balance; }
.sc-also { margin: 0; font-size: 14px; opacity: 0.75; }
.sc-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--line); }
.sc-bar > span { display: block; height: 100%; width: 0; background: var(--peach); }
@keyframes sc-bar { from { width: 0; } to { width: 100%; } }
.sc-host { display: flex; gap: 10px; width: min(100%, 520px); }
.sc-host .btn { flex: 1; }
@media (prefers-reduced-motion: no-preference) {
  .sc-box.tease .sc-mystery { animation: sc-wobble 0.9s ease-in-out infinite; }
  .sc-box.tease .sc-title { animation: sc-rise 0.45s ease-out both; }
  .sc-box.reveal .sc-emoji { animation: hs-pop 0.5s ease-out both; }
  .sc-box.reveal .sc-who { animation: sc-rise 0.4s 0.15s ease-out both; }
  .sc-box.reveal .sc-detail { animation: sc-rise 0.4s 0.3s ease-out both; }
}
@keyframes sc-wobble { 50% { transform: rotate(8deg) scale(1.06); } }
@keyframes sc-rise { from { transform: translateY(14px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .sc-bar > span { animation: none !important; width: 100%; opacity: 0.4; }
}
body.is-spectator .sc-box { width: min(100%, 900px); min-height: 60vh; }
body.is-spectator .sc-title { font-size: clamp(44px, 6vw, 80px); }
body.is-spectator .sc-detail, body.is-spectator .sc-tease { font-size: clamp(22px, 2.4vw, 34px); }
/* ---------- Highlight reel (game over): replays inside the slideshow card ---------- */
.sc-box[data-kind='highlight'].reveal { transform: none; justify-content: flex-start; padding: 18px 14px 26px; }
.sc-box[data-kind='highlight'].reveal:not(.me) { background: var(--surface); }
.sc-box[data-kind='highlight'] .sc-stage { width: 100%; }
.rp { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rp-title { font-size: clamp(22px, 6.4vw, 32px); }
.rp-title::before { content: attr(data-emoji) ' '; }
.rp-clue { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.rp-round { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.sc-box.me .rp-round { color: inherit; opacity: 0.7; }
.rp-clue-text { font-size: 20px; font-weight: 800; overflow-wrap: anywhere; text-wrap: balance; }
.rp .dial-wrap { margin: 4px auto 0; max-width: min(100%, 420px); }
.rp .map-wrap { max-width: min(100%, 40vh, 380px); margin: 0 auto; }
.rp .dial-needles .needle.other { opacity: 0.8; }
.rp .dial-needles .needle.other:last-child { opacity: 1; }
.rp .dial-needles .needle.other:last-child .needle-line { stroke-width: 5; }
.rp-caption { min-height: 3.4em; display: flex; align-items: center; justify-content: center; gap: 12px; }
.rp-caption .rp-detail { text-align: left; }
.rp:not([data-stage='landed']) .rp-caption > * { visibility: hidden; }
.rp-points { flex: none; font-size: 30px; font-weight: 900; color: var(--muted); }
.rp-points.pts-4 { color: var(--pts-4); }
.rp-points.pts-3 { color: var(--pts-3); }
.rp-points.pts-2 { color: var(--pts-2); }
@media (prefers-reduced-motion: no-preference) {
  .rp[data-stage='locked'] .dial-needles .needle.other:last-child { animation: rp-hold 0.5s ease-in-out infinite; }
  .rp[data-stage='landed'] .dial-bands { animation: rp-land 0.45s ease-out both; }
  .rp[data-stage='landed'] .rp-caption > * { animation: sc-rise 0.4s ease-out both; }
  .rp[data-stage='landed'] .rp-points { animation: hs-pop 0.5s 0.1s ease-out both; }
}
@keyframes rp-hold { 50% { opacity: 0.55; } }
@keyframes rp-land { from { opacity: 0; } }
body.is-spectator .rp .map-wrap { max-width: min(100%, 44vh); }
body.is-spectator .rp-title { font-size: clamp(28px, 3.2vw, 44px); }
body.is-spectator .rp .dial-wrap { max-width: min(100%, 760px, 88vh); }
body.is-spectator .rp-clue-text { font-size: clamp(24px, 2.6vw, 38px); }
body.is-spectator .rp-points { font-size: clamp(34px, 3.4vw, 56px); }
/* ---------- Roomier top bar (design-ux/17): code, points, reactions and a ⋯ menu; the round line gets row two ---------- */
.tb-row .react-toggle { width: 40px; height: 40px; margin: 0; }
.tb-menu-wrap { position: relative; flex: none; }
.tb-menu-btn { width: 40px; min-width: 40px; padding: 0 !important; display: inline-flex; align-items: center; justify-content: center; }
.tb-menu-btn.open { background: var(--accent); color: var(--on-accent); }
.tb-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 40;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--puff);
}
.tb-menu[hidden] { display: none; }
.tb-menu hr { border: 0; border-top: 1.5px solid var(--line); margin: 4px 8px; }
.tb-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 0;
  border-radius: calc(var(--radius) - 6px);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.tb-menu-item:hover,
.tb-menu-item:focus-visible { background: var(--surface-2); outline: none; }
.tb-menu-item:active { background: var(--accent-soft); }
.tb-menu-item.danger { color: var(--danger); }
.tb-menu-item.is-muted { color: var(--muted); }
.tb-score { white-space: nowrap; font-variant-numeric: tabular-nums; }
/* The round line wraps instead of being cut off. */
.tb-sub { align-items: center; min-height: 28px; }
.tb-sub .tb-status { white-space: normal; line-height: 1.25; }
.tb-sub .tb-status-text { overflow: visible; text-overflow: clip; }
@media (max-width: 380px) {
  .topbar .brand-mini { display: none; }
}
/* Menu rows reuse the toggle buttons, so undo their square chip sizing. */
.tb-menu .tb-menu-item.sound-toggle,
.tb-menu .tb-menu-item.theme-toggle {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  justify-content: flex-start;
}
.tb-menu-item svg { flex: none; width: 22px; height: 22px; }
.tb-menu-item span { white-space: nowrap; }
/* The music row: a three-bar level meter on the right (design-ux/22). */
.tb-menu-item .music-bars {
  margin-left: auto;
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
}
.music-bars i {
  width: 5px;
  border-radius: 2px;
  background: var(--line);
}
.music-bars i:nth-child(1) { height: 7px; }
.music-bars i:nth-child(2) { height: 12px; }
.music-bars i:nth-child(3) { height: 18px; }
.music-bars i.on { background: var(--accent); }
.tb-menu-item.is-muted .music-bars i.on { background: var(--muted); }

/* ---------- Lobby join link on its own row (design-ux/18) ---------- */
.join-card { flex-wrap: wrap; }
.join-card .join-url {
  flex: 1 1 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 8px 8px 8px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}
/* Break between the address and the room part; inside either only when a phone is too narrow for it. */
.join-url-text { flex: 1; min-width: 0; padding-bottom: 1px; }
.join-url-text .nowrap { display: inline-block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
.join-card .join-url { position: relative; padding: 9px 12px; }
.join-url-copy { position: absolute; right: 8px; bottom: 7px; }
.join-url-copy {
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--edge);
  color: var(--ink);
  font-family: var(--font, inherit);
  font-size: 12px;
  font-weight: 800;
}
.join-card .join-url:active .join-url-copy { background: var(--accent-soft); }
body.is-spectator .join-card .join-url { font-size: clamp(14px, 1.6vw, 22px); cursor: default; }
body.is-spectator .join-url-copy { display: none; }
.copy-scratch { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; }
@media (max-width: 359px) {
  .join-card .join-url { flex: none; align-self: stretch; }
  .join-card .join-url { font-size: 12px; padding: 9px 8px; }
}

/* ---------- Lobby "You" card: your photo and your sound in one place ---------- */
.you-card {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
}
.you-card .avatar-slot + .sound-slot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px dashed var(--line);
}
.you-card .you-section {
  padding: 4px 2px;
}
.you-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.you-lead {
  flex: none;
  width: 40px;
  height: 40px;
}
.you-label {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.you-change {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
}
.you-remove {
  flex: none;
  border-radius: 50%;
  border: 0;
  color: var(--danger);
}
.you-remove:hover {
  background: var(--danger-soft);
}
@media (max-width: 339px) {
  .you-change-text {
    display: none;
  }
  .you-change {
    padding: 0 12px;
  }
}
.you-note {
  margin: 10px 0 0;
  min-height: 0;
  font-size: 13px;
}
/* Under the host's settings: they are remembered on this device, with a quiet way back to the defaults. */
.settings-note {
  margin: 10px 0 0;
  min-height: 0;
  font-size: 13px;
}
.link-btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 8px 2px;
  margin: -8px 0;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
/* Both skipped and nothing saved: just the two chips side by side, no card around them. */
.you-card:not(:has(.you-row, .you-section)) {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  background: none;
  box-shadow: none;
}
.you-card:not(:has(.you-row, .you-section)) .sound-slot {
  margin: 0;
  padding: 0;
  border: 0;
}

/* ---------- Operator stats page (/stats.html) ---------- */
.stats-range { display: flex; gap: 8px; flex-wrap: wrap; }
.stats-range .btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-deep); }
.stats-body { display: flex; flex-direction: column; gap: 16px; }
.stats-tiles { margin: 0 0 4px; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.stats-tile { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.stats-tile dt { font-size: 12px; color: var(--muted); }
.stats-tile dd { margin: 2px 0 0; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
.stats-tile small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.stats-sub { margin: 14px 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.stats-bars { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, max-content) minmax(40px, 1fr) max-content; gap: 6px 10px; align-items: center; font-size: 14px; }
.stats-bars li { display: contents; }
.stats-bar-label { overflow-wrap: anywhere; max-width: 14em; }
.stats-bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.stats-bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.stats-bars b { font-variant-numeric: tabular-nums; text-align: right; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stats-table th, .stats-table td { padding: 8px 6px; text-align: right; white-space: nowrap; }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; padding-left: 0; }
.stats-table th { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.stats-table tr + tr td { border-top: 1.5px solid var(--line); }
.stats-errors { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.stats-errors code { font-family: "DM Mono", ui-monospace, monospace; font-size: 13px; overflow-wrap: anywhere; }
.stats-errors small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

/* Map and reverse rounds: the "2× time" tag on the round banner while the longer timer runs. */
.team-banner .tb-text { flex: 1; min-width: 0; }
.team-banner .tb-time {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--butter);
  color: var(--butter-ink);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}
body.is-spectator .team-banner .tb-time { font-size: 18px; padding: 6px 14px; }

/* "Sike has moved" page a former address serves (server movedPage). */
.moved {
  max-width: 28rem;
  margin: 20vh auto 0;
  padding: 0 16px;
  text-align: center;
}

/* ---------- Report a bug or suggest something (report.js, features/33) ---------- */
.report-link {
  align-self: center;
  margin: 4px auto 0;
  padding: 10px 12px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 4px;
  cursor: pointer;
}
.report-link:active { color: var(--ink); }
.gameover .report-link { display: block; }
.report-card { transform: rotate(0.5deg); }
.report-kinds { display: flex; gap: 8px; flex-wrap: wrap; }
.report-kind { flex: 1 1 auto; }
.report-kind[aria-pressed='true'] { background: var(--butter); color: var(--butter-ink); }
.report-voice { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--radius-sm); background: var(--bg-2); }
.report-rec-row { display: flex; align-items: center; gap: 12px; }
.report-rec {
  flex: none;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--peach);
  color: var(--peach-ink);
  box-shadow: var(--puff-sm);
  cursor: pointer;
}
.report-rec:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 0 0 0 2px var(--edge); }
.report-rec:disabled { opacity: 0.6; }
.report-voice[data-mode='rec'] .report-rec { background: var(--danger); color: #fff; }
.report-rec-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.report-rec-label { font-weight: 700; font-size: 15px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.report-meter { display: none; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; box-shadow: inset 0 0 0 2px var(--edge); }
.report-meter i { display: block; height: 100%; width: 0; background: var(--good); transition: width 0.06s linear; }
.report-voice[data-mode='rec'] .report-meter { display: block; }
.report-take { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-take[hidden] { display: none; }
.report-audio { flex: 1 1 180px; min-width: 0; height: 40px; }
.report-text { width: 100%; min-height: 84px; padding-top: 12px; padding-bottom: 12px; line-height: 1.35; resize: vertical; font: inherit; }
.report-note { font-size: 13px; min-height: 0; }

/* Reports on the operator stats page */
.stats-reports { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.stats-report { padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.stats-report-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--muted); }
.stats-report-kind { padding: 3px 9px; border-radius: 999px; font-weight: 800; font-size: 12px; color: var(--on-pastel); background: var(--butter); }
.stats-report-kind.k-bug { background: var(--band-3); }
.stats-report-kind.k-crash { background: var(--danger); color: #fff; }
.stats-report-text { margin: 0; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.stats-report-text.is-code { font-family: var(--mono); font-size: 13px; }
.stats-report audio { width: 100%; height: 40px; }
.stats-report-facts { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.stats-report details summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--muted); }
.stats-report pre { margin: 8px 0 0; padding: 10px; border-radius: 10px; background: var(--bg-2); font-family: var(--mono); font-size: 12px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
.stats-report-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats-reports-tabs { margin-bottom: 10px; }
.stats-reports + .hint, .stats-reports-tabs + .hint { margin-bottom: 10px; }
