/* APEX GP interface.
   Colour comes only from the tokens below. The light theme overrides tokens,
   so a rule written with tokens works in both themes. The rail, the hero bands
   and the labels drawn over the 3D scene keep fixed colours on purpose. */
:root {
  color-scheme: dark;
  --bg: #0e1238;
  --bg-top: #1c2572;
  --hatch: #ffffff06;
  --bar: #0b0f33eb;
  --inset: #121746;
  --panel: #1a2060;
  --raised: #262e86;
  --line: #3640a2;
  --line-soft: #272f7e;
  --text: #f5f6ff;
  --text-2: #bcc5f0;
  --muted: #8d97d2;
  /* Card heads and selected controls. */
  --head-a: #ffffff;
  --head-b: #cdd5f8;
  --head-text: #10163f;
  --head-muted: #4a5596;
  --head-btn: #10163f;
  /* The accent when it is used as text or as a thin marker. */
  --ink: #abe33c;
  --team: #53b6ff;
  --link: #94c9ff;
  --green: #62e08c;
  --amber: #ffc53d;
  --red: #ff6675;
  --focus: #ffffff;
  /* Outline for swatches whose colour can be close to the panel. */
  --ring: transparent;
  --glass: linear-gradient(145deg, #1c2468f2, #10164aeb);
  --glass-line: #6c78d44d;
  --scrim-a: #0a0e30f5;
  --scrim-b: #0a0e30b8;
  --scene: #0a0e30;
  --shadow: 0 10px 30px #04061a66;
  /* Same in both themes. */
  --rail: #0a0e30;
  --rail-text: #b4bdea;
  --hero-a: #3b48b4;
  --hero-b: #1f2772;
  --cta: #abe33c;
  --cta-b: #8fce2a;
  --cta-text: #0f2206;
  /* sans-serif-condensed is Android's name for Roboto Condensed. */
  --display: "Bahnschrift", "DIN Alternate", "Roboto Condensed", sans-serif-condensed, "Arial Narrow",
    "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
  --ui: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", Roboto, Arial, sans-serif;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #e6eafb;
  --bg-top: #f8f9ff;
  --hatch: #1c25720a;
  --bar: #ffffffeb;
  --inset: #edf0fc;
  --panel: #ffffff;
  --raised: #dfe5fb;
  --line: #bfc8ef;
  --line-soft: #d7ddf6;
  --text: #131943;
  --text-2: #414b88;
  --muted: #5f699e;
  --head-a: #2e38a4;
  --head-b: #1c2370;
  --head-text: #ffffff;
  --head-muted: #c3caf3;
  --head-btn: #ffffff2e;
  --ink: #2f6b00;
  --team: #1e6fd6;
  --link: #195fb3;
  --green: #0f8a4f;
  --amber: #9a5b00;
  --red: #c2313f;
  --focus: #1c2370;
  --ring: #5f699e;
  --glass: linear-gradient(145deg, #fffffff5, #f1f3fdf0);
  --glass-line: #aab4e680;
  --scrim-a: #f6f7fff5;
  --scrim-b: #f6f7ffb8;
  --scene: #dfe4f6;
  --shadow: 0 10px 30px #1c257226;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 14px var(--ui);
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(118deg, transparent 0 46px, var(--hatch) 46px 48px),
    radial-gradient(130% 70% at 72% -12%, var(--bg-top) 0, var(--bg) 58%);
}
button {
  font: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
}
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Shell: icon rail, top bar, content. */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  width: 96px;
  flex: 0 0 96px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: 14px;
  overflow: hidden auto;
  scrollbar-width: none;
  background: var(--rail);
  border-right: 1px solid var(--line-soft);
  color: var(--rail-text);
}
.brand {
  display: grid;
  justify-items: center;
  gap: 7px;
  margin-bottom: 12px;
}
.brand b {
  font: 800 15px var(--display);
  letter-spacing: 1px;
  color: #fff;
}
.brand b span {
  margin-left: 3px;
  color: var(--cta);
}
.mark {
  width: 30px;
  height: 24px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  transform: skew(-15deg);
}
.mark i {
  width: 7px;
  height: 15px;
  background: var(--cta);
}
.mark i:nth-child(2) {
  height: 23px;
  background: #fff;
}
.mark i:nth-child(3) {
  height: 10px;
  background: #53b6ff;
}
nav {
  display: flex;
  flex-direction: column;
}
.nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 72px;
  padding: 9px 4px;
  border-top: 1px solid #ffffff0d;
  background: transparent;
  color: var(--rail-text);
  font: 700 11px var(--ui);
  letter-spacing: 0.5px;
}
.nav i {
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.nav svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}
.nav:hover {
  background: #171d57;
  color: #fff;
}
.nav.active {
  border-top-color: transparent;
  background: linear-gradient(180deg, var(--cta), var(--cta-b));
  color: var(--cta-text);
}
.settings {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 50px;
  padding: 6px 4px;
  background: transparent;
  color: var(--rail-text);
  font-size: 10px;
}
.settings svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.settings:hover {
  color: #fff;
}
#theme-toggle {
  margin-top: auto;
  border-top: 1px solid #ffffff0d;
}
#theme-toggle .moon,
#theme-toggle[aria-pressed="true"] .sun {
  display: none;
}
#theme-toggle[aria-pressed="true"] .moon {
  display: block;
}
main {
  min-width: 0;
  flex: 1;
}
main > header {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-left: 28px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bar);
  backdrop-filter: blur(10px);
}
main > header > div:first-child {
  min-width: 0;
}
#crumb {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font: 700 11px var(--ui);
  letter-spacing: 1px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
header h1 {
  margin: 3px 0 0;
  overflow: hidden;
  font: 800 24px var(--display);
  letter-spacing: 0.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
}
/* Resource chips: dark tiles with an accent corner. `.next` alone would also
   match the current round in the calendar (`.event.next`). */
.season,
.budget,
.header-actions .next {
  padding: 8px 15px 8px 12px;
  border-radius: 3px;
  background:
    linear-gradient(225deg, var(--cta) 7px, transparent 7.5px),
    var(--inset);
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}
.season {
  display: flex;
  align-items: center;
  gap: 7px;
}
.season > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
}
.season strong,
.budget b,
.header-actions .next b {
  color: var(--text);
  font: 800 15px var(--display);
}
.budget {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.budget b {
  color: var(--green);
}
.budget b.debt {
  color: var(--red);
}
.header-actions .next {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 8px;
  align-items: baseline;
  padding-block: 4px;
}
.header-actions .next span {
  grid-column: 1 / -1;
  font-size: 11px;
}
.primary {
  padding: 10px 16px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--cta), var(--cta-b));
  box-shadow: inset 0 -2px #0000001f;
  color: var(--cta-text);
  font: 800 13px var(--ui);
  letter-spacing: 0.5px;
}
.primary b {
  margin-left: 6px;
  font-size: 16px;
  line-height: 0;
}
/* The top-bar action is the one slanted block, flush with the corner. */
#advance {
  align-self: stretch;
  margin-left: 6px;
  padding: 0 26px 0 46px;
  border-radius: 0;
  box-shadow: none;
  clip-path: polygon(24px 0, 100% 0, 100% 100%, 0 100%);
  font: 800 18px var(--display);
  letter-spacing: 1px;
  white-space: nowrap;
}
#advance:focus-visible {
  outline-color: var(--cta-text);
  outline-offset: -5px;
}
.ghost {
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--text-2);
  font: 700 12px var(--ui);
}
/* Row-level actions stay quiet; the accent is kept for one action per card. */
.management-row button,
.queue,
.timeline button,
.staff > button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--raised);
  color: var(--text);
  font: 700 12px var(--ui);
  white-space: nowrap;
}
.content {
  max-width: 1500px;
  margin: auto;
  padding: 24px 28px 48px;
}
.view {
  display: none;
}
.view.active {
  display: block;
  animation: fade 0.24s ease;
}
@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.up {
  color: var(--green) !important;
}
.muted {
  color: var(--muted) !important;
}

/* Home. */
.hero {
  position: relative;
  min-height: 290px;
  display: flex;
  justify-content: space-between;
  overflow: hidden;
  padding: 30px 34px;
  border-radius: 4px;
  background: linear-gradient(118deg, var(--hero-a), var(--hero-b) 72%);
  color: #fff;
}
.hero:before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #12175066, transparent 62%),
    repeating-linear-gradient(118deg, transparent 0 54px, #ffffff0a 54px 108px);
}
.hero-text {
  position: relative;
  z-index: 1;
}
.hero-text > small {
  color: var(--cta);
  font: 800 12px var(--ui);
  letter-spacing: 2px;
}
.hero-text h2 {
  margin: 10px 0 12px;
  font: 800 42px/1.2 var(--display);
  letter-spacing: 1px;
}
.hero-text h2 strong {
  color: var(--cta);
}
.hero-text p {
  margin: 0 0 20px;
  color: #d4dbff;
  font-size: 13px;
  line-height: 1.6;
}
.hero-text .ghost {
  margin-left: 8px;
  border-color: #ffffff59;
  color: #fff;
}
.hero-track {
  position: absolute;
  right: 8%;
  top: 14px;
  width: 480px;
  height: 250px;
  pointer-events: none;
}
.hero-track svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.hero-track path {
  fill: none;
  stroke: #e8ecff;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 6px 0 #0d124366);
}
.hero-track > div {
  position: absolute;
  right: 23px;
  bottom: 4px;
  color: #c9d1ff;
  font-size: 11px;
}
.hero-track > div b {
  color: #fff;
  font: 800 16px var(--display);
}
.weather {
  position: absolute;
  right: 30px;
  top: 26px;
  z-index: 1;
  color: var(--amber);
  font-size: 21px;
}
.weather b {
  margin-left: 7px;
  color: #fff;
  font: 800 20px var(--display);
}
.weather small {
  display: block;
  margin: -1px 0 0 30px;
  color: #c9d1ff;
  font-size: 11px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 16px;
}
.metrics article {
  min-height: 122px;
  padding: 15px 16px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background:
    linear-gradient(225deg, var(--cta) 10px, transparent 10.5px),
    var(--panel);
}
.metrics article > small {
  color: var(--text-2);
  font: 700 12px var(--ui);
  letter-spacing: 0.5px;
}
.metrics article > b {
  display: block;
  margin: 8px 0 7px;
  font: 800 31px var(--display);
}
.metrics article > b i {
  color: var(--muted);
  font: 600 13px var(--ui);
}
.metrics article > span {
  color: var(--muted);
  font-size: 11px;
}
.metrics article > span i {
  color: var(--muted);
  font-style: normal;
}
.bar {
  height: 6px;
  margin: 10px 0 8px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--inset);
}
.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--cta);
}
.columns {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  margin-top: 16px;
}

/* Cards: a bright head strip over a dark body, rows as inset tiles. */
.panel {
  --pad: 18px;
  padding: var(--pad);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: var(--panel);
}
.panel-head,
.schedule-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) 14px;
  padding: 7px var(--pad);
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--head-a), var(--head-b));
  color: var(--head-text);
}
.panel-head > div {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.panel-head h3 {
  margin: 0;
}
.panel-head h3,
.schedule-head {
  font: 800 17px var(--display);
  letter-spacing: 0.5px;
}
.panel-head > div > small,
.panel-head > small,
.schedule-head span {
  color: var(--head-muted);
  font: 700 11px var(--ui);
  letter-spacing: 1px;
  white-space: nowrap;
}
.panel-head > button {
  min-height: 32px;
  padding: 0 4px;
  background: transparent;
  color: var(--head-text);
  font: 700 12px var(--ui);
  white-space: nowrap;
}
.panel-head > button:focus-visible {
  outline-color: var(--head-text);
}
.panel-head > em {
  padding: 4px 8px;
  border-radius: 3px;
  background: var(--head-btn);
  color: #fff;
  font: 700 11px var(--ui);
  white-space: nowrap;
}
.timeline,
.feed,
.management-list,
.performance,
.stat-list {
  display: grid;
  gap: 6px;
}
.timeline > div,
.feed-entry,
.management-row,
.event,
.standing-row,
.upgrade,
.market-driver,
.ledger > div,
.news-item {
  border-radius: 3px;
  background: var(--inset);
}
.timeline > div {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 8px 12px;
  border-left: 3px solid transparent;
}
.timeline > div > strong {
  width: 46px;
  color: var(--muted);
  font: 800 19px var(--display);
}
.timeline strong small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font: 600 11px var(--ui);
}
.timeline span {
  flex: 1;
  min-width: 0;
}
.timeline span b {
  display: block;
  font-size: 13px;
}
.timeline span small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.timeline em {
  color: var(--green);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}
.timeline .current {
  border-left-color: var(--ink);
  background: var(--raised);
}
.timeline .current > strong {
  color: var(--ink);
}
.feed-entry {
  display: flex;
  width: 100%;
  min-height: 44px;
  text-align: left;
  align-items: center;
  gap: 11px;
  margin: 0;
  padding: 9px 12px;
}
.feed-entry > i,
.news-item header i,
.upgrade > i,
.staff > b {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 3px;
  background: var(--raised);
  color: var(--ink);
  font-style: normal;
}
.feed-entry > i {
  width: 30px;
  height: 30px;
}
.feed-entry > i.green {
  color: var(--muted);
}
.feed-entry span {
  flex: 1;
  min-width: 0;
}
.feed b {
  display: block;
  font-size: 13px;
  line-height: 1.5;
}
.feed small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.feed em {
  padding: 3px 7px;
  border-radius: 3px;
  background: var(--raised);
  color: var(--ink);
  font: 800 11px var(--ui);
  white-space: nowrap;
}
.news-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.news-filters button {
  padding: 6px 11px;
  font-size: 12px;
}
.news-list {
  display: grid;
  gap: 8px;
}
.news-item {
  padding: 10px 12px;
}
.news-item header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.news-item header i {
  width: 26px;
  height: 26px;
  font-size: 13px;
}
.news-item header b {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.news-item header small {
  color: var(--muted);
  font-size: 11px;
}
.news-item p {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.heading p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
}

/* The race is a viewport scene; HUD surfaces never define the canvas size. */
body:has(#race.active) {
  height: 100dvh;
  overflow: hidden;
  background: var(--scene);
}
body:has(#race.active) .sidebar,
body:has(#race.active) main > header { display: none; }
body:has(#race.active) .app-shell { min-height: 0; height: 100dvh; }
body:has(#race.active) .content { padding: 0; }
#race {
  --race-left: 332px;
  --race-right: 302px;
  --race-top: 76px;
  --race-bottom: 88px;
  position: fixed;
  inset: 0;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: var(--scene);
}
#race .heading {
  position: absolute;
  z-index: 4;
  inset: 0 0 auto;
  height: 66px;
  padding: 10px 20px;
  margin: 0;
  gap: 16px;
  flex-wrap: nowrap;
  background: linear-gradient(var(--scrim-a), var(--scrim-b) 75%, transparent);
}
#race .heading > div:first-child { min-width: 0; }
#race .heading small { color: var(--ink); font: 800 11px var(--ui); letter-spacing: 1px; }
#race .heading h2 { margin: 3px 0 0; font: 800 21px var(--display); letter-spacing: 0.5px; }
.race-status { margin-left: auto; color: var(--text-2); font-size: 12px; white-space: nowrap; }
.race-status > span {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--ink);
}
#race button, #race select { min-height: 32px; }
#race button:focus-visible, #race input:focus-visible, #race select:focus-visible,
#race-classification:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.race-home,
#race .race-save {
  display: block;
  flex: 0 0 auto;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid var(--glass-line);
  border-radius: 3px;
  background: var(--inset);
  color: var(--text);
  font: 700 12px var(--ui);
  text-align: center;
}
.race-grid, #race .race-panel { position: absolute; inset: 0; }
#race .race-panel { padding: 0; border: 0; border-radius: 0; background: none; }
.track { position: absolute; inset: 0; overflow: hidden; background: var(--scene); }
.track > #race-map { display: block; width: 100%; height: 100%; }
#car-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.car-rank-label {
  position: absolute;
  left: 0;
  top: 0;
  padding: 2px 5px;
  border: 1px solid #ffffff47;
  border-radius: 3px;
  background: #0a0e30d9;
  color: #f5f6ff;
  font: 700 10px var(--ui);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px #000;
}
.car-rank-label.ours { border-color: var(--team); background: #123a7cee; color: #d8eeff; font-size: 12px; }
.car-rank-label[hidden] { display: none; }
#race-render-error {
  position: absolute;
  z-index: 3;
  top: 40%;
  left: calc(var(--race-left) + 12px);
  right: calc(var(--race-right) + 12px);
  padding: 18px;
  border: 1px solid var(--amber);
  border-radius: 4px;
  background: var(--glass);
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}
#race-render-error[hidden] { display: none; }
.race-controls,
.race-stats,
#race-classification,
#race .driver.panel,
.tip {
  border: 1px solid var(--glass-line);
  border-radius: 4px;
  background: var(--glass);
  backdrop-filter: blur(12px);
}
.race-controls {
  position: absolute;
  z-index: 5;
  bottom: 14px;
  left: 16px;
  right: 16px;
  min-height: 54px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 8px 12px;
  box-shadow: var(--shadow);
}
.camera-gesture-hint {
  flex-basis: 100%;
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}
.race-tools, .race-tools > span, .race-tools > div,
.camera-tools, .view-distance, .race-quality { display: flex; align-items: center; gap: 5px; }
.race-tools { gap: 14px; color: var(--text-2); font-size: 11px; white-space: nowrap; }
.race-controls button,
.coach-toggle {
  min-width: 32px;
  padding: 5px 9px;
  border-radius: 3px;
  background: var(--raised);
  color: var(--text);
  font: 600 11px var(--ui);
  white-space: nowrap;
}
.race-tools .speed.active,
.camera-tools button[aria-pressed="true"],
.coach-toggle[aria-pressed="true"],
.segments button.selected {
  background: linear-gradient(180deg, var(--head-a), var(--head-b));
  color: var(--head-text);
  font-weight: 800;
}
.camera-tools { padding-left: 12px; border-left: 1px solid var(--glass-line); }
.view-distance, .race-quality { color: var(--text-2); font-size: 11px; white-space: nowrap; }
.view-distance input { width: 95px; min-width: 40px; min-height: 32px; accent-color: var(--cta-b); cursor: pointer; }
.view-distance output { min-width: 35px; text-align: center; font-variant-numeric: tabular-nums; }
.race-quality select { padding: 4px 5px; border: 1px solid var(--glass-line); border-radius: 3px; background: var(--raised); color: var(--text); font: inherit; }
.race-options { display: flex; align-items: center; justify-content: end; gap: 6px; }
#audio-settings[aria-pressed="true"] { color: var(--amber); }
.audio-controls { display: grid; gap: 14px; margin: 16px 0; }
.audio-controls label { display: grid; grid-template-columns: 76px minmax(80px, 1fr) 40px; align-items: center; gap: 10px; font-size: 13px; }
.audio-controls input[type="range"] { width: 100%; min-height: 32px; accent-color: var(--cta-b); }
.audio-controls output { text-align: right; font-variant-numeric: tabular-nums; }
.audio-controls .audio-mute { display: flex; gap: 9px; min-height: 32px; }
#audio-status { color: var(--text-2); font-size: 12px; line-height: 1.5; }
.camera-caption, .race-clock {
  position: absolute;
  top: var(--race-top);
  padding: 7px 9px;
  border-radius: 3px;
  background: #0a0e30cc;
  color: #f5f6ff;
  font-size: 11px;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.camera-caption { left: var(--race-left); max-width: calc(100% - var(--race-left) - var(--race-right) - 115px); }
.race-clock { right: var(--race-right); }
.track > #race-minimap {
  position: absolute;
  right: var(--race-right);
  bottom: calc(var(--race-bottom) + 8px);
  width: 268px;
  height: 161px;
  padding: 6px;
  box-sizing: content-box;
  border: 1px solid #ffffff45;
  border-radius: 8px;
  background: #0a0e30d0;
  box-shadow: 0 6px 18px #0000003d;
  pointer-events: none;
}
.track > #race-minimap[hidden] { display: none; }
#race:has(#race-start-sequence:not([hidden])) #race-minimap { visibility: hidden; }
.mini-road { fill: none; stroke: #cdd5f8; stroke-width: 14; stroke-linecap: round; }
.mini-pit { fill: none; stroke: #69d8de; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.mini-pit-directions { fill: none; stroke: #b5fbff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
#mini-focus[hidden] { display: none; }
.mini-focus-halo, .mini-focus-ring { fill: none; vector-effect: non-scaling-stroke; }
.mini-focus-halo { stroke: #0a0e30; stroke-width: 5; }
.mini-focus-ring { stroke: #fff; stroke-width: 2; }
.team-home { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; padding: 18px; }
.team-home > div:nth-child(2) { flex: 1; min-width: 0; }
.team-home h3 { margin: 4px 0; font: 800 24px var(--display); }
.team-home p { margin: 0; color: var(--text-2); font-size: 12px; line-height: 1.7; }
.team-home small { color: var(--text-2); font-size: 10px; letter-spacing: 1px; }
.team-home-mark, .team-preset-mark, #team-preview-logo { display: grid; place-items: center; border: 1px solid var(--glass-line); border-radius: 8px; background: #12182b; }
.team-home-mark { width: 64px; height: 64px; flex-shrink: 0; }
.team-home-mark .team-logo { width: 42px; height: 42px; }
.team-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.team-presets button { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 4px 10px; min-height: 76px; padding: 10px; border: 1px solid var(--glass-line); border-radius: 6px; background: var(--inset); color: var(--text); text-align: left; }
.team-presets button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.team-presets b { font: 700 12px var(--ui); overflow-wrap: anywhere; }
.team-presets small { grid-column: 2; color: var(--text-2); font: 10px var(--ui); }
.team-preset-mark { grid-row: span 2; width: 40px; height: 40px; }
.team-preset-mark .team-logo { width: 27px; height: 27px; }
.team-preview { margin-block: 18px; padding: 18px; border-radius: 8px; background: #11182c; color: #f3f6ff; }
.team-preview-heading { display: flex; align-items: center; gap: 12px; }
#team-preview-logo { width: 48px; height: 48px; flex-shrink: 0; }
#team-preview-logo svg { width: 32px; height: 32px; }
.team-preview h3 { margin: 4px 0; font: 800 20px var(--display); overflow-wrap: anywhere; }
.team-preview small { color: #a8b4cc; font-size: 9px; letter-spacing: 1px; }
.team-preview > svg { display: block; width: 100%; height: auto; margin-top: 16px; }
.team-colors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 12px; padding: 12px; border: 1px solid var(--glass-line); border-radius: 6px; }
.team-colors legend, .team-colors label { color: var(--text-2); font-size: 11px; }
.team-colors label { display: grid; gap: 6px; }
.team-colors input { width: 100%; height: 44px; padding: 3px; border: 1px solid var(--glass-line); border-radius: 4px; background: var(--raised); cursor: pointer; }
.team-colors output { color: var(--text); font: 11px var(--mono, monospace); }
.team-confirm { margin-top: 18px; }
.team-picker button, .team-home button { min-height: 44px; }
.team-replace-warning { color: var(--amber); }
@media (max-width: 600px) {
  .team-home { flex-wrap: wrap; gap: 12px; }
  .team-home h3 { font-size: 20px; }
  .team-home > button { width: 100%; }
  .team-colors { gap: 8px; padding: 8px; }
  .team-preview { padding: 12px; }
}
@media (max-width: 380px) {
  .team-presets { grid-template-columns: 1fr; }
}
#race.race-yellow .track::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  box-shadow: inset 0 0 0 3px #ffc53d, inset 0 0 70px #ffc53d55;
}
#race.race-yellow #banner { border-left-color: #ffc53d; background: #2a2208e8; color: #ffe6a0; }
#race.race-yellow #race-clock { color: #ffd76b; }
#race.race-yellow .race-status b { color: var(--amber); }
.classification-row.retired { opacity: 0.62; }
.classification-row.retired .classification-status { color: var(--red); }
#banner {
  position: absolute;
  left: var(--race-left);
  bottom: calc(var(--race-bottom) + 8px);
  max-width: calc(100% - var(--race-left) - var(--race-right) - 215px);
  margin: 0;
  padding: 8px 12px;
  border-left: 3px solid var(--cta);
  border-radius: 3px;
  background: #0a0e30dc;
  color: #e1e6ff;
  font-size: 11px;
  line-height: 1.6;
  pointer-events: none;
}
#banner:empty { display: none; }
.race-stats {
  position: absolute;
  left: 16px;
  bottom: var(--race-bottom);
  width: calc(var(--race-left) - 30px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
  color: var(--muted);
  font-size: 10px;
}
.race-stats b { display: block; margin: 3px 0; color: var(--text); font: 800 17px var(--display); }
.race-stats small { color: var(--muted); font-size: 10px; }
.race-stats .good,
.management-row em { color: var(--green); font-style: normal; font-weight: 700; }
#race-classification {
  position: absolute;
  z-index: 3;
  top: var(--race-top);
  left: 16px;
  width: calc(var(--race-left) - 30px);
  max-height: calc(100% - var(--race-top) - var(--race-bottom) - 138px);
  padding: 0 5px 5px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  font-variant-numeric: tabular-nums;
}
#race-classification .classification-head,
#race-classification .classification-row {
  --tower-gap-width: 52px;
  grid-template-columns: minmax(0, 1fr) 52px 54px 36px;
  gap: 4px;
  padding: 8px 3px;
  font-size: 10px;
}
#race-classification .classification-head { z-index: 1; font-size: 9px; }
#race-classification .classification-row b { margin-right: 0; }
#race-classification .classification-row > span { min-width: 0; overflow-wrap: anywhere; }
.commands {
  position: absolute;
  z-index: 4;
  top: var(--race-top);
  right: 16px;
  bottom: var(--race-bottom);
  width: calc(var(--race-right) - 30px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
#race .driver.panel {
  --pad: 13px;
  flex: 0 0 auto;
  padding: 0 var(--pad) var(--pad);
}
.driver > header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 calc(-1 * var(--pad));
  padding: 6px var(--pad);
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--head-a), var(--head-b));
  color: var(--head-text);
}
.avatar { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 3px; background: #10163f; }
.avatar svg { width: 22px; height: 22px; fill: var(--team); }
.avatar.second svg { fill: #b9efff; }
.driver header > span:nth-child(2) { flex: 1; min-width: 0; }
.driver header small { display: block; color: var(--head-muted); font-size: 9px; font-weight: 700; letter-spacing: .5px; }
.driver header b { display: block; margin-top: 2px; font: 800 18px var(--display); }
.driver header b i { color: var(--head-muted); font: 700 10px var(--ui); }
.driver header > strong { font: 800 16px var(--display); }
.driver header > strong em { font-size: 25px; font-style: normal; }
.driver label { display: flex; gap: 4px; margin-top: 10px; color: var(--text-2); font-size: 10px; }
.driver label b { color: var(--text); }
.driver label strong { margin-left: auto; }
.driver .ers b { color: var(--green); }
.driver .ers i { color: var(--text); font-style: normal; }
.tire { height: 4px; margin: 6px 0 8px; overflow: hidden; border-radius: 3px; background: var(--rail); }
.tire span { display: block; height: 100%; border-radius: 3px; background: var(--amber); }
.strategy-feedback { display: block; width: 100%; margin: 0; padding: 3px 0; border: 0; background: transparent; color: var(--text-2); font-size: 10px; line-height: 1.4; text-align: left; }
.driver > small { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }
.segments { display: flex; margin-top: 4px; overflow: hidden; border: 1px solid var(--glass-line); border-radius: 3px; background: var(--inset); }
.segments button { flex: 1; padding: 5px 2px; border-right: 1px solid var(--glass-line); background: transparent; color: var(--text-2); font: 600 11px var(--ui); }
.segments button:last-child { border: 0; }
.pit { width: 100%; margin-top: 10px; padding: 7px 9px; border: 1px solid var(--glass-line); border-radius: 3px; background: var(--raised); color: var(--text); font: 700 11px var(--ui); text-align: left; }
.pit small { float: right; color: var(--text-2); font-size: 9px; font-weight: 400; }
.dispatch { width: 100%; margin-top: 10px; padding: 8px; border-radius: 3px; background: linear-gradient(180deg, var(--cta), var(--cta-b)); color: var(--cta-text); font: 800 12px var(--ui); }
.dispatch[hidden], #advance-prep[hidden] { display: none; }
.qualifying-times { display: none; margin: 8px 0 0; color: var(--text-2); font-size: 10px; line-height: 1.6; font-variant-numeric: tabular-nums; }
.tyre-heat { display: block; flex-basis: 100%; margin-top: 4px; color: var(--text-2); font-size: 11px; }
#race .driver label:has(.tyre-heat) { flex-wrap: wrap; }
#modal:has(.tyre-workbench) { width: min(880px, calc(100vw - 32px)); }
.tyre-workbench { overflow-wrap: anywhere; }
.tyre-set-choice { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.tyre-set-choice select { max-width: 100%; min-width: 0; min-height: 44px; padding: 8px; background: var(--inset); color: var(--text); font: 16px var(--ui); border: 1px solid var(--line); }
.tyre-workbench button, [data-tyre-workbench] { min-height: 44px; white-space: normal; }
.pit-comparison { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.pit-comparison article, .pit-review article { min-width: 0; padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 5px; }
.pit-comparison h3 { margin-top: 0; }
.pit-comparison p, .pit-review p { font-size: 12px; line-height: 1.6; }
.pit-comparison button { width: 100%; }
@media (max-width: 600px) { .pit-comparison { grid-template-columns: minmax(0, 1fr); } }
.qualifying-conditions { display: none; }
.qualifying-session .driver .qualifying-conditions { display: grid; gap: 4px; margin: 8px 0; font-size: 11px; line-height: 1.5; color: var(--text-2); overflow-wrap: anywhere; }
.qualifying-conditions small { font-size: inherit; color: var(--muted); }
.qualifying-conditions .qualifying-urgent { color: var(--amber); }
#race .commands .session-events { grid-column: 1 / -1; width: 100%; min-height: 44px; padding: 8px; border: 1px solid var(--glass-line); border-radius: 5px; background: var(--inset); color: var(--text); font: 700 12px var(--ui); }
.career-seed { margin: 16px 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
.career-seed > div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.career-seed input { flex: 1 1 140px; width: 100%; min-width: 0; min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--inset); color: var(--text); font: 16px var(--ui); }
.career-seed button, .prep-advance button, #advance-decision, #sporting-rules { min-height: 44px; white-space: normal; }
.career-seed p, .prep-advance p { font-size: 12px; line-height: 1.6; color: var(--text-2); overflow-wrap: anywhere; }
.prep-advance { margin: 12px 0; }
.prep-advance button { max-width: 100%; }
.decision-pause { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 12px 0; line-height: 1.5; }
.decision-pause input { flex: 0 0 24px; width: 24px; height: 24px; accent-color: var(--cta); }
.prep-summary { color: var(--text-2); font-size: 13px; line-height: 1.6; margin: 0 0 12px; }
.prep-summary b { color: var(--text); }
.prep-list { list-style: none; padding: 0; margin: 0; }
.prep-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.prep-list li > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.prep-list b { display: block; font-size: 13px; }
.prep-list b small { display: inline-block; margin-right: 6px; padding: 2px 4px; border-radius: 3px; background: var(--raised); color: var(--muted); font-size: 10px; }
.prep-list .prep-warning b small { color: var(--amber); }
.prep-list p { margin: 4px 0 0; color: var(--text-2); font-size: 12px; line-height: 1.6; }
.prep-list button { flex-shrink: 0; min-width: 60px; min-height: 44px; padding: 6px 8px; }
.prep-actions button { min-height: 44px; }
#home-weekend .prep-list { max-height: 320px; overflow: auto; scrollbar-gutter: stable; }
#home-weekend .timeline[hidden] { display: none; }
.qualifying-session .driver label { flex-wrap: wrap; }
.qualifying-traffic { flex: 0 0 100%; min-width: 0; color: var(--amber); font-size: inherit; line-height: 1.35; text-align: right; overflow-wrap: anywhere; }
.qualifying-session .qualifying-times { display: block; }
.qualifying-session .driver .tire,
.qualifying-session .driver > small,
.qualifying-session .driver .segments,
.qualifying-session .driver .pit,
.qualifying-session .driver .strategy-feedback { display: none; }
.qualifying-cut .classification-gap,
.qualifying-cut .classification-status { color: var(--amber); }
.tip { padding: 12px; }
.tip b { color: var(--text); font-size: 11px; }
.tip p { margin: 6px 0 0; color: var(--text-2); font-size: 10px; line-height: 1.6; }
.race-history { display: grid; gap: 8px; margin-top: 14px; }
.race-history h3 { margin: 0; font: 800 15px var(--display); }
.race-history button { text-align: left; white-space: normal; }
.review-driver { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.race-review p { line-height: 1.6; }
.race-review .ledger { max-height: none; }

/* Drivers and staff. */
.driver-cards,
.research-grid,
.calendar-grid,
.management-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
/* The car panel keeps its own height instead of stretching to the upgrade list. */
.research-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: start;
}
/* Two columns: the car and its numbers stay in view while the list scrolls. */
@media (min-width: 1101px) and (min-height: 640px) {
  .car-panel {
    position: sticky;
    top: 84px;
  }
}
.profile {
  padding: 0;
  overflow: hidden;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 16px;
  background: linear-gradient(180deg, var(--head-a), var(--head-b));
  color: var(--head-text);
  font: 800 17px var(--display);
  letter-spacing: 0.5px;
}
.banner,
.car-art {
  position: relative;
  overflow: hidden;
  background: linear-gradient(118deg, var(--hero-a), var(--hero-b));
}
.banner:after,
.car-art:after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(118deg, transparent 0 46px, #ffffff0d 46px 92px);
  pointer-events: none;
}
.banner {
  height: 150px;
  --helmet: #53b6ff;
  --stripe: #b9efff;
}
.banner.teal {
  --helmet: #b9efff;
  --stripe: #53b6ff;
}
.banner > strong {
  position: absolute;
  left: 16px;
  bottom: -22px;
  color: #ffffff24;
  font: 800 120px var(--display);
}
.banner > svg {
  position: absolute;
  right: 9%;
  bottom: 4px;
  width: 158px;
  height: 132px;
  filter: drop-shadow(0 8px 0 #0d124359);
}
.profile-body {
  padding: 14px 16px 16px;
}
.profile-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.profile-person {
  min-width: 0;
  min-height: 44px;
  padding: 0;
  background: transparent;
  text-align: left;
}
.profile-person:hover { background: var(--raised); }
.profile-name {
  display: block;
  margin: 0 0 3px;
  font: 800 27px var(--display);
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.profile-meta {
  display: block;
  margin: 0;
  color: var(--text-2);
  font-size: 12px;
}
.profile-title > em {
  padding: 5px 9px;
  border-radius: 3px;
  background: var(--inset);
  color: var(--green);
  font: 700 12px var(--ui);
  white-space: nowrap;
}
.rating {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 14px 0 10px;
}
.rating > b {
  flex: 0 0 68px;
  color: var(--ink);
  font: 800 46px/1 var(--display);
  text-align: center;
}
.rating > b small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font: 700 11px var(--ui);
}
.stat-list {
  flex: 1;
  min-width: 0;
}
/* A stat row: label, bar, value. Shared by drivers and the car. */
.performance p,
.stat-list p {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 3px;
  background: var(--inset);
  color: var(--text-2);
  font-size: 12px;
}
.performance i,
.stat-list i {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--raised);
}
.performance i b,
.stat-list i b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--cta);
}
.performance strong,
.stat-list strong {
  color: var(--text);
  font: 800 16px var(--display);
  text-align: right;
}
.profile-body > label {
  display: block;
  margin-bottom: 12px;
  padding: 7px 10px;
  border-radius: 3px;
  background: var(--inset);
  color: var(--text-2);
  font-size: 12px;
}
.wide {
  width: 100%;
  padding: 11px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--cta), var(--cta-b));
  box-shadow: inset 0 -2px #0000001f;
  color: var(--cta-text);
  font: 800 14px var(--ui);
  letter-spacing: 1px;
}
.staff {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
}
.staff > b {
  width: 44px;
  height: 44px;
}
.staff > b svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}
.staff > span {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.staff small {
  color: var(--muted);
  font-size: 11px;
}
.staff span > strong {
  margin: 2px 0;
  font: 800 20px var(--display);
}
.staff p {
  margin: 0;
  color: var(--text-2);
  font-size: 12px;
}

/* Research. */
.car-panel .panel-head {
  margin-bottom: 0;
}
.car-art {
  display: grid;
  place-items: center;
  height: 176px;
  margin: 0 calc(-1 * var(--pad)) 14px;
  --helmet: #53b6ff;
  --stripe: #b9efff;
}
.car-art svg {
  position: relative;
  z-index: 1;
  width: min(88%, 440px);
  height: auto;
}
.upgrade {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 6px;
  padding: 12px;
}
.upgrade > i {
  width: 36px;
  height: 36px;
  font-size: 18px;
}
.upgrade > span {
  flex: 1;
  min-width: 0;
}
.upgrade b {
  font-size: 13px;
  line-height: 1.6;
}
.upgrade em {
  display: inline-block;
  margin: 0 4px 4px 6px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--raised);
  color: var(--text-2);
  font: 700 11px var(--ui);
}
.upgrade small {
  display: block;
  margin: 5px 0 7px;
  color: var(--muted);
  font-size: 11px;
}
.upgrade .bar {
  margin: 0 0 5px;
  background: var(--raised);
}

/* Calendar and standings. */
.switch {
  display: flex;
  padding: 3px;
  border-radius: 3px;
  background: var(--inset);
}
.switch button {
  padding: 7px 12px;
  border-radius: 2px;
  background: transparent;
  color: var(--text-2);
  font: 700 12px var(--ui);
}
.switch .active {
  background: linear-gradient(180deg, var(--head-a), var(--head-b));
  color: var(--head-text);
}
.event {
  display: grid;
  grid-template-columns: 30px minmax(110px, 1fr) 76px 40px;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 11px 12px;
  border-left: 3px solid transparent;
}
.event > b {
  color: var(--muted);
  font: 800 19px var(--display);
}
.event span strong {
  display: block;
  font-size: 13px;
}
.event span small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.event > em {
  color: var(--text-2);
  font-size: 12px;
  font-style: normal;
}
.event > i {
  color: var(--green);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  text-align: right;
}
.event.next {
  border-left-color: var(--ink);
  background: var(--raised);
}
.event.next > b,
.event.next > em {
  color: var(--ink);
}
.event:not(.done) > i {
  color: var(--muted);
  font-size: 19px;
}
.language-choice,
.standings-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 12px;
}
.language-choice select,
.standings-filter select {
  min-height: 44px;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--inset);
  color: var(--text);
  font: inherit;
}
.ers-options button { min-height: 32px; }
@media (pointer: coarse) {
  html[lang="en"] #race .commands .segments button,
  .ers-options button { min-height: 44px; }
}
/* English labels need room inside the existing compact cards. */
html[lang="en"] #race .driver header > span:nth-child(2) { min-width: 0; flex: 1; }
html[lang="en"] #race .driver header > strong { flex-shrink: 0; }
@media (max-height: 500px) and (min-width: 601px) {
  html[lang="en"] #race .driver header > span:nth-child(2) { display: block; }
  html[lang="en"] #race .driver header small,
  html[lang="en"] #race .driver header b { white-space: normal; }
  html[lang="en"] #drivers .stat-list p > span { grid-column: 1 / -1; }
  html[lang="en"] #drivers .stat-list i { grid-column: 1; grid-row: 2; }
  html[lang="en"] #drivers .stat-list strong { grid-column: 2; grid-row: 2; }
}
@media (max-width: 700px), (max-height: 500px) {
  html[lang="en"] .stat-list p { grid-template-columns: minmax(0, 1fr) 24px; }
  html[lang="en"] .stat-list i { grid-column: 1 / -1; grid-row: 2; }
  html[lang="en"] .stat-list strong { grid-column: 2; grid-row: 1; }
  html[lang="en"] .staff { flex-wrap: wrap; }
  html[lang="en"] .staff > span { flex: 1 1 160px; min-width: 0; }
}
@media (max-width: 360px) {
  html[lang="en"] #race .commands { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) and (min-height: 501px), (max-width: 600px) {
  html[lang="en"] #race .heading > div:first-child { min-width: 0; flex: 1; }
  html[lang="en"] #race .heading h2,
  html[lang="en"] #race .heading small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html[lang="en"] #race .heading button { flex-shrink: 0; padding-inline: 6px; }
  html[lang="en"] #race .hud-dock button { white-space: normal; line-height: 1.2; }
}
.standings-note,
.standings-incomplete {
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.standings-incomplete {
  padding: 8px;
  background: var(--raised);
  color: var(--text-2);
}
.standing-row {
  display: grid;
  width: 100%;
  min-height: 44px;
  text-align: left;
  grid-template-columns: 28px 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin: 6px 0 0;
  padding: 8px 12px;
}
.standing-row > b {
  color: var(--muted);
  font: 800 17px var(--display);
}
.standing-row > i {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background: var(--rail);
  font: 800 12px var(--display);
}
.standing-row > i .team-logo {
  width: 16px;
  height: 16px;
}
.standing-row span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 600;
}
.standing-row span small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}
.standing-row > strong {
  font: 800 21px var(--display);
  text-align: right;
}
.standing-row.current {
  background: var(--raised);
  box-shadow: inset 3px 0 var(--ink);
}
.standing-row.current > b {
  color: var(--ink);
}
.toast {
  position: fixed;
  right: 26px;
  bottom: 22px;
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 11px 15px;
  border-left: 4px solid var(--cta);
  border-radius: 3px;
  background: var(--raised);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.25s;
}
.toast.show {
  opacity: 1;
  transform: none;
}

/* Team operations and the transfer market. */
.management-wide {
  grid-column: 1 / -1;
}
.management-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}
.management-row > span {
  flex: 1;
  min-width: 0;
}
.management-row b,
.market-driver b {
  display: block;
  font-size: 13px;
}
.management-row small,
.market-driver small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.management-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.management-proposal {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--inset);
}
#management-lock {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--amber);
  background: var(--inset);
  color: var(--text-2);
}
.management-proposal b {
  font-size: 14px;
}
.management-proposal p {
  margin: 6px 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}
.management-proposal small {
  color: var(--muted);
  font-size: 11px;
}
.management-proposal .dialog-actions {
  margin-top: 8px;
}
.management-history p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 11px;
}
.market-driver {
  margin-top: 6px;
  padding: 10px 12px;
}
.market-driver .dialog-actions {
  margin-top: 7px;
}
.engineering-plan article { padding: 12px; margin-block: 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--inset); }
.engineering-plan .dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.engineering-plan button { min-height: 44px; max-width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 3px; background: var(--raised); color: var(--text); font: 600 12px var(--ui); overflow-wrap: anywhere; }
.engineering-plan button:disabled { opacity: 0.5; }
.engineering-plan p { overflow-wrap: anywhere; line-height: 1.6; }
.panel-head > [data-engineering], [data-world-history] { min-height: 44px; }

/* Names lead to the same profiles from news, standings and the market. */
.entity-link {
  display: inline;
  padding: 6px 2px;
  border-radius: 3px;
  background: transparent;
  color: var(--link);
  font: inherit;
  line-height: 2;
  text-align: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.entity-link:hover, .feed-entry:hover, .standing-row:hover {
  background: var(--raised);
}
.feed-entry:focus-visible, .standing-row:focus-visible {
  outline-offset: -2px;
}
.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-block: 16px;
}
.detail-stats > div { padding: 10px; background: var(--inset); border-radius: 3px; }
.detail-stats dt { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.detail-stats dd { margin: 5px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.detail-team-mark { width: 52px; height: 52px; padding: 8px; border-radius: 4px; background: var(--rail); }
.detail-roster { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-bottom: 16px; }
.detail-roster .entity-link { min-height: 44px; text-align: left; }
.entity-detail .dialog-actions button, .market-driver .dialog-actions button, .radio-list > article > button { min-height: 44px; }
.radio-list > article > button { margin-top: 10px; }
.tip [data-radio-history] { margin-top: 8px; }
.driver-comparison { margin-bottom: 16px; }
.driver-comparison table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; text-align: center; }
.driver-comparison caption { margin-bottom: 8px; color: var(--muted); text-align: left; }
.driver-comparison th, .driver-comparison td { padding: 7px 3px; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.driver-comparison th:first-child { width: 16%; }
.driver-comparison small { display: block; margin-top: 4px; color: var(--muted); }
.driver-comparison .better { color: var(--green); }
.driver-comparison .worse { color: var(--red); }
#modal:has(.contract-decision) { width: min(820px, calc(100vw - 32px)); }
.contract-seat { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.contract-seat select { min-width: 0; max-width: 100%; min-height: 44px; padding: 8px; background: var(--inset); color: var(--text); border: 1px solid var(--line); border-radius: 3px; font: inherit; }
.contract-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.contract-options > article { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--inset); overflow-wrap: anywhere; }
.contract-options h3 { margin: 0; font-size: 16px; }
.contract-options dl { margin: 12px 0; }
.contract-options dl > div { margin-block: 10px; }
.contract-options dt { color: var(--muted); font-size: 12px; }
.contract-options dd { margin: 4px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.contract-options button, [data-contract-plan] { min-height: 44px; }
.cash-shortfall { color: var(--amber); }
@media (max-width: 600px) {
  .contract-options { grid-template-columns: minmax(0, 1fr); }
  .contract-options dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .contract-options dl > div { margin: 0; }
  .contract-options button { width: 100%; }
}
.profile-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.profile-tabs button { flex: 1; min-height: 44px; }
.profile-tabs [aria-pressed="true"] { background: var(--raised); border-color: var(--link); color: var(--link); }
.career-filter { display: flex; align-items: center; gap: 12px; }
.career-filter select { min-height: 44px; flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 3px; padding: 8px; background: var(--inset); color: var(--text); font: inherit; }
.career-filter select:focus-visible { outline: 2px solid var(--focus); }
.career-summary, .career-empty { padding: 10px; border-left: 3px solid var(--link); background: var(--inset); }
.career-trend { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.career-trend button { min-height: 118px; min-width: 0; padding: 8px 2px; background: var(--inset); border: 1px solid var(--line); border-radius: 3px; }
.career-trend button:hover, .career-race:hover { background: var(--raised); }
.career-trend b, .career-trend small { display: block; font-size: 11px; }
.career-trend small { margin-top: 3px; color: var(--muted); }
.career-bars { display: flex; justify-content: center; align-items: flex-end; height: 64px; gap: 4px; margin-bottom: 6px; }
.career-bars i { width: 8px; min-height: 3px; background: var(--muted); border-radius: 2px 2px 0 0; }
.career-bars i.finished { background: var(--link); }
.career-bars i.retired, .career-bars i.dsq { background: var(--red); }
.career-races { display: grid; gap: 6px; }
.career-race { display: grid; grid-template-columns: minmax(0, 1fr) 42px 42px 36px; align-items: center; gap: 4px; min-height: 60px; padding: 8px; background: var(--inset); text-align: left; border-radius: 3px; font-size: 12px; }
.career-race > span { min-width: 0; overflow-wrap: anywhere; }
.career-race > span:not(:first-child) { color: var(--muted); font-size: 11px; text-align: center; }
.career-race b { display: block; margin-top: 4px; color: var(--text); font-size: 13px; }
.career-race small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.archive-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.archive-list > div { padding: 8px; border-radius: 3px; background: var(--inset); overflow-wrap: anywhere; }
.archive-list .entity-link { min-height: 44px; display: inline-block; }
.archive-list small { display: block; color: var(--muted); }
.team-contributions { margin-bottom: 16px; }
.team-contributions > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-soft); }
.team-contributions > div > span { white-space: nowrap; color: var(--muted); font-size: 12px; }
.race-field { display: grid; gap: 4px; }
.race-field > div { display: grid; grid-template-columns: 34px minmax(0, 1fr) 40px; align-items: center; gap: 2px 8px; padding: 4px 8px; background: var(--inset); border-radius: 3px; }
.race-field .entity-link { text-align: left; }
.race-field small { grid-column: 2; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.race-field strong { grid-column: 3; grid-row: 1 / 3; text-align: right; font-size: 12px; }
.race-field > div > b { grid-row: 1 / 3; font-size: 12px; }
@media (max-width: 400px) {
  .detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .career-trend { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Championship ceremonies and the archive share the existing dialog navigation. */
.honor-entry { width: calc(100% - 24px); margin: 12px; min-height: 44px; }
.honor-ceremony { padding: 24px 12px 0; margin-bottom: 20px; text-align: center; border: 1px solid var(--line); border-radius: 8px; background: radial-gradient(ellipse at 50% 0%, #d5ad4a26, transparent 68%), var(--inset); overflow: hidden; }
.honor-ceremony > small { letter-spacing: 2px; color: var(--muted); }
.honor-ceremony h3 { font-size: 22px; margin: 8px 0 24px; }
.honor-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; }
.honor-place { min-width: 0; display: flex; flex-direction: column; align-items: center; --medal: #bfccd8; }
.honor-place.place-1 { --medal: #d9b34f; }
.honor-place.place-3 { --medal: #b58360; }
.honor-trophy { width: 42px; height: 42px; fill: currentColor; color: var(--medal, #d9b34f); flex-shrink: 0; }
.honor-place.place-1 .honor-trophy { width: 56px; height: 56px; }
.honor-place strong, .honor-place > small { display: block; width: 100%; overflow-wrap: anywhere; }
.honor-place strong { margin-top: 8px; min-height: 44px; }
.honor-place .entity-link { color: var(--text); min-height: 44px; white-space: normal; overflow-wrap: anywhere; }
.honor-place > small { color: var(--text-2); font-size: 11px; min-height: 36px; }
.honor-step { display: flex; flex-direction: column; width: 100%; height: 96px; padding-top: 12px; margin-top: 8px; border-top: 3px solid var(--medal); background: linear-gradient(#c0c6d41c, #c0c6d408); }
.place-1 .honor-step { height: 126px; background: linear-gradient(#d9b34f30, #d9b34f08); }
.place-3 .honor-step { height: 76px; }
.honor-step b { font: 800 32px var(--display); color: var(--medal); }
.honor-step span { margin-top: 4px; font-size: 12px; color: var(--text-2); }
.honor-filters, .honor-champions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 16px 0; }
.honor-filters label { min-width: 0; display: grid; gap: 6px; color: var(--text-2); }
.honor-filters select { width: 100%; min-height: 44px; padding: 8px; background: var(--inset); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.honor-champions article { min-width: 0; padding: 16px; border: 1px solid #cda95475; border-radius: 6px; background: linear-gradient(135deg, #cda95419, transparent), var(--inset); overflow-wrap: anywhere; }
.honor-champions small { display: block; margin-top: 8px; color: var(--text-2); }
.honor-champions h3 { margin: 8px 0; }
.honor-champions .entity-link { white-space: normal; overflow-wrap: anywhere; }
.honor-pending { padding: 12px; border-left: 3px solid var(--line); background: var(--inset); color: var(--text-2); }
.honor-races { display: grid; gap: 8px; }
.honor-races button { padding: 12px; min-height: 64px; text-align: left; white-space: normal; }
.honor-races b, .honor-races span { display: block; overflow-wrap: anywhere; }
.honor-races span { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.6; }
@media (max-width: 480px) {
  .honor-filters, .honor-champions { grid-template-columns: minmax(0, 1fr); }
  .honor-ceremony { padding: 18px 6px 0; }
  .honor-podium { gap: 5px; }
  .honor-place strong { font-size: 12px; min-height: 64px; }
  .honor-place > small { font-size: 10px; min-height: 44px; }
}

.honors-room .detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

html[data-theme="light"] .honor-place { --medal: #596779; }
html[data-theme="light"] .honor-place.place-1 { --medal: #8b650b; }
html[data-theme="light"] .honor-place.place-3 { --medal: #875333; }
html[data-theme="light"] .honor-champions .honor-trophy { color: #8b650b; }
