:root {
  --cream: #fff8e6;
  --mint: #bff7dc;
  --muted: #a9c8cf;
  --gold: #ffdb83;
  --dark: #102b36;
  --coral: #ff957c;
}

body {
  background: #10252e;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
a {
  color: inherit;
  text-decoration: none;
}
.topbar button,
.bottom-bar button {
  background: #102b368a;
  border: 1px solid #b6dde04a;
  letter-spacing: 0.6px;
}

.topbar button:hover,
.bottom-bar button:hover {
  background: #ffffff18;
}
#game-shell {
  height: min(830px, calc(100svh - 105px - var(--safe-top) - var(--safe-bottom)));
  margin: auto;
  border: 1px solid #97c7d23b;
  background: #84bfc5;
}

#viewport,
#viewport canvas,
.vignette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.vignette {
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(#07293538, transparent 26%, transparent 70%, #07293545);
}
.hud {
  top: 27px;
}

.eyebrow {
  font: 600 10px monospace;
  letter-spacing: 2px;
}
.game-brand {
  text-shadow: 0 2px 15px #173d4e9c;
}
.game-brand .eyebrow {
  color: #efffed;
}
h1 {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -1px;
  margin: 5px 0;
}
h1 span {
  color: var(--gold);
  font-size: 33px;
  margin-left: 4px;
}
.stats {
  background: #102c38ed;
  border: 1px solid #e9f9e333;
  padding: 13px 5px;
  align-self: flex-start;
}

.stats > div {
  min-width: 98px;
  padding: 0 16px;
}

.stats strong {
  font-size: 23px;
  line-height: 1.5;
  font-weight: 500;
}

.course-panel {
  position: absolute;
  top: 140px;
  left: 30px;
  z-index: 2;
  width: 246px;
  background: #102c38ed;
  border: 1px solid #fff2;
  border-radius: 12px;
  padding: 18px;
  backdrop-filter: blur(8px);
}
.course-panel > .eyebrow {
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 1.5px;
}
.course-panel h2 {
  font-size: 22px;
  margin: 10px 0 6px;
}
.course-panel p {
  color: #c3d9d7;
  font-size: 11px;
  line-height: 1.6;
  margin: 0 0 18px;
}
.boost-label {
  display: flex;
  justify-content: space-between;
  font: 10px monospace;
  color: var(--mint);
}
.boost-label label span {
  margin-left: 7px;
}
.boost-label > span {
  color: #b1c9cb;
  font-size: 10px;
}
.course-panel progress {
  appearance: none;
  display: block;
  width: 100%;
  height: 6px;
  border: 0;
  background: #ffffff1a;
  border-radius: 5px;
  overflow: hidden;
  margin: 9px 0 10px;
}
.course-panel progress::-webkit-progress-bar {
  background: #ffffff1a;
}
.course-panel progress::-webkit-progress-value {
  background: var(--mint);
}
.course-panel progress::-moz-progress-bar {
  background: var(--mint);
}
.course-panel small {
  font: 10px/1.5 monospace;
  color: #abc3c7;
}
.map-panel {
  position: absolute;
  z-index: 2;
  right: 26px;
  bottom: 70px;
  width: 184px;
  padding: 12px;
  border: 1px solid #f5ffe236;
  border-radius: 11px;
  background: #102b36df;
  backdrop-filter: blur(8px);
}
.map-title {
  display: flex;
  justify-content: space-between;
  font: 10px monospace;
  letter-spacing: 0.4px;
  color: #d9eccc;
}
.map-panel canvas {
  display: block;
  width: 100%;
  height: auto;
  margin: 6px 0;
}
.map-legend {
  display: flex;
  align-items: center;
  font: 10px monospace;
  letter-spacing: 0.3px;
  color: #cae2d5;
}
.map-legend i {
  width: 5px;
  height: 5px;
  margin-right: 4px;
  background: var(--gold);
  border-radius: 50%;
}
.map-legend span {
  margin-left: auto;
  font-size: 10px;
}
.speedometer {
  position: absolute;
  z-index: 2;
  bottom: 79px;
  left: 32px;
  display: flex;
  align-items: baseline;
  gap: 7px;
  text-shadow: 0 2px 10px #05282f90;
}
.speedometer strong {
  font-size: 48px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.speedometer > span {
  font: 10px monospace;
}
.speedometer small {
  position: absolute;
  top: 55px;
  left: 0;
  white-space: nowrap;
  font: 10px monospace;
  letter-spacing: 1.3px;
  color: #efffec;
}
.target {
  position: absolute;
  z-index: 2;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 21px 10px 16px;
  border: 1px solid #fff4;
  border-radius: 50px;
  background: #102b36df;
}
.target > span {
  font-size: 30px;
  color: var(--gold);
}
.target small {
  display: block;
  font: 10px monospace;
  letter-spacing: 1px;
  color: var(--muted);
}
.target strong {
  font-size: 18px;
  font-weight: 500;
}
.bottom-bar {
  bottom: 14px;
  gap: 10px;
}

.bottom-bar > div {
  display: flex;
  gap: 8px;
}
.keyboard-help {
  color: #f3ffea;
  text-shadow: 0 1px 5px #163d48;
}

.keyboard-help b {
  padding: 0 5px;
}
kbd {
  border-bottom: 1px solid #fff6;
}

#toast {
  top: 112px;
  max-width: 420px;
  padding: 12px 21px;
  border-radius: 8px;
  color: #203e40;
  font-size: 12px;
  box-shadow: 0 5px 24px #17404030;
}

.countdown {
  position: absolute;
  z-index: 4;
  inset: 36% 0 auto;
  text-align: center;
  font-size: 100px;
  font-weight: 900;
  color: var(--cream);
  text-shadow:
    0 6px 0 #16374250,
    0 10px 40px #114a52;
  pointer-events: none;
}
.overlay {
  padding: 32px 6%;
  background: linear-gradient(90deg, #09252e96, transparent 67%);
}

.menu-card {
  width: 355px;
  padding: 29px;
  background: #102c38f2;
  border: 1px solid #d3f1e04a;
  box-shadow: 0 15px 60px #1233403a;
}

.menu-card h2 {
  font-size: 48px;
  letter-spacing: -2px;
  line-height: 1.06;
}

.menu-card > p {
  color: #bfd5d5;
}

.intro-details {
  margin: 24px 0;
}

.intro-details > div > span {
  font: 10px monospace;
  color: var(--mint);
  border: 1px solid #c3eddf50;
  border-radius: 50%;
  padding: 5px;
  margin-top: 1px;
}
.intro-details p {
  color: #abc6cb;
}

.primary {
  color: #123e40;
}

.primary > span {
  float: right;
  font-size: 17px;
  line-height: 14px;
}
.primary:hover {
  background: #dcffed;
}
.secondary {
  border: 1px solid #ffffff38;
  color: var(--cream);
}

.menu-card .menu-note {
  color: #a5c0c6;
}

.results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 22px 0;
}
.results div {
  border-top: 1px solid #ffffff30;
}

.results span {
  display: block;
  font: 10px monospace;
  letter-spacing: 1px;
  color: #b5d6d4;
}
.results strong {
  font-size: 25px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.touch-controls button {
  background: #153642e8;
  border: 1px solid #e4fae65c;
  border-radius: 10px;
}

.touch-controls .boost {
  color: var(--gold);
}
.touch-controls button.pressed {
  background: var(--gold);
  color: #123b42;
}
.load-state {
  background: #142e3a;
}

footer {
  gap: 16px;
  color: #8eb1bc;
}

footer a {
  color: #c6e2dc;
}
.no-script {
  padding: 24px;
}
@media (min-width: 1550px) {
  #game-shell {
    margin: 0 30px;
    max-width: none;
  }
}
@media (max-width: 1050px) {
  .terminal {
    display: none;
  }
  .hud {
    left: 22px;
    right: 22px;
  }
  .game-brand h1 {
    font-size: 24px;
  }
  .stats > div {
    min-width: 77px;
    padding: 0 11px;
  }
  .stats strong {
    font-size: 20px;
  }
  .course-panel {
    left: 22px;
    width: 218px;
    padding: 15px;
  }
  .map-panel {
    width: 150px;
    right: 22px;
  }
  .menu-card {
    width: 330px;
    padding: 25px;
  }
  .menu-card h2 {
    font-size: 43px;
  }
  .keyboard-help {
    font-size: 10px;
  }
}
@media (pointer: coarse) {
  .keyboard-help {
    display: none;
  }
  .bottom-bar {
    justify-content: flex-end;
  }
  .speedometer {
    bottom: 138px;
  }
  .map-panel {
    bottom: 135px;
  }
  .target {
    bottom: 136px;
  }
}
@media (max-width: 650px) {
  .topbar {
    height: 46px;
    padding: 0 15px;
    font-size: 10px;
  }
  .topbar button {
    font-size: 10px;
    padding: 7px 9px;
  }
  #game-shell {
    height: calc(100svh - 76px - var(--safe-top) - var(--safe-bottom));
    min-height: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .hud {
    top: 18px;
    left: 16px;
    right: 16px;
    gap: 6px;
    align-items: flex-start;
  }
  .game-brand h1 {
    font-size: 19px;
    letter-spacing: -0.8px;
  }
  .game-brand h1 span {
    font-size: 22px;
    margin-left: 0;
  }
  .game-brand .eyebrow {
    font-size: 10px;
    letter-spacing: 0.7px;
  }
  .stats {
    padding: 8px 0;
  }
  .stats > div {
    min-width: 48px;
    padding: 0 7px;
  }
  .stats span {
    font-size: 10px;
    letter-spacing: 0.3px;
  }
  .stats strong {
    font-size: 16px;
  }
  .course-panel {
    top: 94px;
    left: 16px;
    width: 198px;
    padding: 13px;
  }
  .course-panel > .eyebrow {
    font-size: 10px;
    letter-spacing: 1px;
  }
  .course-panel h2 {
    font-size: 18px;
    margin: 8px 0;
  }
  .course-panel p {
    font-size: 10px;
    line-height: 1.5;
    margin-bottom: 12px;
  }
  .course-panel small {
    font-size: 10px;
  }
  .boost-label {
    font-size: 10px;
  }
  .map-panel {
    width: 120px;
    right: 16px;
    bottom: 132px;
    padding: 9px;
  }
  .map-title {
    font-size: 10px;
  }
  .map-legend {
    font-size: 10px;
  }
  .map-legend span {
    display: none;
  }
  .speedometer {
    left: 20px;
    bottom: 142px;
  }
  .speedometer strong {
    font-size: 36px;
  }
  .speedometer small {
    top: 41px;
    font-size: 10px;
  }
  .target {
    bottom: 290px;
    right: 16px;
    left: auto;
    transform: none;
    padding: 8px 12px;
    gap: 7px;
  }
  .target > span {
    font-size: 22px;
  }
  .target strong {
    font-size: 14px;
  }
  .target small {
    font-size: 10px;
  }
  .bottom-bar {
    left: 16px;
    right: 16px;
    bottom: 12px;
    justify-content: flex-end;
  }
  .keyboard-help {
    display: none;
  }
  .overlay {
    padding: 86px 16px 55px;
    justify-content: center;
    background: #09252e45;
  }
  .menu-card {
    width: min(340px, 100%);
    padding: 22px;
  }
  .menu-card h2 {
    font-size: 38px;
    margin: 12px 0;
  }
  .menu-card > p {
    font-size: 12px;
  }
  .intro-details {
    gap: 10px;
    margin: 17px 0;
  }
  .intro-details p {
    font-size: 10px;
  }
  .intro-details strong {
    font-size: 11px;
  }
  .menu-card .menu-note {
    font-size: 10px;
  }
  #toast {
    top: 280px;
    width: calc(100% - 36px);
    max-width: 340px;
    font-size: 11px;
  }
  .countdown {
    top: 43%;
    font-size: 80px;
  }
  footer {
    height: 30px;
    font-size: 10px;
    padding: 0 15px;
  }
  footer > span:last-child {
    display: none;
  }
}
/* Keep the course information out of the driving view on shorter phones. */
@media (max-width: 650px) and (max-height: 700px) and (orientation: portrait) {
  .course-panel {
    top: 84px;
    left: 12px;
    width: 164px;
    padding: 11px;
  }
  .course-panel > .eyebrow {
    font-size: 10px;
    letter-spacing: 0.6px;
  }
  .course-panel h2 {
    font-size: 16px;
    margin: 7px 0;
  }
  .course-panel p,
  .course-panel small {
    display: none;
  }
  .course-panel progress {
    margin-bottom: 0;
  }
  .driving-game .map-panel {
    top: 84px;
    bottom: auto;
    right: 12px;
    width: 108px;
    padding: 8px;
  }
  .target {
    bottom: 134px;
    right: 16px;
  }
  .overlay {
    padding-top: 76px;
    padding-bottom: 14px;
  }
  .menu-card {
    padding: 18px;
  }
  .menu-card h2 {
    font-size: 32px;
    margin: 10px 0;
  }
  .intro-details {
    gap: 7px;
    margin: 12px 0;
  }
  .menu-card .menu-note {
    display: none;
  }
}
@media (max-width: 370px) {
  .hud {
    left: 12px;
    right: 12px;
  }
  .game-brand h1 {
    font-size: 17px;
  }
  .stats > div {
    min-width: 43px;
    padding: 0 5px;
  }
  .stats strong {
    font-size: 14px;
  }
}
@media (max-height: 700px) and (min-width: 651px) {
  .course-panel p {
    display: none;
  }
  .menu-card {
    width: 320px;
    padding: 20px;
  }
  .menu-card h2 {
    font-size: 34px;
    margin: 10px 0;
  }
  .intro-details {
    gap: 7px;
    margin: 12px 0;
  }
  .menu-card > p {
    font-size: 11px;
  }
  .menu-note {
    display: none;
  }
  .overlay {
    padding-top: 83px;
    padding-bottom: 16px;
  }
  .course-panel {
    top: 105px;
  }
  .map-panel {
    width: 130px;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .topbar {
    height: 36px;
    padding: 0 15px;
    font-size: 10px;
  }
  .topbar button {
    font-size: 10px;
    padding: 5px 9px;
  }
  #game-shell {
    height: calc(100svh - 36px - var(--safe-top) - var(--safe-bottom));
    min-height: 0;
    border-radius: 0;
  }
  footer {
    display: none;
  }
  .hud {
    top: 12px;
    left: 14px;
    right: 14px;
  }
  .game-brand h1 {
    font-size: 18px;
  }
  .game-brand .eyebrow {
    font-size: 10px;
  }
  .stats {
    padding: 6px 0;
  }
  .stats > div {
    min-width: 60px;
    padding: 0 8px;
  }
  .stats span {
    font-size: 10px;
  }
  .stats strong {
    font-size: 17px;
  }
  .overlay {
    padding: 61px 16px 12px;
    align-items: center;
    justify-content: flex-start;
  }
  .menu-card {
    width: 320px;
    padding: 17px;
  }
  .menu-card h2 {
    font-size: 28px;
    margin: 7px 0;
  }
  .menu-card > p {
    font-size: 10px;
    margin: 8px 0;
  }
  .intro-details {
    display: none;
  }
  .menu-card .menu-note {
    display: block;
    font-size: 10px;
    margin-top: 8px;
  }
  .primary {
    padding: 12px;
    font-size: 10px;
  }
  .secondary {
    padding: 8px;
    margin-top: 6px;
  }
  .results {
    gap: 7px;
    margin: 9px 0;
  }
  .results div {
    padding-top: 5px;
  }
  .results strong {
    font-size: 18px;
  }
  .results span {
    font-size: 10px;
  }
  .course-panel {
    top: 76px;
    left: 14px;
    width: 180px;
    padding: 11px;
  }
  .course-panel h2 {
    font-size: 16px;
    margin: 6px 0;
  }
  .course-panel > .eyebrow {
    font-size: 10px;
  }
  .course-panel p,
  .course-panel small {
    display: none;
  }
  .course-panel progress {
    margin: 6px 0 2px;
  }
  .boost-label {
    font-size: 10px;
  }
  .map-panel {
    width: 105px;
    right: 14px;
    bottom: 78px;
    padding: 8px;
  }
  .map-title {
    font-size: 10px;
  }
  .map-legend {
    font-size: 10px;
  }
  .map-legend span {
    display: none;
  }
  .target {
    right: 131px;
    bottom: 83px;
    left: auto;
    transform: none;
    padding: 7px 12px;
    gap: 7px;
  }
  .target strong {
    font-size: 13px;
  }
  .target small {
    font-size: 10px;
  }
  .target > span {
    font-size: 21px;
  }
  .speedometer {
    display: none;
  }
  .keyboard-help {
    display: none;
  }
  .bottom-bar {
    top: 12px;
    bottom: auto;
    left: auto;
    right: 227px;
  }
  .bottom-bar button {
    font-size: 10px;
    padding: 7px 8px;
  }
  #toast {
    top: 75px;
    font-size: 10px;
    max-width: 280px;
    padding: 9px 14px;
  }
  .countdown {
    top: 29%;
    font-size: 76px;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .game-brand h1 {
    line-height: 1.1;
  }
  .game-brand h1 span {
    font-size: 20px;
  }
}
@media (max-height: 350px) and (orientation: landscape) {
  .menu-card .menu-note {
    display: none;
  }
  .results {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  .results span {
    min-height: 17px;
    line-height: 1.3;
    letter-spacing: 0.2px;
  }
  .results strong {
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
