/* ===================================================
   ARENA SURVIVAL — style.css
   Dark neon gaming aesthetic
=================================================== */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@400;600&display=swap');

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --neon-red:    #ff2244;
  --neon-gold:   #ffd700;
  --neon-cyan:   #00e5ff;
  --neon-green:  #39ff14;
  --neon-purple: #bf5fff;
  --bg-dark:     #050810;
  --bg-card:     rgba(255,255,255,0.04);
  --border:      rgba(0,229,255,0.2);
  --font-hud:    'Orbitron', monospace;
  --font-body:   'Rajdhani', sans-serif;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: #fff;
  font-family: var(--font-body);
  font-size: 16px;
}

/* ===== SCREEN SYSTEM ===== */
.screen {
  position: fixed; inset: 0;
  display: none;
  overflow: hidden;
}
.screen.active { display: flex; }
.hidden { display: none !important; }

/* ===================================================
   HOME SCREEN
=================================================== */
#screen-home {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
}

/* Animated grid background */
.home-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    linear-gradient(rgba(0,229,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridMove 20s linear infinite;
}
@keyframes gridMove {
  from { background-position: 0 0; }
  to   { background-position: 40px 40px; }
}
.scanlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.15) 2px,
    rgba(0,0,0,0.15) 4px
  );
  pointer-events: none;
}

/* Particle canvas */
.particle-field {
  position: absolute; inset: 0; z-index: 1;
  pointer-events: none;
}

/* Content */
.home-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; gap: 28px;
  text-align: center;
  padding: 20px;
}

/* Logo */
.logo-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.logo-sub {
  font-family: var(--font-hud);
  font-size: 11px; letter-spacing: 6px;
  color: var(--neon-cyan);
  opacity: 0.7;
  animation: pulse 3s ease-in-out infinite;
}
.logo-title {
  font-family: var(--font-hud);
  font-size: clamp(48px, 10vw, 96px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: 4px;
  color: #fff;
  text-shadow:
    0 0 20px var(--neon-cyan),
    0 0 60px rgba(0,229,255,0.3);
}
.logo-title span {
  color: var(--neon-red);
  text-shadow:
    0 0 20px var(--neon-red),
    0 0 60px rgba(255,34,68,0.4);
}
.logo-tagline {
  font-family: var(--font-hud);
  font-size: 12px; letter-spacing: 8px;
  color: var(--neon-gold);
  margin-top: 8px;
}

/* Stats bar */
.home-stats-bar {
  display: flex; gap: 16px;
}
.stat-pill {
  background: rgba(255,215,0,0.08);
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: 20px;
  padding: 6px 16px;
  font-family: var(--font-hud);
  font-size: 12px;
  color: var(--neon-gold);
}

/* Nav buttons */
.home-nav { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.home-nav-row { display: flex; gap: 12px; }

.btn-play {
  position: relative;
  font-family: var(--font-hud);
  font-size: 22px; font-weight: 700;
  letter-spacing: 4px;
  color: var(--bg-dark);
  background: var(--neon-red);
  border: none; border-radius: 4px;
  padding: 18px 60px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 0 30px rgba(255,34,68,0.6), 0 0 60px rgba(255,34,68,0.2);
}
.btn-play:hover {
  transform: scale(1.04);
  box-shadow: 0 0 50px rgba(255,34,68,0.9), 0 0 100px rgba(255,34,68,0.3);
}
.btn-play:active { transform: scale(0.97); }
.btn-glow {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: translateX(-100%);
  animation: shimmer 2.5s ease-in-out infinite;
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  50%, 100% { transform: translateX(100%); }
}

.btn-secondary {
  font-family: var(--font-hud);
  font-size: 13px; letter-spacing: 2px;
  color: var(--neon-cyan);
  background: rgba(0,229,255,0.06);
  border: 1px solid var(--neon-cyan);
  border-radius: 4px;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover {
  background: rgba(0,229,255,0.15);
  box-shadow: 0 0 20px rgba(0,229,255,0.3);
}

.home-version {
  font-size: 11px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 2px;
}

/* ===================================================
   SHOP SCREEN
=================================================== */
#screen-shop {
  align-items: flex-start;
  justify-content: center;
  background: var(--bg-dark);
}
.shop-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(191,95,255,0.08) 0%, transparent 60%);
}
.shop-wrap {
  position: relative; z-index: 1;
  width: 100%; max-width: 900px;
  padding: 30px 20px;
  overflow-y: auto; height: 100vh;
}
.shop-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.shop-title {
  font-family: var(--font-hud);
  font-size: 24px; font-weight: 700;
  color: var(--neon-purple);
  text-shadow: 0 0 20px var(--neon-purple);
}
.shop-gold-display {
  font-family: var(--font-hud);
  font-size: 18px;
  color: var(--neon-gold);
}
.btn-back {
  font-family: var(--font-hud);
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  background: none; border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-back:hover { color: #fff; border-color: #fff; }

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* Shop card */
.shop-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.shop-card:hover {
  border-color: rgba(0,229,255,0.5);
  box-shadow: 0 0 20px rgba(0,229,255,0.1);
}
.shop-card.maxed { border-color: rgba(255,215,0,0.4); }
.sc-header { display: flex; align-items: center; gap: 10px; }
.sc-icon { font-size: 28px; }
.sc-name {
  font-family: var(--font-hud);
  font-size: 14px; font-weight: 700;
  color: #fff;
}
.sc-level {
  font-size: 12px;
  color: var(--neon-cyan);
  font-family: var(--font-hud);
}
.sc-desc { font-size: 13px; color: rgba(255,255,255,0.5); line-height: 1.4; }
.sc-effect { font-size: 12px; color: var(--neon-green); font-family: var(--font-hud); }
.sc-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.sc-cost {
  font-family: var(--font-hud);
  font-size: 14px;
  color: var(--neon-gold);
}
.sc-buy {
  font-family: var(--font-hud);
  font-size: 11px; letter-spacing: 1px;
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid var(--neon-gold);
  background: rgba(255,215,0,0.08);
  color: var(--neon-gold);
  cursor: pointer;
  transition: all 0.2s;
}
.sc-buy:hover:not(:disabled) {
  background: rgba(255,215,0,0.2);
  box-shadow: 0 0 15px rgba(255,215,0,0.3);
}
.sc-buy:disabled { opacity: 0.3; cursor: not-allowed; }
.sc-buy.maxed-btn {
  color: var(--neon-gold);
  border-color: var(--neon-gold);
  opacity: 1;
  cursor: default;
}

/* Progress bars */
.sc-progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}
.sc-progress-fill {
  height: 100%;
  background: var(--neon-cyan);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ===================================================
   HOW TO PLAY
=================================================== */
#screen-howto {
  align-items: flex-start;
  justify-content: center;
  background: var(--bg-dark);
  overflow-y: auto;
}
.howto-wrap {
  max-width: 800px;
  width: 100%;
  padding: 30px 20px;
  display: flex; flex-direction: column; gap: 24px;
}
.howto-title {
  font-family: var(--font-hud);
  font-size: 28px; font-weight: 700;
  color: var(--neon-cyan);
  text-align: center;
  margin-top: 10px;
}
.howto-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.howto-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.howto-icon { font-size: 32px; }
.howto-card h3 {
  font-family: var(--font-hud);
  font-size: 13px; color: var(--neon-cyan);
}
.howto-card p { font-size: 13px; color: rgba(255,255,255,0.6); line-height: 1.5; }

.howto-types h3 {
  font-family: var(--font-hud);
  font-size: 16px; color: var(--neon-gold);
  margin-bottom: 12px;
}
.enemy-legend { display: flex; flex-wrap: wrap; gap: 12px; }
.el-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px;
}
.el-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
}

/* ===================================================
   GAME SCREEN
=================================================== */
#screen-game {
  flex-direction: column;
  background: #0a0d12;
}

/* HUD */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px 8px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
  gap: 12px;
}
.hud-left, .hud-right {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 120px;
}
.hud-right { align-items: flex-end; }
.hud-stat {
  font-family: var(--font-hud);
  font-size: 13px;
  color: rgba(255,255,255,0.9);
}
.hud-hp-bar {
  width: 120px; height: 5px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px; overflow: hidden;
}
#hp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-green), #27ae60);
  border-radius: 3px;
  transition: width 0.2s, background 0.3s;
}
#hp-fill.low  { background: var(--neon-gold); }
#hp-fill.crit { background: var(--neon-red); }
.kills-stat { color: rgba(255,255,255,0.5); }

.hud-center { text-align: center; }
.wave-display {
  font-family: var(--font-hud);
  font-size: 20px; font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 15px var(--neon-cyan);
}
.wave-subtitle {
  font-family: var(--font-hud);
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2px;
}

/* Canvas */
#game-canvas {
  display: block;
  width: 100%; height: 100%;
}

/* Pause overlay */
#pause-overlay {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.pause-box {
  background: rgba(5,8,16,0.95);
  border: 1px solid var(--neon-cyan);
  border-radius: 10px;
  padding: 40px 50px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  box-shadow: 0 0 40px rgba(0,229,255,0.2);
}
.pause-box h2 {
  font-family: var(--font-hud);
  font-size: 28px; color: var(--neon-cyan);
  margin-bottom: 10px;
}

/* Wave banner */
#wave-banner {
  position: absolute; inset: 0; z-index: 15;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.wave-banner-inner {
  text-align: center;
  animation: wbSlide 2.5s ease-in-out forwards;
}
@keyframes wbSlide {
  0%   { opacity: 0; transform: scale(0.7); }
  20%  { opacity: 1; transform: scale(1.05); }
  70%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.1); }
}
.wb-wave {
  font-family: var(--font-hud);
  font-size: clamp(36px, 8vw, 72px); font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: 0 0 40px var(--neon-cyan);
  letter-spacing: 6px;
}
.wb-sub {
  font-family: var(--font-hud);
  font-size: 16px; letter-spacing: 8px;
  color: var(--neon-red);
  margin-top: 6px;
}

/* Damage numbers */
#dmg-numbers {
  position: absolute; inset: 0; z-index: 12;
  pointer-events: none;
}
.dmg-num {
  position: absolute;
  font-family: var(--font-hud);
  font-weight: 700;
  pointer-events: none;
  animation: dmgFloat 0.9s ease-out forwards;
  transform: translateX(-50%);
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}
@keyframes dmgFloat {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  50%  { opacity: 1; transform: translateX(-50%) translateY(-30px) scale(1.1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-55px) scale(0.8); }
}

/* ===================================================
   GAME OVER SCREEN
=================================================== */
#screen-gameover {
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a0005 0%, var(--bg-dark) 70%);
}
.go-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 24px;
  text-align: center;
  padding: 20px;
}
.go-skull {
  font-size: 72px;
  animation: skullPulse 1.5s ease-in-out infinite;
}
@keyframes skullPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px #ff2244); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 30px #ff2244); }
}
.go-title {
  font-family: var(--font-hud);
  font-size: clamp(48px, 10vw, 88px); font-weight: 900;
  color: var(--neon-red);
  text-shadow: 0 0 30px var(--neon-red), 0 0 80px rgba(255,34,68,0.3);
  letter-spacing: 6px;
}
.go-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%; max-width: 420px;
}
.go-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.go-stat label {
  font-family: var(--font-hud);
  font-size: 10px; letter-spacing: 2px;
  color: rgba(255,255,255,0.4);
}
.go-stat span {
  font-family: var(--font-hud);
  font-size: 26px; font-weight: 700;
  color: var(--neon-cyan);
}
.go-btns { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

/* ===================================================
   ANIMATIONS
=================================================== */
@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ===================================================
   RESPONSIVE
=================================================== */
@media (max-width: 600px) {
  .hud-stat { font-size: 11px; }
  .wave-display { font-size: 16px; }
  .hud-hp-bar { width: 80px; }
  .shop-grid { grid-template-columns: 1fr; }
  .go-stats { grid-template-columns: 1fr 1fr; }
  .btn-play { padding: 14px 40px; font-size: 18px; }
  .home-nav-row { flex-direction: column; width: 100%; }
  .btn-secondary { width: 100%; }
}

/* Touch controls for mobile */
#touch-controls {
  position: absolute;
  bottom: 30px; left: 50%; transform: translateX(-50%);
  z-index: 11;
  display: none;
}
@media (pointer: coarse) {
  #touch-controls { display: flex; gap: 6px; }
}
.dpad {
  display: grid;
  grid-template-areas: ". up ." "left . right" ". down .";
  grid-template-columns: 44px 44px 44px;
  grid-template-rows: 44px 44px 44px;
  gap: 4px;
}
.dpad-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.dpad-btn:active { background: rgba(255,255,255,0.3); }
.dpad-up    { grid-area: up; }
.dpad-down  { grid-area: down; }
.dpad-left  { grid-area: left; }
.dpad-right { grid-area: right; }