/* Tic-Tac-Lab — styles (started from Science Tug of War's). Same game chrome as the other review games (deep navy, gold for the main action,
   raised things on a solid darker bottom edge). Readability floor for a Chromebook at arm's length or a projector:
   body 16px+, HUD 20px+, answers 18px+, the prompt 22-26px, tap targets 48px+. The match fits a 1366x768 window
   (about 1366x650 inside the browser) with no scrolling: the scene (whole-number pixel scale) on top with the board's
   click targets over it, the question / move panel at the bottom, the HUD over the scene. */
:root {
  --ttt-page: #0e1424;
  --ttt-panel: #1a2340;
  --ttt-raised: #243056;
  --ttt-raised-hover: #2d3b69;
  --ttt-edge: #0a0f1c;
  --ttt-line: #33406a;
  --ttt-ink: #f2f5fc;
  --ttt-muted: #b4bed8;
  --ttt-gold: #ffc53d;
  --ttt-gold-edge: #b9820c;
  --ttt-gold-ink: #1d1400;
  --ttt-good: #3ddc97;
  --ttt-good-bg: #10392c;
  --ttt-bad: #ff8a8a;
  --ttt-bad-bg: #401a22;
  --ttt-x: #7cc4ff;          /* side X accent (always paired with a label and the shape) */
  --ttt-o: #ffa860;          /* side O accent */
  --ttt-focus: #7cc4ff;
  --ttt-font: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ttt-mono: 'DM Mono', ui-monospace, monospace;
}

.ttt-body { margin: 0; color: var(--ttt-ink); background: var(--ttt-page); min-height: 100vh; font-size: 16px; line-height: 1.45; }
.ttt-app { font-family: var(--ttt-font); color: var(--ttt-ink); background: var(--ttt-page); padding: 20px 16px 40px; }
.ttt-app *, .ttt-app *::before, .ttt-app *::after { box-sizing: border-box; }
.ttt-app button, .ttt-app input, .ttt-app select { font: inherit; }
.ttt-app button { cursor: pointer; }
.ttt-app :where(button, a, input, select, summary, [tabindex]):focus-visible { outline: 3px solid var(--ttt-focus); outline-offset: 3px; }
.ttt-app h1, .ttt-app h2 { font-weight: 800; letter-spacing: -.02em; margin: 0 0 8px; }
.ttt-app h1 { font-size: 40px; line-height: 1.1; }
.ttt-app h2 { font-size: 26px; }
.ttt-app [hidden] { display: none !important; }
.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; }
.ttt-app kbd { padding: 0 6px; font: 500 14px/1.4 var(--ttt-mono); color: inherit; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .22); border-bottom-width: 2px; border-radius: 6px; }
.ttt-kicker { margin: 0 0 4px; color: var(--ttt-muted); font-family: var(--ttt-mono); font-size: 14px; letter-spacing: .1em; text-transform: uppercase; }
.ttt-lede { font-size: 18px; color: var(--ttt-muted); margin: 0 0 16px; }
.ttt-hint { color: var(--ttt-muted); margin: 4px 0 12px; }
.ttt-msg { min-height: 1.45em; margin: 10px 0 0; color: var(--ttt-gold); font-weight: 600; }
.ttt-msg.is-bad { color: var(--ttt-bad); }
.ttt-card { background: var(--ttt-panel); border: 2px solid var(--ttt-line); border-radius: 14px; padding: 22px; }

/* While a match is on screen the game owns the viewport. */
body.ttt-playing { overflow: hidden; }
body.ttt-playing .tlg-header, body.ttt-playing .tlg-footer, body.ttt-playing .tlg-skip, body.ttt-playing .tlg-overlay { display: none; }

.ttt-screen { display: none; max-width: 1180px; margin: 0 auto; }
.ttt-screen.is-active { display: block; }

/* ---- buttons ---------------------------------------------------------------------------------- */
.ttt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border: 0; border-radius: 10px;
  font-weight: 700; font-size: 18px; color: var(--ttt-ink); background: var(--ttt-raised); box-shadow: 0 3px 0 var(--ttt-edge); transition: transform .06s, box-shadow .06s, background .12s; }
.ttt-btn:hover:not(:disabled) { background: var(--ttt-raised-hover); }
.ttt-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ttt-edge); }
.ttt-btn:disabled { opacity: .55; cursor: not-allowed; }
.ttt-btn-go { color: var(--ttt-gold-ink); background: var(--ttt-gold); box-shadow: 0 3px 0 var(--ttt-gold-edge); }
.ttt-btn-go:hover:not(:disabled) { background: #ffd162; }
.ttt-btn-quiet { background: transparent; box-shadow: inset 0 0 0 2px var(--ttt-line); }
.ttt-btn-quiet:hover:not(:disabled) { background: rgba(255, 255, 255, .06); }
.ttt-btn-bad { background: #8f2a35; box-shadow: 0 3px 0 #4d141b; }
.ttt-btn-small { min-height: 40px; padding: 0 12px; font-size: 16px; }
.ttt-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; margin-top: 18px; }

/* ---- title ------------------------------------------------------------------------------------ */
.ttt-title-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .ttt-title-grid { grid-template-columns: 1fr; } }
.ttt-me { display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin-bottom: 18px; background: rgba(0, 0, 0, .18); border-radius: 12px; }
.ttt-me-av { width: 64px; height: 64px; flex: none; }
.ttt-me-av canvas { width: 48px; height: 48px; image-rendering: pixelated; }
.ttt-me-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ttt-me-label { color: var(--ttt-muted); font-size: 15px; }
.ttt-me-name { font-size: 22px; overflow-wrap: anywhere; }
.ttt-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .ttt-modes { grid-template-columns: 1fr; } }
.ttt-mode { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; text-align: left; color: var(--ttt-ink);
  background: var(--ttt-raised); border: 0; border-radius: 12px; box-shadow: 0 3px 0 var(--ttt-edge); min-height: 96px; }
button.ttt-mode:hover:not(:disabled) { background: var(--ttt-raised-hover); }
button.ttt-mode:disabled { opacity: .6; cursor: not-allowed; }
.ttt-mode-main { background: var(--ttt-gold); color: var(--ttt-gold-ink); box-shadow: 0 3px 0 var(--ttt-gold-edge); }
button.ttt-mode-main:hover:not(:disabled) { background: #ffd162; }
.ttt-mode-title { font-size: 22px; font-weight: 800; }
.ttt-mode-sub { font-size: 16px; opacity: .9; }
.ttt-mode-row { display: flex; gap: 8px; margin-top: 6px; }
.ttt-mode-row .ttt-btn { min-height: 44px; padding: 0 16px; font-size: 16px; }
.ttt-toggles { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.ttt-toggle { min-height: 44px; padding: 0 14px; border-radius: 10px; color: var(--ttt-ink); background: transparent; border: 2px solid var(--ttt-line); font-size: 16px; }
.ttt-toggle strong { color: var(--ttt-gold); }
.ttt-how { margin-top: 16px; color: var(--ttt-muted); }
.ttt-how summary { cursor: pointer; color: var(--ttt-ink); font-weight: 700; min-height: 32px; }
.ttt-how ul { margin: 8px 0 0; padding-left: 20px; }
.ttt-how li { margin: 4px 0; }

/* Lab Rating board (rows from games/shared/leaderboard.js; .lb-games is ours). */
.ttt-board h2 { margin-bottom: 2px; }
.ttt-lb-head { display: grid; grid-template-columns: 44px 1fr 70px 60px; gap: 8px; padding: 0 8px 6px; color: var(--ttt-muted); font-size: 14px; border-bottom: 1px solid var(--ttt-line); }
.ttt-lb-head span:nth-child(n+3) { text-align: right; }
.ttt-lb-body { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; min-height: 60px; }
.ttt-lb-body .lb-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: rgba(0, 0, 0, .16); font-size: 16px; }
.ttt-lb-body .lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttt-lb-body .lb-pts { display: flex; gap: 8px; font-family: var(--ttt-mono); }
.ttt-lb-body .lb-rating { min-width: 56px; text-align: right; color: var(--ttt-gold); font-weight: 600; }
.ttt-lb-body .lb-games { min-width: 44px; text-align: right; color: var(--ttt-muted); }
.ttt-lb-you { margin: 10px 0 0; color: var(--ttt-muted); }

/* ---- setup screens ---------------------------------------------------------------------------- */
.ttt-narrow { max-width: 620px; margin: 0 auto; }
.ttt-center { text-align: center; }
.ttt-center .ttt-actions { justify-content: center; }
.ttt-field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 0; font-weight: 600; border: 0; padding: 0; }
.ttt-field select, .ttt-field input { min-height: 48px; padding: 0 12px; color: var(--ttt-ink); background: var(--ttt-page); border: 2px solid var(--ttt-line); border-radius: 10px; font-size: 18px; font-weight: 400; }
.ttt-skill { flex-direction: row; flex-wrap: wrap; gap: 10px; }
.ttt-skill legend { width: 100%; margin-bottom: 6px; }
.ttt-skill label { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; background: var(--ttt-raised); border-radius: 10px; font-weight: 600; cursor: pointer; }
.ttt-skill input { width: 20px; height: 20px; accent-color: var(--ttt-gold); }
.ttt-code-input { font-family: var(--ttt-mono); font-size: 32px !important; letter-spacing: .2em; text-transform: uppercase; text-align: center; min-height: 64px !important; }
.ttt-code { font-family: var(--ttt-mono); color: var(--ttt-gold); letter-spacing: .12em; font-size: 34px; }
.ttt-big { font-size: 24px; font-weight: 700; margin: 8px 0; }
.ttt-spinner { width: 56px; height: 56px; margin: 16px auto; border-radius: 50%; border: 6px solid var(--ttt-line); border-top-color: var(--ttt-gold); animation: ttt-spin 1s linear infinite; }
@keyframes ttt-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ttt-spinner { animation-duration: 3s; } }

/* ---- lobby ------------------------------------------------------------------------------------ */
.ttt-lobby { max-width: 900px; margin: 0 auto; }
.ttt-lobby-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.ttt-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
@media (max-width: 560px) { .ttt-sides { grid-template-columns: 1fr; } }
.ttt-side { padding: 14px; border-radius: 12px; background: rgba(0, 0, 0, .18); border: 2px solid var(--ttt-line); }
.ttt-side h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; font-size: 18px; }
.ttt-side[data-side="X"] h3 .ttt-side-name { color: var(--ttt-x); }
.ttt-side[data-side="O"] h3 .ttt-side-name { color: var(--ttt-o); }
.ttt-seat { display: flex; align-items: center; gap: 10px; padding: 6px 0; min-height: 52px; }
.ttt-seat-av { width: 48px; height: 48px; flex: none; }
.ttt-seat-av canvas { width: 48px; height: 48px; image-rendering: pixelated; }
.ttt-seat-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.ttt-seat-name small { display: block; font-weight: 400; color: var(--ttt-muted); font-size: 14px; }
.ttt-seat-empty { color: var(--ttt-muted); font-style: italic; }
.ttt-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .ttt-settings { grid-template-columns: 1fr; } }

/* ---- match ------------------------------------------------------------------------------------ */
.ttt-screen.ttt-game { position: fixed; inset: 0; z-index: 50; max-width: none; margin: 0; flex-direction: column; background: #0b1020; }
.ttt-screen.ttt-game.is-active { display: flex; }
.ttt-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ttt-canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.ttt-hud { position: absolute; top: 0; left: 0; right: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px; padding: 10px 16px; pointer-events: none;
  background: linear-gradient(rgba(8, 12, 24, .82), rgba(8, 12, 24, 0)); }
.ttt-hud-side { display: flex; flex-direction: column; gap: 2px; font-size: 20px; font-weight: 700; min-width: 0; }
.ttt-hud-o { align-items: flex-end; text-align: right; }
.ttt-hud-side .ttt-hud-team { font-family: var(--ttt-mono); font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.ttt-hud-x .ttt-hud-team { color: var(--ttt-x); }
.ttt-hud-o .ttt-hud-team { color: var(--ttt-o); }
.ttt-hud-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ttt-hud-name small { font-weight: 500; color: var(--ttt-gold); font-family: var(--ttt-mono); font-size: 16px; margin-left: 6px; }
.ttt-hud-mid { text-align: center; }
.ttt-timer { font: 700 36px/1 var(--ttt-mono); color: var(--ttt-ink); padding: 6px 14px; background: rgba(0, 0, 0, .45); border-radius: 10px; min-width: 120px; }
.ttt-timer.is-low { color: var(--ttt-gold); }
.ttt-tags { position: absolute; inset: 0; pointer-events: none; }
.ttt-tag { position: absolute; transform: translate(-50%, -100%); padding: 1px 8px; border-radius: 6px; font: 700 14px/1.4 var(--ttt-mono); letter-spacing: .06em; white-space: nowrap; background: rgba(8, 12, 24, .82); color: var(--ttt-ink); border: 1px solid rgba(255, 255, 255, .3); }
.ttt-tag { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.ttt-tag.is-you { background: #fff; color: #10172a; border-color: #fff; }
.ttt-tag.is-bot { color: var(--ttt-muted); }
.ttt-tag.is-out { text-decoration: line-through; opacity: .7; }
.ttt-banner { position: absolute; left: 50%; top: 96px; transform: translateX(-50%); padding: 4px 14px; border-radius: 8px; font: 800 22px/1.3 var(--ttt-font); letter-spacing: .04em; color: var(--ttt-gold-ink); background: var(--ttt-gold); box-shadow: 0 3px 0 var(--ttt-gold-edge); }
.ttt-quit { position: absolute; right: 16px; bottom: 10px; min-height: 40px; padding: 0 14px; border-radius: 8px; color: var(--ttt-muted); background: rgba(8, 12, 24, .7); border: 1px solid var(--ttt-line); font-size: 15px; }
.ttt-quit:hover { color: var(--ttt-ink); }

.ttt-intro { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 40px; background: rgba(8, 12, 24, .86); }
.ttt-intro-side { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 200px; }
.ttt-intro-avs { display: flex; gap: 6px; }
.ttt-intro-avs canvas { image-rendering: pixelated; }
.ttt-intro-name { font-size: 24px; font-weight: 800; text-align: center; }
.ttt-intro-rating { font: 600 20px var(--ttt-mono); color: var(--ttt-gold); }
.ttt-intro-team { font: 700 15px var(--ttt-mono); letter-spacing: .1em; }
.ttt-intro-side:first-child .ttt-intro-team { color: var(--ttt-x); }
.ttt-intro-side:nth-child(3) .ttt-intro-team { color: var(--ttt-o); }
.ttt-vs { font: 900 56px var(--ttt-font); color: var(--ttt-gold); }
.ttt-go { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 900 96px var(--ttt-font); color: var(--ttt-gold); background: rgba(8, 12, 24, .6); text-shadow: 0 6px 0 var(--ttt-gold-edge); }

.ttt-results { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(8, 12, 24, .55); padding: 16px; overflow-y: auto; }
.ttt-results-card { width: min(560px, 100%); text-align: center; margin: auto 0; }
.ttt-results-card > h2 { font-size: 40px; }
.ttt-res-how { font-size: 20px; color: var(--ttt-muted); margin: 0 0 12px; }
.ttt-res-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.ttt-res-stats div { padding: 10px; border-radius: 10px; background: rgba(0, 0, 0, .2); }
.ttt-res-stats dt { color: var(--ttt-muted); font-size: 15px; }
.ttt-res-stats dd { margin: 0; font: 700 26px var(--ttt-mono); }
.ttt-res-reward { font-size: 18px; margin: 14px 0 0; min-height: 1.4em; }
.ttt-res-reward strong { color: var(--ttt-gold); }
.ttt-results .ttt-actions { justify-content: center; }

/* Question panel. */
.ttt-panel { flex: none; padding: 12px 20px 16px; background: var(--ttt-panel); border-top: 3px solid var(--ttt-line); min-height: 230px; }
.ttt-q-meta { display: flex; gap: 14px; align-items: center; min-height: 26px; color: var(--ttt-muted); font-family: var(--ttt-mono); font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
.ttt-streak { color: var(--ttt-gold); font-weight: 600; }
.ttt-afk { margin-left: auto; color: var(--ttt-bad); text-transform: none; letter-spacing: 0; font-family: var(--ttt-font); font-weight: 600; font-size: 16px; }
.ttt-prompt { margin: 4px 0 12px; font-size: 24px; font-weight: 600; line-height: 1.3; min-height: 1.3em; max-width: 1100px; }
.ttt-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 1100px; }
.ttt-options.is-tf { grid-template-columns: 1fr 1fr; max-width: 640px; }
.ttt-opt { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; text-align: left; font-size: 19px; color: var(--ttt-ink); background: var(--ttt-raised); border: 0; border-radius: 10px; box-shadow: 0 3px 0 var(--ttt-edge); line-height: 1.25; }
.ttt-opt:hover:not(:disabled) { background: var(--ttt-raised-hover); }
.ttt-opt:disabled { cursor: default; }
.ttt-opt kbd { flex: none; }
.ttt-panel.is-locked .ttt-opt, .ttt-panel.is-locked .ttt-typed { opacity: .55; }
.ttt-typed { display: flex; gap: 10px; max-width: 760px; }
.ttt-input { flex: 1; min-height: 52px; padding: 0 14px; font-size: 20px; color: var(--ttt-ink); background: var(--ttt-page); border: 2px solid var(--ttt-line); border-radius: 10px; }
.ttt-feedback { margin: 8px 0 0; min-height: 1.4em; font-size: 18px; font-weight: 700; }
.ttt-feedback.is-good { color: var(--ttt-good); }
.ttt-feedback.is-bad { color: var(--ttt-bad); }

.ttt-dialog { max-width: 460px; padding: 22px; color: var(--ttt-ink); background: var(--ttt-panel); border: 2px solid var(--ttt-line); border-radius: 14px; font-family: var(--ttt-font); }
.ttt-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.ttt-dialog h2 { margin-top: 0; }

/* Short windows (a Chromebook at 1366x768 with the browser bar): a slightly tighter panel. */
@media (max-height: 700px) {
  .ttt-panel { min-height: 214px; padding: 8px 16px 12px; }
  .ttt-prompt { font-size: 22px; margin-bottom: 8px; }
  .ttt-opt { min-height: 48px; font-size: 18px; }
  .ttt-timer { font-size: 30px; }
}
@media (max-width: 700px) { .ttt-options { grid-template-columns: 1fr; } .ttt-intro { flex-direction: column; gap: 12px; } }

/* ---- Tic-Tac-Lab: board targets, HUD, move panel ------------------------------------------------ */
.ttt-banner { background: #ff6b6b; color: #22070a; box-shadow: 0 3px 0 #8f2a35; pointer-events: none; z-index: 3; }
.ttt-cells { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.ttt-cell { position: absolute; padding: 0; margin: 0; border: 3px solid transparent; border-radius: 50%; background: transparent; color: var(--ttt-ink); cursor: default; }
.ttt-cell-num { position: absolute; left: 2px; top: 0; font: 700 15px/1 var(--ttt-mono); padding: 2px 5px; border-radius: 6px; background: rgba(8, 12, 24, .7); color: var(--ttt-muted); }
.ttt-cell-tag { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); padding: 1px 6px; border-radius: 5px; font: 800 12px/1.3 var(--ttt-mono); letter-spacing: .05em; white-space: nowrap;
  background: #2e2418; color: #ffcf9a; border: 1px solid #ffcf9a; }
.ttt-cell-mark { position: absolute; right: 2px; top: 0; font: 800 15px/1 var(--ttt-mono); padding: 2px 5px; border-radius: 6px; background: rgba(8, 12, 24, .75); }
.ttt-cell-mark.is-x { color: var(--ttt-x); }
.ttt-cell-mark.is-o { color: var(--ttt-o); }
.ttt-cells.is-active .ttt-cell.can-place, .ttt-cells.is-active .ttt-cell.can-remove { cursor: pointer; }
.ttt-cells.is-active .ttt-cell.can-place:hover, .ttt-cells.is-active .ttt-cell.can-place:focus-visible { border-color: var(--ttt-gold); background: rgba(255, 197, 61, .12); outline: none; }
.ttt-cells.is-active.is-remove .ttt-cell.can-remove { border-color: rgba(143, 227, 255, .55); border-style: dashed; }
.ttt-cells.is-active.is-remove .ttt-cell.can-remove:hover, .ttt-cells.is-active.is-remove .ttt-cell.can-remove:focus-visible { border-color: #8fe3ff; border-style: solid; background: rgba(143, 227, 255, .14); outline: none; }
.ttt-cells.is-active .ttt-cell.can-place .ttt-cell-num, .ttt-cells.is-active.is-remove .ttt-cell.can-remove .ttt-cell-num { color: var(--ttt-gold-ink); background: var(--ttt-gold); }
.ttt-cells.is-active.is-remove .ttt-cell.can-remove .ttt-cell-num { background: #8fe3ff; }

.ttt-hud { z-index: 2; }
.ttt-hud-side { gap: 4px; }
.ttt-hud-team { display: inline-flex; align-items: center; gap: 8px; }
.ttt-hud-shape { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 6px; font: 800 18px/1 var(--ttt-mono); color: #0b1020; }
.ttt-hud-x .ttt-hud-shape { background: var(--ttt-x); }
.ttt-hud-o .ttt-hud-shape { background: var(--ttt-o); }
.ttt-hud-o .ttt-hud-team { flex-direction: row-reverse; }
.ttt-tokens { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: var(--ttt-muted); }
.ttt-hud-o .ttt-tokens { flex-direction: row-reverse; }
.ttt-pip { width: 14px; height: 30px; flex: none; }
.ttt-pip.is-used { opacity: .25; }
.ttt-hud-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ttt-round { font: 700 16px var(--ttt-mono); color: var(--ttt-muted); letter-spacing: .06em; text-transform: uppercase; }
.ttt-status { font-size: 18px; font-weight: 700; min-height: 1.4em; color: var(--ttt-ink); text-shadow: 0 2px 0 rgba(0, 0, 0, .6); }
.ttt-status.is-you { color: var(--ttt-gold); }

.ttt-reveal { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 14px; margin-top: 4px; font-size: 20px; border-radius: 10px; background: rgba(0, 0, 0, .22); border: 2px solid var(--ttt-line); }
.ttt-reveal.is-good { background: var(--ttt-good-bg); border-color: var(--ttt-good); }
.ttt-reveal.is-bad { background: var(--ttt-bad-bg); border-color: var(--ttt-bad); }
.ttt-reveal strong { font-weight: 800; }
.ttt-reveal .is-good-text { color: var(--ttt-good); }
.ttt-reveal .is-bad-text { color: var(--ttt-bad); }
.ttt-reveal-answer { font-weight: 700; color: #fff; }
.ttt-moveui { padding: 4px 0; }
.ttt-move-text { margin: 0 0 10px; font-size: 22px; font-weight: 700; }
.ttt-move-text.is-you { color: var(--ttt-gold); }
.ttt-move-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ttt-move-tools .ttt-btn[aria-pressed="true"] { color: var(--ttt-gold-ink); background: var(--ttt-gold); box-shadow: 0 3px 0 var(--ttt-gold-edge); }
.ttt-move-bar { flex: 1 1 200px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.ttt-move-bar span { display: block; height: 100%; width: 100%; background: var(--ttt-gold); transform-origin: left; }
.ttt-waiting { color: var(--ttt-muted); font-size: 20px; }
.ttt-answered-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.ttt-pill { padding: 2px 10px; border-radius: 999px; font-size: 15px; background: rgba(255, 255, 255, .08); color: var(--ttt-muted); }
.ttt-pill.is-in { color: var(--ttt-ink); background: rgba(61, 220, 151, .18); }
.ttt-tag { transform: translate(-50%, -100%); }
/* The board starts ~72 px down at scale 3: keep the HUD's middle to one compact row above it. */
.ttt-hud-mid { flex-direction: row; align-items: center; gap: 12px; }
.ttt-hud-mid .ttt-timer { font-size: 28px; padding: 4px 12px; min-width: 96px; }
.ttt-round, .ttt-status { min-width: 150px; }
.ttt-round { text-align: right; }
.ttt-status { text-align: left; font-size: 17px; }
.ttt-banner { top: auto; bottom: 14px; }
.ttt-intro { z-index: 4; }
.ttt-results { z-index: 5; }
.ttt-quit { z-index: 3; }
.ttt-prompt:empty { display: none; }
@media (max-width: 900px) { .ttt-round, .ttt-status { min-width: 0; } .ttt-hud-mid { flex-direction: column; gap: 2px; } }
.ttt-cell:not(.can-place):not(.can-remove):focus-visible { outline: none; }
/* A fixed-height panel, so the board's whole-number scale does not jump between question, reveal and move. The
   1366x650 budget: 210 px panel + a 420 px scene (140 logical px x 3). */
.ttt-panel { height: 210px; min-height: 0; overflow-y: auto; padding: 10px 20px 12px; }
.ttt-prompt { font-size: 22px; margin: 2px 0 10px; }
@media (min-width: 1000px) { .ttt-options:not(.is-tf) { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: none; } }
.ttt-opt { font-size: 18px; min-height: 52px; }
@media (max-height: 700px) { .ttt-panel { height: 210px; min-height: 0; } .ttt-prompt { font-size: 21px; } }
@media (max-height: 560px) { .ttt-panel { height: 190px; } }
