/* ═══════════════════════════════════════════════
   Impostor — midnight card table
   ═══════════════════════════════════════════════ */

:root {
  /* color — felt table under lamplight */
  --felt:        oklch(0.17 0.03 145);
  --felt-deep:   oklch(0.13 0.028 147);
  --felt-lamp:   oklch(0.225 0.038 143);
  --surface:     oklch(0.215 0.035 145);
  --surface-hi:  oklch(0.26 0.04 145);
  --line:        oklch(0.34 0.045 145);
  --ink:         oklch(0.95 0.012 120);
  --muted:       oklch(0.74 0.035 140);
  --gilt:        oklch(0.86 0.11 90);
  --gilt-deep:   oklch(0.78 0.13 85);
  --card-face:   oklch(0.965 0.015 95);
  --card-ink:    oklch(0.24 0.035 145);
  --card-muted:  oklch(0.45 0.03 145);
  --impostor:        oklch(0.52 0.19 27);
  --impostor-bright: oklch(0.66 0.21 27);

  /* type — fixed rem scale (1.1875 ratio-ish) */
  --font-ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1rem;
  --text-lg: 1.1875rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-display: 2.75rem;

  /* space — 4pt scale */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.25rem;
  --space-2xl: 3.5rem;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-card: 20px;

  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);

  /* z scale */
  --z-sticky: 10;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(130% 85% at 50% -12%, var(--felt-lamp), transparent 62%),
    radial-gradient(140% 110% at 50% 115%, var(--felt-deep), transparent 55%),
    var(--felt);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* faint felt grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

#app {
  position: relative;
  max-width: 430px;
  margin-inline: auto;
  min-height: 100dvh;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

h1, h2, h3 { text-wrap: balance; }
h1:focus, h2:focus { outline: none; }

/* ── screens ─────────────────────────────── */

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-inline: max(var(--space-lg), env(safe-area-inset-left), env(safe-area-inset-right));
  padding-top: max(var(--space-md), env(safe-area-inset-top));
  animation: screen-in 240ms var(--ease-out-quint);
}
.screen[hidden] { display: none; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.screen-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding-bottom: var(--space-lg);
}
.screen-body--center {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
}

.screen-foot {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  margin-top: auto;
  padding-top: var(--space-sm);
  padding-bottom: max(var(--space-lg), env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--felt) 62%, transparent);
}

.foot-hint {
  margin: var(--space-2xs) 0 0;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--muted);
}
.foot-hint[hidden] { display: none; }

/* ── top bar (in-game) ───────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: 44px;
}
.topbar-note {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* ── brand header (setup) ────────────────── */

.brand {
  text-align: center;
  padding-block: var(--space-lg) var(--space-xl);
}
.brand-pip {
  margin: 0 0 var(--space-2xs);
  color: var(--gilt);
  font-size: var(--text-lg);
  letter-spacing: 0.4em;
  text-indent: 0.4em; /* optically recenter the tracked glyph */
}
.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-display);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.brand-tag {
  margin: var(--space-xs) 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* ── menu (game modes) ───────────────────── */

.mode-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.mode-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: var(--space-md);
  background: color-mix(in oklch, var(--surface) 80%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 150ms, transform 120ms var(--ease-out-quint);
}
.mode-card:active { background: var(--surface-hi); transform: scale(0.985); }
.mode-card:focus-visible { outline: 2px solid var(--gilt); outline-offset: 3px; }

/* each mode is a mini dealt card */
.mode-glyph {
  flex: none;
  width: 54px;
  aspect-ratio: 5 / 7;
  display: grid;
  place-items: center;
  font-size: var(--text-xl);
  color: var(--gilt);
  background:
    repeating-linear-gradient(45deg, oklch(0.245 0.04 145) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-45deg, oklch(0.245 0.04 145) 0 1px, transparent 1px 7px),
    oklch(0.20 0.035 145);
  border: 1px solid var(--gilt-deep);
  border-radius: 8px;
}
.mode-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}
.mode-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  line-height: 1.2;
}
.mode-desc {
  font-size: var(--text-sm);
  color: var(--muted);
  text-wrap: pretty;
}
.menu-hint {
  margin: var(--space-xs) 0 0;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--muted);
}

/* ── setup header ────────────────────────── */

.topbar .btn-ghost:first-child { margin-left: calc(-1 * var(--space-sm)); }
.setup-head { padding-block: var(--space-2xs) var(--space-lg); }
.setup-head h1 {
  margin: 0 0 var(--space-2xs);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-2xl);
  line-height: 1.15;
}

/* ── panels (setup sections) ─────────────── */

.panel {
  background: color-mix(in oklch, var(--surface) 72%, transparent);
  border: 1px solid color-mix(in oklch, var(--line) 55%, transparent);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}
.panel-head { margin-bottom: var(--space-sm); }
.panel-head h2 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.2;
}
.panel-hint {
  margin: var(--space-2xs) 0 0;
  font-size: var(--text-xs);
  color: var(--muted);
}

/* players */
.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.player-list:not(:empty) { margin-bottom: var(--space-sm); }
.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 48px;
  padding-left: var(--space-sm);
  background: var(--surface-hi);
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.player-row .seat {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  margin-right: var(--space-xs);
  font-variant-numeric: tabular-nums;
}
.remove-btn {
  flex: none;
  width: 48px; height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: var(--text-lg);
  cursor: pointer;
  border-radius: var(--radius-sm);
  touch-action: manipulation;
}
.remove-btn:active { color: var(--ink); background: color-mix(in oklch, var(--felt-deep) 55%, transparent); }
.remove-btn:focus-visible { outline: 2px solid var(--gilt); outline-offset: -2px; }

.add-row { display: flex; gap: var(--space-xs); }
.add-row input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 var(--space-sm);
  font: inherit;
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--felt-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.add-row input::placeholder { color: var(--muted); opacity: 1; }
.add-row input:focus-visible { outline: 2px solid var(--gilt); outline-offset: -1px; border-color: transparent; }
.btn-add { flex: none; min-height: 48px; padding-inline: var(--space-md); }

.field-error {
  margin: var(--space-xs) 0 0;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--impostor-bright);
}

/* standalone text input (matches .add-row input) */
.field-input {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--space-sm);
  margin-bottom: var(--space-sm);
  font: inherit;
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--felt-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.field-input::placeholder { color: var(--muted); opacity: 1; }
.field-input:focus-visible { outline: 2px solid var(--gilt); outline-offset: -1px; border-color: transparent; }

/* removable word/vibe tags */
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: 0;
  padding: 0;
}
.tag-list:not(:empty) { margin-bottom: var(--space-sm); }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-left: var(--space-sm);
  background: var(--surface-hi);
  border: 1px solid color-mix(in oklch, var(--line) 60%, transparent);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  min-height: 40px;
}
.tag button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: var(--text-sm);
  cursor: pointer;
  border-radius: 50%;
  touch-action: manipulation;
}
.tag button:active { color: var(--ink); }
.tag button:focus-visible { outline: 2px solid var(--gilt); outline-offset: -2px; }

/* loaded playlist row */
.playlist-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 48px;
  padding-left: var(--space-sm);
  background: var(--surface-hi);
  border-radius: var(--radius-sm);
}
.playlist-status .playlist-name {
  font-weight: 500;
  color: var(--gilt);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.playlist-status .btn-ghost { flex: none; }

/* settings */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: 48px;
  padding-block: var(--space-xs);
}
.setting-row + .setting-row { border-top: 1px solid color-mix(in oklch, var(--line) 45%, transparent); }
.setting-copy { display: flex; flex-direction: column; gap: 2px; }
.setting-name { font-weight: 500; }
.setting-sub { font-size: var(--text-xs); color: var(--muted); }

/* stepper */
.stepper {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  background: var(--felt-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.step-btn {
  width: 44px; height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-hi);
  color: var(--ink);
  font-size: var(--text-lg);
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.step-btn:active { background: var(--line); }
.step-btn:disabled { opacity: 0.35; cursor: default; }
.step-btn:focus-visible { outline: 2px solid var(--gilt); outline-offset: 1px; }
.stepper output {
  min-width: 2.25rem;
  text-align: center;
  font-weight: 700;
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
}

/* switch */
.switch { position: relative; flex: none; display: inline-block; }
.switch input {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch-track {
  display: block;
  pointer-events: none; /* let taps fall through to the checkbox that fills the wrapper */
  width: 52px; height: 32px;
  border-radius: 999px;
  background: var(--felt-deep);
  border: 1px solid var(--line);
  transition: background 200ms var(--ease-out-quint), border-color 200ms var(--ease-out-quint);
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 4px; left: 4px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 200ms var(--ease-out-quint), background 200ms var(--ease-out-quint);
}
.switch input:checked + .switch-track { background: var(--gilt); border-color: var(--gilt-deep); }
.switch input:checked + .switch-track::after { transform: translateX(20px); background: var(--card-ink); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--gilt); outline-offset: 3px; }

/* category chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}
.chip { position: relative; }
.chip input {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-md);
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in oklch, var(--surface-hi) 60%, transparent);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink);
  transition: border-color 150ms, background 150ms, color 150ms;
}
.chip input:checked + span {
  border-color: var(--gilt-deep);
  background: color-mix(in oklch, var(--gilt) 16%, transparent);
  color: var(--gilt);
  font-weight: 600;
}
.chip input:focus-visible + span { outline: 2px solid var(--gilt); outline-offset: 2px; }

/* ── buttons ─────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 56px;
  padding: var(--space-sm) var(--space-lg);
  border: 0;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: var(--text-lg);
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 120ms var(--ease-out-quint), background 150ms, opacity 150ms;
}
.btn:focus-visible { outline: 2px solid var(--gilt); outline-offset: 3px; }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn-primary {
  width: 100%;
  background: var(--gilt);
  color: var(--card-ink);
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.4), 0 10px 26px oklch(0 0 0 / 0.3);
}
.btn-primary:disabled {
  opacity: 1;
  background: color-mix(in oklch, var(--gilt) 20%, var(--surface));
  color: color-mix(in oklch, var(--gilt) 55%, var(--muted));
  box-shadow: none;
}
.btn-primary:not(:disabled):active { background: var(--gilt-deep); transform: translateY(1px); }

.btn-secondary {
  background: var(--surface-hi);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-secondary:not(:disabled):active { background: var(--line); }

.btn-ghost {
  min-height: 44px;
  padding-inline: var(--space-sm);
  background: none;
  color: var(--muted);
  font-size: var(--text-sm);
}
.btn-ghost:active { color: var(--ink); }

.btn-quit { flex: none; }
.btn[data-armed] { color: var(--impostor-bright); }
.btn-primary[data-armed] {
  color: oklch(0.98 0.008 95);
  background: var(--impostor);
}

/* ── pass / big names ────────────────────── */

.cue {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--muted);
}
.cue-sub {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}
.big-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.25rem, 12vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.big-name--gilt { color: var(--gilt); }
.big-name--red { color: var(--impostor-bright); }

/* ── the card ────────────────────────────── */

.card-stage {
  perspective: 1200px;
  display: grid;
  place-items: center;
  padding-block: var(--space-md);
}

.card {
  position: relative;
  /* height term keeps the card clear of the top bar + footer on short screens */
  width: min(76vw, 300px, max(120px, calc((100dvh - 230px) * 0.714)));
  aspect-ratio: 5 / 7;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 600ms var(--ease-out-quint);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  border-radius: var(--radius-card);
}
.card.flipped { transform: rotateY(180deg); }
.card:focus-visible { outline: 2px solid var(--gilt); outline-offset: 4px; }

.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-card);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

/* back: felt lattice, gilt inset */
.card-back {
  background:
    repeating-linear-gradient(45deg, oklch(0.245 0.04 145) 0 1.5px, transparent 1.5px 11px),
    repeating-linear-gradient(-45deg, oklch(0.245 0.04 145) 0 1.5px, transparent 1.5px 11px),
    oklch(0.20 0.035 145);
  border: 1px solid var(--gilt-deep);
  box-shadow: 0 18px 40px oklch(0 0 0 / 0.35);
}
.card-back::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1.5px solid oklch(0.78 0.13 85 / 0.65);
  border-radius: calc(var(--radius-card) - 8px);
  pointer-events: none;
}
.card-ornament {
  font-size: 3rem;
  line-height: 1;
  color: var(--gilt);
}
.card-back-word {
  margin-top: var(--space-xs);
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-base);
  color: var(--gilt);
  letter-spacing: 0.06em;
}

/* front: ivory face */
.card-front {
  transform: rotateY(180deg);
  justify-content: flex-start;
  gap: var(--space-xs);
  padding: 2.25rem var(--space-lg) var(--space-md);
  background:
    radial-gradient(120% 90% at 50% 0%, oklch(1 0.01 95), transparent 55%),
    var(--card-face);
  color: var(--card-ink);
  border: 1px solid oklch(0.85 0.03 95);
  box-shadow: 0 18px 40px oklch(0 0 0 / 0.35);
}
.card-eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--card-muted);
}
.card-word {
  display: block;
  width: 100%;
  margin-top: auto;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-display);
  line-height: 1.05;
  text-align: center;
  text-wrap: balance;
}
.card-word.is-impostor { color: var(--impostor); font-style: italic; font-weight: 400; }
.card-word--long { font-size: var(--text-2xl); }
.card-sub {
  margin-bottom: auto;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--card-muted);
  text-align: center;
}
.card-foot {
  margin-top: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--card-muted);
  text-align: center;
  text-wrap: pretty;
}
.card-pip {
  position: absolute;
  font-size: var(--text-sm);
  color: var(--gilt-deep);
  line-height: 1;
}
.card-front .card-pip { color: oklch(0.72 0.09 90); }
.card-pip--tl { top: 12px; left: 14px; }
.card-pip--br { bottom: 12px; right: 14px; transform: rotate(180deg); }

/* ── table screen ────────────────────────── */

.table-lede {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  padding-block: var(--space-md) var(--space-xs);
}

.turn-order {
  list-style: none;
  counter-reset: turn;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.turn-order li {
  counter-increment: turn;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 44px;
  padding-inline: var(--space-2xs);
  font-weight: 500;
}
.turn-order li + li { border-top: 1px solid color-mix(in oklch, var(--line) 40%, transparent); }
.turn-order li::before {
  content: counter(turn);
  flex: none;
  width: 1.5rem;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.turn-order li:first-child { color: var(--gilt); font-weight: 600; }
.turn-order li:first-child::before { color: var(--gilt); }
.turn-order .leads {
  margin-left: auto;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gilt);
}

.rules-note {
  border-top: 1px solid color-mix(in oklch, var(--line) 45%, transparent);
  padding-top: var(--space-md);
  max-width: 60ch;
}
.rules-note p {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-sm);
  color: var(--muted);
  text-wrap: pretty;
}
.rules-note strong { color: var(--ink); font-weight: 600; }

/* ── reveal screen ───────────────────────── */

#word-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  width: 100%;
}
.steal-note {
  margin: 0;
  max-width: 34ch;
  font-size: var(--text-sm);
  color: var(--muted);
  text-wrap: pretty;
}
.steal-note strong { color: var(--ink); }
#show-word { align-self: center; min-width: 60%; }
.word-answer {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  animation: screen-in 300ms var(--ease-out-quint);
}
.word-answer[hidden] { display: none; }
.answer-word {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-2xl);
  color: var(--gilt);
}

/* ── online play ─────────────────────────── */

.online-entry {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid color-mix(in oklch, var(--line) 45%, transparent);
}
.mode-glyph--online { color: var(--ink); }

.ol-code {
  color: var(--gilt);
  letter-spacing: 0.08em;
}

.share-btn { width: 100%; min-height: 48px; font-size: var(--text-base); }

.ol-host-tag,
.ol-off-tag {
  margin-left: var(--space-xs);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.ol-host-tag { color: var(--gilt); }
.ol-off-tag { color: var(--muted); }

.ol-summary { margin: 0; font-weight: 500; }
#ol-settings { display: flex; flex-direction: column; gap: var(--space-sm); }

.ol-name-form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}
.ol-name-form .field-input { margin-bottom: 0; }
.ol-or {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-xs) 0;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ol-or::before,
.ol-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: color-mix(in oklch, var(--line) 55%, transparent);
}
.ol-code-input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 var(--space-sm);
  font: inherit;
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  color: var(--gilt);
  background: var(--felt-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.ol-code-input::placeholder { color: var(--muted); font-weight: 500; }
.ol-code-input:focus-visible { outline: 2px solid var(--gilt); outline-offset: -1px; border-color: transparent; }

.ol-waiting {
  margin: var(--space-xs) 0 0;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gilt);
  text-align: center;
  text-wrap: pretty;
}

/* table: fixed-height shell, feed scrolls inside */
[data-screen="ol-table"] {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.ol-turnbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 48px;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--surface-hi);
  font-weight: 600;
  font-size: var(--text-sm);
}
.ol-turnbar--you {
  background: var(--gilt);
  color: var(--card-ink);
}
.ol-skip { min-height: 36px; }
.ol-turnbar--you .ol-skip { color: var(--card-ink); }

.ol-peek {
  align-self: flex-start;
  margin-top: var(--space-xs);
  min-height: 36px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.ol-peek[aria-expanded="true"] { color: var(--gilt); border-color: var(--gilt-deep); }
.ol-peek:focus-visible { outline: 2px solid var(--gilt); outline-offset: 2px; }
.ol-peek-strip {
  margin: var(--space-xs) 0 0;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--card-face);
  color: var(--card-ink);
  font-weight: 600;
  font-size: var(--text-sm);
}

.ol-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  margin: var(--space-sm) 0 0;
  padding: 0 0 var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.ol-sys {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--muted);
  padding-block: var(--space-2xs);
}
.ol-msg {
  max-width: 85%;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  background: color-mix(in oklch, var(--surface) 85%, transparent);
}
.ol-msg--you {
  align-self: flex-end;
  background: var(--surface-hi);
}
.ol-msg-name {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
}
.ol-msg-text { overflow-wrap: anywhere; }
.ol-clue-item {
  align-self: center;
  width: min(100%, 340px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--card-face);
  color: var(--card-ink);
  border: 1px solid oklch(0.85 0.03 95);
  text-align: center;
}
.ol-clue-tag {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--card-muted);
}
.ol-clue-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  overflow-wrap: anywhere;
}

.ol-foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding-top: var(--space-xs);
  padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom));
}
.ol-clue-form,
.ol-chat-form {
  display: flex;
  gap: var(--space-xs);
}
.ol-clue-form input,
.ol-chat-form input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 var(--space-sm);
  font: inherit;
  color: var(--ink);
  background: var(--felt-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.ol-clue-form input { border-color: var(--gilt-deep); }
.ol-clue-form input::placeholder,
.ol-chat-form input::placeholder { color: var(--muted); opacity: 1; }
.ol-clue-form input:focus-visible,
.ol-chat-form input:focus-visible { outline: 2px solid var(--gilt); outline-offset: -1px; border-color: transparent; }
.btn-clue, .btn-send { flex: none; min-height: 48px; padding-inline: var(--space-md); width: auto; }

/* emoji picker for emoji-mode turns */
.ol-emoji-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 2px;
  max-height: 30dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-xs);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.ol-emoji-picker button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
.ol-emoji-picker button:active { background: var(--surface-hi); }
.ol-emoji-picker button:focus-visible { outline: 2px solid var(--gilt); outline-offset: -2px; }

/* aux song search + feed song cards */
.ol-song-results {
  max-height: 40dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  padding: var(--space-xs);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.ol-song-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 52px;
  padding: var(--space-2xs) var(--space-xs);
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.ol-song-option:active { background: var(--surface-hi); }
.ol-song-option:focus-visible { outline: 2px solid var(--gilt); outline-offset: -2px; }
.ol-song-option img { width: 40px; height: 40px; border-radius: 6px; flex: none; }
.ol-song-option--text { color: var(--muted); font-size: var(--text-sm); }
.ol-song-none { margin: 0; padding: var(--space-xs); color: var(--muted); font-size: var(--text-sm); }
.ol-song-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ol-song-meta > span:first-child {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ol-song-artist { font-size: var(--text-xs); color: var(--muted); }

.ol-clue-item--song { text-align: left; }
.ol-song-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
}
.ol-song-row img { width: 44px; height: 44px; border-radius: 6px; flex: none; }
.ol-clue-item--song .ol-clue-text { font-size: var(--text-base); }
.ol-clue-item--song .ol-song-artist { color: var(--card-muted); }
.ol-play {
  flex: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  border: 1px solid oklch(0.8 0.04 95);
  border-radius: 50%;
  background: none;
  color: var(--card-ink);
  font-size: var(--text-sm);
  cursor: pointer;
  touch-action: manipulation;
}
.ol-play:active { background: oklch(0.9 0.02 95); }
.ol-play:focus-visible { outline: 2px solid var(--gilt); outline-offset: 2px; }
.ol-song-links {
  display: flex;
  gap: var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
}
.ol-song-links a { color: var(--card-muted); }

.answer-decoy { color: var(--impostor-bright); font-weight: 600; }

.ol-word-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  width: 100%;
}

.ol-toast {
  position: fixed;
  left: 50%;
  bottom: max(var(--space-lg), env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  margin: 0;
  max-width: min(90vw, 400px);
  padding: var(--space-xs) var(--space-md);
  border-radius: 999px;
  background: var(--surface-hi);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: center;
  box-shadow: 0 10px 26px oklch(0 0 0 / 0.35);
}

/* ── short landscape phones ──────────────── */

@media (max-height: 620px) {
  .card-word { font-size: var(--text-2xl); }
  .card-front { padding-top: 1.5rem; }
  .brand { padding-block: var(--space-md) var(--space-lg); }
  .screen-body { gap: var(--space-md); }
}

/* very short (phone landscape): let the screen scroll instead of squeezing the card */
@media (max-height: 460px) {
  .card { width: 210px; }
  .card-foot { display: none; }
  .screen-foot { position: static; background: none; }
}

/* ── reduced motion ──────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  body { background-attachment: scroll; }
}
