/* ============================================
   WHACK THE GLITCH — Complete Stylesheet
   ============================================ */

/* ── Reset & Base ─────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --neon-cyan: #00ffcc;
  --neon-magenta: #ff00ff;
  --neon-yellow: #ffee00;
  --neon-green: #00ff88;
  --neon-orange: #ff8800;
  --neon-red: #ff2244;
  --neon-blue: #4488ff;
  --neon-purple: #aa44ff;

  --bg-dark: #0a0a1a;
  --bg-panel: #111128;
  --bg-card: #1a1a3a;
  --text-primary: #eeeeff;
  --text-secondary: #8888aa;
  --text-dim: #555577;

  --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;

  --shake-intensity: 5px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-main);
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

/* ── Screen System ────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 1;
  background: var(--bg-dark);
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  z-index: 10;
}

.screen.overlay-screen {
  background: rgba(5, 5, 20, 0.85);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.screen.overlay-screen.active {
  z-index: 20;
}

.screen-content {
  text-align: center;
  max-width: 600px;
  width: 90%;
  z-index: 2;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid rgba(100, 100, 255, 0.2);
  border-radius: 20px;
  padding: 40px 30px;
  box-shadow: 0 0 40px rgba(100, 100, 255, 0.1), inset 0 0 30px rgba(0, 0, 0, 0.3);
}

/* ── Background Grid ──────────────────────── */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 255, 204, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 204, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridScroll 20s linear infinite;
  z-index: 0;
}

@keyframes gridScroll {
  to { background-position: 40px 40px; }
}

.bg-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

/* ── Title Screen ─────────────────────────── */
.title-wrapper {
  margin-bottom: 40px;
}

.game-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

.title-line {
  display: block;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(0, 255, 204, 0.5));
}

.title-the {
  display: block;
  font-size: 0.35em;
  letter-spacing: 0.6em;
  color: var(--text-secondary);
  margin: 5px 0;
}

.glitch-text {
  background: linear-gradient(135deg, var(--neon-magenta), var(--neon-yellow));
  -webkit-background-clip: text;
  background-clip: text;
  animation: glitchPulse 3s ease-in-out infinite;
}

@keyframes glitchPulse {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(255, 0, 255, 0.5)); }
  50% { filter: drop-shadow(0 0 40px rgba(255, 0, 255, 0.8)) drop-shadow(0 0 60px rgba(255, 238, 0, 0.3)); }
}

.subtitle {
  font-size: 1.1rem;
  color: var(--neon-cyan);
  letter-spacing: 0.3em;
  margin-top: 10px;
  text-shadow: 0 0 15px rgba(0, 255, 204, 0.5);
  animation: subtitleGlow 2s ease-in-out infinite alternate;
}

@keyframes subtitleGlow {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

/* ── Buttons ──────────────────────────────── */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.btn {
  padding: 14px 36px;
  border: 2px solid;
  border-radius: 12px;
  font-family: var(--font-main);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 220px;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-green));
  border-color: var(--neon-cyan);
  color: #000;
  box-shadow: 0 0 20px rgba(0, 255, 204, 0.3), inset 0 0 20px rgba(0, 255, 204, 0.1);
}

.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(0, 255, 204, 0.5), inset 0 0 30px rgba(0, 255, 204, 0.2);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--neon-purple);
  color: var(--neon-purple);
  box-shadow: 0 0 15px rgba(170, 68, 255, 0.2);
}

.btn-secondary:hover {
  transform: scale(1.05);
  background: rgba(170, 68, 255, 0.15);
  box-shadow: 0 0 25px rgba(170, 68, 255, 0.4);
}

.btn-danger {
  background: var(--bg-card);
  border-color: var(--neon-red);
  color: var(--neon-red);
  box-shadow: 0 0 15px rgba(255, 34, 68, 0.2);
}

.btn-danger:hover {
  transform: scale(1.05);
  background: rgba(255, 34, 68, 0.15);
}

.btn-icon {
  background: none;
  border: 2px solid var(--text-dim);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  position: fixed;
  top: 15px;
  right: 15px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.btn-icon:hover {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 255, 204, 0.3);
}

.btn-icon.muted {
  border-color: var(--neon-red);
  opacity: 0.6;
}

/* ── Controls Screen ──────────────────────── */
.screen-title {
  font-size: 2rem;
  margin-bottom: 30px;
  color: var(--neon-cyan);
  text-shadow: 0 0 20px rgba(0, 255, 204, 0.5);
}

.controls-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px 15px;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid rgba(100, 100, 255, 0.1);
}

.key {
  background: linear-gradient(135deg, var(--neon-magenta), var(--neon-purple));
  color: #fff;
  padding: 4px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  min-width: 70px;
  text-align: center;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
}

.control-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: left;
}

.enemy-guide {
  margin: 25px 0;
  text-align: left;
}

.enemy-guide h3 {
  color: var(--neon-yellow);
  margin-bottom: 12px;
  text-align: center;
}

.enemy-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.enemy-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.enemy-icon {
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-dark);
  box-shadow: 0 0 10px var(--target-color, #888);
}

/* ── Level Intro ──────────────────────────── */
.level-name {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  color: var(--neon-cyan);
  text-shadow: 0 0 30px rgba(0, 255, 204, 0.6);
  margin-bottom: 15px;
  animation: levelNameIn 0.6s ease-out;
}

@keyframes levelNameIn {
  from { opacity: 0; transform: translateY(-30px) scale(0.8); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.mission-text {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 10px;
  animation: fadeSlideUp 0.6s ease-out 0.2s both;
}

.mechanic-text {
  color: var(--neon-yellow);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 16px;
  background: rgba(255, 238, 0, 0.1);
  border: 1px solid rgba(255, 238, 0, 0.3);
  border-radius: 8px;
  display: inline-block;
  margin-bottom: 30px;
  animation: fadeSlideUp 0.6s ease-out 0.4s both;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.countdown {
  font-size: clamp(4rem, 15vw, 8rem);
  font-weight: 900;
  color: var(--neon-magenta);
  text-shadow: 0 0 40px rgba(255, 0, 255, 0.7), 0 0 80px rgba(255, 0, 255, 0.3);
  animation: countdownPulse 0.8s ease-in-out infinite;
}

@keyframes countdownPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ── Game Screen ──────────────────────────── */
#game-screen {
  flex-direction: column;
  padding: 0;
  background:
    radial-gradient(ellipse at center bottom, rgba(0, 100, 150, 0.15) 0%, transparent 60%),
    linear-gradient(180deg, #050510 0%, #0a0a2a 50%, #0f0f25 100%);
}

#game-screen.active {
  display: flex;
}

/* ── HUD ──────────────────────────────────── */
#hud {
  width: 100%;
  padding: 10px 15px 5px;
  flex-shrink: 0;
  z-index: 5;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.hud-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-label {
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.hud-value {
  font-size: 1.2rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.hud-score {
  color: var(--neon-yellow);
  text-shadow: 0 0 10px rgba(255, 238, 0, 0.5);
  font-size: 1.5rem;
}

.hud-timer {
  color: var(--neon-cyan);
}

.hud-timer.critical {
  color: var(--neon-red);
  animation: timerFlash 0.5s ease-in-out infinite;
}

@keyframes timerFlash {
  50% { opacity: 0.4; }
}

.hud-combo {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--neon-magenta);
  text-shadow: 0 0 15px rgba(255, 0, 255, 0.6);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s ease;
}

.hud-combo.visible {
  opacity: 1;
  transform: scale(1);
}

.hud-combo.pulse {
  animation: comboPulse 0.3s ease;
}

@keyframes comboPulse {
  50% { transform: scale(1.4); }
}

.hud-combo-mult {
  font-size: 0.8rem;
  color: var(--neon-orange);
  font-weight: 700;
}

.pulse {
  animation: hudPulse 0.2s ease;
}

@keyframes hudPulse {
  50% { transform: scale(1.2); }
}

/* ── Bars ─────────────────────────────────── */
.hud-bar-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.bar-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  min-width: 100px;
  letter-spacing: 0.05em;
}

.bar-track {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 5px;
  transition: width 0.3s ease;
  background: linear-gradient(90deg, var(--neon-green), var(--neon-cyan));
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

.bar-fill.warning {
  background: linear-gradient(90deg, var(--neon-orange), var(--neon-yellow));
  box-shadow: 0 0 8px rgba(255, 136, 0, 0.4);
}

.bar-fill.critical {
  background: linear-gradient(90deg, var(--neon-red), var(--neon-orange));
  box-shadow: 0 0 8px rgba(255, 34, 68, 0.4);
  animation: criticalPulse 0.5s ease-in-out infinite;
}

@keyframes criticalPulse {
  50% { opacity: 0.6; }
}

.energy-fill {
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-magenta));
  box-shadow: 0 0 8px rgba(170, 68, 255, 0.4);
  width: 0%;
}

.bar-text {
  font-size: 0.7rem;
  color: var(--text-secondary);
  min-width: 35px;
  text-align: right;
  font-family: var(--font-mono);
}

/* ── Powers ───────────────────────────────── */
.hud-powers {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 5px 0;
}

.power-badge {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(100, 100, 255, 0.2);
  background: var(--bg-card);
  opacity: 0.3;
  transition: all 0.2s;
}

.power-badge.enabled {
  display: flex;
  opacity: 0.5;
}

.power-badge.available {
  opacity: 1;
  border-color: var(--neon-magenta);
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.2);
}

.power-key {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--neon-magenta);
  background: rgba(255, 0, 255, 0.15);
  padding: 1px 6px;
  border-radius: 3px;
}

.power-name {
  font-size: 0.55rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Objective ────────────────────────────── */
.hud-objective {
  text-align: center;
  font-size: 0.75rem;
  color: var(--neon-orange);
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 3px 0;
  text-shadow: 0 0 8px rgba(255, 136, 0, 0.3);
}

/* ── Game Board ───────────────────────────── */
#game-board {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
  padding: 15px;
  max-width: 500px;
  max-height: 500px;
  width: 100%;
  margin: 0 auto;
  position: relative;
}

/* ── Portals ──────────────────────────────── */
.portal {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(0, 255, 204, 0.05) 0%, transparent 70%),
    rgba(10, 10, 30, 0.8);
  border: 2px solid rgba(0, 255, 204, 0.15);
  aspect-ratio: 1;
  cursor: pointer;
  overflow: visible;
}

.portal-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(0, 255, 204, 0.1);
  animation: portalPulse 3s ease-in-out infinite;
}

@keyframes portalPulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.1), inset 0 0 10px rgba(0, 255, 204, 0.05);
    border-color: rgba(0, 255, 204, 0.1);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.2), inset 0 0 15px rgba(0, 255, 204, 0.1);
    border-color: rgba(0, 255, 204, 0.2);
  }
}

.portal:nth-child(even) .portal-ring {
  animation-delay: -1.5s;
}

/* ── Targets ──────────────────────────────── */
.target {
  position: absolute;
  inset: -10%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: all;
  transform: scale(0) translateY(30px);
  opacity: 0;
  transition: none;
}

.target.popped {
  transform: scale(1) translateY(0);
  opacity: 1;
  animation: targetPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes targetPop {
  0% { transform: scale(0) translateY(30px); opacity: 0; }
  60% { transform: scale(1.15) translateY(-5px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.target-body {
  width: 85%;
  height: 85%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.15), transparent 60%),
              var(--target-color, #00ff88);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  box-shadow: 0 0 20px var(--target-glow, rgba(0,255,136,0.4)),
              0 0 40px var(--target-glow, rgba(0,255,136,0.2)),
              inset 0 -3px 6px rgba(0,0,0,0.3);
  animation: targetIdle 1.5s ease-in-out infinite;
  transition: transform 0.1s;
}

.target-body:hover {
  transform: scale(1.1);
}

.target-body:active {
  transform: scale(0.9);
}

@keyframes targetIdle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.target-emoji {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
  z-index: 1;
}

/* Timer ring */
.target-timer-ring {
  position: absolute;
  inset: -4px;
  pointer-events: none;
}

.target-timer-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-circle {
  fill: none;
  stroke: rgba(255, 255, 255, 0.3);
  stroke-width: 2;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear;
}

/* Target HP badge */
.target-hp {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--neon-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 900;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(255, 34, 68, 0.5);
}

/* Hit animation */
.target.hit-anim {
  animation: targetHit 0.3s ease-out forwards;
  pointer-events: none;
}

@keyframes targetHit {
  0% { transform: scale(1); opacity: 1; }
  30% { transform: scale(1.4); opacity: 0.8; }
  100% { transform: scale(0); opacity: 0; }
}

/* Expired animation */
.target.expired-anim {
  animation: targetExpired 0.3s ease-in forwards;
  pointer-events: none;
}

@keyframes targetExpired {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.5) translateY(20px); opacity: 0; }
}

/* Damaged state (heavy bot) */
.target.damaged .target-body {
  animation: damagedShake 0.3s ease;
  box-shadow: 0 0 25px rgba(255, 68, 68, 0.6), 0 0 50px rgba(255, 68, 68, 0.3);
}

@keyframes damagedShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ── Target Type Variants ─────────────────── */
.target-speed .target-body {
  animation: targetIdle 0.6s ease-in-out infinite;
}

.target-hologram .target-body {
  animation: hologramFlicker 0.15s steps(2) infinite, targetIdle 1.5s ease-in-out infinite;
  opacity: 0.85;
}

@keyframes hologramFlicker {
  50% { opacity: 0.6; }
}

.target-shield .target-body {
  animation: shieldFloat 2s ease-in-out infinite;
}

@keyframes shieldFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(5deg); }
}

.target-bomb .target-body {
  animation: bombPulse 0.6s ease-in-out infinite;
}

@keyframes bombPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 34, 0, 0.4); }
  50% { box-shadow: 0 0 35px rgba(255, 34, 0, 0.8), 0 0 60px rgba(255, 34, 0, 0.3); }
}

/* Scan revealed */
.target.scan-revealed .target-body {
  outline: 3px solid var(--neon-red);
  outline-offset: 4px;
  animation: scanFlash 0.4s ease-in-out infinite;
}

.target.scan-safe .target-body {
  outline: 3px solid var(--neon-green);
  outline-offset: 4px;
}

@keyframes scanFlash {
  50% { outline-color: transparent; }
}

/* ── Boss ─────────────────────────────────── */
#boss-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

#boss-container.active {
  display: flex;
  animation: bossEntrance 1s ease-out;
}

@keyframes bossEntrance {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1.3); }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.boss-visual {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(170, 68, 255, 0.3), var(--bg-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: bossIdle 2s ease-in-out infinite;
}

@keyframes bossIdle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.boss-emoji {
  font-size: 4rem;
  filter: drop-shadow(0 0 20px rgba(170, 68, 255, 0.8));
}

.boss-shield-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 3px solid transparent;
  transition: all 0.3s;
}

#boss-container.shielded .boss-shield-ring {
  border-color: var(--neon-blue);
  box-shadow: 0 0 20px rgba(68, 136, 255, 0.5);
  animation: shieldRotate 2s linear infinite;
}

@keyframes shieldRotate {
  to { transform: rotate(360deg); }
}

#boss-container.weak-point-active .boss-visual {
  box-shadow: 0 0 30px rgba(255, 0, 255, 0.8), 0 0 60px rgba(255, 0, 255, 0.4);
  animation: bossWeakPoint 0.4s ease-in-out infinite;
}

@keyframes bossWeakPoint {
  0%, 100% { box-shadow: 0 0 30px rgba(255, 0, 255, 0.8); }
  50% { box-shadow: 0 0 50px rgba(255, 0, 255, 1), 0 0 80px rgba(255, 238, 0, 0.5); }
}

.boss-health-bar {
  width: 120px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.boss-health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--neon-red), var(--neon-magenta));
  border-radius: 4px;
  transition: width 0.3s;
}

.boss-phase-text {
  font-size: 0.7rem;
  color: var(--neon-magenta);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.boss-weak-hint {
  font-size: 0.65rem;
  color: var(--neon-yellow);
  opacity: 0;
  animation: hintBlink 1s ease-in-out infinite;
}

#boss-container.weak-point-active .boss-weak-hint {
  opacity: 1;
}

@keyframes hintBlink {
  50% { opacity: 0.3; }
}

/* ── Effects Layer ────────────────────────── */
#effects-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  overflow: hidden;
}

/* Floating text */
.floating-text {
  position: absolute;
  font-weight: 900;
  font-size: 1.2rem;
  pointer-events: none;
  animation: floatUp 0.8s ease-out forwards;
  text-shadow: 0 0 10px currentColor;
  z-index: 20;
  white-space: nowrap;
  transform: translateX(-50%);
}

.floating-text.score {
  color: var(--neon-yellow);
}

.floating-text.hit {
  color: var(--neon-cyan);
}

.floating-text.penalty {
  color: var(--neon-red);
  font-size: 1rem;
}

.floating-text.bomb {
  color: var(--neon-red);
  font-size: 1.5rem;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-60px) scale(1.3); }
}

/* Screen flash */
.screen-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  animation: flashFade 0.3s ease-out forwards;
}

@keyframes flashFade {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Screen shake */
.shaking {
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(calc(var(--shake-intensity) * -1), var(--shake-intensity)); }
  40% { transform: translate(var(--shake-intensity), calc(var(--shake-intensity) * -1)); }
  60% { transform: translate(calc(var(--shake-intensity) * -1), 0); }
  80% { transform: translate(var(--shake-intensity), var(--shake-intensity)); }
}

/* Shockwave */
.shockwave-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 3px solid var(--neon-cyan);
  transform: translate(-50%, -50%);
  animation: shockwaveExpand 0.6s ease-out forwards;
}

@keyframes shockwaveExpand {
  0% { width: 10px; height: 10px; opacity: 1; border-width: 4px; }
  100% { width: 150vmax; height: 150vmax; opacity: 0; border-width: 1px; }
}

/* Slow-mo overlay */
.slowmo-active {
  filter: hue-rotate(-20deg) saturate(1.3);
}

.slowmo-active #game-board {
  transition: filter 0.3s;
}

.slowmo-active::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 100, 255, 0.08);
  pointer-events: none;
  z-index: 6;
}

/* Scan line */
.scan-line {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--neon-green), transparent);
  box-shadow: 0 0 20px var(--neon-green);
  animation: scanSweep 0.8s ease-in-out forwards;
}

@keyframes scanSweep {
  0% { top: 0; opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Combo milestone */
.combo-milestone {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 900;
  color: var(--neon-magenta);
  text-shadow: 0 0 30px rgba(255, 0, 255, 0.8), 0 0 60px rgba(255, 0, 255, 0.4);
  animation: milestoneAnim 1.2s ease-out forwards;
  pointer-events: none;
  z-index: 25;
}

@keyframes milestoneAnim {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
  60% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.1) translateY(-30px); }
}

/* Celebration particles */
.celebration-particle {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: particleFall linear forwards;
}

@keyframes particleFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ── Results Screen ───────────────────────── */
.result-title {
  font-size: 2rem;
  margin-bottom: 20px;
}

.result-title.win {
  color: var(--neon-cyan);
  text-shadow: 0 0 20px rgba(0, 255, 204, 0.6);
}

.result-title.fail {
  color: var(--neon-red);
  text-shadow: 0 0 20px rgba(255, 34, 68, 0.6);
}

.result-stars {
  font-size: 3rem;
  margin: 15px 0 25px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.star {
  display: inline-block;
  animation: starIn 0.4s ease-out backwards;
}

.star.earned {
  color: var(--neon-yellow);
  text-shadow: 0 0 15px rgba(255, 238, 0, 0.6);
  filter: drop-shadow(0 0 8px rgba(255, 238, 0, 0.5));
}

.star.empty {
  color: var(--text-dim);
  opacity: 0.3;
}

@keyframes starIn {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0 30px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid rgba(100, 100, 255, 0.1);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--neon-cyan);
}

/* ── Game Over ────────────────────────────── */
.game-over-title {
  color: var(--neon-red) !important;
  text-shadow: 0 0 30px rgba(255, 34, 68, 0.6);
  animation: gameOverShake 0.5s ease;
}

@keyframes gameOverShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.game-over-text {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ── Victory Screen ───────────────────────── */
.victory-title {
  font-size: clamp(2rem, 6vw, 3rem);
  color: var(--neon-yellow);
  text-shadow: 0 0 30px rgba(255, 238, 0, 0.6), 0 0 60px rgba(255, 238, 0, 0.3);
  animation: victoryGlow 1.5s ease-in-out infinite alternate;
  margin-bottom: 10px;
}

@keyframes victoryGlow {
  from { text-shadow: 0 0 30px rgba(255, 238, 0, 0.6); }
  to { text-shadow: 0 0 50px rgba(255, 238, 0, 0.9), 0 0 80px rgba(255, 238, 0, 0.4); }
}

.victory-subtitle {
  color: var(--neon-cyan);
  font-size: 1.1rem;
  margin-bottom: 25px;
}

/* ── Mobile/Responsive ────────────────────── */
@media (max-width: 500px) {
  #game-board {
    gap: 8px;
    padding: 10px;
  }

  .hud-score { font-size: 1.2rem; }
  .hud-value { font-size: 1rem; }

  .btn {
    padding: 12px 24px;
    font-size: 0.95rem;
    min-width: 180px;
  }

  .boss-visual {
    width: 80px;
    height: 80px;
  }

  .boss-emoji {
    font-size: 2.5rem;
  }

  .hud-bar-container {
    flex-wrap: wrap;
  }

  .bar-label {
    min-width: 80px;
    font-size: 0.6rem;
  }
}

@media (max-height: 600px) {
  #hud { padding: 5px 10px 2px; }
  .hud-bar-container { margin: 2px 0; }
  .hud-powers { margin: 2px 0; }
  #game-board { gap: 6px; padding: 8px; }
}

/* ── Start Screen Layout ─────────────────── */
.start-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.btn-hero {
  min-width: 260px;
  padding: 16px 40px;
  font-size: 1.25rem;
  margin-bottom: 24px;
  animation: heroPulse 2.5s ease-in-out infinite;
}

@keyframes heroPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 204, 0.3), inset 0 0 20px rgba(0, 255, 204, 0.1); }
  50% { box-shadow: 0 0 35px rgba(0, 255, 204, 0.5), 0 0 60px rgba(0, 255, 204, 0.15), inset 0 0 30px rgba(0, 255, 204, 0.15); }
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
  width: 100%;
  max-width: 400px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--bg-card);
  border: 1px solid rgba(100, 100, 255, 0.2);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
  font-family: var(--font-main);
}

.mode-card:hover {
  transform: translateY(-3px);
  border-color: var(--neon-cyan);
  box-shadow: 0 4px 20px rgba(0, 255, 204, 0.2), 0 0 15px rgba(0, 255, 204, 0.1);
  background: rgba(0, 255, 204, 0.06);
}

.mode-card:active {
  transform: translateY(0) scale(0.97);
}

.mode-icon {
  font-size: 1.6rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.2));
}

.mode-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-main);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 6px 12px;
  transition: color 0.2s;
  letter-spacing: 0.04em;
}

.btn-link:hover {
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 255, 204, 0.4);
}

/* ── Start Screen High Score ─────────────── */
.start-highscore {
  color: var(--neon-yellow);
  font-size: 0.9rem;
  font-family: var(--font-mono);
  margin-top: 8px;
  text-shadow: 0 0 10px rgba(255, 238, 0, 0.4);
  min-height: 1.2em;
}

/* ── Level Select ────────────────────────── */
.level-select-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0 30px;
  max-width: 450px;
  margin-left: auto;
  margin-right: auto;
}

.level-card {
  background: var(--bg-card);
  border: 2px solid rgba(100, 100, 255, 0.2);
  border-radius: 14px;
  padding: 15px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.level-card:hover:not(.locked) {
  transform: scale(1.05);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 20px rgba(0, 255, 204, 0.3);
}

.level-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.level-card.boss-level {
  border-color: rgba(255, 0, 170, 0.4);
}

.level-card.boss-level:hover:not(.locked) {
  border-color: var(--neon-magenta);
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.4);
}

.level-card-num {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--neon-cyan);
  margin-bottom: 4px;
}

.level-card.boss-level .level-card-num {
  color: var(--neon-magenta);
}

.level-card-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.level-card-subtitle {
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.level-card-stars {
  font-size: 1rem;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px rgba(255, 238, 0, 0.4);
  letter-spacing: 2px;
}

/* ── Achievements Screen ─────────────────── */
.achievements-count {
  color: var(--neon-yellow);
  font-size: 1rem;
  font-family: var(--font-mono);
  margin-bottom: 15px;
}

.achievements-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 5px;
  margin-bottom: 20px;
}

.achievements-grid::-webkit-scrollbar {
  width: 4px;
}

.achievements-grid::-webkit-scrollbar-thumb {
  background: var(--neon-purple);
  border-radius: 2px;
}

.achievement-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid rgba(100, 100, 255, 0.15);
  transition: all 0.2s;
}

.achievement-card.unlocked {
  border-color: rgba(0, 255, 204, 0.3);
  box-shadow: 0 0 10px rgba(0, 255, 204, 0.1);
}

.achievement-card.locked {
  opacity: 0.5;
}

.achievement-emoji {
  font-size: 1.8rem;
  min-width: 36px;
  text-align: center;
}

.achievement-info {
  text-align: left;
}

.achievement-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.achievement-desc {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ── Achievement Toast ───────────────────── */
.achievement-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: var(--bg-panel);
  border: 2px solid var(--neon-yellow);
  border-radius: 14px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100;
  box-shadow: 0 0 30px rgba(255, 238, 0, 0.4), 0 8px 32px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.achievement-toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast-emoji {
  font-size: 2rem;
}

.toast-title {
  font-size: 0.65rem;
  color: var(--neon-yellow);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.toast-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Settings ────────────────────────────── */
.settings-section {
  margin: 20px 0;
  text-align: left;
}

.settings-section h3 {
  color: var(--neon-yellow);
  margin-bottom: 10px;
  text-align: center;
}

.setting-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.setting-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--neon-cyan);
  cursor: pointer;
}

/* ── Result High Score Badge ─────────────── */
.result-highscore {
  color: var(--neon-yellow);
  font-size: 1.1rem;
  font-weight: 900;
  text-shadow: 0 0 15px rgba(255, 238, 0, 0.6);
  animation: highScorePulse 0.8s ease-in-out infinite alternate;
  margin-bottom: 10px;
}

@keyframes highScorePulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* ── Endless High Score ──────────────────── */
.endless-hs {
  color: var(--neon-cyan);
  font-size: 0.9rem;
  font-family: var(--font-mono);
  margin: 10px 0;
}

/* ── Perfect Wave Floating Text ──────────── */
.floating-text.perfect {
  color: var(--neon-green);
  font-size: 1.4rem;
  text-shadow: 0 0 15px rgba(0, 255, 136, 0.8);
}

/* ── Runner Target ───────────────────────── */
.target-runner .target-body {
  animation: runnerBounce 0.5s ease-in-out infinite;
}

@keyframes runnerBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.05); }
}

.target.teleporting-out {
  animation: teleportOut 0.2s ease-in forwards !important;
}

.target.teleporting-in {
  animation: teleportIn 0.3s ease-out !important;
}

@keyframes teleportOut {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0) rotate(180deg); opacity: 0; }
}

@keyframes teleportIn {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(0); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ── Mini-Boss Target ────────────────────── */
.target-miniboss .target-body {
  animation: miniBossIdle 1s ease-in-out infinite;
  box-shadow: 0 0 25px rgba(255, 0, 170, 0.6), 0 0 50px rgba(255, 0, 170, 0.3) !important;
}

@keyframes miniBossIdle {
  0%, 100% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-4px) scale(1.05); }
  75% { transform: translateY(2px) scale(0.98); }
}

.target-miniboss .target-emoji {
  font-size: clamp(2rem, 6vw, 3rem);
}

/* ── Daily Challenge Date ────────────────── */
#daily-date {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ── Scrollable screen content ───────────── */
#controls-screen .screen-content,
#level-select-screen .screen-content,
#achievements-screen .screen-content {
  max-height: 95vh;
  overflow-y: auto;
  padding: 20px;
}

#controls-screen .screen-content::-webkit-scrollbar,
#level-select-screen .screen-content::-webkit-scrollbar,
#achievements-screen .screen-content::-webkit-scrollbar {
  width: 4px;
}

#controls-screen .screen-content::-webkit-scrollbar-thumb,
#level-select-screen .screen-content::-webkit-scrollbar-thumb,
#achievements-screen .screen-content::-webkit-scrollbar-thumb {
  background: var(--neon-purple);
  border-radius: 2px;
}

/* ── Mobile adjustments for new features ─── */
@media (max-width: 420px) {
  .mode-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 240px;
  }

  .btn-hero {
    min-width: 200px;
    padding: 14px 28px;
    font-size: 1.1rem;
  }
}

@media (max-width: 500px) {
  .level-select-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .level-card {
    padding: 10px 6px;
  }

  .level-card-num {
    font-size: 1.4rem;
  }

  .achievement-card {
    padding: 8px 10px;
  }

  .achievement-emoji {
    font-size: 1.4rem;
    min-width: 28px;
  }

  .achievement-toast {
    width: 90%;
    padding: 10px 14px;
  }
}
