:root {
  color-scheme: dark;
  font-family: Inter, Pretendard, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07110f;
  color: #effff9;
  -webkit-tap-highlight-color: transparent;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #07110f;
}

body {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font: inherit;
}

#game-shell {
  position: fixed;
  inset: 0;
  min-height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 25%, #17342c 0, #07110f 64%);
}

#game-canvas,
#fallback-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#game-canvas.hidden,
#fallback-canvas.hidden {
  display: none;
}

.hud {
  position: absolute;
  z-index: 3;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  pointer-events: none;
  text-shadow: 0 2px 12px #000b;
}

.hud-center {
  text-align: center;
}

.hud-right {
  text-align: right;
}

.hud .label {
  display: block;
  margin-bottom: 2px;
  color: #8fb9aa;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.hud strong {
  font-size: clamp(18px, 5vw, 28px);
  font-variant-numeric: tabular-nums;
}

.hud small {
  color: #8fb9aa;
  font-size: 10px;
}

.inline-status {
  display: block;
  margin-top: 2px;
  color: #79f2c0;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.10em;
  white-space: nowrap;
}

.vital-meters {
  position: absolute;
  z-index: 3;
  top: max(72px, calc(env(safe-area-inset-top) + 58px));
  right: max(16px, env(safe-area-inset-right));
  left: max(16px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: minmax(92px, 124px) minmax(92px, 124px);
  justify-content: space-between;
  gap: 24px;
  pointer-events: none;
}

.meter span {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  color: #8fb9aa;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.meter strong {
  color: #dffff2;
  font-variant-numeric: tabular-nums;
}

.meter i {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: #06100dcc;
  box-shadow: inset 0 0 0 1px #79f2c022;
}

.meter b {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  transition: width 100ms linear;
}

.gas-meter b {
  width: 50%;
  background: #79f2c0;
}

.health-meter b {
  width: 100%;
  background: #ff875f;
}

.panel {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: linear-gradient(180deg, #07110f88, #07110ff2);
  text-align: center;
  transition: opacity 180ms ease;
}

.panel.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.panel .eyebrow {
  margin: 0 0 12px;
  color: #79f2c0;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.24em;
}

.panel h1,
.panel h2 {
  margin: 0;
  max-width: 100%;
  font-size: clamp(42px, 12.5vw, 68px);
  line-height: 0.86;
  letter-spacing: -0.07em;
  text-shadow: 0 10px 48px #2affaa22;
}

.panel h2 small {
  color: #8fb9aa;
  font-size: 0.18em;
  letter-spacing: 0;
}

.panel h2 {
  font-size: clamp(68px, 22vw, 110px);
}

.device-panel {
  z-index: 20;
  background: radial-gradient(circle at 50% 34%, #17342c 0, #07110f 65%);
}

.device-panel h2 {
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

html[data-device="desktop"] .hud,
html[data-device="desktop"] .vital-meters,
html[data-device="desktop"] .steer-controls,
html[data-device="desktop"] canvas {
  display: none;
}

.panel > p:not(.eyebrow) {
  max-width: 310px;
  margin: 24px 0;
  color: #b9d1c8;
  font-size: 14px;
  line-height: 1.65;
}

.panel button {
  min-width: 190px;
  min-height: 52px;
  border: 0;
  border-radius: 99px;
  background: #79f2c0;
  color: #07110f;
  font-weight: 900;
  box-shadow: 0 10px 40px #36d99a44;
  cursor: pointer;
}

.panel button:active {
  transform: scale(0.98);
}

.panel small {
  margin-top: 18px;
  color: #69887c;
  font-size: 11px;
}

.loading {
  position: absolute;
  z-index: 10;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  color: #8fb9aa;
  font-size: 11px;
  pointer-events: none;
}

.loading.hidden {
  display: none;
}

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

.steer-controls button {
  display: flex;
  width: min(34vw, 132px);
  min-height: 64px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid #79f2c044;
  border-radius: 22px;
  background: #07110fbb;
  color: #dffff2;
  box-shadow: inset 0 0 28px #79f2c00c, 0 10px 30px #0005;
  touch-action: none;
  pointer-events: auto;
}

.steer-controls button span {
  font-size: 30px;
  line-height: 1;
}

.steer-controls button small {
  color: #8fb9aa;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.steer-controls button.active,
.steer-controls button:active {
  border-color: #79f2c0cc;
  background: #1a6b50dd;
  box-shadow: 0 0 32px #79f2c033;
  transform: translateY(1px);
}

@media (min-width: 720px) {
  #game-shell {
    left: 50%;
    width: min(100%, 560px);
    transform: translateX(-50%);
    box-shadow: 0 0 100px #000;
  }
}

@media (max-height: 680px) {
  .steer-controls button {
    min-height: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel {
    transition: none;
  }
}
