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

:root {
  --neon-cyan: #00f5ff;
  --neon-magenta: #ff00aa;
  --neon-purple: #8b5cf6;
  --neon-yellow: #facc15;
  --neon-green: #22c55e;
  --neon-orange: #f97316;
  --bg-dark: #050510;
  --glass: rgba(10, 10, 30, 0.75);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: 'Rajdhani', sans-serif;
  color: #e2e8f0;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

@supports (-webkit-touch-callout: none) {
  html, body {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
  }
}

#app {
  position: relative;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  touch-action: none;
  overscroll-behavior: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #050510;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(5,5,20,0.6) 0%, rgba(5,5,16,0.95) 70%);
  backdrop-filter: blur(4px);
  z-index: 10;
  transition: opacity 0.4s ease;
}

.overlay.hidden { display: none; }

.menu-content {
  text-align: center;
  position: relative;
  padding: 1.5rem 2rem;
  max-height: 100svh;
  overflow-y: auto;
  scrollbar-width: none;
}
.menu-content::-webkit-scrollbar { display: none; }

.menu-glow {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0,245,255,0.15) 0%, rgba(255,0,170,0.08) 40%, transparent 70%);
  pointer-events: none;
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

.title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  text-shadow: 0 0 20px var(--neon-cyan), 0 0 40px rgba(0,245,255,0.4);
  position: relative;
  z-index: 1;
}

.title.small { font-size: clamp(1.8rem, 5vw, 3rem); }

.title .accent {
  color: var(--neon-magenta);
  text-shadow: 0 0 20px var(--neon-magenta), 0 0 40px rgba(255,0,170,0.4);
}

.subtitle {
  font-size: 1.1rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0.5rem 0 2rem;
  position: relative;
  z-index: 1;
}

.btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 1rem 2.5rem;
  border: 2px solid var(--neon-cyan);
  background: rgba(0,245,255,0.1);
  color: var(--neon-cyan);
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: all 0.2s ease;
  text-transform: uppercase;
  margin: 0.3rem;
}

.btn:hover {
  background: rgba(0,245,255,0.25);
  box-shadow: 0 0 30px rgba(0,245,255,0.5), inset 0 0 20px rgba(0,245,255,0.1);
  transform: scale(1.05);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  border-color: var(--neon-magenta);
  color: var(--neon-magenta);
  background: rgba(255,0,170,0.1);
}

.btn.primary:hover {
  background: rgba(255,0,170,0.25);
  box-shadow: 0 0 30px rgba(255,0,170,0.5), inset 0 0 20px rgba(255,0,170,0.1);
}

/* Stats Preview */
.stats-preview {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.stat-label {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: #64748b;
  text-transform: uppercase;
}

.stat-val {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  color: var(--neon-yellow);
}

.control-picker {
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.picker-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: #64748b;
  margin-bottom: 0.6rem;
}

.control-options {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.ctrl-btn {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 1px solid #334155;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.8);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ctrl-btn:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.ctrl-btn.active {
  border-color: var(--neon-magenta);
  color: var(--neon-magenta);
  background: rgba(255, 0, 170, 0.12);
  box-shadow: 0 0 15px rgba(255, 0, 170, 0.25);
}

.controls {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.8;
  position: relative;
  z-index: 1;
}

.control-section.hidden { display: none; }

.control-section strong {
  display: block;
  color: var(--neon-cyan);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  margin-bottom: 0.3rem;
}

.aim-mode {
  position: absolute;
  top: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: #64748b;
  background: rgba(10, 10, 30, 0.7);
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.aim-mode.hidden { display: none; }

.lock-on {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 2px solid rgba(250, 204, 21, 0.8);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
  animation: lock-pulse 0.8s ease-in-out infinite;
}

.lock-on.hidden { display: none; }

@keyframes lock-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
  50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

kbd {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border: 1px solid #334155;
  border-radius: 4px;
  background: #1e293b;
  color: var(--neon-cyan);
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
}

.power-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  position: relative;
  z-index: 1;
}

.p-orbital { color: #22d3ee; }
.p-chain { color: #fbbf24; }
.p-time { color: #a78bfa; }
.p-void { color: #f472b6; }
.p-aegis { color: #3b82f6; }

.final-score {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  color: var(--neon-cyan);
  margin: 1rem 0 0.5rem;
}

.final-wave, .final-kills {
  color: #94a3b8;
  margin-bottom: 0.5rem;
}

/* HUD */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

#hud.hidden { display: none; }

.hud-top {
  display: flex;
  justify-content: space-between;
  padding: 1.2rem 2rem;
}

.hud-right {
  position: absolute;
  top: 1.2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.hud-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-block .label {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: #64748b;
  text-transform: uppercase;
}

.hud-block .value {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0,245,255,0.5);
}

.score-block .value { color: var(--neon-yellow); text-shadow: 0 0 10px rgba(250,204,21,0.5); }

.weapon-block .weapon-value { color: var(--neon-magenta); font-size: 1.1rem; }
.level-block .level-value { color: var(--neon-green); font-size: 1.3rem; }

.value.combo {
  color: var(--neon-magenta);
  text-shadow: 0 0 10px rgba(255,0,170,0.5);
  transition: transform 0.15s ease;
}

.xp-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(30,30,60,0.8);
  z-index: 6;
}

.xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-cyan));
  box-shadow: 0 0 10px rgba(139,92,246,0.6);
  transition: width 0.3s ease;
}

.hud-bottom {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(500px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: center;
}

.health-bar {
  width: 100%;
  height: 12px;
  background: rgba(30,30,60,0.8);
  border: 1px solid rgba(0,245,255,0.3);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ef4444, #f97316, #22c55e);
  border-radius: 5px;
  transition: width 0.2s ease;
  box-shadow: 0 0 15px rgba(34,197,94,0.5);
}

.health-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 0 4px black;
}

.powers {
  display: flex;
  gap: 0.6rem;
}

.mutator-indicator {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
  text-shadow: 0 0 8px currentColor;
}

.mutator-indicator.hidden { display: none; }

.synergy-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  margin-top: 0.3rem;
}

.synergy-list.hidden { display: none; }

.syn-chip {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.5rem;
  border: 1px solid currentColor;
  border-radius: 4px;
  background: rgba(10, 10, 30, 0.7);
  text-transform: uppercase;
}

.power-slot {
  width: 48px;
  height: 48px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: rgba(10,10,30,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  position: relative;
  overflow: hidden;
}

.power-slot.active {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0,245,255,0.4);
}

.power-slot .key-hint {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.55rem;
  color: #64748b;
  font-family: 'Orbitron', monospace;
}

.power-slot .cooldown {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.7);
  transition: height 0.1s linear;
}

.upgrade-notify {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  color: var(--neon-yellow);
  text-shadow: 0 0 20px rgba(250,204,21,0.8);
  animation: notify-pop 1.5s ease forwards;
  pointer-events: none;
  z-index: 7;
}

.upgrade-notify.hidden { display: none; }

@keyframes notify-pop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.5); }
  20% { opacity: 1; transform: translateX(-50%) scale(1.1); }
  80% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.2); }
}

/* Upgrade Menu */
.upgrade-content {
  max-width: min(700px, 95vw);
}

.upgrade-cards {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.upgrade-card {
  width: 180px;
  padding: 1.2rem 1rem;
  background: rgba(10, 10, 30, 0.9);
  border: 2px solid rgba(0, 245, 255, 0.3);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  pointer-events: auto;
}

.upgrade-card:hover {
  border-color: var(--neon-cyan);
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 10px 30px rgba(0, 245, 255, 0.25);
}

.upgrade-card .uc-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.upgrade-card .uc-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  color: var(--neon-cyan);
  margin-bottom: 0.4rem;
}

.upgrade-card .uc-desc {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.4;
}

.wave-banner {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.5rem, 5vw, 3rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  color: white;
  text-shadow: 0 0 30px var(--neon-magenta), 0 0 60px rgba(255,0,170,0.5);
  animation: banner-in 2s ease forwards;
  pointer-events: none;
}

.wave-banner.hidden { display: none; }

.mutator-banner {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(0.9rem, 3vw, 1.4rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--neon-yellow);
  text-shadow: 0 0 15px rgba(250,204,21,0.6);
  animation: banner-in 2.5s ease forwards;
  pointer-events: none;
  z-index: 7;
}

.mutator-banner.hidden { display: none; }

@keyframes banner-in {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
}

/* Leaderboard */
.leaderboard {
  margin-top: 1rem;
  max-height: 220px;
  overflow-y: auto;
  position: relative;
  z-index: 1;
  background: rgba(5, 5, 20, 0.6);
  border: 1px solid rgba(0, 245, 255, 0.15);
  border-radius: 8px;
  padding: 0.75rem;
  width: min(420px, 85vw);
}

.leaderboard::-webkit-scrollbar { width: 6px; }
.leaderboard::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
.leaderboard::-webkit-scrollbar-thumb { background: rgba(0, 245, 255, 0.3); border-radius: 3px; }

.lb-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--neon-yellow);
  margin-bottom: 0.8rem;
  text-shadow: 0 0 10px rgba(250,204,21,0.4);
}

.lb-loading, .lb-empty {
  font-size: 0.9rem;
  color: #64748b;
  padding: 0.5rem;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.lb-table th {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: #64748b;
  text-transform: uppercase;
  padding: 0.4rem 0.3rem;
  border-bottom: 1px solid rgba(0, 245, 255, 0.2);
  text-align: center;
}

.lb-table td {
  padding: 0.45rem 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.lb-rank {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  color: #94a3b8;
  width: 36px;
}

.lb-name {
  text-align: left;
  color: #e2e8f0;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  font-family: 'Orbitron', sans-serif;
  color: var(--neon-yellow);
  font-weight: 700;
}

.lb-wave { color: #a78bfa; }

.rank-gold .lb-rank { color: #fbbf24; text-shadow: 0 0 8px rgba(251,191,36,0.6); }
.rank-silver .lb-rank { color: #cbd5e1; text-shadow: 0 0 8px rgba(203,213,225,0.4); }
.rank-bronze .lb-rank { color: #fb923c; text-shadow: 0 0 8px rgba(251,146,60,0.4); }

/* Submit Score */
.submit-score-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.player-name-input {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  letter-spacing: 0.1em;
  padding: 0.7rem 1rem;
  width: min(280px, 70vw);
  background: rgba(10, 10, 30, 0.8);
  border: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: 6px;
  color: var(--neon-cyan);
  text-align: center;
  outline: none;
  transition: all 0.2s ease;
}

.player-name-input:focus {
  border-color: var(--neon-magenta);
  box-shadow: 0 0 15px rgba(255, 0, 170, 0.3);
}

.player-name-input::placeholder { color: #475569; }

.submit-error {
  font-size: 0.8rem;
  color: #ef4444;
  max-width: min(320px, 80vw);
}

.submit-success {
  font-size: 1rem;
  color: #22c55e;
  margin-bottom: 1.2rem;
  text-shadow: 0 0 10px rgba(34,197,94,0.4);
}

/* Mobile Controls */
.mobile-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.mobile-controls.hidden { display: none; }

/* Left-half touch zone for movement (prevents conflict with action buttons) */
.mobile-touch-zone {
  position: absolute;
  top: 0;
  left: 0;
  width: 55%;
  height: 100%;
  pointer-events: auto;
  touch-action: none;
  z-index: 1;
}

/* Floating joystick visual - positioned dynamically by JS */
.joystick-visual {
  position: absolute;
  width: 120px;
  height: 120px;
  pointer-events: none;
  z-index: 2;
  display: block;
}

.joystick-visual.hidden { display: none; }

.joystick-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 245, 255, 0.04);
  border: 1px solid rgba(0, 245, 255, 0.18);
}

.joystick-thumb {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 245, 255, 0.55);
  border: 2px solid rgba(0, 245, 255, 0.85);
  box-shadow: 0 0 12px rgba(0, 245, 255, 0.6), inset 0 0 8px rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: transform 0.05s linear;
}

/* Dash: bottom-left — large, easy to hit */
.m-dash {
  position: absolute;
  bottom: 1.2rem;
  left: 1.2rem;
  width: 64px;
  height: 64px;
  font-size: 1.4rem;
  border: 2.5px solid rgba(0, 245, 255, 0.5);
  color: var(--neon-cyan);
  background: rgba(10, 10, 30, 0.75);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
  pointer-events: auto;
  z-index: 3;
  box-shadow: 0 0 15px rgba(0, 245, 255, 0.15);
}

.m-dash:active {
  transform: scale(0.9);
  box-shadow: 0 0 30px rgba(0, 245, 255, 0.6);
  border-color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.15);
}

/* Nova: bottom-right — large, easy to hit */
.m-nova {
  position: absolute;
  bottom: 1.2rem;
  right: 1.2rem;
  width: 64px;
  height: 64px;
  font-size: 1.4rem;
  border: 2.5px solid rgba(255, 0, 170, 0.5);
  color: var(--neon-magenta);
  background: rgba(10, 10, 30, 0.75);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
  pointer-events: auto;
  z-index: 3;
  box-shadow: 0 0 15px rgba(255, 0, 170, 0.15);
}

.m-nova:active {
  transform: scale(0.9);
  box-shadow: 0 0 30px rgba(255, 0, 170, 0.6);
  border-color: var(--neon-magenta);
  background: rgba(255, 0, 170, 0.15);
}

/* Responsive Adjustments */
@media (max-width: 640px) {
  .menu-content { padding: 1.2rem 1rem; }
  .title { font-size: clamp(2rem, 10vw, 3rem); }
  .control-options { gap: 0.4rem; }
  .ctrl-btn { font-size: 0.8rem; padding: 0.4rem 0.8rem; }
  .controls { font-size: 0.8rem; }
  .hud-top { padding: 0.8rem 1rem; }
  .hud-right { top: 0.8rem; right: 1rem; }
  .hud-block .value { font-size: 1.3rem; }
  .weapon-block .weapon-value { font-size: 0.9rem; }
  .powers { gap: 0.4rem; }
  .power-slot { width: 40px; height: 40px; font-size: 1.1rem; }
  .leaderboard { max-height: 240px; padding: 0.7rem; }
  .lb-title { font-size: 0.75rem; }
  .lb-table { font-size: 0.78rem; }
  .upgrade-card { width: 140px; padding: 1rem 0.7rem; }
  .joystick-visual { width: 104px; height: 104px; }
  .joystick-thumb { width: 32px; height: 32px; }
  .m-dash { width: 58px; height: 58px; bottom: 1rem; left: 1rem; font-size: 1.3rem; }
  .m-nova { width: 58px; height: 58px; bottom: 1rem; right: 1rem; font-size: 1.3rem; }
  .stats-preview { gap: 1rem; }
  .stat-val { font-size: 0.95rem; }
  .hud-bottom { 
    bottom: auto; 
    top: 4rem; 
    width: min(340px, 85vw); 
  }
  .powers { display: none; }
}

.npc-dialogue {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--neon-yellow);
  text-shadow: 0 0 15px rgba(250, 204, 21, 0.6), 0 0 30px rgba(250, 204, 21, 0.3);
  background: rgba(5, 5, 20, 0.75);
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 8px;
  padding: 0.7rem 1.4rem;
  max-width: min(520px, 85vw);
  text-align: center;
  pointer-events: none;
  z-index: 8;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.npc-dialogue.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

.npc-dialogue.hidden {
  display: none;
}

.ai-status {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 8px rgba(100, 116, 139, 0.5);
  z-index: 7;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.ai-status.active {
  background: var(--neon-green);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.7);
}

.ai-status.fallback {
  background: var(--neon-orange);
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.7);
}

.ai-status.disabled {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
}

@media (max-width: 380px) {
  .joystick-zone { width: 100px; height: 100px; }
  .joystick-thumb { width: 40px; height: 40px; }
  .m-dash, .m-nova { width: 50px; height: 50px; font-size: 0.5rem; }
  .m-fire { width: 56px; height: 56px; font-size: 0.55rem; }
  .upgrade-card { width: 120px; }
}
