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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0f;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #fff;
}

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

#game-canvas {
  display: block;
  background: #050510;
  border: 2px solid #1a1a3a;
  box-shadow: 0 0 60px rgba(0, 150, 255, 0.15), inset 0 0 100px rgba(0, 50, 100, 0.1);
}

/* Start Screen */
#start-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #0d1025 0%, #050510 70%);
  z-index: 10;
}

#start-screen h1 {
  font-size: 3.5rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #00d4ff, #7b2fff, #ff2d92);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(123, 47, 255, 0.5));
}

#start-screen .goal {
  font-size: 1.4rem;
  color: #ff6b6b;
  margin-bottom: 2rem;
  letter-spacing: 0.1em;
}

#start-screen .controls {
  font-size: 0.9rem;
  color: #6a7a9a;
  text-align: center;
  line-height: 1.8;
  margin-bottom: 2rem;
}

#start-screen .controls span {
  color: #00d4ff;
  font-weight: 600;
}

#start-screen .best-run {
  font-size: 1rem;
  color: #ffd700;
  margin-bottom: 2rem;
}

#start-screen .start-hint {
  font-size: 1.1rem;
  color: #00ff88;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  display: none;
}

#hud.visible {
  display: block;
}

.hud-top-left {
  position: absolute;
  top: 15px;
  left: 15px;
}

.hud-top-center {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.hud-bottom {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  width: 300px;
}

.stat-label {
  font-size: 0.7rem;
  color: #6a8aaa;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 3px;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

.bar-container {
  width: 200px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 3px;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.15s ease;
}

#hp-bar .bar-fill {
  background: linear-gradient(90deg, #ff4444, #ff6b6b);
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
}

#xp-bar .bar-fill {
  background: linear-gradient(90deg, #00ff88, #00d4ff);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

#boss-bar-container {
  margin-top: 8px;
  display: none;
}

#boss-bar-container.visible {
  display: block;
}

#boss-bar .bar-fill {
  background: linear-gradient(90deg, #ff2d92, #ff6b6b);
  box-shadow: 0 0 15px rgba(255, 45, 146, 0.6);
}

#boss-name {
  font-size: 0.8rem;
  color: #ff2d92;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 3px;
}

/* Upgrade Screen */
#upgrade-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 16, 0.92);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 15;
}

#upgrade-screen.visible {
  display: flex;
}

#upgrade-screen h2 {
  font-size: 2rem;
  color: #00ff88;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

#upgrade-screen .level-info {
  font-size: 1rem;
  color: #6a8aaa;
  margin-bottom: 2rem;
}

#upgrade-cards {
  display: flex;
  gap: 20px;
  pointer-events: auto;
}

.upgrade-card {
  width: 180px;
  padding: 20px;
  background: linear-gradient(145deg, #151530, #0d0d20);
  border: 2px solid #2a2a5a;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.upgrade-card:hover {
  transform: translateY(-8px);
  border-color: #00ff88;
  box-shadow: 0 10px 40px rgba(0, 255, 136, 0.3);
}

.upgrade-card .card-key {
  width: 28px;
  height: 28px;
  background: #1a1a3a;
  border: 1px solid #3a3a6a;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 0.9rem;
  color: #00d4ff;
}

.upgrade-card .card-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.upgrade-card .card-name {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}

.upgrade-card .card-desc {
  font-size: 0.75rem;
  color: #6a8aaa;
  line-height: 1.4;
}

.upgrade-card .card-level {
  margin-top: 10px;
  font-size: 0.7rem;
  color: #00ff88;
}

/* Pause Screen */
#pause-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 16, 0.85);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 15;
}

#pause-screen.visible {
  display: flex;
}

#pause-screen h2 {
  font-size: 2.5rem;
  color: #00d4ff;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  margin-bottom: 1rem;
}

#pause-screen p {
  color: #6a8aaa;
  font-size: 1rem;
}

/* Defeat / Victory Screen */
#end-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 16, 0.95);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

#end-screen.visible {
  display: flex;
}

#end-screen h2 {
  font-size: 3rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 2rem;
}

#end-screen.defeat h2 {
  color: #ff4444;
  text-shadow: 0 0 40px rgba(255, 68, 68, 0.5);
}

#end-screen.victory h2 {
  background: linear-gradient(135deg, #ffd700, #ff2d92, #00d4ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.5));
}

#end-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px 40px;
  margin-bottom: 2rem;
}

#end-stats .stat {
  text-align: center;
}

#end-stats .stat-value {
  font-size: 2rem;
  color: #00d4ff;
}

#end-stats .stat-label {
  font-size: 0.8rem;
  color: #6a8aaa;
  margin-top: 3px;
}

#restart-btn {
  padding: 15px 50px;
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  background: linear-gradient(135deg, #00d4ff, #7b2fff);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
}

#restart-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
