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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1a2e;
  font-family: 'Segoe UI', 'Arial Black', Arial, sans-serif;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Overlays */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.overlay.hidden {
  display: none;
}

/* Title Screen */
#title-screen {
  background: rgba(0, 0, 0, 0.6);
}

.title-content {
  text-align: center;
  color: #fff;
}

.game-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1.1;
  color: #ffd700;
  text-shadow:
    3px 3px 0 #ff6b35,
    6px 6px 0 rgba(0,0,0,0.4),
    0 0 40px rgba(255, 215, 0, 0.5);
  margin-bottom: 0.3em;
}

.title-subtitle {
  font-size: clamp(1rem, 3vw, 1.4rem);
  color: #e0e0e0;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  margin-bottom: 2em;
  letter-spacing: 0.1em;
}

.btn-primary {
  display: inline-block;
  padding: 0.8em 2.5em;
  font-size: clamp(1.2rem, 3.5vw, 1.8rem);
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #ff6b35, #ff3e6c);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  box-shadow: 0 6px 24px rgba(255, 62, 108, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 32px rgba(255, 62, 108, 0.7);
}

.btn-primary:active {
  transform: scale(0.96);
}

/* Controls Hint */
.controls-hint {
  margin-top: 2em;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  font-size: 0.85rem;
  color: #aaa;
}

.hint-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6em;
}

.key-icon {
  display: inline-block;
  background: rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 0.2em 0.5em;
  font-size: 0.85em;
  color: #ddd;
  min-width: 4em;
  text-align: center;
}

.hint-label {
  color: #999;
}

/* Game Over */
#gameover-screen {
  background: rgba(0, 0, 0, 0.75);
}

.gameover-content {
  text-align: center;
  color: #fff;
}

.gameover-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  color: #ff4444;
  text-shadow:
    2px 2px 0 #cc0000,
    0 0 30px rgba(255, 68, 68, 0.5);
  margin-bottom: 1em;
  letter-spacing: 0.05em;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(280px, 70vw);
  margin: 0 auto 0.8em;
  padding: 0.5em 1em;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
}

.stat-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #aaa;
  letter-spacing: 0.1em;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 900;
  color: #ffd700;
}

#gameover-screen .btn-primary {
  margin-top: 1.5em;
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 5;
  pointer-events: none;
}

#hud.hidden {
  display: none;
}

#score-display {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

#coins-display {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffd700;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

.coin-icon {
  color: #ffd700;
  font-size: 1.1em;
}

#powerup-indicators {
  display: flex;
  gap: 6px;
}

.powerup-indicator {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  transition: opacity 0.2s ease;
}

.powerup-indicator.hidden {
  opacity: 0;
}

#indicator-magnet {
  background: #2196F3;
  box-shadow: 0 0 12px rgba(33,150,243,0.6);
}

#indicator-shield {
  background: #00BCD4;
  box-shadow: 0 0 12px rgba(0,188,212,0.6);
}

#indicator-2x {
  background: #FF9800;
  box-shadow: 0 0 12px rgba(255,152,0,0.6);
}

/* Mobile hint visibility */
@media (min-width: 769px) {
  .mobile-only {
    display: none;
  }
}
