.mode-buttons {display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:18px}
.mode-buttons button,#race button {cursor:pointer;font:700 14px/1.2 system-ui,sans-serif;color:#181d23;background:#ffe287;border:0;border-radius:4px;padding:12px 16px}
.mode-buttons button + button {background:#9be0da}
.mode-buttons kbd {font:inherit;opacity:.65;margin-left:.6em}
.racing .hud, .racing #hurt, .racing #run-screen, .racing #run-card { display: none !important; }
#race {
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  color: #fff; font: 700 16px/1.1 Silkscreen, monospace;
  --ink: #0b0d12;
  --gold: #ffd23f;
  --inset: clamp(10px, 1.75vw, 26px);
  --outline: -2px -2px #0b0d12, 0 -2px #0b0d12, 2px -2px #0b0d12,
    -2px 0 #0b0d12, 2px 0 #0b0d12, -2px 2px #0b0d12, 0 2px #0b0d12, 2px 2px #0b0d12;
}
#race button { pointer-events: auto; }
.race-panes { display: flex; height: 100%; }
.race-pane {
  position: relative; flex: 0 0 50%; min-width: 0; box-sizing: border-box;
  display: flex; flex-direction: column; justify-content: space-between;
  text-shadow: var(--outline);
}
.race-pane + .race-pane { border-left: 4px solid var(--ink); }
.race-pane header, .race-pane footer {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; padding: var(--inset);
}
.driver-tag { display: flex; align-items: center; gap: 8px; min-width: 0; }
.driver-tag strong {
  display: grid; place-items: center; flex: none; padding: 3px 4px;
  color: var(--ink); background: var(--team); border: 3px solid var(--ink);
  text-shadow: none; font-size: clamp(16px, 1.6vw, 25px);
}
.driver-tag small, .race-timing small, .speedo small, .race-message small, .road-map small {
  display: block; font-size: clamp(10px, .84vw, 13px); line-height: 1.1;
}
.driver-tag small { color: var(--team); }
.driver-tag b { display: block; font-size: clamp(14px, 1.45vw, 23px); }
.race-timing { flex: none; text-align: right; }
.race-timing b { font-size: clamp(18px, 1.9vw, 30px); line-height: 1; }
.race-timing small { margin-top: 3px; color: var(--gold); }
.gate-nav {
  position: absolute; top: clamp(54px, 5.4vw, 84px); left: var(--inset);
  display: flex; align-items: center; gap: 7px; color: var(--gold);
  font-size: clamp(12px, 1vw, 16px);
}
.gate-nav i {
  display: grid; place-items: center; width: 20px; height: 20px; font-size: 0;
  background: var(--ink); border: 2px solid var(--ink);
}
.gate-nav i::after {
  content: ''; width: 16px; height: 16px; background: var(--gold);
  clip-path: polygon(37.5% 0,62.5% 0,62.5% 12.5%,75% 12.5%,75% 25%,87.5% 25%,87.5% 37.5%,100% 37.5%,100% 50%,62.5% 50%,62.5% 100%,37.5% 100%,37.5% 50%,0 50%,0 37.5%,12.5% 37.5%,12.5% 25%,25% 25%,25% 12.5%,37.5% 12.5%);
}
.gate-nav i[hidden] { display: none; }
.race-pane footer { align-items: flex-end; padding-bottom: max(34px, var(--inset)); }
.road-map {
  width: clamp(108px, 11vw, 156px); max-width: 56%; background: var(--ink); border: 3px solid var(--ink);
  box-shadow: 0 0 0 2px #60646a; text-shadow: none;
}
.road-map canvas { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.road-map small {
  padding: 4px 5px 3px; border-top: 2px solid var(--team); color: #fff;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.speedo { text-align: right; }
.speedo b { display: block; color: #74df79; font-size: clamp(28px, 3.8vw, 58px); line-height: .9; }
.speedo small { margin-top: 4px; }
#race .race-exit {
  position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%);
  padding: 4px 8px; border: 2px solid var(--ink); border-radius: 0;
  color: #fff; background: #23262c; font: 700 12px/1.1 Silkscreen, monospace;
}
#race .race-exit:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.race-message {
  position: absolute; left: 50%; top: 29%; transform: translateX(-50%); text-align: center;
  font-size: clamp(38px, 6vw, 88px); color: var(--gold); text-shadow: var(--outline); white-space: nowrap;
}
.race-message small { background: var(--ink); color: #fff; padding: 5px 10px; text-shadow: none; }
.race-message strong { display: block; margin: 3px 0; line-height: 1; }
.start-lamps { display: inline-flex; gap: 4px; padding: 4px; background: var(--ink); vertical-align: top; }
.start-lamps i { width: 12px; height: 12px; background: #454750; }
.start-lamps i.lit { background: #ff454b; }
.apb {
  position: absolute; right: var(--inset); bottom: clamp(104px, 11vw, 160px);
  max-width: 47%; font-size: clamp(11px, .95vw, 15px); text-align: right; color: var(--gold);
}
.apb small { display: block; color: #fff; font-size: clamp(9px, .78vw, 12px); line-height: 1.25; margin-top: 4px; }
.apb progress { display: block; width: 100%; height: 8px; margin-top: 5px; background: #22252a; border: 2px solid var(--ink); border-radius: 0; appearance: none; }
.apb progress::-webkit-progress-bar { background: #22252a; }
.apb progress::-webkit-progress-value { background: #f04e50; }
.apb progress::-moz-progress-bar { background: #f04e50; }
.apb progress[hidden], .apb small:empty { display: none; }
@media (max-width: 760px) {
  #race { --inset: 10px; }
  .driver-tag { gap: 4px; }
  .driver-tag small { display: none; }
  .race-timing small { font-size: 9px; }
  .gate-nav { top: 49px; }
  .apb { bottom: 92px; }
}
@media (orientation: portrait) {
  .race-panes { flex-direction: column; }
  .race-pane { min-height: 0; }
  .race-pane + .race-pane { border-left: 0; border-top: 4px solid var(--ink); }
  .race-pane footer { padding-bottom: var(--inset); }
  .road-map { width: clamp(105px, 27vw, 145px); }
  .apb { bottom: 70px; }
  .race-message { top: 50%; transform: translate(-50%, -50%); }
  #race .race-exit { bottom: auto; top: 50%; transform: translate(-50%, -50%); }
  #race:has(.race-message:not(:empty)) .race-exit { top: auto; bottom: 4px; transform: translateX(-50%); }
}
@media (orientation: landscape) and (max-height: 440px) {
  #race { --inset: 8px; }
  .road-map { width: 106px; }
  .race-pane footer { padding-bottom: 8px; }
  .apb { bottom: 62px; }
  .race-message { top: 25%; }
}
