:root {
  --paper: #f8f7f4;
  --paper-rgb: 248, 247, 244;
  --ink: #161616;
  --muted: #5c5c5c;
  --line: #dcdad4;
  --soft: #eeede9;
  --accent: #c8281d;
  --success: #087443;
  --accent-fill: var(--accent); /* fill under white text (START RACE); own value in dark mode */
  /*
   * Type roles: seven steps instead of 27 scattered values. Variation comes from weight, case and
   * colour, not from more sizes. Same in light and dark; dark only overrides the greys.
   * eyebrow stays at 11px (the WCAG minimum for functional text); body and value sit one step above at
   * 12px so labels stay smaller than values.
   */
  --text-eyebrow: 11px;  /* caps label: SEASON CIRCUITS, SKILL TIERS, GHOSTS */
  --text-body: 12px;     /* running text, descriptions */
  --text-value: 12px;    /* compact value in rows: times, PBs */
  --text-row-title: 15px; /* row title: track name in a list, achievement name */
  --text-page-title: 24px; /* page title: track name as race headline */
  --text-stat: 32px;     /* large single figure: season score, rank */
  --text-hero: 48px;     /* huge figure: countdown, GO, finish only */
  --text-heading: clamp(48px, 6vw, 78px); /* large heading of the menu pages (Season Circuits, Profile ...) */
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

/*
 * Dark mode inverts only the black/white greys (paper, ink, muted, line, soft). --success stays, and
 * so do the medal colours (set in src/medals.js, untouched by the theme). Fonts and sizes are
 * theme independent.
 * --accent goes back to the original #df3d32 here: :root uses the darker #c8281d so red on white and
 * white on red reach 4.5:1 in light mode, which would be too dim against the dark background.
 * Activated by [data-theme="dark"] on <html> (see applyTheme() in src/theme.js) and kept in
 * localStorage.
 */
:root[data-theme="dark"] {
  --paper: #161616;
  --paper-rgb: 22, 22, 22;
  --ink: #f4f4f1;
  /*
   * On the dark background red and green text sat at 4.18:1 and 3.09:1. Slightly lighter tones reach
   * 5.0:1 and 7.2:1; --accent-fill stays close to the old red because white text sits on it.
   */
  --accent: #ec5146;
  --accent-fill: #d63a2f;
  --success: #3bb87f;
  --muted: #9a9a95;
  --line: #37312e;
  --soft: #201f1d;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; padding: 22px; background: var(--paper); }
button, input { font: inherit; }
button { color: inherit; }

.site-header,
.start-menu,
.layout {
  /*
   * Scales with the viewport instead of a fixed cap: up to about 1440px screens it stays at the 1080px
   * floor, then grows with the window to a 1600px ceiling so lines and grids do not stretch thin on
   * large displays. The outer min(100%, ...) keeps the narrow-viewport behaviour and the 1000px/650px
   * breakpoints.
   */
  width: min(100%, clamp(1080px, 75vw, 1600px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}
.header-spacer { flex: 1; }
.beta-tag { margin-right: 16px; padding: 2px 7px; border: 1px solid currentColor; background: transparent; color: var(--muted); font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .1em; cursor: pointer; }
.beta-tag:hover, .beta-tag:focus-visible { color: var(--ink); }
.header-back {
  padding: 6px 0;
  border: 0;
  background: transparent;
  font-size: var(--text-eyebrow);
  font-weight: 650;
  letter-spacing: .12em;
  cursor: pointer;
}
.header-back:hover { color: var(--accent); }
/* Account control in the header: plain text like the rest of the header. Guests see LOG IN in Flag Red. */
.header-profile { display: flex; align-items: center; gap: 8px; padding: 6px 0 6px 18px; border: 0; background: transparent; cursor: pointer; }
.header-profile strong { font-size: var(--text-value); letter-spacing: .1em; text-transform: uppercase; }
.header-profile.is-guest strong { color: var(--accent); }
.header-profile:hover strong { color: var(--accent); }
.header-profile::after { content: ''; width: 5px; height: 5px; margin: -3px 2px 0 1px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform .18s cubic-bezier(.2, .8, .2, 1), border-color .18s ease; }
.header-profile[aria-expanded="true"]::after { margin-top: 3px; transform: rotate(225deg); }

/* Account menu: the home menu in miniature. Same parts as .mode-entry / .utility-link - 24px tight title
   with a muted line under it, an arrow that turns red and nudges on hover, hairlines between entries -
   and the same red selection rail, which rests on Profile and glides to whatever is hovered. */
.header-account { position: relative; }
.account-menu { position: absolute; top: calc(100% + 10px); right: 0; z-index: 30; width: 360px; border: 1px solid var(--ink); background: var(--paper); transform-origin: top right; }
.account-menu:not([hidden]) { animation: account-menu-in .18s cubic-bezier(.2, .8, .2, 1); }
@keyframes account-menu-in { from { opacity: 0; transform: translateY(-6px); } }
.account-menu[hidden], .account-menu [hidden] { display: none; }
.account-menu-rail { position: absolute; top: 0; left: -1px; width: 3px; height: 0; background: var(--accent); opacity: 0; pointer-events: none; transition: transform .22s cubic-bezier(.2, .8, .2, 1), height .22s cubic-bezier(.2, .8, .2, 1), opacity .15s ease; }
.account-guest { display: grid; gap: 7px; padding: 22px; }
.account-kicker { margin-bottom: 4px; color: var(--accent); font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .18em; }
.account-guest > strong { font-size: var(--text-page-title); font-weight: 650; letter-spacing: -.04em; }
.account-guest > small { color: var(--muted); font-size: var(--text-body); line-height: 1.65; }
.account-consent { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; margin-top: 8px; color: var(--muted); font-size: var(--text-body); line-height: 1.55; cursor: pointer; }
.account-consent input { margin-top: 3px; accent-color: var(--accent); }
.account-consent a { color: var(--ink); }
/* Guests see a plain person symbol (red like the old LOG IN); signed-in players see their name instead. */
.header-profile-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.header-profile.is-guest { color: var(--accent); }
.header-profile:not(.is-guest) .header-profile-icon { display: none; }
.google-placeholder { width: 100%; max-width: 316px; height: 40px; margin-top: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-size: var(--text-row-title); cursor: not-allowed; }
.account-menu #google-signin { min-height: 40px; margin-top: 8px; }
.account-menu .player-error { min-height: 0; margin: 0; color: var(--accent); font-size: var(--text-body); }
.account-menu .player-error:empty { display: none; }
/* Blocks of the menu (Profile, Account, Options, Sign out) are split by one fine line each; Sound and Dark mode share a block. */
.account-options { border-top: 1px solid var(--line); }
.account-options-label { display: block; padding: 14px 22px 2px; color: var(--muted); font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .13em; }
.account-options .account-entry { border-top: 0; }
.account-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; width: 100%; padding: 15px 22px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.account-entry strong { display: block; font-size: var(--text-row-title); font-weight: 650; letter-spacing: -.01em; }
.account-entry small { display: block; margin-top: 3px; color: var(--muted); font-size: var(--text-body); line-height: 1.65; }
.account-entry-arrow { justify-self: end; font-size: var(--text-value); transition: transform .16s ease, color .16s ease; }
.account-entry-primary { padding: 27px 22px 29px; border-top: 0; }
/* Achievements and Garage belong to Profile: same left edge, closer together, the block ends with the same air as the others. */
.account-entry-primary:has(+ .account-entry-sub) { padding-bottom: 12px; }
.account-entry-sub { padding: 9px 22px; border-top: 0; }
.account-entry-sub:last-child { padding-bottom: 24px; }
.account-entry-sub strong { color: var(--ink); font-size: var(--text-row-title); font-weight: 600; }
.account-entry-sub:hover strong, .account-entry-sub:focus-visible strong { color: var(--accent); }
.account-entry-primary strong { font-size: var(--text-page-title); letter-spacing: -.04em; }
.account-entry-primary small { margin-top: 7px; }
.account-entry-primary .account-entry-arrow { font-size: var(--text-row-title); }
.account-entry:hover strong, .account-entry:focus-visible strong { color: var(--accent); }
.account-entry:hover .account-entry-arrow, .account-entry:focus-visible .account-entry-arrow { color: var(--accent); transform: translateX(5px); }
.account-entry:focus-visible { outline: none; }
.account-entry-signout strong { color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .account-menu:not([hidden]) { animation: none; }
  .account-menu-rail { transition: opacity .15s ease; }
}

.player-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
}
.player-dialog::backdrop { background: rgba(var(--paper-rgb), .9); }
.player-dialog form { display: grid; gap: 14px; padding: 34px; }
.player-dialog h2 { margin: 0; font-size: var(--text-page-title); letter-spacing: -.045em; }
.player-dialog p { margin: 0; color: var(--muted); font-size: var(--text-body); line-height: 1.6; }
.player-dialog label { margin-top: 8px; font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .13em; }
.player-dialog input { width: 100%; padding: 13px 0 10px; border: 0; border-bottom: 1px solid var(--ink); border-radius: 0; outline: 0; background: transparent; font-size: var(--text-page-title); }
.player-dialog input:focus { border-bottom-color: var(--accent); }
.player-dialog .primary-action { margin-top: 5px; }
.player-dialog small { color: var(--muted); font-size: var(--text-eyebrow); line-height: 1.5; }
.player-dialog .player-error { min-height: 16px; color: var(--accent); }

[hidden] { display: none !important; }

.start-menu { padding-top: clamp(54px, 8vh, 92px); }
.menu-view { width: 100%; }
.home-view { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(480px, 1.25fr); gap: clamp(70px, 10vw, 150px); align-items: center; min-height: min(620px, calc(100vh - 145px)); padding-bottom: clamp(52px, 8vh, 90px); }
.home-hero { align-self: center; }
.hero-kicker { display: block; margin-bottom: 18px; color: var(--accent); font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .18em; }
/*
 * --hero-display holds the responsive value so the mobile breakpoint can override this one custom
 * property. The desktop and mobile curves differ (a steeper slope works better once the mode list
 * below needs the room).
 */
.home-hero h1 { --hero-display: clamp(68px, 8.5vw, 116px); margin: 0; font-size: var(--hero-display); font-weight: 760; line-height: .78; letter-spacing: -.075em; }
/*
 * A precise sweep, like a plotter head or scan line crossing the wordmark once on load, in line with
 * the product's premise of measured fairness. Runs once, since the home screen is what a fresh load
 * shows.
 */
@keyframes hero-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: no-preference) {
  .home-hero h1 { animation: hero-reveal .7s cubic-bezier(0.65, 0, 0.35, 1) both; }
}
.home-hero p { margin: 28px 0 0; color: var(--muted); font-size: var(--text-body); line-height: 1.65; } /* same size as the descriptions in the menu list */

/*
 * Deliberate exception to the otherwise square design: this dark-mode switch is rounded. Fixed px
 * values here instead of a new global radius token, to keep the exception local.
 */
.switch { position: relative; display: inline-flex; width: 32px; height: 17px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch-track { position: absolute; inset: 0; border: 1px solid var(--ink); border-radius: 999px; background: var(--paper); transition: background .15s ease; pointer-events: none; }
.switch-track::before { content: ''; position: absolute; top: 1px; left: 1px; width: 13px; height: 13px; border-radius: 50%; background: var(--ink); transition: transform .15s ease, background .15s ease; }
.switch input:checked ~ .switch-track { background: var(--ink); }
.switch input:checked ~ .switch-track::before { transform: translateX(15px); background: var(--paper); }
.switch input:focus-visible ~ .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.mode-list { border-top: 1px solid var(--ink); }
.mode-entry {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 28px;
  gap: 14px;
  align-items: center;
  padding: 27px 0 29px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.mode-index { align-self: start; padding-top: 7px; color: var(--accent); font-size: var(--text-eyebrow); font-variant-numeric: tabular-nums; }
.mode-copy-block strong { display: block; font-size: var(--text-page-title); font-weight: 650; letter-spacing: -.04em; }
.mode-copy-block small { display: block; max-width: 470px; margin-top: 7px; color: var(--muted); font-size: var(--text-body); line-height: 1.65; }
.mode-arrow { justify-self: end; font-size: var(--text-row-title); transform: translateX(0); transition: transform .16s ease, color .16s ease; }
.mode-entry:hover .mode-arrow { color: var(--accent); transform: translateX(5px); }
.mode-entry:hover .mode-copy-block strong { color: var(--accent); }
/* The .selection-rail (moved to the focused row by MenuMotion) already IS
   the focus indicator here - a second, default browser outline on top of it
   is redundant. Same for .utility-link/.circuit-row below. */
.mode-entry:focus-visible { outline: none; }

.utility-nav { margin-top: 6px; }
.utility-link {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  gap: 14px;
  align-items: center;
  padding: 15px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.utility-link .mode-copy-block strong { font-size: var(--text-row-title); font-weight: 650; letter-spacing: -.01em; }
.utility-link .mode-copy-block small { max-width: 470px; margin-top: 3px; font-size: var(--text-body); }
.utility-link .mode-arrow { font-size: var(--text-value); }
.utility-link:hover .mode-arrow { color: var(--accent); transform: translateX(5px); }
.utility-link:hover .mode-copy-block strong { color: var(--accent); }
.utility-link:focus-visible { outline: none; }

.mode-page { padding-bottom: 80px; }
.page-heading { display: grid; grid-template-columns: 1fr minmax(260px, 420px); gap: 70px; align-items: end; margin-bottom: 62px; }
/*
 * -.08em instead of the original -.06em: "Weekly Challenge" wrapped to two lines at common desktop
 * widths, and menu-motion.js skips the flying-title transition for a multiline destination (to avoid
 * visible re-wrapping mid-flight). Slightly tighter tracking keeps every page title on one line.
 */
.page-heading h1 { margin: 8px 0 0; font-size: var(--text-heading); font-weight: 700; line-height: .9; letter-spacing: -.04em; }
.page-heading > p { margin: 0; color: var(--muted); font-size: var(--text-body); line-height: 1.7; }
.page-countdown { display: grid; gap: 6px; justify-items: start; }
.page-countdown strong { color: var(--ink); font-size: clamp(28px, 3vw, 40px); font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
@media (min-width: 761px) { .page-countdown { justify-items: end; } }
/* The season runs for months, so its countdown is a quiet one-liner, not a headline number. */
.page-countdown--quiet { display: flex; gap: 8px; align-items: baseline; }
@media (min-width: 761px) { .page-countdown--quiet { justify-content: flex-end; } }
.page-countdown--quiet strong { color: var(--muted); font-size: var(--text-eyebrow); font-weight: 650; letter-spacing: .08em; }
/*
 * The profile page heading has no second-column paragraph, so it collapses to one column instead of
 * leaving an empty grid track.
 */
.page-heading--profile { grid-template-columns: 1fr; }
.section-bar { display: flex; align-items: baseline; justify-content: space-between; padding: 0 0 10px; border-bottom: 1px solid var(--ink); }
.section-bar h2 { margin: 0; font-size: var(--text-eyebrow); letter-spacing: .13em; }
/*
 * Plain variant for the profile's SEASON CIRCUITS heading (see .section-bar--plain in index.html): no
 * rule above or below, more space, sized like the Season Rankings home link instead of the small
 * eyebrow label the other .section-bar headings keep.
 */
.section-bar--plain { border-bottom: 0; padding-bottom: 0; margin: 12px 0 22px; }
.section-bar--plain h2 { font-size: var(--text-row-title); font-weight: 650; letter-spacing: .02em; }
.circuit-columns { display: grid; grid-template-columns: 150px 115px 20px; gap: 20px; color: var(--ink); font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .13em; text-align: right; }
.circuit-columns span:first-child { grid-column: 1; }
.circuit-columns span[title] { cursor: help; }
/*
 * Legacy Tracks has no percentile (no season score attaches to a legacy run), so its list drops that
 * column.
 */
#legacy-view .circuit-columns { grid-template-columns: 150px 20px; }
#legacy-circuit-list .circuit-row { grid-template-columns: auto auto minmax(230px, 1fr) 150px 20px; }
.circuit-list { border-bottom: 1px solid var(--ink); }
.circuit-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto auto minmax(230px, 1fr) 150px 115px 20px;
  gap: 20px;
  align-items: center;
  padding: 18px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.circuit-row:last-child { border-bottom: 0; }
.circuit-row:focus-visible { outline: none; }
.circuit-row:hover .circuit-name strong,
.circuit-row.active .circuit-name strong { color: var(--accent); }
.circuit-index { color: var(--muted); font-size: var(--text-eyebrow); }
.circuit-row.active .circuit-index { color: var(--accent); }
/*
 * Enlarged from 40x26: the real circuit outline is the product's most distinctive visual, and this
 * list shows all outlines side by side.
 */
.circuit-track-preview { width: 64px; height: 42px; color: var(--accent); opacity: .85; justify-self: start; }
.circuit-name strong { display: block; font-size: var(--text-row-title); font-weight: 650; letter-spacing: -.02em; }
.circuit-stat { font-size: var(--text-value); font-weight: 620; font-variant-numeric: tabular-nums; text-align: right; }
.circuit-percentile { color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .07em; }
.circuit-pb-cell { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.circuit-medal { display: flex; }
/*
 * .medal-icon is a drawn <svg> (see createMedalIcon in src/medals.js: a plain disc, no image).
 * .badge-icon and .career-icon are <img> elements with finished badge pictures, see their rules below.
 */
.medal-icon { width: 18px; height: 18px; }
.circuit-arrow { justify-self: end; opacity: 0; transform: translateX(-4px); transition: .16s ease; }
.circuit-row:hover .circuit-arrow,
.circuit-row.active .circuit-arrow { opacity: 1; transform: translateX(0); }
.selected-race { display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: 32px 0 15px; }
.selected-race h2 { --selected-race-h2-size: var(--text-page-title); margin: 6px 0 3px; font-size: var(--selected-race-h2-size); font-weight: 650; letter-spacing: -.035em; }
.menu-action {
  min-width: 230px;
  padding: 12px 15px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-size: var(--text-eyebrow);
  letter-spacing: .11em;
  cursor: pointer;
}
.menu-action span { float: right; }
.menu-action:hover,
.menu-action:focus-visible { background: var(--paper); color: var(--ink); }
.menu-action:disabled { border-color: var(--line); background: var(--soft); color: var(--muted); cursor: not-allowed; }
.menu-action:disabled:hover { background: var(--soft); color: var(--muted); }

/*
 * The Time Trial START RACE button is the main action of the screen but looked like every other small
 * menu button. Changed here with a positional rule instead of the shared .menu-action base, so e.g.
 * the weekly start button stays as it is. Accent red as fill instead of black: red is reserved for
 * emphasis, so no new colour.
 */
.selected-race .menu-action {
  min-width: 250px;
  padding: 17px 24px;
  border-color: var(--accent-fill);
  background: var(--accent-fill);
  color: #fff;
  font-size: var(--text-row-title);
  font-weight: 650;
  letter-spacing: .02em;
}
.selected-race .menu-action:hover,
.selected-race .menu-action:focus-visible { background: var(--paper); color: var(--accent); border-color: var(--accent); }
.selected-race .menu-action:disabled { border-color: var(--line); background: var(--soft); color: var(--muted); }
.selected-race .menu-action:disabled:hover { background: var(--soft); color: var(--muted); }

.menu-leaderboard { margin-top: 36px; border-top: 1px solid var(--ink); }
.leaderboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 18px 0 13px; }
.leaderboard-heading h2 { margin: 5px 0 0; font-size: var(--text-page-title); font-weight: 640; letter-spacing: -.025em; }
.leaderboard-list { border-bottom: 1px solid var(--ink); }
.leaderboard-empty { margin: 0; padding: 18px 0; color: var(--muted); font-size: var(--text-body); }
.leaderboard-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: baseline; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: var(--text-value); font-variant-numeric: tabular-nums; }
.leaderboard-row:first-child { border-top-color: var(--ink); }
.leaderboard-rank { color: var(--accent); font-size: var(--text-eyebrow); }
.leaderboard-player { overflow: hidden; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-player-link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 620;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.leaderboard-player-link:hover { color: var(--accent); }
.leaderboard-row.current .leaderboard-player::after { content: 'YOU'; margin-left: 8px; color: var(--success); font-size: var(--text-eyebrow); letter-spacing: .1em; }
/*
 * Appended below a capped leaderboard when the viewer's own rank is outside it (see
 * renderLeaderboard() in src/screens/leaderboard.js): a gap and a heavier top border so it does not
 * read as if the list continues at 51.
 */
.leaderboard-own-row { margin-top: 10px; border-top: 1px solid var(--ink); padding-top: 12px; }
.leaderboard-time { font-weight: 650; }
.leaderboard-row-actionable { grid-template-columns: 44px minmax(0, 1fr) auto auto; }
.leaderboard-actions { display: flex; gap: 6px; }
.leaderboard-action {
  border: 1px solid var(--line);
  background: transparent;
  padding: 4px 9px;
  color: var(--muted);
  font-size: var(--text-eyebrow);
  letter-spacing: .1em;
  font-weight: 700;
  cursor: pointer;
}
.leaderboard-action:hover { border-color: var(--accent); color: var(--accent); }
.weekly-status { display: grid; grid-template-columns: 250px minmax(260px, 1fr) auto; gap: 38px; align-items: end; padding: 24px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.weekly-status strong { display: block; margin-top: 6px; font-size: var(--text-stat); line-height: 1; font-variant-numeric: tabular-nums; }
.weekly-status p { margin: 0; color: var(--muted); font-size: var(--text-body); line-height: 1.65; }
.weekly-division { grid-template-columns: 250px minmax(0, 1fr); border-top: 0; }
.weekly-division { row-gap: 18px; }
.league-rules { grid-column: 1 / -1; border-top: 1px solid var(--line); }
.league-rules > summary { display: flex; justify-content: space-between; align-items: center; padding: 14px 0 0; list-style: none; color: var(--muted); font-size: var(--text-eyebrow); font-weight: 650; letter-spacing: .12em; cursor: pointer; }
.league-rules > summary::-webkit-details-marker { display: none; }
.league-rules > summary::after { content: '+'; color: var(--accent); font-size: 20px; font-weight: 400; line-height: 1; }
.league-rules[open] > summary::after { content: '–'; }
.league-rules > summary:hover { color: var(--accent); }
.league-rules > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.weekly-status .league-rules p { margin: 14px 0 0; max-width: 640px; }
.text-action { padding: 4px 0; border: 0; background: transparent; color: var(--muted); font-size: var(--text-eyebrow); font-weight: 650; letter-spacing: .1em; cursor: pointer; }
.text-action:hover { color: var(--accent); }
.text-action:disabled { color: var(--line); cursor: default; }
.text-action:disabled:hover { color: var(--line); }
.archive-empty { padding: 34px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.archive-empty > span { display: block; color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .12em; }
.archive-empty strong { display: block; margin: 8px 0 22px; font-size: var(--text-row-title); font-weight: 620; }

.profile-summary { display: grid; grid-template-columns: repeat(2, minmax(130px, auto)) 1fr; column-gap: 50px; row-gap: 16px; align-items: end; padding: 0 0 40px; }
.profile-summary-stat strong { display: block; margin-top: 8px; font-size: var(--text-stat); line-height: .9; font-weight: 700; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.profile-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 18px 26px; padding: 0 0 36px; }
.profile-stat strong { display: block; margin-top: 6px; overflow: hidden; font-size: var(--text-row-title); font-weight: 650; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.profile-stats p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: var(--text-eyebrow); }
.profile-summary p { grid-column: 1 / -1; margin: 0; max-width: 520px; color: var(--muted); font-size: var(--text-body); line-height: 1.65; }

/*
 * Garage: car picker on your own profile (see renderGarage() in profile.js). A still-locked model
 * keeps this plain row (preview image plus one unlock action); an unlocked model gets a full paint
 * studio instead (.garage-paint-studio below).
 */
.garage-beta { display: grid; gap: 10px; max-width: 520px; padding: 4px 0 18px; }
.garage-beta p { margin: 0; color: var(--muted); font-size: var(--text-body); line-height: 1.6; }
.garage-beta .secondary-action { width: auto; justify-self: start; margin-top: 0; padding-inline: 18px; }
.garage-row { display: flex; align-items: center; gap: 20px; width: 100%; padding: 16px 0; border: 0; border-top: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; }
.garage-row:first-child { border-top: 0; }
.garage-row:disabled { cursor: default; }
.garage-hero { width: 130px; height: auto; flex: none; }
.garage-row.locked .garage-hero { opacity: .4; }
.garage-row-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.garage-row-title { color: var(--ink); font-size: var(--text-row-title); font-weight: 650; }
.garage-row-state { color: var(--muted); font-size: var(--text-eyebrow); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.garage-row:not(.locked):not(:disabled):hover .garage-row-state { color: var(--accent); }
.garage-error { margin: 0 0 14px; color: var(--accent); font-size: var(--text-body); }
/*
 * mountCarPaintStudio() renders block-level content of its own (a two-column grid on wide screens),
 * so it must not sit in a flex row like .garage-row or its grid loses its full width. This wrapper
 * only supplies the same hairline row rhythm.
 */
.garage-paint-studio { padding: 12px 0; border-top: 1px solid var(--line); }
.garage-paint-studio:first-child { border-top: 0; }

/*
 * .badge-icon: each tier is a finished, coloured picture, so there is no shared shape differing only
 * by opacity (the old .badge-icon--topN steps are gone). 64px: at 34px the percentage inside the icon
 * was hard to read; the 256px sources hold up at the larger size.
 */
.badge-icon { display: block; width: 64px; height: 64px; object-fit: contain; flex: none; }

/*
 * Five columns on wide screens instead of auto-fill: the grid is sized for the season's circuit count
 * (up to 10 = two full rows of 5), not for however many 160px cards fit. auto-fill gave 6 columns at
 * typical desktop widths, leaving a visible gap in the second row.
 */
.score-card-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
/*
 * Two-column card: text (name, big PCTL stat, small rank) on the left, track preview top right with
 * the medal (if any) pinned to the bottom under it via space-between on the right column.
 */
.score-card { display: flex; align-items: stretch; justify-content: space-between; gap: 12px; min-width: 0; padding: 24px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); transition: background-color .16s ease, border-color .16s ease; }
@media (hover: hover) {
  .score-card:hover { background: var(--soft); border-color: color-mix(in srgb, var(--ink) 20%, var(--line)); }
}
.score-card:focus-within { background: var(--soft); border-color: color-mix(in srgb, var(--ink) 20%, var(--line)); }
.score-card-left { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/*
 * min-height reserves two lines whether or not this name wraps; otherwise a one-line name sits lower
 * than a two-line neighbour and the PCTL row no longer lines up across a grid row.
 */
.score-card-track { display: block; color: var(--ink); font-size: var(--text-row-title); font-weight: 700; letter-spacing: -.01em; line-height: 1.25; min-height: calc(1.25em * 2); }
/*
 * Percentile is the large stat and rank the small one: rank reads "#N OF M" and M keeps growing, so
 * a big bold rank could break the layout at 5+ digits, while the percentile stays short.
 */
.score-card-pctl { display: flex; align-items: baseline; gap: 5px; }
.score-card-pctl strong { font-size: var(--text-stat); font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.score-card-pctl span { font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.score-card-pb { color: var(--muted); font-size: var(--text-value); font-variant-numeric: tabular-nums; }
.score-card-rank { color: var(--muted); font-size: var(--text-value); font-variant-numeric: tabular-nums; }
.score-card-right { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; flex: none; }
.score-card-preview { width: 38px; height: 38px; color: var(--accent); opacity: .8; flex: none; }
/* Icon-only corner badge, so it can be a bit bigger than the old icon-plus-label version (18px). */
.score-card-medal .medal-icon { width: 26px; height: 26px; flex-shrink: 0; }

.achievement-section { margin-top: 46px; }
.achievement-season { padding: 22px 0; border-bottom: 1px solid var(--line); }
.achievement-season:last-child { border-bottom: 0; }
.achievement-season-header { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; flex-wrap: wrap; }
.achievement-season-name { display: block; font-size: var(--text-row-title); font-weight: 650; letter-spacing: -.01em; }
.achievement-season-dates { display: block; margin-top: 4px; color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .1em; text-transform: uppercase; }
.achievement-season-rank { text-align: right; }
.achievement-season-rank strong { font-size: var(--text-stat); font-weight: 700; font-variant-numeric: tabular-nums; }
.achievement-season-rank span { display: block; margin-top: 3px; color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .08em; text-transform: uppercase; }
.achievement-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.achievement-badge { display: flex; align-items: center; gap: 12px; border: 1px solid var(--ink); border-radius: 10px; padding: 10px 14px; }
.achievement-badge-icon { flex: none; }
.career-icon.achievement-badge-icon { width: 22px; height: 22px; }
.tier-mark { display: grid; place-items: center; flex: none; min-width: 22px; height: 22px; padding: 0 3px; box-sizing: border-box; border: 1px solid var(--ink); border-radius: 6px; font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: 0; }
.achievement-badge-text strong { display: block; font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .06em; }
.achievement-badge-text span { display: block; margin-top: 3px; color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .04em; text-transform: uppercase; }

/*
 * Driver Profile / Garage switch for the whole profile screen: lighter than the filled invert box of
 * .history-tabs (fine for a small sub-tab, but heavy as top-level navigation). A plain underline
 * marks the active tab, like the rest of the site's thin-line treatment (see .mode-entry,
 * .camera-slider-row).
 */
.profile-tabbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0 28px; margin: 0 0 40px; border-bottom: 1px solid var(--line); }
.profile-tabs { display: flex; gap: 28px; }
/* Which ranking list is shown (keyboard & controller, or touch): text tabs like the profile tabs. */
.class-switch { display: flex; gap: 28px; }
.class-switch button { padding: 0 0 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--muted); font-size: var(--text-eyebrow); font-weight: 650; letter-spacing: .08em; cursor: pointer; }
.class-switch button:hover { color: var(--ink); }
.class-switch button.active { color: var(--ink); border-bottom-color: var(--accent); }
.class-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#rankings-view > .class-switch { margin-bottom: 0; border-bottom: 1px solid var(--line); }
.profile-tabs button { padding: 0 0 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--muted); font-size: var(--text-eyebrow); font-weight: 650; letter-spacing: .08em; cursor: pointer; }
.profile-tabs button:hover { color: var(--ink); }
.profile-tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.profile-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.rankings-selectors { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.rankings-selectors select,
.history-selectors select {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-body);
  cursor: pointer;
}
/* Season history dropdown (Profile tab): same look as Rankings. */
.history-selectors { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 4px 0 12px; }

/* Profile tab: season summary left, the showcase (the badges the player is
   proudest of) right - the main attraction of the profile. */
.profile-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 64px; align-items: start; }
.profile-showcase { min-width: 0; }
.profile-showcase .section-bar--plain { margin-top: 0; justify-content: flex-start; gap: 18px; }
.showcase-slots { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.showcase-badge { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 112px; text-align: center; }
.showcase-badge .badge-icon, .showcase-badge .achievement-art { display: block; width: 96px; height: 96px; object-fit: contain; }
.showcase-option .achievement-art { display: block; width: 64px; height: 64px; object-fit: contain; }
.showcase-option .season-record-badge { --badge-size: 64px; }
/* The generic .showcase-* span rules would restyle the season nameplate. */
.showcase-badge .season-record-badge__season, .showcase-option .season-record-badge__season { color: #f5f5f5; font-size: max(8px, calc(var(--badge-size) * 20 / 256)); letter-spacing: .02em; min-height: 0; }
.showcase-badge strong { font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .11em; }
.showcase-badge span { color: var(--muted); font-size: var(--text-eyebrow); font-weight: 650; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.showcase-empty { width: 112px; height: 96px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); font-size: var(--text-eyebrow); font-weight: 650; letter-spacing: .1em; cursor: pointer; }
.showcase-empty:hover, .showcase-empty:focus-visible { border-color: var(--accent); color: var(--accent); }
.showcase-dialog { width: min(560px, calc(100% - 28px)); }
.showcase-picker { display: grid; gap: 18px; margin: 16px 0 6px; max-height: 50vh; overflow: auto; }
.showcase-picker-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.showcase-option { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 14px 8px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; }
.showcase-option:hover { border-color: var(--ink); }
.showcase-option[aria-pressed="true"] { border-color: var(--accent); }
.showcase-option span { min-height: 14px; color: var(--muted); font-size: var(--text-eyebrow); font-weight: 650; font-variant-numeric: tabular-nums; }
.showcase-option-order { position: absolute; top: 6px; right: 8px; color: var(--accent); font-size: var(--text-eyebrow); font-weight: 700; }
@media (max-width: 900px) {
  .profile-top { grid-template-columns: minmax(0, 1fr); }
}
.player-search { padding: 20px 0 30px; border-bottom: 1px solid var(--line); }
.player-search input {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  font: inherit;
  font-size: var(--text-body);
  color: var(--ink);
}
.player-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.rankings-pager { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 16px 0; }
.rankings-pager-label { color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .08em; font-variant-numeric: tabular-nums; }
#player-search-results { margin-top: 10px; }
.player-search-result {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--paper);
  font: inherit;
  font-size: var(--text-row-title);
  font-weight: 620;
  text-align: left;
  cursor: pointer;
}
.player-search-result:first-child { border-top: 1px solid var(--ink); }
.player-search-result:hover { background: var(--soft); color: var(--accent); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 42px; align-items: start; padding-top: 18px; }
.game-column { min-width: 0; }
.hud {
  display: grid;
  /*
   * Fixed instead of fr widths for LAP and the four time columns (TOTAL, PERSONAL BEST, LAST LAP,
   * PB LAP). A M:SS.mmm value from formatTime() needs about 126px at this size (tabular-nums makes that
   * independent of the digits) and "01 / 03" about 97px; with fr shares six columns got tight and
   * values were cut by text-overflow: ellipsis.
   * .layout caps its width at 1080px for every viewport between about 1124px and 1440px, so the game
   * column is a fixed ~778px across that whole common range. The split below is chosen so all six
   * columns fit exactly into 778px; SPEED needs much less than the time columns and takes the rest as
   * 1fr. Below that (but above the 1000px mobile limit) the media query further down hides PB LAP
   * instead of squeezing the fixed widths.
   */
  /*
   * 96px fits the time values but not their labels: PERSONAL BEST needs about 104px unwrapped at this
   * letter-spacing. 112px is each stat column's floor; minmax() lets PERSONAL BEST, LAST LAP and PB LAP
   * grow equally into the room between TOTAL and SPEED instead of packing right after TOTAL. SPEED is
   * capped at 140px so it does not compete for that slack and stays near the right edge.
   */
  grid-template-columns: 102px 190px minmax(112px, 1fr) minmax(112px, 1fr) minmax(112px, 1fr) minmax(96px, 140px);
  gap: 8px;
  align-items: end;
  padding: 0 2px 10px;
  border-bottom: 1px solid var(--line);
}

/*
 * Between the real mobile limit (650px, see @media max-width: 650px below) and the point where
 * .layout reaches its 1080px cap (about 1124px), PB LAP is hidden instead of squeezing the remaining
 * four time columns below their measured minimum. Without this range, 651-1000px let the six-column
 * base rule squeeze SPEED to about 37px and cut off "0 PX/S" (measured at tablet widths like 768px).
 */
@media (max-width: 1120px) and (min-width: 651px) {
  .hud { grid-template-columns: 102px 190px minmax(112px, 1fr) minmax(112px, 1fr) minmax(96px, 140px); }
  .hud-item:nth-child(5) { display: none; }
}
.hud-item { min-width: 0; }
.hud-item > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .1em; }
.hud-item strong {
  display: block; overflow: hidden; font-weight: 620; white-space: nowrap; text-overflow: ellipsis;
  /*
   * Secondary HUD values (LAP, PERSONAL BEST, LAST LAP, PB LAP, SPEED) stay at row-title size; only
   * TOTAL (.hud-time strong below) gets the larger hero treatment, so the one number the player races
   * against the clock reads as the primary one.
   */
  --hud-item-size: var(--text-row-title);
  font-size: var(--hud-item-size); line-height: .9; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
/*
 * TOTAL: the one live number that matters most during a race, the Stat role from DESIGN.md (one
 * dominant number per context). The column width above (190px) was sized for var(--text-stat).
 */
.hud-time strong { font-size: var(--text-stat); font-weight: 700; letter-spacing: -.03em; }
.hud-speed { text-align: right; }
.hud-speed small { color: var(--muted); font-size: var(--text-eyebrow); font-weight: 500; }

.canvas-shell { position: relative; width: 100%; overflow: hidden; background: var(--paper); }
canvas { display: block; width: 100%; height: auto; aspect-ratio: 760 / 520; touch-action: none; }

.race-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(.98);
  transition: opacity .16s ease, transform .16s ease;
  pointer-events: none;
}
.race-overlay.visible { opacity: 1; transform: scale(1); }
.overlay-body { display: contents; }
.race-overlay strong { font-size: var(--text-hero); line-height: .9; letter-spacing: .02em; }
.race-overlay span { margin-top: 8px; color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .13em; text-transform: uppercase; }
.race-overlay.finish strong { color: var(--accent); font-size: var(--text-hero); }
.race-overlay.error strong { color: var(--accent); font-size: var(--text-page-title); }
.race-overlay.status,
.race-overlay.error { justify-content: flex-start; padding-top: 46px; }
.race-overlay.status strong,
.race-overlay.error strong { min-width: 74px; padding: 7px 12px 9px; background: rgba(var(--paper-rgb),.65); text-align: center; }
.race-overlay.status span,
.race-overlay.error span { margin-top: 4px; padding: 3px 7px; background: rgba(var(--paper-rgb),.6); }
.race-overlay.status strong { min-width: 0; padding: 8px 16px; }
.race-overlay small, .overlay-segments { display: none; }

/*
 * The start sequence (READY, 3, 2, 1, GO): transparent type straight on the track, no box. One fixed
 * grid (label / main line / segments / sub line, 115px) that is identical in every state, so nothing
 * moves between READY, 3, 2, 1 and GO; only the main line changes. The red bar on the left is
 * the same height throughout. Countdown digits and GO share one size.
 */
.race-overlay.ready,
.race-overlay.countdown,
.race-overlay.go { justify-content: flex-start; padding-top: 46px; transform: none; }
.race-overlay.go:not(.visible) { transform: translateY(-10px); }
:is(.ready, .countdown, .go) > .overlay-body {
  position: relative;
  display: grid;
  grid-template-rows: 14px 66px 3px 17px;
  row-gap: 5px;
  width: min(225px, calc(100% - 36px));
  box-sizing: border-box;
  padding: 0 8px;
  text-align: center;
}
:is(.ready, .countdown, .go) > .overlay-body::before { content: ""; position: absolute; left: 0; top: 22px; width: 3px; height: 59px; background: var(--accent); }
:is(.ready, .countdown, .go) small { display: block; color: var(--accent); font-size: var(--text-eyebrow); font-weight: 650; line-height: 14px; letter-spacing: .2em; }
:is(.ready, .countdown, .go) strong { display: grid; align-items: center; height: 66px; font-size: 39px; font-weight: 760; line-height: 1; letter-spacing: -.065em; }
:is(.countdown, .go) strong { font-size: 63px; }
.race-overlay.go strong { color: var(--accent); }
:is(.ready, .countdown, .go) .overlay-segments { display: flex; justify-content: center; gap: 5px; }
.overlay-segments b { width: 20px; height: 3px; background: var(--line); }
.overlay-segments b.on { background: var(--accent); }
:is(.ready, .countdown, .go) span { margin: 0; padding: 0; font-size: var(--text-eyebrow); line-height: 17px; letter-spacing: .02em; white-space: nowrap; }
.race-overlay.ready span, .race-overlay.go span { color: var(--ink); } /* readable over the grey outer wall */
.race-overlay.countdown span { visibility: hidden; }
/*
 * On a phone the canvas is only ~240px tall, and the transparent type would land on the light road
 * (unreadable in dark mode). Smaller and right under the top edge, it stays above the road.
 */
@media (max-width: 600px) {
  .race-overlay.ready,
  .race-overlay.countdown,
  .race-overlay.go { padding-top: 8px; }
  :is(.ready, .countdown, .go) > .overlay-body { transform: scale(.72); transform-origin: top center; }
}

/*
 * One short beat per countdown number and for GO instead of an instant text swap; app.js retriggers it
 * by toggling the class (see setOverlay()). Only the main line moves.
 */
@keyframes overlay-tick {
  from { transform: translateY(9px) scale(.96); }
  to { transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: no-preference) {
  .race-overlay.countdown strong.tick,
  .race-overlay.go strong.tick { animation: overlay-tick .18s cubic-bezier(.2, .8, .2, 1); }
}

.race-results {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(.98);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
  background: rgba(var(--paper-rgb), .82);
}
.race-results.visible { opacity: 1; transform: scale(1); }
.race-results-card { min-width: 260px; padding: 28px 36px; background: var(--paper); border: 1px solid var(--ink); text-align: center; }
.race-results-eyebrow { display: block; color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .13em; }
.race-results-time { display: block; margin: 8px 0 20px; font-size: var(--text-hero); line-height: .9; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.race-results-deltas { display: flex; gap: 30px; justify-content: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.race-results-delta span { display: block; color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .1em; }
.race-results-delta strong { display: block; margin-top: 5px; font-size: var(--text-row-title); font-variant-numeric: tabular-nums; }
.race-results-delta.ahead strong { color: var(--success); }
.race-results-delta.behind strong { color: var(--accent); }
.race-results-medal { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 18px; }
.race-results-medal .medal-icon { width: 22px; height: 22px; }
.race-results-medal span:last-child { font-size: var(--text-value); font-weight: 650; letter-spacing: .07em; }
.challenge-link { margin: 4px 0 0; padding: 4px 0; border: 0; background: transparent; color: var(--muted); font-size: var(--text-eyebrow); font-weight: 650; letter-spacing: .11em; cursor: pointer; }
.challenge-link span { font-variant-numeric: tabular-nums; }
.challenge-link:hover:not(:disabled), .challenge-link:focus-visible { color: var(--accent); outline: 0; }
.challenge-link:disabled { cursor: default; opacity: .6; }
.race-results-note { margin: 16px 0 0; color: var(--muted); font-size: var(--text-body); line-height: 1.55; }
/*
 * Server rejected this run: the card that just celebrated a finish carries the verdict, instead of
 * only the small RUN VALIDATION panel in the side rail.
 */
.race-results.invalid .race-results-card { border-color: var(--accent); }
.race-results.invalid .race-results-eyebrow { color: var(--accent); }

.checkpoint-delta {
  position: absolute;
  left: 50%;
  top: 24px;
  min-width: 165px;
  padding: 8px 14px;
  background: rgba(var(--paper-rgb),.65);
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -5px);
  transition: .18s ease;
  pointer-events: none;
}
.checkpoint-delta.visible { opacity: 1; transform: translate(-50%, 0); }
.checkpoint-delta span { display: block; color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .12em; }
/*
 * Same size as the values in the main HUD row (TOTAL, PB, LAST LAP; see .hud-item strong), so the
 * checkpoint time is as readable during a race as the permanent HUD values.
 */
.checkpoint-delta strong { display: block; margin-top: 3px; font-size: var(--text-page-title); line-height: .9; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.checkpoint-delta.ahead strong { color: var(--success); }
.checkpoint-delta.behind strong { color: var(--accent); }

.race-panel { min-width: 0; border-top: 1px solid var(--ink); }
.panel-section { padding: 15px 0; border-bottom: 1px solid var(--line); }
.eyebrow { display: block; color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .12em; }
.mode-copy h1 { margin: 7px 0 5px; font-size: var(--text-page-title); font-weight: 650; letter-spacing: -.035em; }
.mode-copy p, .validation p, .compact-options p { margin: 0; color: var(--muted); font-size: var(--text-body); line-height: 1.55; }
.attempts { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: var(--text-value); font-weight: 650; letter-spacing: .06em; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; }
.section-heading h2 { margin: 0; font-size: var(--text-eyebrow); font-weight: 650; letter-spacing: .11em; }
.section-heading span { color: var(--muted); font-size: var(--text-eyebrow); }
.lap-list { min-height: 74px; padding-top: 9px; }
.lap-list .empty { margin: 12px 0; color: var(--muted); font-size: var(--text-body); }
.lap-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; padding: 5px 0; border-top: 1px solid var(--soft); font-size: var(--text-value); font-variant-numeric: tabular-nums; }
.lap-row span:first-child { color: var(--muted); }
.lap-row .best-mark { color: var(--success); font-size: var(--text-eyebrow); letter-spacing: .08em; }
.camera-option > span { display: block; margin-bottom: 8px; font-size: var(--text-eyebrow); letter-spacing: .1em; }
.camera-slider-row { display: flex; align-items: center; gap: 10px; }
.camera-slider-row input[type="range"] { flex: 1; accent-color: var(--ink); }
.camera-slider-end { font-size: var(--text-eyebrow); letter-spacing: .06em; color: var(--muted); }
.camera-option-secondary { margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--soft); }
.ghost-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ghost-row + .ghost-row { margin-top: 8px; }
.ghost-row input { width: 13px; height: 13px; accent-color: var(--accent); flex-shrink: 0; }
.ghost-row span { font-size: var(--text-eyebrow); letter-spacing: .1em; }
.ghost-row strong { margin-left: auto; color: var(--muted); font-size: var(--text-value); font-weight: 620; font-variant-numeric: tabular-nums; text-align: right; }
.ghost-row input:not(:disabled) ~ strong { color: var(--ink); }
.ghost-row-secondary { margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--soft); }
.gamepad-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--soft); }
.gamepad-status span { color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .1em; }
.gamepad-status strong { font-size: var(--text-value); font-weight: 620; text-align: right; }
.compact-options .eyebrow { margin-bottom: 10px; }
.attack-target-row { color: var(--accent); }
.attack-target-row span { color: var(--accent); }
.attack-target-clear {
  position: relative;
  margin-left: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-row-title);
  line-height: 1;
  cursor: pointer;
}
/*
 * Invisible hit-area expansion, not a bigger glyph: this sits in a dense settings row where a larger
 * x would look out of place, but the glyph alone is well under the 44px touch target.
 */
.attack-target-clear::before { content: ''; position: absolute; inset: -15px; }
.attack-target-clear:hover { color: var(--accent); }
.spectator-info .ghost-row { color: var(--ink); }
.spectator-info .ghost-row + .ghost-row { margin-top: 6px; }
.spectator-info .ghost-row span { color: var(--muted); }

.race-medal-targets { padding-top: 15px; }
/* One tier per line (icon, name, time): four times side by side were wider
   than the sidebar and pushed the last tier out of the screen. */
.race-medal-target-row { display: grid; gap: 8px; margin-top: 10px; }
.race-medal-target { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 9px; }
.race-medal-target-name { color: var(--ink); font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .11em; }
/*
 * .medal-icon is an inline <svg> (see createMedalIcon in src/medals.js); a plain class selector
 * matches it.
 */
.race-medal-target-icon .medal-icon { width: 13px; height: 13px; }
.race-medal-target > span:last-child { color: var(--muted); font-size: var(--text-value); font-weight: 600; font-variant-numeric: tabular-nums; }
.race-medal-target[data-tier="platinum"] > span:last-child,
.race-medal-target[data-tier="platinum"] .race-medal-target-name { color: var(--accent); }
.shortcut-hint { opacity: .75; font-weight: 500; }
.validation strong { display: block; margin: 5px 0 2px; font-size: var(--text-value); }
.validation.valid strong { color: var(--success); }
.validation.invalid strong { color: var(--accent); }
.validation-cancel { margin-top: 8px; padding: 6px 0; border: 0; background: transparent; color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .11em; cursor: pointer; }
.validation-cancel:hover { color: var(--accent); }

.primary-action,
.secondary-action {
  width: 100%;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-size: var(--text-eyebrow);
  letter-spacing: .11em;
  cursor: pointer;
}
.primary-action:hover { background: var(--paper); color: var(--ink); }
.primary-action:disabled { border-color: var(--line); background: var(--soft); color: var(--muted); cursor: not-allowed; }
.secondary-action { background: var(--paper); color: var(--ink); }
/* Destructive actions: solid red, never styled like the neutral buttons. */
.danger-action { width: 100%; margin-top: 14px; padding: 10px 12px; border: 1px solid #c8322a; border-radius: 6px; background: #c8322a; color: #fff; font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .11em; cursor: pointer; }
.danger-action:hover { background: #a82720; border-color: #a82720; }
.danger-action:disabled { border-color: var(--line); background: var(--soft); color: var(--muted); cursor: not-allowed; }
/* Account dialog: each block is separated by a line so one input never looks like it belongs to another action. */
.account-section { display: grid; gap: 8px; padding-top: 20px; border-top: 1px solid var(--line); }
.account-section:first-of-type { padding-top: 6px; border-top: 0; }
.account-delete-confirm { display: grid; gap: 8px; margin-top: 6px; }
.menu-return { width: 100%; margin-top: 9px; padding: 8px 0; border: 0; background: transparent; color: var(--muted); font-size: var(--text-eyebrow); letter-spacing: .11em; cursor: pointer; }
.menu-return:hover { color: var(--ink); }

.touch-controls { display: none; gap: 12px; padding-top: 12px; touch-action: none; }
.touch-controls, .touch-controls * { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.touch-controls { align-items: flex-end; justify-content: space-between; }
.touch-steer { position: relative; flex: 0 0 44%; height: 60px; border: 1px solid var(--line); border-radius: 30px; background: var(--soft); touch-action: none; overflow: hidden; }
.touch-steer::before { content: ""; position: absolute; left: 50%; top: 14px; bottom: 14px; border-left: 1px solid var(--line); }
.touch-thumb { position: absolute; left: calc(50% - 26px); top: 4px; bottom: 4px; width: 52px; border-radius: 26px; background: var(--paper); border: 1px solid var(--ink); transition: background .08s; }
.touch-steer.pressed .touch-thumb { background: var(--ink); }
.touch-pedals { flex: 0 0 50%; display: grid; grid-template-columns: 1fr 1.35fr; gap: 8px; height: 60px; }
.touch-pedals button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--ink);
  font-size: var(--text-eyebrow);
  font-weight: 650;
  letter-spacing: .12em;
  touch-action: none;
}
.touch-pedals button[data-control="throttle"] { border-color: var(--ink); }
.touch-pedals button.pressed { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.touch-actions { display: none; }

.rules-dialog { width: min(480px, calc(100% - 28px)); padding: 24px; border: 1px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); }
.rules-dialog::backdrop { background: rgba(var(--paper-rgb),.86); backdrop-filter: blur(3px); }
.rules-dialog h2 { margin: 8px 0 14px; font-size: var(--text-page-title); letter-spacing: -.03em; }
.rules-dialog ul { margin: 0; padding-left: 17px; color: var(--ink); font-size: var(--text-body); line-height: 1.65; }
.dialog-attempts { margin: 15px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: var(--text-value); font-weight: 650; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 8px; }
.dialog-actions--single { grid-template-columns: 1fr; }

@media (max-width: 1120px) {
  .score-card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  .score-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .site-header, .start-menu, .layout { width: min(760px, 100%); }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .start-menu { padding-top: 58px; }
  .home-view { grid-template-columns: 1fr; gap: 62px; align-items: start; min-height: auto; }
  .home-hero { align-self: auto; }
  .page-heading { gap: 40px; }
  .weekly-status { grid-template-columns: 120px minmax(200px, 1fr); }
  .weekly-division { grid-template-columns: 1fr; gap: 14px; }
  .weekly-status .menu-action { grid-column: 1 / -1; justify-self: end; }
}

@media (max-width: 650px) {
  body { padding: 12px; }
  .site-header { min-height: 34px; }
  .header-profile { padding-left: 10px; }
  .account-menu { width: min(360px, calc(100vw - 24px)); }
  .start-menu { padding-top: 42px; }
  .home-view { gap: 48px; padding-bottom: 42px; }
  .home-hero h1 { --hero-display: clamp(64px, 22vw, 92px); }
  .mode-entry { grid-template-columns: 26px minmax(0, 1fr) 20px; gap: 8px; padding: 21px 0 23px; }
  .mode-copy-block small { font-size: var(--text-body); }
  .page-heading { grid-template-columns: 1fr; gap: 18px; margin-bottom: 42px; }
  .circuit-columns { display: none; }
  .circuit-row { grid-template-columns: 26px minmax(0, 1fr) 18px; gap: 10px; }
  .circuit-track-preview { display: none; }
  .score-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .garage-hero { width: 92px; }
  .circuit-stat { grid-row: 2; text-align: left; }
  .circuit-pb-cell { grid-column: 2; grid-row: 2; justify-content: flex-start; }
  .circuit-percentile { grid-column: 2; grid-row: 2; margin-left: 100px; }
  .circuit-arrow { grid-column: 3; grid-row: 1 / 3; }
  .selected-race {
    align-items: stretch;
    flex-direction: column;
    position: sticky;
    bottom: 0;
    gap: 10px;
    padding: 14px 0;
    margin: 0 -22px;
    padding-left: 22px;
    padding-right: 22px;
    background: var(--paper);
    border-top: 1px solid var(--ink);
    z-index: 5;
  }
  .selected-race h2 { --selected-race-h2-size: 18px; }
  .menu-action { width: 100%; min-width: 0; }
  .selected-race .menu-action { width: 100%; min-width: 0; }
  .weekly-status { grid-template-columns: 1fr; gap: 22px; align-items: start; }
  .weekly-status .menu-action { grid-column: auto; justify-self: stretch; }
  .leaderboard-heading { align-items: start; flex-direction: column; gap: 7px; }
  .leaderboard-row-actionable { grid-template-columns: 30px minmax(0, 1fr) auto; row-gap: 6px; }
  .leaderboard-row-actionable .leaderboard-time { grid-column: 3; grid-row: 1; }
  .leaderboard-row-actionable .leaderboard-actions { grid-column: 1 / -1; grid-row: 2; justify-content: flex-end; }
  .leaderboard-action { padding: 5px 11px; }
  .hud { grid-template-columns: auto 1fr auto; gap: 14px; padding-bottom: 6px; }
  .hud-item:nth-child(3),
  .hud-item:nth-child(4),
  .hud-item:nth-child(5) { display: none; }
  .hud-speed { text-align: right; }
  .hud-item > span { margin-bottom: 1px; }
  .hud-item strong { --hud-item-size: var(--text-row-title); }
  .hud-time strong { font-size: var(--text-page-title); }
  .race-panel { margin-bottom: 28px; }
}

@media (max-width: 650px) {
  /* Three figures in a row do not fit a phone: two per row. */
  .profile-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
}

@media (max-width: 420px) {
  :root { --text-heading: clamp(36px, 12vw, 48px); } /* long words such as Achievements must fit a 320px screen */
  .score-card-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (pointer: coarse), (max-width: 820px) {
  .touch-controls { display: flex; }
  /*
   * RACE/WATCH are the actions repeated most under touch, where a mis-tap costs most: grow the tap
   * target to the 44px floor without touching the mouse-pointer size above.
   */
  .leaderboard-action { min-height: 44px; padding: 4px 14px; display: inline-flex; align-items: center; justify-content: center; }
}

/*
 * Landscape on short screens (phone sideways): HUD and touch controls overlay the canvas instead of
 * stacking below it, since the screen height does not fit canvas, HUD and controls together. The
 * canvas keeps its fixed 760:520 aspect ratio (set by the renderer via canvas.style.aspectRatio) and
 * is fitted proportionally, leaving side margins for the touch buttons.
 */
@media (orientation: landscape) and (max-height: 500px) {
  #game-screen:not([hidden]) {
    position: fixed;
    inset: 0;
    margin: 0;
    background: var(--paper);
    z-index: 20;
  }
  #game-screen .layout { display: block; padding: 0; height: 100%; }
  #game-screen .game-column { position: relative; height: 100%; }
  #game-screen .race-panel { display: none; }

  #game-screen .canvas-shell {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #game-screen canvas { width: auto; height: 100%; max-width: 100%; }
  #game-screen .checkpoint-delta { top: 40px; }

  #game-screen .hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 5px 10px;
    background: rgba(var(--paper-rgb), .88);
    border-bottom: 1px solid var(--line);
  }
  #game-screen .hud-item:nth-child(3),
  #game-screen .hud-item:nth-child(4),
  #game-screen .hud-item:nth-child(5) { display: none; }
  #game-screen .hud-item { text-align: center; }
  #game-screen .hud-item > span { margin-bottom: 1px; font-size: var(--text-eyebrow); }
  #game-screen .hud-item strong { font-size: var(--text-row-title); }
  #game-screen .hud-speed { text-align: center; }

  #game-screen .touch-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    justify-content: space-between;
    padding: 0 16px 14px;
    pointer-events: none;
  }
  #game-screen .touch-controls { align-items: flex-end; }
  #game-screen .touch-steer { flex: 0 0 30%; height: 56px; pointer-events: auto; background: rgba(var(--paper-rgb), .7); }
  #game-screen .touch-pedals { flex: 0 0 32%; height: 56px; pointer-events: auto; }
  #game-screen .touch-pedals button { background: rgba(var(--paper-rgb), .7); }
  #game-screen .touch-pedals button.pressed { background: var(--ink); }
  #game-screen .touch-actions { position: absolute; top: 44px; right: 12px; z-index: 3; display: flex; gap: 6px; }
  #game-screen .touch-actions button { padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: rgba(var(--paper-rgb), .7); color: var(--muted); font-size: var(--text-eyebrow); font-weight: 650; letter-spacing: .1em; }
  #game-screen .touch-actions button:active { background: var(--ink); color: var(--paper); }
}

/*
 * Prevents double-tap zoom when tapping beside the canvas on the race screen, e.g. in the letterboxing
 * margin in landscape. Applied to the whole game screen since the same can happen between the touch
 * buttons in portrait.
 */
/* pan-y: vertical scrolling stays (skill tiers, validation below the track); pinch and double-tap zoom do not. Canvas and controls are touch-action: none. */
#game-screen:not([hidden]) { touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; }
}

/* Achievements tab: category list left, wide tiles right. Locked tiles keep the
   tile but lose colour; earned ones get the ink border and a red date. */
.achievement-total { color: var(--muted); font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .11em; font-variant-numeric: tabular-nums; }
.achievement-browser { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.achievement-nav { display: flex; flex-direction: column; gap: 8px; }
.achievement-nav button { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: none; color: var(--muted); font: inherit; font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .11em; text-align: left; cursor: pointer; }
.achievement-nav button span:last-child { font-variant-numeric: tabular-nums; }
.achievement-nav button:hover { color: var(--ink); }
.achievement-nav button[aria-selected="true"] { border-color: var(--accent); color: var(--accent); }
.achievement-nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.achievement-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.achievement-tile { position: relative; display: flex; align-items: center; gap: 18px; min-width: 0; padding: 18px 22px 18px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.achievement-tile.earned { border-color: var(--ink); }
.achievement-tile-icon { flex: none; width: 56px; height: 56px; }
.achievement-tile img.achievement-tile-icon { display: block; object-fit: contain; }
/*
 * Season records: the sticker is shown larger with the season's nameplate drawn over it; the text
 * scales with the badge.
 */
.season-record-badge { --badge-size: 96px; position: relative; display: inline-block; width: var(--badge-size); height: var(--badge-size); }
.season-record-badge > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.season-record-badge__season { position: absolute; left: 10.9375%; top: 81.25%; width: 78.125%; height: 15.625%; box-sizing: border-box; display: flex; align-items: center; justify-content: center; padding-inline: 3.125%; overflow: hidden; border: max(1px, calc(var(--badge-size) / 64)) solid #f5f5f5; border-radius: calc(var(--badge-size) * 9 / 256); background: #080808; color: #f5f5f5; font-size: max(8px, calc(var(--badge-size) * 20 / 256)); font-weight: 700; letter-spacing: .02em; line-height: 1; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.achievement-tile--record .achievement-tile-icon.season-record-badge { width: 96px; height: 96px; flex: none; }
.achievement-tile .medal-icon { width: 60px; height: 60px; margin: -2px; }
.achievement-tile .tier-mark { width: 56px; height: 56px; border-radius: 12px; font-size: var(--text-page-title); }
.achievement-tile:not(.earned) .achievement-tile-icon { filter: grayscale(1); opacity: .35; }
.achievement-tile-body { flex: 1; min-width: 0; }
.achievement-tile-body strong { display: block; font-size: var(--text-row-title); font-weight: 650; letter-spacing: -.01em; line-height: 1.25; }
.achievement-tile:not(.earned) .achievement-tile-body strong { color: var(--muted); }
.achievement-tile-reached { display: block; margin-top: 3px; color: var(--accent); font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .11em; }
.achievement-tile-body p { margin: 6px 0 0; color: var(--muted); font-size: var(--text-body); line-height: 1.55; }
.achievement-tile-foot { margin-top: 10px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .11em; font-variant-numeric: tabular-nums; }
.achievement-pips { display: flex; gap: 4px; flex: none; }
.achievement-pips i { width: 10px; height: 10px; box-sizing: border-box; border: 1px solid var(--muted); border-radius: 3px; }
.achievement-pips i.earned { border-color: var(--accent); background: var(--accent); }
.achievement-progress { flex: 1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.achievement-progress i { display: block; height: 100%; background: var(--accent); }
.achievement-tile-count { position: absolute; top: 14px; right: 16px; color: var(--accent); font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: .08em; }
@media (max-width: 760px) {
  .achievement-browser { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .achievement-nav { flex-direction: row; overflow-x: auto; padding: 2px; }
  .achievement-nav button { flex: none; gap: 10px; padding: 12px 14px; }
  .achievement-tiles { grid-template-columns: minmax(0, 1fr); }
}

/* Season history: a collapsible block under SEASON CIRCUITS on the Profile tab. */
.history-disclosure { margin-top: 46px; padding: 0 22px; border: 1px solid var(--line); border-radius: 10px; }
.history-disclosure[open] { padding-bottom: 22px; }
.history-disclosure > summary { display: flex; justify-content: space-between; align-items: center; padding: 18px 0; list-style: none; font-size: var(--text-row-title); font-weight: 650; letter-spacing: .02em; cursor: pointer; }
.history-disclosure > summary::-webkit-details-marker { display: none; }
.history-disclosure > summary::after { content: '+'; color: var(--accent); font-size: var(--text-page-title); font-weight: 400; }
.history-disclosure[open] > summary::after { content: '–'; }
.history-disclosure > summary:hover { color: var(--accent); }
.history-disclosure > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/*
 * Touch: header tap areas grow to 44px without changing the layout (padding inwards, an equal
 * negative margin outwards).
 */
@media (pointer: coarse) {
  .account-entry { min-height: 44px; }
  .header-profile, .header-back { padding-block: 15px; margin-block: -9px; }
}
