/* Board styling is shared with the theater build, which does not load this file. */
@import url('src/board.css');
@import url('src/segclock.css');

/* Jost (2026-10-02): the app's one typeface, bundled in fonts/ so it works offline and in the
   Android app. Before this the app named no font: labels fell to the OS default (Segoe UI,
   Roboto, San Francisco) and buttons to the browser's own default (Arial on Windows). */
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 300 600; font-display: swap;
  src: url('fonts/jost-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 300 600; font-display: swap;
  src: url('fonts/jost-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: #05070e; }
body {
  font-family: 'Jost', -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: #cfe0ff;
  position: relative;
}
button, input { font-family: inherit; } /* form controls don't inherit the page font by default */
/* An app, not a page (stress pass, 2026-10-18): a long press on a tab, a name or a game row selected the text and raised the
   Copy menu. Text fields keep selection. */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }
/* Drawn icons (src/icons.js, 2026-10-02): each sizes to its button's font-size and draws in its colour. */
[data-icon] svg { width: 1em; height: 1em; display: block; }
.ico-inline { display: inline-block; width: 0.9em; height: 0.9em; vertical-align: -0.08em; margin-left: 0.15em; }
.ico-inline svg { width: 100%; height: 100%; }
#ambiance { position: fixed; inset: 0; z-index: 0; }
/* move-trail nebulas sit ABOVE the board (z-index 1) but below the menu (3) / overlays;
   pointer-events:none so the trail never intercepts clicks or drags on the board. */
#trail { position: fixed; inset: 0; z-index: 2; pointer-events: none; }

.screen {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  opacity: 0; pointer-events: none; filter: blur(14px);
  /* fogged glass clearing into vision; visibility flips AFTER the fade so a
     hidden screen stops being composited (a permanent full-screen blur is costly) */
  visibility: hidden;
  transition: opacity 1.6s ease, filter 1.6s ease, visibility 0s linear 1.6s;
}
.screen.active {
  opacity: 1; pointer-events: auto; filter: blur(0); visibility: visible;
  transition-delay: 0s, 0s, 0s;
}
/* The menu drawn at 1% under the launch title for about a second, so one real dissolve can run on it (main.js
   warmDissolve). Nothing shows and nothing can be tapped. */
.screen.warming { visibility: visible; opacity: 0.01; filter: blur(0); transition: none; }

/* The launch title card (2026-10-17, owner: "have Ambient Chess fade in as the stars populate, then fade out and be
   replaced with the first menu"). It blurs in over the stars' own rise (ambiance.js INTRO_SPREAD ~1.7 s), stands
   while the heavy first-load work runs under it, then dissolves as the menu fogs in. main.js LAUNCH times it. */
#launch { position: fixed; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; filter: blur(14px); transform: scale(1.03);
  transition: opacity 1.4s ease, filter 1.4s ease, transform 1.4s ease; }
#launch.in { opacity: 1; filter: blur(0); transform: none; }
#launch.out { opacity: 0; filter: blur(16px); transform: scale(1.03); transition-duration: 0.9s; }
#launch.gone { display: none; }
/* Tap to begin (2026-11-03): a browser holds all sound until the first touch, so the website waits for one before the
   stars and the intro (main.js). The title card's own look and fade, quieter; the app and a browser that already lets
   the page sound never show it. */
#begin { position: fixed; inset: 0; z-index: 3; display: none; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; filter: blur(10px); transition: opacity 1.4s ease, filter 1.4s ease; -webkit-tap-highlight-color: transparent; outline: none; }
#begin.on { display: flex; }
#begin.in { opacity: 1; filter: blur(0); }
#begin.out { opacity: 0; filter: blur(12px); transition-duration: 0.6s; pointer-events: none; }
.begin-label { font-size: 12px; font-weight: 300; letter-spacing: 0.45em; text-indent: 0.45em; text-transform: uppercase;
  color: rgba(159,176,216,0.6); text-shadow: 0 0 14px rgba(120,160,230,0.25); }
.launch-title { font-size: 20px; font-weight: 300; letter-spacing: 0.5em; text-indent: 0.5em; text-transform: uppercase;
  color: #9fb0d8; text-shadow: 0 0 18px rgba(120,160,230,0.35); }
/* The licence credits (index.html): quiet lines at the card's foot, riding its fade. */
.launch-credits { position: absolute; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 40px);
  text-align: center; font-size: 11px; font-weight: 300; line-height: 1.8; letter-spacing: 0.04em;
  color: rgba(159,176,216,0.5); }

/* Start screen */
.brand {
  position: absolute; top: 9%; left: 0; right: 0; text-align: center;
  font-size: 12px; letter-spacing: 0.42em; text-indent: 0.42em; text-transform: uppercase; color: #4a5a86;
}
.level {
  background: none; border: none; cursor: pointer;
  font-size: 24px; font-weight: 300; letter-spacing: 0.38em; text-indent: 0.38em; text-transform: uppercase;
  /* Easily clickable, not overt: the hit area is grown with transparent padding (the global
     reset zeroed it, so the target used to be just the thin, wide-spaced letters). The .step
     gap was tightened 34->8px so the extra padding keeps the same on-screen spacing. */
  padding: 14px 32px; min-width: 200px;
  color: #9fb0d8; text-shadow: 0 0 10px rgba(120,160,230,0.28);
  transition: text-shadow 0.3s, color 0.3s;
}
.level.med { color: #a9a6d8; text-shadow: 0 0 10px rgba(160,140,220,0.28); }
.level:active { color: #e8f4ff; text-shadow: 0 0 18px rgba(150,200,255,0.7); }

/* Game screen — spread top/board/bottom to fill the full viewport height */
#screen-game { justify-content: space-between; }

/* The board's pieces are a whole number of screen pixels (2026-12-04). Chrome draws a live svg piece snapped to whole
   pixels, while the baked glow picture (src/piece-bake.js) is drawn at the exact size, so at a fractional size the two
   differ and the pieces visibly changed when the pictures landed a second after a game began: measured in Chrome, live
   vs baked PSNR 31.9-33.2 dB at 80.25 / 80.5 / 81.5 px pieces against 48.3 / 49.5 dB at 80 / 81 px, the position
   (whole, quarter, half pixel) making no difference. --dpx is one screen pixel, set by piece-bake.js (1px until then);
   a browser without round() drops these and keeps the plain sizes (board.css .piece, 80% below). */
#board .piece { width: round(down, min(9.5vw, 46px), var(--dpx, 1px)); height: round(down, min(9.5vw, 46px), var(--dpx, 1px)); }

.side {
  display: flex; align-items: center; justify-content: space-between;
  width: min(96vw, 460px); padding: 0 6px;
  transition: opacity 0.6s;
}
/* Wide screens (2026-11-02, owner: on the web "it doesn't really use the space well… clear this is intended for a
   phone"): the board grows with the window's height instead of stopping at 460 px, the name rows match it, and the
   pieces stay 80% of a square (what 46 px in a 57.5 px square was). Phones and landscape phones keep the 460 px rules;
   the theater shares board.css but not this file, so the stream is untouched. Review has its own desktop grid. */
@media (min-width: 720px) and (min-height: 640px) {
  :root { --game-board: min(96vw, calc(100dvh - 200px), 880px); }
  #board { width: var(--game-board); }
  .side { width: var(--game-board); }
  #board .piece { width: 80%; width: round(down, 80%, var(--dpx, 1px)); height: auto; aspect-ratio: 1 / 1; }
  /* the promotion choices are .piece too but sit in a full-screen overlay: 80% of that made each one 1024 px wide
     and pushed all but a rook's foot and a bishop's head off screen (owner, 2026-11-02). Same size as a board piece. */
  #promo .promo-piece { width: calc(var(--game-board) * 0.1); height: auto; aspect-ratio: 1 / 1; }
}
/* The menu and Settings scale up on the same screens, in steps by height (owner, 2026-11-02: "the menu too"). Zoom
   keeps every proportion; main.js hubZoom divides the panel's glide by it. The steps are set by the tallest panel,
   Settings › Colors (677 px unzoomed): 677 × zoom + ~30 px must fit the window's height. The post-game panel
   (#gameover, "the hub's panel again") and the in-game Menu (#menu) take the same steps so they are the menu's size
   (owner, 2026-12-04). */
@media (min-width: 720px) and (min-height: 880px) { #screen-start, #screen-settings, #gameover, #menu { zoom: 1.25; } }
@media (min-width: 900px) and (min-height: 1060px) { #screen-start, #screen-settings, #gameover, #menu { zoom: 1.5; } }
@media (min-width: 1200px) and (min-height: 1260px) { #screen-start, #screen-settings, #gameover, #menu { zoom: 1.8; } }
/* Facing (owner, 2026-12-01, option B of mockups/web-layout.html): on a wide computer screen the two players sit beside
   the board instead of above and below it, facing each other across it: the opponent top-left, level with the board's
   top edge, you bottom-right, level with its bottom edge, clocks toward the middle. Freed of the two rows the board
   takes nearly the whole height (1600×900: 700 -> 828 px). Only where that beats the stacked layout: at least 7:5 and
   1100 px wide (a 4:3 or 5:4 screen keeps the rows); a phone or a portrait tablet never matches. A live game only:
   Review keeps its own desktop grid. */
/* Piece outlines on a computer are at most 0.7 px (owner, 2026-12-04, picked from the ?line= try-it switch: Review's
   smaller board "looks so crisp"). board.css draws the outline as 0.848 % of the piece, which is 0.74-0.85 px on the
   big game board: nearly a whole pixel, so it straddles two or three screen pixels and reads soft, where Review's
   0.51 px sits in one. min() caps it: Review and any board under ~83 px pieces keep their own thinner line. A mouse
   screen only (pointer: fine), so the phone and a tablet keep the share; the theater has its own board.css copy. The
   promotion choices follow the board. ?line= still overrides (html.line-try). */
@media (min-width: 1100px) and (pointer: fine) {
  #board .piece svg *, #promo .piece svg * { stroke-width: min(calc(0.848 * var(--pu)), 0.7px); }
}
/* Try-it switch for the menus' text (main.js ?text=w4,glow; owner 2026-12-04, after the pieces: "can this apply to text
   too?"). The menu text is Jost Light (300) at 11-13 px with a 6-20 px text-shadow haze; on a 1x screen a light
   weight's stems are under a pixel wide and spread over two grey pixels, the haze is the pieces' halo again. w4: every
   rule that asks for 300 asks for 400 instead (the 500/600 headings stay). glow: no text-shadow in the four menus.
   Nothing changes without the address. */
html.text-w4 :is(.begin-label, .launch-title, .launch-credits, .level, .st-name, .st-rating b, .st-l1 .nm),
html.text-w4.menu-bars :is(#screen-start, #screen-settings, .overlay) :is(.tab, .pill, .tc-chip, .level),
html.text-w4.menu-bars .overlay button { font-weight: 400; }
html.text-glow :is(#screen-start, #screen-settings, #gameover, #menu) * { text-shadow: none !important; }
@media (min-width: 1100px) and (min-height: 600px) and (min-aspect-ratio: 7/5) {
  :root { --game-board: min(calc(100dvh - 72px), calc(100vw - 600px), 1000px); }
  body:not(.analysis-mode) #game-stage {
    display: grid; grid-template-columns: minmax(0, 1fr) var(--game-board) minmax(0, 1fr);
    grid-template-rows: var(--game-board); column-gap: 40px; align-content: center; }
  body:not(.analysis-mode) #board { grid-column: 2; grid-row: 1; margin: 0; }
  body:not(.analysis-mode) .side { grid-row: 1; width: auto; padding: 0; flex-direction: column; gap: 14px; }
  body:not(.analysis-mode) .side-top { grid-column: 1; align-self: start; justify-self: end; align-items: flex-end; }
  body:not(.analysis-mode) .side-top .who { align-items: flex-end; }
  body:not(.analysis-mode) .side-top .name-row { flex-direction: row-reverse; }
  body:not(.analysis-mode) .side-bottom { grid-column: 3; align-self: end; justify-self: start; align-items: flex-start; }
  body:not(.analysis-mode) .side-bottom .who { align-items: flex-start; }
  body:not(.analysis-mode) .side .clock .seg-digit, body:not(.analysis-mode) .side .clock .seg-colon { height: 26px; }
  body:not(.analysis-mode) .side .clock .seg-colon { width: 9px; }
  /* the first-move countdown hangs toward the middle of the board, a little clear of the clock, on the column's edge */
  body:not(.analysis-mode) .side-top #first-move { top: calc(100% + 10px); left: auto; right: 0; text-align: right; }
  body:not(.analysis-mode) .side-bottom #first-move { bottom: calc(100% + 10px); left: 0; right: auto; text-align: left; }
}
.label { font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase; color: #4f5d86; transition: 0.3s; }
.label.active { color: #bfe6ff; text-shadow: 0 0 14px rgba(130,200,255,0.75); }
.tray { display: flex; min-height: 22px; gap: 1px; }
.tray .wp, .tray .bp { width: 19px; height: 19px; display: inline-flex; }
.tray .wp svg, .tray .bp svg { width: 100%; height: 100%; display: block; }
/* colour drives the SVG stroke; glow rides the outline via drop-shadow */
.tray .wp { color: rgb(var(--gc-wp)); filter: drop-shadow(0 0 calc(4px * var(--gc-glow, 1)) rgb(var(--gc-wp-glow))); }
.tray .bp { color: rgb(var(--gc-bp)); filter: drop-shadow(0 0 calc(4px * var(--gc-glow, 1)) rgb(var(--gc-bp-glow))); }
.caps { display: flex; align-items: center; gap: 8px; }
.score { font-size: 12px; min-width: 1.6em; color: #9fc4f0; text-shadow: 0 0 8px rgba(130,190,255,0.5); }
/* Theater grouping (review 2026-09-12: "the name and info across the top is out of wack, clock in
   the middle"): .who is a vertical stack — the name row, then the captured-piece tray under it —
   and the clock stands alone at the outer end of the row. The tray wraps rather than pushing
   the row wide once an endgame has a dozen captures on one side. */
.who { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.side-bottom .who { align-items: flex-end; }
.name-row { display: flex; align-items: center; gap: 20px; } /* 11 px names, 16 px icons, 12 px gaps until 2026-10-19: owner, "a little further apart and a little bigger" */
.tray { flex-wrap: wrap; max-width: 300px; }
#btn-flag {
  background: none; border: none; cursor: pointer; padding: 0;
  color: #3f4c73; font-size: 20px; line-height: 1;
  display: inline-flex; align-items: center;
  transition: color 0.3s, text-shadow 0.3s;
}
#btn-flag.armed { color: #ffb3a6; text-shadow: 0 0 12px rgba(255,140,120,0.7); }
/* "Resign?" unfolds out of the flag while armed; second tap confirms */
#flag-word {
  display: inline-block; overflow: hidden; white-space: nowrap;
  max-width: 0; opacity: 0; margin-left: 0;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  transition: max-width 0.45s ease, opacity 0.45s ease, margin-left 0.45s ease;
}
#btn-flag.armed #flag-word { max-width: 6em; opacity: 1; margin-left: 8px; }
/* The first-move countdown (main.js setFirstMove; option A of mockups/first-move-countdown.html): a quiet line in the
   gap between the board and the name row of whoever must move, in the clocks' colour, warm from 10 s (.late). It hangs
   off the row, so nothing moves when it comes or goes. */
.side { position: relative; }
#first-move { position: absolute; left: 0; right: 0; text-align: center; line-height: 13px; white-space: nowrap;
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: rgb(var(--gc-clock)); opacity: 0.85;
  pointer-events: none; transition: color .4s ease, opacity .4s ease; animation: fadein .6s ease both; }
#first-move b { font-weight: 500; font-size: 12px; letter-spacing: 0.08em; }
#first-move.late { color: #e3a99c; opacity: 1; } /* the clocks' own low-time colour */
.side-bottom #first-move { bottom: 100%; }
.side-top #first-move { top: 100%; }
body.analysis-mode #first-move { display: none; }

#menu-dot {
  position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 16px; z-index: 3;
  background: none; border: none; color: #5a6a99; font-size: 22px; cursor: pointer; padding: 6px;
  transition: opacity 0.6s;
}

/* idle fade: applied to .side and #menu-dot */
.faded { opacity: 0 !important; }

/* Overlays */
.overlay {
  position: fixed; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: rgba(5,7,14,0.78); /* no backdrop blur (2026-11-06): measured in desktop Chrome, the play-again screen ran 23 fps with it, 61 without */
  animation: fadein 0.5s ease both; /* display:none -> flex restarts this each open */
}
.overlay.hidden { display: none; }
.overlay button {
  background: none; border: 1px solid rgba(150,190,255,0.22); border-radius: 30px;
  color: #cfe0ff; font-size: 16px; letter-spacing: 0.2em; text-indent: 0.2em; text-transform: uppercase;
  padding: 12px 34px; cursor: pointer; text-shadow: 0 0 10px rgba(120,180,255,0.4);
}
#gameover-text { font-size: 24px; letter-spacing: 0.3em; text-indent: 0.3em; text-transform: uppercase;
  color: #cfe0ff; text-shadow: 0 0 20px rgba(140,190,255,0.6); }
/* everything fades in from a blur — fogged glass coming into focus */
@keyframes fadein  { from { opacity: 0; filter: blur(10px); } to { opacity: 1; filter: blur(0); } }
@keyframes fadeout { from { opacity: 1; filter: blur(0); } to { opacity: 0; filter: blur(10px); } }
/* .closing fades an overlay out before it is display:none'd (see hideOverlay in main.js) */
.overlay.closing, #gameover.closing { animation: fadeout 0.8s ease both; pointer-events: none; }
/* Game-over sequence: a slower veil, then text and buttons fade in one by one.
   The board dim/blur (#board.dimmed) runs underneath on its own transition. */
#gameover { background: rgba(5,7,14,0.6); animation: fadein 1.4s ease both; }
#gameover #gameover-text { animation: fadein 1.2s ease 0.3s both; }
#gameover #btn-again     { animation: fadein 0.8s ease 0.9s both; }
#gameover #btn-exit      { animation: fadein 0.8s ease 1.3s both; }
#gameover.closing #gameover-text,
#gameover.closing #btn-again,
#gameover.closing #btn-exit { animation: none; } /* let the parent fade carry them out */
/* The promotion choices (main.js choosePromotion): #promo is a see-through catch over the whole screen; the tray lies
   across the middle of the board, placed and sized by main.js from the board's own box. No fade either way. */
#promo { background: none; animation: none; display: block; }
#promo.hidden { display: none; }
.promo-tray { position: fixed; display: grid; grid-template-columns: repeat(4, 1fr); border-radius: 8px;
  background: rgba(6, 9, 18, 0.94); box-shadow: 0 0 0 1px rgba(var(--gc-accent), 0.45), 0 6px 26px rgba(0, 0, 0, 0.6);
  --promo-line: rgba(var(--gc-accent), 0.22); }
.promo-tray.light { background: rgba(214, 220, 232, 0.96); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7), 0 6px 26px rgba(0, 0, 0, 0.6);
  --promo-line: rgba(20, 26, 44, 0.25); }
.promo-opt { display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.promo-opt + .promo-opt::before { content: ''; position: absolute; left: 0; top: 18%; bottom: 18%; width: 1px; background: var(--promo-line); }
#promo .promo-piece { cursor: pointer; height: auto; aspect-ratio: 1 / 1; display: inline-flex; }
#promo .promo-piece svg { width: 100%; height: 100%; display: block; }
/* identical pills: same width regardless of label, so the pair is symmetric
   about the screen center instead of the longer label dragging it sideways */
.gameover-actions { display: flex; gap: 1.4rem; margin-top: 1.5rem; }

/* Third game-over button (Review) joins the stagger; keep three pills on one row */
#gameover #btn-review { animation: fadein 0.8s ease 1.1s both; }
#gameover.closing #btn-review { animation: none; }
#gameover #btn-review.hidden { display: none; }
.gameover-actions { flex-wrap: wrap; justify-content: center; }
.gameover-actions button { width: min(26vw, 170px); padding-left: 0; padding-right: 0; }

/* Chips: the hub's choices (Play as, Level, Casual/Rated, Time) — once the library's filters too. */
.tc-filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tc-chip {
  background: none; border: 1px solid #2a3658; border-radius: 999px; cursor: pointer;
  /* taller tap target (8px) but horizontal padding kept at 14px: at 18px the five chips
     overflowed the 460px row and 'Classical' wrapped to a second line. */
  padding: 8px 14px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: #6678a6; transition: color 0.25s, border-color 0.25s, text-shadow 0.25s;
}
.tc-chip.active { color: #cfe0ff; border-color: #4a6bb0; text-shadow: 0 0 12px rgba(140,190,255,0.55); }


/* the online game's clocks — seven-segment digit rules live in src/segclock.css
   (shared with theater); this file keeps only the game-layout-specific wrapper. */
.clock { display: inline-flex; align-items: center; gap: 4px; color: rgb(var(--gc-clock)); } /* the combo's accent (owner, 2026-10-29); was a fixed #8ea6cc */
/* the game's clock is bigger than the theater's (2026-10-19: 13 px digits -> 19 px); segclock.css stays the theater's size */
.side .clock .seg-digit, .side .clock .seg-colon { height: 19px; }
.side .clock .seg-colon { width: 7px; }
.clock.hidden { display: none; }
.clock.low { color: #e3a99c; } /* under 30s — a muted warm, not alarm-red */
/* Name + rating on the side rows. The rating (.elo) shows beside each name when a Stats game is
   opened in Review (2026-10-17); a live game leaves it hidden. */
.who-top { display: flex; align-items: baseline; gap: 10px; }
.elo { font-size: 12px; letter-spacing: 0.1em; color: #8ea6cc; font-variant-numeric: tabular-nums;
       text-shadow: 0 0 8px rgba(90,195,255,0.3); }
.elo.hidden { display: none; }

/* A quiet note line (the Human lobby's #online-status and the app's #app-note wear it). */
.note-line {
  color: #6f83ad; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  margin-bottom: 6px; text-align: center; animation: fadein 0.6s ease both;
}
.note-line.hidden { display: none; }


/* --- The hub (start screen) + post-game panel (2026-09-20) ---
   The menu felt cheap because it had no structure: bare words on the starfield, one tier of
   button. The hub gives it one: ONE hairline (--hair), ONE radius (--radius), a framed panel,
   small caps row labels, and three button tiers — the go-green word (Play), the chip/pill, and
   the quiet text link. The game screen is deliberately untouched. */
:root { --hair: rgba(150,190,255,0.16); --radius: 16px;
  --lobby-green: rgba(130,235,190,0.55); --lobby-green-text: #9fe8c4; }
.panel { display: flex; flex-direction: column; align-items: center; gap: 16px;
  width: min(88vw, 380px); padding: 20px 22px;
  border: 1px solid var(--hair); border-radius: var(--radius);
  background: rgba(8,12,24,0.35); box-shadow: 0 0 22px rgba(110,140,255,0.06); }
.panel hr { width: 100%; border: 0; border-top: 1px solid var(--hair); }
/* Menu bars (2026-11-03): src/menu-bars.js draws every menu line and every pill's underline as EQ bars on a canvas in
   each menu screen and overlay, so the real borders go clear (the layout keeps them, the eye doesn't). */
html.menu-bars :is(#screen-start, #screen-settings, .overlay) :is(.panel, .panel .tabs, .panel .set-head, .panel hr, .pill, .tc-chip),
html.menu-bars .overlay button { border-color: transparent !important; }
/* No card (owner, 2026-11-03: "I didn't like the square around the words. But … some lining organizing the menu and
   words is essential"): the panel's tint and halo go too, so the menu stands on the stars, held by its inner lines. */
html.menu-bars :is(#screen-start, #screen-settings, .overlay) .panel { background: transparent; box-shadow: none; }
html.menu-bars #hub::after { display: none; }
html.menu-bars :is(#screen-start, #screen-settings) .tab-light { opacity: 0; }
.menu-bars-canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
/* Soft-glow words (owner, 2026-11-04, option C of mockups/menu-letters.html, after the star-dust words of 2026-11-03
   "kinda just look scratchy"): solid letters in the title's manners - no heavy halo, a light weight, wide spacing, dim
   until chosen - with a faint halo in the selected theme's white-piece glow (--gc-wp-glow), the same light the EQ bars
   carry. The tabs and chips rest dim and bare; the chosen one goes near-white with a stronger halo. */
html.menu-bars :is(#screen-start, #screen-settings, .overlay) :is(.tab, .pill, .tc-chip, .level), html.menu-bars .overlay button {
  color: #c4d0ee; font-weight: 300; text-shadow: 0 0 6px rgba(var(--gc-wp-glow, 127,208,255), 0.35); }
html.menu-bars :is(#screen-start, #screen-settings, .overlay) :is(.tab, .pill, .tc-chip) { letter-spacing: 0.3em; text-indent: 0.3em; }
html.menu-bars :is(#screen-start, #screen-settings, .overlay) :is(.tab, .tc-chip) { color: #8494be; text-shadow: none; }
html.menu-bars :is(#screen-start, #screen-settings, .overlay) .go { color: #8fd8b6; }
html.menu-bars :is(#screen-start, #screen-settings, .overlay) .go:disabled { color: #3f4c73; text-shadow: none; }
html.menu-bars :is(#screen-start, #screen-settings, .overlay) :is(.tc-chip.active, .tab.active),
html.menu-bars :is(#screen-start, #screen-settings) .tab::after {
  color: #f2f7ff; text-shadow: 0 0 8px rgba(var(--gc-wp-glow, 127,208,255), 0.6); }
.panel .tc-chip { font-size: 13px; padding: 9px 16px; }
.panel .level { padding: 6px 32px; }
/* The tabs row stands still while the bodies dissolve beneath it (owner, 2026-10-17: "the top bar should remain
   after fading in the first time"). When a tap changes the panel's shape (the Stats box opening into the page)
   the whole panel GLIDES to its new place (main.js dissolveHub, a FLIP transform) rather than dissolving, so the
   row never vanishes. The light moves from word to word: the old word's white fades over a second while the new
   word blooms in (tabglow), and the one underline (.tab-light) slides under it.
   Both move on the GPU alone (2026-10-18, measured on the Pixel): the lit word is a bright copy of the label on its own
   layer (.tab::after), faded and un-blurred with opacity and filter; the light slides by transform at a fixed width.
   Animating the word's colour, text-shadow and blur, and the light's left and width, repainted the row on every frame
   for a second after each tap, and the first 130 ms of a switch dropped frames; with them off, a switch ran 191 of 191. */
.tabs { display: flex; width: 100%; border-bottom: 1px solid var(--hair); margin: -6px 0 2px; position: relative; }
.tab { flex: 1; background: none; border: 0; cursor: pointer; padding: 10px 0 14px; position: relative;
  font-size: 13px; letter-spacing: 0.24em; text-indent: 0.24em; text-transform: uppercase; color: #4f5d86; }
.tab::after { content: attr(data-tab); position: absolute; inset: 0; padding: inherit; text-align: center; pointer-events: none;
  color: #cfe0ff; text-shadow: 0 0 12px rgba(140,190,255,0.55); opacity: 0; transition: opacity 0.6s ease; will-change: opacity, filter; }
.tab.active::after { opacity: 1; animation: tabglow 0.7s ease both; }
@keyframes tabglow {
  0%   { opacity: 0; filter: blur(1.5px) brightness(1); }
  45%  { opacity: 1; filter: blur(0.4px) brightness(1.35); }
  100% { opacity: 1; filter: blur(0px) brightness(1); }
}
.tab-light { position: absolute; bottom: -1px; height: 1px; left: 0; width: 0; pointer-events: none; will-change: transform;
  background: #4a6bb0; box-shadow: 0 0 8px rgba(140,190,255,0.8); transition: transform 0.55s var(--snap); }
.tab-light.still { transition: none; } /* its first placement, under the fog, must not slide in from the edge */
/* The three bodies sit in ONE grid cell, the hidden two kept in the layout but invisible, so the panel
   is as tall as the tallest body on every tab and never moves (2026-10-17: before, a hidden body left
   the layout, the panel went 248 -> 414 px between Human and Computer at phone width, and the whole
   menu re-centred under the finger). The live body fades in on opacity with a 6 px rise — no blur: a
   blurred body inside the screen's own blur meant two blur passes per frame on a phone. */
.hub-bodies { display: grid; width: 100%; }
.hub-body { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  width: 100%; min-height: 150px; animation: bodyin 0.45s ease both; }
.hub-body.hidden { display: flex; visibility: hidden; pointer-events: none; animation: none; }
@keyframes bodyin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* Signed out on Human the rule and the foot keep their room (only Connect shows), so the panel is the
   same height signed in or out; the lobby fades in as one piece once its time controls are known. */
#hub-rule.hidden { display: block; visibility: hidden; }
#hub-foot.hidden { display: flex; visibility: hidden; }
#online-lobby { animation: bodyin 0.45s ease both; }
#online-status { min-height: 1.5em; }
#online-status.hidden { display: block; visibility: hidden; }
.hub-stack { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; }
.hub-foot { display: flex; flex-direction: column; align-items: center; }
.row { display: flex; flex-direction: column; align-items: center; gap: 9px; width: 100%; }
.row-label { font-size: 10px; letter-spacing: 0.26em; text-indent: 0.26em; text-transform: uppercase; color: #4f5d86; }
.cap { font-size: 11px; letter-spacing: 0.12em; color: #5c6c98; text-align: center; line-height: 1.5; }
.go { color: var(--lobby-green-text); text-shadow: 0 0 12px rgba(130,235,190,0.45); }
.go:disabled { color: #3f4c73; text-shadow: none; cursor: default; }
/* Play's lettering (2026-11-06, src/play-rain.js): Regular weight; the word is drawn on two canvases inside the button,
   a ghost outline that the menu music's swells rain light into. The real text stays (transparent) for size and name. */
/* two ids: past the soft-glow words' html.menu-bars :is(#screen-start, ...) .level / .go rules above */
#screen-start #btn-play { font-weight: 400; }
html.play-rain #screen-start #btn-play { position: relative; color: transparent; text-shadow: none; }
#btn-play canvas.pr { position: absolute; left: -40px; top: -30px; pointer-events: none; }
#btn-play canvas.pr-glow { filter: blur(7px); mix-blend-mode: plus-lighter; opacity: 0.9; }
html.play-rain #btn-play:disabled canvas.pr { opacity: 0.4; }
html.play-rain #btn-play:disabled canvas.pr-glow { opacity: 0.36; }
.quiet { background: none; border: 0; cursor: pointer; color: #4f5d86; font-size: 11px;
  letter-spacing: 0.2em; text-transform: uppercase; padding: 8px 10px; transition: color 0.3s; }
.quiet:active { color: #cfe0ff; }
.quiet-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.pill { background: none; border: 1px solid rgba(150,190,255,0.22); border-radius: 30px; cursor: pointer;
  color: #cfe0ff; font-size: 14px; letter-spacing: 0.2em; text-indent: 0.2em; text-transform: uppercase;
  padding: 11px 26px; text-shadow: 0 0 10px rgba(120,180,255,0.4); }
.acct-line { display: flex; justify-content: space-between; align-items: center; width: 100%;
  font-size: 12px; letter-spacing: 0.16em; color: #bfe6ff; }
.acct-line .quiet { padding: 0; font-size: 10px; }
.searching { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--lobby-green-text);
  font-variant-numeric: tabular-nums; }
/* a seek is held open: the choices stay on screen, but they are not live */
.locked .tc-chip { opacity: 0.45; pointer-events: none; }
#online-status { margin: 0; }

/* --- Settings (2026-10-18): the gear on the start screen, then the hub's panel again (index.html #screen-settings) ---
   The gear sits where the game's ⋯ sits. The panel's head is the lit tab's word; Licences scrolls inside the panel,
   kept short of the brand above; "Read licence" opens the text in a small box that scrolls on its own. */
#settings-dot { position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 16px; z-index: 3;
  background: none; border: none; color: #4f5d86; font-size: 22px; cursor: pointer; padding: 10px; display: flex;
  transition: color 0.3s; }
#settings-dot:active { color: #cfe0ff; }
#settings-dot svg { width: 1em; height: 1em; }
#screen-settings .panel.hidden { display: none; }
.set-head { width: 100%; text-align: center; font-size: 13px; letter-spacing: 0.24em; text-indent: 0.24em;
  text-transform: uppercase; color: #cfe0ff; text-shadow: 0 0 12px rgba(140,190,255,0.55);
  padding: 4px 0 14px; border-bottom: 1px solid var(--hair); margin: -6px 0 2px; }
.set-link { display: flex; justify-content: space-between; align-items: center; width: 100%; background: none; border: 0;
  cursor: pointer; padding: 6px 0; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: #9fb0d8; }
.set-link span:last-child { color: #4f5d86; }
.set-link:active { color: #e8f4ff; }
/* Settings › Colors (2026-10-24, mockups/colours-frame-v4.html): the eight combos as Theme Pad pads at phone size
   (theater/control/control.css .pad), two per line; the combo in use carries the white outline. A pad's five colours
   come in as --white/--black/--light/--dark/--accent on the pad itself (src/colors-panel.js). The brand line hides. */
#screen-settings .brand { transition: opacity .4s ease; }
#screen-settings.colors-open .brand { opacity: 0; }
#settings-colors { gap: 12px; padding-top: 14px; padding-bottom: 12px; }
.pads { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; padding: 4px 0; }
.pad { height: 58px; position: relative; border-radius: 12px; isolation: isolate;
  background: #0a0c14; border: 1px solid rgba(150,170,220,0.10); }
.pad .press { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; margin: 0; padding: 0; border: 0;
  border-radius: inherit; background: none; cursor: pointer; transition: transform .25s ease; }
.pad .press:active { transform: scale(0.97); }
.pad .clip { position: absolute; inset: 0; border-radius: 12px; overflow: hidden; pointer-events: none; }
.pad .l { position: absolute; border-radius: 50%; }
.pad .wash { position: absolute; inset: 0; background: radial-gradient(120% 70% at 50% 120%, var(--dark), transparent 70%); opacity: 0.9; }
.pad .gw { width: 78%; height: 60%; left: -16%; bottom: -34%; background: var(--white); filter: blur(13px); opacity: 0.62; }
.pad .gb { width: 78%; height: 60%; right: -16%; bottom: -34%; background: var(--black); filter: blur(13px); opacity: 0.62; }
.pad .sl { width: 80%; height: 55%; left: -20%; top: -25%; background: var(--light); filter: blur(15px); opacity: 0.5; }
.pad .sd { width: 80%; height: 55%; right: -20%; top: -25%; background: var(--dark); filter: blur(15px); opacity: 0.9; }
.pad .base { position: absolute; left: 14%; right: 14%; bottom: 0; height: 2px; background: var(--accent);
  box-shadow: 0 0 10px var(--accent); opacity: 0.8; }
.pad .name { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 8px; font-size: 10.5px; letter-spacing: 0.06em;
  color: #f1f5ff; text-align: left; text-shadow: 0 1px 4px rgba(0,0,0,0.9); z-index: 3; pointer-events: none;
  overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.pad::after { content: ''; position: absolute; inset: -4px; border-radius: 15px; border: 2px solid rgba(255,255,255,0.75);
  opacity: 0; transition: opacity .5s ease; pointer-events: none; }
.pad.on::after { opacity: 1; }
/* the line under the pads: the combo in use */
.under { width: 100%; height: 24px; display: flex; align-items: center; justify-content: center; }
/* the preview board: the real board's .sq / .piece / hint classes (src/board.css), so its colours are the game's;
   only its size and frame are set here */
.mboard { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  width: 196px; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; background: rgb(var(--gc-bg));
  box-shadow: 0 0 calc(36px * var(--gc-glow, 1)) rgba(var(--gc-board-glow), 0.22), 0 10px 24px rgba(0,0,0,0.6);
  border: 1px solid rgba(var(--gc-board-edge), 0.07); pointer-events: none; }
.mboard .piece { width: 20px; height: 20px; cursor: default; transition: none; }
/* Settings › Sound (2026-10-19): one line per switch, the name left and On/Off right; with All sound off the five
   layers dim and stop taking taps (their choices are kept for when it comes back on). */
.snd-layers { display: flex; flex-direction: column; gap: 10px; width: 100%; transition: opacity 0.3s; }
.snd-row { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 12px; }
.snd-name { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: #9fb0d8; }
.snd-all .snd-name { color: #cfe0ff; }
.snd-row .tc-filters { flex-wrap: nowrap; gap: 6px; }
.panel .snd-row .tc-chip { font-size: 12px; padding: 7px 11px; } /* 13 px sides until the volume bars, 2026-10-26 */
.snd-layers.locked { opacity: 0.4; }
.snd-layers.locked .tc-chip { opacity: 1; } /* the hub's .locked dims each chip too: the panel's dim is enough */
/* The volume bars (owner, 2026-10-26: "a left to right bar next to the category, to the left of the toggle… a little
   circle… left of the circle a glow around the line, to the right it is dim"). --v is the bar's place, 0..1, set by
   main.js. The bar's box is taller than the line so a thumb finds it; the circle never leaves the ends (.vol-bar's inset). */
.vol { flex: 1 1 auto; min-width: 48px; height: 30px; padding: 0 6px; cursor: pointer; touch-action: none; outline: none;
  --v: 1; transition: opacity 0.3s; -webkit-tap-highlight-color: transparent; }
.vol-bar { position: relative; display: block; height: 100%; }
.vol-bar::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; margin-top: -0.5px;
  background: rgba(150,190,255,0.16); }
.vol-fill { position: absolute; left: 0; top: 50%; height: 2px; margin-top: -1px; width: calc(var(--v) * 100%); border-radius: 1px;
  background: #9cc0ff; box-shadow: 0 0 6px rgba(140,190,255,0.85), 0 0 14px rgba(110,160,255,0.4); }
.vol-knob { position: absolute; top: 50%; left: calc(var(--v) * 100%); width: 10px; height: 10px; border-radius: 50%;
  transform: translate(-50%, -50%); background: #e8f4ff; box-shadow: 0 0 8px rgba(140,190,255,0.9); transition: transform 0.2s; }
.vol.dragging .vol-knob, .vol:focus-visible .vol-knob { transform: translate(-50%, -50%) scale(1.3); }
/* a layer switched off: its bar dims and loses its glow (no volume is reaching the speakers), but can still be set */
.vol.off { opacity: 0.4; }
.vol.off .vol-fill { box-shadow: none; }
.snd-layers.locked .vol { pointer-events: none; }
.snd-row .snd-name { flex: 0 0 auto; width: 8.6em; white-space: nowrap; letter-spacing: 0.14em; font-size: 11px; } /* one width, so the bars line up */
/* the Sound panel takes a little more of a phone's width (its chips a little less, above), so the bars have room */
#settings-sound { width: min(94vw, 420px); padding-left: 18px; padding-right: 18px; }
#settings-sound .snd-row { gap: 10px; }
#settings-sound .snd-row[hidden] { display: none; }   /* the Endgame row while that layer is empty (main.js) */
/* Moving between the settings panels dissolves like the hub (owner, 2026-10-26: "fades between menus like everywhere
   else"): the panel blur-fades out (0.2 s, main.js SETTINGS_OUT_MS), swaps while nothing shows, and the new one fades in
   (0.55 s; an animation, because a panel coming out of display:none has nothing to transition from). */
#screen-settings .panel { animation: setin 0.55s ease backwards; transition: opacity 0.2s ease, filter 0.2s ease; }
#screen-settings.dissolving .panel { opacity: 0; filter: blur(16px); pointer-events: none; }
@keyframes setin { from { opacity: 0; filter: blur(16px); } to { opacity: 1; filter: blur(0); } }
#lic-list { width: 100%; max-height: 50vh; overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; }
#lic-list::-webkit-scrollbar { display: none; }
.lic-intro { font-size: 11px; letter-spacing: 0.06em; color: #5c6c98; line-height: 1.6; text-align: center; padding: 0 4px 6px; }
.lic { padding: 12px 0; border-bottom: 1px solid rgba(40,52,88,0.4); display: flex; flex-direction: column; gap: 4px; }
.lic:last-child { border-bottom: 0; }
.lic-name { font-size: 13px; letter-spacing: 0.12em; color: #bfe6ff; }
.lic-what { font-size: 11px; letter-spacing: 0.06em; color: #6f80ad; line-height: 1.5; }
.lic-source { overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.lic-actions { margin-left: -10px; }
.lic-text { display: none; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 10.5px; line-height: 1.55;
  letter-spacing: 0.02em; color: #6f80ad; max-height: 34vh; overflow-y: auto; padding: 10px 12px; margin-top: 4px;
  border: 1px solid var(--hair); border-radius: 10px; background: rgba(5,7,14,0.5); user-select: text; -webkit-user-select: text; }
.lic.open .lic-text { display: block; }
.lic.open .lic-toggle { color: #cfe0ff; }
/* Settings › Privacy (2026-10-20): privacy.html's policy, in the licences' type and scroll box. */
#privacy-text { width: 100%; max-height: 50vh; overflow-y: auto; scrollbar-width: none; font-size: 11.5px; line-height: 1.6;
  letter-spacing: 0.04em; color: #8193bf; user-select: text; -webkit-user-select: text; }
#privacy-text::-webkit-scrollbar { display: none; }
#privacy-text h2 { font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: #bfe6ff;
  margin: 16px 0 4px; }
#privacy-text p, #privacy-text li { margin: 0 0 8px; }
#privacy-text ul { padding-left: 16px; margin: 0 0 8px; }
#privacy-text .lead { color: #aebce0; font-size: 12.5px; }
#privacy-text strong { color: #cfe0ff; font-weight: 500; }
#privacy-text a { color: #bfe6ff; }

/* --- Stats (2026-10-17, in place of Watch): the player's Lichess self ---
   Signed out the tab is a box like Human's (Connect). Signed in the box opens into a PAGE: #screen-start
   scrolls, the tabs stick to the top on a dim strip, and the name, the two figures, the rating lines and
   the games run down as one column (shape C of the three mock-ups, mockups/stats.html; restyled 2026-11-06, see below). The other two
   tabs keep the fixed-height panel. The rule and the Play foot leave the layout here (.gone), not just
   the eye: there is nothing to play. .hub-body min-width: 0 — a grid item's automatic minimum is its
   content width, and the rows' nowrap text pushed the body 64 px past the panel in the mock-up. */
.hub-body { min-width: 0; }
.hub-foot.gone, #hub-rule.gone { display: none; }
#screen-start.stats-page { justify-content: flex-start; overflow-y: auto; padding-top: 15vh; scrollbar-width: none; }
#screen-start.stats-page::-webkit-scrollbar { display: none; }
#hub.stats-page { border-color: transparent; background: none; box-shadow: none; } /* same width as the box: the Level chips re-wrapped at a wider page and the panel jumped a chip row at the end of the glide */
/* The tab row scrolls with the page, keeping its spacing (owner, 2026-10-18: the graph and ratings slid behind a
   sticky row). It was sticky with a 0.9-dark strip until then. */
#hub.stats-page .tabs { padding-top: 4px; }
#hub.stats-page .hub-body:not([data-body=stats]) { display: none; }
#stats-login.hidden { display: none; }
#stats-page { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; }
#stats-page.hidden { display: none; }
/* On Computer and Human the Stats body is hidden-but-in-layout like the others (so the panel height holds),
   so the PAINTED PAGE inside it must leave the layout, or the shared cell grows to the page: measured 7775 px
   on Computer after one signed-in visit to Stats (review 2026-10-17). The Connect stack stays, keeping the
   signed-out height equal. */
.hub-body.hidden #stats-page { display: none; }
/* Drawn once, invisibly, a few seconds after launch (stats.js prepare): fixed at the corner, all but transparent. */
#stats-page.st-prewarm { display: flex; visibility: visible; position: fixed; left: 0; top: 0; opacity: 0.01;
  pointer-events: none; z-index: 3; } /* lent to <body> for 0.4 s while the launch title stands (stats.js prepare) */
/* In the menu's manners since 2026-11-06 (owner's pick, option B of mockups/stats-v2.html, after "the stats page is
   currently still in the old style"): no glass box round the games, no hairline under each row, no green/red result
   bars; light wide lettering with a halo in the selected theme's white-piece glow (--gc-wp-glow), the graph in the
   theme's two glows, and each game written like a menu chip with a short row of EQ bars under it (src/menu-bars.js). The
   whole page scrolls as one (the games box with its own scroll went with the box). */
/* A long name wraps, it never shrinks (the owner's rule for the shorts titles; stress pass 2026-10-18: a 30-character Lichess name
   ran 555 px wide on a 320 px screen). */
#stats-page { --st-w: var(--st-lit-w, 127,208,255); --st-b: var(--st-lit-b, 169,140,255); } /* main.js applyCombo: the glows lifted for the night sky */
.st-name { max-width: 100%; overflow-wrap: anywhere; text-align: center; line-height: 1.4;
  font-size: 18px; font-weight: 300; letter-spacing: 0.3em; text-indent: 0.3em; text-transform: uppercase; color: #f2f7ff;
  text-shadow: 0 0 8px rgba(var(--st-w), 0.5); }
.st-note { font-size: 11px; letter-spacing: 0.12em; color: #5c6c98; min-height: 1.5em; text-align: center; margin-top: -8px; }
.st-note .quiet { padding: 0 6px; font-size: 11px; }
.st-ratings { display: flex; gap: 40px; justify-content: center; }
.st-rating { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.st-rating .row-label { display: flex; align-items: center; gap: 8px; text-indent: 0; font-size: 11px; color: #8494be; }
.st-key { display: inline-block; width: 12px; height: 2px; border-radius: 1px; }
.st-key.rapid { background: rgb(var(--st-w)); box-shadow: 0 0 6px rgba(var(--st-w), 0.8); }
.st-key.classical { background: rgb(var(--st-b)); box-shadow: 0 0 6px rgba(var(--st-b), 0.8); }
.st-rating b { font-weight: 300; font-size: 30px; letter-spacing: 0.08em; color: #e8f0ff; line-height: 1;
  text-shadow: 0 0 10px rgba(var(--st-w), 0.35); }
.st-rating i { font-style: normal; font-size: 11.5px; letter-spacing: 0.12em; color: #6678a6; }
.st-rating i.up, .st-rating i.down { color: #6678a6; } /* the week's change reads quietly, like the menu's captions */
.up { color: #9fe8c4; } .down { color: #e07a7a; }
/* the graph: the two lines in the theme's glows over a soft wide copy of themselves; no grid, the hundreds at the left */
.st-graph { width: 100%; height: 110px; display: block; overflow: visible; }
.st-graph text { font-size: 10px; fill: #4f5d86; letter-spacing: 0.14em; }
.st-graph .ln { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.st-graph .ln.halo { stroke-width: 6; opacity: 0.16; }
.st-graph .ln.rapid { stroke: rgb(var(--st-w)); } .st-graph .ln.classical { stroke: rgb(var(--st-b)); }
.st-graph .dot { fill: #f2f7ff; }
.st-graph .dot.rapid { filter: drop-shadow(0 0 4px rgb(var(--st-w))); }
.st-graph .dot.classical { filter: drop-shadow(0 0 4px rgb(var(--st-b))); }
/* the rule between the graph and the games: a .panel hr, so src/menu-bars.js draws it as a line of EQ bars */
#stats-page .st-rule { width: 100%; margin: 0; }
.st-games { width: 100%; display: flex; flex-direction: column; align-items: center; }
.st-list { width: 100%; display: flex; flex-direction: column; gap: 4px; }
/* Each game is a chip: the opponent in the menu's wide capitals, the result word on the right, the clock and when under
   them; src/menu-bars.js draws its bars along the bottom padding. Rows that arrive while you look still blur in (rowin). */
.st-row { display: flex; flex-direction: column; gap: 5px; padding: 10px 4px 12px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; outline: none; }
.st-row.st-new { animation: rowin 0.9s ease both; } /* only rows that arrive while you look (stats.js rowsHtml newFrom) */
@keyframes rowin { from { opacity: 0; filter: blur(8px); } to { opacity: 1; filter: none; } }
.st-l1 { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.st-l1 .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 300;
  letter-spacing: 0.24em; text-transform: uppercase; color: #8494be; transition: color 0.25s, text-shadow 0.25s; }
.st-l1 .rs { flex: none; font-size: 10.5px; letter-spacing: 0.24em; text-transform: uppercase; }
.st-row.W .rs { color: #8fd8b6; } .st-row.L .rs { color: #c98ea0; } .st-row.D .rs { color: #8494be; }
.st-l2 { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: #4f5d86; white-space: nowrap; margin-bottom: 7px; /* room for the bars (menu-bars.js sets them 4 px under the content) */
  overflow: hidden; text-overflow: ellipsis; transition: color 0.25s; }
.st-row.active .nm { color: #f2f7ff; text-shadow: 0 0 8px rgba(var(--st-w), 0.6); }
.st-row.active .st-l2 { color: #8494be; }
.st-row.active .rs { text-shadow: 0 0 8px currentColor; }
/* Review and Analyze, right under the chosen game */
.st-chosen { display: flex; gap: 18px; justify-content: center; margin: -2px 0 6px; animation: bodyin 0.45s ease both; }
.st-chosen .quiet { color: #c4d0ee; font-size: 11px; letter-spacing: 0.28em; text-shadow: 0 0 6px rgba(var(--st-w), 0.4); }
.st-chosen .quiet:active { color: #f2f7ff; text-shadow: 0 0 10px rgba(var(--st-w), 0.8); }
.st-older { width: 100%; text-align: center; }
.st-empty { padding: 18px 0; text-align: center; font-size: 11px; letter-spacing: 0.12em; color: #5c6c98; }
/* The fold: a faint line the unrendered rows wait under; it reveals twenty more as it comes within a screen
   of the bottom (main.js watches it), or on a tap. */
.st-fold { width: 100%; height: 22px; cursor: pointer; position: relative; }
.st-fold::after { content: ""; position: absolute; left: 18%; right: 18%; top: 10px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--st-w), 0.3), transparent); }
/* The dissolve (owner, 2026-10-17: "each menu should do the blurry fade in fade out that theater does"): the
   theater's look — opacity and a 16 px blur (its 3 % scale dropped, see below) — at a menu pace: 0.2 s
   out and 0.55 s in (timing history: BIBLE.md, Journal 2026-10-17 and 2026-10-18; main.js DISSOLVE_OUT_MS must match the out time). Every change dissolves the bodies and the foot and leaves the tabs row standing; a change
   of shape (the Stats box opening into the page, or closing) also GLIDES the panel to its new place and size
   (main.js glideFrom: a FLIP riding #hub's transform, width and height transitions, 0.55 s) — until 2026-10-17 evening
   it dissolved the whole panel instead, and the owner missed the tabs row; then the position glided but the size
   snapped, and the owner saw the screen jump. */
/* No zoom here (2026-10-18): the theater's 3 % scale made the content lurch outward the moment a tab was touched —
   10 px on the tall Stats page, measured on the Pixel ("a little jiggle… it jumps a little when I touch it"). */
#hub .hub-bodies, #hub .hub-foot, #hub-rule { transition: opacity 0.55s ease, filter 0.55s ease; }
#hub.dissolving .hub-bodies, #hub.dissolving .hub-foot, #hub.dissolving #hub-rule { opacity: 0; filter: blur(16px); transition-duration: 0.2s; }
/* A page that is leaving takes no taps (stress pass, 2026-10-18: a Stats row tapped as the page faded out opened a Review whose
   "Stats" button then led to the Computer tab). The tabs row stays live, so a change of mind still works. */
#hub.dissolving .hub-bodies, #hub.dissolving .hub-foot { pointer-events: none; }
/* Snappier (owner, 2026-10-18: "I don't want it to feel heavy as it moves around"): the glide, the tab light and the fade-in
   went 0.7 / 1.0 / 0.7 s -> 0.55 / 0.55 / 0.55 s, and the moving parts use --snap, an ease-out that starts at full speed
   and settles softly, in place of `ease`, whose slow first tenth read as weight. main.js GLIDE_MS must match. */
:root { --snap: cubic-bezier(0.22, 0.61, 0.36, 1); }
#hub { transition: opacity 0.7s ease, filter 0.7s ease, transform 0.55s var(--snap), width 0.55s var(--snap), height 0.55s var(--snap), border-color 0.7s, background 0.7s; }
/* While the frame glides to a new size, nothing pokes out of it. clip, not hidden: hidden makes #hub a scroll box, which
   moved the sticky tab row 6 px down at the swap and 6 px back up at the end of the glide (measured on the Pixel,
   2026-10-18: the owner's "little bump" between Human and Stats). clip cuts the same way without being a scroll box. */
#hub.gliding { overflow: clip; }
/* Each frame of a glide re-lays the hub out; containment keeps that from reaching into the page's rows and graph, and
   the bodies sit on their own layer for the blur (2026-10-18: "still a little framey" between different-sized menus). */
#hub .hub-bodies { will-change: opacity, filter; contain: layout style; }
/* Never shrink to fit the screen (2026-10-18, measured on the Pixel): #hub is a flex item of #screen-start, and with
   overflow hidden (.gliding) its automatic minimum height becomes 0, so the Stats page glided to the 733 px left on
   the screen and sprang to its real 834 px when the clip came off. The screen scrolls instead. */
#hub { flex-shrink: 0; }
/* A Lichess game in progress (2026-10-18): the lobby says so in place of the Game and Time choices, and Play reads
   "Return" (main.js syncHubFoot). A saved computer game does the same on the Computer tab, in place of Play as and Level. */
#online-lobby.resuming .row, .hub-body.resuming > .row { display: none; }
#online-resume .resume-line, #computer-resume .resume-line { font-size: 15px; letter-spacing: 0.04em; color: #d6e6ff; }
#btn-quit-game { margin-top: 4px; }
#btn-quit-game.armed { color: #e6a0a0; }
#btn-quit-game.hidden { display: none; }
/* The panel's soft glow lives on its own layer (2026-10-18, measured on the Pixel): drawn on #hub itself it was
   redrawn at every frame of a glide as the panel changed size, and Stats → Human dropped 11–15 of 180 frames; with
   the glow off it dropped about 2. So the glow steps aside while the panel glides (or is the open Stats page) and
   fades back in when it lands — an opacity fade, which costs no redraw. Same look as .panel's shadow. */
#hub { box-shadow: none; position: relative; }
#hub::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 22px rgba(110,140,255,0.06); animation: hubglow 0.55s ease both; }
#hub.gliding::after, #hub.stats-page::after { display: none; }
@keyframes hubglow { from { opacity: 0; } to { opacity: 1; } }
.hub-body { animation: none; } /* the dissolve replaces the 6 px rise (bodyin) */

/* Post-game panel. The app's `.overlay button` rule makes every overlay button a pill; the
   go-word and the quiet links opt back out. */
#gameover .panel { gap: 14px; }
#gameover .panel #gameover-text { font-size: 19px; letter-spacing: 0.26em; text-indent: 0.26em;
  text-align: center; line-height: 1.5; }
#gameover-sub:empty, #gameover-summary:empty, #gameover-how:empty { display: none; }
/* how the game ended, under the verdict: smaller and quieter than the title (owner 2026-11-08) */
#gameover-how { font-size: 13px; letter-spacing: 0.18em; color: #8ea6cc; text-align: center; margin-top: -6px;
  animation: fadein 1s ease 0.5s both; }
#gameover.closing #gameover-how { animation: none; }
#gameover-sub { animation: fadein 1s ease 0.6s both; }
.summary { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: #6678a6; text-align: center; }
.overlay button.level { border: 0; border-radius: 0; font-size: 22px; letter-spacing: 0.32em; text-indent: 0.32em;
  padding: 6px 0; white-space: nowrap; color: var(--lobby-green-text); text-shadow: 0 0 12px rgba(130,235,190,0.45); }
.overlay button.quiet { border: 0; border-radius: 0; color: #5c6c98; font-size: 11px; letter-spacing: 0.2em;
  text-indent: 0; padding: 8px 10px; text-shadow: none; }

/* Online board controls: a Draw button mirroring the Resign flag, shown only online */
#btn-draw-board {
  background: none; border: none; cursor: pointer; padding: 0;
  color: #3f4c73; font-size: 20px; line-height: 1; display: none; align-items: center;
  transition: color 0.3s, text-shadow 0.3s;
}
.online-mode #btn-draw-board { display: inline-flex; }
/* The trouble panel and the note line (2026-10-20, main.js showTrouble / showNote). The panel wears the draw prompt's
 look; the note sits under the top edge, above the overlays, and lets taps through. */
#trouble .draw-title { text-align: center; line-height: 1.5; max-width: 22em; padding: 0 16px; }
#trouble .cap { max-width: 26em; padding: 0 16px; font-size: 12px; color: #8ea6cc; }
#trouble .cap:empty { display: none; }
#app-note { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 18px); z-index: 6; margin: 0;
  padding: 0 56px; pointer-events: none; color: #8ea6cc; }
.draw-title { font-size: 18px; letter-spacing: 0.2em; text-indent: 0.2em; text-transform: uppercase;
  color: #cfe0ff; text-shadow: 0 0 14px rgba(140,190,255,0.5); }
#btn-draw-board.armed { color: #9fd0ff; text-shadow: 0 0 12px rgba(140,200,255,0.7); }
/* resting for 20 plies after the player's own offer, as on lichess.org (main.js syncDrawButton): dim, not pressable */
#btn-draw-board.spent { opacity: 0.3; pointer-events: none; }
#draw-word {
  display: inline-block; overflow: hidden; white-space: nowrap; max-width: 0; opacity: 0; margin-left: 0;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  transition: max-width 0.45s ease, opacity 0.45s ease, margin-left 0.45s ease;
}
#btn-draw-board.armed #draw-word { max-width: 6em; opacity: 1; margin-left: 8px; }

/* --- Review (post-game analysis board) — body.analysis-mode gates the layout. --- */
/* game-stage holds the board + all Review chrome. In a live game it is a full-height column
   with the board centred and each side row sitting AGAINST the board (review 2026-09-11:
   "the names, pieces, and clock should be against the board, like in theater") — it used to
   spread them to the top and bottom of the viewport with space-between. The board's own
   14px margin (src/board.css) is the gap. */
#game-stage { display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; align-self: stretch; width: 100%; min-height: 0; }
/* Review from the play-again screen (main.js reviewFromGameOver): the stage fades out with the screen, Review is laid out
   unseen, then the stage fades back in. */
#game-stage { transition: opacity 0.7s ease; }
#game-stage.stage-out { opacity: 0; pointer-events: none; transition-duration: 0.8s; }
/* the ⋯ menu sits beside the stage, not in it: while the stage is on its way out to Review it takes no taps either */
#screen-game:has(> #game-stage.stage-out) #menu-dot { pointer-events: none; }
/* Review-only elements are hidden in a live game; analysis-mode reveals them. */
#an-lines, #an-accuracy, #eval-bar, #an-strip, #an-controls, #coach-note { display: none; }

/* Played line (move list): one row, scrolls sideways. Its look lives in one block under body.analysis-mode below
   (the strip only shows there). */
#an-strip::-webkit-scrollbar { display: none; }

/* Best-lines panel — numbered rows, no box, one row each (scroll). */
#an-lines { flex-direction: column; gap: 7px; max-width: min(96vw, 460px); }
.an-line { display: flex; align-items: baseline; gap: 9px; font-size: 12.5px; }
.an-line .an-rank { color: #41507c; font-size: 11px; }
.an-line .an-mvs { color: #6f80ad; flex: 1; min-width: 0; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.an-line .an-mvs::-webkit-scrollbar { display: none; }
.an-line .an-b1 { color: #9fb6e8; }
.an-line.an-best .an-b1 { color: #c6f1d6; text-shadow: 0 0 7px rgba(150,230,180,.45); }
.an-line .an-ev { color: #e8f4ff; font-weight: 600; min-width: 36px; text-align: right; }

/* Eval bar — thin vertical bar; the number sits at the bottom (player's near side). */
#eval-bar {
  width: 12px; border-radius: 5px; overflow: hidden; position: relative;
  background: rgba(20,26,44,.85); border: 1px solid rgba(150,180,255,.12);
}
#eval-bar.hidden { display: none; }
#eval-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 50%;
  background: linear-gradient(180deg,#e8f4ff,#bcd6f5); box-shadow: 0 0 8px rgba(190,220,255,.45);
  transition: height .5s ease; }
/* The number sits just under the bar, in the bar's own grid cell (2026-11-07). It used to sit inside the 12 px bar,
   which clips to keep its round ends, so "+1.0" (22 px) showed as "-1." (phone QA). It is the bar's next sibling, not
   its child, and only shows while the bar does. */
#eval-num { display: none; position: absolute; grid-area: bar; top: calc(100% + 5px); left: 50%; transform: translateX(-50%);
  font-size: 10px; font-weight: 600; color: #c4d4f0; white-space: nowrap; pointer-events: none; }
body.analysis-mode #eval-bar:not(.hidden) + #eval-num { display: block; }

/* Accuracy line. */
#an-accuracy { display: flex; gap: 16px; justify-content: center; align-items: center; margin: 6px 0; /* above Menu, with room (2026-10-19) */
  font-size: 12px; letter-spacing: .04em; color: #6f80ad; }
#an-accuracy.hidden { display: none; } /* ID beats the .hidden class — restore the hide explicitly */
.an-acc-you { color: #cfe0ff; } .an-acc-opp { color: #b9a6ff; }

/* Nav row + footer. */
.an-nav { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
#an-start, #an-prev, #an-next, #an-end { margin: 0 6px; } /* the arrows spread wider than the pills (owner, 2026-10-19) */
.an-nav button { background: none; border: 1px solid #2a3658; border-radius: 999px; cursor: pointer;
  color: #6678a6; font-size: 13px; padding: 5px 15px; letter-spacing: .06em; }
#btn-back-to-game { color: #8d86c9; border-color: #453a78; text-transform: uppercase; font-size: 11px; }
#btn-back-to-game.hidden { display: none; }
/* Analyze, once the game is analysed: it fades out where it stands (analysis-hud.js setProgress, LEAVE_MS), then is
   removed, and the accuracy line, held back until then, fades in in its place. */
#btn-analyze { transition: opacity .4s ease, filter .4s ease; }
#btn-analyze.leaving { opacity: 0; filter: blur(6px); pointer-events: none; }
#an-controls:has(#btn-analyze.leaving) #an-accuracy { visibility: hidden; height: 0; overflow: hidden; } /* as when empty: its margins stay */
#an-controls:has(#btn-analyze.hidden) #an-accuracy:not(:empty) { animation: fadein .6s ease both; }
.an-footer { display: flex; gap: 26px; justify-content: center; }
.an-footer .level { font-size: 15px; letter-spacing: .24em; }

/* Review move-arrow glyphs — bare (no pill), size hierarchy, and a steady "nebula"
   bloom on whichever direction was last scrubbed. These ID rules beat `.an-nav button`
   on specificity, so they reset the pill for the four glyphs only; #btn-analyze and
   #btn-back-to-game keep their look. One size across web + mobile (no per-device bump). */
#an-start, #an-prev, #an-next, #an-end {
  border: 0; background: none; border-radius: 0; letter-spacing: 0;
  color: #7385ac; font-size: 28px; line-height: 1; padding: 12px 16px; /* 20 px until 2026-10-19: owner asked for bigger */
  position: relative; transition: color .25s ease, text-shadow .25s ease;
}
#an-start, #an-end { color: #3c4a75; font-size: 21px; padding: 12px 12px; } /* start/end jumps sit back */
#an-prev::before, #an-next::before {
  content: ""; position: absolute; inset: -7px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(130,180,255,.34), transparent 68%);
  opacity: 0; transition: opacity .25s ease; /* cross-fades as the glow moves */
}
#an-prev.nav-active, #an-next.nav-active { color: #dcebff; text-shadow: 0 0 11px rgba(150,200,255,.5); }
#an-prev.nav-active::before, #an-next.nav-active::before { opacity: 1; }

/* ===== Review layout — MOBILE (default) ===== */
/* Column 1 is JUST the eval bar; everything else lives in column 2 at a fixed board
   width, so nothing spans and inflates the bar column. Names align to the board edges. */
body.analysis-mode #game-stage {
  display: grid; justify-content: center; align-content: safe center; overflow-y: auto;
  position: relative; /* the containing block for #eval-num, placed in the bar's grid cell */
  grid-template-columns: 12px min(84vw, 440px) 12px; /* phantom right col balances the bar so the board centers */
  grid-template-areas:
    ".    played   ."
    ".    lines    ."
    ".    opp      ."
    "bar  board    ."
    ".    you      ."
    ".    controls .";
  column-gap: 6px; row-gap: 8px;
}
/* In the menu's manners since 2026-11-06 (owner's pick, option B, after "this is the old style"): no bubble — the moves
   stand on the stars in light, wide lettering and fade out at both ends instead of being cut by a border; the current
   move goes near-white with the theme's glow and a short glowing line under it, like the menu's chosen tab. */
body.analysis-mode #an-strip   { grid-area: played; display: flex; gap: 8px; align-items: baseline; white-space: nowrap;
  overflow-x: auto; scrollbar-width: none; min-width: 0; max-width: 100%; justify-self: stretch;
  padding: 6px 18% 10px; font-weight: 300; /* the side padding = the fade, so move 1 and the last move can reach full light */
  font-size: 13px; letter-spacing: .1em; color: #8494be;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); }
body.analysis-mode .an-num { color: #4f5d86; font-size: 11px; margin-left: 6px; }
body.analysis-mode .an-num:first-child { margin-left: 0; }
body.analysis-mode .an-move { cursor: pointer; padding: 1px 5px; border-radius: 6px; }
body.analysis-mode .an-move.cur { position: relative; color: #f2f7ff;
  text-shadow: 0 0 8px rgba(var(--gc-wp-glow, 127,208,255), .6); }
body.analysis-mode .an-move.cur::after { content: ""; position: absolute; left: -6px; right: -6px; bottom: -5px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--gc-wp-glow, 127,208,255), .8), transparent);
  box-shadow: 0 0 6px rgba(var(--gc-wp-glow, 127,208,255), .6); }
/* Judgment colours, declared once. After .cur (same specificity) so they stay on the current move too — the glow
   and the line are the "you are here". A variation move keeps its own colour over a judgment, as before. */
body.analysis-mode .an-move.j-inaccuracy { color: #9fc0ee; }   /* lighter blue */
body.analysis-mode .an-move.j-mistake    { color: #e6d16a; }   /* yellow */
body.analysis-mode .an-move.j-blunder    { color: #e07a7a; }   /* red */
body.analysis-mode .an-move.var { font-style: italic; color: #8d86c9; }
body.analysis-mode .an-move.cur.var { color: #c9c3f0; }
#an-lines { transition: opacity 0.2s ease; }
#an-lines.stale { opacity: 0.3; } /* the previous position's lines, until the new search's first answer (main.js refreshEngineForPosition) */
body.analysis-mode #an-lines   { grid-area: lines; display: flex; min-width: 0; max-width: 100%; justify-self: stretch;
  height: var(--an-lines-h, 68px); overflow: hidden; } /* always three lines tall (2026-10-18, owner: "the board and screen jump around
  a lot due to the lines appearing and disappearing above it"): empty, one line or three, the board below never moves */
/* Coaching note (src/coach-hud.js; the owner's pick "A2", mockups/coach-frame.html, 2026-10-18): a bubble in the lines'
   own slot — the lines fade out as it fades in (body.coach-on), the slot keeps its height, so the board never moves. */
body.analysis-mode #coach-note { grid-area: lines; display: flex; flex-direction: column; justify-content: safe center; gap: 4px;
  min-width: 0; max-width: 100%; justify-self: stretch; height: var(--an-lines-h, 68px);
  opacity: 0; pointer-events: none; transition: opacity .35s ease;
  overflow: hidden; overflow-x: visible; overflow-y: clip; } /* guard: nothing spills over the strip or the names (sideways stays free for the nudge) */
body.analysis-mode.coach-on #coach-note { opacity: 1; pointer-events: auto; transition-delay: .12s; }
/* the lines fade out, and back in (coach-leaving: coach-hud.js, for 0.4 s after a note goes), over 0.35 s; .stale keeps its own 0.2 s */
body.analysis-mode.coach-on #an-lines { opacity: 0; pointer-events: none; transition: opacity .35s ease; }
body.analysis-mode.coach-leaving #an-lines { transition: opacity .35s ease; }
body.analysis-mode .coach-bubble { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 6px 12px 7px;
  border: 1px solid rgba(150,180,255,.14); border-radius: 11px; background: rgba(150,180,255,.05);
  touch-action: pan-y; user-select: none; cursor: grab; will-change: transform; }
body.analysis-mode .coach-bubble.red    { border-color: rgba(224,122,122,.28); }
body.analysis-mode .coach-bubble.yellow { border-color: rgba(230,209,106,.26); }
body.analysis-mode .coach-bubble.fly { transition: transform .25s ease, opacity .25s ease; }
body.analysis-mode .coach-bubble.nudge { animation: coach-nudge 1.1s ease .5s 1; }
@keyframes coach-nudge { 0%, 100% { transform: none; } 30% { transform: translateX(16px); } 55% { transform: translateX(-5px); } 75% { transform: translateX(2px); } }
body.analysis-mode .coach-top { display: flex; justify-content: space-between; align-items: baseline; line-height: 1.2; }
/* (padding and the top row's line-height are 1–3 px tighter than the mock-up: two lines of words fit the 68 px slot) */
/* the top row never wraps: the tag keeps its width, the hint gives way (ellipsis, then gone) */
body.analysis-mode .coach-tag { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: #9fc0ee;
  white-space: nowrap; flex-shrink: 0; }
body.analysis-mode .coach-tag.red    { color: #e07a7a; }
body.analysis-mode .coach-tag.yellow { color: #e6d16a; }
body.analysis-mode .coach-hint { font-size: 9.5px; letter-spacing: .12em; color: #3d4c78; white-space: nowrap;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; margin-left: 10px; }
body.analysis-mode .coach-say { font-size: 12.5px; line-height: 1.4; color: #cfe0ff; letter-spacing: .02em; }
@media (max-width: 379px) { body.analysis-mode .coach-say { font-size: 11.5px; } } /* narrow phones: two lines of words still fit the slot */
body.analysis-mode .coach-bubble.coach-tight .coach-say { font-size: 11px; } /* one bubble that still overflowed its slot (coach-hud.js fitBubble) */
body.analysis-mode .coach-end { opacity: 0; transition: opacity .4s; }
body.analysis-mode .coach-end.done { opacity: 1; }
body.analysis-mode .coach-go { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 12px;
  color: #b9a6ff; letter-spacing: .08em; white-space: nowrap; }
body.analysis-mode .coach-go:hover { color: #e0d6ff; }
body.analysis-mode .coach-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
body.analysis-mode .coach-line { font-size: 12px; color: #8d86c9; font-style: italic; letter-spacing: .04em;
  flex: 1; min-width: 0; white-space: nowrap; overflow-x: auto; scrollbar-width: none; } /* one row: a long line scrolls to keep the current move in view (coach-hud.js) */
body.analysis-mode .coach-line::-webkit-scrollbar { display: none; }
body.analysis-mode .coach-line .coach-mv { padding: 1px 4px; border-radius: 6px; }
body.analysis-mode .coach-line .cur { color: #e8f4ff; background: rgba(90,130,220,.24); } /* the move the board is on (the strip's old bubble look; the strip itself lost it 2026-11-06) */
body.analysis-mode .coach-back { background: none; border: 1px solid #453a78; border-radius: 999px; cursor: pointer; color: #8d86c9;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 4px 12px; white-space: nowrap; }
body.analysis-mode .an-line:nth-child(n+4) { display: none; } /* mobile shows top 3 */
body.analysis-mode .side-top   { grid-area: opp; justify-self: end; }
body.analysis-mode #eval-bar   { grid-area: bar; display: block; align-self: stretch; }
body.analysis-mode #board      { grid-area: board; width: 100%; }
body.analysis-mode .side-bottom{ grid-area: you; justify-self: start; }
body.analysis-mode #an-controls{ grid-area: controls; display: flex; flex-direction: column;
  align-items: center; gap: 12px; margin-top: 4px; min-width: 0; max-width: 100%;
  min-height: 160px; justify-content: flex-start; }
/* The Review screen is centred, so anything under the board that changes height moves the board too: the Analyze button
   wraps the arrow row onto two lines and leaves when the sweep ends, and the accuracy line arrives — 157 → 134 px, the board
   down 12 px (measured 2026-10-18). The area keeps the larger height throughout. */
body.analysis-mode #an-accuracy{ display: flex; }

/* Review hides live-game chrome; keeps names + trays. */
body.analysis-mode #menu-dot, body.analysis-mode #btn-flag,
body.analysis-mode #btn-draw-board, body.analysis-mode .side .score { display: none; }
body.analysis-mode .side { width: auto; }
body.analysis-mode .side-top { flex-direction: row-reverse; gap: 8px; }
body.analysis-mode .side-bottom { flex-direction: row; gap: 8px; }

/* ===== Review layout — DESKTOP ===== */
@media (min-width: 720px) {
  /* Right column holds the lines + played strip, top-aligned with the board's row.
     (accuracy stays with the controls under the board — it's nested in #an-controls.) */
  /* Bigger board, centered on screen: a left spacer mirrors the right lines panel so the
     board sits in the middle with the spacey background breathing on both sides. */
  body.analysis-mode #game-stage {
    justify-content: center; align-content: center; overflow: visible;
    grid-template-columns: minmax(160px, 300px) min-content min(64vh, 620px) minmax(160px, 300px);
    grid-template-areas:
      ".       .    opp      ."
      "spacer  bar  board    lines"
      ".       .    you      played"
      ".       .    controls .";
    column-gap: 22px; row-gap: 10px;
  }
  body.analysis-mode #an-lines   { grid-area: lines; align-self: start; justify-self: start; max-width: 100%;
    height: auto; min-height: 93px; overflow: visible; } /* beside the board here: all four lines, and its own height cannot move the board */
  body.analysis-mode #coach-note { grid-area: lines; align-self: start; justify-self: stretch; justify-content: flex-start;
    height: auto; min-height: 93px; } /* the note sits where the lines start, in the same column */
  body.analysis-mode #an-strip   { grid-area: played; align-self: start; justify-self: start; max-width: 100%; }
  body.analysis-mode #board      { width: 100%; }
  body.analysis-mode #an-controls{ grid-area: controls; }
  body.analysis-mode .an-line:nth-child(n+4) { display: flex; } /* desktop shows the 4th line */
}

/* Catch-all: a `hidden` class always hides, regardless of an element's own display rule.
   Placed last so it wins source-order ties against class/element display declarations.
   (ID-scoped elements like #online-login keep their own #id.hidden rules — an ID beats a
   class on specificity, so those still need the explicit overrides above.) This closes a
   class of bugs where a class-based element carrying `hidden` still computed display:block
   and overflowed on mobile, e.g. a .note-line that was hidden but still took its row. */
.hidden { display: none; }
