:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #05050d;
  color: #f7fbff;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

button {
  font: inherit;
  letter-spacing: 0;
}

.game-shell {
  position: fixed;
  inset: 0;
  min-width: 320px;
  min-height: 520px;
  overflow: hidden;
  background: #05050d;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hud-layer {
  position: absolute;
  z-index: 3;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  pointer-events: none;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid rgb(139 249 255 / 0.42);
  background: linear-gradient(90deg, rgb(5 8 20 / 0.82), rgb(20 6 34 / 0.52));
  box-shadow: 0 0 22px rgb(36 238 255 / 0.15);
  text-transform: uppercase;
}

.brand-lockup .mark {
  display: grid;
  width: 34px;
  height: 28px;
  place-items: center;
  color: #061017;
  background: #53f7ff;
  font-size: 12px;
  font-weight: 900;
  clip-path: polygon(11% 0, 100% 0, 89% 100%, 0 100%);
}

.brand-lockup strong {
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.meters {
  display: grid;
  grid-template-columns: repeat(6, minmax(70px, 1fr));
  gap: 7px;
}

.meter,
.mission-strip {
  min-height: 42px;
  padding: 6px 9px;
  border: 1px solid rgb(255 255 255 / 0.16);
  background: rgb(4 7 18 / 0.66);
  box-shadow: inset 0 0 18px rgb(91 255 239 / 0.07), 0 0 20px rgb(0 0 0 / 0.22);
  backdrop-filter: blur(6px);
}

.meter span {
  display: block;
  color: #a7ccda;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
}

.meter strong {
  display: block;
  margin-top: 2px;
  color: #ffffff;
  font-size: 19px;
  line-height: 1;
  text-shadow: 0 0 12px rgb(97 244 255 / 0.55);
}

.meter.score strong {
  color: #ffe56a;
  text-shadow: 0 0 12px rgb(255 92 206 / 0.7);
}

.mission-strip {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  color: #dbfaff;
  font-size: 12px;
  text-transform: uppercase;
}

.mission-strip b {
  display: grid;
  width: 34px;
  height: 26px;
  place-items: center;
  color: #071018;
  background: #ffe56a;
  font-size: 17px;
  line-height: 1;
  clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
}

.touch-controls {
  position: absolute;
  z-index: 4;
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  pointer-events: none;
}

.steer-cluster {
  display: flex;
  gap: 10px;
  pointer-events: none;
}

.touch-pad,
.boost-pad,
#modalPrimary {
  border: 1px solid rgb(255 255 255 / 0.26);
  color: #f8fdff;
  background: rgb(5 10 22 / 0.58);
  box-shadow: 0 0 18px rgb(80 245 255 / 0.2), inset 0 0 20px rgb(255 255 255 / 0.05);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.touch-pad {
  width: 74px;
  height: 74px;
  font-size: 54px;
  line-height: 1;
  clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
}

.boost-pad {
  width: 104px;
  height: 74px;
  color: #061018;
  background: linear-gradient(135deg, #ffe56a, #ff4fb8 55%, #4df4ff);
  font-size: 14px;
  font-weight: 900;
  text-shadow: 0 1px 0 rgb(255 255 255 / 0.28);
  clip-path: polygon(12% 0, 100% 0, 88% 100%, 0 100%);
}

.touch-pad:active,
.boost-pad:active,
#modalPrimary:active {
  transform: translateY(2px) scale(0.98);
}

.modal {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 65%, rgb(255 76 188 / 0.12), transparent 35%), rgb(3 4 10 / 0.32);
}

.modal.hidden {
  display: none;
}

.modal-panel {
  width: min(560px, calc(100vw - 48px));
  padding: 22px 24px 24px;
  border: 1px solid rgb(95 239 255 / 0.38);
  background: linear-gradient(135deg, rgb(4 8 20 / 0.86), rgb(42 9 42 / 0.72));
  box-shadow: 0 0 50px rgb(45 235 255 / 0.2), inset 0 0 36px rgb(255 255 255 / 0.05);
}

.modal-panel p,
.modal-panel h1 {
  margin: 0;
}

#modalKicker {
  color: #53f7ff;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

#modalTitle {
  margin-top: 8px;
  font-size: clamp(42px, 8vw, 74px);
  line-height: 0.88;
  text-transform: uppercase;
  text-shadow: 0 0 22px rgb(83 247 255 / 0.5), 0 0 34px rgb(255 70 191 / 0.5);
}

#modalBody {
  max-width: 44em;
  margin-top: 14px;
  color: #c9ecf2;
  font-size: 15px;
  line-height: 1.45;
}

#modalPrimary {
  min-width: 172px;
  min-height: 54px;
  margin-top: 22px;
  padding: 0 22px;
  color: #071018;
  background: linear-gradient(135deg, #53f7ff, #ffe56a 56%, #ff4fb8);
  font-size: 16px;
  font-weight: 900;
  text-transform: uppercase;
  clip-path: polygon(8% 0, 100% 0, 92% 100%, 0 100%);
}

@media (max-width: 760px) {
  .hud-layer {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .brand-lockup {
    width: max-content;
    min-height: 34px;
    padding: 5px 8px;
  }

  .brand-lockup .mark {
    width: 29px;
    height: 23px;
    font-size: 10px;
  }

  .brand-lockup strong {
    font-size: 10px;
  }

  .meters {
    grid-template-columns: repeat(3, minmax(66px, 1fr));
    gap: 5px;
  }

  .meter {
    min-height: 36px;
    padding: 5px 7px;
  }

  .meter span {
    font-size: 9px;
  }

  .meter strong {
    font-size: 16px;
  }

  .mission-strip {
    min-height: 31px;
    font-size: 10px;
  }

  .touch-controls {
    gap: 8px;
  }

  .steer-cluster {
    gap: 8px;
  }

  .touch-pad {
    width: 64px;
    height: 64px;
    font-size: 44px;
  }

  .boost-pad {
    width: 90px;
    height: 64px;
    font-size: 12px;
  }
}

@media (max-height: 620px) {
  .mission-strip {
    display: none;
  }

  .touch-controls {
    bottom: 10px;
  }
}
