:root {
  color-scheme: dark;
  --ink: #05090f;
  --panel: rgba(4, 11, 17, .94);
  --teal: #58f5e3;
  --cyan: #77dfff;
  --amber: #ffb34e;
  --red: #ff4562;
  --green: #8cff9d;
  --text: #eafffd;
  --muted: #89a9ae;
  --touch-opacity: .78;
  font-family: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Consolas, monospace;
  background: #020509;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 50% 30%, #141126 0, #05090e 52%, #020407 100%);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid rgba(112, 226, 220, .38);
  border-radius: 2px;
  color: var(--text);
  background: linear-gradient(90deg, rgba(14, 33, 41, .96), rgba(8, 19, 27, .96));
  min-height: 42px;
  padding: 9px 15px;
  letter-spacing: .11em;
  text-align: left;
  cursor: pointer;
  transition: border-color .12s ease, color .12s ease, transform .12s ease, background .12s ease;
}

button:hover,
button:focus-visible {
  outline: none;
  border-color: var(--teal);
  color: #fff;
  background: linear-gradient(90deg, rgba(21, 64, 67, .98), rgba(8, 27, 34, .98));
  transform: translateX(3px);
}

button:active {
  transform: translateX(3px) scale(.985);
}

button:disabled {
  cursor: not-allowed;
  opacity: .42;
  filter: saturate(.35);
}

button:disabled:hover,
button:disabled:focus-visible {
  border-color: rgba(112, 226, 220, .38);
  color: var(--text);
  background: linear-gradient(90deg, rgba(14, 33, 41, .96), rgba(8, 19, 27, .96));
  transform: none;
}

button.primary {
  color: #061210;
  border-color: #8ffff2;
  background: linear-gradient(90deg, #73f9e7, #3ac2ba);
  font-weight: 900;
}

button.primary:hover,
button.primary:focus-visible {
  background: linear-gradient(90deg, #b5fff6, #60e8dc);
  color: #020707;
}

button.danger {
  border-color: #ff5267;
  color: #fff;
  background: linear-gradient(90deg, #bd2842, #711b31);
}

.game-root {
  position: relative;
  width: min(100vw, calc(100vh * .6));
  height: min(100vh, calc(100vw * 1.6666667));
  margin: auto;
  top: 50%;
  transform: translateY(-50%);
  overflow: hidden;
  background: #04080d;
  box-shadow: 0 0 0 1px rgba(104, 255, 238, .25), 0 25px 100px rgba(0, 0, 0, .78), 0 0 70px rgba(33, 208, 199, .08);
  isolation: isolate;
}

.game-root::before {
  content: "";
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(139, 255, 246, .22);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, .5);
}

#game-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.ui-layer {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: none;
  pointer-events: none;
}

.ui-layer.is-visible {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 4vw, 28px);
  pointer-events: auto;
  background: rgba(1, 5, 9, .28);
  backdrop-filter: blur(1px);
}

.ui-layer.menu-ui {
  align-items: stretch;
  justify-content: flex-start;
  background: transparent;
  backdrop-filter: none;
  padding: 0;
}

.title-screen {
  width: 100%;
  padding: clamp(42px, 10vh, 78px) clamp(28px, 9vw, 54px) 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.title-kicker,
.panel__eyebrow {
  color: var(--red);
  font-size: clamp(8px, 2.15vw, 11px);
  font-weight: 900;
  letter-spacing: .24em;
  text-transform: uppercase;
}

.title-screen h1 {
  margin: 9px 0 0;
  line-height: .82;
  letter-spacing: -.07em;
  filter: drop-shadow(0 0 16px rgba(76, 255, 232, .18));
}

.title-screen h1 span,
.title-screen h1 strong {
  display: block;
}

.title-screen h1 span {
  color: #fff;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(48px, 14vw, 74px);
  font-style: italic;
  font-weight: 900;
}

.title-screen h1 strong {
  color: var(--teal);
  font-size: clamp(20px, 6.5vw, 34px);
  letter-spacing: .34em;
  margin-left: 3px;
  margin-top: 9px;
}

.title-subtitle {
  margin: 16px 0 0;
  color: #a9c4c7;
  font-size: clamp(9px, 2.5vw, 12px);
  letter-spacing: .05em;
}

.menu-stack {
  display: grid;
  gap: 7px;
  width: min(280px, 78%);
  margin-top: auto;
  margin-bottom: 36px;
}

.menu-stack.compact {
  width: 100%;
  margin: 22px 0 0;
}

.menu-stack button {
  position: relative;
  padding-left: 23px;
  font-size: clamp(10px, 3vw, 13px);
}

.menu-stack button::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 5px;
  height: 5px;
  border: 1px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.high-score {
  color: #fff3d6;
  font-size: clamp(8px, 2.2vw, 11px);
  letter-spacing: .16em;
}

.menu-transmission {
  position: absolute;
  right: 21px;
  bottom: 22px;
  color: var(--green);
  font-size: 7px;
  letter-spacing: .12em;
  transform: rotate(-90deg) translateX(100%);
  transform-origin: bottom right;
}

.menu-transmission i {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: signal 1.2s steps(2) infinite;
}

@keyframes signal {
  50% { opacity: .25; }
}

.panel {
  width: min(100%, 424px);
  max-height: min(92%, 740px);
  overflow: auto;
  padding: clamp(20px, 5vw, 32px);
  border: 1px solid rgba(96, 245, 232, .52);
  background:
    linear-gradient(135deg, rgba(18, 44, 49, .2), transparent 35%),
    var(--panel);
  box-shadow: 0 0 0 5px rgba(2, 8, 12, .48), 0 20px 70px rgba(0, 0, 0, .72), inset 0 0 40px rgba(49, 214, 200, .035);
  scrollbar-width: thin;
  scrollbar-color: #4dded0 #071116;
}

.panel h2 {
  margin: 7px 0 21px;
  color: #f6fffe;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(26px, 7.5vw, 42px);
  font-style: italic;
  font-weight: 900;
  line-height: .95;
  letter-spacing: .015em;
}

.panel__footer {
  padding-top: 16px;
  margin-top: 18px;
  border-top: 1px solid rgba(119, 223, 218, .18);
  color: var(--muted);
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.button-row button {
  flex: 1 1 120px;
  text-align: center;
  font-size: 9px;
}

.briefing-log {
  list-style: none;
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0;
}

.briefing-log li {
  padding-left: 12px;
  border-left: 2px solid rgba(80, 238, 224, .44);
}

.briefing-log span {
  display: block;
  margin-bottom: 3px;
  color: var(--teal);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .14em;
}

.briefing-log li:last-child span,
.briefing-log li:last-child p {
  color: #ff6b79;
}

.briefing-log p,
.small-copy,
.warning-copy {
  margin: 0;
  color: #c1d5d7;
  font-size: clamp(9px, 2.5vw, 12px);
  line-height: 1.52;
}

.briefing-objective {
  display: grid;
  gap: 5px;
  margin-top: 17px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 179, 78, .35);
  background: rgba(255, 165, 63, .06);
}

.briefing-objective b {
  color: var(--amber);
  font-size: 8px;
  letter-spacing: .18em;
}

.briefing-objective span {
  color: #fff1d8;
  font-size: 9px;
  line-height: 1.4;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.control-grid div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(104, 232, 224, .18);
  background: rgba(14, 31, 38, .64);
}

kbd {
  color: var(--teal);
  font-size: 10px;
  font-weight: 900;
}

.control-grid span {
  color: var(--muted);
  font-size: 8px;
}

.small-copy {
  margin-top: 16px;
}

.track-list {
  display: grid;
  gap: 8px;
}

.route-list {
  display: grid;
  gap: 7px;
}

.route-card {
  display: grid;
  grid-template-columns: 33px 1fr auto;
  gap: 2px 9px;
  width: 100%;
  min-height: 61px;
}

.route-card > span {
  grid-row: 1 / 4;
  align-self: center;
  color: #628189;
  font-size: 19px;
}

.route-card b {
  color: #efffff;
  font-size: 10px;
}

.route-card small,
.route-card i {
  color: var(--muted);
  font-size: 7px;
  font-style: normal;
  letter-spacing: .04em;
}

.route-card i {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
  color: #ffd17b;
}

.route-card.is-complete {
  border-color: rgba(120, 255, 157, .58);
  box-shadow: inset 3px 0 rgba(120, 255, 157, .72);
}

.route-card.is-complete b {
  color: var(--green);
}

.track-button {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 2px 8px;
  width: 100%;
  min-height: 58px;
}

.track-button > span {
  grid-row: 1 / 3;
  align-self: center;
  color: #5d7c82;
  font-size: 16px;
}

.track-button b {
  color: #eafffd;
  font-size: 10px;
}

.track-button small {
  color: var(--muted);
  font-size: 7px;
  letter-spacing: .04em;
}

.track-button.is-playing {
  border-color: var(--green);
  box-shadow: inset 3px 0 var(--green);
}

.track-button.is-playing b {
  color: var(--green);
}

.now-playing {
  margin-top: 13px;
  color: var(--green);
  font-size: 8px;
  letter-spacing: .12em;
}

.settings-list {
  display: grid;
  gap: 15px;
}

.setting-row,
.toggle-row {
  display: grid;
  gap: 8px;
  color: #cde0e1;
  font-size: 9px;
}

.setting-row > span,
.toggle-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.setting-row > span {
  display: grid;
  grid-template-columns: 1fr auto;
}

.setting-row b,
.toggle-row b {
  color: var(--teal);
  font-size: 8px;
}

input[type="range"] {
  width: 100%;
  height: 18px;
  accent-color: var(--teal);
  cursor: pointer;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 9px;
  accent-color: var(--teal);
}

.credits-copy {
  display: grid;
  gap: 15px;
}

.credits-copy p {
  display: grid;
  gap: 5px;
  margin: 0;
}

.credits-copy b {
  color: var(--teal);
  font-size: 9px;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.credits-copy span {
  color: #b9ccce;
  font-size: 9px;
  line-height: 1.5;
}

.danger-ui .panel {
  border-color: rgba(255, 65, 92, .65);
  background: linear-gradient(145deg, rgba(99, 15, 34, .28), transparent 36%), var(--panel);
}

.danger-ui .panel__eyebrow,
.warning-copy {
  color: #ff8190;
}

.respawn-ui {
  background: rgba(1, 5, 9, .65) !important;
}

.respawn-card {
  display: grid;
  justify-items: center;
  gap: 9px;
  width: 290px;
  padding: 25px;
  border: 1px solid var(--teal);
  background: rgba(3, 13, 17, .94);
  color: var(--teal);
}

.respawn-card span {
  font-size: 9px;
  letter-spacing: .16em;
}

.respawn-card b {
  color: #fff;
  font-size: 42px;
}

.respawn-card i {
  width: 100%;
  height: 3px;
  background: var(--teal);
  animation: handshake 1s ease-in-out infinite;
  transform-origin: left;
}

@keyframes handshake {
  0% { transform: scaleX(.05); opacity: .4; }
  100% { transform: scaleX(1); opacity: 1; }
}

.completion-headline,
.revelation {
  padding: 11px;
  line-height: 1.45;
  text-align: center;
}

.completion-headline {
  border: 1px solid rgba(95, 255, 230, .42);
  color: var(--teal);
  background: rgba(58, 221, 203, .07);
  font-size: 10px;
  font-weight: 900;
}

.revelation {
  margin-top: 8px;
  color: #ffce79;
  font-size: 8px;
  letter-spacing: .07em;
}

.final-transmission {
  margin-top: 9px;
  padding: 12px;
  border: 1px solid rgba(140, 255, 157, .5);
  color: #bcffc7;
  background: rgba(47, 151, 76, .08);
  font-size: 8px;
  line-height: 1.55;
  letter-spacing: .08em;
  text-align: center;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 15px 0 0;
  background: rgba(96, 195, 192, .2);
}

.results-grid div {
  display: grid;
  gap: 4px;
  padding: 8px 9px;
  background: #071117;
}

.results-grid dt {
  color: var(--muted);
  font-size: 7px;
  text-transform: uppercase;
}

.results-grid dd {
  margin: 0;
  color: #f2fffe;
  font-size: 10px;
  font-weight: 900;
}

.final-rating {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 8px 13px;
  border: 1px solid rgba(126, 255, 235, .35);
  color: var(--teal);
}

.final-rating span {
  font-size: 8px;
  letter-spacing: .16em;
}

.final-rating b {
  color: #fff;
  font-size: 25px;
}

.final-rating.failed {
  color: #ff6275;
  border-color: rgba(255, 70, 96, .38);
}

.touch-controls {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: none;
  pointer-events: none;
  opacity: var(--touch-opacity);
  touch-action: none;
}

.touch-controls.is-active {
  display: block;
}

.touch-pause,
.steering-zone,
.touch-button {
  pointer-events: auto;
}

.touch-pause {
  position: absolute;
  top: 85px;
  right: 9px;
  width: 38px;
  min-height: 30px;
  padding: 0;
  color: #bff9f3;
  text-align: center;
  background: rgba(4, 13, 18, .74);
  touch-action: none;
}

.steering-zone {
  --knob-x: 0px;
  position: absolute;
  left: 13px;
  bottom: max(17px, env(safe-area-inset-bottom));
  width: min(38vw, 160px);
  height: min(27vw, 116px);
  border: 1px solid rgba(83, 233, 222, .34);
  border-radius: 5px;
  background: rgba(3, 13, 18, .64);
  box-shadow: inset 0 0 24px rgba(38, 231, 216, .035);
  touch-action: none;
}

.steering-zone__cross {
  position: absolute;
  inset: 50% 12px auto;
  height: 1px;
  background: rgba(107, 235, 227, .25);
}

.steering-zone__cross::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -39px;
  width: 1px;
  height: 78px;
  background: inherit;
}

.steering-zone__knob {
  position: absolute;
  left: calc(50% - 20px);
  top: calc(50% - 20px);
  width: 40px;
  height: 40px;
  border: 2px solid var(--teal);
  border-radius: 50%;
  background: rgba(13, 53, 54, .72);
  box-shadow: 0 0 14px rgba(83, 255, 237, .2);
  transform: translateX(var(--knob-x));
  transition: transform .06s linear, background .08s ease, box-shadow .08s ease;
}

.steering-zone b,
.steering-zone__left,
.steering-zone__right {
  position: absolute;
  bottom: 5px;
  color: rgba(157, 255, 247, .62);
  font-size: 7px;
  letter-spacing: .1em;
}

.steering-zone b {
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.steering-zone__left {
  left: 8px;
}

.steering-zone__right {
  right: 8px;
}

.steering-zone.is-held {
  border-color: rgba(104, 255, 239, .82);
  background: rgba(6, 30, 33, .76);
}

.steering-zone.is-held .steering-zone__knob {
  background: rgba(25, 100, 96, .88);
  box-shadow: 0 0 22px rgba(83, 255, 237, .42);
}

.touch-actions {
  position: absolute;
  right: 10px;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(48vw, 190px);
  height: min(36vw, 158px);
}

.touch-button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  text-align: center;
  background: rgba(5, 17, 23, .74);
  touch-action: none;
  transition: transform .08s ease, background .08s ease, box-shadow .08s ease;
}

.touch-button span {
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .06em;
}

.touch-button--fire {
  right: 0;
  bottom: 0;
  width: 68px;
  height: 68px;
  border-color: var(--teal);
  color: var(--teal);
}

.touch-button--emp {
  right: 66px;
  bottom: 67px;
  border-color: #7ca5ff;
  color: #9db8ff;
}

.touch-button--throttle {
  right: 76px;
  bottom: 0;
  border-color: var(--amber);
  color: #ffd28a;
}

.touch-button--brake {
  right: 0;
  bottom: 77px;
  width: 50px;
  height: 50px;
  border-color: #ff6a73;
  color: #ff9399;
}

.touch-button--boost {
  right: 132px;
  bottom: 56px;
  width: 43px;
  height: 43px;
  border-color: #d277ff;
  color: #e5a7ff;
}

.touch-button:active,
.touch-button.is-held,
.touch-pause:active,
.touch-pause.is-held {
  transform: scale(.92);
  background: rgba(55, 234, 218, .3);
  box-shadow: 0 0 20px rgba(73, 255, 231, .26);
}

.touch-button:not(.is-held):hover,
.touch-button:not(.is-held):focus-visible,
.touch-pause:not(.is-held):hover,
.touch-pause:not(.is-held):focus-visible {
  transform: none;
  background: rgba(5, 17, 23, .74);
}

.no-script {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  background: #05090f;
  color: #fff;
}

@media (hover: hover) and (pointer: fine) {
  .game-root:not(.touch-capable) .touch-controls,
  .game-root:not(.touch-capable) .touch-controls.is-active {
    display: none;
  }
}

@media (max-width: 430px), (max-height: 720px) {
  .touch-controls {
    --touch-scale: .92;
  }

  .steering-zone {
    left: 9px;
    width: min(38vw, 148px);
  }

  .touch-actions {
    right: 7px;
    transform: scale(var(--touch-scale));
    transform-origin: right bottom;
  }
}

@media (max-height: 650px) and (orientation: landscape) {
  .panel {
    max-height: 95%;
  }

  .title-screen {
    padding-top: 28px;
  }

  .title-screen h1 span {
    font-size: 45px;
  }

  .menu-stack {
    margin-bottom: 15px;
  }
}

@media (max-height: 620px) {
  .title-screen {
    padding-top: 24px;
    padding-bottom: 18px;
  }

  .title-screen h1 span {
    font-size: 42px;
  }

  .title-screen h1 strong {
    font-size: 18px;
    margin-top: 6px;
  }

  .title-subtitle {
    margin-top: 9px;
  }

  .menu-stack {
    gap: 4px;
    margin-bottom: 10px;
  }

  .menu-stack button {
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
