    :root {
      color-scheme: dark;
      /* ======================================================================
         Chess Gym design tokens — SPEC: US-28 AC 2, D-195 §Decision 1.
         One palette for the whole product: warm obsidian or ivory surfaces, a
         petrol-teal accent for actions that never doubles as move feedback, and
         tournament green for board and evaluation success.

         This block began as a frozen Penpot export (`docs/design/penpot/tokens.json`)
         under D-198/D-200/D-208. It is code-owned now: no script regenerates it,
         there is no `--write` or drift check, and a colour change is a hand edit
         reviewed like code. The petrol action role and the light-theme values are
         deliberate amendments to that historical snapshot.

         Everything outside the markers is hand-written: colour-channel
         triples (so a tint derives from the same value, e.g.
         `rgba(var(--gym-brand-accent-rgb), 0.15)`), the 20 % badge tints, the
         lightened `-text` variants, and the reconstructed names F-1 found
         referenced but never declared.
         ====================================================================== */

      /* ----- Frozen snapshot of the Penpot export (D-198, D-200; D-208) ----- */
      /* BEGIN GENERATED TOKENS — frozen snapshot rendered once from the Penpot export (D-198, D-200), frozen by D-208; do not regenerate */
      /* Chess Gym · core */
      --gym-bg-app: #141312;
      --gym-bg-surface: #1c1a18;
      --gym-bg-card: #262421;
      --gym-bg-card-hover: #2f2c28;
      --gym-bg-input: #181715;
      --gym-border-subtle: rgba(255, 255, 255, 0.08);
      --gym-border-card: #33302c;
      --gym-border-focus: rgba(34, 166, 195, 0.55);
      --gym-brand-accent: #0e7490;
      --gym-brand-accent-hover: #155e75;
      --gym-brand-accent-active: #0b556b;
      --gym-brand-glow: rgba(14, 116, 144, 0.25);
      --gym-chess-green: #7fa650;
      --gym-chess-green-hover: #6f9444;
      --gym-eval-brilliant: #1eb8b0;
      --gym-eval-best: #7fa650;
      --gym-eval-book: #d4973b;
      --gym-eval-inaccuracy: #e5b022;
      --gym-eval-mistake: #f07822;
      --gym-eval-blunder: #e03e3e;
      --gym-eval-blunder-small: #f47878;
      --gym-text-main: #f5f2eb;
      --gym-text-muted: #a39f99;
      --gym-text-dim: #918c84;
      /* Chess Gym · proposed (needs review) */
      --gym-bg-panel: #171614;
      --gym-bg-active-row: #2b2823;
      --gym-board-light: #f0d9b5;
      --gym-board-dark: #b58863;
      --gym-board-frame: #2a2723;
      --gym-overlay-blunder: #e03e3e;
      --gym-overlay-solution: #7fa650;
      /* END GENERATED TOKENS */

      /* ----- Derived: channel triples, tints and text variants ----- */
      --gym-bg-app-rgb: 20, 19, 18;
      --gym-bg-surface-rgb: 28, 26, 24;
      --gym-bg-card-rgb: 38, 36, 33;
      --gym-brand-accent-rgb: 14, 116, 144;
      --gym-brand-accent-fg: #22a6c3;
      --gym-brand-accent-fg-rgb: 34, 166, 195;
      --gym-brand-ink: #fffdf8; /* label on the solid petrol fill: 5.27:1 */
      --gym-focus-ring: #22a6c3;
      --gym-chess-green-rgb: 127, 166, 80;
      --gym-text-main-rgb: 245, 242, 235;
      --gym-text-muted-rgb: 163, 159, 153;

      /* Tactical-quality tiers: each carries its channel triple (borders and
         fills at any alpha), its 20 % tint (the badge background) and a
         lightened `-text` that stays legible on that tint (the solid tier
         colour is a fill, not body text: blunder at #e03e3e on its own tint
         measures 2.99:1). */
      --gym-eval-brilliant-rgb: 30, 184, 176;
      --gym-eval-brilliant-bg: rgba(30, 184, 176, 0.2);
      --gym-eval-brilliant-text: #5fd9d3;
      --gym-eval-best-rgb: 127, 166, 80;
      --gym-eval-best-bg: rgba(127, 166, 80, 0.2);
      --gym-eval-best-text: #a6cc7f;
      --gym-eval-book-rgb: 212, 151, 59;
      --gym-eval-book-bg: rgba(212, 151, 59, 0.2);
      --gym-eval-book-text: #e8bb77;
      --gym-eval-inaccuracy-rgb: 229, 176, 34;
      --gym-eval-inaccuracy-bg: rgba(229, 176, 34, 0.2);
      --gym-eval-inaccuracy-text: #f2cf5c;
      --gym-eval-mistake-rgb: 240, 120, 34;
      --gym-eval-mistake-bg: rgba(240, 120, 34, 0.2);
      --gym-eval-mistake-text: #f7a06a;
      --gym-eval-blunder-rgb: 224, 62, 62;
      --gym-eval-blunder-bg: rgba(224, 62, 62, 0.2);
      --gym-eval-blunder-text: #f47878;

      /* Rank medals in the weakness table — warm chips on the dark surface
         (gold 6.61:1, silver 8.55:1, bronze 6.38:1 for their ink) */
      --gym-medal-gold: #f2e2a0;
      --gym-medal-gold-ink: #5c4a12;
      --gym-medal-silver: #d9d5cd;
      --gym-medal-silver-ink: #38332c;
      --gym-medal-bronze: #efd0b0;
      --gym-medal-bronze-ink: #6b3a1a;

      /* Reconstructed names (F-1): the Progress screen used them before the
         sheet declared them. The design draws the Progress cards at radius 8
         with the secondary text grey, and its chart accent is the brand petrol,
         so the three resolve to exactly that and never to a legacy value. */
      --gym-accent: var(--gym-brand-accent);
      --gym-text-secondary: var(--gym-text-muted);
      --gym-radius-md: 8px;

      /* Neutral alphas and the board's annotation scrim (US-28 AC 2): the
         component layer draws no one-off white/black literal and no legacy
         slate scrim; every neutral strength has one name. */
      --gym-border-strong: rgba(255, 255, 255, 0.2);
      --gym-border-selected: rgba(255, 255, 255, 0.42);
      --gym-border-hover: rgba(255, 255, 255, 0.18);
      --gym-hairline: rgba(255, 255, 255, 0.06);
      --gym-hairline-faint: rgba(255, 255, 255, 0.04);
      --gym-row-hover: rgba(255, 255, 255, 0.02);
      --gym-chip-bg: rgba(255, 255, 255, 0.05);
      --gym-promotion-cell: rgba(255, 255, 255, 0.92);
      --gym-board-scrim: var(--gym-bg-app);
      --gym-overlay-scrim: rgba(0, 0, 0, 0.72);
      --gym-shadow-raised: 0 4px 16px rgba(0, 0, 0, 0.4);
      --gym-shadow-overlay: 0 8px 24px rgba(0, 0, 0, 0.6);

      /* SPEC: US-33: the multi-stream chart's data-only categorical palette.
         Okabe-Ito colour-blind-safe subset; each measured against the page
         plane (#141312) at 8.04, 6.06, 5.42 and 8.24:1. Never a brand, action
         or quality role, and the legend plus stroke pattern carries identity. */
      --gym-chart-series-1: #56b4e9;
      --gym-chart-series-2: #cc79a7;
      --gym-chart-series-3: #009e73;
      --gym-chart-series-4: #e69f00;

      /* Typography, radii and depth */
      --font-family: "Inter var", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
      --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      --radius-sm: 0.375rem;
      --radius-md: 0.5rem;
      --radius-lg: 0.75rem;
      --radius-full: 9999px;
      --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);

      /* Transition alias (US-28 AC 2): `client/analysis_view.re` paints one
         inline SVG with this name, and client markup belongs to DR-3. It is the
         brand accent, not the retired blue, and no rule in this sheet uses it. */
      --color-primary: var(--gym-brand-accent);

      /* Code-owned scale tokens (the working direction makes the code the
         design source; the Penpot colour block above stays frozen). */
      --gym-space-1: 4px;
      --gym-space-2: 8px;
      --gym-space-3: 12px;
      --gym-space-4: 16px;
      --gym-space-5: 24px;
      --gym-space-6: 32px;
      --gym-space-7: 48px;
      --gym-space-8: 64px;
      --gym-text-xs: 0.75rem;
      --gym-text-sm: 0.875rem;
      --gym-text-base: 1rem;
      --gym-text-lg: 1.25rem;
      --gym-text-xl: 1.75rem;
      --gym-text-2xl: 2.5rem;
      --gym-radius-control: 6px;
      --gym-radius-chip: 4px;
    }

    /* Warm-ivory light theme. The role names stay identical; only their values
       change. `client/theme.re` sets this attribute from the stored preference
       or the operating system before React mounts. */
    [data-theme="light"] {
      color-scheme: light;
      --gym-bg-app: #f7f4ed;
      --gym-bg-surface: #fffdf8;
      --gym-bg-card: #fffdf8;
      --gym-bg-card-hover: #f0ebe1;
      --gym-bg-input: #fffdf8;
      --gym-border-subtle: rgba(28, 25, 20, 0.12);
      --gym-border-card: #d8d1c5;
      --gym-border-focus: rgba(14, 116, 144, 0.55);
      --gym-brand-accent-fg: #0e7490;
      --gym-focus-ring: #0e7490;
      --gym-chess-green: #4f7629;
      --gym-chess-green-hover: #3f641f;
      --gym-eval-blunder-small: #b42323;
      --gym-text-main: #24211d;
      --gym-text-muted: #5f594f;
      --gym-text-dim: #6b655b;
      --gym-bg-panel: #f0ebe1;
      --gym-bg-active-row: #eae3d6;
      --gym-board-frame: #d8cdbb;
      --gym-bg-app-rgb: 247, 244, 237;
      --gym-bg-surface-rgb: 255, 253, 248;
      --gym-bg-card-rgb: 255, 253, 248;
      --gym-brand-accent-fg-rgb: 14, 116, 144;
      --gym-chess-green-rgb: 79, 118, 41;
      --gym-text-main-rgb: 36, 33, 29;
      --gym-text-muted-rgb: 95, 89, 79;
      --gym-eval-brilliant-text: #006c67;
      --gym-eval-best-text: #3f641f;
      --gym-eval-book-text: #7a4b00;
      --gym-eval-inaccuracy-text: #7a5900;
      --gym-eval-mistake-text: #9a3d00;
      --gym-eval-blunder-text: #b42323;
      --gym-border-strong: rgba(28, 25, 20, 0.28);
      --gym-border-selected: #756e62;
      --gym-border-hover: rgba(28, 25, 20, 0.22);
      --gym-hairline: rgba(28, 25, 20, 0.08);
      --gym-hairline-faint: rgba(28, 25, 20, 0.05);
      --gym-row-hover: rgba(28, 25, 20, 0.035);
      --gym-chip-bg: rgba(28, 25, 20, 0.055);
      --gym-shadow-raised: 0 4px 16px rgba(45, 37, 25, 0.12);
      --gym-shadow-overlay: 0 8px 24px rgba(45, 37, 25, 0.18);
      --shadow-card: 0 4px 6px -1px rgba(45, 37, 25, 0.12), 0 2px 4px -2px rgba(45, 37, 25, 0.08);
      --gym-chart-series-1: #0075b3;
      --gym-chart-series-2: #b44883;
      --gym-chart-series-3: #007a5e;
      --gym-chart-series-4: #9a6800;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    html {
      scrollbar-color: var(--gym-border-strong) var(--gym-bg-app);
    }

    body {
      font-family: var(--font-family);
      background-color: var(--gym-bg-app);
      color: var(--gym-text-main);
      line-height: 1.5;
      min-height: 100vh;
      padding: 2rem 0;
      caret-color: var(--gym-text-main);
    }

    ::selection {
      background: rgba(var(--gym-brand-accent-rgb), 0.28);
      color: var(--gym-text-main);
    }

    a {
      text-underline-offset: 0.18em;
    }

    /* Self-hosted Inter variable font (latin subset, SIL OFL 1.1 in
       assets/fonts/INTER-LICENSE.txt). Declared after :root so :root stays the
       first stylesheet rule. */
    @font-face {
      font-family: "Inter var";
      src: url("/fonts/inter-var-latin.woff2") format("woff2");
      font-weight: 100 900;
      font-style: normal;
      font-display: swap;
    }

    /* SPEC: US-28 AC 4: one 1520px container with the design's responsive
       gutters (32px, 24px ≤1200, 16px ≤767). `box-sizing: border-box` keeps the
       gutters inside the 1520px cap. */
    .app-container {
      width: 100%;
      max-width: 1520px;
      box-sizing: border-box;
      margin: 0 auto;
      padding: 0 32px;
    }

    @media (max-width: 1200px) {
      .app-container {
        padding: 0 24px;
      }
    }

    @media (max-width: 767px) {
      .app-container {
        padding: 0 16px;
      }
    }

    /* SPEC: US-28 AC 1 / component-specs.md §1: one shell bar holding the
       brand, the three destinations and the account cluster. */
    .app-header {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 1rem;
      margin-bottom: 1.5rem;
      padding: 0.75rem 1.25rem;
      background: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--gym-radius-md);
    }

    .header-brand {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .brand-icon {
      font-size: var(--gym-text-xl);
      line-height: 1;
      color: var(--gym-brand-accent-fg);
    }

    /* D-T2 / SPEC: US-28 AC 1: the exported SVG icons. Each call site passes
       the design's drawn size through `~size`, so these rules align the icon
       with its label and never scale it with the font. */
    .gym-icon {
      display: inline-block;
      vertical-align: -0.15em;
      flex: none;
    }

    .brand-icon .gym-icon,
    .control-bar-button .gym-icon {
      display: block;
    }

    .control-bar-flip .gym-icon {
      margin-right: 0.3rem;
    }

    /* SPEC: US-28 AC 7 / D-205: the analysis game stepper and the clean badge
       draw exported icons beside their visible labels with the export's
       spacing; the controls themselves keep their drawn geometry. */
    .gym-step-arrow-btn .gym-icon {
      margin-right: 0.25rem;
    }

    .gym-step-arrow-btn .gym-icon:last-child {
      margin-right: 0;
      margin-left: 0.25rem;
    }

    .gym-clean-badge .gym-icon {
      margin-left: 0.25rem;
    }

    .gym-eval-badge .gym-icon {
      margin-right: 0.3rem;
    }

    .gym-srs-clean .gym-icon {
      margin-left: 0.25rem;
    }

    .brand-text h1 {
      font-size: var(--gym-text-lg);
      font-weight: 800;
      line-height: 1.15;
      letter-spacing: 0.066em;
    }

    .brand-subtitle {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      line-height: 1.3;
      text-transform: uppercase;
      letter-spacing: 0.056em;
    }

    .server-status-pill {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.375rem 0.875rem;
      border-radius: var(--radius-full);
      background-color: rgba(var(--gym-bg-card-rgb), 0.8);
      border: 1px solid var(--gym-border-card);
      font-size: var(--gym-text-xs);
      font-weight: 500;
    }

    .status-dot {
      width: 0.625rem;
      height: 0.625rem;
      border-radius: var(--radius-full);
      transition: background-color 0.2s ease, box-shadow 0.2s ease;
    }

    .status-idle { background-color: var(--gym-chess-green); box-shadow: 0 0 6px rgba(var(--gym-chess-green-rgb), 0.5); }
    /* SPEC: US-28 AC 2 / DESIGN §Tokens: a status dot is neutral by default;
       green is a result/evaluation role, never health. */
    .status-neutral { background-color: var(--gym-text-muted); }
    .status-running { background-color: var(--gym-eval-inaccuracy); box-shadow: 0 0 6px rgba(var(--gym-eval-inaccuracy-rgb), 0.5); }
    .status-error { background-color: var(--gym-eval-blunder); box-shadow: 0 0 6px rgba(var(--gym-eval-blunder-rgb), 0.5); }

    /* Cards */
    .card {
      background-color: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-lg);
      padding: 1.5rem;
      box-shadow: var(--shadow-card);
      margin-bottom: 1.75rem;
    }

    .card-title {
      font-size: var(--gym-text-lg);
      font-weight: 600;
      margin-bottom: 0.25rem;
      color: var(--gym-text-main);
    }

    .card-subtitle {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      margin-bottom: 1.25rem;
    }

    .card-header-flex {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 1.25rem;
      flex-wrap: wrap;
      gap: 0.75rem;
    }

    /* Form Layout */
    .form-row-grid {
      display: grid;
      grid-template-columns: 2fr 1.5fr 1.5fr;
      gap: 1.25rem;
      margin-bottom: 1.25rem;
    }

    @media (max-width: 820px) {
      .form-row-grid { grid-template-columns: 1fr; }
    }

    .form-group {
      display: flex;
      flex-direction: column;
      gap: 0.375rem;
    }

    .form-label {
      font-size: var(--gym-text-sm);
      font-weight: 500;
      color: var(--gym-text-main);
    }

    .required { color: var(--gym-eval-blunder-small); }

    .form-control {
      background-color: var(--gym-bg-input);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      color: var(--gym-text-main);
      padding: 0.625rem 0.875rem;
      font-size: var(--gym-text-sm);
      transition: border-color 0.2s, box-shadow 0.2s;
    }

    .form-control:focus {
      border-color: var(--gym-border-focus);
      box-shadow: 0 0 0 3px rgba(var(--gym-brand-accent-rgb), 0.25);
    }

    .form-control.is-invalid {
      border-color: var(--gym-eval-blunder);
      box-shadow: 0 0 0 3px rgba(var(--gym-eval-blunder-rgb), 0.25);
    }

    .form-feedback {
      font-size: var(--gym-text-xs);
      color: var(--gym-eval-blunder-small);
      min-height: 1rem;
    }

    .form-hint {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-dim);
    }

    /* Platform Radio Control */
    .platform-segmented-control {
      display: flex;
      gap: 0.5rem;
    }

    .platform-option {
      flex: 1;
      cursor: pointer;
    }

    .platform-option input {
      position: absolute;
      opacity: 0;
      width: 0;
      height: 0;
    }

    .platform-box {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
      background-color: var(--gym-bg-input);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      padding: 0.625rem 0.75rem;
      font-size: var(--gym-text-sm);
      font-weight: 500;
      transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
      user-select: none;
    }

    .platform-option input:checked + .platform-box {
      border-color: var(--gym-brand-accent-fg);
      background-color: rgba(var(--gym-brand-accent-rgb), 0.15);
      color: var(--gym-brand-accent-fg);
    }

    /* Tuning Grid */
    .tuning-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 1.25rem;
      margin-bottom: 1.25rem;
    }

    @media (max-width: 640px) {
      .tuning-grid { grid-template-columns: 1fr; }
    }

    /* Presets */
    .presets-row {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 1.5rem;
      flex-wrap: wrap;
    }

    .presets-label {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-dim);
      font-weight: 500;
    }

    .btn-preset {
      background: none;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-full);
      color: var(--gym-text-muted);
      padding: 0.25rem 0.75rem;
      font-size: var(--gym-text-xs);
      cursor: pointer;
      transition: color 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    }

    .btn-preset:hover {
      border-color: var(--gym-border-card);
      color: var(--gym-text-main);
      background-color: var(--gym-bg-card-hover);
    }

    .btn-preset.active {
      border-color: var(--gym-brand-accent-fg);
      color: var(--gym-brand-accent-fg);
      background-color: rgba(var(--gym-brand-accent-rgb), 0.12);
    }

    /* Buttons */
    .form-actions {
      display: flex;
      gap: 0.75rem;
      align-items: center;
    }

    /* A `.btn` is never the browser's native control: it takes the app font and
       the neutral (secondary) surface by default. A filled variant must name
       itself (`.btn-primary`, the one accent action per screen). */
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
      padding: 0.625rem 1.25rem;
      border-radius: var(--radius-md);
      font-family: inherit;
      text-decoration: none;
      font-size: var(--gym-text-sm);
      font-weight: 600;
      cursor: pointer;
      transition: color 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
      border: 1px solid var(--gym-border-card);
      background-color: transparent;
      color: var(--gym-text-muted);
    }

    .btn:disabled {
      cursor: not-allowed;
      opacity: 0.6;
    }

    .btn-primary {
      background-color: var(--gym-brand-accent);
      border-color: var(--gym-brand-accent-fg);
      color: var(--gym-brand-ink);
    }

    .btn-primary:hover:not(:disabled) {
      background-color: var(--gym-brand-accent-hover);
    }

    .btn-secondary {
      background-color: transparent;
      border: 1px solid var(--gym-border-card);
      color: var(--gym-text-muted);
    }

    .btn-secondary:hover:not(:disabled) {
      background-color: var(--gym-bg-card-hover);
      color: var(--gym-text-main);
    }

    .btn-sm {
      padding: 0.25rem 0.625rem;
      font-size: var(--gym-text-xs);
    }

    .btn:disabled {
      opacity: 0.6;
      cursor: not-allowed;
    }

    /* Progress & Status Card */
    .progress-card {
      background: linear-gradient(135deg, rgba(var(--gym-bg-card-rgb), 0.95), rgba(var(--gym-bg-app-rgb), 0.95));
      border: 1px solid rgba(var(--gym-brand-accent-rgb), 0.3);
    }

    .progress-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 0.5rem;
    }

    .progress-title-wrapper {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .progress-title {
      font-size: var(--gym-text-lg);
      font-weight: 600;
    }

    /* Restored by W-4 rework: the analysis page's puzzle-build panel still
       binds these (client/analysis_view.re:1223/1229/1237), so they are not
       progress-only and must stay. */
    .progress-description {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      margin-bottom: 1rem;
    }

    .progress-bar-track {
      width: 100%;
      height: 6px;
      background-color: var(--gym-bg-input);
      border-radius: var(--radius-full);
      overflow: hidden;
      margin-bottom: 1rem;
    }

    .spinner-circle {
      display: inline-block;
      width: 1.125rem;
      height: 1.125rem;
      border: 2px solid rgba(var(--gym-brand-accent-rgb), 0.3);
      border-top-color: var(--gym-brand-accent-fg);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    /* The analysis page's error band carries `alert alert-error`; the scoped
       `.analysis-page .alert` rule supplies its layout, and this rule supplies
       the error paint from tokens (W-4b: it was bound with no selector). */
    .alert-error {
      background-color: rgba(var(--gym-eval-blunder-rgb), 0.12);
      border: 1px solid rgba(var(--gym-eval-blunder-rgb), 0.35);
      color: var(--gym-eval-blunder-text);
    }

    .alert-message {
      font-size: var(--gym-text-sm);
    }

    /* Weakness Table */
    .badge-counter {
      font-size: var(--gym-text-xs);
      background-color: var(--gym-bg-input);
      border: 1px solid var(--gym-border-card);
      padding: 0.25rem 0.625rem;
      border-radius: var(--radius-full);
      color: var(--gym-text-muted);
    }

    .rank-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 1.75rem;
      height: 1.75rem;
      border-radius: 50%;
      font-size: var(--gym-text-xs);
      font-weight: 700;
      background-color: var(--gym-bg-input);
      color: var(--gym-text-muted);
    }

    .rank-1 { background-color: var(--gym-medal-gold); color: var(--gym-medal-gold-ink); }
    .rank-2 { background-color: var(--gym-medal-silver); color: var(--gym-medal-silver-ink); }
    .rank-3 { background-color: var(--gym-medal-bronze); color: var(--gym-medal-bronze-ink); }

    .theme-title-wrapper {
      display: flex;
      flex-direction: column;
      gap: 0.125rem;
    }

    .theme-name {
      font-weight: 600;
      color: var(--gym-text-main);
    }

    .theme-code {
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
      color: var(--gym-text-dim);
    }

    .blunder-count-pill {
      display: inline-block;
      padding: 0.2rem 0.5rem;
      border-radius: var(--radius-full);
      background-color: rgba(var(--gym-eval-blunder-rgb), 0.15);
      color: var(--gym-eval-blunder-text);
      font-weight: 700;
      font-size: var(--gym-text-xs);
    }

    .freq-cell-wrapper {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .freq-pct-text {
      width: 3.5rem;
      font-weight: 600;
      font-size: var(--gym-text-xs);
    }

    .freq-bar-bg {
      flex: 1;
      height: 6px;
      background-color: var(--gym-bg-input);
      border-radius: var(--radius-full);
      overflow: hidden;
      min-width: 60px;
    }

    .freq-bar-fill {
      height: 100%;
      background: linear-gradient(90deg, var(--gym-brand-accent-active), var(--gym-brand-accent-fg));
      border-radius: var(--radius-full);
    }

    .delta-badge {
      display: inline-block;
      padding: 0.2rem 0.5rem;
      border-radius: var(--radius-sm);
      font-weight: 600;
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
    }

    .delta-severe { background-color: rgba(var(--gym-eval-blunder-rgb), 0.2); color: var(--gym-eval-blunder-text); }
    .delta-moderate { background-color: rgba(var(--gym-eval-mistake-rgb), 0.2); color: var(--gym-eval-mistake-text); }
    .delta-mild { background-color: rgba(var(--gym-eval-inaccuracy-rgb), 0.2); color: var(--gym-eval-inaccuracy-text); }

    .btn-training {
      display: inline-flex;
      align-items: center;
      gap: 0.375rem;
      padding: 0.375rem 0.75rem;
      border-radius: var(--radius-md);
      background-color: rgba(var(--gym-brand-accent-rgb), 0.15);
      border: 1px solid rgba(var(--gym-brand-accent-rgb), 0.3);
      color: var(--gym-brand-accent-fg);
      text-decoration: none;
      font-size: var(--gym-text-xs);
      font-weight: 600;
      transition: color 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
      white-space: nowrap;
    }

    .btn-training:hover {
      background-color: var(--gym-brand-accent);
      color: var(--gym-brand-ink);
      border-color: var(--gym-brand-accent-fg);
    }

    /* Empty state */
    .empty-state {
      text-align: center;
      padding: 2.5rem 1rem;
    }

    .empty-icon { font-size: var(--gym-text-2xl); margin-bottom: 0.75rem; }
    .empty-title { font-size: var(--gym-text-lg); font-weight: 600; margin-bottom: 0.25rem; }
    .empty-desc { color: var(--gym-text-muted); font-size: var(--gym-text-sm); }

    /* Per-Game Breakdown & Accordion */
    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 1rem;
      margin-bottom: 1.25rem;
      padding-bottom: 0.75rem;
      border-bottom: 1px solid var(--gym-border-card);
    }

    .section-title-wrapper {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .section-title {
      font-size: var(--gym-text-lg);
      font-weight: 700;
      margin: 0;
      color: var(--gym-text-main);
    }

    .section-controls {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      flex-wrap: wrap;
    }

    .control-toggle {
      display: flex;
      align-items: center;
      gap: 0.375rem;
      font-size: var(--gym-text-sm);
      color: var(--gym-text-muted);
      cursor: pointer;
      user-select: none;
    }

    .accordion-list {
      display: flex;
      flex-direction: column;
      gap: 0.875rem;
    }

    .game-accordion-item {
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      background-color: var(--gym-bg-card);
      overflow: hidden;
      transition: box-shadow 0.15s ease, border-color 0.15s ease;
    }

    .game-accordion-item[open] {
      box-shadow: var(--shadow-card);
      border-color: var(--gym-border-focus);
    }

    .game-summary {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0.875rem 1.25rem;
      background-color: var(--gym-bg-card);
      cursor: pointer;
      user-select: none;
      list-style: none;
      gap: 1rem;
      flex-wrap: wrap;
    }

    .game-summary::-webkit-details-marker { display: none; }

    .game-summary:hover {
      background-color: var(--gym-bg-card-hover);
    }

    .summary-left {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.625rem;
      font-size: var(--gym-text-sm);
      font-weight: 600;
    }

    .player-tag {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
    }

    .elo-tag {
      font-weight: 400;
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
    }

    .vs-text {
      font-size: var(--gym-text-xs);
      font-weight: 400;
      color: var(--gym-text-dim);
      text-transform: uppercase;
    }

    .summary-badges {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.5rem;
    }

    .badge {
      display: inline-flex;
      align-items: center;
      padding: 0.2rem 0.5rem;
      border-radius: 0.25rem;
      font-size: var(--gym-text-xs);
      font-weight: 600;
      line-height: 1;
    }

    .badge-neutral {
      background-color: var(--gym-bg-input);
      color: var(--gym-text-muted);
      border: 1px solid var(--gym-border-card);
    }

    .badge-platform {
      background-color: rgba(var(--gym-brand-accent-rgb), 0.15);
      color: var(--gym-brand-accent-fg);
      border: 1px solid rgba(var(--gym-brand-accent-rgb), 0.3);
    }

    .badge-platform-chesscom {
      background-color: rgba(var(--gym-chess-green-rgb), 0.15);
      color: var(--gym-eval-best-text);
      border: 1px solid rgba(var(--gym-chess-green-rgb), 0.3);
    }

    .badge-user-white {
      background-color: var(--gym-text-main);
      color: var(--gym-bg-input);
      border: 1px solid var(--gym-border-card);
    }

    .badge-user-black {
      background-color: var(--gym-bg-input);
      color: var(--gym-text-main);
      border: 1px solid var(--gym-border-card);
    }

    .badge-blunder-count {
      background-color: rgba(var(--gym-eval-blunder-rgb), 0.15);
      color: var(--gym-eval-blunder-text);
      border: 1px solid rgba(var(--gym-eval-blunder-rgb), 0.35);
    }

    .badge-clean-game {
      background-color: rgba(var(--gym-chess-green-rgb), 0.15);
      color: var(--gym-eval-best-text);
      border: 1px solid rgba(var(--gym-chess-green-rgb), 0.35);
    }

    .summary-right {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .link-game-ext {
      color: var(--gym-brand-accent-fg);
      text-decoration: none;
      font-size: var(--gym-text-xs);
      font-weight: 500;
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
    }

    .link-game-ext:hover {
      text-decoration: underline;
    }

    .accordion-chevron {
      width: 1.25rem;
      height: 1.25rem;
      color: var(--gym-text-muted);
      transition: transform 0.2s ease-in-out;
    }

    .game-accordion-item[open] .accordion-chevron {
      transform: rotate(180deg);
    }

    .game-content {
      padding: 1.25rem;
      border-top: 1px solid var(--gym-border-card);
      background-color: var(--gym-bg-input);
    }

    .clean-game-banner {
      display: flex;
      align-items: center;
      gap: 1rem;
      padding: 1rem 1.25rem;
      background-color: rgba(var(--gym-chess-green-rgb), 0.08);
      border: 1px solid rgba(var(--gym-chess-green-rgb), 0.25);
      border-radius: var(--radius-md);
      color: var(--gym-eval-best-text);
    }

    .clean-game-banner h4 {
      font-size: var(--gym-text-sm);
      font-weight: 600;
      margin-bottom: 0.125rem;
    }

    .clean-game-banner p {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
    }

    /* Blunder Card */
    .blunder-cards-list {
      display: flex;
      flex-direction: column;
      gap: 1.25rem;
    }

    .blunder-card {
      background-color: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      padding: 1.25rem;
      box-shadow: var(--shadow-card);
    }

    .blunder-card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.75rem;
      margin-bottom: 1rem;
      padding-bottom: 0.625rem;
      border-bottom: 1px solid var(--gym-border-card);
    }

    .blunder-card-title {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-size: var(--gym-text-sm);
      font-weight: 600;
    }

    .badge-phase {
      background-color: var(--gym-bg-input);
      color: var(--gym-text-muted);
      border: 1px solid var(--gym-border-card);
      text-transform: capitalize;
    }

    .badge-eval-critical {
      background-color: rgba(var(--gym-eval-blunder-rgb), 0.2);
      color: var(--gym-eval-blunder-text);
      border: 1px solid rgba(var(--gym-eval-blunder-rgb), 0.4);
    }

    .badge-eval-severe {
      background-color: rgba(var(--gym-eval-mistake-rgb), 0.2);
      color: var(--gym-eval-mistake-text);
      border: 1px solid rgba(var(--gym-eval-mistake-rgb), 0.4);
    }

    .badge-eval-moderate {
      background-color: rgba(var(--gym-eval-inaccuracy-rgb), 0.2);
      color: var(--gym-eval-inaccuracy-text);
      border: 1px solid rgba(var(--gym-eval-inaccuracy-rgb), 0.4);
    }

    .move-comparison-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 1rem;
      margin-bottom: 1rem;
    }

    @media (max-width: 600px) {
      .move-comparison-grid { grid-template-columns: 1fr; }
    }

    .move-tile {
      padding: 0.75rem 1rem;
      border-radius: var(--radius-md);
      border: 1px solid var(--gym-border-card);
      background-color: var(--gym-bg-input);
    }

    .move-tile-blunder {
      border-color: rgba(var(--gym-eval-blunder-rgb), 0.35);
      background-color: rgba(var(--gym-eval-blunder-rgb), 0.05);
    }

    .move-tile-best {
      border-color: rgba(var(--gym-chess-green-rgb), 0.35);
      background-color: rgba(var(--gym-chess-green-rgb), 0.05);
    }

    .move-tile-label {
      font-size: var(--gym-text-xs);
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 0.25rem;
    }

    .move-tile-blunder .move-tile-label { color: var(--gym-eval-blunder-text); }
    .move-tile-best .move-tile-label { color: var(--gym-eval-best-text); }

    .move-tile-value {
      font-family: var(--font-mono);
      font-size: var(--gym-text-lg);
      font-weight: 700;
      display: block;
      margin-bottom: 0.25rem;
    }

    .move-tile-subtext {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
    }

    .blunder-themes-row {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.5rem;
      margin-bottom: 1rem;
    }

    .themes-label {
      font-size: var(--gym-text-xs);
      font-weight: 600;
      color: var(--gym-text-muted);
    }

    .theme-chip {
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      padding: 0.2rem 0.55rem;
      border-radius: var(--radius-full);
      background-color: rgba(var(--gym-brand-accent-rgb), 0.15);
      border: 1px solid rgba(var(--gym-brand-accent-rgb), 0.3);
      color: var(--gym-brand-accent-fg);
      font-size: var(--gym-text-xs);
      font-weight: 500;
      text-decoration: none;
      transition: color 0.15s, background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    }

    .theme-chip:hover {
      background-color: var(--gym-brand-accent);
      color: var(--gym-brand-ink);
    }

    .theme-fallback {
      background-color: var(--gym-bg-input);
      color: var(--gym-text-muted);
      border-color: var(--gym-border-card);
    }

    .blunder-refutation-row {
      margin-bottom: 1.25rem;
      padding: 0.625rem 0.875rem;
      background-color: var(--gym-bg-input);
      border-radius: var(--radius-md);
      border: 1px solid var(--gym-border-card);
      font-size: var(--gym-text-xs);
    }

    .refutation-label {
      font-weight: 600;
      color: var(--gym-text-main);
      margin-right: 0.5rem;
    }

    .refutation-pv-chips {
      display: inline-flex;
      flex-wrap: wrap;
      gap: 0.375rem;
      margin-top: 0.375rem;
    }

    .pv-move-chip {
      padding: 0.2rem 0.5rem;
      background-color: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-sm);
      color: var(--gym-text-main);
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
      cursor: pointer;
      transition: color 0.15s, background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    }

    .pv-move-chip:hover {
      background-color: var(--gym-bg-card-hover);
      border-color: var(--gym-border-card);
    }

    .pv-move-chip.active {
      background-color: var(--gym-eval-inaccuracy);
      color: var(--gym-brand-ink);
      border-color: var(--gym-brand-accent-active);
      font-weight: 700;
    }

    /* Dual Chess Board Grid */
    .blunder-boards-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 1.5rem;
      margin-top: 1rem;
    }

    @media (max-width: 768px) {
      .blunder-boards-grid { grid-template-columns: 1fr; }
    }

    .board-card {
      display: flex;
      flex-direction: column;
      background-color: var(--gym-bg-input);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      padding: 0.875rem;
    }

    .board-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: var(--gym-text-xs);
      margin-bottom: 0.625rem;
    }

    .board-indicator {
      display: inline-block;
      width: 0.5rem;
      height: 0.5rem;
      border-radius: 9999px;
      margin-right: 0.375rem;
    }

    .dot-green { background-color: var(--gym-chess-green); box-shadow: 0 0 4px rgba(var(--gym-chess-green-rgb), 0.6); }
    .dot-red { background-color: var(--gym-eval-blunder); box-shadow: 0 0 4px rgba(var(--gym-eval-blunder-rgb), 0.6); }

    .board-move-hint code {
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
      padding: 0.1rem var(--gym-space-1);
      border-radius: 0.25rem;
      background-color: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
    }

    .board-canvas-wrapper {
      position: relative;
      width: 100%;
      aspect-ratio: 1 / 1;
      max-width: 380px;
      margin: 0 auto;
      border-radius: var(--radius-sm);
      overflow: hidden;
      box-shadow: var(--shadow-card);
      border: 2px solid var(--gym-board-frame);
    }

    /* SPEC: US-26 AC 11 / US-27 AC 1 / US-27 AC 4: the board has three stacked
       layers. DOM order is the paint order: the board and its pieces below, the
       annotation arrows above the board, the in-flight drag/slide piece and the
       promotion column above the arrows. The position layer redraws through
       `innerHTML` on every playback frame; the arrow layer is its own stable
       node, so a settled arrow is not recreated (and its fade cannot restart)
       while a snap-back animates. */
    .board-position-layer,
    .board-arrow-layer,
    .board-overlay-layer {
      position: absolute;
      inset: 0;
    }

    /* Neither overlay may intercept a board gesture; only the promotion column
       is interactive, and its own rules restore pointer events below. */
    .board-arrow-layer,
    .board-overlay-layer {
      pointer-events: none;
    }

    /* SPEC: US-27 AC 3: only the board root carries `.chess-board-svg` (below).
       The arrow and overlay layers are stacked siblings with their own classes;
       they fill their layer (the wrapper is the sized, capped box) and take none
       of the board's touch-action or user-select contract. */
    .chess-board-arrows,
    .chess-board-overlays {
      display: block;
      width: 100%;
      height: 100%;
    }

    .chess-board-svg {
      display: block;
      width: 100%;
      height: 100%;
      user-select: none;
      /* US-27 AC 1: the board owns Pointer Events; the browser must not pan or
         zoom a drag on touch. */
      touch-action: none;
    }

    /* Blunder board panel: P-2/D-088 fills the two names that had no rule. */
    .blunder-board-panel {
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
      padding: 0.5rem;
      border: 1px solid var(--gym-board-frame);
      border-radius: var(--radius-sm);
      background-color: var(--gym-bg-input);
    }

    /* Interactive puzzle board (P-2). Squares are the only click targets. */
    .puzzle-board {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .puzzle-board [data-square] {
      cursor: pointer;
    }

    .puzzle-board .board-canvas-wrapper {
      touch-action: none;
    }

    /* Interaction states: gold selection/destination, green last move. */
    .board-highlight-selected {
      fill: rgba(var(--gym-eval-inaccuracy-rgb), 0.42);
    }

    .board-highlight-last {
      fill: rgba(var(--gym-chess-green-rgb), 0.32);
    }

    .board-highlight-best {
      fill: rgba(var(--gym-eval-best-rgb), 0.42);
    }

    .board-highlight-blunder {
      fill: rgba(var(--gym-eval-blunder-rgb), 0.42);
    }

    .board-highlight-pv {
      fill: rgba(var(--gym-eval-book-rgb), 0.42);
    }

    .board-destination {
      fill: rgba(var(--gym-eval-inaccuracy-rgb), 0.85);
    }

    .board-destination-capture {
      fill: none;
      stroke: rgba(var(--gym-eval-inaccuracy-rgb), 0.9);
    }

    /* US-26/US-27: the three annotation arrows and their markers take the
       evaluation role tokens (green = best, gold = book/pv, red = blunder),
       never a legacy palette literal. */
    .board-arrow {
      fill: none;
    }

    .board-arrow-green,
    .board-arrowhead-green {
      stroke: var(--gym-eval-best);
      fill: var(--gym-eval-best);
    }

    .board-arrow-gold,
    .board-arrowhead-gold {
      stroke: var(--gym-eval-book);
      fill: var(--gym-eval-book);
    }

    .board-arrow-red,
    .board-arrowhead-red {
      stroke: var(--gym-eval-blunder);
      fill: var(--gym-eval-blunder);
    }

    .board-arrow-green,
    .board-arrow-gold,
    .board-arrow-red {
      fill: none;
    }

    /* SPEC: US-26 AC 6 / US-27 AC 4: the red shaft is dashed as well as
       coloured — a redundant shape encoding for red-green colour vision — on
       the training surfaces only (outlook counterplay and refutation punishment
       inside the drill). The scope leaves the analysis blunder board's red arrow
       solid, as it was. The marker keeps the one filled triangle. */
    .opening-drill .board-arrow-red {
      stroke-dasharray: 22 14;
    }

    /* SPEC: US-26 AC 11 / US-27 AC 4: the study's target arrow arrives after
       the 1.5 s explanation read, so its entrance is a fade. Only the study
       phase scopes it: a hint or a refutation arrow is not delayed and must not
       animate. The token layer has no duration or easing token (it is colours,
       spacing and type only), so the curve is explicit here; reduced motion
       removes the fade as well as the delay and leaves the same settled arrow.
       The settled opacity is the renderer's own `opacity` attribute: the
       implicit 100% keyframe resolves to it, so `0.88` has one owner. */
    @keyframes study-target-fade {
      from {
        opacity: 0;
      }
    }

    .opening-drill-study .board-arrow-green {
      animation: study-target-fade 240ms ease-out both;
    }

    /* SPEC: US-26 AC 2 / US-27 AC 4: the end-of-line outlook set is a settled
       annotation, never an arrival. Only the delayed study target fades, so the
       outlook board (study end or quiz completion) suppresses that fade; under
       reduced motion the final arrows are identical. */
    .opening-drill-outlook .board-arrow-green {
      animation: none;
    }

    @media (prefers-reduced-motion: reduce) {
      .opening-drill-study .board-arrow-green {
        animation: none;
      }
    }

    /* US-27 AC 1/2: the piece that follows the pointer (110x110, drawn by the
       renderer) and the in-board promotion column (scrim plus four cells). */
    .board-dragging-piece {
      pointer-events: none;
    }

    /* US-27 AC 3: the piece in flight during a playback `Sliding` frame (drawn
       by the renderer); it stays transparent to the delegated click so the
       square beneath it remains a target once the queue settles. */
    .board-sliding-piece {
      pointer-events: none;
    }

    .board-promotion-scrim {
      cursor: default;
      fill: var(--gym-overlay-scrim);
      fill-opacity: 0.58;
      /* The overlay layer is transparent to pointer events; the scrim is the
         one target that cancels the column, and the cells choose it. */
      pointer-events: auto;
    }

    .board-promotion-cell {
      fill: var(--gym-promotion-cell);
      cursor: pointer;
      pointer-events: auto;
    }

    /* P-4 (Sprint 7): puzzle session UI. These are new names for this view; the
       report-panel class drift in client/analysis_view.re is untouched (D-088). */
    .puzzle-session {
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }

    .puzzle-session-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 0.75rem;
      flex-wrap: wrap;
    }

    .puzzle-header-text .card-title {
      margin-bottom: 0.125rem;
    }

    .puzzle-header-text .card-subtitle {
      margin-bottom: 0;
    }

    .puzzle-context {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.375rem;
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
    }

    .puzzle-context-tag {
      display: inline-flex;
      align-items: center;
      padding: 0.15rem 0.5rem;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-full);
      background-color: var(--gym-bg-input);
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
    }

    .puzzle-motif {
      border-color: rgba(var(--gym-eval-inaccuracy-rgb), 0.45);
      background-color: rgba(var(--gym-eval-inaccuracy-rgb), 0.12);
      color: var(--gym-eval-inaccuracy-text);
    }

    .puzzle-session-body {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }

    .puzzle-board-area {
      padding: 0.5rem;
      border: 1px solid var(--gym-board-frame);
      border-radius: var(--radius-md);
      background: linear-gradient(180deg, var(--gym-board-light), var(--gym-board-dark));
    }

    .puzzle-feedback {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.5rem 0.75rem;
      border: 1px solid var(--gym-border-card);
      border-left-width: 4px;
      border-radius: var(--radius-sm);
      background-color: var(--gym-bg-input);
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      font-weight: 600;
    }

    .puzzle-feedback-correct {
      border-left-color: var(--gym-chess-green);
      color: var(--gym-eval-best-text);
    }

    .puzzle-feedback-wrong {
      border-left-color: var(--gym-eval-blunder);
      color: var(--gym-eval-blunder-text);
    }

    .puzzle-feedback-solved {
      border-left-color: var(--gym-chess-green);
      color: var(--gym-eval-best-text);
    }

    .puzzle-feedback-revealed {
      border-left-color: var(--gym-eval-inaccuracy-text);
      color: var(--gym-eval-inaccuracy-text);
    }

    .puzzle-feedback-finished {
      border-left-color: var(--gym-eval-brilliant);
      color: var(--gym-eval-brilliant-text);
    }

    .puzzle-explanation {
      display: flex;
      flex-direction: column;
      gap: 0.375rem;
      padding: 0.75rem;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      background-color: var(--gym-bg-input);
    }

    .puzzle-explanation-label {
      font-size: var(--gym-text-xs);
      font-weight: 700;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      color: var(--gym-text-muted);
    }

    .puzzle-move-line {
      display: flex;
      flex-wrap: wrap;
      gap: 0.3rem;
    }

    .puzzle-move {
      padding: 0.15rem var(--gym-space-2);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-sm);
      background-color: var(--gym-bg-card);
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
      color: var(--gym-text-main);
    }

    /* SPEC: US-27 AC 5 / D-204: the tactical workout HUD and its docked action
       column. The design draws a pill row (turn, difficulty, session), an
       objective headline, a motif subhead, the contextual session goal and a
       three-control dock. Only the affordances that work ship (D-204):
       `Show Solution` and the session's advance/replay action. `Submit Move →`
       and `Get Hint` are withheld pending session behaviour (design ticket
       D-T7), so no disabled primary and no disabled-state rule exists. */
    .puzzle-hud {
      display: flex;
      flex-direction: column;
      gap: 0.4rem;
      min-width: 0;
    }

    .puzzle-turn-pill {
      border-color: rgba(var(--gym-chess-green-rgb), 0.4);
      background-color: rgba(var(--gym-chess-green-rgb), 0.12);
      color: var(--gym-chess-green);
    }

    .puzzle-progress-chip,
    .puzzle-difficulty-chip {
      font-variant-numeric: tabular-nums;
    }

    .puzzle-subhead {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
    }

    .puzzle-session-goal {
      margin-bottom: 0.15rem;
    }

    .puzzle-progress-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 0.25rem;
    }

    .puzzle-moves-section {
      display: flex;
      flex-direction: column;
      min-width: 0;
    }

    .puzzle-solution-progress {
      font-variant-numeric: tabular-nums;
    }

    .puzzle-actions {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 0.5rem;
      padding-top: 0.25rem;
    }

    /* SPEC: US-27 AC 5 / D-204: the dock ships only affordances that work, so
       the session's Show Solution / advance / replay actions span the sidebar.
       The drawn Submit Move and Get Hint are withheld (D-T7) and leave no
       disabled-state rule behind. */
    .puzzle-show-solution {
      width: 100%;
    }

    .puzzle-dock-secondary {
      width: 100%;
    }

    .puzzle-finished {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 0.75rem;
      padding: 1rem;
      border: 1px solid var(--gym-board-frame);
      border-radius: var(--radius-md);
      background-color: var(--gym-bg-input);
    }

    .puzzle-finished-title {
      font-size: var(--gym-text-base);
      font-weight: 700;
      color: var(--gym-text-main);
    }

    .puzzle-finished-message {
      font-size: var(--gym-text-sm);
      color: var(--gym-text-muted);
    }

    /* SPEC: US-31: the session's terminal action and completion summary. */
    .puzzle-dock-primary,
    .puzzle-next,
    .puzzle-finish {
      width: 100%;
      justify-content: center;
    }

    /* SPEC: US-31: the finished summary's count, accuracy and queue lines are
       one main-text step. The `puzzle-session-*` class selectors this group
       used to carry were dead — those strings are element ids, not classes. */
    .puzzle-finished-count,
    .puzzle-finished-accuracy,
    .puzzle-finished-queue {
      font-size: var(--gym-text-sm);
      color: var(--gym-text-main);
    }

    /* SPEC: US-34 AC 1 / DESIGN §06: the band change is a neutral summary — one
       muted text step and tabular numerals, no colour, no trend icon. */
    .puzzle-finished-band {
      margin: 0;
      font-size: var(--gym-text-sm);
      color: var(--gym-text-muted);
    }

    /* SPEC: US-34 AC 1 / DESIGN §06: the daily band's calibration line is one
       muted line under the heading and above the session copy; the band value is
       its only bold element and both numbers are tabular. It is a difficulty,
       never a rating, and never an action. */
    .puzzle-hub-band {
      margin: 0;
      font-size: var(--gym-text-sm);
      color: var(--gym-text-muted);
    }

    .puzzle-hub-band-value {
      font-weight: 600;
      color: var(--gym-text-main);
    }

    .puzzle-hub-lane-alert {
      margin: 0;
      font-size: var(--gym-text-sm);
      color: var(--gym-text-main);
    }

    .puzzle-session-completion {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }

    .puzzle-dock-exit,
    .puzzle-exit {
      width: 100%;
      justify-content: center;
    }

    /* SPEC: US-31: the puzzle hub is flat bands: the weakness profile, the daily
       session, the two supporting lanes and the corpus strip. The lanes are one
       flat band, so neither gets a card of its own. */
    .puzzle-hub {
      display: flex;
      flex-direction: column;
      gap: 0;
    }

    /* SPEC: US-31 / DESIGN §06: the hub is one flat plane cut by full-width
       hairlines at every band boundary. No band is inset from the page gutter. */
    .puzzle-hub-header {
      padding-bottom: var(--gym-space-5);
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .puzzle-hub-header .page-header {
      margin-bottom: 0;
    }

    .puzzle-hub-analyze {
      text-decoration: none;
    }

    @media (min-width: 768px) {
      .puzzle-hub-header .page-header {
        flex-direction: row;
        align-items: flex-end;
      }
    }

    .puzzle-hub-profile,
    .puzzle-hub-daily {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      padding: var(--gym-space-5) 0;
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .puzzle-hub-heading-row {
      display: flex;
      align-items: center;
      gap: var(--gym-space-2);
      flex-wrap: wrap;
    }

    .puzzle-hub-pill {
      padding: 2px 8px;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-chip);
      background: var(--gym-bg-active-row);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    /* SPEC: US-31 / docs/design/screens/DESIGN.md: the hub's section headings
       are the 20px step of the type ramp, not the small uppercase label. */
    .puzzle-hub-heading {
      margin: 0;
      font-size: var(--gym-text-lg);
      font-weight: 700;
      line-height: 1.25;
      color: var(--gym-text-main);
    }

    .puzzle-hub-profile-meta,
    .puzzle-hub-profile-balanced,
    .puzzle-hub-daily-copy,
    .puzzle-hub-lane-copy {
      margin: 0;
      font-size: var(--gym-text-sm);
      color: var(--gym-text-muted);
    }

    .puzzle-hub-profile-link {
      display: inline-flex;
      align-items: center;
      align-self: flex-start;
      min-height: 40px;
      color: var(--gym-brand-accent-fg);
      font-weight: 600;
    }

    .puzzle-hub-profile-link:hover {
      color: var(--gym-brand-accent-fg);
    }

    /* SPEC: US-31: the loading state is the same three-column table grid the
       loaded profile delivers - name plus two numeric cells - never a bar
       layout the loaded state never renders. */
    .puzzle-hub-motif-skeleton .gym-motif-row {
      align-items: center;
    }

    .puzzle-hub-skeleton-block {
      display: block;
      height: 12px;
      border-radius: var(--radius-full);
      background: var(--gym-bg-card-hover);
    }

    .puzzle-hub-skeleton-name {
      width: 70%;
    }

    .puzzle-hub-skeleton-value {
      width: 2.4rem;
    }

    .puzzle-hub-motif-name {
      font-size: var(--gym-text-sm);
      color: var(--gym-text-main);
    }

    /* SPEC: US-31 / DESIGN §02: the hub's repeat-blunders block is the same
       flat compact table as Progress, with the two questions as column labels;
       no motif cards and no comparison bars. */
    .puzzle-hub-motif-table .gym-motif-table-head,
    .puzzle-hub-motif-table .gym-motif-row {
      grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
    }

    /* SPEC: US-31 / DESIGN §06: the pace is a segmented control, not two ghost
       text buttons. The selected segment is filled on the neutral surface; the
       accent is reserved for `Start daily session`. */
    .puzzle-hub-pace {
      display: inline-flex;
      align-self: flex-start;
      gap: var(--gym-space-1);
      padding: var(--gym-space-1);
      background: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--gym-radius-md);
    }

    .puzzle-hub-pace .puzzle-hub-pace-btn {
      min-height: 32px;
      padding: var(--gym-space-1) var(--gym-space-3);
      border: 1px solid transparent;
      border-radius: var(--gym-radius-control);
      background: transparent;
      color: var(--gym-text-muted);
    }

    .puzzle-hub-pace .puzzle-hub-pace-btn:hover {
      color: var(--gym-text-main);
      background: var(--gym-bg-card-hover);
    }

    .puzzle-hub-pace .puzzle-hub-pace-selected {
      background: var(--gym-bg-active-row);
      border-color: var(--gym-border-selected);
      color: var(--gym-text-main);
    }

    .puzzle-hub-pace .puzzle-hub-pace-selected:hover {
      background: var(--gym-bg-active-row);
      color: var(--gym-text-main);
    }

    .puzzle-hub-daily {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: start;
      column-gap: var(--gym-space-5);
    }

    .puzzle-hub-daily-main {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      min-width: 0;
    }

    .puzzle-hub-daily-action {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: var(--gym-space-2);
    }

    .puzzle-hub-start-daily {
      align-self: flex-end;
      width: auto;
      min-width: 150px;
      min-height: 40px;
      justify-content: center;
    }

    .puzzle-hub-daily-copy {
      font-size: var(--gym-text-base);
    }

    .puzzle-hub-daily-note,
    .puzzle-hub-daily-meta {
      margin: 0;
      font-size: var(--gym-text-sm);
      color: var(--gym-text-muted);
    }

    .puzzle-hub-daily-meta {
      text-align: right;
    }

    .puzzle-hub-lanes {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0;
      padding: var(--gym-space-5) 0;
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .puzzle-hub-lane {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      min-width: 0;
    }

    .puzzle-hub-lane + .puzzle-hub-lane {
      padding-left: var(--gym-space-6);
      border-left: 1px solid var(--gym-border-subtle);
    }

    .puzzle-hub-lane-actions {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-2);
      margin-top: var(--gym-space-2);
    }

    .puzzle-hub-badge {
      align-self: flex-start;
      padding: 2px 8px;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-chip);
      background: var(--gym-bg-active-row);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    /* SPEC: US-31 / DESIGN §06: the corpus state is a flat line, never an
       empty bordered card; the dot is neutral (gold only means attention). */
    .puzzle-hub-corpus {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.5rem;
      padding: var(--gym-space-4) 0;
      border: 0;
      border-radius: 0;
      background: transparent;
    }

    .puzzle-hub-corpus-dot {
      width: 6px;
      height: 6px;
      border-radius: var(--radius-full);
      background: var(--gym-text-dim);
    }

    @media (max-width: 767px) {
      /* SPEC: US-31 / design/screens §06: the Start action stays in the first
         viewport and the pace explanation follows it. Flattening the main
         column lets the button slot between the copy and the pace control
         without a second copy in the markup. */
      .puzzle-hub-daily {
        display: flex;
        flex-direction: column;
      }

      .puzzle-hub-daily-main {
        display: contents;
      }

      .puzzle-hub-heading-row { order: 1; }
      /* SPEC: US-34 AC 1 / DESIGN §06: phone order is heading → band → copy →
         action → pace → note. The band line stays visible at every width; it is
         the surface that states the current difficulty. */
      .puzzle-hub-band { order: 2; }
      .puzzle-hub-daily-copy { order: 3; }
      .puzzle-hub-daily-action { order: 4; align-items: flex-start; }
      .puzzle-hub-pace { order: 5; }

      .puzzle-hub-pace .puzzle-hub-pace-btn {
        min-height: 40px;
      }
      .puzzle-hub-daily-note { order: 6; }

      .puzzle-hub-start-daily {
        align-self: flex-start;
      }

      .puzzle-hub-daily-meta {
        text-align: left;
      }

      .puzzle-hub-lanes {
        grid-template-columns: 1fr;
      }

      .puzzle-hub-lane + .puzzle-hub-lane {
        padding-left: 0;
        padding-top: var(--gym-space-5);
        border-left: 0;
        border-top: 1px solid var(--gym-border-subtle);
      }
    }

    @media (max-width: 640px) {
      .puzzle-session-header {
        flex-direction: column;
      }

      .puzzle-actions {
        flex-direction: column;
        align-items: stretch;
      }

      .puzzle-actions .btn {
        width: 100%;
      }
    }

    /* SPEC: US-27 AC 6: the read-only stepper's status row; the controls
       themselves are the one shared Board Control Bar. */
    .pv-status-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      flex-wrap: wrap;
    }

    .stepper-status {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
      font-family: var(--font-mono);
    }

    .step-counter {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
      font-family: var(--font-mono);
    }

    .pv-pills-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 0.3rem;
      margin-top: 0.5rem;
      max-height: 90px;
      overflow-y: auto;
    }

    .pv-pill {
      background-color: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-full);
      padding: 0.15rem var(--gym-space-2);
      font-size: var(--gym-text-xs);
      font-family: var(--font-mono);
      color: var(--gym-text-muted);
      cursor: pointer;
      transition: color 0.15s, background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    }

    .pv-pill:hover {
      border-color: var(--gym-brand-accent-fg);
      color: var(--gym-text-main);
    }

    .pv-pill.active {
      background-color: rgba(var(--gym-eval-inaccuracy-rgb), 0.2);
      border-color: var(--gym-eval-inaccuracy-text);
      color: var(--gym-eval-inaccuracy-text);
      font-weight: 700;
    }

    /* SPEC: US-28 AC 1 / D-202: three destination items inside
       the shell bar; the active route is the warm card surface with an accent
       600 label and a hairline border. */
    .app-nav-tabs {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-left: auto;
      margin-bottom: 0;
      padding-bottom: 0;
      border-bottom: 0;
      flex-wrap: wrap;
    }

    .nav-tab {
      background: transparent;
      border: 1px solid transparent;
      border-radius: var(--radius-sm);
      color: var(--gym-text-muted);
      padding: 0.375rem 0.875rem;
      font-size: var(--gym-text-sm);
      font-weight: 400;
      line-height: 1.4;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      text-decoration: none;
      transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    }

    .nav-tab:hover {
      background: var(--gym-bg-card);
      color: var(--gym-text-main);
    }

    .nav-tab.active {
      background: var(--gym-bg-card);
      border-color: var(--gym-border-subtle);
      color: var(--gym-brand-accent-fg);
      font-weight: 600;
    }

    /* Snapshot Banner */
    .snapshot-banner {
      background: rgba(var(--gym-brand-accent-rgb), 0.15);
      border: 1px solid var(--gym-brand-accent);
      border-radius: var(--radius-md);
      padding: 0.75rem 1rem;
      margin-bottom: 1.5rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
    }

    /* Authentication & Modal Styles */
    .header-actions {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      flex-wrap: wrap;
      /* The nav's auto margin and this one share the free space, so the
         destinations sit between the brand and a right-aligned account
         cluster (component-specs.md §1). */
      margin-left: auto;
    }

    .auth-user-bar {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      background: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-full);
      padding: 0.3rem var(--gym-space-2) 0.3rem var(--gym-space-3);
    }

    .auth-user-name {
      font-size: var(--gym-text-sm);
      font-weight: 600;
      color: var(--gym-text-main);
    }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      background: var(--gym-overlay-scrim);
      backdrop-filter: blur(4px);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1000;
      padding: 1rem;
    }

    .modal-dialog {
      background: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-card);
      width: 100%;
      max-width: 440px;
      padding: 1.5rem;
      position: relative;
    }

    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 1rem;
    }

    .modal-title {
      font-size: var(--gym-text-lg);
      font-weight: 700;
      color: var(--gym-text-main);
      margin: 0;
    }

    .modal-close {
      background: transparent;
      border: none;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-lg);
      cursor: pointer;
      padding: 0.25rem 0.5rem;
      border-radius: var(--radius-sm);
    }

    .modal-close:hover {
      color: var(--gym-text-main);
      background: var(--gym-bg-card-hover);
    }

    .auth-provider-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: var(--gym-space-3);
      width: 100%;
      padding: 0.7rem 1rem;
      border-radius: var(--radius-md);
      border: 1px solid var(--gym-border-card);
      background: var(--gym-bg-input);
      color: var(--gym-text-main);
      font-weight: 600;
      font-size: var(--gym-text-sm);
      text-decoration: none;
      transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
      margin-bottom: var(--gym-space-3);
    }

    .auth-provider-btn:hover {
      background: var(--gym-bg-card-hover);
      border-color: var(--gym-brand-accent-fg);
    }

    .auth-divider {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      color: var(--gym-text-dim);
      font-size: var(--gym-text-xs);
      margin: 1rem 0;
    }

    .auth-divider::before,
    .auth-divider::after {
      content: "";
      flex: 1;
      height: 1px;
      background: var(--gym-border-card);
    }

    .sub-list-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.6rem 0.75rem;
      background: var(--gym-bg-input);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      margin-bottom: 0.5rem;
      font-size: var(--gym-text-sm);
    }

    /* D-041: keep the third-party licence/source-offer link visible without
       competing with the application UI. */
    .app-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: var(--gym-space-2) var(--gym-space-4);
      margin-top: var(--gym-space-6);
      padding: var(--gym-space-3) 0 var(--gym-space-6);
      border-top: 1px solid var(--gym-border-subtle);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .app-footer-brand {
      color: var(--gym-text-muted);
    }

    .app-footer a {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      color: var(--gym-text-muted);
      text-decoration: underline;
    }

    .third-party {
      max-width: 60rem;
      margin: 0 auto;
      padding: 2rem 1rem 4rem;
      line-height: 1.55;
    }

    .third-party table {
      width: 100%;
      table-layout: fixed;
      border-collapse: collapse;
      margin: 0.75rem 0 1.5rem;
      font-size: var(--gym-text-sm);
    }

    .third-party th,
    .third-party td {
      border: 1px solid var(--gym-border-card);
      padding: 0.5rem var(--gym-space-3);
      text-align: left;
      vertical-align: top;
      overflow-wrap: anywhere;
    }

    .third-party th {
      white-space: normal;
    }

    .third-party code {
      overflow-wrap: anywhere;
    }

    .third-party a {
      overflow-wrap: anywhere;
    }

    /* ------------------------------------------------------------------
       O-7 (Sprint 10): the Opening Trainer (`/openings`, the course picker
       and the drill). Every class the views emit has a rule here; the Node
       suite asserts the vocabulary, the `test_board_interaction.js` idiom.
       ------------------------------------------------------------------ */

    .opening-page {
      background: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-lg);
      padding: 1.5rem;
      margin-bottom: 1.5rem;
    }

    .opening-header {
      margin-bottom: 1rem;
    }

    .opening-subtitle {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      margin-bottom: 0.5rem;
    }

    .opening-section-title {
      font-size: var(--gym-text-base);
      margin: 1.25rem 0 0.5rem;
    }

    .opening-band-panel {
      background: var(--gym-bg-input);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      padding: 0.75rem;
      margin: 0.75rem 0;
    }

    .opening-band-header {
      display: flex;
      gap: 0.5rem;
      align-items: baseline;
      flex-wrap: wrap;
    }

    .opening-band-label {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .opening-band-default {
      color: var(--gym-text-main);
      font-weight: 600;
    }

    .opening-band-options {
      display: flex;
      gap: var(--gym-space-1);
      flex-wrap: wrap;
      margin-top: 0.5rem;
    }

    .opening-band-button {
      background: var(--gym-bg-card);
      color: var(--gym-text-main);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-full);
      padding: 0.3rem 0.7rem;
      font-size: var(--gym-text-sm);
      cursor: pointer;
    }

    .opening-band-button-active {
      background: var(--gym-brand-accent);
      border-color: var(--gym-brand-accent-fg);
      color: var(--gym-brand-ink);
    }

    .opening-band-note {
      color: var(--gym-text-dim);
      font-size: var(--gym-text-xs);
      margin-top: 0.4rem;
    }

    .opening-band-compact {
      padding: 0;
    }

    .opening-band-summary {
      display: flex;
      align-items: center;
      gap: var(--gym-space-2);
      min-height: 44px;
      padding: var(--gym-space-2) var(--gym-space-3);
      cursor: pointer;
      list-style: none;
    }

    .opening-band-compact > summary::-webkit-details-marker {
      display: none;
    }

    .opening-band-compact .opening-band-label,
    .opening-band-compact .opening-band-default,
    .opening-band-compact .opening-band-change {
      white-space: nowrap;
    }

    .opening-band-compact .opening-band-default {
      font-size: var(--gym-text-sm);
    }

    .opening-band-change {
      margin-left: auto;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
    }

    .opening-band-chevron {
      display: inline-flex;
      color: var(--gym-text-muted);
    }

    .opening-band-compact[open] .opening-band-chevron {
      transform: rotate(180deg);
    }

    .opening-band-compact .opening-band-options {
      padding: 0 var(--gym-space-3) var(--gym-space-2);
    }

    .opening-band-compact .opening-band-note {
      margin: 0;
      padding: 0 var(--gym-space-3) var(--gym-space-3);
    }

    .opening-band-compact .opening-band-button-active {
      background: var(--gym-bg-card-hover);
      border-color: var(--gym-border-card);
      color: var(--gym-text-main);
    }

    .opening-due {
      display: inline-flex;
      margin: 0.25rem 0 0.75rem;
    }

    .opening-due-count {
      background: var(--gym-bg-input);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-full);
      padding: 0.3rem 0.7rem;
      font-size: var(--gym-text-sm);
      color: var(--gym-eval-inaccuracy-text);
    }

    .opening-due-start {
      background: var(--gym-brand-accent);
      color: var(--gym-brand-ink);
      border: 1px solid var(--gym-brand-accent);
      border-radius: var(--radius-full);
      padding: 0.3rem 0.7rem;
      font-size: var(--gym-text-sm);
      cursor: pointer;
      margin-left: 0.4rem;
    }

    /* O-8 / D-161: the permanent "local to this device only" note and the
       transient reset / write-failure line. */
    .opening-progress-note {
      color: var(--gym-text-dim);
      font-size: var(--gym-text-xs);
      margin: 0.25rem 0 0.6rem;
    }

    .opening-progress-alert {
      color: var(--gym-eval-inaccuracy-text);
      font-size: var(--gym-text-sm);
      margin: 0.25rem 0 0.6rem;
    }

    .opening-catalogue {
      display: flex;
      flex-direction: column;
      gap: 0.6rem;
    }

    .opening-course-main {
      display: flex;
      flex-direction: column;
      gap: 0.15rem;
    }

    .opening-course-name {
      font-weight: 600;
    }

    .opening-course-meta {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .opening-course-actions {
      display: flex;
      gap: 0.5rem;
      flex-wrap: wrap;
    }

    .opening-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 40px;
      background: transparent;
      color: var(--gym-text-main);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-sm);
      padding: 0 var(--gym-space-3);
      font: inherit;
      font-size: var(--gym-text-sm);
      cursor: pointer;
    }

    .opening-link:hover {
      background: var(--gym-bg-card-hover);
    }

    .opening-traps-entry {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 40px;
      background: transparent;
      color: var(--gym-text-main);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-sm);
      padding: 0 var(--gym-space-3);
      font: inherit;
      font-size: var(--gym-text-sm);
      cursor: pointer;
    }

    .opening-traps-entry:hover:not(:disabled),
    .opening-trap-practise:hover:not(:disabled) {
      background: var(--gym-bg-card-hover);
      border-color: var(--gym-border-card);
    }

    .opening-traps-entry:active:not(:disabled),
    .opening-trap-practise:active:not(:disabled) {
      background: var(--gym-bg-active-row);
    }

    .opening-traps-entry:disabled,
    .opening-trap-practise:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }

    .opening-back,
    .opening-breadcrumb-link {
      display: inline-flex;
      align-items: center;
      min-height: 40px;
      padding: 0 var(--gym-space-2);
      background: transparent;
      color: var(--gym-text-muted);
      border: 1px solid transparent;
      border-radius: var(--radius-sm);
      font: inherit;
      font-size: var(--gym-text-sm);
      cursor: pointer;
    }

    .opening-breadcrumb-link {
      border-color: transparent;
    }

    .opening-loading,
    .opening-error,
    .opening-empty {
      padding: 1rem;
      text-align: center;
    }

    .opening-error-icon {
      font-size: var(--gym-text-lg);
      color: var(--gym-eval-blunder);
      margin-bottom: 0.25rem;
    }

    .opening-error-title,
    .opening-empty-title {
      font-size: var(--gym-text-base);
      margin-bottom: 0.25rem;
    }

    .opening-error-desc,
    .opening-empty-desc {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .opening-notice {
      background: var(--gym-bg-input);
      border: 1px solid var(--gym-eval-inaccuracy);
      border-radius: var(--radius-md);
      padding: 0.6rem 0.75rem;
      margin-bottom: 0.75rem;
      font-size: var(--gym-text-sm);
    }

    .opening-picker {
      display: flex;
      flex-direction: column;
    }

    .opening-picker-actions {
      display: flex;
      gap: 0.5rem;
      flex-wrap: wrap;
      margin-bottom: 0.75rem;
    }

    .opening-variation-list {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-1);
      max-height: 420px;
      overflow-y: auto;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      padding: 0.5rem;
    }

    /* SPEC: US-28 AC 7: the Branch Out panel is a narrow panel at every width
       (a 400px rail on desktop). The opponent row and each weapon row wrap
       instead of forcing a horizontal scroll inside the 420px list; the badge,
       move count and action stay inside the panel. */
    .opening-variation-row {
      display: flex;
      align-items: flex-start;
      flex-wrap: wrap;
      gap: 0.5rem;
      justify-content: space-between;
      border-bottom: 1px solid var(--gym-border-card);
      padding: var(--gym-space-1) 0.25rem;
    }

    .opening-variation-name {
      font-size: var(--gym-text-sm);
    }

    .opening-variation-meta {
      color: var(--gym-text-dim);
      font-size: var(--gym-text-xs);
      white-space: normal;
      overflow-wrap: anywhere;
    }

    .opening-variation-row .opening-variation-row {
      flex: 1 1 100%;
      min-width: 0;
    }

    .opening-variation-row .opening-link {
      flex: 1 1 auto;
    }

    /* The course tree: path chips, the shortest line at this branch, and the
       continuations. Tokens only; the row is the target. */
    .opening-rows {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-4);
    }

    .opening-rows-list {
      display: flex;
      flex-direction: column;
    }

    .opening-row-target {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--gym-space-3);
      width: 100%;
      min-height: 44px;
      padding: var(--gym-space-2) 0;
      background: transparent;
      border: 0;
      border-bottom: 1px solid var(--gym-border-subtle);
      color: var(--gym-text-main);
      font: inherit;
      font-size: var(--gym-text-sm);
      text-align: left;
      cursor: pointer;
    }

    .opening-row-target:hover {
      background: var(--gym-bg-card-hover);
    }

    .opening-row-target:active {
      background: var(--gym-bg-active-row);
    }

    .opening-row-text {
      display: flex;
      flex: 1;
      flex-direction: column;
      gap: var(--gym-space-1);
      min-width: 0;
    }

    .opening-row-chevron {
      display: inline-flex;
      flex: none;
      margin-top: var(--gym-space-1);
      transform: rotate(-90deg);
      color: var(--gym-text-muted);
    }

    .opening-tree {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-3);
    }

    .opening-tree-branches {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-2);
    }

    .opening-tree-heading {
      margin: 0;
    }

    .opening-tree-branches .opening-tree-title {
      margin: 0;
    }

    @media (min-width: 1101px) {
      .opening-tree {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 380px;
        grid-template-areas:
          "heading heading"
          "intro intro"
          "path path"
          "meta meta"
          "branches line";
        column-gap: var(--gym-space-6);
        row-gap: var(--gym-space-3);
        align-items: start;
      }

      .opening-tree-heading { grid-area: heading; }
      .opening-tree-intro { grid-area: intro; }
      .opening-tree-path { grid-area: path; }
      .opening-tree-meta { grid-area: meta; }
      .opening-tree-branches { grid-area: branches; }
      .opening-tree-shortest {
        position: sticky;
        top: var(--gym-space-4);
        grid-area: line;
      }

      .opening-band-compact {
        max-width: 420px;
      }
    }

    .opening-tree-path {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-2);
      padding: var(--gym-space-2) 0;
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .opening-tree-path-label {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
    }

    .opening-tree-crumbs {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-2);
    }

    .opening-tree-crumb {
      display: inline-flex;
      align-items: center;
      min-height: 40px;
      padding: 0 var(--gym-space-3);
      background: transparent;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      color: var(--gym-text-main);
      font-family: var(--font-mono);
      font-size: var(--gym-text-sm);
      cursor: pointer;
    }

    .opening-tree-crumb-current {
      background: var(--gym-bg-active-row);
    }

    .opening-tree-meta {
      margin: 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .opening-tree-shortest {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-2);
      padding: var(--gym-space-3);
      background: var(--gym-bg-input);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-md);
    }

    .opening-tree-shortest-label {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
    }

    .opening-tree-shortest-name {
      color: var(--gym-text-main);
      font-size: var(--gym-text-lg);
      font-weight: 700;
      line-height: 1.2;
    }

    .opening-tree-shortest-meta {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-variant-numeric: tabular-nums;
    }

    .opening-tree-shortest-moves {
      color: var(--gym-text-muted);
      font-family: var(--font-mono);
      font-size: var(--gym-text-sm);
      line-height: 1.45;
      overflow-wrap: anywhere;
    }

    .opening-tree-note {
      margin: 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      line-height: 1.45;
    }

    .opening-tree-shortest .gym-btn-sm {
      align-self: flex-start;
      min-height: 40px;
    }

    .opening-tree-title {
      margin: var(--gym-space-2) 0 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      font-weight: 700;
    }

    .opening-tree-san {
      color: var(--gym-text-main);
      font-family: var(--font-mono);
      font-size: var(--gym-text-base);
      font-weight: 700;
    }

    .opening-tree-count {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .opening-tree-names {
      display: block;
      overflow: visible;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      line-height: 1.35;
      white-space: normal;
      overflow-wrap: anywhere;
    }

    .opening-tree-move {
      min-height: 52px;
    }

    /* Screen 04 §2C: name-first continuation rows. The variation name is the
       row heading (16 px, main); the branching move is the muted mono line
       beneath it; the count, learned state and band rate are the row data. */
    .opening-tree-row-name {
      color: var(--gym-text-main);
      font-size: var(--gym-text-base);
      font-weight: 600;
      line-height: 1.3;
    }

    .opening-tree-move .opening-tree-san {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      font-weight: 400;
      line-height: 1.35;
    }

    .opening-tree-row-progress {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-2);
      align-items: baseline;
    }

    .opening-tree-row-progress .opening-tree-count,
    .opening-tree-row-progress .opening-tree-completion {
      font-variant-numeric: tabular-nums;
    }
    .opening-line-status {
      align-self: flex-start;
      display: inline-flex;
      align-items: center;
      padding: 0.1rem 0.5rem;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-full);
      background: var(--gym-bg-card-hover);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }

    .opening-line-status-solid {
      color: var(--gym-text-main);
    }

    .opening-line-status-due {
      color: var(--gym-text-main);
      border-color: var(--gym-text-muted);
    }

    .opening-line-status-interval {
      color: var(--gym-text-muted);
      font-family: var(--font-mono);
    }

    .opening-tree-completion {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-variant-numeric: tabular-nums;
    }

    .opening-tree-due {
      color: var(--gym-text-main);
    }

    .opening-study-paths {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--gym-space-2);
    }

    .opening-study-paths-label {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
    }

    .opening-study-path {
      min-height: 40px;
      padding: 0 var(--gym-space-3);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      background: transparent;
      color: var(--gym-text-muted);
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
      font-variant-numeric: tabular-nums;
      cursor: pointer;
    }

    .opening-study-path:hover:not(:disabled) {
      background: var(--gym-bg-card-hover);
      color: var(--gym-text-main);
    }

    .opening-study-path-active {
      background: var(--gym-bg-active-row);
      color: var(--gym-text-main);
      border-color: var(--gym-text-muted);
    }


    .opening-traps {
      background: var(--gym-bg-input);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      padding: 0.75rem;
      margin: 0.75rem 0;
    }

    .opening-traps-header {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 0.5rem;
      flex-wrap: wrap;
      margin-bottom: 0.5rem;
    }

    .opening-traps-title {
      font-weight: 600;
      color: var(--gym-eval-inaccuracy-text);
    }

    .opening-traps-label {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .opening-traps-board {
      max-width: 420px;
    }

    .opening-traps-feedback {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      margin: 0.5rem 0;
    }

    .opening-traps-actions {
      display: flex;
      gap: 0.5rem;
      flex-wrap: wrap;
    }

    .opening-drill {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }

    /* Screen 05 §1: the breadcrumb is one row; the title and the phase switch
       are the next, spanning the page so the title sits over the board column
       and the switch over the rail. */
    .opening-drill-header {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: var(--gym-space-2);
    }

    .opening-drill-heading {
      display: flex;
      flex-direction: column;
      gap: 0.15rem;
    }

    .opening-drill-variation {
      font-size: var(--gym-text-lg);
    }

    .opening-drill-body {
      display: flex;
      gap: 1rem;
      align-items: flex-start;
      flex-wrap: wrap;
    }

    .opening-board-area {
      flex: 1 1 320px;
      max-width: 480px;
    }

    .opening-drill-panel {
      flex: 1 1 300px;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .opening-controls {
      display: flex;
      gap: 0.5rem;
      flex-wrap: wrap;
      margin-top: 0.5rem;
    }

    .opening-control:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }

    .opening-control {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 40px;
      background: var(--gym-bg-input);
      color: var(--gym-text-main);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-sm);
      padding: 0 var(--gym-space-3);
      font: inherit;
      font-size: var(--gym-text-sm);
      cursor: pointer;
    }

    .opening-message {
      border-radius: var(--radius-sm);
      padding: var(--gym-space-2) 0.6rem;
      font-size: var(--gym-text-sm);
    }

    .opening-message-hint {
      background: rgba(var(--gym-chess-green-rgb), 0.12);
      border: 1px solid var(--gym-chess-green);
    }

    .opening-message-nudge {
      background: rgba(var(--gym-brand-accent-rgb), 0.12);
      border: 1px solid var(--gym-brand-accent);
    }

    .opening-message-miss {
      background: rgba(var(--gym-eval-blunder-rgb), 0.12);
      border: 1px solid var(--gym-eval-blunder);
    }

    .opening-note {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    /* SPEC: US-26 AC 7, AC 10 / DESIGN 05: the completion card is a stack on the
       design record's type scale — the completion state as the lead, the
       schedule (or the learned word) as the fact under it, the membership and
       pacing sentences as muted support, and the flattened plan block last.
       S20-7's outlook arrows and legend slot into that plan block at these same
       sizes and spacing; nothing here is a second treatment. */
    .opening-completion {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: var(--gym-space-2);
      background: rgba(var(--gym-chess-green-rgb), 0.12);
      border: 1px solid var(--gym-chess-green);
      border-radius: var(--radius-md);
      padding: var(--gym-space-2) var(--gym-space-3);
    }

    .opening-completion-text {
      color: var(--gym-text-main);
      font-size: var(--gym-text-base);
      font-weight: 600;
      line-height: 1.4;
    }

    .opening-completion-fact {
      color: var(--gym-text-main);
      font-size: var(--gym-text-base);
      line-height: 1.4;
    }

    .opening-completion-support {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      line-height: 1.45;
    }

    /* The S20-7 plan/legend area: the existing flattened explainer block, given
       the card's full width so the arrows and chips have a slot to land in. */
    .opening-completion > .gym-drill-explainer {
      align-self: stretch;
    }

    /* SPEC: US-26 AC 2, AC 6 / DESIGN 05: the end-of-line outlook block. Three
       compact chips colour-keyed to the arrows, then (only when authored) the
       middlegame plan note at the card's support size — never a second type
       scale. A node without `plan_arrows` renders no block, and a node without
       a note renders no paragraph, so an absent note leaves no empty box or
       reserved gap. */
    .opening-outlook {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: var(--gym-space-1);
    }

    .opening-completion > .opening-outlook {
      align-self: stretch;
    }

    .opening-outlook-legend {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--gym-space-1);
    }

    .opening-outlook-chip {
      display: inline-flex;
      align-items: center;
      gap: var(--gym-space-1);
      padding: 0 var(--gym-space-2);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--radius-full);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      line-height: 1.4;
      white-space: nowrap;
    }

    .opening-outlook-swatch {
      width: var(--gym-space-2);
      height: var(--gym-space-2);
      flex: none;
      border-radius: var(--radius-full);
      box-sizing: border-box;
    }

    .opening-outlook-chip-green .opening-outlook-swatch {
      background-color: var(--gym-eval-best-text);
    }

    .opening-outlook-chip-gold .opening-outlook-swatch {
      background-color: var(--gym-eval-book-text);
    }

    /* The red fill alone measures 2.98:1 against the completion card's tint
       (`#313427`), under the 3:1 non-text threshold. The token-layer ring
       (`--gym-eval-blunder-text`, `#f47878`) measures 4.73:1 there and 5.62:1 on
       the untinted study card, so the dot clears AA non-text. */
    .opening-outlook-chip-red .opening-outlook-swatch {
      background-color: var(--gym-eval-blunder);
      border: 1px solid var(--gym-eval-blunder-text);
    }

    .opening-outlook-note {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      line-height: 1.45;
      max-width: 62ch;
    }

    .opening-refutation {
      background: rgba(var(--gym-eval-blunder-rgb), 0.1);
      border: 1px solid var(--gym-eval-blunder);
      border-radius: var(--radius-md);
      padding: 0.75rem;
    }

    .opening-refutation-header {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 0.5rem;
      flex-wrap: wrap;
      margin-bottom: var(--gym-space-1);
    }

    .opening-refutation-headline {
      font-size: var(--gym-text-base);
    }

    .opening-refutation-size {
      color: var(--gym-eval-blunder-small);
      font-size: var(--gym-text-sm);
      white-space: nowrap;
    }

    .opening-refutation-step {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      margin-bottom: var(--gym-space-1);
    }

    .opening-refutation-explanation {
      font-size: var(--gym-text-sm);
      margin-bottom: 0.5rem;
    }

    .opening-refutation-controls {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex-wrap: wrap;
    }

    /* SPEC: US-26 AC 11 / D-175 rule 3: the study step before a first drill. */
    .opening-study {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      background: rgba(var(--gym-brand-accent-rgb), 0.1);
      border: 1px solid var(--gym-brand-accent);
      border-radius: var(--radius-md);
      padding: 0.75rem;
    }

    .opening-study-notation {
      font-variant-numeric: tabular-nums;
      line-height: 1.5;
      font-size: var(--gym-text-sm);
    }

    .opening-study-step {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .opening-study-controls {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex-wrap: wrap;
    }

    .opening-step-button {
      background: var(--gym-bg-card);
      color: var(--gym-text-main);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-sm);
      padding: 0.3rem 0.6rem;
      cursor: pointer;
    }

    /* SPEC: US-26 AC 9 / D-109: the Game Analysis -> Opening Drill bridge.
       A matching opening blunder offers a button (not a link: the position
       rides the app's consume-once due slot) naming the course, the line and
       its ECO. */
    .opening-bridge {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      margin-top: 0.5rem;
    }

    .opening-bridge-button {
      background: var(--gym-bg-card);
      color: var(--gym-text-main);
      border: 1px solid var(--gym-brand-accent);
      border-radius: var(--radius-sm);
      padding: var(--gym-space-1) 0.7rem;
      cursor: pointer;
    }

    /* SPEC: US-26 AC 10 / D-172 / D-174: the local nudge banner. It names a
       line (never a score) and is dismissed with the one v1 timestamp, so the
       schedule is not reset to hide it. */
    .opening-banner {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      flex-wrap: wrap;
      background: rgba(var(--gym-brand-accent-rgb), 0.12);
      border: 1px solid var(--gym-brand-accent);
      border-radius: var(--radius-md);
      padding: 0.6rem 0.8rem;
      margin-bottom: 1rem;
    }

    .opening-banner-text {
      flex: 1 1 18rem;
      font-size: var(--gym-text-sm);
    }

    .opening-banner-action {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 40px;
      background: transparent;
      color: var(--gym-text-main);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-sm);
      padding: 0 var(--gym-space-3);
      font: inherit;
      cursor: pointer;
    }

    .opening-banner-dismiss {
      background: transparent;
      color: var(--gym-text-muted);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-sm);
      padding: var(--gym-space-1) 0.7rem;
      cursor: pointer;
    }

    /* SPEC: US-26 AC 7, AC 10 / US-28 AC 6 / DR-5: the `/openings` course
       directory and the repertoire drill workspace at the design size. The
       cards and the HUD reuse the one `.gym-*` vocabulary (component-specs.md
       §5, §11); this block only removes the trainer's old page frame and
       stacks the shared workspace sidebar the way the drawing does. The board
       keeps the shared `min(84vh, 800px)` playing-surface cap (D-204). */
    .opening-page.gym-openings-container {
      background: transparent;
      border: 0;
      border-radius: 0;
      padding: 0;
      margin-bottom: 0;
    }

    /* The design draws three cards across the 1616px content column; five
       shipped courses wrap 3 + 2. Below the app-wide 768px breakpoint the
       directory is one column like every other multi-column workspace
       (US-28 AC 7; the designed mobile layout is D-T6). */
    .opening-page .gym-course-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    @media (max-width: 767px) {
      .opening-page .gym-course-grid {
        grid-template-columns: minmax(0, 1fr);
      }
    }

    .opening-page .gym-course-card {
      min-height: 0;
    }

    .opening-page .gym-course-meter-row {
      margin-top: auto;
    }

    .opening-page .gym-course-footer {
      flex-wrap: wrap;
      gap: 0.5rem;
    }

    .opening-page .gym-progress-bar {
      min-width: 8rem;
    }

    .opening-course-open {
      display: inline-flex;
      align-items: center;
      gap: var(--gym-space-1);
      min-height: 40px;
      padding: 0;
      background: transparent;
      border: 0;
      color: var(--gym-text-main);
      font: inherit;
      font-size: var(--gym-text-sm);
      font-weight: 600;
      cursor: pointer;
    }

    .opening-course-open:hover {
      color: var(--gym-brand-accent-fg);
    }

    .opening-course-open-chevron {
      display: inline-flex;
      transform: rotate(-90deg);
      color: var(--gym-text-muted);
    }

    .opening-header-meta {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--gym-space-2);
      margin-top: var(--gym-space-2);
    }

    .opening-drill .training-workspace-sidebar {
      padding: 0;
      gap: 0;
      overflow: hidden;
    }

    .opening-drill .training-workspace-sidebar > * {
      padding: var(--gym-space-3) var(--gym-space-4);
    }

    .opening-drill .training-workspace-sidebar > * + * {
      border-top: 1px solid var(--gym-border-subtle);
    }

    /* Screen 05 §2: the Hero Coaching Card is the first zone of the rail and
       the rail's one surface: every coaching state (study plan, quiz prompt,
       hint, nudge, refutation, completion) replaces another inside the same
       card. The reserved floor keeps the move table below it from jumping. */
    .opening-drill .coaching-slot {
      gap: var(--gym-space-2);
      min-height: 5.4rem;
      padding: var(--gym-space-4);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      background-color: var(--gym-bg-card);
    }

    /* Inside the card the plan note is a block of copy, not a second card. */
    .opening-drill .gym-drill-explainer {
      margin: 0;
      padding: 0;
      border: 0;
      border-radius: 0;
      background: transparent;
    }

    /* The next-line suggestion is part of the completion summary, not a second
       success card: a hairline block under the completion line. */
    .opening-drill #opening-bridge {
      padding: var(--gym-space-2) 0 0;
      border: 0;
      border-top: 1px solid var(--gym-border-subtle);
      border-radius: 0;
      background: transparent;
    }

    .opening-drill .gym-explainer-label {
      font-size: var(--gym-text-xs);
      font-weight: 600;
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }

    .opening-drill .gym-explainer-text {
      color: var(--gym-text-main);
      font-size: var(--gym-text-base);
      line-height: 1.5;
      max-width: 62ch;
    }

    /* The quiz lead is the card's headline; the study advice is a quiet note
       under the notation. */
    .opening-coach-lead {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-base);
      font-weight: 600;
      line-height: 1.4;
    }

    .opening-coach-note {
      margin: 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      line-height: 1.45;
    }

    .opening-sheet-meta {
      display: flex;
      align-items: center;
      gap: var(--gym-space-2);
    }

    .opening-drill .gym-headline {
      margin-top: 0.15rem;
    }

    .opening-drill .gym-section-header {
      margin-bottom: var(--gym-space-1);
    }

    .opening-drill .training-actions {
      flex-direction: column;
      margin-top: 0;
      padding-top: 0;
      border-top: 0;
    }

    .opening-drill .training-actions > * {
      width: 100%;
    }

    /* Screen 05 §1, §5: the two-phase control sits at the foot of the rail, just
       above `Back to Choose a line`. It is content width and quieter than the
       dock's actions: it is the way back to the study, not a task button. */
    .opening-drill .training-actions > .opening-phase-row {
      width: auto;
    }

    .opening-phase-row {
      display: flex;
      flex-basis: 100%;
    }

    .opening-phase-row .opening-phase-switch {
      align-self: flex-start;
    }

    @media (min-width: 768px) {
      .opening-phase-row .opening-phase-button {
        min-height: 32px;
      }
    }

    /* ------------------------------------------------------------------
       O-1 (Sprint 16): the screen-set opening surfaces. Rows, not cards;
       one accent action; the target card first on narrow and in the rail at
       tablet/desktop; the drill's coaching slot never moves the board.
       ------------------------------------------------------------------ */

    .opening-page .page-header-actions {
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: var(--gym-space-3);
    }

    .opening-page-actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--gym-space-3);
    }

    .opening-page-meta {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-3);
      align-items: baseline;
      margin-top: var(--gym-space-3);
    }

    .opening-summary {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      font-variant-numeric: tabular-nums;
    }

    .opening-catalogue-tools {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--gym-space-4);
      margin-bottom: var(--gym-space-4);
    }

    .opening-band-select-panel,
    .opening-band-compact {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--gym-space-2);
      max-width: 100%;
      padding: 0;
      margin: 0;
      background: transparent;
      border: 0;
    }

    .opening-band-select {
      min-height: 40px;
      min-width: 12rem;
      padding: 0 var(--gym-space-3);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      background: var(--gym-bg-input);
      color: var(--gym-text-main);
      font: inherit;
      font-size: var(--gym-text-sm);
      cursor: pointer;
    }

    .opening-band-select-panel .opening-band-default,
    .opening-band-compact .opening-band-default {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .opening-band-select-panel .opening-band-note,
    .opening-band-compact .opening-band-note {
      flex-basis: 100%;
      margin: 0;
      color: var(--gym-text-dim);
      font-size: var(--gym-text-xs);
    }

    .opening-band-scope {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .opening-due-strip {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--gym-space-4);
      padding: var(--gym-space-4);
      margin-bottom: var(--gym-space-4);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-md);
      background: var(--gym-bg-input);
    }

    .opening-due-strip-primary {
      border-color: var(--gym-brand-accent-fg);
      background: rgba(var(--gym-brand-accent-rgb), 0.08);
    }

    .opening-due-strip-copy {
      min-width: 0;
    }

    .opening-due-strip-title {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-base);
      font-weight: 700;
    }

    .opening-due-strip-detail {
      margin: 0.15rem 0 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .opening-due-strip .opening-due-start {
      flex: none;
      min-height: 40px;
      margin: 0;
      border-radius: var(--gym-radius-control);
    }

    .opening-catalogue-heading {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      justify-content: space-between;
      gap: var(--gym-space-2);
      margin-bottom: var(--gym-space-2);
    }

    .opening-course-rows {
      display: flex;
      flex-direction: column;
      border-top: 1px solid var(--gym-border-subtle);
    }

    /* SPEC: US-26 AC 7 / design/screens §03: a course is a flat row divided by
       hairlines, not an equal card. This is the one base rule for the row; the
       card chrome once repeated above it must not survive the cascade. */
    .opening-course-row {
      display: grid;
      grid-template-columns: 96px minmax(0, 1fr) 300px auto;
      align-items: center;
      gap: var(--gym-space-4);
      padding: var(--gym-space-4) 0;
      border: 0;
      border-bottom: 1px solid var(--gym-border-subtle);
      border-radius: 0;
      background: transparent;
    }

    .opening-trunk-board {
      width: 96px;
      aspect-ratio: 1 / 1;
      overflow: hidden;
      border: 1px solid var(--gym-board-frame);
      border-radius: var(--radius-sm);
      background: var(--gym-board-light);
    }

    .opening-trunk-board svg {
      display: block;
      width: 100%;
      height: 100%;
    }

    .opening-course-identity {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      gap: var(--gym-space-1) var(--gym-space-3);
      min-width: 0;
    }

    .opening-course-identity .opening-course-name {
      flex-basis: 100%;
      margin: 0;
      font-size: var(--gym-text-lg);
    }

    .opening-course-badge {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      padding: 0 var(--gym-space-2);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-sm);
      background: var(--gym-bg-active-row);
      color: var(--gym-text-main);
      font-size: var(--gym-text-xs);
      font-weight: 600;
    }

    .opening-course-counts,
    .opening-course-trunk {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-variant-numeric: tabular-nums;
    }

    .opening-course-trunk {
      font-family: var(--font-mono);
    }

    .opening-course-stats {
      display: flex;
      flex-direction: column;
      gap: 0.3rem;
      min-width: 0;
    }

    .opening-solid-meter {
      width: 100%;
      height: 6px;
      overflow: hidden;
      border-radius: var(--radius-full);
      background: var(--gym-bg-active-row);
    }

    .opening-solid-fill {
      height: 100%;
      border-radius: var(--radius-full);
      background: var(--gym-text-muted);
    }

    .opening-solid-label,
    .opening-course-mastery {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-variant-numeric: tabular-nums;
    }

    .opening-course-review {
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      font-weight: 600;
    }

    .opening-course-review.opening-course-fresh {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      color: var(--gym-text-muted);
      font-weight: 500;
    }

    .opening-course-row .opening-course-open {
      min-height: 40px;
      padding: 0 var(--gym-space-3);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      background: transparent;
      color: var(--gym-text-main);
      white-space: nowrap;
    }

    .opening-course-row .opening-course-open:hover {
      background: var(--gym-bg-card-hover);
      color: var(--gym-text-main);
    }

    .opening-breadcrumb {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--gym-space-2);
      margin-bottom: var(--gym-space-3);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .opening-breadcrumb-separator {
      color: var(--gym-text-dim);
    }

    .opening-breadcrumb-current {
      color: var(--gym-text-main);
    }

    .opening-breadcrumb-link {
      padding: 0;
      border: 0;
      background: transparent;
      color: var(--gym-text-muted);
      font: inherit;
      cursor: pointer;
    }

    .opening-breadcrumb-link:hover {
      color: var(--gym-text-main);
    }

    .opening-picker-intro {
      margin: 0 0 var(--gym-space-3);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      max-width: 52ch;
    }

    .opening-phase-switch {
      display: flex;
      flex-wrap: wrap;
      gap: 0.25rem;
      padding: 0.2rem;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      background: var(--gym-bg-input);
    }

    .opening-phase-button {
      min-height: 40px;
      padding: 0 var(--gym-space-3);
      border: 1px solid transparent;
      border-radius: var(--radius-sm);
      background: transparent;
      color: var(--gym-text-muted);
      font: inherit;
      font-size: var(--gym-text-xs);
      font-weight: 600;
      cursor: pointer;
    }

    .opening-phase-button-active {
      border-color: var(--gym-border-selected);
      background: var(--gym-bg-active-row);
      color: var(--gym-text-main);
    }

    .opening-phase-button:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }

    .opening-path-chip {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      padding: 0 var(--gym-space-2);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-full);
      background: var(--gym-bg-input);
      color: var(--gym-text-main);
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
    }

    .opening-traps-section {
      margin-top: var(--gym-space-6);
      padding-top: var(--gym-space-4);
      border-top: 1px solid var(--gym-border-subtle);
    }

    .opening-traps-section .opening-traps-header {
      align-items: flex-start;
    }

    .opening-traps-count {
      color: var(--gym-text-muted);
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
    }

    .opening-trap-row,
    .opening-trap-course-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto auto;
      align-items: center;
      gap: var(--gym-space-3);
      padding: var(--gym-space-3) 0;
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .opening-trap-course-row .opening-trap-detail {
      justify-self: end;
    }

    .opening-trap-copy {
      display: flex;
      flex-direction: column;
      gap: 0.2rem;
      min-width: 0;
    }

    .opening-trap-label {
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      font-weight: 600;
    }

    .opening-trap-detail {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      overflow-wrap: anywhere;
    }

    .opening-trap-rate {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }

    .opening-trap-practise {
      min-height: 40px;
      padding: 0 var(--gym-space-3);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-sm);
      background: var(--gym-bg-input);
      color: var(--gym-text-main);
      font: inherit;
      font-size: var(--gym-text-sm);
      cursor: pointer;
    }

    .opening-anonymous-graduation {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--gym-space-3);
      padding-top: var(--gym-space-2);
      border-top: 1px solid var(--gym-border-subtle);
    }

    .opening-anonymous-graduation p {
      flex: 1 1 18rem;
      margin: 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .opening-tree-rate {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
      margin-left: auto;
    }

    @media (min-width: 768px) {
      .opening-tree {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        grid-template-areas:
          "heading heading"
          "intro intro"
          "path path"
          "meta meta"
          "branches line";
        column-gap: var(--gym-space-6);
        row-gap: var(--gym-space-3);
        align-items: start;
      }

      .opening-tree-heading { grid-area: heading; }
      .opening-tree-intro { grid-area: intro; }
      .opening-tree-path { grid-area: path; }
      .opening-tree-meta { grid-area: meta; }
      .opening-tree-branches { grid-area: branches; }
      .opening-tree-shortest {
        position: sticky;
        top: var(--gym-space-4);
        grid-area: line;
      }
    }

    @media (min-width: 1101px) {
      .opening-tree {
        grid-template-columns: minmax(0, 1fr) 400px;
      }
    }

    @media (max-width: 767px) {
      .opening-page .page-title {
        font-size: var(--gym-text-xl);
      }

      .opening-page .page-header-actions {
        justify-content: stretch;
        width: 100%;
      }

      .opening-page .page-header-actions > * {
        flex: 1 1 100%;
      }

      .opening-page .page-header-actions .opening-band-compact {
        width: 100%;
      }

      .opening-page button,
      .opening-page select,
      .opening-page .opening-tree-crumb {
        min-height: 40px;
      }

      .opening-page .control-bar-button {
        min-width: 44px;
        min-height: 44px;
      }

      .opening-drill .gym-btn-sm,
      .opening-page .gym-btn-sm {
        min-height: 40px;
      }

      .opening-course-row {
        grid-template-columns: 96px minmax(0, 1fr);
        align-items: start;
      }

      .opening-course-stats,
      .opening-course-row .opening-course-open {
        grid-column: 1 / -1;
      }

      .opening-course-row .opening-course-open {
        width: 100%;
      }

      .opening-due-strip {
        align-items: stretch;
        flex-direction: column;
      }

      .opening-due-strip .opening-due-start {
        width: 100%;
      }

      .opening-trap-row,
      .opening-trap-course-row {
        grid-template-columns: minmax(0, 1fr) auto;
      }

      .opening-trap-copy,
      .opening-trap-course-row .opening-trap-detail {
        grid-column: 1 / -1;
        justify-self: start;
      }

      .opening-trap-practise {
        grid-column: 1 / -1;
        width: 100%;
      }

      .opening-trap-course-row .opening-trap-label {
        grid-column: 1 / -1;
      }

    }

    @media (max-width: 390px) {
      .opening-course-row {
        grid-template-columns: 72px minmax(0, 1fr);
      }

      .opening-trunk-board {
        width: 72px;
      }

      .opening-course-identity .opening-course-name {
        font-size: var(--gym-text-base);
      }

      .opening-band-select {
        min-width: 0;
        width: 100%;
      }
    }

    /* SPEC: US-27 AC 5: the shared training workspace. Mobile first: a single
       column of at most 480px, board and its control bar first in flow, then
       the four sidebar zones. The coaching slot is always mounted with a
       reserved height, so a state transition never shifts the board. */
    .training-workspace {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      width: 100%;
      margin: 0 auto;
    }

    .training-workspace-board {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      width: 100%;
      /* SPEC: US-31 / docs/DESIGN.md: the training board is capped at 720px
         (the playing surface); the frame adds 9px a side, so the board-and-bar
         group caps at 738 and is centred in its column. */
      max-width: min(calc(84vh + 18px), 738px);
      margin: 0 auto;
      min-width: 0;
    }

    /* SPEC: US-31 / docs/DESIGN.md: the board-and-bar group is the capped
       element (see `.training-workspace-board`); the frame fills it with 9px
       a side (8px padding + 1px border), so 720 surface yields a 738 frame. */
    .training-board-frame {
      padding: 0.5rem;
      border: 1px solid var(--gym-board-frame);
      border-radius: var(--radius-md);
      background: linear-gradient(180deg, var(--gym-board-light), var(--gym-board-dark));
      width: 100%;
      max-width: 100%;
      aspect-ratio: 1 / 1;
    }

    /* SPEC: US-31 / docs/DESIGN.md: the playing surface (the squares) is the
       720px-capped element on desktop and always 1 / 1; below 768 it is the
       container width. */
    .training-board-frame .board-canvas-wrapper {
      width: min(84vh, 720px);
      max-width: 100%;
      height: auto;
      aspect-ratio: 1 / 1;
      margin: 0 auto;
    }

    .training-workspace-sidebar {
      display: flex;
      flex-direction: column;
      gap: 0.6rem;
      padding: 0.75rem;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      background-color: var(--gym-bg-card);
      min-width: 0;
    }

    .training-header-slot {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-1);
      min-width: 0;
    }

    .training-title {
      font-size: var(--gym-text-base);
      font-weight: 600;
      color: var(--gym-text-main);
    }

    .training-pills {
      display: flex;
      flex-wrap: wrap;
      gap: 0.3rem;
    }
    /* Screen 05 §6: the board-header strip. It rides above the board inside the
       board column, so the rail below the strip is coaching first. One line at
       every width; the identity yields before the drill state does. */
    .training-board-header {
      display: flex;
      width: 100%;
      min-width: 0;
    }

    .opening-board-strip {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--gym-space-3);
      width: 100%;
      min-width: 0;
      min-height: 28px;
    }

    .opening-board-strip-id {
      min-width: 0;
      max-width: 45%;
      overflow: hidden;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .opening-board-strip-status {
      display: flex;
      align-items: center;
      gap: var(--gym-space-2);
      min-width: 0;
      white-space: nowrap;
    }

    .opening-board-strip-status .side-to-move-badge,
    .opening-board-strip-status .training-pill {
      white-space: nowrap;
    }

    .opening-drill-state {
      overflow: hidden;
      color: var(--gym-text-main);
      font-size: var(--gym-text-xs);
      font-weight: 600;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    /* Phone: the identity takes its own line so the state row never squeezes a
       badge into two lines. Both rows are always present, so the board position
       does not depend on the state text. */
    @media (max-width: 767px) {
      .opening-board-strip {
        flex-wrap: wrap;
        row-gap: var(--gym-space-1);
      }

      .opening-board-strip-id {
        flex-basis: 100%;
        max-width: 100%;
      }
    }


    .training-pill {
      display: inline-flex;
      align-items: center;
      padding: 0.1rem var(--gym-space-2);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-full);
      background-color: var(--gym-bg-input);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-family: var(--font-mono);
    }

    .side-to-move-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      padding: 0.15rem 0.5rem;
      border-radius: var(--radius-full);
      border: 1px solid var(--gym-border-card);
      background-color: var(--gym-bg-active-row);
      color: var(--gym-text-main);
      font-size: var(--gym-text-xs);
      font-weight: 600;
    }

    /* The always-mounted coaching/feedback slot: a fixed floor keeps the
       sidebar (and therefore every other zone) from changing height when a
       prompt, hint, notice or completion summary replaces another in place. */
    .coaching-slot {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-1);
      min-height: 5.4rem;
      overflow-y: auto;
    }

    .coaching-prompt {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      margin: 0;
    }

    /* SPEC: US-31 / design/screens §06: the canonical playing prompt is one
       readable line; the anti-signposting sentence is the quieter supporting
       line beside it. */
    .puzzle-coaching-prompt {
      color: var(--gym-text-main);
    }

    .puzzle-coaching-signpost {
      color: var(--gym-text-muted);
      font-weight: 600;
    }

    .training-move-table-slot {
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
      min-height: 0;
    }

    .training-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem;
      margin-top: auto;
      padding-top: 0.5rem;
      border-top: 1px solid var(--gym-border-card);
    }

    /* The one Board Control Bar (SPEC: US-27 AC 6). */
    .board-control-bar {
      display: flex;
      align-items: center;
      gap: 0.3rem;
      flex-wrap: wrap;
      padding: var(--gym-space-1);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      background-color: var(--gym-bg-input);
    }

    .control-bar-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 2rem;
      padding: 0.3rem 0.5rem;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-sm);
      background-color: var(--gym-bg-card);
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      font-weight: 600;
      cursor: pointer;
    }

    .control-bar-button:hover:not(:disabled) {
      background-color: var(--gym-bg-card-hover);
      border-color: var(--gym-brand-accent-fg);
    }

    .control-bar-button:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }

    /* SPEC: US-28 AC 2 / design/screens §05: the pressed Flip is a state, not
       an action; it takes the neutral selected-row surface, never accent. */
    .control-bar-flip[aria-pressed="true"] {
      border-color: var(--gym-border-card);
      background-color: var(--gym-bg-card-hover);
    }

    .control-bar-flip[aria-pressed="true"]:hover:not(:disabled) {
      border-color: var(--gym-border-card);
      background-color: var(--gym-bg-card-hover);
    }

    .training-live-banner {
      margin-left: auto;
      padding: 0.3rem var(--gym-space-3);
      border: 1px solid var(--gym-eval-inaccuracy);
      border-radius: var(--radius-full);
      background-color: rgba(var(--gym-eval-inaccuracy-rgb), 0.14);
      color: var(--gym-eval-inaccuracy-text);
      font-size: var(--gym-text-xs);
      font-weight: 600;
      cursor: pointer;
    }

    /* The two-column numbered move table (SPEC: US-27 AC 5). */
    .move-table {
      display: flex;
      flex-direction: column;
      gap: 0.15rem;
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
    }

    .move-table-start {
      align-self: flex-start;
      padding: 0.12rem 0.4rem;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-sm);
      background-color: var(--gym-bg-input);
      color: var(--gym-text-muted);
      font: inherit;
      cursor: pointer;
    }

    .move-table-row {
      display: grid;
      grid-template-columns: 2rem minmax(0, 1fr) minmax(0, 1fr);
      align-items: center;
      gap: 0.2rem;
    }

    .move-table-number {
      color: var(--gym-text-dim);
      text-align: right;
      padding-right: 0.2rem;
    }

    .move-table-cell {
      display: block;
      width: 100%;
      padding: 0.12rem var(--gym-space-1);
      border: 1px solid transparent;
      border-radius: var(--radius-sm);
      background-color: transparent;
      color: var(--gym-text-main);
      font: inherit;
      text-align: left;
      cursor: pointer;
    }

    .move-table-cell:hover {
      background-color: var(--gym-bg-card-hover);
    }

    .move-table-cell-active {
      border-color: var(--gym-border-card);
      /* SPEC: US-28 / DESIGN §06: the current ply and the current row are
         neutral state, never the brand accent; accent is reserved for the one
         action. */
      background-color: var(--gym-bg-active-row);
      color: var(--gym-text-main);
    }

    .move-table-empty {
      cursor: default;
    }

    /* SPEC: US-31 / DESIGN §06: the session's flat composition. The board and
       the rail are divided by hairlines, with no rounded card around either;
       the rail holds 400px including its 24px inner gutter, so the action dock
       spans the designed 376px. */
    .training-workspace-flat {
      gap: 0;
      max-width: 100%;
    }

    .training-workspace-flat .training-workspace-sidebar {
      padding: var(--gym-space-5) 0 0;
      border: 0;
      border-top: 1px solid var(--gym-border-subtle);
      border-radius: 0;
      background: transparent;
      max-height: none;
      overflow: visible;
    }

    .training-workspace-flat .training-actions {
      flex-direction: column;
      align-items: stretch;
      gap: var(--gym-space-2);
    }

    .training-workspace-flat .training-actions .gym-btn-primary,
    .training-workspace-flat .training-actions .gym-btn-secondary {
      width: 100%;
      justify-content: center;
      min-height: 40px;
    }

    @media (min-width: 768px) {
      /* SPEC: US-31 / docs/DESIGN.md: tablet (768–1100) is 1fr + 320; the board
         group's own 738px cap centres the board inside its 1fr column. */
      .training-workspace {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        align-items: start;
        justify-content: center;
        gap: 2rem;
        width: 100%;
        max-width: 1290px;
        margin: 0 auto;
      }

      .training-workspace-sidebar {
        align-self: stretch;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
      }

      .training-workspace-flat {
        grid-template-columns: minmax(0, 1fr) 320px;
        gap: 0;
        max-width: 100%;
      }

      .training-workspace-flat .training-workspace-sidebar {
        padding: 0;
        /* The rail is 400px; the 1px hairline plus a 23px gutter (the 24px
           step less the hairline) leaves the designed 376px action dock. */
        padding-left: calc(var(--gym-space-5) - 1px);
        border-top: 0;
        border-left: 1px solid var(--gym-border-subtle);
      }
    }

    @media (min-width: 1101px) {
      /* SPEC: US-31 / docs/DESIGN.md: wide desktop is 1fr + 400. */
      .training-workspace {
        grid-template-columns: minmax(0, 1fr) 400px;
      }

      .training-workspace-flat {
        grid-template-columns: minmax(0, 1fr) 400px;
      }
    }

    /* The rating chip on the puzzle page carries a number beside a theme list. */
    .puzzle-library-rating {
      font-family: var(--font-mono);
      color: var(--gym-text-muted);
    }

    /* SPEC: US-31 / DESIGN §06: the session band is the page header for the
       flat mount: breadcrumb, 40/28px title, meta chips and progress. */
    .session-band {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      grid-template-rows: auto auto;
      align-items: end;
      column-gap: var(--gym-space-5);
      row-gap: var(--gym-space-3);
      padding-bottom: var(--gym-space-5);
      margin-bottom: var(--gym-space-5);
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .session-breadcrumb {
      grid-column: 1 / -1;
      display: flex;
      align-items: center;
      gap: var(--gym-space-1);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .session-breadcrumb a {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      color: var(--gym-text-muted);
    }

    .session-breadcrumb a:hover {
      color: var(--gym-text-main);
    }

    .session-band-main {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-3);
      min-width: 0;
    }

    .session-chips {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-2);
    }

    .session-chip {
      display: inline-flex;
      align-items: center;
      padding: 4px 10px;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-chip);
      background: var(--gym-bg-active-row);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .session-progress {
      display: flex;
      align-items: center;
      gap: var(--gym-space-2);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      white-space: nowrap;
    }

    .session-progress-track {
      display: inline-block;
      width: 96px;
      height: 2px;
      background: var(--gym-border-subtle);
      overflow: hidden;
    }

    .session-progress-fill {
      display: block;
      height: 100%;
      background: var(--gym-text-main);
    }

    .session-progress-count {
      color: var(--gym-text-main);
    }

    @media (max-width: 767px) {
      .session-band {
        grid-template-columns: 1fr;
      }

      .session-progress {
        margin-left: 0;
      }
    }

    /* SPEC: US-31 / DESIGN §06: a revealed motif is a lesson, not move
       feedback or an action; the chip row is neutral. */
    .puzzle-motif-reveal {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-2);
    }

    .puzzle-motif-reveal-note {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-3);
      margin: 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .puzzle-motif-chips {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-2);
    }

    .puzzle-motif-chip {
      display: inline-flex;
      align-items: center;
      padding: 4px 10px;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-chip);
      background-color: var(--gym-bg-active-row);
      color: var(--gym-text-main);
      font-size: var(--gym-text-xs);
    }

    .puzzle-session-stats {
      margin: var(--gym-space-2) 0 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .puzzle-session-flat {
      gap: 0;
    }

    /* ==========================================================================
       SPEC: US-28 AC 3 — tabular numerals on every numeric surface.
       A number that changes width (a move number, an evaluation, a rating, a
       blunder count, an elapsed timer) must not shift the columns beside it.
       One grouped rule: a new numeric surface is one selector away from the
       same treatment. `font-variant-numeric` is the property that matters;
       `font-feature-settings: "tnum" 1` is the same feature requested
       explicitly, as the DR-1 token spec states.
       ========================================================================== */
    .move-table,
    .move-table-number,
    .move-table-cell,
    .gym-progress-table,
    .pv-status-row,
    .stepper-status,
    .puzzle-library-rating,
    .gym-progress-kpi-value,
    .blunder-count-pill,
    .badge-counter,
    .step-counter,
    .delta-badge,
    .move-tile-value,
    .badge-eval-critical,
    .badge-eval-severe,
    .badge-eval-moderate,
    .opening-study-step,
    .opening-completion-fact,
    .gym-eval-badge,
    .gym-blunder-count-badge,
    .gym-breakdown-count,
    .gym-eval-delta,
    .gym-tabular-demo,
    .gym-num {
      font-variant-numeric: tabular-nums;
      font-feature-settings: "tnum" 1;
    }

    /* ==========================================================================
       Sprint 13: Chess Gym Design Tokens & Prototype Styles (T-02 / T-03)
       ========================================================================== */

    .gym-preview-container {
      max-width: 1140px;
      margin: 0 auto;
      padding: 0 1.25rem 5rem 1.25rem;
      width: 100%;
      box-sizing: border-box;
      font-family: var(--font-family);
      color: var(--gym-text-main);
    }

    .gym-preview-container.gym-wide {
      max-width: 1680px;
    }

    .gym-preview-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0.75rem 1.25rem;
      background-color: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--radius-md);
      margin-bottom: 1rem;
    }

    .gym-brand {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .gym-brand-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      height: 28px;
      color: var(--gym-brand-accent-fg);
    }

    .gym-brand-titles {
      display: flex;
      flex-direction: column;
    }

    .gym-brand-name {
      font-weight: 800;
      font-size: var(--gym-text-lg);
      letter-spacing: -0.01em;
      color: var(--gym-text-main);
    }

    .gym-brand-tagline {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
      letter-spacing: normal;
      text-transform: none;
    }

    .gym-preview-nav {
      display: flex;
      gap: 0.5rem;
    }

    .gym-nav-item {
      padding: var(--gym-space-1) var(--gym-space-3);
      border-radius: 6px;
      font-size: var(--gym-text-sm);
      color: var(--gym-text-muted);
      cursor: pointer;
      background: transparent;
      border: none;
      transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    }

    .gym-nav-item:hover {
      color: var(--gym-text-main);
      background-color: var(--gym-bg-card);
    }

    .gym-nav-active {
      background-color: var(--gym-bg-card);
      color: var(--gym-brand-accent-fg);
      font-weight: 600;
      border: 1px solid var(--gym-border-subtle);
    }

    .gym-user-badge {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .gym-user-name {
      font-size: var(--gym-text-sm);
      color: var(--gym-text-muted);
      font-family: var(--font-mono);
    }

    .gym-settings-cog {
      background: transparent;
      border: 1px solid var(--gym-border-subtle);
      color: var(--gym-text-muted);
      width: 32px;
      height: 32px;
      border-radius: 6px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: var(--gym-text-base);
      transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    }

    .gym-settings-cog:hover {
      color: var(--gym-text-main);
      border-color: var(--gym-border-strong);
      background-color: var(--gym-bg-card);
    }

    .gym-token-matrix {
      background-color: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--radius-md);
      padding: 0.9rem 1.25rem;
      margin-bottom: 1.25rem;
    }

    .gym-token-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      cursor: pointer;
    }

    .gym-section-title {
      font-size: var(--gym-text-sm);
      font-weight: 700;
      color: var(--gym-brand-accent-fg);
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

    .gym-pill-toggle {
      background: transparent;
      border: 1px solid var(--gym-border-subtle);
      color: var(--gym-text-muted);
      padding: 0.2rem 0.6rem;
      border-radius: 4px;
      font-size: var(--gym-text-xs);
      cursor: pointer;
    }

    .gym-pill-toggle:hover {
      background-color: var(--gym-bg-card);
      color: var(--gym-text-main);
    }

    .gym-token-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 0.75rem;
      margin-top: 0.75rem;
      padding-top: 0.75rem;
      border-top: 1px solid var(--gym-border-subtle);
    }

    .gym-token-card {
      background-color: var(--gym-bg-card);
      border: 1px solid var(--gym-border-subtle);
      border-radius: 6px;
      padding: var(--gym-space-3) 0.75rem;
    }

    .gym-token-label {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-dim);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      display: block;
      margin-bottom: 0.4rem;
      font-weight: 600;
    }

    .gym-swatch-row {
      display: flex;
      gap: var(--gym-space-1);
    }

    .gym-swatch {
      flex: 1;
      padding: var(--gym-space-1) 0.2rem;
      text-align: center;
      font-size: var(--gym-text-xs);
      font-family: var(--font-mono);
      border-radius: 4px;
      border: 1px solid var(--gym-border-subtle);
    }

    .swatch-app { background: var(--gym-bg-app); color: var(--gym-text-muted); }
    .swatch-surface { background: var(--gym-bg-surface); color: var(--gym-text-main); }
    .swatch-card { background: var(--gym-bg-card); color: var(--gym-text-main); }
    .swatch-accent { background: var(--gym-brand-accent); color: var(--gym-brand-ink); font-weight: 700; }
    .swatch-accent-hover { background: var(--gym-brand-accent-hover); color: var(--gym-brand-ink); font-weight: 700; }
    .swatch-green { background: var(--gym-chess-green); color: var(--gym-bg-app); font-weight: 700; }

    .gym-badge-row {
      display: flex;
      flex-wrap: wrap;
      gap: 0.3rem;
    }

    .gym-eval-badge {
      font-size: var(--gym-text-xs);
      font-weight: 600;
      padding: 0.15rem 0.4rem;
      border-radius: 4px;
    }

    .badge-brilliant { background: var(--gym-eval-brilliant-bg); color: var(--gym-eval-brilliant-text); border: 1px solid rgba(var(--gym-eval-brilliant-rgb), 0.4); }
    .badge-best { background: var(--gym-eval-best-bg); color: var(--gym-eval-best-text); border: 1px solid rgba(var(--gym-eval-best-rgb), 0.4); }
    .badge-book { background: var(--gym-eval-book-bg); color: var(--gym-eval-book-text); border: 1px solid rgba(var(--gym-eval-book-rgb), 0.4); }

    /* SPEC: US-33: the chart's filter summary is a neutral chip, never an
       evaluation colour or the accent action. */
    .gym-chart-neutral-badge {
      background: var(--gym-bg-active-row);
      color: var(--gym-text-muted);
      border: 1px solid var(--gym-border-subtle);
    }
    .badge-inaccuracy { background: var(--gym-eval-inaccuracy-bg); color: var(--gym-eval-inaccuracy-text); border: 1px solid rgba(var(--gym-eval-inaccuracy-rgb), 0.4); }
    .badge-mistake { background: var(--gym-eval-mistake-bg); color: var(--gym-eval-mistake-text); border: 1px solid rgba(var(--gym-eval-mistake-rgb), 0.4); }
    .badge-blunder { background: var(--gym-eval-blunder-bg); color: var(--gym-eval-blunder-text); border: 1px solid rgba(var(--gym-eval-blunder-rgb), 0.4); }

    .gym-tabular-demo {
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
    }

    .gym-tab-row {
      display: flex;
      justify-content: space-between;
      font-size: var(--gym-text-xs);
      font-variant-numeric: tabular-nums;
      font-feature-settings: "tnum" 1;
    }

    .gym-num { font-family: var(--font-mono); color: var(--gym-chess-green); }
    .gym-neg { color: var(--gym-eval-blunder-small); }

    /* ==========================================================================
       Synthesized Workspace Layout (Wide, Large Board, Space-Efficient Trays)
       ========================================================================== */

    .gym-analysis-container {
      display: flex;
      flex-direction: column;
      gap: 1.25rem;
    }

    /* Ingestion Console */
    .gym-ingest-console {
      background-color: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      padding: 1rem 1.25rem;
    }

    .gym-ingest-fields {
      display: flex;
      flex-wrap: wrap;
      gap: 1rem;
      align-items: flex-end;
    }

    .gym-field-group {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-1);
    }

    .gym-field-grow {
      flex: 1;
      min-width: 180px;
    }

    .gym-field-label {
      font-size: var(--gym-text-xs);
      font-weight: 700;
      color: var(--gym-text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    .gym-platform-pills {
      display: flex;
      gap: 0.3rem;
    }

    .gym-pill-opt {
      background-color: var(--gym-bg-card);
      border: 1px solid var(--gym-border-subtle);
      color: var(--gym-text-muted);
      padding: 0.42rem 0.8rem;
      border-radius: 6px;
      font-size: var(--gym-text-sm);
      cursor: pointer;
      font-weight: 600;
      transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    }

    .gym-pill-opt:hover {
      color: var(--gym-text-main);
      background-color: var(--gym-bg-card-hover);
    }

    .gym-pill-selected {
      background-color: var(--gym-brand-accent) !important;
      color: var(--gym-brand-ink) !important;
      font-weight: 700;
      border-color: var(--gym-brand-accent-fg) !important;
    }

    .gym-input-text {
      background-color: var(--gym-bg-input);
      border: 1px solid var(--gym-border-card);
      color: var(--gym-text-main);
      padding: 0.42rem 0.75rem;
      border-radius: 6px;
      font-size: var(--gym-text-sm);
      font-family: var(--font-mono);
    }

    .gym-input-text::placeholder {
      color: var(--gym-text-muted);
      opacity: 1;
    }

    .gym-input-text:focus {
      border-color: var(--gym-brand-accent-fg);
    }

    .gym-select {
      background-color: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      color: var(--gym-text-main);
      padding: 0.42rem 0.75rem;
      border-radius: 6px;
      font-size: var(--gym-text-sm);
      cursor: pointer;
    }

    .gym-field-submit {
      margin-left: auto;
    }

    .gym-btn-wide {
      padding: 0.55rem 1.25rem;
      white-space: nowrap;
    }

    .gym-val-danger { color: var(--gym-eval-blunder-small); }

    .gym-val-accent { color: var(--gym-brand-accent-fg); }

    /* Games Breakdown Accordion */
    .gym-games-breakdown {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }

    .gym-breakdown-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding-bottom: 0.5rem;
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .gym-breakdown-title {
      font-size: var(--gym-text-base);
      font-weight: 700;
      color: var(--gym-text-main);
    }

    .gym-breakdown-count {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
      font-variant-numeric: tabular-nums;
    }

    .gym-games-list {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-3);
    }

    .gym-game-row {
      background-color: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      overflow: hidden;
      transition: border-color 0.15s ease;
    }

    .gym-game-row:hover {
      border-color: var(--gym-border-hover);
    }

    .gym-game-meta {
      padding: var(--gym-space-3) var(--gym-space-4);
      display: flex;
      align-items: center;
      gap: var(--gym-space-3);
      cursor: pointer;
    }

    .gym-result-chip {
      font-size: var(--gym-text-xs);
      font-weight: 800;
      padding: 0.15rem var(--gym-space-2);
      border-radius: 4px;
      font-family: var(--font-mono);
    }

    .chip-win {
      background: rgba(var(--gym-eval-best-rgb), 0.2);
      color: var(--gym-chess-green);
      border: 1px solid rgba(var(--gym-eval-best-rgb), 0.4);
    }

    .chip-loss {
      background: rgba(var(--gym-eval-blunder-rgb), 0.2);
      color: var(--gym-eval-blunder-small);
      border: 1px solid rgba(var(--gym-eval-blunder-rgb), 0.4);
    }

    .chip-draw {
      background: rgba(var(--gym-text-muted-rgb), 0.2);
      color: var(--gym-text-muted);
      border: 1px solid rgba(var(--gym-text-muted-rgb), 0.4);
    }

    .gym-game-players {
      font-size: var(--gym-text-sm);
      font-weight: 600;
      color: var(--gym-text-main);
    }

    .gym-game-tc {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
    }

    .gym-blunder-count-badge {
      margin-left: auto;
      font-size: var(--gym-text-xs);
      font-weight: 700;
      color: var(--gym-eval-blunder-small);
      background: rgba(var(--gym-eval-blunder-rgb), 0.15);
      border: 1px solid rgba(var(--gym-eval-blunder-rgb), 0.3);
      padding: 0.15rem 0.55rem;
      border-radius: 9999px;
    }

    .gym-clean-badge {
      margin-left: auto;
      font-size: var(--gym-text-xs);
      font-weight: 600;
      color: var(--gym-chess-green);
    }

    .gym-expand-chevron {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
      margin-left: 0.5rem;
    }

    .gym-game-inspector {
      padding: var(--gym-space-4);
      border-top: 1px solid var(--gym-border-subtle);
      background-color: var(--gym-bg-panel);
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }

    .gym-blunder-pill-selector {
      display: flex;
      gap: 0.5rem;
      flex-wrap: wrap;
    }

    .gym-b-pill {
      background-color: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
      padding: var(--gym-space-1) 0.75rem;
      border-radius: 6px;
      cursor: pointer;
    }

    .gym-b-pill:hover {
      background-color: var(--gym-bg-card-hover);
      color: var(--gym-text-main);
    }

    .gym-b-active {
      background-color: rgba(var(--gym-eval-blunder-rgb), 0.2) !important;
      color: var(--gym-eval-blunder-small) !important;
      border-color: rgba(var(--gym-eval-blunder-rgb), 0.4) !important;
    }

    /* Shared Workspace Grid */
    .gym-workspace-grid {
      display: grid;
      grid-template-columns: minmax(auto, min(84vh, 800px)) minmax(340px, 440px);
      gap: 2rem;
      align-items: start;
      justify-content: center;
    }

    .gym-board-wrapper {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      min-width: 0;
    }

    .gym-board-box {
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      background-color: var(--gym-bg-surface);
      padding: 8px;
      box-shadow: var(--gym-shadow-raised);
      width: 100%;
      box-sizing: border-box;
    }

    .gym-board-box .board-canvas-wrapper,
    .gym-board-wrapper .board-canvas-wrapper,
    .gym-analysis-board-col .board-canvas-wrapper {
      max-width: 100% !important;
      width: 100% !important;
      height: auto !important;
    }

    /* SPEC: US-28 AC 5 / DESIGN.md: the analysis board is capped at 720px and
       always square; the grid column caps it too, so the board never outgrows
       its arena at any viewport. */
    .gym-analysis-board-col .board-canvas-wrapper {
      width: 100% !important;
      max-width: min(720px, 100%) !important;
      height: auto !important;
      aspect-ratio: 1 / 1;
    }

    .gym-sidebar-panel {
      display: flex;
      flex-direction: column;
      background-color: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      overflow: hidden;
      min-width: 0;
    }

    .gym-panel-section {
      padding: var(--gym-space-3) var(--gym-space-4);
      border-bottom: 1px solid var(--gym-border-subtle);
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-2);
    }

    .gym-panel-section:last-child {
      border-bottom: none;
    }

    .gym-hud-pill-row {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex-wrap: wrap;
    }

    .gym-hud-motif {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
      font-weight: 500;
    }

    .gym-eval-delta {
      margin-left: auto;
      font-size: var(--gym-text-sm);
      font-weight: 700;
      font-variant-numeric: tabular-nums;
      color: var(--gym-eval-blunder-small);
    }

    .gym-headline {
      font-size: var(--gym-text-base);
      font-weight: 700;
      color: var(--gym-text-main);
      line-height: 1.3;
    }

    .gym-subhead {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
    }

    .gym-coaching-card {
      background-color: var(--gym-bg-card);
      border-left: 3px solid var(--gym-brand-accent);
      padding: 0.75rem 1rem;
      border-radius: 4px;
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-1);
    }

    .gym-card-tag {
      font-size: var(--gym-text-xs);
      font-weight: 800;
      letter-spacing: 0.08em;
      color: var(--gym-brand-accent-fg);
      text-transform: uppercase;
    }

    .gym-coaching-prose {
      font-size: var(--gym-text-sm);
      line-height: 1.5;
      color: var(--gym-text-main);
    }

    .gym-section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 0.25rem;
    }

    .gym-section-title-sm {
      font-size: var(--gym-text-xs);
      font-weight: 700;
      color: var(--gym-text-dim);
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

    .gym-tabular-info {
      font-size: var(--gym-text-xs);
      font-variant-numeric: tabular-nums;
      color: var(--gym-text-muted);
      font-family: var(--font-mono);
    }

    .gym-moves-section {
      max-height: 260px;
      overflow-y: auto;
    }

    .gym-action-section {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      background-color: var(--gym-bg-input);
    }

    .gym-btn-primary {
      background-color: var(--gym-brand-accent);
      color: var(--gym-brand-ink);
      font-weight: 700;
      font-size: var(--gym-text-sm);
      padding: var(--gym-space-3) 1rem;
      border-radius: 6px;
      border: none;
      cursor: pointer;
      transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
      display: inline-flex;
      justify-content: center;
      align-items: center;
    }

    .gym-btn-primary:hover {
      background-color: var(--gym-brand-accent-hover);
      box-shadow: 0 0 14px var(--gym-brand-glow);
    }

    .gym-btn-primary:disabled,
    .gym-btn-secondary:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .gym-btn-primary.gym-btn-lg {
      padding: 0.8rem 1.25rem;
      font-size: var(--gym-text-base);
    }

    .gym-btn-secondary {
      background-color: var(--gym-bg-card);
      color: var(--gym-text-main);
      font-weight: 600;
      font-size: var(--gym-text-sm);
      padding: var(--gym-space-3) 1rem;
      border-radius: 6px;
      border: 1px solid var(--gym-border-card);
      cursor: pointer;
      transition: background 0.15s ease;
      display: inline-flex;
      justify-content: center;
      align-items: center;
    }

    .gym-btn-secondary:hover {
      background-color: var(--gym-bg-card-hover);
    }

    .gym-btn-dual {
      display: flex;
      gap: 0.5rem;
    }

    .gym-btn-dual .gym-btn-secondary {
      flex: 1;
    }

    /* Puzzles Screen Specifics */
    .gym-pill-stat {
      font-size: var(--gym-text-xs);
      font-weight: 600;
      padding: 0.15rem 0.5rem;
      border-radius: 9999px;
      background: var(--gym-bg-card);
      border: 1px solid var(--gym-border-subtle);
      color: var(--gym-text-muted);
    }

    .gym-puzzle-prompt {
      background-color: var(--gym-bg-card);
      border-left: 3px solid var(--gym-chess-green);
      padding: 0.75rem 1rem;
      border-radius: 4px;
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-1);
    }

    .gym-prompt-badge {
      font-size: var(--gym-text-xs);
      font-weight: 800;
      letter-spacing: 0.08em;
      color: var(--gym-chess-green);
    }

    .gym-prompt-text {
      font-size: var(--gym-text-sm);
      line-height: 1.5;
      color: var(--gym-text-main);
    }

    /* Openings Screen Specifics */
    .gym-openings-container {
      display: flex;
      flex-direction: column;
      gap: 1.25rem;
    }

    .gym-openings-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0.6rem 1rem;
      background-color: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--radius-md);
    }

    .gym-subview-switcher {
      display: flex;
      gap: 0.4rem;
    }

    .gym-tab-btn {
      padding: var(--gym-space-1) var(--gym-space-3);
      border-radius: 4px;
      font-size: var(--gym-text-xs);
      font-weight: 600;
      color: var(--gym-text-muted);
      background: transparent;
      border: 1px solid transparent;
      cursor: pointer;
      transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    }

    .gym-tab-btn:hover {
      color: var(--gym-text-main);
      background: var(--gym-bg-card);
    }

    .gym-tab-active {
      color: var(--gym-brand-accent-fg) !important;
      background: var(--gym-bg-card) !important;
      border-color: var(--gym-border-subtle) !important;
    }

    .gym-repertoire-band {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
      font-weight: 500;
    }

    .gym-course-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
      gap: 1.25rem;
    }

    .gym-course-card {
      background-color: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      padding: var(--gym-space-4);
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-2);
    }

    .gym-course-badge {
      font-size: var(--gym-text-xs);
      font-weight: 800;
      letter-spacing: 0.08em;
      color: var(--gym-eval-book-text);
      text-transform: uppercase;
    }

    .gym-course-name {
      font-size: var(--gym-text-base);
      font-weight: 700;
      color: var(--gym-text-main);
    }

    .gym-course-desc {
      font-size: var(--gym-text-sm);
      color: var(--gym-text-muted);
      line-height: 1.45;
    }

    .gym-course-meter-row {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      margin-top: 0.5rem;
    }

    .gym-progress-bar {
      flex: 1;
      height: 6px;
      background: var(--gym-bg-card-hover);
      border-radius: 9999px;
      overflow: hidden;
    }

    .gym-progress-fill {
      height: 100%;
      background: var(--gym-chess-green);
      border-radius: 9999px;
    }

    .gym-progress-pct {
      font-size: var(--gym-text-xs);
      font-weight: 700;
      font-variant-numeric: tabular-nums;
      color: var(--gym-chess-green);
    }

    .gym-course-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 0.75rem;
      padding-top: 0.75rem;
      border-top: 1px solid var(--gym-border-subtle);
    }

    .gym-srs-due {
      font-size: var(--gym-text-xs);
      font-weight: 600;
      color: var(--gym-brand-accent-fg);
    }

    .gym-srs-clean {
      font-size: var(--gym-text-xs);
      color: var(--gym-chess-green);
      font-weight: 600;
    }

    .gym-btn-sm {
      padding: var(--gym-space-1) 0.8rem;
      font-size: var(--gym-text-xs);
    }

    .gym-srs-badge {
      font-size: var(--gym-text-xs);
      font-weight: 700;
      color: var(--gym-eval-book-text);
      background: rgba(var(--gym-eval-book-rgb), 0.15);
      border: 1px solid rgba(var(--gym-eval-book-rgb), 0.3);
      padding: 0.1rem var(--gym-space-2);
      border-radius: 4px;
      margin-left: auto;
    }

    .gym-drill-explainer {
      background-color: var(--gym-bg-card);
      border-left: 3px solid var(--gym-eval-book);
      padding: 0.75rem 1rem;
      border-radius: 4px;
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-1);
    }

    .gym-explainer-label {
      font-size: var(--gym-text-xs);
      font-weight: 800;
      letter-spacing: 0.08em;
      color: var(--gym-eval-book-text);
    }

    .gym-explainer-text {
      font-size: var(--gym-text-sm);
      line-height: 1.5;
      color: var(--gym-text-main);
    }

    /* ==========================================================================
       Chess Gym: Progress View & Longitudinal Trends (.gym-progress-*)
       ========================================================================== */
    .gym-progress-workspace {
      display: flex;
      flex-direction: column;
      gap: 1.25rem;
      width: 100%;
      max-width: 100%;
      margin: 0 auto;
    }

    .gym-progress-controls-toolbar {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      flex-wrap: wrap;
    }

    .gym-chart-card {
      background: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--gym-radius-md);
      padding: 1.25rem 1.5rem;
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }

    /* SPEC: US-33 / design/screens §02: the loaded Progress chart is one flat
       plane divided by hairlines. The surface stays on the empty gate chart
       only, so the card is a state, not the default chrome. */
    .gym-chart-card-flat {
      background: transparent;
      border: 0;
      border-radius: 0;
      padding: var(--gym-space-5) 0;
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .gym-chart-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 0.75rem;
    }

    .gym-chart-title-group {
      display: flex;
      flex-direction: column;
      gap: 0.2rem;
    }

    .gym-chart-title {
      font-size: var(--gym-text-base);
      font-weight: 700;
      color: var(--gym-text-main);
      margin: 0;
    }

    .gym-chart-subtitle {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-secondary);
    }

    .gym-chart-svg-container {
      width: 100%;
      height: 220px;
      position: relative;
    }

    .gym-chart-svg-body {
      width: 100%;
      height: 100%;
    }

    .gym-chart-svg {
      width: 100%;
      height: 100%;
      overflow: visible;
    }

    /* W-4: the chart is painted through tokens only. A single stream uses the
       text family; several streams use the data-only series palette. The
       closing point is the accent latest-week marker and the grid is the
       design's 6% white hairline. No colour literal is in the SVG markup;
       these classes carry every paint. */
    .gym-chart-grid {
      stroke: var(--gym-hairline);
      stroke-dasharray: 3, 3;
      stroke-width: 1;
    }

    .gym-chart-axis {
      fill: var(--gym-text-muted);
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
      font-variant-numeric: tabular-nums;
      font-feature-settings: "tnum" 1;
    }

    .gym-chart-week {
      text-anchor: middle;
    }

    .gym-chart-week-odd {
      text-anchor: middle;
    }

    .gym-chart-svg.gym-chart-empty-svg {
      width: 100%;
      height: 100%;
    }

    .gym-chart-line {
      fill: none;
      stroke: var(--gym-brand-accent-fg);
      stroke-width: 3;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .gym-chart-dot {
      fill: var(--gym-text-muted);
      stroke: var(--gym-bg-surface);
      stroke-width: 2;
    }

    .gym-chart-dot-last {
      fill: var(--gym-brand-accent-fg);
    }

    .gym-chart-empty {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 200px;
      color: var(--gym-text-dim);
      font-size: var(--gym-text-sm);
      font-style: italic;
    }

    .gym-chart-point {
      cursor: pointer;
      transition: transform 0.15s ease;
    }

    .gym-chart-point:hover circle {
      r: 6.5;
      stroke: var(--gym-accent);
      stroke-width: 2.5;
    }

    .gym-motif-name {
      font-size: var(--gym-text-sm);
      font-weight: 600;
      color: var(--gym-text-main);
    }

    .gym-btn-xs {
      padding: 0.15rem 0.5rem;
      font-size: var(--gym-text-xs);
      border-radius: 4px;
    }

    .gym-progress-table-card {
      background: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--gym-radius-md);
      padding: 1.25rem 1.5rem;
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }

    /* SPEC: US-33 / design/screens §02: the repeat-blunders table and the week
       blocks are the page plane; hairline divisions replace the card. */
    .gym-progress-table-card-flat {
      background: transparent;
      border: 0;
      border-radius: 0;
      padding: var(--gym-space-5) 0;
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .gym-table-container {
      width: 100%;
      overflow-x: auto;
    }

    .gym-progress-table {
      width: 100%;
      border-collapse: collapse;
      font-size: var(--gym-text-sm);
    }

    .gym-progress-table th {
      text-align: left;
      padding: 0.75rem 1rem;
      color: var(--gym-text-secondary);
      font-size: var(--gym-text-xs);
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      border-bottom: 1px solid var(--gym-border-subtle);
      white-space: nowrap;
    }

    .gym-progress-table td {
      padding: var(--gym-space-3) 1rem;
      border-bottom: 1px solid var(--gym-hairline-faint);
      color: var(--gym-text-main);
      white-space: nowrap;
    }

    .gym-progress-table tr:hover td {
      background: var(--gym-row-hover);
    }

    .gym-td-period {
      color: var(--gym-text-main);
      font-weight: 700;
    }

    .gym-table-motifs {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      flex-wrap: wrap;
    }

    /* The history table's inner track scrolls inside `.gym-table-container`, so
       the motif chips keep one line per row instead of wrapping the row taller. */
    .gym-progress-table .gym-table-motifs {
      flex-wrap: nowrap;
    }

    .gym-motif-chip {
      font-size: var(--gym-text-xs);
      font-weight: 600;
      color: var(--gym-text-secondary);
      background: var(--gym-chip-bg);
      border: 1px solid var(--gym-border-subtle);
      padding: 0.15rem 0.5rem;
      border-radius: 4px;
    }

    .gym-motif-delta {
      margin-left: var(--gym-space-1);
      font-weight: 700;
      font-variant-numeric: tabular-nums;
      font-feature-settings: "tnum" 1;
    }

    .gym-motif-delta-none {
      color: var(--gym-text-muted);
    }

    .gym-progress-tc {
      display: inline-block;
      margin-left: 0.5rem;
      padding: 0.05rem 0.4rem;
      border: 1px solid var(--gym-border-subtle);
      border-radius: 4px;
      font-size: var(--gym-text-xs);
      font-weight: 600;
      color: var(--gym-text-muted);
      vertical-align: middle;
    }

    /* The phone form of the history: the table is the desktop shape, and a
       1160px track inside a 390px card is not a table a phone can read. Both
       presentations read the same sorted rows. */
    .gym-progress-rows {
      display: none;
    }

    @media (max-width: 900px) {
      .gym-progress-table-card {
        padding: var(--gym-space-4);
      }

      /* The flat history is the page plane; its week blocks align with the
         chart and the page gutter, not the retired card inset. */
      .gym-progress-table-card-flat {
        padding: var(--gym-space-4) 0;
      }

      .gym-progress-table-card .gym-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--gym-space-2);
      }

      .gym-table-container {
        display: none;
      }

      .gym-progress-rows {
        display: flex;
        flex-direction: column;
        margin: 0;
        padding: 0;
        list-style: none;
        border-top: 1px solid var(--gym-border-subtle);
      }

      .gym-progress-row {
        padding: var(--gym-space-3) 0;
        border-bottom: 1px solid var(--gym-border-subtle);
      }

      .gym-progress-row-head {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--gym-space-2);
      }

      .gym-progress-row-period {
        font-size: var(--gym-text-sm);
        font-variant-numeric: tabular-nums;
      }

      .gym-progress-row .gym-progress-tc {
        margin-left: 0;
      }

      .gym-progress-row-figures {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: var(--gym-space-3) var(--gym-space-4);
        margin: var(--gym-space-3) 0 0;
      }

      .gym-progress-row-figures div {
        min-width: 0;
      }

      .gym-progress-row-figures dt {
        color: var(--gym-text-muted);
        font-size: var(--gym-text-xs);
        font-weight: 600;
      }

      .gym-progress-row-figures dd {
        margin: 0;
        color: var(--gym-text-main);
        font-size: var(--gym-text-sm);
        font-weight: 600;
        font-variant-numeric: tabular-nums;
      }

      .gym-progress-row .gym-table-motifs {
        margin-top: var(--gym-space-2);
      }
    }

    .gym-progress-page {
      display: flex;
      flex-direction: column;
      gap: 1.25rem;
    }

    .gym-progress-state {
      padding: 2rem 1rem;
      color: var(--gym-text-secondary);
      font-size: var(--gym-text-base);
    }

    .gym-progress-error {
      padding: 1rem 1.25rem;
      border: 1px solid var(--gym-eval-blunder-small);
      border-radius: var(--gym-radius-md);
      background: var(--gym-bg-surface);
      color: var(--gym-text-main);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      flex-wrap: wrap;
    }

    .gym-progress-retry {
      padding: var(--gym-space-2) 1rem;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      background: var(--gym-bg-input);
      color: var(--gym-text-main);
      font-weight: 600;
      cursor: pointer;
    }

    /* P-1: the accepted Progress surface. Four figures are one reading line
       band, the gate is a two-column pitch, and the trend is a neutral token
       line with a direct label. */
    .gym-tabular {
      font-variant-numeric: tabular-nums;
      font-feature-settings: "tnum" 1;
    }

    .gym-reading-line {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 0;
      padding: 0.5rem 0;
      border-top: 1px solid var(--gym-border-subtle);
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .gym-reading-item {
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
      min-width: 0;
      padding: 0 1.25rem;
      border-left: 1px solid var(--gym-border-subtle);
    }

    .gym-reading-item:first-child {
      padding-left: 0;
      border-left: 0;
    }

    .gym-reading-label {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
    }

    .gym-reading-value {
      color: var(--gym-text-main);
      font-family: var(--font-mono);
      font-size: var(--gym-text-xl);
      font-weight: 700;
      line-height: 1.15;
    }

    .gym-reading-detail {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      line-height: 1.4;
    }

    .gym-progress-gate {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 2rem;
      align-items: start;
    }

    .gym-progress-gate-copy {
      display: flex;
      flex-direction: column;
      gap: 1rem;
      min-width: 0;
    }

    .gym-progress-gate-headline {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-xl);
      font-weight: 700;
      line-height: 1.15;
      letter-spacing: -0.01em;
    }

    .gym-progress-gate-lede {
      margin: 0;
      max-width: 60ch;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      line-height: 1.55;
    }

    .gym-progress-evidence {
      display: flex;
      flex-direction: column;
      gap: 0.9rem;
      margin: 0;
      padding: 0;
      list-style: none;
    }

    .gym-progress-evidence-item {
      display: flex;
      align-items: flex-start;
      gap: 0.75rem;
    }

    .gym-progress-evidence-icon {
      flex: none;
      color: var(--gym-text-main);
    }

    .gym-progress-evidence-label {
      display: block;
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      font-weight: 700;
    }

    .gym-progress-evidence-body {
      display: block;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      line-height: 1.5;
    }

    .gym-progress-gate-actions {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.75rem;
    }

    .gym-progress-gate-window {
      margin: 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      line-height: 1.5;
    }

    .gym-progress-upgrade {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 0.75rem;
      padding: var(--gym-space-3) var(--gym-space-4);
      background: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--gym-radius-md);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .gym-progress-upgrade a {
      color: var(--gym-text-main);
      font-weight: 700;
    }

    .gym-progress-analysis-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 1.25rem;
      align-items: start;
    }

    .gym-trend-legend {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.5rem 1rem;
      margin-top: 0.75rem;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .gym-trend-legend-swatch {
      display: inline-block;
      width: 18px;
      margin-right: var(--gym-space-1);
      vertical-align: middle;
      border-top: 2px solid var(--gym-text-main);
    }

    .gym-chart-caption,
    .gym-chart-cap-note {
      margin: 0.5rem 0 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .gym-chart-cap-note {
      color: var(--gym-text-dim);
    }

    /* SPEC: US-33: the legend item is neutral state, not an accent action. The
       button label names the stream; the swatch only repeats the line identity. */
    .gym-trend-legend-toggle {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      padding: 0.15rem 0.35rem;
      background: transparent;
      border: 0;
      border-radius: var(--gym-radius-control);
      color: var(--gym-text-muted);
      font: inherit;
      font-size: var(--gym-text-xs);
      cursor: pointer;
    }

    .gym-trend-legend-toggle:hover {
      background: var(--gym-row-hover);
      color: var(--gym-text-main);
    }

    .gym-trend-legend-toggle[aria-pressed="false"] {
      color: var(--gym-text-dim);
    }

    .gym-trend-legend-toggle[aria-pressed="false"] .gym-trend-legend-swatch {
      border-top-color: var(--gym-text-dim);
      border-top-style: dashed;
      opacity: 0.55;
    }

    .gym-trend-legend-label {
      max-width: 16rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .gym-chart-visibility-state {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: var(--gym-space-3);
      margin-top: var(--gym-space-3);
      padding-top: var(--gym-space-3);
      border-top: 1px solid var(--gym-border-subtle);
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
    }

    .gym-chart-visibility-state p {
      margin: 0;
    }

    .gym-chart-show-all {
      min-height: 24px;
      padding: 0.25rem 0.6rem;
      background: transparent;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      color: var(--gym-text-main);
      font: inherit;
      font-size: var(--gym-text-xs);
      cursor: pointer;
    }

    .gym-chart-show-all:hover {
      background: var(--gym-row-hover);
      border-color: var(--gym-border-hover);
    }

    /* SPEC: US-33: the legend swatch carries the same data-only colour as its
       line, and the same stroke pattern for a colour-free read. */
    .gym-trend-legend-swatch.gym-chart-series-1 {
      border-top-color: var(--gym-chart-series-1);
      border-top-style: solid;
    }

    .gym-trend-legend-swatch.gym-chart-series-2 {
      border-top-color: var(--gym-chart-series-2);
      border-top-style: dashed;
    }

    .gym-trend-legend-swatch.gym-chart-series-3 {
      border-top-color: var(--gym-chart-series-3);
      border-top-style: dotted;
    }

    .gym-trend-legend-swatch.gym-chart-series-4 {
      border-top-color: var(--gym-chart-series-4);
      border-top-style: dashed;
      border-top-width: 4px;
    }

    .gym-trend-legend-dot {
      display: inline-block;
      width: 8px;
      height: 8px;
      margin-right: var(--gym-space-1);
      border-radius: 50%;
      background: var(--gym-text-main);
    }

    .gym-trend-legend-latest {
      background: var(--gym-brand-accent-fg);
    }

    .gym-chart-line-neutral {
      fill: none;
      stroke: var(--gym-text-main);
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    /* SPEC: US-33: the multi-stream chart paints one data-only series per
       stream. The stroke pattern and the direct label remain, so identity does
       not depend on colour. The one-stream chart keeps the neutral rule. */
    .gym-chart-line-series {
      fill: none;
      stroke-width: 2.5;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .gym-chart-line-series.gym-chart-series-1 {
      stroke: var(--gym-chart-series-1);
      stroke-dasharray: none;
    }

    .gym-chart-line-series.gym-chart-series-2 {
      stroke: var(--gym-chart-series-2);
      stroke-dasharray: 9 5;
    }

    .gym-chart-line-series.gym-chart-series-3 {
      stroke: var(--gym-chart-series-3);
      stroke-dasharray: 2 4;
    }

    .gym-chart-line-series.gym-chart-series-4 {
      stroke: var(--gym-chart-series-4);
      stroke-dasharray: 9 4 2 4;
    }

    .gym-chart-dot-series.gym-chart-series-1 {
      fill: var(--gym-chart-series-1);
    }

    .gym-chart-dot-series.gym-chart-series-2 {
      fill: var(--gym-chart-series-2);
    }

    .gym-chart-dot-series.gym-chart-series-3 {
      fill: var(--gym-chart-series-3);
    }

    .gym-chart-dot-series.gym-chart-series-4 {
      fill: var(--gym-chart-series-4);
    }

    /* SPEC: US-33: the accent legend key names the closing marker, so every
       series' closing dot is accent in the multi-stream view too. */
    .gym-chart-dot.gym-chart-dot-series.gym-chart-dot-last {
      fill: var(--gym-brand-accent-fg);
    }

    .gym-chart-point-label {
      fill: var(--gym-text-main);
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
      font-weight: 700;
      font-variant-numeric: tabular-nums;
      font-feature-settings: "tnum" 1;
    }

    .gym-chart-series-label {
      fill: var(--gym-text-muted);
      font-family: var(--font-family);
      font-size: var(--gym-text-xs);
      font-weight: 600;
    }

    .gym-chart-empty-frame {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }

    .gym-chart-empty-container {
      height: 200px;
    }

    .gym-chart-empty-text {
      margin: 0;
      color: var(--gym-text-dim);
      font-size: var(--gym-text-sm);
    }

    .gym-motif-table {
      display: flex;
      flex-direction: column;
    }

    .gym-motif-table-head,
    .gym-motif-row {
      display: grid;
      grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.7fr);
      gap: 0.5rem;
      align-items: center;
    }

    .gym-motif-table-head {
      padding-bottom: var(--gym-space-2);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .gym-motif-row {
      padding: 0.6rem 0;
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .gym-motif-row .gym-motif-name {
      font-weight: 700;
      color: var(--gym-text-main);
    }

    .gym-motif-rate {
      display: flex;
      flex-direction: column;
      gap: 0.2rem;
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
    }

    .gym-motif-rate-label {
      display: block;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .gym-motif-share-label {
      display: none;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .gym-motif-share {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .gym-motif-delta-rising {
      color: var(--gym-eval-blunder-text);
      font-weight: 700;
    }

    .gym-motif-delta-falling,
    .gym-motif-delta-flat {
      color: var(--gym-text-main);
      font-weight: 700;
    }

    .gym-motif-delta-none {
      color: var(--gym-text-muted);
    }

    .gym-motif-note {
      margin: var(--gym-space-3) 0 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      line-height: 1.5;
    }

    @media (max-width: 1100px) {
      .gym-progress-gate,
      .gym-progress-analysis-grid {
        grid-template-columns: minmax(0, 1fr);
      }
    }

    @media (max-width: 767px) {
      /* SPEC: US-33: the mandated motif bridge is longer than the old label;
         the title group keeps the full row and the action moves below it, so
         the subtitle is not squeezed into a narrow column at 320/390. */
      .gym-chart-header {
        flex-wrap: wrap;
      }

      .gym-chart-title-group {
        flex: 1 1 100%;
        min-width: 0;
      }

      .gym-chart-action {
        max-width: 100%;
        white-space: normal;
      }

      .gym-reading-line {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
      }

      .gym-reading-item {
        padding: 0;
        border-left: 0;
      }

      .gym-progress-gate-actions .btn,
      .gym-progress-gate-actions .gym-btn-primary,
      .gym-progress-gate-actions .gym-btn-secondary { min-height: 40px; }

      .gym-progress-controls-toolbar select,
      .gym-progress-filter .gym-select { min-height: 40px; }

      .gym-progress-retry {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
      }

      .gym-trend-legend-toggle,
      .gym-chart-show-all {
        min-height: 40px;
        padding: 0.35rem 0.65rem;
      }

      .gym-motif-table-head {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
      }

      .gym-motif-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
          "name delta"
          "rate share";
        gap: 0.25rem 0.75rem;
        padding: 0.7rem 0;
      }

      .puzzle-hub-motif-table .gym-motif-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
          "name name"
          "rate share";
        gap: 0.25rem 0.75rem;
      }

      .gym-motif-row .gym-motif-name { grid-area: name; }

      .gym-motif-row .gym-motif-rate {
        grid-area: rate;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
      }

      .gym-motif-row .gym-motif-share {
        grid-area: share;
        text-align: right;
      }

      .gym-motif-row [class*="gym-motif-delta-"] {
        grid-area: delta;
        text-align: right;
      }

      .gym-motif-rate-label,
      .gym-motif-share-label {
        display: inline;
      }
    }

    @media (max-width: 600px) {
      .gym-chart-axis {
        font-size: var(--gym-text-lg);
      }

      .gym-chart-point-label {
        font-size: var(--gym-text-lg);
      }

      .gym-chart-series-label {
        font-size: var(--gym-text-base);
      }

      .gym-chart-week-even {
        display: none;
      }
    }

    .gym-visually-hidden {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      clip-path: inset(50%);
      white-space: nowrap;
      border: 0;
    }

    .gym-history-title {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-lg);
      font-weight: 700;
      line-height: 1.2;
      letter-spacing: -0.01em;
    }

    .gym-history-block-motifs {
      margin-top: var(--gym-space-2);
    }

    .gym-history-block-motif-label {
      display: block;
      margin-bottom: 0.25rem;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
    }

    .gym-history-meta {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 0.2rem;
    }

    .gym-td-stream {
      color: var(--gym-text-muted);
      white-space: nowrap;
    }

    .gym-elo-closing,
    .gym-elo-delta {
      font-variant-numeric: tabular-nums;
      font-feature-settings: "tnum" 1;
    }

    .gym-elo-delta {
      color: var(--gym-text-muted);
      font-weight: 700;
    }

    .gym-verified-note {
      display: inline-flex;
      align-items: center;
      gap: var(--gym-space-1);
      color: var(--gym-chess-green);
      font-size: var(--gym-text-xs);
      font-weight: 600;
    }

    .gym-progress-filters {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 1rem;
    }

    .gym-progress-filter {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-1);
    }

    .gym-progress-filter-label {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
    }

    .gym-progress-gate-note {
      margin: 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      line-height: 1.5;
    }

    /* SPEC: US-28 AC 7 / DESIGN.md targets: the card's text action keeps the
       24px desktop floor; the phone rule raises it to 40. */
    .gym-chart-action {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      font-weight: 700;
      white-space: nowrap;
    }

    .gym-progress-partial {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 0.75rem;
      padding: var(--gym-space-3) var(--gym-space-4);
      background: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--gym-radius-md);
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
    }

    .gym-progress-partial p {
      margin: 0;
    }

    .gym-progress-skeleton {
      display: flex;
      flex-direction: column;
      gap: 1.25rem;
    }

    .gym-progress-skeleton-band,
    .gym-progress-skeleton-card {
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--gym-radius-md);
      background: var(--gym-bg-surface);
    }

    .gym-progress-skeleton-band {
      height: 96px;
    }

    .gym-progress-skeleton-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 1.25rem;
    }

    .gym-progress-skeleton-card {
      height: 220px;
    }

    .gym-val-good {
      color: var(--gym-chess-green);
      font-weight: 700;
    }

    /* Floating Switcher Bar (Per prototype/UI.md) */
    .gym-prototype-switcher-bar {
      position: fixed;
      bottom: var(--gym-space-5);
      left: 50%;
      transform: translateX(-50%);
      background: rgba(var(--gym-bg-app-rgb), 0.94);
      backdrop-filter: blur(10px);
      border: 1px solid rgba(var(--gym-brand-accent-rgb), 0.4);
      border-radius: 9999px;
      padding: 6px 14px;
      display: flex;
      align-items: center;
      gap: 1rem;
      box-shadow: var(--gym-shadow-overlay);
      z-index: 1000;
    }

    .gym-switcher-label {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .gym-switcher-badge {
      font-size: var(--gym-text-xs);
      font-weight: 800;
      background: var(--gym-brand-accent);
      color: var(--gym-brand-ink);
      padding: 0.1rem var(--gym-space-2);
      border-radius: 9999px;
    }

    .gym-switcher-cur {
      font-size: var(--gym-text-xs);
      font-weight: 600;
      color: var(--gym-text-main);
      white-space: nowrap;
    }

    .gym-switcher-buttons {
      display: flex;
      gap: var(--gym-space-1);
    }

    .gym-sw-btn {
      background: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
      padding: var(--gym-space-1) 0.75rem;
      border-radius: 9999px;
      cursor: pointer;
      transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
      white-space: nowrap;
    }

    .gym-sw-btn:hover {
      color: var(--gym-text-main);
      background: var(--gym-border-card);
    }

    .gym-sw-active {
      background: var(--gym-brand-accent) !important;
      color: var(--gym-brand-ink) !important;
      border-color: var(--gym-brand-accent-fg) !important;
      font-weight: 700;
    }

    /* ==========================================================================
       Multi-Game Analysis Workspace (3-Column Desktop, 2-Column Medium, 1-Col Mobile)
       ========================================================================== */

    .gym-analysis-workspace {
      display: grid;
      grid-template-columns: 290px minmax(420px, min(80vh, 740px)) minmax(340px, 1fr);
      gap: 1.25rem;
      align-items: start;
    }

    /* Left Column: Games Drawer / List */
    .gym-analysis-games-col {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-3);
      background-color: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      padding: var(--gym-space-3);
      max-height: calc(min(80vh, 740px) + 54px);
      overflow-y: auto;
    }

    .gym-games-col-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding-bottom: 0.5rem;
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .gym-games-filter-pills {
      display: flex;
      gap: 0.25rem;
    }

    .gym-filter-pill {
      background: var(--gym-bg-card);
      border: 1px solid var(--gym-border-subtle);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
      padding: 0.2rem 0.5rem;
      border-radius: 4px;
      cursor: pointer;
    }

    .gym-filter-pill-active {
      background: var(--gym-brand-accent) !important;
      color: var(--gym-brand-ink) !important;
      border-color: var(--gym-brand-accent-fg) !important;
    }

    .gym-games-scroll-list {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .gym-game-card {
      background-color: var(--gym-bg-card);
      border: 1px solid var(--gym-border-subtle);
      border-radius: 6px;
      padding: var(--gym-space-3) 0.75rem;
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-1);
      cursor: pointer;
      transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
      text-align: left;
      width: 100%;
      box-sizing: border-box;
    }

    .gym-game-card:hover {
      border-color: var(--gym-border-strong);
      background-color: var(--gym-bg-card-hover);
    }

    .gym-game-card-active {
      border-color: var(--gym-brand-accent-fg) !important;
      background-color: var(--gym-bg-active-row) !important;
      box-shadow: 0 0 10px rgba(var(--gym-brand-accent-rgb), 0.15);
    }

    .gym-game-card-top {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      justify-content: space-between;
    }

    .gym-card-opponent {
      font-size: var(--gym-text-sm);
      font-weight: 600;
      color: var(--gym-text-main);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .gym-card-meta-sub {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 0.5rem;
      min-width: 0;
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
    }

    /* The meta line is one row at every width: the clock/date label may
       ellipsise, the badge never shrinks or wraps onto a second line. */
    .gym-card-tc {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .gym-card-meta-sub .gym-blunder-count-badge,
    .gym-card-meta-sub .gym-clean-badge {
      flex: none;
      white-space: nowrap;
    }

    /* Center Column: Board Column */
    .gym-analysis-board-col {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-3);
      min-width: 0;
    }

    .gym-board-stepper-header {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      background-color: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      padding: 0.55rem var(--gym-space-3);
      gap: 0.5rem;
    }

    .gym-stepper-game-info {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      min-width: 0;
    }

    .gym-stepper-title {
      font-size: var(--gym-text-sm);
      font-weight: 700;
      color: var(--gym-text-main);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* The desktop title is the full `Game k of n: vs. <opponent>`; below
       768px the design's complete short form replaces it. CSS-only: the
       hidden span is `display: none`, so assistive technology reads only the
       visible one. */
    .gym-stepper-title-compact {
      display: none;
    }

    @media (max-width: 768px) {
      .gym-stepper-title-full {
        display: none;
      }

      .gym-stepper-title-compact {
        display: inline;
        font-size: var(--gym-text-xs);
      }
    }

    .gym-stepper-actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: flex-end;
      gap: var(--gym-space-2);
      margin-left: auto;
      min-width: 0;
    }

    .gym-board-stepper-header .gym-review-entry {
      padding: 0;
    }

    .gym-stepper-nav {
      display: flex;
      gap: var(--gym-space-1);
    }

    .gym-step-arrow-btn {
      background: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      color: var(--gym-text-main);
      padding: 0.3rem 0.6rem;
      border-radius: 4px;
      font-size: var(--gym-text-xs);
      font-weight: 600;
      cursor: pointer;
      transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
      white-space: nowrap;
    }

    .gym-step-arrow-btn:hover:not(:disabled) {
      background: var(--gym-bg-card-hover);
      border-color: var(--gym-brand-accent-fg);
    }

    .gym-step-arrow-btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }

    /* Right Column: Inspector Column */
    .gym-analysis-inspector-col {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      min-width: 0;
    }

    .gym-inspector-card {
      background-color: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      padding: var(--gym-space-3) 1rem;
      display: flex;
      flex-direction: column;
      gap: 0.6rem;
    }

    .gym-blunder-btn-list {
      display: flex;
      flex-direction: column;
      gap: 0.4rem;
    }

    .gym-blunder-btn {
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      color: var(--gym-text-main);
      padding: var(--gym-space-2) 0.75rem;
      border-radius: 6px;
      font-size: var(--gym-text-xs);
      cursor: pointer;
      text-align: left;
      transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    }

    .gym-blunder-btn:hover {
      background: var(--gym-bg-card-hover);
      border-color: rgba(var(--gym-eval-blunder-rgb), 0.4);
    }

    .gym-blunder-btn-active {
      background: rgba(var(--gym-eval-blunder-rgb), 0.18) !important;
      border-color: rgba(var(--gym-eval-blunder-rgb), 0.5) !important;
      color: var(--gym-text-main) !important;
    }

    .gym-blunder-btn-delta {
      font-family: var(--font-mono);
      font-weight: 700;
      color: var(--gym-eval-blunder-small);
      font-size: var(--gym-text-xs);
    }

    .gym-clean-game-box {
      background-color: rgba(var(--gym-eval-best-rgb), 0.1);
      border: 1px solid rgba(var(--gym-eval-best-rgb), 0.3);
      border-radius: 6px;
      padding: var(--gym-space-3);
      display: flex;
      align-items: center;
      gap: 0.75rem;
      color: var(--gym-chess-green);
      font-size: var(--gym-text-sm);
      font-weight: 600;
    }

    /* SPEC: US-28 AC 5 / DR-3: the analysis workspace's own pieces. The
       drawer, grid, pills and cards above are the shared .gym-* surface; these
       rules are the empty/clean states and the notation card around the shared
       move table. */
    #analysis-view {
      display: flex;
      flex-direction: column;
      gap: 1.25rem;
    }

    .gym-analysis-lede {
      margin: 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .gym-analysis-empty {
      grid-column: 1 / -1;
      padding: 2rem 1rem;
      text-align: center;
      color: var(--gym-text-muted);
      background-color: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
    }

    .gym-notation-card {
      background-color: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      padding: var(--gym-space-3) 1rem;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .gym-notation-ply {
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
      font-variant-numeric: tabular-nums;
    }

    .gym-move-sheet-empty {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      padding: 0.4rem 0;
    }

    .gym-clean-arena {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.75rem;
      min-height: 12rem;
      background-color: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--radius-md);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .gym-clean-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 1.75rem;
      height: 1.75rem;
      border-radius: 9999px;
      background-color: rgba(var(--gym-chess-green-rgb), 0.15);
      color: var(--gym-chess-green);
      font-weight: 800;
    }

    .gym-clean-title {
      font-weight: 700;
      color: var(--gym-chess-green);
      font-size: var(--gym-text-base);
    }

    .gym-clean-sub {
      font-size: var(--gym-text-xs);
      color: var(--gym-text-muted);
    }

    /* Mobile Segmented Tab Switcher (Analysis Screen) */
    .gym-mobile-analysis-tabs {
      display: none;
      gap: var(--gym-space-1);
      background: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-card);
      border-radius: 6px;
      padding: 4px;
    }

    .gym-mobile-tab-btn {
      flex: 1;
      padding: var(--gym-space-2) 0.2rem;
      font-size: var(--gym-text-xs);
      font-weight: 600;
      border-radius: 4px;
      background: transparent;
      border: none;
      color: var(--gym-text-muted);
      cursor: pointer;
      text-align: center;
      transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    }

    .gym-mobile-tab-active {
      background: var(--gym-bg-card);
      color: var(--gym-brand-accent-fg);
      font-weight: 700;
    }

    /* ==========================================================================
       Responsive Ergonomics & Breakpoints
       ========================================================================== */

    /* 1. Medium Desktops & Tablets (up to 1240px) */
    @media (max-width: 1240px) {
      .gym-analysis-workspace {
        grid-template-columns: 240px minmax(360px, 1fr) 320px;
        gap: 1rem;
      }
    }

    /* 2. Tablets & Small Desktops (up to 980px) */
    @media (max-width: 980px) {
      .gym-analysis-workspace {
        grid-template-columns: 1fr;
        gap: 1rem;
      }

      .gym-analysis-games-col {
        max-height: 240px;
      }

      .gym-workspace-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
      }
    }

    /* 3. Mobile Viewports (up to 768px) */
    @media (max-width: 768px) {
      .gym-preview-container {
        padding: 0.5rem var(--gym-space-3) 6.5rem var(--gym-space-3);
      }

      /* SPEC: US-28 AC 7 / D-195: the mobile shell stacks the brand above a
         full-width three-destination nav (the drawn 390 shell; its `4 × flex-1`
         row predates D-202, and three destinations must fit 320). The account
         cluster stays reachable on a compact full-width row and the status pill
         is dropped, as the drawn mobile shell has no room for it. */
      .gym-preview-header,
      .app-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--gym-space-3);
        padding: 0.75rem;
      }

      .app-nav-tabs {
        width: 100%;
        margin-left: 0;
        gap: 0.25rem;
        flex-wrap: nowrap;
      }

      .nav-tab {
        flex: 1 1 0;
        min-width: 0;
        justify-content: center;
        text-align: center;
        padding: var(--gym-space-2) 0.25rem;
        font-size: var(--gym-text-xs);
      }

      .header-actions {
        width: 100%;
        margin-left: 0;
        justify-content: stretch;
        gap: 0.5rem;
      }

      .server-status-pill {
        display: none;
      }

      .auth-user-bar {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--gym-space-1);
        padding: 0.3rem var(--gym-space-2);
      }

      .auth-user-name {
        flex: 1 1 100%;
        text-align: center;
      }

      .auth-user-bar .btn {
        flex: 1 1 auto;
        padding: var(--gym-space-1) 0.55rem;
        font-size: var(--gym-text-xs);
      }

      /* SPEC: US-28 AC 7 / component-specs.md §12 (G-9): on a phone every
         button and input is at least 40px tall and every Board Control Bar
         control at least 44. These floors are mobile-only; desktop keeps the
         design's drawn 34-37px heights. */
      .btn,
      .nav-tab,
      .gym-pill-opt,
      .gym-game-card,
      .gym-filter-pill,
      .gym-blunder-btn,
      .gym-step-arrow-btn,
      .gym-mobile-tab-btn,
      .gym-input-text,
      .gym-select,
      .control-bar-button,
      .training-live-banner,
      .move-table-cell,
      .puzzle-actions .btn,
      .training-actions .btn,
      .gym-btn-sm,
      .gym-btn-primary,
      .gym-btn-secondary,
      .gym-tab-btn,
      .puzzle-dock-primary,
      .opening-band-button,
      .opening-link,
      .puzzle-dock-secondary,
      .puzzle-show-solution,
      .move-table-start {
        min-height: 40px;
      }

      .control-bar-button {
        min-height: 44px;
        min-width: 44px;
      }

      .puzzle-actions .btn,
      .training-actions .btn {
        min-width: 0;
      }

      .gym-preview-nav {
        width: 100%;
        display: flex;
        gap: 0.25rem;
      }

      .gym-nav-item {
        flex: 1;
        text-align: center;
        padding: var(--gym-space-2) 0.25rem;
        font-size: var(--gym-text-xs);
      }

      .gym-user-badge {
        display: none;
      }

      .gym-ingest-console {
        padding: var(--gym-space-3);
      }

      .gym-ingest-fields {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
      }

      .gym-field-group {
        width: 100%;
      }

      .gym-platform-pills {
        width: 100%;
      }

      .gym-pill-opt {
        flex: 1;
        text-align: center;
      }

      .gym-field-submit {
        margin-left: 0;
        width: 100%;
      }

      .gym-btn-wide {
        width: 100%;
      }

      /* SPEC: US-28 AC 7: the segmented control is the only analysis pane
         switch below 768px; the tab state toggles this marker, and above the
         breakpoint every zone is drawn as the desktop workspace. */
      .gym-mobile-analysis-tabs {
        display: flex;
        width: 100%;
      }

      /* US-28 AC 7: the 240 px rail is a desktop shape. On a phone it showed
         2 of 5 games inside a box the page could not grow, so the page
         scrolls instead. */
      .gym-analysis-games-col {
        max-height: none;
        overflow: visible;
      }

      .gym-mobile-zone-off {
        display: none !important;
      }

      .gym-hide-mobile {
        display: none !important;
      }

      .gym-board-box {
        padding: 4px;
      }

      /* US-28 AC 7: on a phone the page is the scroller; a 200 px box inside
         it made the player scroll twice for one game. */
      .gym-moves-section {
        max-height: none;
        overflow: visible;
      }

      .gym-course-grid {
        grid-template-columns: 1fr;
      }

      .gym-progress-controls-toolbar {
        width: 100%;
      }

      .gym-progress-controls-toolbar .gym-platform-pills,
      .gym-progress-controls-toolbar select {
        flex: 1 1 100%;
      }

      .gym-prototype-switcher-bar {
        bottom: 8px;
        left: 8px;
        right: 8px;
        width: auto;
        transform: none;
        padding: 6px 8px;
        border-radius: 12px;
        flex-direction: column;
        gap: 4px;
        box-sizing: border-box;
      }

      .gym-switcher-label {
        display: none;
      }

      .gym-switcher-buttons {
        width: 100%;
        display: flex;
        gap: 4px;
      }

      .gym-sw-btn {
        flex: 1;
        font-size: var(--gym-text-xs);
        padding: 0.42rem 0.2rem;
        text-align: center;
      }
    }

    /* ==========================================================================
       Workbench component layer (D-208 working direction; decision record
       deferred). Code-owned tokens and reusable shell/page/empty/progress/
       summary rules. Colours resolve to the generated --gym-* block.
       ========================================================================== */

    body {
      padding: 0;
    }

    .main-content {
      padding: 32px 0 64px;
    }

    .app-skip-link {
      position: fixed;
      top: 8px;
      left: 8px;
      z-index: 2000;
      transform: translateY(-200%);
      padding: 10px 14px;
      border-radius: var(--gym-radius-control);
      background: var(--gym-brand-accent);
      color: var(--gym-brand-ink);
      font-size: var(--gym-text-sm);
      font-weight: 700;
      text-decoration: none;
    }

    .app-skip-link:focus {
      transform: none;
      outline: 2px solid var(--gym-focus-ring);
      outline-offset: 2px;
    }

    /* Header: one flat bar, one hairline, no status/quota pill. */
    .app-header-flat {
      display: flex;
      flex-direction: row;
      align-items: center;
      flex-wrap: nowrap;
      gap: var(--gym-space-6);
      margin-bottom: 0;
      padding: 14px 0;
      background: transparent;
      border: 0;
      border-bottom: 1px solid var(--gym-border-subtle);
      border-radius: 0;
    }

    .app-header-brand {
      display: inline-flex;
      align-items: center;
      gap: var(--gym-space-3);
      min-height: 40px;
      color: var(--gym-text-main);
    }

    .app-header-brand-mark {
      display: inline-flex;
      color: var(--gym-brand-accent-fg);
    }

    .app-header-brand-text {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-1);
    }

    .app-header-brand-name {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-base);
      font-weight: 800;
      line-height: 1.1;
      letter-spacing: -0.01em;
    }

    .app-header-brand-tag {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      line-height: 1.2;
      letter-spacing: normal;
      text-transform: none;
    }

    .app-header-nav {
      display: flex;
      align-items: stretch;
      gap: var(--gym-space-5);
      margin-left: var(--gym-space-2);
    }

    .app-header-nav-item {
      display: inline-flex;
      align-items: center;
      min-height: 40px;
      padding: 0 2px;
      border: 0;
      border-bottom: 2px solid transparent;
      background: none;
      color: var(--gym-text-muted);
      font: inherit;
      font-size: var(--gym-text-sm);
      cursor: pointer;
    }

    .app-header-nav-item:hover {
      color: var(--gym-text-main);
    }

    .app-header-nav-item-active {
      color: var(--gym-text-main);
      border-bottom-color: var(--gym-text-main);
      font-weight: 600;
    }

    .app-header-account {
      display: flex;
      align-items: center;
      gap: var(--gym-space-2);
      margin-left: auto;
    }

    .app-header-theme-toggle {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 40px;
      height: 40px;
      flex: none;
      padding: 0;
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--radius-full);
      background: transparent;
      color: var(--gym-text-muted);
      cursor: pointer;
      transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
    }

    .app-header-theme-toggle:hover {
      background: var(--gym-bg-card);
      border-color: var(--gym-border-strong);
      color: var(--gym-text-main);
    }

    .app-header-theme-toggle:active {
      background: var(--gym-bg-active-row);
    }

    @media (max-width: 900px) {
      .app-header-theme-toggle {
        width: 44px;
        height: 44px;
      }
    }

    @media (max-width: 480px) {
      .account-entry-name,
      .account-entry-chevron {
        display: none;
      }
    }

    .app-header-account .btn-primary {
      background: transparent;
      border: 1px solid var(--gym-border-card);
      color: var(--gym-text-main);
    }

    .app-header-account .btn-primary:hover:not(:disabled) {
      background: var(--gym-bg-card-hover);
    }

    .app-header-account .btn {
      min-height: 38px;
    }

    .app-header-account .auth-user-bar {
      gap: var(--gym-space-2);
    }

    /* Page header */
    .page-header {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      gap: var(--gym-space-5);
      margin-bottom: var(--gym-space-5);
    }

    .page-header-copy {
      min-width: 0;
    }

    .page-title {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-2xl);
      font-weight: 700;
      line-height: 1.15;
      letter-spacing: -0.02em;
    }

    .page-lede {
      margin: var(--gym-space-2) 0 0;
      max-width: 68ch;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-lg);
      line-height: 1.55;
    }

    .page-meta {
      margin: var(--gym-space-2) 0 0;
      color: var(--gym-text-dim);
      font-size: var(--gym-text-xs);
    }

    .page-header-actions {
      display: flex;
      align-items: center;
      gap: var(--gym-space-4);
      flex: none;
    }

    /* Analysis page: the console is a band, not a card. */
    .analysis-page .gym-ingest-console {
      margin-bottom: var(--gym-space-6);
      padding: var(--gym-space-4) 0 var(--gym-space-3);
      background: transparent;
      border: 0;
      border-top: 1px solid var(--gym-border-subtle);
      border-bottom: 1px solid var(--gym-border-subtle);
      border-radius: 0;
    }

    .analysis-page .gym-ingest-fields {
      gap: var(--gym-space-4);
    }

    .analysis-page .gym-field-label {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 500;
      line-height: 1.2;
      letter-spacing: 0;
      text-transform: none;
    }

    .analysis-page .gym-field-grow {
      flex: 1 1 auto;
      min-width: 220px;
    }

    .analysis-page .gym-field-submit {
      margin-left: auto;
    }

    .analysis-page .gym-input-text,
    .analysis-page .gym-select {
      min-height: 40px;
    }

    .analysis-page .gym-pill-opt {
      min-height: 36px;
    }

    .analysis-page .gym-field-submit .btn {
      min-height: 40px;
    }

    /* Selected pills are a state, not an action: no accent in the console. */
    .analysis-page .gym-pill-selected {
      background-color: var(--gym-bg-card-hover) !important;
      color: var(--gym-text-main) !important;
      border-color: var(--gym-border-selected) !important;
    }

    /* Empty state */
    .gym-empty-state {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
      gap: var(--gym-space-7);
      padding: var(--gym-space-2) 0 var(--gym-space-5);
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .gym-empty-title {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-lg);
      font-weight: 650;
      line-height: 1.2;
      letter-spacing: -0.015em;
    }

    .gym-empty-body {
      margin: var(--gym-space-3) 0 0;
      max-width: 58ch;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      line-height: 1.6;
    }

    .gym-empty-action {
      margin-top: var(--gym-space-3);
    }

    .gym-empty-text-button {
      padding: 0;
      border: 0;
      background: none;
      color: var(--gym-text-muted);
      font: inherit;
      font-size: var(--gym-text-sm);
      text-decoration: underline;
      text-decoration-color: var(--gym-border-card);
      text-underline-offset: 3px;
      cursor: pointer;
    }

    .gym-empty-text-button:hover {
      color: var(--gym-text-main);
      text-decoration-color: var(--gym-text-muted);
    }

    .gym-empty-steps {
      list-style: none;
      margin: 0;
      padding: 0;
      border-top: 1px solid var(--gym-border-subtle);
    }

    .gym-empty-steps li {
      display: grid;
      grid-template-columns: 28px 1fr;
      gap: var(--gym-space-3);
      padding: var(--gym-space-3) 0;
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .gym-empty-step-n {
      color: var(--gym-text-dim);
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
      line-height: 1.7;
    }

    .gym-empty-steps strong {
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      font-weight: 600;
    }

    .gym-empty-steps p {
      margin: var(--gym-space-1) 0 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      line-height: 1.55;
    }

    /* Progress band */
    .progress-band {
      padding: var(--gym-space-4) 0 var(--gym-space-5);
      border-top: 1px solid var(--gym-border-subtle);
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .progress-band-head {
      display: flex;
      align-items: center;
      gap: var(--gym-space-3);
    }

    .progress-band-title {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-lg);
      font-weight: 650;
      line-height: 1.2;
      letter-spacing: -0.015em;
    }

    .progress-band-meta {
      color: var(--gym-text-dim);
      font-size: var(--gym-text-xs);
      font-variant-numeric: tabular-nums;
    }

    .progress-band-spinner {
      width: 18px;
      height: 18px;
      flex: none;
      border: 2px solid var(--gym-border-card);
      border-top-color: var(--gym-text-main);
      border-radius: 50%;
      animation: gym-spin 700ms linear infinite;
    }

    .progress-band-cancel {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 24px;
      margin-left: auto;
      padding: 0;
      border: 0;
      background: none;
      color: var(--gym-text-muted);
      font: inherit;
      font-size: var(--gym-text-sm);
      text-decoration: underline;
      text-underline-offset: 3px;
      cursor: pointer;
    }

    .progress-band-track {
      height: 4px;
      margin-top: var(--gym-space-4);
      background: var(--gym-bg-card);
      border-radius: var(--gym-radius-chip);
      overflow: hidden;
    }

    .progress-band-fill {
      display: block;
      width: 38%;
      height: 100%;
      background: var(--gym-text-main);
      opacity: 0.85;
      animation: gym-progress-indeterminate 1.4s ease-in-out infinite;
    }

    @keyframes gym-progress-indeterminate {
      0% { transform: translateX(-110%); }
      100% { transform: translateX(290%); }
    }

    @keyframes gym-spin {
      to { transform: rotate(360deg); }
    }

    .progress-band-steps {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-5);
      margin-top: var(--gym-space-3);
      color: var(--gym-text-dim);
      font-size: var(--gym-text-xs);
    }

    .progress-band-step.is-done { color: var(--gym-text-muted); }
    .progress-band-step.is-active { color: var(--gym-text-main); font-weight: 600; }

    .progress-band-note {
      margin: var(--gym-space-3) 0 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    /* Analysis summary */
    .analysis-summary {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      gap: var(--gym-space-6);
      padding-bottom: var(--gym-space-4);
      border-bottom: 1px solid var(--gym-border-subtle);
      margin-bottom: var(--gym-space-5);
    }

    .analysis-summary-line {
      margin: 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-base);
      line-height: 1.5;
    }

    .analysis-summary-line strong {
      color: var(--gym-text-main);
      font-weight: 650;
    }

    .analysis-summary-blunders {
      color: var(--gym-eval-blunder-small);
      font-weight: 650;
      font-variant-numeric: tabular-nums;
    }

    .gym-progress-sample-chart {
      margin-top: var(--gym-space-2);
    }

    .gym-progress-sample-preview {
      margin-top: var(--gym-space-5);
    }

    .gym-quick-switch-status {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .analysis-page-report .page-title {
      font-size: var(--gym-text-xl);
    }

    .analysis-summary-sub {
      margin: var(--gym-space-2) 0 0;
      color: var(--gym-text-dim);
      font-size: var(--gym-text-xs);
      font-variant-numeric: tabular-nums;
    }

    .analysis-summary-actions {
      display: flex;
      align-items: center;
      gap: var(--gym-space-4);
      flex: none;
    }

    /* SPEC: US-28 AC 7 / DESIGN.md targets: every interactive target is at
       least 24 x 24 on desktop. The box grows; the label's type does not. */
    .analysis-summary-text {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      padding: 0;
      border: 0;
      background: none;
      color: var(--gym-text-muted);
      font: inherit;
      font-size: var(--gym-text-sm);
      text-decoration: underline;
      text-underline-offset: 3px;
      cursor: pointer;
    }

    .analysis-summary-text:hover { color: var(--gym-text-main); }

    .analysis-summary-link {
      padding-bottom: var(--gym-space-1);
      border-bottom: 1px solid var(--gym-border-card);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      text-decoration: none;
    }

    .analysis-summary-link:hover {
      color: var(--gym-text-main);
      border-bottom-color: var(--gym-text-muted);
    }

    .analysis-summary-primary {
      min-height: 40px;
    }

    /* Chip contrast (D-T1 / F-12 adjacent): the solid taxonomy colours are
       fills, not small text. */
    .chip-win {
      background: rgba(var(--gym-eval-best-rgb), 0.14);
      color: var(--gym-eval-best-text);
      border-color: rgba(var(--gym-eval-best-rgb), 0.35);
    }

    .chip-draw {
      background: rgba(var(--gym-text-main-rgb), 0.08);
      color: var(--gym-text-main);
      border-color: rgba(var(--gym-text-main-rgb), 0.22);
    }

    /* SPEC: US-28 AC 7 colour roles: a filter is a state, not an action, so the
       selected pill is neutral at every width (the one accent action belongs to
       the view, not to the games rail). */
    .gym-workbench .gym-filter-pill {
      min-height: 28px;
      background: transparent;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .gym-workbench .gym-filter-pill:hover {
      background: var(--gym-bg-card);
      border-color: var(--gym-border-hover);
      color: var(--gym-text-main);
    }

    .gym-workbench .gym-filter-pill:active {
      background: var(--gym-bg-active-row);
    }

    .gym-workbench .gym-filter-pill-active {
      background: var(--gym-bg-card-hover) !important;
      border-color: var(--gym-border-card) !important;
      color: var(--gym-text-main) !important;
    }

    /* Desktop workbench: flat plane, hairlines, no nested cards. The mobile
       analysis keeps the segmented tabs; this block stops at 980px. */
    @media (min-width: 981px) {
      .gym-workbench {
        grid-template-columns: 260px minmax(0, 1fr) 380px;
        gap: 0 var(--gym-space-6);
      }

      .gym-workbench .gym-analysis-games-col {
        padding: 0 var(--gym-space-5) 0 0;
        background: transparent;
        border: 0;
        border-right: 1px solid var(--gym-border-subtle);
        border-radius: 0;
        max-height: none;
        overflow: visible;
      }

      .gym-workbench .gym-games-col-header {
        gap: var(--gym-space-2);
        padding-bottom: var(--gym-space-3);
        border-bottom: 1px solid var(--gym-border-subtle);
        margin-bottom: var(--gym-space-1);
      }

      .gym-workbench .gym-section-title-sm {
        color: var(--gym-text-muted);
        font-size: var(--gym-text-xs);
        font-weight: 600;
        letter-spacing: 0;
        text-transform: none;
      }

      .gym-workbench .gym-games-scroll-list {
        gap: 0;
        max-height: calc(min(80vh, 740px) + 48px);
        overflow-y: auto;
      }

      .gym-workbench .gym-game-card {
        padding: 12px 8px 12px 0;
        border: 0;
        border-bottom: 1px solid var(--gym-border-subtle);
        border-radius: 0;
        background: transparent;
      }

      .gym-workbench .gym-game-card:hover { background: var(--gym-bg-card); }

      .gym-workbench .gym-game-card-active {
        padding-left: 8px;
        border-color: var(--gym-border-subtle) !important;
        background: var(--gym-bg-active-row) !important;
        box-shadow: none !important;
      }

      .gym-workbench .gym-analysis-inspector-col {
        padding-left: var(--gym-space-6);
        border-left: 1px solid var(--gym-border-subtle);
      }

      .gym-workbench .gym-board-box {
        padding: 0;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
      }

      .gym-workbench .gym-board-stepper-header {
        padding-bottom: var(--gym-space-3);
        margin-bottom: var(--gym-space-3);
        border-bottom: 1px solid var(--gym-border-subtle);
      }

      .gym-workbench .gym-inspector-card,
      .gym-workbench .gym-sidebar-panel {
        padding: 0;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
      }

      .gym-workbench .gym-section-header {
        padding-bottom: var(--gym-space-2);
        border-bottom: 1px solid var(--gym-border-subtle);
      }

      .gym-workbench .gym-blunder-btn-list { gap: 0; }

      .gym-workbench .gym-blunder-btn {
        padding: var(--gym-space-3) 0;
        background: transparent;
        border: 0;
        border-bottom: 1px solid var(--gym-border-subtle);
        border-radius: 0;
      }

      .gym-workbench .gym-blunder-btn-active {
        padding-left: 8px;
        padding-right: 8px;
        border-color: rgba(var(--gym-eval-blunder-rgb), 0.4) !important;
        background: rgba(var(--gym-eval-blunder-rgb), 0.14) !important;
      }

      .gym-workbench .gym-coaching-card {
        padding: var(--gym-space-3) 0;
        background: var(--gym-bg-panel);
        border: 0;
        border-top: 1px solid var(--gym-border-subtle);
        border-bottom: 1px solid var(--gym-border-subtle);
        border-radius: 0;
      }

      .gym-workbench .gym-card-tag {
        color: var(--gym-text-muted);
        font-size: var(--gym-text-xs);
        font-weight: 600;
        letter-spacing: 0;
        text-transform: none;
      }

      .gym-workbench .gym-inspector-card .gym-btn-primary {
        min-height: 36px;
        background: transparent;
        border: 1px solid var(--gym-border-card);
        border-radius: var(--gym-radius-control);
        color: var(--gym-text-main);
        font-size: var(--gym-text-sm);
        font-weight: 600;
      }

      .gym-workbench .gym-inspector-card .gym-btn-primary:hover {
        background: var(--gym-bg-card);
        border-color: var(--gym-border-card);
      }

      .gym-workbench .gym-panel-section {
        padding: var(--gym-space-3) 0;
        border-bottom: 1px solid var(--gym-border-subtle);
      }

      .gym-workbench .gym-panel-section:last-child { border-bottom: 0; }

      .gym-workbench .move-table-start {
        min-height: 28px;
        background: transparent;
        border: 1px solid var(--gym-border-card);
        border-radius: var(--gym-radius-chip);
        color: var(--gym-text-muted);
        font-size: var(--gym-text-xs);
      }

      .gym-workbench .move-table-cell {
        min-height: 30px;
        color: var(--gym-text-main);
        font-size: var(--gym-text-sm);
      }

      .gym-workbench .move-table-cell:hover { background: var(--gym-bg-card); }

      .gym-workbench .move-table-cell-active {
        background: rgba(var(--gym-brand-accent-rgb), 0.14);
        box-shadow: inset 0 0 0 1px rgba(var(--gym-brand-accent-rgb), 0.35);
      }

      .gym-workbench .gym-step-arrow-btn {
        min-height: 32px;
        background: transparent;
        border: 1px solid var(--gym-border-card);
        border-radius: var(--gym-radius-control);
        color: var(--gym-text-muted);
        font-size: var(--gym-text-xs);
      }

      .gym-workbench .control-bar-button {
        min-height: 36px;
        min-width: 36px;
        background: transparent;
        border: 1px solid var(--gym-border-card);
        border-radius: var(--gym-radius-control);
        color: var(--gym-text-muted);
      }
    }

    @media (max-width: 1100px) {
      .gym-empty-state {
        grid-template-columns: 1fr;
        gap: var(--gym-space-5);
      }

      .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--gym-space-3);
      }

      .analysis-summary {
        flex-direction: column;
        align-items: stretch;
        gap: var(--gym-space-4);
      }

      .analysis-summary-actions {
        flex-wrap: wrap;
        gap: var(--gym-space-3);
      }

      .analysis-summary-primary {
        order: 3;
        width: 100%;
      }
    }

    /* SPEC: US-28 AC 1: two rows at ≤900. The wordmark and account cluster
       share the first row; the four destinations are a full-width 44px row
       beneath them. The bar scrolls away (no sticky/fixed position) and there
       is no bottom bar or hamburger. */
    @media (max-width: 900px) {
      .app-header-flat {
        flex-wrap: wrap;
        gap: var(--gym-space-2) var(--gym-space-4);
        padding: 12px 0;
      }

      .app-header-brand { order: 1; }
      .app-header-account { order: 2; margin-left: auto; }
      /* SPEC: US-28 AC 7: the four destinations are a structural four-way
         partition, not content-sized flex items. `flex: 1` with the default
         `min-width: auto` let each label's glyph width set its column, so the
         equal-column contract depended on the host font (CI run 481: the same
         320px row spread 10.05px on the runner's font and 0 on another). The
         explicit tracks hold at any font; the items may not widen them. */
      .app-header-nav {
        order: 3;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        width: 100%;
        margin-left: 0;
        gap: var(--gym-space-2);
        padding-top: 4px;
        border-top: 1px solid var(--gym-border-subtle);
      }

      .app-header-nav-item {
        min-width: 0;
        justify-content: center;
        min-height: 44px;
      }

      .app-header-account .btn,
      .app-header-account .btn-primary { min-height: 40px; }
    }

    @media (max-width: 767px) {
      .main-content { padding: 24px 0 48px; }

      .page-title { font-size: var(--gym-text-xl); }

      /* SPEC: US-31 / DESIGN §06: the phone board is the content width and
         still 1 / 1; the card and frame padding that produced 290px at 390 are
         removed in the flat session. */
      .training-workspace-flat .training-board-frame {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: none;
      }

      .training-workspace-flat .training-workspace-board {
        max-width: 100%;
      }

      .page-header-actions .gym-btn-secondary {
        min-height: 40px;
      }

      /* SPEC: US-28 AC 1: at 320 the wordmark and the account action must share
         the first row. The phone wordmark drops the tagline (the design's 390
         header does the same) and may shrink; only the destinations wrap. */
      .app-header-brand {
        min-width: 0;
        flex: 1 1 auto;
      }

      .app-header-brand-tag { display: none; }

      /* SPEC: US-28 AC 7: the destination label drops to the 12px step of the
         12/14/16/20/28/40 ramp on a phone, so `Openings` fits its 66px column
         in the widest devShell font instead of relying on a narrow fallback. */
      .app-header-nav-item { font-size: var(--gym-text-xs); }

      .analysis-page .gym-ingest-fields {
        flex-direction: column;
        align-items: stretch;
      }

      .analysis-page .gym-field-group,
      .analysis-page .gym-field-grow,
      .analysis-page .gym-field-submit {
        width: 100%;
        margin-left: 0;
      }

      .analysis-page .gym-platform-pills { width: 100%; }
      .analysis-page .gym-pill-opt { flex: 1; min-height: 40px; }
      .analysis-page .gym-input-text,
      .analysis-page .gym-select,
      .analysis-page .gym-field-submit .btn { min-height: 44px; }

      .gym-empty-text-button {
        display: inline-flex;
        align-items: center;
        min-height: 40px;
      }
      .analysis-summary-text,
      .analysis-summary-link,
      .gym-chart-action { min-height: 40px; display: inline-flex; align-items: center; }
    }

    .gym-mobile-tab-btn:hover:not(:disabled) {
      background: var(--gym-bg-card-hover);
      color: var(--gym-text-main);
    }

    .gym-mobile-tab-btn:active:not(:disabled) {
      background: var(--gym-bg-active-row);
    }

    .progress-band-cancel:hover {
      background: var(--gym-bg-card-hover);
      border-color: var(--gym-border-hover);
      color: var(--gym-text-main);
    }

    .progress-band-cancel:active {
      background: var(--gym-bg-active-row);
    }

    @media (prefers-reduced-motion: reduce) {
      .progress-band-spinner { animation: none; }
      .progress-band-fill { animation: none; width: 100%; opacity: 0.5; transform: none; }
      .analysis-page button,
      .analysis-page a,
      .analysis-page .gym-pill-opt,
      .analysis-page .gym-game-card,
      .analysis-page .gym-mobile-tab-btn,
      .analysis-page .gym-filter-pill { transition: none; }
    }

    /* The analysis error is a band, not a card; the message names the failure
       and the retry is next to it. */
    .analysis-page .alert {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--gym-space-5);
      margin-bottom: var(--gym-space-5);
      padding: var(--gym-space-4) 0 var(--gym-space-5);
      background: transparent;
      border: 0;
      border-top: 1px solid var(--gym-border-subtle);
      border-bottom: 1px solid var(--gym-border-subtle);
      border-radius: 0;
    }

    .analysis-page .alert .alert-heading {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-lg);
      font-weight: 650;
      line-height: 1.2;
      letter-spacing: -0.015em;
    }

    .analysis-page .alert .alert-message {
      margin: var(--gym-space-2) 0 0;
      max-width: 70ch;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .analysis-error-retry {
      flex: none;
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      margin-top: var(--gym-space-1);
      padding: 0;
      border: 0;
      background: none;
      color: var(--gym-text-muted);
      font: inherit;
      font-size: var(--gym-text-sm);
      text-decoration: underline;
      text-underline-offset: 3px;
      cursor: pointer;
    }

    .analysis-error-retry:hover { color: var(--gym-text-main); }

    @media (max-width: 767px) {
      .analysis-page .alert { flex-direction: column; }
      .analysis-error-retry { min-height: 40px; display: inline-flex; align-items: center; }
      /* SPEC: US-28 AC 7 / design review S19-A: the new band control meets the
         phone target floor and the head may wrap rather than tighten at 320. */
      .progress-band-head { flex-wrap: wrap; }
      .progress-band-cancel { min-height: 40px; }
      .analysis-page .theme-pill,
      .analysis-page .gym-inspector-card .gym-btn-wide {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }
    }

    /* One accent per view: the inspector's training action is a secondary until
       it is the screen's primary. */
    .analysis-page .gym-inspector-card .gym-btn-primary {
      min-height: 36px;
      background: transparent;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      font-weight: 600;
    }

    .analysis-page .gym-inspector-card .gym-btn-primary:hover {
      background: var(--gym-bg-card);
      border-color: var(--gym-border-card);
    }

    /* A disabled submit stays legible; it is a state, not a muddy accent. */
    .analysis-page .gym-field-submit .btn:disabled {
      background: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      color: var(--gym-text-muted);
      opacity: 1;
    }

    /* The report has one accent action: the console's rerun is secondary. */
    .analysis-page .gym-inspector-card .btn-primary {
      min-height: 36px;
      background: transparent;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      font-weight: 600;
    }

    .analysis-page .gym-inspector-card .btn-primary:hover {
      background: var(--gym-bg-card);
      border-color: var(--gym-border-card);
    }

    /* Theme chips are links, not the legacy blue anchor. */
    .themes-tag-row {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-2);
    }

    .theme-pill {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      padding: 2px 8px;
      background: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-chip);
      color: var(--gym-text-main);
      font-size: var(--gym-text-xs);
      text-decoration: none;
    }

    .theme-pill:hover {
      background: var(--gym-bg-card-hover);
      border-color: var(--gym-border-card);
    }

    /* Shared inspector surfaces: the mobile view keeps the card frame but not
       the accent left rule or the uppercase micro tag. */
    .analysis-page .gym-coaching-card {
      padding: var(--gym-space-3) 0;
      background: var(--gym-bg-panel);
      border: 0;
      border-top: 1px solid var(--gym-border-subtle);
      border-bottom: 1px solid var(--gym-border-subtle);
      border-radius: 0;
    }

    .analysis-page .gym-card-tag {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
      letter-spacing: 0;
      text-transform: none;
    }

    /* US-28 AC 3 / D-195: one focus ring, from the palette, on every surface.
       The browser default measured 1.03:1 on the page, 1.10:1 in the header and
       1.23:1 on a card; the solid accent measures 7.1-8.5:1. Two pixels with an
       offset, and no rule removes it. */
    :focus-visible {
      outline: 2px solid var(--gym-focus-ring);
      outline-offset: 2px;
      /* Buttons transition `all`; without this the ring interpolates from the
         text colour for 150 ms before it becomes visible. */
      transition: none;
    }

    /* ---------------------------------------------------------------------
       SPEC: US-29 / US-30: the account surface and its header entry.
       The page is the design's one-column forms + right-rail membership on
       desktop, one column below 1100, and a compact stacked page on a phone.
       Accent appears on exactly one action per state: `Continue with Lichess`
       signed out, `Save Chess Accounts` signed in.
       --------------------------------------------------------------------- */
    .account-page {
      padding-bottom: var(--gym-space-8);
    }

    .account-page .page-header-actions .btn {
      min-height: 40px;
    }

    .app-header-account-link {
      display: inline-flex;
      align-items: center;
      gap: var(--gym-space-2);
      min-height: 40px;
      padding: 0 var(--gym-space-3) 0 var(--gym-space-1);
      border: 1px solid transparent;
      border-radius: var(--radius-full);
      color: var(--gym-text-main);
      text-decoration: none;
    }

    .app-header-account-link:hover {
      background: var(--gym-bg-card);
      border-color: var(--gym-border-card);
    }

    .app-header-account-link[aria-current="page"] {
      border-color: var(--gym-border-card);
      background: var(--gym-bg-card);
    }

    .account-avatar {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      height: 28px;
      border-radius: var(--radius-full);
      background: var(--gym-bg-input);
      border: 1px solid var(--gym-border-card);
      color: var(--gym-text-main);
      font-size: var(--gym-text-xs);
      font-weight: 700;
    }

    .account-entry-name {
      font-size: var(--gym-text-sm);
      font-weight: 600;
      max-width: 140px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .account-entry-chevron {
      display: inline-flex;
      color: var(--gym-text-dim);
    }

    /* SPEC: US-29 AC 3: the signed-out account entry is a plain text link —
       no button chrome, never the one accent fill on a screen. */
    .app-header-signin {
      display: inline-flex;
      align-items: center;
      min-height: 40px;
      padding: 0 var(--gym-space-2);
      border: 0;
      border-radius: 0;
      background: transparent;
      color: var(--gym-text-main);
      text-decoration: none;
      font-size: var(--gym-text-sm);
    }

    .app-header-signin:hover {
      color: var(--gym-brand-accent-fg);
      text-decoration: underline;
    }

    .account-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 400px;
      gap: var(--gym-space-7);
      align-items: start;
      margin-top: var(--gym-space-7);
    }

    .account-main {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-7);
      min-width: 0;
    }

    .account-side {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-5);
      position: sticky;
      top: var(--gym-space-5);
    }

    .account-section h2 {
      font-size: var(--gym-text-lg);
      color: var(--gym-text-main);
    }

    .account-section-lede {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      margin-top: var(--gym-space-1);
      max-width: 70ch;
    }

    .account-onboarding {
      margin-top: var(--gym-space-4);
      padding: var(--gym-space-3) var(--gym-space-4);
      border-left: 2px solid var(--gym-brand-accent);
      background: var(--gym-bg-panel);
      border-radius: var(--gym-radius-control);
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
    }

    .account-panel {
      margin-top: var(--gym-space-4);
      padding: 0 var(--gym-space-5);
      background: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--radius-lg);
    }

    .account-panel .form-control {
      width: 100%;
    }

    .platform-row {
      display: grid;
      grid-template-columns: 150px minmax(0, 1fr);
      gap: var(--gym-space-5);
      padding: var(--gym-space-4) 0;
      border-bottom: 1px solid var(--gym-border-subtle);
      align-items: start;
    }

    .platform-row:last-child {
      border-bottom: 0;
    }

    .platform-name {
      font-size: var(--gym-text-base);
      font-weight: 650;
      color: var(--gym-text-main);
    }

    .platform-name small {
      display: block;
      margin-top: var(--gym-space-1);
      color: var(--gym-text-dim);
      font-size: var(--gym-text-xs);
      font-weight: 400;
    }

    .platform-handle {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-3);
      min-width: 0;
    }

    .account-page .form-hint {
      margin-top: var(--gym-space-2);
      line-height: 1.5;
    }

    .tc-list {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-2);
    }

    .tc {
      display: inline-flex;
      align-items: center;
      gap: var(--gym-space-2);
      min-height: 32px;
      font-family: inherit;
      padding: 0 var(--gym-space-2);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--gym-radius-chip);
      background: var(--gym-bg-input);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 600;
      cursor: pointer;
    }

    .tc[aria-pressed="true"] {
      border-color: var(--gym-border-selected);
      background: var(--gym-bg-card);
      color: var(--gym-text-main);
    }

    .tc .tc-check {
      display: inline-flex;
      color: var(--gym-text-main);
    }

    .tc-save {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--gym-space-4);
      padding-top: var(--gym-space-4);
    }

    .tc-save .form-hint {
      max-width: 52ch;
    }

    .form-feedback.text-success {
      color: var(--gym-eval-best-text);
    }

    .membership {
      padding: var(--gym-space-5);
      background: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--radius-lg);
    }

    .membership h2 {
      font-size: var(--gym-text-lg);
      color: var(--gym-text-main);
    }

    .membership .plan {
      display: flex;
      align-items: center;
      gap: var(--gym-space-2);
      margin-top: var(--gym-space-2);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .membership .plan strong {
      color: var(--gym-text-main);
    }

    .membership .status-dot,
    .account-summary .status-dot {
      width: 7px;
      height: 7px;
      border-radius: var(--radius-full);
      background: var(--gym-text-muted);
      flex: none;
    }

    .membership-streams {
      margin-top: var(--gym-space-2);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .membership-subhead {
      margin-top: var(--gym-space-5);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    .membership-list {
      margin-top: var(--gym-space-2);
      border-top: 1px solid var(--gym-border-subtle);
    }

    .membership-item {
      display: flex;
      align-items: flex-start;
      gap: var(--gym-space-2);
      padding: var(--gym-space-2) 0;
      border-bottom: 1px solid var(--gym-border-subtle);
      font-size: var(--gym-text-sm);
      color: var(--gym-text-muted);
    }

    /* SPEC: US-28 AC 2 / US-29 AC 3 / US-30 AC 4: a capability tick means
       "included", so it takes the result-green role (DESIGN "Checked ticks are
       green"), never the muted text or the accent action. */
    .membership-check {
      display: inline-flex;
      color: var(--gym-chess-green);
      flex: none;
      margin-top: var(--gym-space-1);
    }

    .membership-action {
      width: 100%;
      margin-top: var(--gym-space-4);
      min-height: 40px;
    }

    .identity-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--gym-space-5);
      padding: 16px 0;
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .identity-label {
      font-size: var(--gym-text-sm);
      font-weight: 600;
      color: var(--gym-text-main);
    }

    .identity-label small {
      display: block;
      margin-top: var(--gym-space-1);
      font-size: var(--gym-text-xs);
      font-weight: 400;
      color: var(--gym-text-dim);
    }

    .identity-value {
      display: flex;
      align-items: center;
      gap: var(--gym-space-2);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .email-form {
      display: flex;
      align-items: center;
      gap: var(--gym-space-2);
      width: min(100%, 380px);
    }

    .email-form .form-control {
      flex: 1;
    }

    .notification-row {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--gym-space-5);
      padding: 16px 0;
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .notification-row:last-of-type {
      border-bottom: 0;
    }

    .notification-copy strong {
      display: block;
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
    }

    .notification-copy span {
      display: block;
      margin-top: var(--gym-space-1);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      line-height: 1.5;
      max-width: 62ch;
    }

    .toggle {
      display: flex;
      align-items: center;
      gap: var(--gym-space-2);
      flex: none;
      min-height: 24px;
      cursor: pointer;
    }

    .toggle input {
      appearance: none;
      width: 40px;
      height: 22px;
      border-radius: var(--radius-full);
      background: var(--gym-bg-card);
      border: 1px solid var(--gym-border-card);
      position: relative;
      flex: none;
      cursor: pointer;
    }

    .toggle input::after {
      content: "";
      position: absolute;
      top: var(--gym-space-1);
      left: var(--gym-space-1);
      width: 14px;
      height: 14px;
      border-radius: var(--radius-full);
      background: var(--gym-text-muted);
      transition: transform 150ms ease, background-color 150ms ease;
    }

    /* SPEC: US-29 AC 3 / DESIGN.md: a toggle is state, not an action, so the
       checked track is neutral. Accent is reserved for the one filled action. */
    .toggle input:checked {
      background: var(--gym-bg-active-row);
      border-color: var(--gym-border-card);
    }

    .toggle input:checked::after {
      transform: translateX(18px);
      background: var(--gym-text-main);
    }

    .toggle input:disabled {
      cursor: not-allowed;
      opacity: 0.55;
    }

    /* SPEC: DESIGN.md / US-29 AC 3: the knob is the one new transition; it
       collapses to zero like every other playback duration. Declared after the
       base rule so the cascade cannot resurrect it. */
    @media (prefers-reduced-motion: reduce) {
      .toggle input::after {
        transition: none;
      }
    }

    .auth-layout {
      display: grid;
      grid-template-columns: minmax(0, 1.15fr) minmax(340px, 1fr);
      gap: var(--gym-space-7);
      align-items: start;
      margin-top: var(--gym-space-7);
    }

    .auth-card {
      padding: var(--gym-space-7);
      background: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--radius-lg);
    }

    .auth-card h2 {
      font-size: var(--gym-text-xl);
      letter-spacing: -0.02em;
      color: var(--gym-text-main);
    }

    .auth-lede {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      line-height: 1.55;
      margin-top: var(--gym-space-2);
      max-width: 52ch;
    }

    .auth-wide {
      width: 100%;
      margin-top: var(--gym-space-3);
      min-height: 44px;
      justify-content: center;
    }

    .auth-card > .btn-primary {
      margin-top: var(--gym-space-5);
    }

    .auth-card .auth-divider {
      margin: var(--gym-space-5) 0 var(--gym-space-3);
    }

    .auth-email {
      display: grid;
      grid-template-columns: 1fr auto;
      align-items: end;
      gap: var(--gym-space-3);
    }

    .auth-email .form-group {
      margin: 0;
    }

    .auth-sent {
      margin-top: var(--gym-space-3);
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      border-left: 2px solid var(--gym-eval-best);
      padding-left: var(--gym-space-3);
    }

    .auth-side-note {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      line-height: 1.55;
    }

    .auth-side-note-terms {
      margin-top: var(--gym-space-2);
    }

    .auth-handle-note {
      display: flex;
      align-items: flex-start;
      gap: var(--gym-space-2);
      margin-top: var(--gym-space-5);
      padding-top: var(--gym-space-4);
      border-top: 1px solid var(--gym-border-subtle);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      line-height: 1.5;
    }

    .auth-handle-note .status-dot {
      flex: none;
      margin-top: var(--gym-space-2);
    }

    .auth-membership-link {
      display: inline-flex;
      align-items: center;
      align-self: flex-start;
      min-height: 24px;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      text-decoration: underline;
      text-underline-offset: 3px;
    }

    .auth-membership-link:hover {
      color: var(--gym-text-main);
    }

    .auth-side {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-5);
    }

    .auth-side-card {
      padding: var(--gym-space-5);
      background: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-subtle);
      border-radius: var(--radius-lg);
    }

    .auth-side-card h2 {
      font-size: var(--gym-text-lg);
      color: var(--gym-text-main);
    }

    .auth-list {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-4);
      margin-top: var(--gym-space-4);
    }

    .auth-list li {
      display: flex;
      flex-direction: row;
      align-items: flex-start;
      gap: var(--gym-space-2);
    }

    .auth-list-copy {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-1);
      min-width: 0;
    }

    /* The accepted account shot draws the "What you get" ticks in the
       result-green role, not the action accent (V-1 design review; the written
       DESIGN sentence that a checked feature takes text-main/muted contradicts
       the shot and is owed to the designer). */
    .auth-check {
      display: inline-flex;
      flex: none;
      margin-top: var(--gym-space-1);
      color: var(--gym-chess-green);
    }

    .auth-list strong {
      font-size: var(--gym-text-sm);
      font-weight: 600;
      color: var(--gym-text-main);
    }

    .auth-list small {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      line-height: 1.45;
    }

    .account-summary {
      display: none;
    }

    .account-loading {
      margin-top: var(--gym-space-5);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    @media (max-width: 1100px) {
      /* DESIGN.md: the 768-1100 middle tier is account single column, with the
         compact membership summary above the forms linking to the panel. */
      .account-grid,
      .auth-layout {
        grid-template-columns: 1fr;
      }

      .account-side {
        position: static;
      }

      .account-summary {
        display: flex;
        align-items: center;
        gap: var(--gym-space-2);
        padding: var(--gym-space-3) 0;
        margin-top: var(--gym-space-4);
        border-top: 1px solid var(--gym-border-subtle);
        border-bottom: 1px solid var(--gym-border-subtle);
        color: var(--gym-text-muted);
        font-size: var(--gym-text-sm);
      }

      /* SPEC: US-30 AC 4 / DESIGN.md §07: the compact summary is the plan and
         the active date only — the stream count belongs to the rail. */
      .account-summary-copy {
        display: inline-flex;
        align-items: baseline;
        gap: var(--gym-space-2);
        min-width: 0;
      }

      .account-summary strong {
        color: var(--gym-text-main);
      }

      .account-summary .gym-empty-text-button {
        margin-left: auto;
      }
    }

    @media (max-width: 767px) {
      /* DESIGN.md §07: on a phone the compact summary is a deliberate two-line
         block — plan, then the active date — with no separator to orphan and no
         stream segment competing with the rail. */
      .account-summary {
        align-items: flex-start;
      }

      .account-summary .status-dot {
        margin-top: 0.45em;
      }

      .account-summary-copy {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
      }
    }

    @media (max-width: 900px) {

      .app-header-account-link,
      .app-header-signin {
        min-height: 44px;
      }

      .app-header-account-link {
        border: 1px solid var(--gym-border-card);
        border-radius: var(--radius-full);
        padding: 0 var(--gym-space-3);
      }

      .app-header-signin {
        padding: 0 var(--gym-space-2);
      }

      .account-entry-name {
        max-width: 110px;
      }
    }

    @media (max-width: 767px) {
      .auth-membership-link {
        min-height: 40px;
      }

      .account-grid {
        margin-top: var(--gym-space-5);
        gap: var(--gym-space-6);
      }

      .platform-row {
        grid-template-columns: 1fr;
        gap: var(--gym-space-3);
      }

      .tc {
        min-height: 40px;
      }

      .tc-save {
        flex-direction: column;
        align-items: stretch;
      }

      .tc-save .btn {
        width: 100%;
        min-height: 44px;
      }

      .identity-row,
      .notification-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--gym-space-3);
      }

      .email-form {
        width: 100%;
        flex-wrap: wrap;
      }

      .email-form .btn {
        min-height: 44px;
      }

      .auth-card {
        padding: var(--gym-space-5);
      }

      .auth-email {
        grid-template-columns: 1fr;
      }

      .auth-email .btn {
        width: 100%;
      }

      .auth-wide {
        min-height: 44px;
      }

      .toggle {
        min-height: 40px;
      }

      .toggle input {
        width: 44px;
        height: 24px;
      }

      .toggle input::after {
        width: 16px;
        height: 16px;
      }

      .toggle input:checked::after {
        transform: translateX(18px);
      }
    }

    /* ==========================================================================
       A-1 · Analysis screen set (SPEC: US-01, US-02, US-26, US-28 AC 5/7)
       The console is a band, the report is one summary + three flat regions,
       and at ≤1100 the one board sits above the Games/Blunders/Move sheet
       segmented body. These rules are appended after the legacy workbench so
       the design values win at equal specificity.
       ========================================================================== */

    /* Quick switch: saved streams are a state chip, not a second accent action. */
    .gym-quick-switch {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-2);
      margin-bottom: var(--gym-space-3);
    }

    .gym-quick-switch-chip {
      min-height: 36px;
      padding: var(--gym-space-1) var(--gym-space-2);
      background: transparent;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-chip);
      color: var(--gym-text-muted);
      font: inherit;
      font-size: var(--gym-text-xs);
      font-weight: 600;
      cursor: pointer;
    }

    .gym-quick-switch-chip:hover {
      color: var(--gym-text-main);
      background: var(--gym-bg-card);
    }

    .gym-quick-switch-chip-active {
      color: var(--gym-text-main);
      background: var(--gym-bg-card-hover);
      border-color: var(--gym-border-card);
    }

    /* The report summary's disabled explanation. */
    .analysis-summary-note {
      margin: var(--gym-space-2) 0 0;
      max-width: 65ch;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      line-height: 1.5;
    }

    .analysis-partial {
      margin: 0 0 var(--gym-space-4);
      padding: var(--gym-space-3) 0;
      border-top: 1px solid var(--gym-border-subtle);
      border-bottom: 1px solid var(--gym-border-subtle);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    /* The filter's empty result is a state with a way back, never a dead end. */
    .gym-games-filter-empty {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: var(--gym-space-2);
      padding: var(--gym-space-4) 0;
      color: var(--gym-text-muted);
    }

    .gym-games-filter-empty-title {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      font-weight: 650;
    }

    .gym-games-filter-empty-hint {
      margin: 0;
      font-size: var(--gym-text-xs);
      line-height: 1.5;
    }

    .gym-games-filter-empty-action {
      min-height: 36px;
      padding: var(--gym-space-1) var(--gym-space-2);
      background: transparent;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      color: var(--gym-text-main);
      font: inherit;
      font-size: var(--gym-text-sm);
      font-weight: 600;
      cursor: pointer;
    }

    .gym-games-filter-empty-action:hover {
      background: var(--gym-bg-card);
    }

    .gym-analysis-board-col .gym-analysis-empty {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-2);
      padding: var(--gym-space-5) var(--gym-space-4);
      background: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      text-align: left;
    }

    .gym-analysis-empty-title {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      font-weight: 650;
    }

    .gym-analysis-empty-hint {
      margin: 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
      line-height: 1.5;
    }

    /* Played / Best / Drop: three aligned values, tabular numerals. */
    .gym-blunder-pair {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: var(--gym-space-3);
      padding: var(--gym-space-2) 0;
      border-top: 1px solid var(--gym-border-subtle);
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .gym-blunder-pair-item {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-1);
      min-width: 0;
    }

    .gym-blunder-pair-label {
      color: var(--gym-text-dim);
      font-size: var(--gym-text-xs);
    }

    .gym-blunder-pair-value {
      color: var(--gym-text-main);
      font-family: var(--font-mono);
      font-size: var(--gym-text-sm);
      font-variant-numeric: tabular-nums;
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .gym-blunder-pair-drop { color: var(--gym-eval-blunder-small); }

    /* Desktop: the designed flat three-region workspace (rail 260 / arena
       fluid / inspector 400) with the 720px board centred in its arena. */
    @media (min-width: 1101px) {
      .analysis-page .gym-analysis-workspace {
        grid-template-columns: 260px minmax(0, 1fr) 400px;
        gap: 0 var(--gym-space-6);
        align-items: start;
      }

      .analysis-page .gym-analysis-games-col {
        grid-column: 1;
        grid-row: 1;
      }

      .analysis-page .gym-analysis-board-col {
        grid-column: 2;
        grid-row: 1;
      }

      .analysis-page .gym-analysis-inspector-col {
        grid-column: 3;
        grid-row: 1;
      }
    }

    /* Middle and narrow: one board first, then the segmented body. The board is
       mounted once (it is the same Board_arena instance at every width). */
    @media (max-width: 1100px) {
      .analysis-page .gym-analysis-workspace {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: var(--gym-space-4);
        grid-template-columns: 1fr;
      }

      .analysis-page .gym-analysis-board-col {
        order: 1;
      }

      .analysis-page .gym-mobile-analysis-tabs {
        order: 2;
        display: flex;
        width: 100%;
      }

      .analysis-page .gym-mobile-zone-off { display: none; }

      .analysis-page .gym-analysis-games-col {
        order: 3;
        max-height: none;
        overflow: visible;
        padding: 0;
        background: transparent;
        border: 0;
      }

      .analysis-page .gym-analysis-inspector-col {
        order: 3;
        padding-left: 0;
        border-left: 0;
      }

      .analysis-page .gym-game-card {
        display: flex;
      }

      .analysis-page .gym-mobile-tab-btn { min-height: 44px; }
      .analysis-page .gym-filter-pill { min-height: 40px; }
      .analysis-page .gym-step-arrow-btn { min-height: 40px; }
      .analysis-page .gym-quick-switch-chip { min-height: 40px; }
      .analysis-page .gym-games-filter-empty-action { min-height: 40px; }

      /* The report's one accent stays full width; the secondary row wraps. */
      .analysis-summary-actions { flex-wrap: wrap; }
      .analysis-summary-primary { order: 3; width: 100%; }
    }

    @media (max-width: 767px) {
      /* SPEC: US-28 AC 7 / US-31: a standalone navigation link keeps the 40px
         phone target floor; the inline footer links keep 24px. */
      .session-breadcrumb a {
        min-height: 40px;
      }
    }

    @media (max-width: 767px) {
      /* Five time-control chips share the phone width in two rows rather than
         overflowing. */
      .analysis-page .gym-platform-pills { flex-wrap: wrap; }
      .analysis-page .gym-pill-opt {
        flex: 1 1 calc(33.333% - var(--gym-space-1));
        min-width: 0;
        padding-left: var(--gym-space-1);
        padding-right: var(--gym-space-1);
      }

      /* SPEC: US-28 AC 7: the signed Drop is a labelled value, not a
         truncation. At the phone floor it takes its own row and every pair
         label stays readable. */
      .gym-blunder-pair {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      .gym-blunder-pair-item:last-child {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: baseline;
        justify-content: space-between;
      }
    }

    /* A text action is still a target: 24px at every width, 40 on a phone. */
    .gym-empty-text-button {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
    }

    @media (max-width: 767px) {
      .gym-empty-text-button { min-height: 40px; }
    }

    /* Idle sample card: the accepted shot puts it beside the three steps. */
    .gym-empty-sample {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: var(--gym-space-2);
      padding: var(--gym-space-5);
      background: var(--gym-bg-surface);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
    }

    .gym-empty-sample-title {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-sm);
      font-weight: 650;
    }

    .gym-empty-sample-body {
      margin: 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      line-height: 1.5;
    }

    .gym-empty-sample-note {
      margin: var(--gym-space-2) 0 0;
      color: var(--gym-text-dim);
      font-size: var(--gym-text-xs);
    }

    /* The console's one provenance note, under the band. */
    .gym-ingest-note {
      margin: var(--gym-space-3) 0 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    /* A selected analysis tab is a state, not the action accent. */
    .analysis-page .gym-mobile-tab-active {
      color: var(--gym-text-main);
    }

    .gym-quick-switch-chip .gym-icon {
      vertical-align: -2px;
      margin-right: var(--gym-space-1);
    }

    /* SPEC: US-01 / US-02 AC 3: the whole-run failure is a named band with a
       real retry, never the filtered-empty state and never a clean set. */
    .analysis-failure {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: var(--gym-space-2);
      margin: 0 0 var(--gym-space-4);
      padding: var(--gym-space-4) 0 var(--gym-space-5);
      border-top: 1px solid var(--gym-border-subtle);
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .analysis-failure-title {
      margin: 0;
      color: var(--gym-text-main);
      font-size: var(--gym-text-lg);
      font-weight: 650;
      line-height: 1.2;
      letter-spacing: -0.015em;
    }

    .analysis-failure-message {
      margin: 0;
      max-width: 65ch;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      line-height: 1.5;
    }

    .analysis-failure-action {
      min-height: 40px;
      padding: var(--gym-space-1) var(--gym-space-3);
      background: transparent;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      color: var(--gym-text-main);
      font: inherit;
      font-size: var(--gym-text-sm);
      font-weight: 600;
      cursor: pointer;
    }

    .analysis-failure-action:hover {
      background: var(--gym-bg-card);
    }

    /* V-1: the phone touch floor and the full-width action rule (US-28 AC 7;
       DESIGN §Layout "full-width actions" at ≤767). */
    @media (max-width: 767px) {
      .opening-banner-dismiss {
        display: inline-flex;
        align-items: center;
        min-height: 40px;
      }

      .gym-progress-gate-actions {
        flex-direction: column;
        align-items: stretch;
      }

      .gym-progress-gate-actions > * {
        width: 100%;
        justify-content: center;
      }

      .gym-progress-upgrade a {
        display: inline-flex;
        align-items: center;
        min-height: 40px;
      }

      .auth-email input,
      .auth-email .btn {
        min-height: 40px;
      }
    }

    /* ==========================================================================
       SPEC: US-35 — designed game review. Board first; one playback host; a
       bounded move navigator; quiet accuracy and counts below the workspace.
       Every paint, surface, type step, radius and spacing value resolves to the
       existing token layer. The old developer block above is retired below.
       ========================================================================== */

    .gym-review-game-item {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-1);
      min-width: 0;
    }

    .gym-review-entry {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--gym-space-1) var(--gym-space-2);
      padding: 0 var(--gym-space-2) var(--gym-space-2);
      min-width: 0;
    }

    .gym-review-entry-btn {
      min-height: 40px;
      white-space: nowrap;
    }

    .gym-review-entry-locked .gym-review-entry-btn {
      color: var(--gym-text-muted);
      cursor: not-allowed;
    }

    .gym-review-locked-copy {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .gym-review {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-5);
      min-width: 0;
    }

    .gym-review-header {
      display: flex;
      flex-wrap: wrap;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--gym-space-3);
    }

    .gym-review-heading {
      margin: 0;
      font-size: var(--gym-text-xl);
      line-height: 1.2;
    }

    .gym-review-subheading {
      margin: 0;
      font-size: var(--gym-text-base);
      font-weight: 650;
    }

    .gym-review-meta {
      margin: var(--gym-space-1) 0 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      overflow-wrap: anywhere;
    }

    .gym-review-back {
      margin-left: auto;
    }

    .gym-review-workspace {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-6);
      min-width: 0;
    }

    .gym-review-board,
    .gym-review-side {
      min-width: 0;
    }

    .gym-review-board {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-2);
    }

    .gym-review-board-row {
      display: flex;
      align-items: stretch;
      gap: var(--gym-space-2);
      width: min(756px, 100%, max(320px, calc(100vh - (var(--gym-space-8) * 6) + 36px)));
      margin: 0 auto;
    }

    .gym-review-eval-bar {
      position: relative;
      flex: none;
      width: 34px;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      overflow: hidden;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-chip);
      background-color: var(--gym-board-frame);
    }

    .gym-review-eval-bar.is-flipped {
      justify-content: flex-start;
    }

    .gym-review-eval-fill {
      width: 100%;
      background-color: var(--gym-board-light);
      transition: height 200ms ease;
    }

    .gym-review-eval-score {
      position: absolute;
      left: 0;
      right: 0;
      text-align: center;
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
      font-weight: 700;
      line-height: 1.2;
      padding: 4px 1px;
      pointer-events: none;
      letter-spacing: -0.04em;
    }

    .gym-review-eval-score.is-white {
      bottom: 2px;
      color: var(--gym-board-frame);
    }

    .gym-review-eval-score.is-black {
      top: 2px;
      color: var(--gym-board-light);
    }

    .gym-review-eval-bar.is-flipped .gym-review-eval-score.is-white {
      bottom: auto;
      top: 2px;
    }

    .gym-review-eval-bar.is-flipped .gym-review-eval-score.is-black {
      top: auto;
      bottom: 2px;
    }

    .gym-review-board-stage {
      position: relative;
      flex: 1;
      min-width: 0;
    }

    .gym-review-board-stage .puzzle-board {
      width: 100%;
    }

    .gym-review-board-stage .puzzle-board .board-canvas-wrapper {
      width: 100%;
      max-width: none;
    }

    /* The review board is read-only: it must not pretend to be a move target or
       trap a phone's vertical swipe. */
    .gym-review-board-stage .puzzle-board [data-square] {
      cursor: default;
    }

    .gym-review-board-stage .puzzle-board .board-canvas-wrapper,
    .gym-review-board-stage .chess-board-svg {
      touch-action: pan-y;
    }

    .gym-review-board .board-control-bar {
      width: min(720px, 100%, max(320px, calc(100vh - (var(--gym-space-8) * 6))));
      margin: 0 auto;
    }

    .gym-review-board .control-bar-button {
      min-width: 44px;
      min-height: 44px;
    }

    .gym-review-badge {
      display: inline-flex;
      align-items: center;
      gap: var(--gym-space-1);
      width: fit-content;
      padding: 0 var(--gym-space-1);
      border-radius: var(--radius-full);
      font-size: var(--gym-text-xs);
      font-weight: 650;
      line-height: 1.4;
      white-space: nowrap;
    }

    .gym-review-badge .gym-icon {
      flex: none;
      color: var(--gym-text-main);
    }

    /* Optical centering for the independently authored marks. Percentages
       scale with the SVG, so the same correction holds at table and board size. */
    .gym-review-badge.badge-best .gym-icon {
      transform: translateY(2.8%);
    }

    .gym-review-badge.badge-inaccuracy .gym-icon {
      transform: translate(-1.4%, 1.4%);
    }

    .gym-review-badge.badge-mistake .gym-icon {
      transform: translate(0.4%, -2.9%);
    }

    .gym-review-badge.badge-blunder .gym-icon {
      transform: translate(3.1%, 10.6%);
    }

    .gym-review-badge-neutral .gym-icon {
      transform: translate(-0.3%, -0.6%);
    }

    .gym-review-badge.badge-brilliant {
      background-color: var(--gym-eval-brilliant-bg);
      color: var(--gym-eval-brilliant-text);
      border: 1px solid rgba(var(--gym-eval-brilliant-rgb), 0.45);
    }

    .gym-review-badge.badge-great {
      background-color: rgba(var(--gym-brand-accent-fg-rgb), 0.18);
      color: var(--gym-brand-accent-fg);
      border: 1px solid rgba(var(--gym-brand-accent-fg-rgb), 0.45);
    }

    .gym-review-badge.badge-excellent {
      background-color: var(--gym-eval-best-bg);
      color: var(--gym-eval-best-text);
      border: 1px solid rgba(var(--gym-eval-best-rgb), 0.35);
    }

    .gym-review-badge.badge-miss {
      background-color: var(--gym-eval-mistake-bg);
      color: var(--gym-eval-mistake-text);
      border: 1px solid rgba(var(--gym-eval-mistake-rgb), 0.45);
    }

    .gym-review-badge-neutral {
      background-color: var(--gym-bg-active-row);
      color: var(--gym-text-muted);
      border: 1px solid var(--gym-border-subtle);
    }

    .gym-review-badge-board {
      position: absolute;
      right: var(--gym-space-2);
      bottom: var(--gym-space-2);
      display: grid;
      place-items: center;
      width: var(--gym-space-5);
      height: var(--gym-space-5);
      gap: 0;
      padding: 0;
      pointer-events: none;
    }

    .gym-review-badge-board .gym-icon {
      position: absolute;
      left: 50%;
      top: 50%;
      translate: -50% -50%;
      filter: drop-shadow(0 1px 1px var(--gym-board-scrim));
    }

    .gym-review-badge-board.badge-brilliant {
      background-color: rgba(var(--gym-eval-brilliant-rgb), 0.92);
    }

    .gym-review-badge-board.badge-great {
      background-color: rgba(var(--gym-brand-accent-fg-rgb), 0.92);
    }

    .gym-review-badge-board.badge-best {
      background-color: rgba(var(--gym-eval-best-rgb), 0.9);
    }

    .gym-review-badge-board.badge-excellent {
      background-color: rgba(var(--gym-eval-best-rgb), 0.85);
    }

    .gym-review-badge-board.badge-inaccuracy {
      background-color: rgba(var(--gym-eval-inaccuracy-rgb), 0.9);
    }

    .gym-review-badge-board.badge-mistake {
      background-color: rgba(var(--gym-eval-mistake-rgb), 0.9);
    }

    .gym-review-badge-board.badge-miss {
      background-color: rgba(var(--gym-eval-mistake-rgb), 0.9);
    }

    .gym-review-badge-board.badge-blunder {
      background-color: rgba(var(--gym-eval-blunder-rgb), 0.9);
    }

    .gym-review-badge-board-anchored {
      right: auto;
      bottom: auto;
      transform: translate(-50%, -50%);
    }

    .gym-review-side {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-4);
    }

    .gym-review-inspector {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-3);
      padding: var(--gym-space-4) 0;
      border-top: 1px solid var(--gym-border-subtle);
      border-bottom: 1px solid var(--gym-border-subtle);
      min-height: calc(var(--gym-space-8) * 3.5);
    }

    .gym-review-selection {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: var(--gym-space-2);
    }

    .gym-review-selection-title {
      margin: 0;
      font-family: var(--font-mono);
      font-size: var(--gym-text-lg);
      font-weight: 650;
      overflow-wrap: anywhere;
    }

    .gym-review-selection-meta {
      display: inline-flex;
      align-items: center;
      gap: var(--gym-space-2);
    }

    .gym-review-selection-clock {
      color: var(--gym-text-muted);
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
    }

    .gym-review-preview-actions {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-2);
    }

    .gym-review-action,
    .gym-review-filter {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 40px;
      padding: var(--gym-space-2) var(--gym-space-3);
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-control);
      background-color: var(--gym-bg-input);
      color: var(--gym-text-main);
      font: inherit;
      font-size: var(--gym-text-sm);
      font-weight: 600;
      cursor: pointer;
      transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
    }

    .gym-review-action:hover:not(:disabled),
    .gym-review-filter:hover {
      background-color: var(--gym-bg-card-hover);
      border-color: var(--gym-border-strong);
    }

    .gym-review-action:active:not(:disabled),
    .gym-review-filter:active {
      background-color: var(--gym-bg-active-row);
    }

    .gym-review-action[aria-pressed="true"] {
      background-color: var(--gym-bg-active-row);
      border-color: var(--gym-border-selected);
    }

    .gym-review-action:disabled {
      color: var(--gym-text-muted);
      border-color: var(--gym-border-subtle);
      cursor: not-allowed;
    }

    .gym-review-selection-note {
      margin: 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
    }

    .gym-review-facts {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
      gap: var(--gym-space-1) var(--gym-space-3);
      margin: 0;
    }

    .gym-review-facts dt {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .gym-review-facts dd {
      margin: 0;
      font-family: var(--font-mono);
      font-size: var(--gym-text-sm);
      overflow-wrap: anywhere;
    }

    .gym-review-delta {
      color: var(--gym-text-main);
      font-variant-numeric: tabular-nums;
      font-feature-settings: "tnum" 1;
    }

    .gym-review-move-table {
      min-width: 0;
      overflow: hidden;
      border: 1px solid var(--gym-border-card);
      border-radius: var(--gym-radius-md);
      background-color: var(--gym-bg-surface);
    }

    .gym-review-move-table-header {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: var(--gym-space-2);
      padding: var(--gym-space-3);
      border-bottom: 1px solid var(--gym-border-subtle);
    }

    .gym-review-move-filters {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-1);
    }

    .gym-review-filter {
      min-height: 32px;
      padding: var(--gym-space-1) var(--gym-space-2);
      font-size: var(--gym-text-xs);
    }

    .gym-review-filter[aria-pressed="true"] {
      background-color: var(--gym-bg-active-row);
      border-color: var(--gym-border-selected);
      color: var(--gym-text-main);
    }

    .gym-review-move-scroll {
      height: min(56vh, calc(var(--gym-space-8) * 7));
      overflow-y: auto;
      overscroll-behavior: contain;
      scrollbar-color: var(--gym-border-strong) var(--gym-bg-input);
      scrollbar-width: thin;
    }

    .gym-review-move-scroll::-webkit-scrollbar {
      width: var(--gym-space-2);
    }

    .gym-review-move-scroll::-webkit-scrollbar-track {
      background: var(--gym-bg-input);
    }

    .gym-review-move-scroll::-webkit-scrollbar-thumb {
      background: var(--gym-border-strong);
      border-radius: var(--radius-full);
    }

    .gym-review-move-empty-message {
      margin: 0;
      padding: var(--gym-space-4);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      text-align: center;
    }

    .gym-review-move-row {
      display: grid;
      grid-template-columns: var(--gym-space-6) minmax(0, 1fr) minmax(0, 1fr);
      gap: var(--gym-space-1);
      align-items: stretch;
      min-width: 0;
    }

    .gym-review-move-number {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      padding-right: var(--gym-space-1);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .gym-review-move-cell {
      display: flex;
      align-items: center;
      gap: var(--gym-space-1);
      min-width: 0;
      min-height: 36px;
      padding: var(--gym-space-1);
      border: 1px solid transparent;
      border-radius: var(--gym-radius-chip);
      background-color: transparent;
      color: var(--gym-text-main);
      font: inherit;
      font-size: var(--gym-text-sm);
      text-align: left;
      cursor: pointer;
    }

    .gym-review-move-cell:hover {
      background-color: var(--gym-row-hover);
      border-color: var(--gym-border-card);
    }

    .gym-review-move-cell.is-active {
      background-color: var(--gym-bg-active-row);
      border-color: var(--gym-border-strong);
    }

    .gym-review-move-empty {
      cursor: default;
      color: var(--gym-text-dim);
    }

    .gym-review-move-san {
      flex: none;
      font-family: var(--font-mono);
      overflow-wrap: anywhere;
    }

    .gym-review-move-clock {
      margin-left: auto;
      color: var(--gym-text-muted);
      font-family: var(--font-mono);
      font-size: var(--gym-text-xs);
      white-space: nowrap;
    }

    .analysis-summary-projection {
      margin: var(--gym-space-1) 0 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-sm);
      line-height: 1.45;
    }

    .analysis-summary-projection strong {
      color: var(--gym-text-main);
    }

    .gym-review-summary {
      grid-column: 1 / -1;
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-3);
      padding-top: var(--gym-space-4);
      border-top: 1px solid var(--gym-border-subtle);
      min-width: 0;
    }

    .gym-review-summary-heading {
      margin: 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-base);
      font-weight: 650;
    }

    .gym-review-summary-note {
      margin: calc(-1 * var(--gym-space-2)) 0 0;
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .gym-review-summary-sides {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--gym-space-5);
    }

    .gym-review-summary-side {
      display: flex;
      flex-direction: column;
      gap: var(--gym-space-2);
      min-width: 0;
    }

    .gym-review-summary-accuracy {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      justify-content: space-between;
      gap: var(--gym-space-2);
    }

    .gym-review-summary-side-name {
      margin: 0;
      font-size: var(--gym-text-sm);
      font-weight: 650;
    }

    .gym-review-summary-elo {
      color: var(--gym-text-muted);
      font-weight: 500;
    }

    .gym-review-summary-figures {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      gap: var(--gym-space-4);
    }

    .gym-review-summary-figure {
      display: flex;
      align-items: baseline;
      gap: var(--gym-space-1);
      margin: 0;
    }

    .gym-review-summary-figure-label {
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    .gym-review-summary-value {
      font-size: var(--gym-text-lg);
      font-weight: 700;
    }

    .gym-review-summary-counts {
      display: flex;
      flex-wrap: wrap;
      gap: var(--gym-space-2) var(--gym-space-3);
      margin: 0;
      padding: 0;
      list-style: none;
    }

    .gym-review-summary-count {
      display: inline-flex;
      align-items: center;
      gap: var(--gym-space-1);
      color: var(--gym-text-muted);
      font-size: var(--gym-text-xs);
    }

    @media (min-width: 1101px) {
      .gym-review-workspace {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 400px;
        align-items: start;
      }
    }

    @media (max-width: 767px) {
      .gym-review {
        gap: var(--gym-space-4);
      }

      .gym-review-workspace {
        gap: var(--gym-space-5);
      }

      .gym-review-filter,
      .gym-review-move-cell {
        min-height: 40px;
      }

      .gym-review-move-scroll {
        height: calc(var(--gym-space-8) * 5);
      }

      .gym-review-summary-sides {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--gym-space-4);
      }
    }

    @media (max-width: 360px) {
      .gym-review-move-table-header {
        align-items: flex-start;
        flex-direction: column;
      }

      .gym-review-move-cell .gym-icon,
      .gym-review-move-clock {
        display: none;
      }

      .gym-review-inspector {
        min-height: calc(var(--gym-space-8) * 5.5);
      }

      .gym-review-facts {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--gym-space-1);
      }

      .gym-review-facts dd {
        margin-bottom: var(--gym-space-2);
      }
    }

    @media (prefers-reduced-motion: reduce) {
      .app-header-theme-toggle,
      .gym-review-action,
      .gym-review-filter,
      .gym-review-eval-fill,
      .gym-review-board .control-bar-button {
        transition: none;
      }
    }
