@font-face {
  font-family: Road;
  src: local("Avenir Next");
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #101b22;
  color: #fff;
  font-family: Road, Arial, sans-serif;
  font-size: 16px;
}
button,
select,
input {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  border: 1px solid #ffffff25;
  background: #ffffff08;
  border-radius: 5px;
  padding: 12px 16px;
  transition:
    background 0.2s,
    transform 0.2s;
}
button:hover {
  background: #ffffff1f;
}
button:active {
  transform: scale(0.98);
}
button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid #ffc978;
  outline-offset: 3px;
}
.hidden {
  display: none !important;
}
#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
header {
  position: absolute;
  top: max(28px, env(safe-area-inset-top));
  left: max(32px, env(safe-area-inset-left));
  right: max(32px, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
.brand {
  color: white;
  text-decoration: none;
  letter-spacing: 0.25em;
  font-weight: 900;
  font-size: 27px;
  pointer-events: auto;
  text-shadow: 0 2px 14px #0005;
}
.brand span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.47em;
  margin-top: 2px;
}
.top-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 8px #000;
}
.top-right button {
  pointer-events: auto;
  background: #14212988;
  backdrop-filter: blur(12px);
  font-size: 12px;
}
#pause {
  font-size: 20px;
  padding: 7px 16px;
}
#menu {
  position: absolute;
  top: 115px;
  left: 32px;
  bottom: 26px;
  width: 390px;
  overflow-y: auto;
  padding: 25px 28px;
  background: linear-gradient(135deg, #10212bef, #101b22db);
  border: 1px solid #ffffff20;
  backdrop-filter: blur(20px);
  border-radius: 10px;
  box-shadow: 0 20px 80px #0002;
  scrollbar-width: thin;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: #f2bc79;
  font-weight: 700;
}
h1 {
  font-size: 53px;
  line-height: 1.02;
  letter-spacing: -0.055em;
  margin: 15px 0;
}
p.intro {
  font-size: 14px;
  color: #b9c5cb;
  line-height: 1.6;
  margin-bottom: 25px;
}
.section-label {
  font-size: 11px;
  letter-spacing: 0.15em;
  display: flex;
  justify-content: space-between;
  color: #bdc7cc;
  margin-bottom: 12px;
}
#cars {
  display: flex;
  gap: 8px;
}
#cars button {
  flex: 1;
  padding: 10px 0;
  font-size: 12px;
  letter-spacing: 0.05em;
  background: #ffffff04;
  border-color: #ffffff20;
}
#cars button i {
  display: block;
  width: 28px;
  height: 8px;
  margin: 0 auto 8px;
  border-radius: 8px 8px 2px 2px;
  background: var(--car);
}
#cars button.active {
  border-color: #efbc78;
  background: #efbc7814;
}
.car-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}
.car-details h2 {
  font-size: 24px;
  letter-spacing: -0.03em;
  margin: 0 0 4px;
}
.car-details span {
  font-size: 10px;
  letter-spacing: 0.15em;
  color: #aabcc5;
}
.car-details p {
  font-size: 12px;
  color: #b9c5cb;
  max-width: 130px;
  line-height: 1.4;
  text-align: right;
}
#stats {
  display: flex;
  gap: 16px;
  margin: 16px 0 23px;
}
#stats div {
  flex: 1;
  font-size: 10px;
  color: #bccbd2;
  letter-spacing: 0.08em;
}
#stats i {
  display: block;
  height: 3px;
  background: #ffffff20;
  margin-top: 8px;
}
#stats b {
  display: block;
  height: 3px;
  background: #edbd7e;
}
.mode-switch {
  display: flex;
  border-bottom: 1px solid #ffffff20;
  margin-bottom: 15px;
}
.mode-switch button {
  border: 0;
  border-radius: 0;
  flex: 1;
  font-size: 14px;
  color: #aab8c1;
  padding: 12px 0;
}
.mode-switch button.active {
  color: #ffca81;
  border-bottom: 2px solid #ffca81;
  background: transparent;
}
.primary {
  background: #f3c185;
  color: #19252b;
  border: 0;
  font-weight: 800;
  width: 100%;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
}
.primary:hover {
  background: #ffdbab;
}
.menu-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}
.menu-footer button {
  padding: 6px 0;
  border: 0;
  font-size: 11px;
  color: #c4ced3;
  background: none;
}
.menu-footer span {
  font-size: 9px;
  color: #83959f;
  letter-spacing: 0.06em;
}
#race-options {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 15px;
}
#race-options label {
  font-size: 10px;
  color: #c1cbd0;
}
select {
  background: #203039;
  color: #fff;
  border: 1px solid #ffffff30;
  border-radius: 4px;
  padding: 9px;
  font-size: 13px;
  max-width: 100%;
}
#hud {
  pointer-events: none;
}
.map-wrap {
  position: absolute;
  left: 32px;
  bottom: 48px;
  width: 200px;
}
#map {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: #101e2bbb;
  border: 1px solid #ffffff30;
  backdrop-filter: blur(12px);
}
#map-caption {
  display: block;
  text-align: center;
  font-size: 8px;
  letter-spacing: 0.13em;
  color: #d2d9dd;
  margin-top: 10px;
}
#speedometer {
  position: absolute;
  right: 40px;
  bottom: 70px;
  text-align: right;
  text-shadow: 0 2px 20px #0006;
}
#speedometer strong {
  font-size: 88px;
  letter-spacing: -0.06em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
#gear {
  display: inline-block;
  border: 1px solid #ffffff70;
  border-radius: 4px;
  font-size: 21px;
  padding: 5px 9px;
  margin-right: 14px;
  vertical-align: 20px;
}
#speedometer > div {
  font-size: 11px;
  letter-spacing: 0.2em;
}
#drive-status {
  color: #ffcf92;
  margin-left: 20px;
}
.rev-track {
  height: 3px;
  background: #ffffff40;
  margin-top: 16px;
}
#revs {
  height: 100%;
  background: #ffd08b;
  display: block;
  width: 0;
}
.hints {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  letter-spacing: 0.07em;
  font-size: 10px;
  color: #ffffffb0;
}
.hints span {
  margin-left: 24px;
}
#racehud {
  position: absolute;
  top: 115px;
  left: 32px;
  display: flex;
  gap: 22px;
  align-items: center;
  background: #10212bdd;
  border: 1px solid #ffffff20;
  border-radius: 6px;
  padding: 16px 20px;
}
#race-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  max-width: 60px;
  line-height: 1.6;
  color: #edbc7c;
}
#place {
  font-size: 38px;
  font-weight: 500;
}
#place small {
  font-size: 16px;
  color: #b6c3cd;
}
#racehud > div {
  display: grid;
  gap: 6px;
}
#checkpoint {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #b6c3cd;
}
#timer {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
#countdown {
  position: absolute;
  top: 35%;
  width: 100%;
  text-align: center;
  font-size: 96px;
  font-weight: 800;
  text-shadow: 0 4px 30px #0008;
  pointer-events: none;
}
#toast {
  position: absolute;
  top: 24%;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 22px;
  border-radius: 5px;
  background: #10212be8;
  color: #ffe0b7;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  text-align: center;
  font-size: 14px;
}
#toast.show {
  opacity: 1;
}
dialog {
  color: #fff;
  background: #12232bf5;
  backdrop-filter: blur(20px);
  border: 1px solid #ffffff30;
  border-radius: 12px;
  padding: 32px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 25px 100px #0008;
}
dialog::backdrop {
  background: #05101b88;
}
dialog h2 {
  font-size: 30px;
  margin: 13px 0 25px;
  letter-spacing: -0.04em;
}
dialog > button {
  display: block;
  width: 100%;
  margin: 10px 0;
}
dialog p {
  font-size: 14px;
  color: #b9cbd3;
  line-height: 1.65;
}
dialog label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0;
  font-size: 14px;
}
#result-board > div {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid #ffffff20;
  font-size: 14px;
}
#result-board .you {
  color: #ffc980;
}
#loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #101b22;
  z-index: 20;
}
.wordmark {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: 0.3em;
  padding-left: 0.3em;
}
.wordmark span {
  display: block;
  font-size: 11px;
  text-align: center;
  letter-spacing: 0.65em;
  color: #e8ba7d;
  margin-top: 10px;
}
.loadtrack {
  width: 200px;
  height: 2px;
  background: #ffffff20;
  margin-top: 40px;
}
.loadtrack i {
  display: block;
  height: 2px;
  width: 5%;
  background: #edbc7b;
  transition: width 0.3s;
}
#loadtext {
  font-size: 12px;
  color: #92a6b2;
}
#touch {
  position: absolute;
  bottom: max(26px, env(safe-area-inset-bottom));
  left: max(22px, env(safe-area-inset-left));
  right: max(22px, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
#touch > div {
  display: flex;
  align-items: end;
  gap: 10px;
}
#touch button {
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: #12232b99;
  border: 1px solid #ffffff55;
  backdrop-filter: blur(8px);
  height: 68px;
  min-width: 62px;
  font-size: 15px;
  font-weight: 700;
}
#touch button.pressed {
  background: #edbc7b88;
}
.throttle {
  height: 88px !important;
  border-color: #ffd29b !important;
}
.handbrake {
  min-width: 44px !important;
  height: 46px !important;
  font-size: 12px !important;
}
@media (pointer: coarse) {
  .hints {
    display: none;
  }
  .map-wrap {
    bottom: 135px;
    width: 125px;
  }
  #map {
    width: 125px;
    height: 125px;
  }
  #map-caption {
    display: none;
  }
  #speedometer {
    bottom: 150px;
    right: 25px;
  }
  #speedometer strong {
    font-size: 54px;
  }
  #gear {
    font-size: 16px;
    vertical-align: 10px;
  }
}
@media (max-height: 760px) {
  #menu {
    top: 92px;
    padding: 20px 24px;
  }
  h1 {
    font-size: 40px;
    margin: 10px 0;
  }
  p.intro {
    margin: 10px 0 16px;
  }
  .car-details {
    margin-top: 10px;
  }
  #stats {
    margin: 12px 0 15px;
  }
  header {
    top: 20px;
  }
}
@media (max-width: 600px) {
  header {
    left: 18px;
    right: 18px;
    top: max(18px, env(safe-area-inset-top));
  }
  .brand {
    font-size: 21px;
  }
  .brand span {
    font-size: 8px;
  }
  .top-right {
    gap: 8px;
  }
  #area {
    display: none;
  }
  #sound {
    font-size: 9px;
    padding: 10px;
  }
  #menu {
    left: 14px;
    right: 14px;
    width: auto;
    top: 85px;
    bottom: 14px;
    max-width: 390px;
    padding: 20px;
  }
  h1 {
    font-size: 40px;
  }
  .intro {
    font-size: 13px !important;
  }
  #racehud {
    top: 90px;
    left: 18px;
    padding: 10px;
    gap: 12px;
  }
  #racehud strong {
    font-size: 28px;
  }
  .map-wrap {
    left: 18px;
  }
  #toast {
    width: 80%;
  }
  .wordmark {
    font-size: 38px;
  }
  #speedometer {
    right: 20px;
  }
  #touch {
    left: 12px;
    right: 12px;
  }
  #touch button {
    min-width: 52px;
    padding: 12px 9px;
  }
}
@media (max-height: 500px) {
  #menu {
    top: 75px;
    bottom: 12px;
    width: 350px;
    left: 18px;
  }
  #menu h1 {
    font-size: 32px;
  }
  #menu .intro {
    display: none;
  }
  .map-wrap {
    bottom: 105px;
  }
  #map {
    width: 95px;
    height: 95px;
  }
  #speedometer {
    bottom: 118px;
  }
  #racehud {
    top: 75px;
  }
  #touch button {
    height: 52px;
  }
  .throttle {
    height: 64px !important;
  }
  header {
    top: 12px;
  }
}
@media (max-width: 899px) {
  .hints {
    display: none;
  }
  .map-wrap {
    bottom: 135px;
    width: 125px;
  }
  #map {
    width: 125px;
    height: 125px;
  }
  #map-caption {
    display: none;
  }
  #speedometer {
    bottom: 150px;
    right: 25px;
  }
  #speedometer strong {
    font-size: 54px;
  }
  #gear {
    font-size: 16px;
    vertical-align: 10px;
  }
}
