:root {
  color-scheme: dark;
  --paper: #f3f0e9;
  --muted: #bbbcc5;
  --ink: #151820;
  --orange: #ff8056;
  --ice: #91f0e6;
  --amber: #ffc074;
  --line: #ffffff38;
  --sans: 'Roboto', 'Arial', sans-serif;
  --display: 'Roboto', 'Arial', sans-serif;
  --mono: 'IBM Plex Mono', 'Consolas', 'Courier New', monospace;
  --gutter: clamp(22px, 4.8vw, 92px);
  --mast-height: clamp(56px, 9vh, 88px);
  font-family: var(--sans);
  color: var(--paper);
  background: #262837;
}
* {
  box-sizing: border-box;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  position: relative;
  isolation: isolate;
  touch-action: none;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
#view,
.shade,
.grid-screen,
#race,
#result {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#view {
  display: block;
  background: linear-gradient(#202436, #817782 63%, #393a44 64%);
}
.shade {
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      rgba(12, 15, 23, 0.9) 0%,
      rgba(15, 18, 27, 0.66) 27%,
      rgba(14, 17, 25, 0.1) 57%,
      transparent 82%
    ),
    linear-gradient(0deg, #10131dbe, transparent 24%, transparent 83%, #10131b7a);
}
.mast {
  position: absolute;
  z-index: 5;
  top: max(0px, env(safe-area-inset-top));
  left: max(var(--gutter), env(safe-area-inset-left));
  right: max(var(--gutter), env(safe-area-inset-right));
  height: var(--mast-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
  font: italic 900 clamp(16px, 1.5vw, 24px) / 1 var(--display);
  letter-spacing: -0.07em;
}
.wordmark em {
  color: var(--orange);
}
.stripes {
  position: relative;
  display: inline-block;
  transform: skewX(-24deg);
  width: 29px;
  height: 17px;
  border-left: 7px solid var(--orange);
  border-right: 7px solid var(--orange);
}
.stripes:after {
  content: '';
  position: absolute;
  inset: 0 4px;
  background: var(--orange);
}
.mast nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
#fps {
  margin-left: auto;
  margin-right: 10px;
  padding: 2px 7px;
  min-width: 9ch;
  border-radius: 2px;
  background: #131823db;
  color: var(--ice);
  font: 600 12px/1.5 var(--mono);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}
.quiet {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid #fff4;
  background: #15182182;
  border-radius: 2px;
  height: 33px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.015em;
}
.quiet:hover {
  border-color: var(--paper);
  background: #242733;
}
.levels {
  height: 13px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.levels i {
  width: 2px;
  height: 6px;
  background: var(--orange);
}
.levels i:nth-child(2) {
  height: 12px;
}
.levels i:nth-child(3) {
  height: 9px;
}
.levels i:nth-child(4) {
  height: 4px;
}
[aria-pressed='true'] .levels i {
  height: 2px;
  background: var(--muted);
}
.restart-icon {
  font-size: 19px;
  line-height: 1;
}
.grid-screen {
  pointer-events: none;
}
.grid-screen button,
.grid-footer {
  pointer-events: auto;
}
.brief {
  position: absolute;
  left: max(var(--gutter), env(safe-area-inset-left));
  top: 48.4%;
  transform: translateY(-50%);
  max-width: 48%;
}
.eyebrow,
.brief small,
.car-caption small,
.result-card small,
.instruments small {
  font: 600 11px/1.35 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #e6e2df;
}
.eyebrow span,
.car-caption small span {
  color: var(--orange);
}
.signal-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--orange);
  border-radius: 50%;
  box-shadow: 0 0 10px #fd774957;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font: italic 900 clamp(66px, 7.05vw, 138px) / 0.91 var(--display);
  letter-spacing: -0.055em;
  margin: 23px 0 30px -0.045em;
}
h1 em {
  color: var(--orange);
  font-style: inherit;
}
.specs,
.result-stats {
  display: flex;
  align-items: center;
  gap: 24px;
}
.specs > div + div,
.result-stats > div + div {
  border-left: 1px solid var(--line);
  padding-left: 24px;
}
.specs small,
.result-stats small,
.result-card > small,
.car-caption small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.13em;
}
.specs strong {
  display: block;
  font-size: 18px;
  font-weight: 600;
  margin-top: 4px;
}
.specs b {
  font-weight: 400;
  font-size: 0.82em;
}
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 38px;
  margin-top: 30px;
  padding: 0 19px;
  height: 48px;
  min-width: 182px;
  border: 0;
  border-radius: 2px;
  background: var(--orange);
  color: #1b1719;
  font-size: 15px;
  font-weight: 750;
  box-shadow: 0 4px 24px #120b071f;
}
.primary span {
  font-family: Arial, sans-serif;
  font-size: 22px;
  font-weight: 400;
}
.primary:hover {
  background: #ff9b76;
}
.primary:disabled {
  cursor: wait;
  opacity: 0.75;
}
#launch-hint,
#problem {
  font-size: 12px;
  line-height: 1.45;
  margin-top: 12px;
  color: #d2d0d6;
}
#problem {
  color: #ffbc9f;
  max-width: 330px;
}
.car-caption {
  position: absolute;
  right: var(--gutter);
  bottom: 19%;
  text-align: right;
  text-shadow: 0 2px 11px #101018;
}
.car-caption small b {
  color: var(--paper);
  font-weight: 600;
}
#car-choices {
  display: inline-flex;
  pointer-events: auto;
  padding: 3px;
  margin: 10px 0 0;
  border: 1px solid #c1c6cc73;
  border-radius: 3px;
  background: #151923ed;
}
#car-choices label {
  position: relative;
  cursor: pointer;
}
#car-choices input {
  position: absolute;
  opacity: 0;
}
#car-choices span {
  display: block;
  padding: 10px 14px;
  font: 600 12px/1.2 var(--mono);
  color: #e6e2df;
  text-shadow: none;
}
#car-choices input:checked + span {
  background: var(--orange);
  color: var(--ink);
}
#car-choices input:focus-visible + span {
  outline: 2px solid var(--ice);
  outline-offset: -2px;
}
.paint-controls {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  font: 600 12px var(--mono);
}
.paint-controls label,
.paint-controls button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #c1c6cc73;
  border-radius: 3px;
  background: #151923ed;
  color: var(--paper);
  font: inherit;
  text-shadow: none;
  cursor: pointer;
  pointer-events: auto;
}
.paint-controls input {
  width: 30px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.paint-controls button:disabled {
  color: var(--muted);
  cursor: default;
}
@media (pointer: coarse) {
  .paint-controls label, .paint-controls button { min-height: 44px; }
}
.car-caption strong {
  display: block;
  font: italic 700 clamp(19px, 2vw, 34px) / 1.2 var(--display);
  letter-spacing: -0.045em;
  margin-top: 4px;
}
.grid-footer {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: max(0px, env(safe-area-inset-bottom));
  height: clamp(64px, 10vh, 96px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.keys,
.keys > span,
.record,
.touch-guide {
  display: flex;
  align-items: center;
}
.keys {
  gap: 25px;
}
.keys > span {
  font-size: 12px;
  color: #dbd9de;
  gap: 4px;
}
kbd {
  border: 1px solid #fffb;
  border-bottom-color: #fff5;
  border-radius: 3px;
  font: 11px/20px var(--mono);
  text-align: center;
  min-width: 22px;
  background: #27293488;
}
kbd:last-of-type {
  margin-right: 4px;
}
.record {
  gap: 8px;
  color: #d0cfd5;
  font-size: 12px;
}
.record strong {
  font: 600 13px var(--mono);
  color: var(--paper);
}
.clock-icon {
  width: 12px;
  height: 12px;
  border: 1px solid var(--orange);
  border-radius: 50%;
  position: relative;
}
.clock-icon:after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 3px;
  height: 4px;
  border-left: 1px solid var(--orange);
  border-bottom: 1px solid var(--orange);
}
.touch-guide {
  display: none;
  color: #dedce0;
  font-size: 11px;
  gap: 8px;
}
.touch-guide span {
  color: var(--orange);
}
body:not([data-phase='grid']) .shade {
  background: linear-gradient(0deg, #10151e80, transparent 22%, transparent 78%, #10131d7a);
}
body:not([data-phase='grid']) {
  --mast-height: clamp(41px, 7vh, 62px);
}
#race {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  align-items: start;
  column-gap: 12px;
  padding-top: calc(env(safe-area-inset-top) + var(--mast-height) + var(--hud-gap, clamp(8px, 2vh, 20px)));
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  pointer-events: none;
}
.timing {
  grid-area: 1 / 1;
  width: clamp(180px, 18vw, 268px);
  max-width: 100%;
  filter: drop-shadow(0 2px 5px #111522);
}
.timing .eyebrow {
  font-size: 9px;
}
.timing time {
  display: block;
  font: 500 clamp(25px, 2.6vw, 42px) / 1.4 var(--mono);
  letter-spacing: -0.075em;
  font-variant-numeric: tabular-nums;
}
.stage-progress {
  height: 3px;
  background: #e1eaf052;
}
.stage-progress i {
  display: block;
  transform: scaleX(0);
  transform-origin: left;
  height: 100%;
  background: var(--orange);
}
.timing-meta,
.tach-meta {
  display: flex;
  justify-content: space-between;
  font: 10px/2 var(--mono);
  color: #e0dfe5;
}
.timing-meta b {
  color: var(--paper);
  font-weight: 500;
}
.start-lights {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 7px;
  text-shadow: 0 2px 12px #111;
}
#lights {
  display: flex;
  gap: 5px;
  padding: 6px 7px;
  background: #151822dd;
  border: 1px solid #fff4;
}
#lights i {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #55434a;
}
#lights i.red {
  background: #ff705c;
  box-shadow: 0 0 12px #fe4d4660;
}
#lights i.green {
  background: var(--ice);
  box-shadow: 0 0 12px #6cfae670;
}
#signal,
.notice {
  font: 700 12px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.notice {
  position: absolute;
  top: 37%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  text-shadow: 0 1px 6px #000;
  color: var(--amber);
}
.dash {
  grid-area: 1 / 2;
  width: clamp(228px, 22vw, 335px);
  padding: 13px 17px 9px;
  background: linear-gradient(108deg, #111923ed, #14232bdd);
  border: 1px solid #a6c5c15c;
  border-top: 2px solid #a6c5c189;
  border-radius: 3px;
  box-shadow: 0 5px 30px #060a0e30;
}
.instruments {
  display: flex;
  align-items: flex-start;
  gap: 17px;
}
.instruments small {
  font-size: 9px;
  color: #a6c3c5;
  display: block;
}
.instruments small span {
  font-size: 8px;
  color: var(--ice);
  letter-spacing: 0;
}
.gear-block {
  min-width: 42px;
  border-right: 1px solid #9abdbd40;
}
.gear-readout {
  height: 38px;
  padding-top: 2px;
  font: italic 600 32px/1 var(--mono);
  color: var(--amber);
}
.speed-readout {
  display: flex;
  gap: 4px;
  height: 39px;
  align-items: center;
}
.digit {
  display: inline-block;
  position: relative;
  width: 18px;
  height: 29px;
  transform: skewX(-6deg);
  color: var(--ice);
}
.digit i {
  position: absolute;
  background: currentColor;
  opacity: 0.085;
}
.digit i.lit {
  opacity: 1;
  filter: drop-shadow(0 0 2px #75eddf82);
}
.digit i:nth-child(1),
.digit i:nth-child(4),
.digit i:nth-child(7) {
  left: 2px;
  right: 2px;
  height: 3px;
  clip-path: polygon(10% 0, 90% 0, 100% 50%, 90% 100%, 10% 100%, 0 50%);
}
.digit i:nth-child(1) {
  top: 0;
}
.digit i:nth-child(4) {
  bottom: 0;
}
.digit i:nth-child(7) {
  top: 13px;
}
.digit i:nth-child(2),
.digit i:nth-child(3),
.digit i:nth-child(5),
.digit i:nth-child(6) {
  width: 3px;
  height: 12px;
  clip-path: polygon(50% 0, 100% 12%, 100% 85%, 50% 100%, 0 85%, 0 12%);
}
.digit i:nth-child(2),
.digit i:nth-child(3) {
  right: 0;
}
.digit i:nth-child(5),
.digit i:nth-child(6) {
  left: 0;
}
.digit i:nth-child(2),
.digit i:nth-child(6) {
  top: 2px;
}
.digit i:nth-child(3),
.digit i:nth-child(5) {
  bottom: 2px;
}
.shift-block {
  margin-left: auto;
  text-align: right;
}
#shift-light {
  display: inline-block;
  width: 18px;
  height: 6px;
  margin-top: 10px;
  border: 1px solid #685a4e;
  background: #362f29;
  border-radius: 2px;
}
#shift-light.lit {
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
}
.tach {
  display: flex;
  height: 12px;
  gap: 2px;
  margin: 6px 0 3px;
}
.tach i {
  position: relative;
  flex: 1;
  background: #6fa59f38;
  border-radius: 1px;
}
.tach i.on {
  background: var(--ice);
}
.tach i.hot {
  background: #664239;
}
.tach i.hot.on {
  background: var(--orange);
}
.tach i.band:after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 2px;
  background: var(--amber);
}
.tach-meta {
  font-size: 9px;
  color: #a2bcbf;
}
.tach-meta span i {
  display: inline-block;
  width: 7px;
  height: 2px;
  background: var(--amber);
  vertical-align: middle;
}
.tach-meta strong {
  font-weight: 500;
  color: var(--ice);
}
.boost {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--amber);
  font: 600 10px/1.25 var(--mono);
}
.boost span {
  text-transform: uppercase;
  letter-spacing: .1em;
}
#boost-meter {
  flex: 1;
  height: 5px;
  background: #574439;
}
#boost-meter i {
  display: block;
  height: 100%;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left;
}
#steer-zone,
#pedals {
  display: none;
}
#result {
  z-index: 4;
  display: grid;
  place-items: center;
  background: #10141dc9;
}
.result-card {
  width: min(430px, 90vw);
  padding: 30px 34px;
  background: #191e29ef;
  border: 1px solid #bbc4d153;
  border-top: 3px solid var(--orange);
}
.flag {
  width: 19px;
  height: 13px;
  background: repeating-conic-gradient(#e8ded8 0 25%, #494657 0 50%) 0/8px 8px;
}
.result-card h2 {
  font: italic 850 44px/1 var(--display);
  letter-spacing: -0.07em;
  margin: 18px 0 26px;
}
.result-card time {
  display: block;
  font: 500 44px/1.3 var(--mono);
  letter-spacing: -0.08em;
  color: var(--ice);
}
.result-stats {
  margin-top: 16px;
}
.result-stats strong {
  display: block;
  font: 15px/1.8 var(--mono);
}
#finish-note {
  font: 11px/1.5 var(--mono);
  color: var(--amber);
  margin-top: 10px;
}
@media (pointer: coarse), (any-pointer: coarse) {
  .keys {
    display: none;
  }
  .touch-guide {
    display: flex;
  }
  #steer-zone {
    display: block;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 50%;
    pointer-events: auto;
    touch-action: none;
  }
  #steer-cue {
    position: absolute;
    bottom: max(20px, env(safe-area-inset-bottom));
    left: 30%;
    color: #cde9e3b8;
    font: 18px var(--mono);
  }
  #steer-cue span {
    font: 9px var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
  }
  #pedals {
    --pedal-inset: max(17px, env(safe-area-inset-left));
    display: grid;
    width: min(190px, calc(50% - var(--pedal-inset) - 2px));
    grid-template-columns: minmax(0, 10fr) minmax(0, 13fr);
    gap: 6px;
    position: absolute;
    left: var(--pedal-inset);
    bottom: max(14px, env(safe-area-inset-bottom));
    pointer-events: auto;
    touch-action: none;
  }
  #pedals button {
    height: 46px;
    background: #15202970;
    border: 1px solid #dbe2e575;
    border-radius: 4px;
    color: #e0e9ee;
    font-size: 13px;
    touch-action: none;
  }
  #pedals button:nth-child(n + 3) {
    height: 60px;
  }
  #pedals button[data-action='throttle'] {
    border-color: #94dace99;
    color: #bdede4;
  }
  #pedals button.active {
    background: #4c697caa;
    border-color: var(--ice);
    color: white;
  }
}
@media (max-width: 700px) {
  .quiet {
    padding: 0 9px;
  }
  .mast nav {
    gap: 5px;
  }
  .keys {
    gap: 10px;
  }
  .specs,
  .result-stats {
    gap: 15px;
  }
  .specs > div + div,
  .result-stats > div + div {
    padding-left: 15px;
  }
}
@media (max-width: 480px) {
  .mast {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
  }
  .wordmark {
    gap: 7px;
  }
  .quiet {
    white-space: nowrap;
    padding: 0 7px;
    font-size: 11px;
  }
  #sound-label,
  .restart-label {
    display: none;
  }
  #mute,
  #restart {
    min-width: 33px;
  }
  #fps {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    margin: 0;
  }
  #race {
    --hud-gap: 32px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    column-gap: 8px;
  }
  .start-lights,
  .notice {
    position: static;
    grid-column: 1 / -1;
    transform: none;
    margin-top: 10px;
  }
}
@media (max-aspect-ratio: 6/5) {
  .shade {
    background: linear-gradient(0deg, #131721fa 0%, #151924ee 32%, #171b24a3 48%, transparent 70%, #17192385);
  }
  .brief {
    top: auto;
    bottom: 12%;
    transform: none;
    max-width: 94%;
  }
  h1 {
    font-size: clamp(54px, 12vw, 93px);
    margin: 14px 0 16px;
  }
  h1 br {
    display: none;
  }
  h1 em:before {
    content: ' ';
  }
  .grid-footer {
    height: 8.5%;
  }
  .car-caption {
    right: var(--gutter);
    top: 17%;
    bottom: auto;
  }
  .car-caption strong {
    font-size: 18px;
  }
  .primary {
    margin-top: 19px;
    height: 43px;
  }
  .specs strong {
    font-size: 15px;
  }
  .grid-footer .record {
    display: none;
  }
  .touch-guide {
    flex-wrap: wrap;
  }
  .dash {
    width: clamp(155px, 48vw, 199px);
    padding: 8px 10px 6px;
  }
  .instruments {
    gap: 9px;
  }
}
.timing .eyebrow {
  white-space: nowrap;
  gap: 6px;
  letter-spacing: 0.085em;
}
@media (max-width: 420px) {
  .instruments {
    gap: 6px;
  }
  .gear-block {
    min-width: 30px;
  }
  .instruments small,
  .timing .eyebrow {
    font-size: 8px;
  }
  .timing .eyebrow {
    white-space: normal;
    gap: 4px;
  }
  .timing-meta {
    flex-wrap: wrap;
    column-gap: 6px;
  }
}
@media (max-height: 550px) and (min-aspect-ratio: 1/1) {
  :root {
    --gutter: 4vw;
    --mast-height: 42px;
  }
  .brief {
    top: 50%;
  }
  h1 {
    font-size: clamp(45px, 11vh, 66px);
    margin: 10px 0 13px;
  }
  .eyebrow,
  .brief small {
    font-size: 9px;
  }
  .specs strong {
    font-size: 14px;
  }
  .primary {
    margin-top: 13px;
    height: 33px;
    min-width: 145px;
    font-size: 13px;
  }
  #launch-hint,
  #problem {
    font-size: 10px;
    margin-top: 6px;
  }
  .grid-footer {
    height: 38px;
  }
  .car-caption {
    bottom: 18%;
  }
  .quiet {
    height: 27px;
    font-size: 10px;
  }
  .timing {
    width: 155px;
  }
  .timing time {
    font-size: 23px;
  }
  .dash {
    width: 178px;
    padding: 6px 9px 4px;
  }
  .instruments {
    gap: 9px;
  }
  .instruments small,
  .tach-meta,
  .timing-meta {
    font-size: 8px;
  }
  .gear-readout,
  .speed-readout {
    height: 28px;
  }
  .gear-readout {
    font-size: 24px;
  }
  .digit {
    transform: scale(0.78) skewX(-6deg);
    margin-right: -3px;
  }
  .tach {
    height: 7px;
    margin: 3px 0;
  }
  .gear-block {
    min-width: 30px;
  }
  .start-lights {
    top: 19%;
  }
  .result-card {
    padding: 15px 24px;
  }
  .result-card h2 {
    margin: 10px 0;
    font-size: 32px;
  }
  .result-card time {
    font-size: 32px;
  }
  .result-stats {
    margin-top: 7px;
  }
}
