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

body {
  background: #0a1020;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', monospace;
  overflow: hidden;
}

.back-link {
  position: fixed;
  top: 16px;
  left: 16px;
  color: rgba(150, 200, 255, 0.6);
  font-size: 0.7rem;
  text-decoration: none;
  letter-spacing: 0.05em;
  z-index: 100;
  transition: color 0.2s;
}

.back-link:hover {
  color: #fbbf24;
}

#game-container {
  position: relative;
  width: min(100vw, 400px);
  aspect-ratio: 9 / 16;
  max-height: 92vh;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(120, 180, 255, 0.2);
  box-shadow:
    0 0 50px rgba(56, 189, 248, 0.2),
    0 0 80px rgba(251, 191, 36, 0.08);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #1a3050;
  cursor: pointer;
  touch-action: manipulation;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
  pointer-events: none;
  z-index: 10;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-label {
  font-size: 0.5rem;
  letter-spacing: 0.15em;
  color: rgba(150, 190, 255, 0.55);
}

#score, #best {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fef3c7;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.7);
}

#overlay, #gameover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(8, 16, 32, 0.85);
  backdrop-filter: blur(6px);
  z-index: 20;
  text-align: center;
  padding: 24px;
  transition: opacity 0.35s ease;
}

#overlay.hidden, #gameover.hidden {
  opacity: 0;
  pointer-events: none;
}

#overlay.visible {
  opacity: 1;
}

h1 {
  font-size: clamp(1.3rem, 5vw, 1.7rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  background: linear-gradient(135deg, #fbbf24, #38bdf8, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}

h2 {
  font-size: 1.4rem;
  color: #f87171;
  text-shadow: 0 0 18px rgba(248, 113, 113, 0.5);
  margin-bottom: 12px;
  letter-spacing: 0.1em;
}

.subtitle {
  color: rgba(180, 210, 255, 0.7);
  font-size: 0.7rem;
  margin-bottom: 22px;
  line-height: 1.5;
}

.controls-hint {
  color: rgba(150, 180, 220, 0.55);
  font-size: 0.62rem;
  margin-bottom: 26px;
}

kbd {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(60, 100, 160, 0.2);
  border: 1px solid rgba(120, 170, 255, 0.25);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.55rem;
}

button {
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 14px 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: white;
  box-shadow: 0 0 28px rgba(245, 158, 11, 0.45);
  transition: transform 0.15s, box-shadow 0.15s;
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 38px rgba(245, 158, 11, 0.6);
}

button:active {
  transform: scale(0.97);
}

#gameover p {
  color: rgba(200, 220, 255, 0.75);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

#final-score {
  color: #fbbf24;
  font-weight: 700;
}
