:root {
  --bg: #0a0a0a;
  --panel: rgba(16, 16, 16, 0.86);
  --c-warn: #ff3c00;
  --c-amber: #ffaa00;
  --c-cyan: #00e5ff;
  --c-ice: #f0f0f0;
  --c-dim: rgba(240, 240, 240, 0.55);
  --glow-warn: 0 0 18px rgba(255, 60, 0, 0.55), 0 0 40px rgba(255, 60, 0, 0.2);
  --glow-cyan: 0 0 18px rgba(0, 229, 255, 0.5), 0 0 40px rgba(0, 229, 255, 0.18);
  --font-display: "Russo One", Impact, sans-serif;
  --font-body: "Share Tech Mono", "Courier New", monospace;
  --radius: 4px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--c-ice);
  font-family: var(--font-body);
  touch-action: none;
}

.game-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.grid-floor,
.scanlines,
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.grid-floor {
  opacity: 0.12;
  background:
    linear-gradient(transparent 95%, rgba(0, 229, 255, 0.25) 95%),
    linear-gradient(90deg, transparent 95%, rgba(0, 229, 255, 0.25) 95%);
  background-size: 60px 60px;
  transform: perspective(400px) rotateX(60deg) translateY(-20%) scale(2);
  transform-origin: center bottom;
  animation: grid-scroll 1.5s linear infinite;
}

@keyframes grid-scroll {
  from { background-position: 0 0; }
  to { background-position: 0 60px; }
}

.scanlines {
  opacity: 0.08;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(255, 255, 255, 0.04) 3px,
    rgba(255, 255, 255, 0.04) 4px
  );
}

.vignette {
  background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.75) 100%);
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  padding: 26px 34px;
  gap: 22px;
  pointer-events: none;
}

.hud-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hud-block--right {
  align-items: flex-end;
}

.hud-block--center {
  align-items: center;
}

.hud-label {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-dim);
}

.hud-value {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 400;
  line-height: 1;
  color: var(--c-cyan);
  text-shadow: var(--glow-cyan);
}

.logo {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--c-ice);
  text-shadow: 0 0 16px rgba(240, 240, 240, 0.3), 0 0 32px rgba(0, 229, 255, 0.2);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms ease;
}

.overlay--active {
  opacity: 1;
  visibility: visible;
}

.overlay__panel {
  width: min(520px, 90vw);
  padding: 44px 38px;
  border: 1px solid rgba(240, 240, 240, 0.18);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.15), 0 0 50px rgba(0, 229, 255, 0.1);
  text-align: center;
  transform: translateY(12px);
  transition: transform 320ms ease;
}

.overlay--active .overlay__panel {
  transform: translateY(0);
}

.overlay__kicker {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.35em;
  color: var(--c-cyan);
  text-shadow: var(--glow-cyan);
  margin-bottom: 14px;
}

.overlay__kicker--alert {
  color: var(--c-warn);
  text-shadow: var(--glow-warn);
}

.overlay__title {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 16px;
  color: var(--c-ice);
}

.overlay__copy {
  font-size: 15px;
  line-height: 1.5;
  color: var(--c-dim);
  margin-bottom: 26px;
}

.overlay__stat {
  color: var(--c-amber);
  font-weight: 700;
  text-shadow: 0 0 12px rgba(255, 170, 0, 0.4);
}

.overlay__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
  font-size: 13px;
  color: var(--c-dim);
}

kbd {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 2px;
  border: 1px solid rgba(240, 240, 240, 0.25);
  background: rgba(240, 240, 240, 0.08);
  color: var(--c-ice);
}

.drift-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 44px;
  border: none;
  border-radius: 0;
  cursor: pointer;
  background: var(--c-cyan);
  color: var(--bg);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  box-shadow: var(--glow-cyan);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.drift-btn--secondary {
  background: var(--c-warn);
  box-shadow: var(--glow-warn);
}

.drift-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.55);
}

.drift-btn--secondary:hover {
  box-shadow: 0 0 30px rgba(255, 60, 0, 0.55);
}

.drift-btn__text {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.18em;
}

@media (max-width: 640px) {
  .hud {
    padding: 18px 20px;
  }
  .hud-value {
    font-size: 30px;
  }
  .logo {
    font-size: 18px;
  }
  .overlay__title {
    font-size: 36px;
  }
  .overlay__panel {
    padding: 32px 24px;
  }
}
