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

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

body {
  background: #000;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Russo One', sans-serif;
}

#game-container { width: 100vw; height: 100vh; position: relative; }
canvas { display: block; }

/* ─── HUD ─── */
#hud {
  position: absolute; top: 0; left: 0; width: 100%;
  padding: 10px 16px; display: none; justify-content: space-between;
  align-items: flex-start; pointer-events: none; z-index: 10; gap: 8px;
}
.hud-item {
  background: rgba(0,0,0,0.55); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 6px 14px; border-radius: 20px;
  color: #fff; font-size: 13px;
  font-family: 'Orbitron', sans-serif; font-weight: 700;
  text-shadow: 0 0 8px rgba(68,170,255,0.4);
  letter-spacing: 1px; white-space: nowrap;
}
#hud-weapon {
  border-color: rgba(255,200,0,0.3);
  text-shadow: 0 0 8px rgba(255,200,0,0.4);
}

/* ─── Weapon timer ─── */
#weapon-timer-bar {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  width: 200px; height: 5px; background: rgba(0,0,0,0.5);
  border-radius: 10px; pointer-events: none; z-index: 10; display: none;
  border: 1px solid rgba(255,255,255,0.1);
}
#weapon-timer-fill { height: 100%; width: 100%; border-radius: 10px; transition: width 0.1s linear; }

/* ─── Progress bar ─── */
#progress-bar-container {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  width: 240px; height: 6px; background: rgba(0,0,0,0.5);
  border-radius: 10px; pointer-events: none; z-index: 10;
  border: 1px solid rgba(255,255,255,0.1); display: none;
}
#progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #4af, #48f);
  border-radius: 10px; box-shadow: 0 0 8px rgba(68,170,255,0.4);
}
#progress-boss { position: absolute; right: -12px; top: -10px; font-size: 16px; }

/* ─── Screen overlays ─── */
.screen-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; justify-content: center;
  align-items: center; z-index: 20; pointer-events: auto;
}
#start-screen { background: linear-gradient(180deg, rgba(0,10,30,0.92), rgba(0,5,20,0.96)); }
#start-screen h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(30px, 7vw, 52px); font-weight: 900;
  background: linear-gradient(135deg, #4af, #48f, #8bf);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(68,170,255,0.4));
  margin-bottom: 6px;
}
.subtitle {
  color: rgba(255,255,255,0.45); font-size: 13px;
  letter-spacing: 3px; text-transform: uppercase; margin-bottom: 40px;
}

/* ─── Buttons ─── */
.btn {
  font-family: 'Orbitron', sans-serif;
  background: linear-gradient(135deg, #4af, #38f);
  color: #fff; border: none; padding: 16px 50px;
  font-size: 17px; font-weight: 700; border-radius: 50px;
  cursor: pointer; letter-spacing: 2px;
  box-shadow: 0 0 40px rgba(68,170,255,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all 0.2s;
}
.btn:hover { transform: scale(1.05); box-shadow: 0 0 60px rgba(68,170,255,0.5); }
.btn:active { transform: scale(0.97); }
.btn-red { background: linear-gradient(135deg, #f55, #d33); box-shadow: 0 0 40px rgba(255,80,80,0.3); }
.btn-green { background: linear-gradient(135deg, #5f5, #3b3); box-shadow: 0 0 40px rgba(80,255,80,0.3); }
.btn-gold { background: linear-gradient(135deg, #fc0, #e90); box-shadow: 0 0 40px rgba(255,200,0,0.3); color: #000; }
.btn-gold:hover { box-shadow: 0 0 60px rgba(255,200,0,0.5); }

.controls-hint { color: rgba(255,255,255,0.25); font-size: 11px; margin-top: 20px; letter-spacing: 1px; }

/* ─── Game over / Win ─── */
#gameover-screen, #win-screen, #highscore-screen { background: rgba(0,5,15,0.9); display: none; }
#gameover-screen h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(28px, 6vw, 46px); font-weight: 900;
  color: #f44; filter: drop-shadow(0 0 20px rgba(255,60,60,0.4));
}
#win-screen h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(28px, 6vw, 46px); font-weight: 900;
  color: #4f4; filter: drop-shadow(0 0 20px rgba(60,255,60,0.4));
}
.score-text {
  font-family: 'Orbitron', sans-serif;
  color: #fff; font-size: 16px; margin: 14px 0 32px; letter-spacing: 1px;
}

/* ─── Banners ─── */
#level-banner {
  position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%);
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(26px, 6vw, 42px); font-weight: 900;
  color: #fff; text-shadow: 0 0 40px rgba(255,255,255,0.5);
  opacity: 0; pointer-events: none; z-index: 15;
  transition: opacity 0.4s; letter-spacing: 3px;
}
#weapon-banner {
  position: absolute; top: 55%; left: 50%; transform: translate(-50%, -50%);
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(18px, 4vw, 28px); font-weight: 700;
  opacity: 0; pointer-events: none; z-index: 15;
  transition: opacity 0.3s; letter-spacing: 2px;
}

/* ─── Effects ─── */
#damage-flash {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255,0,0,0.3));
  opacity: 0; pointer-events: none; z-index: 5; transition: opacity 0.15s;
}
#shield-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(ellipse at 50% 80%, rgba(0,150,255,0.15), transparent 60%);
  opacity: 0; pointer-events: none; z-index: 4; transition: opacity 0.3s;
}

/* ─── Music toggle ─── */
#music-toggle {
  position: absolute; bottom: 16px; right: 16px; z-index: 25;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff; font-size: 20px; width: 44px; height: 44px;
  border-radius: 50%; cursor: pointer; display: none;
  align-items: center; justify-content: center;
  transition: all 0.2s; padding: 0; line-height: 1;
}
#music-toggle:hover { background: rgba(68,170,255,0.3); transform: scale(1.1); }
#music-toggle:active { transform: scale(0.95); }

/* ─── Quit button ─── */
#quit-btn {
  position: absolute; top: 46px; right: 16px; z-index: 25;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff; font-family: 'Orbitron', sans-serif;
  font-size: 11px; font-weight: 700;
  padding: 6px 14px; border-radius: 20px;
  cursor: pointer; display: none; letter-spacing: 1px;
  transition: all 0.2s; pointer-events: auto;
}
#quit-btn:hover { background: rgba(255,60,60,0.4); border-color: rgba(255,60,60,0.5); }
#quit-btn:active { transform: scale(0.95); }

/* ─── Highscores ─── */
#highscore-screen {
  background: linear-gradient(180deg, rgba(0,10,30,0.95), rgba(0,5,20,0.98));
  display: none;
}
#highscore-screen h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(22px, 5vw, 36px); font-weight: 900;
  background: linear-gradient(135deg, #fc0, #f90, #ff6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(255,200,0,0.4));
  margin-bottom: 20px;
}
.hs-table { width: min(340px, 85vw); border-collapse: collapse; margin-bottom: 24px; }
.hs-table th {
  font-family: 'Orbitron', sans-serif; font-size: 11px;
  color: rgba(255,255,255,0.4); text-transform: uppercase;
  letter-spacing: 2px; padding: 4px 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.hs-table td {
  font-family: 'Orbitron', sans-serif; font-size: 14px;
  color: #fff; padding: 7px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05); text-align: center;
}
.hs-table td:first-child { color: rgba(255,255,255,0.35); width: 30px; }
.hs-table td:nth-child(2) { text-align: left; color: #4af; }
.hs-table td:nth-child(3) { color: #fc0; text-align: right; }
.hs-table td:nth-child(4) { color: rgba(255,255,255,0.35); text-align: right; font-size: 11px; }
.hs-row-highlight td { color: #fff !important; text-shadow: 0 0 10px rgba(68,170,255,0.6); }
.hs-row-highlight td:nth-child(2) { color: #4af !important; }
.hs-row-highlight td:nth-child(3) { color: #fc0 !important; text-shadow: 0 0 10px rgba(255,200,0,0.5); }
.hs-empty {
  color: rgba(255,255,255,0.2); font-family: 'Orbitron', sans-serif;
  font-size: 12px; letter-spacing: 1px; margin-bottom: 24px;
}

/* ─── Name modal ─── */
#name-modal {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,5,15,0.92); display: none;
  flex-direction: column; justify-content: center; align-items: center;
  z-index: 30; pointer-events: auto;
}
#name-modal h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(18px, 4vw, 28px); font-weight: 900;
  color: #fc0; filter: drop-shadow(0 0 15px rgba(255,200,0,0.3));
  margin-bottom: 6px;
}
#name-modal .score-text { margin-bottom: 20px; }
#name-input {
  font-family: 'Orbitron', sans-serif; font-size: 18px; font-weight: 700;
  text-align: center; background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,200,0,0.4); color: #fff;
  padding: 12px 20px; border-radius: 12px; width: min(260px, 70vw);
  letter-spacing: 3px; outline: none; text-transform: uppercase;
  caret-color: #fc0;
}
#name-input:focus { border-color: #fc0; box-shadow: 0 0 20px rgba(255,200,0,0.2); }
#name-input::placeholder { color: rgba(255,255,255,0.2); text-transform: none; letter-spacing: 1px; }

.hs-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
