:root {
  --bg-deep: #0a0f1e;
  --bg-panel: rgba(12, 20, 40, 0.82);
  --c-cyan: #00e5ff;
  --c-magenta: #ff2a9d;
  --c-gold: #ffd166;
  --c-violet: #b14aed;
  --c-ice: #e6f7ff;
  --c-dim: rgba(230, 247, 255, 0.55);
  --c-frost: rgba(180, 220, 255, 0.12);
  --glow-cyan: 0 0 24px rgba(0, 229, 255, 0.55), 0 0 56px rgba(0, 229, 255, 0.22);
  --glow-magenta: 0 0 24px rgba(255, 42, 157, 0.55), 0 0 56px rgba(255, 42, 157, 0.22);
  --glow-gold: 0 0 24px rgba(255, 209, 102, 0.55), 0 0 56px rgba(255, 209, 102, 0.22);
  --glow-violet: 0 0 24px rgba(177, 74, 237, 0.55), 0 0 56px rgba(177, 74, 237, 0.22);
  --font-display: "Cinzel Decorative", Georgia, serif;
  --font-body: "Nunito", system-ui, sans-serif;
  --radius: 20px;
}

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

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  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;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: radial-gradient(circle at 50% 45%, transparent 15%, rgba(6, 10, 22, 0.85) 100%);
}

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

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

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

.hud-block--center {
  grid-column: 2;
  align-items: center;
}

.hud-block--best {
  grid-column: 3;
  grid-row: 2;
  align-items: flex-end;
}

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

.hud-value {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  color: var(--c-ice);
  text-shadow: 0 0 18px rgba(230, 247, 255, 0.35);
}

.hud-value--dim {
  color: var(--c-dim);
  text-shadow: none;
  font-size: 22px;
}

.logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--c-ice);
  text-shadow: 0 0 18px rgba(230, 247, 255, 0.3), 0 0 36px rgba(0, 229, 255, 0.18);
}

.logo-sub {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.35em;
  color: var(--c-cyan);
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
  margin-top: 2px;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(10, 18, 38, 0.6) 0%, rgba(6, 10, 22, 0.94) 100%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 380ms ease, visibility 380ms ease;
  backdrop-filter: blur(6px);
}

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

.overlay__panel {
  width: min(520px, 90vw);
  padding: 48px 42px;
  border: 1px solid rgba(0, 229, 255, 0.28);
  border-radius: var(--radius);
  background: var(--bg-panel);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 60px rgba(0, 229, 255, 0.1), inset 0 0 60px rgba(0, 229, 255, 0.04);
  text-align: center;
  transform: translateY(16px) scale(0.98);
  transition: transform 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

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

.overlay__title {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 6px;
  color: var(--c-ice);
  text-shadow: 0 0 22px rgba(230, 247, 255, 0.25);
}

.overlay__subtitle {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.45em;
  color: var(--c-cyan);
  text-shadow: 0 0 14px rgba(0, 229, 255, 0.35);
  margin-bottom: 22px;
}

.overlay__copy {
  font-size: 17px;
  line-height: 1.55;
  color: var(--c-dim);
  margin-bottom: 28px;
}

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

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

kbd {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  background: rgba(0, 229, 255, 0.08);
  color: var(--c-cyan);
}

.ice-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 18px 46px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.18), rgba(177, 74, 237, 0.18));
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.42), 0 0 24px rgba(0, 229, 255, 0.25);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.ice-btn--secondary {
  background: linear-gradient(135deg, rgba(255, 42, 157, 0.16), rgba(177, 74, 237, 0.16));
  box-shadow: 0 0 0 1px rgba(255, 42, 157, 0.42), 0 0 24px rgba(255, 42, 157, 0.2);
}

.ice-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.7), 0 0 36px rgba(0, 229, 255, 0.4);
}

.ice-btn--secondary:hover {
  box-shadow: 0 0 0 1px rgba(255, 42, 157, 0.7), 0 0 36px rgba(255, 42, 157, 0.35);
}

.ice-btn__text {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--c-ice);
}

@media (max-width: 640px) {
  .hud {
    padding: 16px 18px;
    gap: 6px 14px;
  }
  .hud-value {
    font-size: 26px;
  }
  .hud-value--dim {
    font-size: 18px;
  }
  .logo {
    font-size: 16px;
  }
  .logo-sub {
    font-size: 9px;
    letter-spacing: 0.28em;
  }
  .overlay__title {
    font-size: 34px;
  }
  .overlay__subtitle {
    font-size: 15px;
  }
  .overlay__panel {
    padding: 36px 24px;
  }
}
