*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #1a1f2e;
  color: #e8ecf4;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
}

#game-root {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

#game-root:focus-visible {
  box-shadow: inset 0 0 0 3px #5b8cff;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  background: #87ceeb;
  cursor: default;
}

#hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  font-size: clamp(14px, 2.5vw, 18px);
  font-weight: 600;
}

#score-row,
#high-row {
  display: flex;
  gap: 0.5em;
  align-items: baseline;
}

#high-row {
  opacity: 0.85;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  background: rgba(15, 18, 28, 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.overlay h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 700;
}

.overlay .hint {
  margin: 0.5rem 0;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
}

.overlay .sub {
  margin: 1rem 0 0;
  max-width: 22rem;
  font-size: 0.95rem;
  line-height: 1.45;
  opacity: 0.9;
}

.final-score {
  margin: 0 0 0.75rem;
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  font-weight: 600;
  opacity: 0.95;
}

kbd {
  display: inline-block;
  padding: 0.15em 0.45em;
  font-family: inherit;
  font-size: 0.9em;
  background: #2a3145;
  border: 1px solid #4a5570;
  border-radius: 4px;
  box-shadow: 0 2px 0 #0d1018;
}
