/* === STAR BLITZ — style.css === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold: #FFD700;
  --teal: #00E5FF;
  --teal-dim: #0097A7;
  --pink: #FF4081;
  --purple: #7C4DFF;
  --green: #69F0AE;
  --red: #FF1744;
  --white: #FFFFFF;
  --dark: #060B18;
  --panel: rgba(4, 10, 24, 0.90);
  --border: rgba(0, 229, 255, 0.28);
  --mono: 'Courier New', monospace;
  --head: 'Arial Black', 'Arial Bold', sans-serif;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  font-family: var(--mono);
  color: var(--white);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

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

#gameCanvas {
  display: block;
  image-rendering: pixelated;
  touch-action: none;
}

/* ── HUD ──────────────────────────────────────────────────────────── */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 14px;
  pointer-events: none;
  z-index: 10;
}
#hud-left, #hud-right {
  display: flex; flex-direction: column; gap: 4px; min-width: 120px;
}
#hud-right { align-items: flex-end; }
#hud-center {
  display: flex; flex-direction: column; align-items: center;
}

.stat-block { display: flex; flex-direction: column; }
.stat-label {
  font-size: 8px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--teal-dim);
}
.stat-val {
  font-size: 22px; font-weight: bold; letter-spacing: 2px;
  color: var(--gold);
  text-shadow: 0 0 8px var(--gold);
}
.stat-val.dim { font-size: 13px; color: var(--teal); text-shadow: 0 0 5px var(--teal); }
.red-label { color: var(--red) !important; }

#level-label { font-size: 8px; letter-spacing: 2px; color: var(--teal-dim); }
#level-display {
  font-size: 30px; font-weight: bold; color: var(--teal);
  text-shadow: 0 0 12px var(--teal); letter-spacing: 3px;
}

/* Boss HP bar */
#boss-hp-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; margin-top: 4px; }
#boss-hp-track {
  width: 200px; height: 9px;
  background: rgba(255,23,68,0.12); border: 1px solid var(--red);
  border-radius: 5px; overflow: hidden;
  box-shadow: 0 0 6px rgba(255,23,68,0.4);
}
#boss-hp-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #FF1744, #FF6D00, #FFD700);
  border-radius: 5px;
  transition: width 0.2s ease;
  box-shadow: 0 0 8px #FF1744;
}

/* Shield / Blitz bars */
#shield-wrap, #blitz-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
#shield-bar, #blitz-bar {
  width: 100px; height: 6px;
  background: rgba(105,240,174,0.1); border: 1px solid rgba(105,240,174,0.4);
  border-radius: 3px; overflow: hidden;
}
#shield-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--green), #00E5FF);
  border-radius: 3px; transition: width 0.25s ease;
  box-shadow: 0 0 5px var(--green);
}
#blitz-bar { border-color: rgba(255,64,129,0.5); background: rgba(255,64,129,0.08); }
#blitz-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--pink), var(--purple));
  border-radius: 3px; transition: width 0.25s ease;
  box-shadow: 0 0 5px var(--pink);
}

#sound-btn {
  font-size: 18px; background: none; border: none; cursor: pointer;
  pointer-events: all; opacity: 0.65; transition: opacity 0.2s; color: white;
}
#sound-btn:hover { opacity: 1; }

/* ── Bottom HUD ───────────────────────────────────────────────────── */
#hud-bottom {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
  pointer-events: none; z-index: 10;
}
#lives-row { display: flex; gap: 6px; align-items: center; }
#weapon-row { display: flex; flex-direction: column; align-items: center; gap: 3px; }
#laser-pips { display: flex; gap: 5px; }
.pip {
  width: 18px; height: 7px; border-radius: 2px;
  background: rgba(0,229,255,0.1); border: 1px solid rgba(0,229,255,0.25);
  transition: background 0.3s, box-shadow 0.3s;
}
.pip.on { background: var(--teal); box-shadow: 0 0 6px var(--teal); }
.pip.on.lv3 { background: #AA00FF; box-shadow: 0 0 6px #AA00FF; }
.pip.on.lv4 { background: var(--pink); box-shadow: 0 0 6px var(--pink); }
.pip.on.lv5 { background: var(--gold); box-shadow: 0 0 8px var(--gold), 0 0 16px var(--gold); }
#blitz-charge { display: flex; flex-direction: column; align-items: center; gap: 3px; }
#blitz-ready-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(255,64,129,0.2); border: 2px solid rgba(255,64,129,0.4);
  transition: background 0.3s, box-shadow 0.3s;
}
#blitz-ready-dot.ready {
  background: var(--pink); border-color: var(--pink);
  box-shadow: 0 0 12px var(--pink), 0 0 24px rgba(255,64,129,0.6);
  animation: blitzPulse 0.8s ease-in-out infinite alternate;
}
@keyframes blitzPulse {
  from { transform: scale(1); } to { transform: scale(1.3); }
}

/* ── Screens ──────────────────────────────────────────────────────── */
.screen {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  z-index: 20;
}
.screen.active { display: flex; }

.panel {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 40px 36px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 0 60px rgba(0,229,255,0.12), inset 0 0 40px rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  max-width: 560px; width: 92%; text-align: center;
}
.panel.wide { max-width: 680px; }

.title-text {
  font-family: var(--head);
  font-size: clamp(32px, 6.5vw, 56px);
  font-weight: 900; letter-spacing: 5px;
  background: linear-gradient(135deg, #00E5FF, #7C4DFF, #FFD700);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  filter: drop-shadow(0 0 22px rgba(0,229,255,0.75));
  animation: titlePulse 3s ease-in-out infinite alternate;
  text-transform: uppercase; line-height: 1.1;
}
@keyframes titlePulse {
  from { filter: drop-shadow(0 0 16px rgba(0,229,255,0.6)); }
  to   { filter: drop-shadow(0 0 30px rgba(124,77,255,0.9)) drop-shadow(0 0 50px rgba(0,229,255,0.4)); }
}
.sub-text { font-size: 12px; letter-spacing: 7px; color: var(--teal-dim); margin-top: -10px; }

.menu-wrap { display: flex; flex-direction: column; gap: 10px; width: 100%; }

.menu-btn {
  padding: 14px 32px;
  background: linear-gradient(135deg, rgba(0,229,255,0.14), rgba(124,77,255,0.08));
  border: 1px solid var(--teal); border-radius: 7px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 3px;
  color: var(--teal); cursor: pointer; text-transform: uppercase;
  transition: all 0.2s ease;
  text-shadow: 0 0 8px var(--teal);
  box-shadow: 0 0 12px rgba(0,229,255,0.1), inset 0 0 12px rgba(0,229,255,0.04);
  pointer-events: all; outline: none;
}
.menu-btn:hover, .menu-btn:focus {
  background: linear-gradient(135deg, rgba(0,229,255,0.28), rgba(124,77,255,0.18));
  box-shadow: 0 0 22px rgba(0,229,255,0.4), inset 0 0 18px rgba(0,229,255,0.1);
  transform: scale(1.02);
}
.menu-btn.secondary {
  border-color: rgba(0,229,255,0.3); color: rgba(0,229,255,0.55);
  font-size: 11px; padding: 10px 24px; text-shadow: none;
}
.menu-btn.secondary:hover { border-color: var(--teal); color: var(--teal); text-shadow: 0 0 6px var(--teal); }

.hint-text { font-size: 9px; color: rgba(0,229,255,0.35); letter-spacing: 1px; line-height: 1.9; }

.panel-title { font-family: var(--head); font-size: 22px; letter-spacing: 4px; color: var(--teal); text-shadow: 0 0 12px var(--teal); }
.how-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; text-align: left; }
.how-section h3 { font-size: 9px; letter-spacing: 3px; color: var(--pink); border-bottom: 1px solid rgba(255,64,129,0.25); padding-bottom: 4px; margin-bottom: 8px; }
.how-row { font-size: 10px; color: rgba(255,255,255,0.65); margin-bottom: 4px; line-height: 1.5; }
.kbd {
  display: inline-block; padding: 1px 5px;
  background: rgba(0,229,255,0.12); border: 1px solid rgba(0,229,255,0.35);
  border-radius: 3px; font-size: 10px; color: var(--teal); margin-right: 4px;
}

.pause-text {
  font-family: var(--head); font-size: 42px; letter-spacing: 7px;
  color: var(--teal); text-shadow: 0 0 22px var(--teal);
}

.gameover-text {
  font-family: var(--head);
  font-size: clamp(28px, 5vw, 46px); letter-spacing: 4px;
  color: var(--red); text-shadow: 0 0 20px var(--red), 0 0 42px rgba(255,23,68,0.5);
  animation: goFlicker 2s ease-in-out infinite alternate;
}
@keyframes goFlicker {
  0% { opacity: 1; text-shadow: 0 0 20px var(--red); }
  90% { opacity: 1; } 95% { opacity: 0.7; }
  100% { opacity: 1; text-shadow: 0 0 32px var(--red), 0 0 60px rgba(255,23,68,0.5); }
}

.win-text {
  font-family: var(--head);
  font-size: clamp(36px, 6vw, 54px); letter-spacing: 6px;
  background: linear-gradient(135deg, #FFD700, #69F0AE, #00E5FF);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  filter: drop-shadow(0 0 22px rgba(255,215,0,0.8));
  animation: winGlow 1.5s ease-in-out infinite alternate;
}
@keyframes winGlow {
  from { filter: drop-shadow(0 0 14px rgba(255,215,0,0.6)); }
  to   { filter: drop-shadow(0 0 28px rgba(0,229,255,0.9)) drop-shadow(0 0 56px rgba(255,215,0,0.5)); }
}
.win-sub { font-size: 11px; letter-spacing: 7px; color: var(--gold); opacity: 0.75; margin-top: -10px; }

#go-stats, #win-stats { width: 100%; display: flex; flex-direction: column; gap: 7px; }
.stat-row {
  display: flex; justify-content: space-between; padding: 8px 16px;
  background: rgba(0,229,255,0.04); border: 1px solid rgba(0,229,255,0.12);
  border-radius: 5px; font-size: 12px;
}
.stat-row span:first-child { color: var(--teal-dim); letter-spacing: 2px; font-size: 9px; }
.stat-row span:last-child  { color: var(--gold); font-weight: bold; font-size: 15px; }

/* Boss Warning */
#boss-warning {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 15; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255,23,68,0.28) 0%, transparent 70%);
  animation: warnFade 3s ease forwards;
}
#boss-warning.hidden { display: none; }
#boss-warn-text {
  font-family: var(--head);
  font-size: clamp(22px, 5vw, 40px); letter-spacing: 4px; color: var(--red); text-align: center;
  text-shadow: 0 0 20px var(--red), 0 0 42px rgba(255,23,68,0.6);
  animation: warnPulse 0.5s ease infinite alternate;
  line-height: 1.4;
}
@keyframes warnFade { 0% { opacity: 0; } 10% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes warnPulse { from { transform: scale(1); } to { transform: scale(1.06); } }

/* Mobile Controls */
#mobile-controls {
  position: absolute; bottom: 56px; right: 14px;
  display: none; z-index: 15;
}
.m-btn {
  width: 62px; height: 62px;
  background: rgba(255,64,129,0.28); border: 2px solid var(--pink);
  border-radius: 50%; color: var(--pink); font-size: 18px; font-family: var(--mono);
  cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0; line-height: 1;
  text-shadow: 0 0 6px var(--pink); box-shadow: 0 0 12px rgba(255,64,129,0.3);
  transition: all 0.1s; touch-action: manipulation;
}
.m-btn:active { background: rgba(255,64,129,0.55); transform: scale(0.94); }
.m-btn small { font-size: 8px; letter-spacing: 1px; }

.hidden { display: none !important; }
::-webkit-scrollbar { display: none; }

@media (hover: none) and (pointer: coarse) {
  #mobile-controls { display: flex; }
}
