:root {
  color-scheme: dark;
  --bg: #090a12;
  --panel: #111520;
  --panel-line: #2a3145;
  --text: #edf4ff;
  --muted: #94a1b7;
  --cyan: #25d9ff;
  --gold: #ffd24a;
  --pink: #ff4fb6;
  --green: #57f287;
  --danger: #ff6b5f;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(37, 217, 255, 0.08), transparent 42%),
    linear-gradient(180deg, #080912 0%, #0d0b17 44%, #06070c 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  width: 100vw;
  height: 100vh;
  min-width: 320px;
}

.hud {
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 12px clamp(12px, 3vw, 28px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 10, 18, 0.82);
  backdrop-filter: blur(14px);
}

.brand,
.stats {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand {
  gap: 10px;
  color: var(--text);
  font-size: clamp(0.9rem, 1.6vw, 1rem);
  font-weight: 750;
  white-space: nowrap;
}

.brand strong {
  color: var(--gold);
  font-size: 0.78em;
  letter-spacing: 0;
  text-transform: uppercase;
}

.mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--gold);
  background: linear-gradient(135deg, #ffe66d, #ff9e44);
  box-shadow: 0 0 18px rgba(255, 210, 74, 0.4);
}

.stats {
  justify-content: end;
  gap: clamp(8px, 2vw, 16px);
  color: var(--muted);
  font-size: clamp(0.72rem, 1.8vw, 0.92rem);
  font-variant-numeric: tabular-nums;
}

.stats span,
.speed-control {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--panel-line);
  border-radius: 7px;
  background: rgba(17, 21, 32, 0.72);
  white-space: nowrap;
}

.stats span.unlocked {
  color: #06130a;
  border-color: rgba(87, 242, 135, 0.65);
  background: var(--green);
}

.speed-control {
  gap: 8px;
}

.speed-control strong {
  color: var(--gold);
  font-weight: 800;
}

.speed-control input {
  width: 82px;
  accent-color: var(--gold);
  cursor: pointer;
}

.icon-button,
.primary {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  min-height: 38px;
  border: 1px solid var(--panel-line);
  border-radius: 7px;
  color: var(--text);
  background: rgba(17, 21, 32, 0.95);
  cursor: pointer;
}

.icon-button:hover,
.primary:hover {
  border-color: rgba(37, 217, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(37, 217, 255, 0.12);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(6, 7, 12, 0.72);
}

.overlay[hidden] {
  display: none;
}

.result {
  display: grid;
  gap: 14px;
  width: min(360px, 100%);
  padding: 24px;
  border: 1px solid rgba(87, 242, 135, 0.5);
  border-radius: 8px;
  background: rgba(17, 21, 32, 0.96);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.result h1,
.result p {
  margin: 0;
}

.result h1 {
  font-size: clamp(1.45rem, 5vw, 2rem);
  line-height: 1.1;
}

.result p {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.primary {
  min-height: 42px;
  color: #06130a;
  border-color: transparent;
  background: var(--green);
  font-weight: 750;
}

@media (max-width: 620px) {
  .hud {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .stats {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: stretch;
    gap: 6px;
  }

  .stats span,
  .speed-control {
    flex: 1;
    justify-content: center;
    min-width: 0;
    padding: 0 6px;
    font-size: 0.72rem;
  }

  .speed-control {
    gap: 5px;
  }

  .speed-control input {
    width: min(76px, 26vw);
  }
}
