/* Games area: game page (the analysis room), game archive, search, openings. Built from site.css tokens.
   Lists are data cards (.dcards in site.css); each list names its column tracks here with --dc-cols. */

/* ── Game page ─────────────────────────────────────────────────────────── */
/* The head is one short line (both names repeat on the board bars). In one column the board is sized by the viewport
   height as well as the width, so the board, both bars and the replay controls sit above the fold: --gm-board is the
   board's side, and 414px is the chrome above the board (header, ticker, breadcrumb, head and subtitle, black bar) plus the white
   bar and controls below it. Beside the side panel (wider than 980px) the board fills its column instead, since the
   panel sets the stage's height anyway, capped so the board and both bars still fit one screen once scrolled to. */
.site-main:has(> .gm-head) { padding-top: 24px; }
.site-main:has(> .gm-head) > .breadcrumb { margin-bottom: 10px; }
.gm-head { padding-bottom: 16px; }
.gm-title { font-size: clamp(28px, 3vw, 38px); line-height: 1.02; }
.gm-title em { padding-inline: .06em; }
.gm-sub { margin-top: 6px; font-size: 14px; line-height: 1.35; color: var(--muted); }
.gm-main { --gm-board: clamp(300px, calc(100svh - 414px), 680px); --gm-pad: clamp(14px, 2.6vw, 32px); display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); }
.gm-stage { display: flex; flex-direction: column; gap: 10px; padding: 16px var(--gm-pad) var(--gm-pad); min-width: 0; }
.gm-stage > * { order: 5; }
.gm-stage > .gm-board-tags { order: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.gm-board-tags:not(:has(> :not([hidden]))) { display: none; }
.gm-position { order: 1; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px 8px; width: min(100%, calc(var(--gm-board) + 52px)); margin-inline: auto; }
.gm-bar { grid-column: 2; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 16px; }
.gm-bar [data-latest-clock]:empty { display: none; }
.gm-bar--black { order: 1; } .gm-board { order: 2; } .gm-bar--white { order: 3; }
.is-flipped .gm-bar--black { order: 3; } .is-flipped .gm-bar--white { order: 1; }
.gm-bar-who { flex: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 6px; }
.gm-bar-who .plink-name { font-weight: 650; white-space: normal; overflow-wrap: anywhere; }
.gm-board { grid-column: 1 / -1; grid-template-columns: subgrid; }
.gm-board .board { --board-max: var(--gm-board); margin-inline: auto; }
.gm-dateline { margin-bottom: -6px; }
.replay-controls { display: flex; align-items: center; gap: 6px; max-width: calc(var(--gm-board) + 52px); width: 100%; margin: 0 auto; }
.replay-play .i-pause, .replay-play.is-playing .i-play { display: none; }
.replay-play.is-playing .i-pause { display: block; }
.replay-range { flex: 1; min-width: 60px; height: 42px; margin: 0 8px; accent-color: var(--accent); cursor: pointer; background: transparent; }
.replay-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; max-width: calc(var(--gm-board) + 52px); width: 100%; margin-inline: auto; font: 400 14px/1.4 var(--mono); color: var(--muted); }
.replay-speed { display: inline-flex; align-items: center; gap: 8px; }
.replay-speed .select { width: auto; height: 40px; padding-left: 12px; background-color: var(--surface-2); font: inherit; }
.gm-side { display: flex; flex-direction: column; gap: 18px; padding: clamp(18px, 2.6vw, 32px); border-left: 1px solid var(--line); background: rgba(255, 255, 255, .018); min-width: 0; }
.gm-score { display: flex; align-items: baseline; gap: 14px; font: 800 semi-condensed clamp(44px, 5vw, 64px)/1.1 var(--display); letter-spacing: -.02em; }
.gm-score > span:first-child { color: var(--accent-text); }
.gm-dash { color: var(--muted); padding-inline: .08em; }
.gm-score-label { font: 700 14px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted) !important; }
.gm-result-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; font-size: 15px; font-weight: 550; }
.gm-opening { margin-top: 6px; font-size: 14px; color: var(--text-2); }
.gm-moves-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.move-list { flex: 1 1 280px; min-height: 180px; max-height: 420px; overflow-y: auto; margin-inline: -8px; padding-inline: 8px; scrollbar-width: thin; }
.mv-row { display: grid; grid-template-columns: 38px 1fr 1fr; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.mv-no { font: 400 14px/1 var(--mono); color: var(--muted); }
.move { height: 34px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; text-align: left; font: 600 14px/1 var(--mono); color: var(--text); }
.move:hover { background: var(--surface-2); }
.move.is-current { background: var(--accent); color: var(--on-accent); }
.mv-gap { padding: 0 10px; color: var(--muted); }
.gm-moves-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font: 400 14px/1 var(--mono); color: var(--muted); }
.mv-result { font-weight: 600; color: var(--text); font-size: 14px; }
.gm-kbd { display: inline-flex; align-items: center; gap: 4px; }
.gm-side .empty { border-color: var(--line-2); }
@media (min-width: 981px) {
  .gm-main { --gm-board: clamp(300px, min(100cqi - 52px, 100svh - 150px), 680px); grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .gm-stage { container-type: inline-size; }
  .move-list { flex-basis: 180px; }  /* The list grows to the board's height rather than setting the stage's. */
  .replay-meta { flex-wrap: nowrap; }
  .replay-meta [data-position-label] { flex: 1 1 0; min-width: 0; }  /* Wraps beside the speed menu, not under it. */
}
@media (max-width: 980px) { .gm-main { grid-template-columns: minmax(0, 1fr); } .gm-side { border-left: 0; border-top: 1px solid var(--line); } .move-list { max-height: 320px; } }
@media (max-width: 520px) { .replay-controls .btn--icon { width: 38px; min-height: 38px; } .replay-range { margin: 0 2px; } .gm-bar { font-size: 14.5px; } .gm-bar .fed-code { display: none; } .gm-bar .fed { padding: 0; border: 0; } .no-flags .gm-bar .fed, .gm-bar .fed--noflag { display: none; } }
/* Phone: the stage runs edge to edge, the evaluation bar becomes a thin strip under the board (the vertical meter is
   turned a quarter: white's share reads from the left), the scrubber gets its own row, and the moves become a
   horizontal strip at the top of the side panel, right under the controls, so a tapped move changes a board in view. */
@media (max-width: 640px) {
  .site-main:has(> .gm-head) { padding-top: 6px; }
  .site-main:has(> .gm-head) > .breadcrumb { margin-bottom: 4px; }
  .gm-head { padding-bottom: 6px; }
  .gm-title { font-size: clamp(24px, 6.4vw, 28px); }
  .gm-sub { margin-top: 3px; font-size: 13px; }
  .gm-main { margin-inline: calc(-1 * var(--gutter)); border-radius: 0; border-inline: 0; }
  .gm-stage { gap: 8px; padding: 10px 8px 8px; }
  .gm-position { grid-template-columns: minmax(0, 1fr); gap: 8px; width: min(100%, var(--gm-board)); }
  .gm-bar { grid-column: 1; }
  .gm-board.board-with-eval { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .gm-board .eval-bar { order: 2; container-type: size; height: 12px; min-height: 0; padding: 0 52px 0 0; }
  .gm-board .eval-meter { position: absolute; top: 50%; left: 50cqw; width: 100cqh; height: 100cqw; min-height: 0; margin: 0; transform: translate(-50%, -50%) rotate(90deg); }
  .gm-board .eval-value { top: 50%; bottom: auto; left: auto; right: 0; transform: translateY(-50%); }
  .replay-controls { flex-wrap: wrap; justify-content: space-between; gap: 4px; }
  .replay-range { order: 1; flex: 1 0 100%; height: 32px; margin: 0; }
  .replay-meta { flex-wrap: nowrap; padding-inline: 4px; }
  .replay-meta [data-position-label] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .replay-speed-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .gm-side { gap: 14px; padding: 8px var(--gutter) 18px; }
  .gm-moves-head { order: -2; }
  .move-list, .gm-moves-foot { order: -1; }
  .move-list { display: flex; flex: none; min-height: 0; max-height: none; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; margin: -6px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter) 4px; }
  .mv-row { display: flex; align-items: center; flex: none; gap: 0; border-bottom: 0; }
  .mv-no { padding: 0 2px 0 8px; }
  .move { height: 40px; padding: 0 8px; }
}
@media (pointer: coarse) { .gm-kbd { display: none; } }

.gm-context { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1.5px solid var(--edge); border-radius: var(--r); background: var(--card); overflow: hidden; }
.gm-ctx { display: grid; grid-row: span 3; grid-template-rows: subgrid; align-items: start; row-gap: 14px; padding: 20px; border-left: 1px solid var(--line); min-width: 0; }
.gm-ctx:first-child { border-left: 0; }
.gm-ctx-data { display: grid; align-content: start; gap: 6px; min-width: 0; }
.gm-ctx .section-link { margin: 6px 0 0; }
.gm-big { font: 800 semi-condensed 36px/1.1 var(--display); letter-spacing: -.01em; }
.gm-big em { font-size: .74em; }
.gm-big--b { color: var(--muted); }
.gm-odds { display: flex; justify-content: space-between; }
.gm-split { width: 100%; height: 8px; border-radius: 4px; overflow: hidden; }
.gm-split .w { fill: var(--accent); } .gm-split .b { fill: var(--line-2); }
.gm-form-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 29px; }
.gm-ctx-name { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-pts { font: 800 semi-condensed 26px/1.1 var(--display); }
.gm-pts .muted { font-size: .7em; }
@media (max-width: 1080px) { .gm-context { grid-template-columns: repeat(2, minmax(0, 1fr)); } .gm-ctx:nth-child(odd) { border-left: 0; } .gm-ctx:nth-child(n + 3) { border-top: 1px solid var(--line); } }
@media (max-width: 600px) { .gm-context { grid-template-columns: minmax(0, 1fr); } .gm-ctx { border-left: 0; } .gm-ctx + .gm-ctx { border-top: 1px solid var(--line); } }

/* By the numbers: one card per measure. White's figure sits on the left and Black's on the right, each beside its
   swatch, over a bar split between the two (bone for White, ink for Black, framed so both show in either theme).
   Measures without comparable figures (castling, clocks) and the one with a note take a full row on a phone. */
.gm-numbers { display: grid; gap: 14px; }
.gm-num-head { display: flex; flex-wrap: wrap; gap: 6px 24px; font: 800 semi-condensed 22px/1.1 var(--display); }
.gm-num-head span { display: inline-flex; align-items: center; gap: 8px; }
.gm-num-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.gm-num { grid-template-columns: minmax(0, 1fr); align-content: start; gap: 9px; padding: 14px 16px; }
.gm-num-label { font: 700 12px/1.3 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--text-2); }
.gm-num-sides { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 12px; margin: 0; }
.gm-num-side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gm-num-b { flex-direction: row-reverse; text-align: right; }
.gm-num-side dt { display: flex; flex: none; }
.gm-num-side dd { margin: 0; min-width: 0; font: 800 semi-condensed 28px/1 var(--display); overflow-wrap: anywhere; }
.gm-num--text .gm-num-side dd { font: 700 16px/1.25 var(--sans); }
.gm-nbar { width: 100%; height: 8px; border-radius: 3px; background: var(--surface-2); box-shadow: 0 0 0 1.5px var(--line-2); }
.gm-nbar .w { fill: var(--bone); } .gm-nbar .b { fill: var(--ink); }
.gm-num-note { font-size: 13px; line-height: 1.35; color: var(--muted); }
@media (max-width: 600px) { .gm-num-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } .gm-num { padding: 12px; } .gm-num--wide { grid-column: 1 / -1; } }

.gm-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); column-gap: clamp(24px, 3vw, 44px); }
.gm-dl > div { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.gm-dl dt { font: 700 14px/1.6 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.gm-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.gm-pgn { margin-top: 18px; border: 1.5px solid var(--edge); border-radius: var(--r-sm); background: var(--card); }
.gm-pgn summary { padding: 12px 16px; cursor: pointer; font: 700 14px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.gm-pgn pre { margin: 0; padding: 14px 16px; border-top: 1px solid var(--line); max-height: 320px; overflow: auto; font: 400 14px/1.6 var(--mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word; }

/* ── Archive ───────────────────────────────────────────────────────────── */
.ga-day {
  --archive-columns: repeat(auto-fill, minmax(min(100%, 388px), 1fr));
  --archive-gap: clamp(12px, 1.2vw, 20px);
  display: grid;
  grid-template-columns: var(--archive-columns);
  gap: 26px var(--archive-gap);
  margin-top: clamp(32px, 4.4vw, 56px);
}
.ga-day:first-child { margin-top: 28px; }
.ga-date { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.ga-date-main { font: 800 semi-condensed clamp(24px, 2.5vw, 30px)/1.1 var(--display); letter-spacing: -.015em; }
.ga-date-main em { color: var(--muted); }
.ga-date-count { margin-left: auto; font: 400 14px/1 var(--mono); color: var(--muted); }
.ga-group { min-width: 0; }
/* Single-board rounds can sit side by side. Larger rounds keep their own board grid. */
.ga-group:has(.ga-row:nth-child(2)) { grid-column: 1 / -1; }
.ga-event { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 12px; font-size: 17px; font-weight: 650; }
.ga-event a:hover { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.ga-event-round { font: 700 14px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
/* A round is a grid of matchups, in board order. The score chips share the players' rows,
   so even a wrapped name keeps its own result in line. */
.ga-list > .dcards-list { grid-template-columns: var(--archive-columns); gap: var(--archive-gap); }
.ga-row { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; align-items: start; gap: 14px; padding: clamp(12px, 1.25vw, 20px); border-top: 6px solid var(--ev); background: var(--card); }
.ga-row.dcard--stale { border-top-style: dashed; }
.ga-board-meta, .ga-foot { display: flex; align-items: center; gap: 8px; }
.ga-board-meta { flex-wrap: wrap; color: var(--muted); }
.ga-board-meta .gb-mv { margin-left: 0; font-size: 13px; }
.ga-board-meta .pill, .ga-board-meta .gb-time { margin-left: auto; }
.ga-match { display: grid; min-width: 0; align-items: center; align-self: stretch; }
.ga-match--pictured { grid-template-columns: minmax(0, 32%) minmax(0, 1fr); gap: clamp(12px, 1.1vw, 20px); }
.ga-diagram { display: block; width: 100%; aspect-ratio: 1; border-radius: 3px; box-shadow: 0 0 0 2px var(--ink); background: var(--sq-light); }
.ga-checks { stroke: var(--diagram-dark, var(--sq-dark)); shape-rendering: crispEdges; }
.ga-tone-2 { --diagram-dark: color-mix(in srgb, var(--sq-dark) 62%, var(--sq-last-dark)); }
.ga-tone-3 { --diagram-dark: color-mix(in srgb, var(--sq-dark) 68%, var(--ev-deep)); }
.ga-last { fill: var(--sq-last-light); stroke: var(--ink); stroke-width: .08; }
.ga-last--dark { fill: var(--sq-last-dark); }
.ga-sides { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 12px 8px; }
.ga-sides:has(.ga-score) { grid-template-columns: minmax(0, 1fr) auto; }
.ga-sides .gcard-p { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 5px; }
.ga-sides .plink { align-items: center; }
.ga-sides .plink-name { white-space: normal; overflow-wrap: anywhere; }
.ga-player-meta { grid-column: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.ga-score { grid-area: 1 / 2 / 3 / 3; display: grid; grid-template-rows: subgrid; align-items: center; }
.ga-foot { min-height: 34px; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 5px; }
.ga-op { min-width: 0; font-size: 14px; line-height: 1.4; color: var(--text-2); overflow-wrap: anywhere; }
.ga-eco { color: var(--muted); }
.ga-no-preview { display: block; color: var(--muted); }
.ga-foot .row-go { flex: none; }
.ga + .pager .pager-list { max-width: 100%; flex-wrap: wrap; }

/* ── Board cards ───────────────────────────────────────────────────────── */
/* The game page lists its round's other boards in columns on wide screens. */
.gb-time { font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.dcards--boards .gcard-rd, .gb-mv { white-space: nowrap; }
.gb-mv { margin-left: auto; }
/* A missing board number or move count is a dash in its column; on a phone the details line leaves it out. */
@media (max-width: 899.98px) { .dcards--boards .gb-none { display: none; } }
@media (min-width: 900px) {
  .dcards--boards { --gb-res: 68px; }
  .dcards--boards:has(.pill--stale) { --gb-res: 140px; }
  .gm-round { --dc-cols: 44px minmax(0, 1fr) 48px var(--gb-res) minmax(0, 1fr) 48px 64px 32px; }
  .gm-round:not(:has(.row-go)) { --dc-cols: 44px minmax(0, 1fr) 48px var(--gb-res) minmax(0, 1fr) 48px 64px; }
  /* The card's phone rows (.gcard's template areas) would stay as empty rows under the columns. */
  .dcards--boards .gcard { grid-template-areas: none; }
  /* The board column needs no word in front of its number, and under a "Moves" legend the count needs no unit. */
  .dcards--boards .gb-pre { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .gm-round .gb-unit { display: none; }
  .dcards--boards .gb-mv { margin-left: 0; text-align: right; font-size: 14px; color: var(--muted); }
}
/* ── Search ────────────────────────────────────────────────────────────── */
.sr-form { display: flex; gap: 10px; max-width: 760px; }
.sr-input { height: 56px; font-size: 18px; padding-inline: 24px; }
.sr-form .btn { min-height: 56px; padding-inline: 28px; }
.sr-jump { margin-top: 20px; }
.sr-zero { color: var(--muted); }
.sr-none { margin-top: 40px; display: grid; gap: 14px; }
.sr-none-title { font: 800 semi-condensed clamp(28px, 3vw, 36px)/1.1 var(--display); letter-spacing: -.015em; }
.sr-tips { display: grid; gap: 6px; color: var(--text-2); font-size: 15px; }
.sr-tips li { padding-left: 18px; position: relative; }
.sr-tips li::before { content: ""; position: absolute; left: 0; top: .55em; width: 8px; height: 8px; background: var(--accent); border-radius: 2px; }
.sr-suggest-row { display: flex; align-items: center; gap: 10px; padding: 12px 18px; }
.sr-suggest-row .plink { flex: 1; }
.sr-suggest-elo { font: 800 semi-condensed 24px/1.1 var(--display); }
@media (max-width: 720px) { .sr-form { flex-direction: column; } }
/* Players found: one card per player. Phone: name, federation and the classical rating over the other figures. From
   900px the name line's two parts (name, federation) take a column each, so the list reads in aligned columns. */
.srcard { grid-template-columns: minmax(0, 1fr) auto; }
.srcard-fed { display: inline-flex; flex: none; }
.srcard .dc-facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 899.98px) { .srcard-none { display: none; } }
@media (min-width: 900px) {
  .dcards--found { --dc-cols: minmax(0, 1fr) 76px 92px 72px 72px 104px 64px; }
  .dcards--found .srcard-main { display: contents; }
  .dcards--found .dcard-key small { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
}

/* ── Openings ──────────────────────────────────────────────────────────── */
/* The index: one card per opening. Phone: the name, its ECO codes and the game count, then White's score beside the
   results. From 900px the name line's two parts (name, codes) take a column each. The results bar splits the
   finished games into White wins (bone), draws and Black wins (ink), framed so all three show in either theme; the
   counts beside it carry the sides' swatches. */
.opcard { grid-template-columns: minmax(0, 1fr) auto; }
.opcard-name { overflow-wrap: anywhere; }
a.opcard-name:hover { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.opcard-eco { font-size: 14px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.opcard .dcard-key small, .dcards--tally .dcard-key small { display: inline; margin: 0 0 0 5px; }
.opcard .dc-facts { grid-template-columns: auto minmax(0, 1fr); column-gap: 20px; }
.op-wdl { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; min-width: 0; }
.op-wdl-bar { flex: 1 1 64px; min-width: 48px; height: 8px; border-radius: 3px; box-shadow: 0 0 0 1.5px var(--line-2); }
.op-wdl-bar .w { fill: var(--bone); } .op-wdl-bar .d { fill: var(--line-2); } .op-wdl-bar .b { fill: var(--ink); }
.op-wdl-n { display: grid; grid-template-columns: repeat(3, minmax(40px, auto)); justify-items: end; flex: none; gap: 0 6px; font: 600 14px/1.2 var(--mono); white-space: nowrap; }
.op-wdl-n > span { display: inline-flex; align-items: center; gap: 5px; }
.op-wdl-eq { color: var(--muted); }
@media (max-width: 899px) {
  /* On a phone an opening is two lines: its name and games, then White's score beside the result bar and counts.
     The two labels stay for a screen reader; the score says whose it is in words. */
  .opcard .dc-facts { display: flex; align-items: center; gap: 10px; }
  .opcard .dc-f:first-child { flex: none; } .opcard .opcard-res { flex: 1; }
  .opcard .dc-f dt { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .opcard .dc-f:first-child dd::after { content: " for White"; font: 500 13px/1 var(--sans); color: var(--muted); }
  .opcard .dc-f:first-child dd:has(.muted)::after { content: none; }
}
@media (max-width: 899.98px) { .opcard-none { display: none; } }
@media (min-width: 900px) {
  .dcards--openings { --dc-cols: minmax(0, 1.4fr) 104px 76px 104px minmax(0, 1.3fr); }
  .dcards--openings .opcard-main { display: contents; }
  .dcards--openings .dcard-key small, .dcards--tally .dcard-key small { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .op-wdl { flex-wrap: nowrap; }
  .op-wdl-n { grid-template-columns: repeat(3, 54px); justify-items: start; gap: 0; }
}
/* An opening's page: the lines played and the players who play it are tallies, a name beside its game count. */
.dcards--tally .dcard { grid-template-columns: minmax(0, 1fr) auto; padding-block: 9px; }
.dcards--tally .dcard-main { font-size: 15px; overflow-wrap: anywhere; }
.dcards--tally .dcard-key { font-size: 22px; }
@media (min-width: 900px) { .dcards--tally { --dc-cols: minmax(0, 1fr) 64px; } }

/* === turning-point-graph === */
/* Advantage chart between the result and the move list, inside the always-dark stage. The SVG is stretched to its box (viewBox = plies × 100),
   so strokes do not scale and dots are zero-length round-capped lines. The plot is split like an evaluation bar laid on its side: the bone
   area rising from the bottom is White's expected score and the black area above it is Black's, each marked by its king on a board square.
   Volt marks decisive mistakes; the playhead inverts whatever is under it. */
.gm-tp { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.gm-tp-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.gm-tp-sub { font: 400 14px/1.4 var(--mono); color: var(--muted); }
.gm-tp-chart { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
.gm-tp-plot { position: relative; min-width: 0; padding-block: 6px; border-radius: 4px; }  /* Room for dots at 0% and 100%. */
.gm-tp-side { position: absolute; left: 6px; width: 24px; height: 24px; border-radius: 4px; pointer-events: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.gm-tp-side--b { top: 12px; background: var(--sq-light); }
.gm-tp-side--w { bottom: 12px; background: var(--sq-dark); }
.js .gm-tp-plot { cursor: pointer; }
.gm-tp-svg { width: 100%; height: 140px; overflow: visible; }
.gm-tp-x { display: flex; justify-content: space-between; font: 400 14px/1 var(--mono); color: var(--muted); }
.gm-tp-svg * { vector-effect: non-scaling-stroke; }
.gm-tp-svg { outline: 1px solid var(--line-2); outline-offset: 0; }
.gm-tp-bg { fill: #050506; }
.gm-tp-area { fill: var(--sq-light); }
.gm-tp-mid { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.gm-tp-line { fill: none; stroke: var(--muted); stroke-width: 1; stroke-linejoin: round; }
.gm-tp-drop { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.gm-tp-ring, .gm-tp-ring-in, .gm-tp-dot { stroke-linecap: round; }
.gm-tp-ring { stroke: var(--accent); stroke-width: 11; }
.gm-tp-ring-in { stroke: var(--on-accent); stroke-width: 5; }
.gm-tp-now { stroke: #fff; stroke-width: 1.5; mix-blend-mode: difference; }
.gm-tp-dot--out { stroke: var(--on-accent); stroke-width: 13; }
.gm-tp-dot--in { stroke: var(--text); stroke-width: 8; }
.gm-tp-dot.is-off { display: none; }
.gm-tp-list { display: flex; flex-wrap: wrap; gap: 6px; }
.gm-tp-mark { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px 0 10px; border: 1px solid var(--line-2); border-radius: 999px; background: transparent; font: 400 14px/1 var(--mono); color: var(--text-2); cursor: pointer; }
.gm-tp-mark:hover { background: var(--surface-2); }
.gm-tp-mark.is-current { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.gm-tp-san { font-weight: 600; font-size: 14px; color: inherit; }
.gm-tp-mark:not(.is-current) .gm-tp-san { color: var(--text); }
.gm-tp-mark::before, .move.gm-tp-hit::after, .gm-tp-key { content: ""; display: inline-block; flex: none; width: 9px; height: 9px; border: 2.5px solid var(--accent-text); border-radius: 50%; }
.gm-tp-mark.is-current::before, .move.gm-tp-hit.is-current::after { border-color: currentColor; }
.move.gm-tp-hit::after { margin-left: 6px; vertical-align: 1px; }
.gm-tp-key { margin-right: 6px; vertical-align: -1px; }
.gm-tp-note { font-size: 14px; line-height: 1.45; color: var(--muted); }
@media (max-width: 520px) { .gm-tp-svg { height: 112px; } }
@media (pointer: coarse) { .gm-tp-mark { min-height: 40px; } }
/* === end turning-point-graph === */

/* What happened (game.html story_panel): the reviewed story about this game, with a button to its key move. */
.gm-story { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 16px; border: 1.5px solid var(--line-2); border-left: 6px solid var(--accent); border-radius: var(--r-sm); background: var(--surface); }
.gm-story-head { font: 800 semi-condensed clamp(21px, 1.8vw, 26px)/1.08 var(--display); overflow-wrap: anywhere; }
.gm-story-why { font-size: 15px; line-height: 1.45; color: var(--text-2); }
.gm-story .btn { white-space: normal; text-align: center; }
