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

body {
  background: #050510;
  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, 180, 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: #38bdf8;
}

#game-container {
  position: relative;
  width: min(100vw, 480px);
  aspect-ratio: 3 / 4;
  max-height: 100vh;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 0 60px rgba(120, 80, 255, 0.3),
    0 0 120px rgba(0, 200, 255, 0.15),
    inset 0 0 80px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(150, 120, 255, 0.25);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #0a0a1a;
  cursor: none;
}

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

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

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

#score, #best, #level, #power {
  font-size: 1rem;
  font-weight: 700;
  color: #e0f0ff;
  text-shadow: 0 0 10px rgba(100, 200, 255, 0.8);
}

.hud-arms {
  min-width: 5.5rem;
}

#power {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: #fde047;
  text-shadow: 0 0 10px rgba(253, 224, 71, 0.8);
  white-space: nowrap;
}

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

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

#overlay.visible {
  opacity: 1;
}

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

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

.subtitle {
  color: rgba(180, 200, 255, 0.7);
  font-size: 0.75rem;
  margin-bottom: 24px;
  letter-spacing: 0.05em;
}

.controls-hint {
  color: rgba(150, 170, 220, 0.6);
  font-size: 0.65rem;
  line-height: 2;
  margin-bottom: 28px;
}

kbd {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(80, 100, 180, 0.2);
  border: 1px solid rgba(120, 150, 255, 0.3);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.6rem;
}

button {
  font-family: 'Orbitron', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 14px 40px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: white;
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.5);
  transition: transform 0.15s, box-shadow 0.15s;
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(124, 58, 237, 0.7);
}

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

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

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