:root {
  --night-top: #091126;
  --night-bottom: #162f59;
  --overlay: rgba(5, 10, 19, 0.56);
  --hud-bg: rgba(8, 16, 30, 0.56);
  --hud-border: rgba(255, 255, 255, 0.2);
  --ink: #f3f7ff;
  --accent: #ffe171;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  display: block;
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.2), transparent 35%),
    radial-gradient(circle at 75% 12%, rgba(255, 255, 255, 0.16), transparent 26%),
    linear-gradient(165deg, var(--night-top), var(--night-bottom));
  color: var(--ink);
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  touch-action: none;
}

.game-page {
  width: 100vw;
  height: 100vh;
  padding: 0;
}

.game-shell {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  touch-action: none;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background: linear-gradient(#0b1a33, #1e4677);
}

.hud {
  position: absolute;
  top: 14px;
  z-index: 4;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--hud-border);
  background: var(--hud-bg);
  color: #ffffff;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0.3px;
  user-select: none;
}

.hud-score {
  left: 14px;
}

.hud-timer {
  right: 14px;
}

#scoreValue,
#timerValue {
  color: var(--accent);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
  background: var(--overlay);
  color: #ffffff;
  user-select: none;
}

.overlay h1 {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  line-height: 1.05;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.overlay p {
  margin: 0;
  max-width: 34ch;
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  color: rgba(242, 248, 255, 0.95);
}

button {
  margin-top: 8px;
  border: 0;
  border-radius: 999px;
  padding: 11px 20px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #0b1934;
  background: linear-gradient(180deg, #fff5bd, #ffd446);
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.34);
}

button:hover {
  filter: brightness(1.04);
}

button:active {
  transform: translateY(1px);
}

.hidden {
  display: none;
}

@media (max-width: 760px) {
  .hud {
    top: max(12px, env(safe-area-inset-top));
  }

  .hud-score {
    left: max(12px, env(safe-area-inset-left));
  }

  .hud-timer {
    right: max(12px, env(safe-area-inset-right));
  }
}