/* Convergence — design system, ported pixel-for-pixel from the designer's
   hi-fi handoff (design_handoff_convergence/Convergence.dc.html + README).
   That doc is the source of truth for look/motion/copy over SPEC §7 wherever
   they differ (see docs/frontend-questions.md for the deviations we kept —
   the ones the backend protocol or the no-start-now rule force).
   Reveal and win render inside the game room's "sky" — there is no separate
   reveal/win screen; see index.html. */

:root {
  --canvas: #14161B;
  --surface: #1d2129;
  --border: #3a4049;
  --border-dim: #2a2f38;

  --text: #dfe3ea;
  --text-strong: #fff;
  --text-secondary: #9aa0aa;
  --text-muted: #6b7078;
  --text-muted-2: #8b909a;
  --placeholder: #5a616c;

  --hue-0: #FF6B5E;
  --hue-1: #8B5CF6;
  --hue-2: #14B8A6;
  --hue-3: #F59E0B;
  --hue-4: #4E9CF5;
  --consensus: #fff;
  --amber: #F59E0B;
  --seat-empty: #454b55;

  --link: #4E9CF5;
  --link-hover: #7fb8f8;
  --btn-ink: #1A1D21;

  --font-display: 'Bricolage Grotesque', sans-serif;
  --font-ui: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: dark;
}

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

html {
  background: var(--canvas);
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

a { color: var(--link); }
a:hover { color: var(--link-hover); }
input::placeholder { color: var(--placeholder); }

button {
  font-family: inherit;
  cursor: pointer;
  appearance: none;
}

:focus-visible { outline: 2px solid var(--hue-4); outline-offset: 2px; }

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

/* [hidden] has the same specificity as a single class selector, so any rule
   below that sets `display` on a hidden-able element (.sky-hint, .sky-win, …)
   would otherwise win the cascade by source order and defeat `el.hidden`.
   This blanket override keeps `hidden` authoritative everywhere. */
[hidden] { display: none !important; }

#app { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.screen { width: 100%; display: flex; flex-direction: column; align-items: center; }

/* ---------- shared button styles ---------- */

.btn-pill {
  border-radius: 999px;
  border: 0;
  background: var(--text-strong);
  color: var(--btn-ink);
  font-family: var(--font-display);
  font-weight: 700;
}
.btn-pill.is-lg { font-size: 19px; padding: 14px 54px; }
.btn-pill.is-md { font-size: 16px; padding: 14px 34px; min-height: 44px; }
.btn-pill.is-share { font-size: 16px; padding: 14px 30px; min-height: 44px; }
.btn-ghost-pill {
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 15px 22px;
  min-height: 44px;
  box-sizing: border-box;
}
/* Bluesky's own brand blue (bsky.app brand assets, #1185FE) — there's no official "Sign in
   with Bluesky" button spec (the atproto team has left branding to each client, since it's
   a multi-app protocol, not Bluesky-specific). Outlined, not filled, by default: login is an
   optional secondary action (SPEC §5 — "never required to play") and needs to visually read
   that way next to the page's actual primary CTA (Play, share-again) rather than compete
   with it at equal weight. `.is-solid` (the modal's own "continue" button, where it IS the
   one clear action in front of the player) gets the stronger filled treatment. */
.btn-bsky-pill {
  border-radius: 999px;
  border: 1.5px solid #1185fe;
  background: transparent;
  color: #1185fe;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 15px 22px;
  min-height: 44px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.btn-bsky-pill:hover { background: rgba(17,133,254,.12); }
.btn-bsky-pill.is-solid { background: #1185fe; color: #fff; }
.btn-bsky-pill.is-solid:hover { background: #0a6fe0; border-color: #0a6fe0; }
.btn-bsky-pill svg { flex-shrink: 0; }

.bsky-login-modal {
  border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text);
  padding: 24px; width: min(360px, calc(100vw - 48px)); box-sizing: border-box;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  max-height: calc(100vh - 48px); overflow-y: auto;
}
.bsky-login-modal::backdrop { background: rgba(10,11,14,.6); backdrop-filter: blur(2px); }
.bsky-login-modal-title { font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--text-strong); margin: 0 0 4px; }
.bsky-login-modal-sub { font-family: var(--font-ui); font-size: 13px; color: var(--text-secondary); margin: 0 0 16px; line-height: 1.4; }
/* In normal flow, not position:absolute — an overlay here would float outside the dialog's
   own box (nothing below it stretches to contain an absolutely-positioned child) and cover
   the cancel/continue buttons entirely. Letting the list push them down instead means the
   modal grows to fit it, which is the correct tradeoff for a fixed-width dialog. */
.bsky-handle-combo { margin-bottom: 18px; }
.bsky-login-modal .bsky-handle-input { width: 100%; }
.bsky-handle-suggestions {
  margin: 6px 0 0; padding: 4px;
  list-style: none; background: var(--canvas); border: 1px solid var(--border); border-radius: 12px;
  max-height: 180px; overflow-y: auto;
}
.bsky-handle-suggestion {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; cursor: pointer;
  font-family: var(--font-mono); font-size: 12px; color: var(--text);
}
.bsky-handle-suggestion img, .bsky-handle-suggestion-avatar-fallback { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; background: var(--border-dim); }
.bsky-handle-suggestion .bsky-suggestion-display { color: var(--text-secondary); }
.bsky-handle-suggestion:hover, .bsky-handle-suggestion.is-active { background: var(--border-dim); }
.bsky-login-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.bsky-handle-hint { font-family: var(--font-ui); font-size: 11px; color: var(--text-muted); margin: 8px 0 0; line-height: 1.4; }
.bsky-handle-hint b { color: var(--text-secondary); font-weight: 600; }
.btn-bsky-pill:disabled { opacity: .4; cursor: not-allowed; }
.btn-bsky-pill:disabled:hover { background: transparent; }
.btn-bsky-pill.is-solid:disabled:hover { background: #1185fe; }

.btn-appear { animation: popin .3s var(--ease); }

@keyframes popin { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes driftL { 0%, 18% { transform: translateX(0); opacity: .95; } 46% { transform: translateX(105px) scale(.72); opacity: 0; } 100% { opacity: 0; } }
@keyframes driftR { 0%, 18% { transform: translateX(0); opacity: .95; } 46% { transform: translateX(-105px) scale(.72); opacity: 0; } 100% { opacity: 0; } }
@keyframes fuse {
  0%, 42% { opacity: 0; transform: translateX(-50%) scale(.7); }
  52% { opacity: 1; transform: translateX(-50%) scale(1.12); }
  62%, 84% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; }
}
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes lobbypulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes toastin { from { transform: translateX(-50%) translateY(8px) scale(.9); opacity: 0; } to { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Landing ---------- */

.landing {
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  padding: 24px;
  width: 100%;
  max-width: 440px;
}
.landing-wordmark { font-family: var(--font-display); font-weight: 800; font-size: 48px; letter-spacing: -0.03em; color: var(--text-strong); margin: 0; }
.landing-hero { height: 54px; position: relative; width: 320px; }
.landing-hero span {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  white-space: nowrap;
}
.landing-hero-l { color: var(--hue-0); left: 6%; animation: driftL 5s ease-in-out infinite; }
.landing-hero-r { color: var(--hue-2); right: 6%; animation: driftR 5s ease-in-out infinite; }
.landing-hero-m { color: var(--text-strong); left: 50%; opacity: 0; animation: fuse 5s ease-in-out infinite; }
.landing-nick {
  font-family: var(--font-ui); font-size: 16px; padding: 13px 18px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text-strong);
  width: min(320px, 80vw); text-align: center; outline: none;
}
.landing-rules { font-family: var(--font-ui); font-size: 13px; color: var(--text-secondary); max-width: 46ch; text-align: center; line-height: 1.6; margin: 0; }
.landing-live { font-family: var(--font-mono); font-size: 11px; color: var(--hue-2); margin: 0; }
.landing-disclosure { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted-2); max-width: 46ch; line-height: 1.6; margin: 0; }

/* ---------- Lobby ---------- */

.lobby { flex-direction: column; align-items: center; gap: 26px; padding: 24px; }
.lobby-status { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); min-height: 18px; }
.lobby-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hue-2); animation: lobbypulse 1.4s ease-in-out infinite; }
.lobby-seats { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.lobby-seat { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 80px; }
.lobby-seat-ring {
  width: 64px; height: 64px; border-radius: 50%; border: 2px dashed var(--seat-empty);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; color: var(--text-strong); font-size: 19px;
  transition: border .3s;
}
.lobby-seat.is-joined .lobby-seat-ring { border: 2.5px solid var(--seat-hue, var(--seat-empty)); }
.lobby-seat-name { font-family: var(--font-mono); font-size: 10px; color: var(--text-secondary); text-align: center; }
.lobby-countdown { font-family: var(--font-display); font-weight: 800; font-size: 40px; color: var(--text-strong); min-height: 52px; }
.lobby-leave {
  background: none; border: 0; color: var(--text-muted); font-family: var(--font-mono); font-size: 11px;
  min-width: 44px; min-height: 44px; padding: 8px 16px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- Private rooms (custom-rooms mode) ---------- */

.landing-friends-link {
  background: none; border: 0; color: var(--text-secondary); font-family: var(--font-mono);
  font-size: 12px; margin-top: -8px; padding: 4px;
}
.landing-friends-link:hover { color: var(--text); }

.custom-setup, .custom-lobby { flex-direction: column; align-items: center; gap: 16px; padding: 24px; width: 100%; max-width: 440px; }
.custom-title { font-family: var(--font-display); font-weight: 800; font-size: 28px; color: var(--text-strong); margin: 0; }
.custom-sub { font-family: var(--font-ui); font-size: 13px; color: var(--text-secondary); text-align: center; max-width: 34ch; margin: 0; }

.custom-tabs { display: flex; gap: 8px; }
.custom-tab {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); background: none;
  border: 1.5px solid var(--border); border-radius: 999px; padding: 8px 16px;
}
.custom-tab.is-active { color: var(--text-strong); border-color: var(--hue-4); }

.custom-form { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.custom-field {
  display: flex; align-items: center; justify-content: space-between; width: min(320px, 80vw);
  font-family: var(--font-ui); font-size: 13px; color: var(--text-secondary);
}
.custom-field input {
  font-family: var(--font-mono); font-size: 14px; width: 64px; text-align: center; padding: 8px;
  border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-strong);
}
.custom-toggle {
  display: flex; align-items: flex-start; gap: 10px; width: min(320px, 80vw);
  font-family: var(--font-ui); font-size: 12.5px; color: var(--text-secondary); text-align: left; line-height: 1.4;
}
.custom-toggle input { margin-top: 3px; }
.custom-code-input {
  font-family: var(--font-mono); font-size: 20px; letter-spacing: 0.2em; text-transform: uppercase;
  padding: 13px 18px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-strong); width: min(220px, 70vw); text-align: center; outline: none;
}
.custom-disclosure { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted-2); max-width: 40ch; line-height: 1.6; margin: 0; text-align: center; }
.custom-error { font-family: var(--font-mono); font-size: 11.5px; color: var(--hue-0); min-height: 14px; margin: 0; }

.custom-code-display {
  font-family: var(--font-mono); font-weight: 500; font-size: 34px; letter-spacing: 0.3em;
  color: var(--text-strong); background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 14px 22px;
}

/* ---------- Game room (sky renders reveal + win in place, no separate screens) ---------- */

/* align-items: stretch overrides .screen's shared `center` — the room's
   children (header, sky, dots row, input row, graveyard) must fill the full
   content width, not shrink-wrap, or the sky's %-based word positions all
   collapse toward the middle and .room-header's space-between has nothing
   to space. */
.room {
  width: 100%; max-width: 820px; height: 100dvh; flex-direction: column; align-items: stretch; gap: 12px;
  padding: calc(20px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
}
.room-header { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); flex-shrink: 0; }
.timer-ring { width: 44px; height: 44px; position: relative; }
.timer-ring svg { transform: rotate(-90deg); }
.timer-ring-track { fill: none; stroke: var(--border-dim); stroke-width: 3.5; }
.timer-ring-fill { fill: none; stroke: var(--text-strong); stroke-width: 3.5; stroke-dasharray: 119.4; transition: stroke-dashoffset 1s linear, stroke .4s; }
.timer-ring.is-low .timer-ring-fill { stroke: var(--amber); }
.timer-ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 12px; color: var(--text-strong); }

/* min-height is a floor for normal layout, not a hard guarantee — when the
   OS keyboard shrinks the visual viewport (word-input focused), the sky is
   the one flex item that must be free to compress toward 0 so the header,
   dots, and input row (all flex-shrink:0) never get pushed off-screen. */
.sky { flex: 1; position: relative; min-height: 60px; }
.sky-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 12px; color: var(--placeholder); }
.sky-word {
  position: absolute;
  font-family: var(--font-display); font-weight: 600; font-size: 19px; white-space: nowrap;
  transform: translate(-50%, -50%) scale(var(--s, 1));
  color: var(--word-hue, var(--text));
  transition: left .65s var(--ease), top .65s var(--ease), opacity .35s, filter .4s, transform .3s;
}
.sky-word.is-burned { filter: grayscale(1) brightness(.6); text-decoration: line-through; }
.sky-flash { position: absolute; inset: 0; background: var(--text-strong); opacity: 0; pointer-events: none; transition: opacity .2s; }
.sky-flash.is-flashing { opacity: .9; }
.sky-win {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
.sky-win-word {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(38px, 8vw, 60px); color: var(--text-strong);
  letter-spacing: -0.02em; text-shadow: 0 0 34px rgba(255,255,255,.65);
  animation: popin .45s var(--ease);
}
.sky-stats { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.sky-toast {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 12.5px; color: #c9ced6; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 16px; white-space: nowrap; animation: toastin .3s var(--ease);
}
.win-spark { position: absolute; width: 7px; height: 7px; border-radius: 50%; pointer-events: none; }

.room-dots { display: flex; justify-content: center; gap: 16px; flex-shrink: 0; }
.room-dot {
  width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--seat-hue, var(--text-secondary));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--text-strong);
  position: relative; transition: opacity .3s;
}
.room-dot.is-dim { opacity: .45; }
.room-dot-mark {
  position: absolute; bottom: -17px; font-size: 11px; color: var(--seat-hue, var(--text-secondary));
  opacity: 0; transition: opacity .3s;
}
.room-dot-mark.is-shown { opacity: 1; }

.room-inputrow { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 8px; flex-shrink: 0; }
.room-inputline { display: flex; gap: 10px; justify-content: center; width: 100%; }
.room-inputline.is-shaking { animation: shake .35s; }
.room-word {
  font-family: var(--font-display); font-weight: 600; font-size: 22px; padding: 13px 20px; border-radius: 14px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text-strong);
  width: min(340px, 60vw); text-align: center; outline: none;
}
.room-word.is-disabled { opacity: .45; }
.room-lock {
  font-family: var(--font-ui); font-weight: 600; font-size: 15px; border-radius: 14px; border: 0;
  padding: 0 22px; background: var(--text-strong); color: var(--btn-ink);
}
.room-lock.is-disabled { opacity: .45; }
.room-inputerr { font-family: var(--font-mono); font-size: 11px; color: var(--hue-0); min-height: 15px; margin: 0; }

.graveyard {
  border-top: 1px dashed var(--border); padding-top: 10px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start;
  min-height: 34px; max-height: 96px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex-shrink: 0;
}
#graveyard-words { display: flex; flex-wrap: wrap; gap: 8px 16px; min-width: 0; }
.graveyard-label { font-family: var(--font-mono); font-weight: 500; font-size: 10px; letter-spacing: .1em; color: var(--text-muted); }
.grave-word { font-family: var(--font-display); font-size: 13px; color: var(--word-hue, var(--text)); text-decoration: line-through; text-decoration-thickness: 1.5px; opacity: .6; white-space: nowrap; }

/* ---------- Who was AI ---------- */

.identity { flex-direction: column; align-items: center; gap: 24px; padding: 24px; }
.identity-title { font-family: var(--font-display); font-weight: 700; font-size: 30px; color: var(--text-strong); letter-spacing: -0.02em; margin: 0; }
.identity-sub { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); text-align: center; max-width: 44ch; margin: 0; }
.identity-cards { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.id-card { width: 120px; height: 150px; perspective: 700px; cursor: pointer; border: 0; background: none; padding: 0; }
.id-card[disabled] { cursor: default; }
.id-card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .7s var(--ease); }
.id-card.is-flipped .id-card-inner { transform: rotateY(180deg); }
.id-card-face {
  position: absolute; inset: 0; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; backface-visibility: hidden; font-family: var(--font-display);
}
.id-card-front { background: var(--surface); border: 2.5px solid var(--card-hue, var(--seat-empty)); color: var(--text-strong); }
.id-card.is-picked .id-card-front { box-shadow: 0 0 0 3px var(--card-hue, var(--seat-empty)); }
.id-card-avatar { width: 40px; height: 40px; border-radius: 50%; border: 2.5px solid var(--card-hue, var(--seat-empty)); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.id-card-name { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); }
.id-card-back {
  background: var(--text-strong); color: var(--btn-ink); transform: rotateY(180deg);
  font-weight: 700; font-size: 15px;
}
.id-card-back small { font-family: var(--font-mono); font-weight: 400; font-size: 10px; color: #5A5F66; }

/* ---------- Share card ---------- */

.share { flex-direction: column; align-items: center; gap: 22px; padding: 24px; width: 100%; max-width: 600px; }
.share-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 26px; width: 100%;
}
.share-title { font-family: var(--font-display); font-weight: 800; font-size: 30px; color: var(--text-strong); letter-spacing: -0.02em; margin: 0; }
.share-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); margin: 2px 0 0; }
.share-braid { margin: 20px 0 8px; width: 100%; height: auto; display: block; }
.share-footer { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); text-align: right; }
.share-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.bsky-login { margin-top: 4px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bsky-handle-input {
  font-family: var(--font-mono); font-size: 12px; padding: 10px 14px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text-strong);
  width: 200px; outline: none;
}
.bsky-login-linked { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); margin: 0; }
.bsky-logout-btn {
  background: none; border: 0; padding: 0; font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted); text-decoration: underline;
}

/* ---------- Data / disclosure page ---------- */

.data-page { max-width: 640px; margin: 0 auto; padding: 48px 24px; font-family: var(--font-ui); line-height: 1.6; }
.data-page h1 { font-family: var(--font-display); font-weight: 800; }
.data-page h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; margin-top: 2rem; }
.data-page code { font-family: var(--font-mono); background: var(--surface); padding: 0 4px; border-radius: 3px; }
.data-page a { text-decoration: underline; }

/* ---------- Leaderboard page ---------- */

.leaderboard-page { max-width: 640px; margin: 0 auto; padding: 48px 24px; font-family: var(--font-ui); line-height: 1.6; }
.leaderboard-page h1 { font-family: var(--font-display); font-weight: 800; margin-bottom: 4px; }
.leaderboard-page p.lead { font-family: var(--font-mono); font-size: 12px; opacity: 0.7; margin-top: 0; }
.leaderboard-tabs { display: flex; gap: 8px; margin: 20px 0; }
.leaderboard-tab {
  font-family: var(--font-mono); font-size: 12px; padding: 8px 18px; border-radius: 999px;
  border: 1.5px solid currentColor; background: transparent; opacity: 0.55; cursor: pointer;
}
.leaderboard-tab.is-active { opacity: 1; font-weight: 600; }
.leaderboard-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 13px; }
.leaderboard-table th, .leaderboard-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid currentColor; opacity: 0.9; }
.leaderboard-table th { opacity: 0.6; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.leaderboard-rank { opacity: 0.5; width: 2.5ch; }
.leaderboard-empty { font-family: var(--font-mono); font-size: 12px; opacity: 0.6; padding: 24px 0; }
.leaderboard-page a { text-decoration: underline; }

/* ---------- Dev harness ---------- */

.dev-controls {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px; padding: 10px;
  background: rgba(20,22,27,.95); border-top: 1px solid var(--border); z-index: 100; font-family: var(--font-mono);
  max-height: 40vh; overflow-y: auto;
}
.dev-controls button { font-size: 11px; padding: 8px 12px; min-height: 32px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--text); }
body.dev-mode #app { min-height: calc(100dvh - 13rem); padding-bottom: 13rem; }
/* .room sets a fixed height:100dvh (the real game room is meant to fill the
   viewport exactly) — #app's padding-bottom trick above can't shrink a fixed
   height, so the room's own bottom rows would render under the control bar.
   Shrink the room screen specifically in dev mode instead. */
body.dev-mode .room { height: calc(100dvh - 13rem); }
