@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Rajdhani:wght@500;700&display=swap');

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #06061a;
  font-family: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#game-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---- HUD ---- */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: env(safe-area-inset-top, 10px) 14px 0 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
}

#hud.hidden { display: none; }

#hud-left, #hud-right {
  flex: 0 0 auto;
  padding-top: 4px;
}

#hud-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
}

#score-display {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 10px;
  padding: 4px 14px;
  min-width: 60px;
  text-align: center;
}

#score {
  color: #fff;
  font-family: 'Orbitron', monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

/* ---- Progress Bar (centered at top like real game) ---- */
#progress-bar {
  width: 100%;
  max-width: 220px;
  height: 6px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #fff, #e0e8ff);
  border-radius: 3px;
  transition: width 0.1s linear;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

#theme-badge {
  background: rgba(60, 120, 60, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 2px 14px;
}

#theme-name {
  color: #fff;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

#coin-display {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 10px;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

#coin-display::before {
  content: "\1F4B0";
  font-size: 14px;
}

#coins {
  color: #ffd740;
  font-family: 'Orbitron', monospace;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.3);
}

/* ---- Screens ---- */
#start-screen,
#over-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#start-screen {
  background: radial-gradient(ellipse at 50% 40%, #0d1033 0%, #06061a 60%, #020208 100%);
}

#over-screen {
  background: rgba(6, 6, 26, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hidden { display: none !important; }

.screen-content {
  text-align: center;
  padding: 40px 30px;
  max-width: 420px;
  width: 90%;
}

.logo-glow {
  margin-bottom: 24px;
}

#start-screen h1 {
  font-family: 'Orbitron', monospace;
  color: #fff;
  font-size: 56px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 6px;
  text-shadow:
    0 0 20px rgba(0, 229, 255, 0.6),
    0 0 40px rgba(0, 229, 255, 0.3),
    0 0 80px rgba(0, 229, 255, 0.15);
}

.subtitle {
  color: rgba(255, 255, 255, 0.45);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 1px;
  margin-bottom: 36px;
}

.controls-hint {
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 28px;
}

#over-screen h2 {
  font-family: 'Orbitron', monospace;
  color: #FF1744;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 6px;
  margin-bottom: 16px;
  text-shadow: 0 0 20px rgba(255, 23, 68, 0.5);
}

#final-score {
  font-family: 'Orbitron', monospace;
  color: #fff;
  font-size: 52px;
  font-weight: 900;
  margin-bottom: 6px;
  text-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
}

#best-score {
  color: rgba(255, 255, 255, 0.4);
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 1px;
  margin-bottom: 32px;
}

/* ---- Buttons ---- */
.game-btn {
  font-family: 'Orbitron', monospace;
  background: linear-gradient(135deg, #00E5FF 0%, #00BCD4 50%, #0097A7 100%);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 15px 52px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow:
    0 0 20px rgba(0, 229, 255, 0.4),
    0 0 40px rgba(0, 229, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  pointer-events: auto;
  position: relative;
  overflow: hidden;
}

.game-btn::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.4s;
}

.game-btn:hover::before {
  transform: translateX(0);
}

.game-btn:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 30px rgba(0, 229, 255, 0.6),
    0 0 60px rgba(0, 229, 255, 0.25);
}

.game-btn:active {
  transform: scale(0.97);
}

.pulse {
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow:
      0 0 20px rgba(0, 229, 255, 0.4),
      0 0 40px rgba(0, 229, 255, 0.15);
  }
  50% {
    box-shadow:
      0 0 30px rgba(0, 229, 255, 0.7),
      0 0 60px rgba(0, 229, 255, 0.3),
      0 0 90px rgba(0, 229, 255, 0.1);
  }
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
  #start-screen h1 {
    font-size: 40px;
    letter-spacing: 4px;
  }
  #score { font-size: 18px; }
  #coins { font-size: 16px; }
  #final-score { font-size: 42px; }
  .game-btn { padding: 13px 40px; font-size: 16px; }
  #hud { padding: env(safe-area-inset-top, 8px) 10px 0 10px; }
  #progress-bar { max-width: 160px; }
}

@media (max-height: 500px) {
  .screen-content { padding: 16px; }
  #start-screen h1 { font-size: 32px; margin-bottom: 8px; }
  .subtitle { margin-bottom: 12px; }
  .controls-hint { margin-bottom: 12px; }
  .logo-glow { margin-bottom: 8px; }
}
