html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0f4f6a;
  color: #f3fbff;
  font-family: "Trebuchet MS", "Avenir Next Condensed", "Segoe UI", sans-serif;
  touch-action: none;
}

body {
  margin: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.game-shell {
  position: relative;
  width: 100%;
  height: 100%;
}

#game-canvas {
  position: absolute;
  inset: 0;
}

.hud {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 14px;
  z-index: 2;
  pointer-events: none;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(230, 245, 255, 0.82);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 0;
}

.overlay.is-hidden {
  display: none;
}

.overlay.start-mode .gameover-panel,
.overlay.gameover-mode .start-button {
  display: none;
}

.overlay.gameover-mode {
  background: rgba(4, 8, 13, 0.28);
}

.start-button {
  width: 100%;
  padding: 20px 24px;
  border: 0;
  border-radius: 0;
  background: rgba(8, 12, 16, 0.62);
  color: #ffffff;
  font: inherit;
  font-size: clamp(24px, 5vw, 34px);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: center;
}

.start-button:active {
  transform: scale(0.985);
}

.gameover-panel {
  display: grid;
  justify-items: center;
  gap: 18px;
  width: 100%;
  padding: 20px 24px 24px;
}

.gameover-title {
  margin: 0;
  width: 100%;
  padding: 18px 24px;
  background: rgba(8, 12, 16, 0.62);
  text-align: center;
  font-size: clamp(36px, 9vw, 52px);
  letter-spacing: 0.18em;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 16px;
  width: min(88vw, 400px);
}

.score-card {
  padding: 14px 12px;
  text-align: center;
}

.score-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.62);
}

.score-card strong {
  display: block;
  font-size: clamp(38px, 8vw, 48px);
}

.retry-button {
  width: 96px;
  height: 96px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  cursor: pointer;
}

.retry-icon {
  display: block;
  font-size: 44px;
  line-height: 1;
}

@media (max-width: 640px) {
  .hud {
    font-size: 13px;
  }

  .start-button {
    padding: 18px 14px;
    font-size: clamp(22px, 7vw, 28px);
  }

  .gameover-panel {
    padding: 18px 0 24px;
  }

  .retry-button {
    width: 88px;
    height: 88px;
  }
}
