/* ===== HYPERWIRED v2 — game-as-page additions ===== */

/* The fixed game canvas sits ON TOP of everything but lets pointer events through to the page */
#hw-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 80;
  image-rendering: pixelated;
}

/* When in gameplay mode, capture pointer for shooting */
body.hw-playing #hw-canvas { pointer-events: auto; }

/* Ship equip buttons: styled for visibility when unlocked. */
.ship-slot [data-action="equip"]:not([disabled]) {
  cursor: pointer;
  border-color: var(--green);
  color: var(--green);
  text-shadow: 0 0 8px var(--green);
}

/* Prevent text selection on HUD and game UI during gameplay */
body.hw-playing #hw-hud,
body.hw-playing #hw-mission-bar,
body.hw-playing #hw-gate,
body.hw-playing .hw-section {
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Hide the OLD inline hero canvas — we don't use it anymore */
.hero canvas { display: none !important; }

/* The hero now uses the fixed game canvas instead — give it visible bg */
.hero {
  background: radial-gradient(ellipse at 60% 40%, #1a0a3a 0%, #08041a 70%, #050210 100%) !important;
}

/* When skipped, hide all game-only HUD chrome */
body.hw-skipped #hw-hud,
body.hw-skipped #hw-gate,
body.hw-skipped #hw-mission-bar,
body.hw-skipped .scanlines { display: none !important; }
body.hw-skipped #hw-canvas { opacity: 0 !important; pointer-events: none !important; }

/* ==================== MISSION BAR — centered top ==================== */
#hw-mission-bar {
  position: fixed;
  top: 82px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 91;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(5,2,16,0.94);
  border: 3px solid rgba(255,210,63,0.35);
  border-radius: 10px;
  padding: 16px 36px;
  box-shadow: 0 0 40px rgba(5,2,16,0.85), 0 0 20px rgba(255,210,63,0.12);
  white-space: nowrap;
}
#hw-mission-bar .hw-mission-text {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: var(--yellow);
  text-shadow: 0 0 10px rgba(255,210,63,0.6);
  letter-spacing: 2px;
}
#hw-mission-bar .hw-mission-progress {
  font-family: 'VT323', monospace;
  font-size: 42px;
  color: var(--cyan);
  text-shadow: 0 0 12px var(--cyan);
  line-height: 1;
  min-width: 80px;
  text-align: center;
}
#hw-mission-bar.done {
  border-color: rgba(94,240,255,0.35);
}
#hw-mission-bar.done .hw-mission-text {
  color: var(--green);
  text-shadow: 0 0 10px rgba(94,240,255,0.6);
}
#hw-mission-bar.done .hw-mission-progress {
  color: var(--green);
}

/* Hero background in skipped/non-game mode — uses the game art image */
body.hw-skipped .hero {
  background: #050210 !important;
}
body.hw-skipped .hero-bg-real {
  background-image: url('../assets/hero-art.png') !important;
  background-size: cover;
  background-position: center 30%;
  opacity: 0.50;
  image-rendering: auto;
}

/* ==================== HUD — top-right panel ==================== */
#hw-hud {
  position: fixed;
  top: 72px; right: 12px;
  z-index: 90;
  pointer-events: none;
  font-family: 'Press Start 2P', monospace;
  color: var(--ink);
}
.hw-hud-panel {
  width: 440px;
  background: rgba(5,2,16,0.92);
  border: 2px solid rgba(94,240,255,0.30);
  border-radius: 12px;
  padding: 20px 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 0 40px rgba(5,2,16,0.8), inset 0 0 30px rgba(94,240,255,0.05);
}

/* ---- top row: lives + score ---- */
.hw-hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hw-lives {
  display: flex; gap: 6px;
  font-size: 40px;
  color: var(--red);
  text-shadow: 0 0 16px var(--red), 0 0 32px rgba(255,61,110,0.4);
  line-height: 1;
  filter: drop-shadow(0 0 6px var(--red));
}
.hw-score {
  font-size: 28px;
  color: #fff;
  text-shadow: 2px 2px 0 var(--magenta), 0 0 12px rgba(255,61,240,0.5);
  line-height: 1;
  letter-spacing: 2px;
}

/* ---- bars ---- */
.hw-hud-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hw-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hw-bar-label {
  font-size: 13px;
  width: 44px;
  letter-spacing: 1px;
  text-shadow: 0 0 6px currentColor;
  flex-shrink: 0;
}
.hw-bar-track {
  flex: 1;
  height: 18px;
  background: rgba(0,0,0,0.6);
  border: 2px solid currentColor;
  border-radius: 3px;
}
.hw-bar-track > div {
  height: 100%;
  transition: width 80ms;
  border-radius: 1px;
}

/* ---- status rows ---- */
.hw-hud-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.hw-sector {
  font-size: 13px;
  color: var(--cyan);
  letter-spacing: 1px;
  text-shadow: 0 0 6px var(--cyan);
}
.hw-progress {
  font-family: 'VT323', monospace;
  font-size: 28px;
  color: var(--yellow);
  text-shadow: 0 0 6px var(--yellow);
  line-height: 1;
}
.hw-progress.complete {
  color: var(--green);
  animation: pulse-glow 1s ease-in-out infinite;
}
/* ---- zone map (5 dots in HUD) ---- */
.hw-zone-map {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 6px 0 2px;
  border-top: 1px solid rgba(94,240,255,0.1);
}
.hw-zone {
  width: 36px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  border-radius: 4px;
  border: 2px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.3);
  transition: all 200ms;
}
.hw-zone.complete {
  border-color: var(--green);
  color: var(--green);
  background: rgba(94,240,255,0.08);
  text-shadow: 0 0 6px var(--green);
}
.hw-zone.current {
  border-color: var(--yellow);
  color: var(--yellow);
  background: rgba(255,210,63,0.12);
  text-shadow: 0 0 6px var(--yellow);
  animation: pulse-glow 1.5s ease-in-out infinite;
}
.hw-zone.locked {
  border-color: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.15);
}
.hw-plug-status {
  font-family: 'VT323', monospace;
  font-size: 22px;
  text-shadow: 0 0 6px currentColor;
  line-height: 1;
}
.hw-equipped { display: inline; }
.hw-mod-slot {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: rgba(255,255,255,0.3);
}
.hw-mod-slot.filled {
  color: currentColor;
  text-shadow: 0 0 10px currentColor;
}
.hw-ship-name {
  font-size: 12px;
  color: var(--green);
  letter-spacing: 1px;
  text-shadow: 0 0 6px var(--green);
  text-align: right;
  opacity: 0.85;
}

/* ---- key guide ---- */
/* compact key hint — replaces old full key guide */
.hw-key-hint {
  margin-top: 8px;
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: rgba(255,255,255,0.35);
  line-height: 1.5;
}
.hw-key-hint .kk {
  color: var(--cyan);
  text-shadow: 0 0 5px rgba(94,240,255,0.5);
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  margin-right: 4px;
}

/* ---- energy warning ---- */
.hw-energy-warn {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Press Start 2P', monospace;
  font-size: 22px;
  color: var(--red);
  text-shadow: 0 0 20px var(--red), 0 0 50px rgba(255,61,110,0.5);
  letter-spacing: 3px;
  text-align: center;
  padding: 22px 44px;
  background: rgba(5,2,16,0.92);
  border: 3px solid var(--red);
  border-radius: 6px;
  display: none;
  animation: warning-flash 0.5s steps(2) infinite;
  z-index: 92;
  pointer-events: none;
}
.hw-energy-warn .k { color: var(--yellow); font-size: 24px; }
.hw-energy-warn.show { display: block; }

/* mega-bar glow when ready */
.hw-mega-bar.ready .hw-bar-track {
  box-shadow: 0 0 10px var(--yellow);
}

/* ==================== SECTOR GATE ==================== */
#hw-gate {
  position: fixed;
  bottom: 30%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  pointer-events: none;
  text-align: center;
  display: none;
}
#hw-gate.show { display: block; animation: slide-up 300ms ease-out; }
@keyframes slide-up {
  from { transform: translate(-50%, 30px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}
.hw-gate-warn {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--yellow);
  letter-spacing: 4px;
  margin-bottom: 10px;
  text-shadow: 0 0 8px var(--yellow);
  animation: warning-flash 1s steps(2) infinite;
}
.hw-gate-msg {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: #fff;
  letter-spacing: 2px;
  margin-bottom: 8px;
  text-shadow: 3px 3px 0 var(--magenta);
}
.hw-gate-prog {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: var(--cyan);
  text-shadow: 0 0 6px var(--cyan);
}

/* ============================================================
   EDGE INDICATOR — bottom-of-viewport barrier OR fly-down arrows
   Two states toggled by JS via .show-barrier / .show-arrows on #hw-edge.
   ============================================================ */
#hw-edge {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 88;                /* above scanlines (85), below HUD (90), below nav (100) */
  pointer-events: none;
  display: none;
}
#hw-edge.show-barrier,
#hw-edge.show-arrows { display: block; }

/* --- BARRIER (sector not yet cleared) --- */
.hw-edge-barrier { display: none; }
#hw-edge.show-barrier .hw-edge-barrier { display: flex; }
.hw-edge-barrier {
  position: relative;
  width: 100%;
  height: 56px;
  align-items: center;
  justify-content: center;
  border-top: 4px solid var(--red);
  background: repeating-linear-gradient(
    45deg,
    var(--yellow) 0 24px,
    #1a1000 24px 48px
  );
  box-shadow: 0 -10px 24px rgba(255, 61, 110, 0.35);
  animation: hw-edge-pulse 1.2s steps(2) infinite;
}
.hw-edge-msg {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  letter-spacing: 4px;
  color: #fff;
  background: var(--bg-2);
  padding: 8px 16px;
  border: 3px solid var(--red);
  text-shadow: 2px 2px 0 var(--red);
}
@keyframes hw-edge-pulse {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.35); }
}

/* --- ARROWS (sector cleared, can fly to next) --- */
.hw-edge-arrows { display: none; }
#hw-edge.show-arrows .hw-edge-arrows { display: flex; }
.hw-edge-arrows {
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 0 16px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(94, 240, 255, 0.05) 40%,
    rgba(94, 240, 255, 0.20) 100%
  );
  border-top: 2px dashed rgba(94, 240, 255, 0.55);
}
.hw-edge-go-msg {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--cyan);
  text-shadow: 0 0 6px var(--cyan);
}
.hw-edge-arrow-row {
  display: flex;
  gap: 22px;
  margin-top: 2px;
}
.hw-edge-arrow {
  font-family: 'Press Start 2P', monospace;
  font-size: 22px;
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan), 0 0 18px rgba(94, 240, 255, 0.6);
  animation: hw-edge-bob 0.9s ease-in-out infinite;
}
.hw-edge-arrow:nth-child(2) { animation-delay: 0.15s; }
.hw-edge-arrow:nth-child(3) { animation-delay: 0.30s; }
@keyframes hw-edge-bob {
  0%, 100% { transform: translateY(0); opacity: 0.55; }
  50%      { transform: translateY(6px); opacity: 1; }
}

/* When the user toggles "Skip Game", hide all edge indicators. */
body.hw-skipped #hw-edge { display: none !important; }

/* Visual fog covering locked sections */
.hw-section-locked::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(45deg, rgba(255,61,110,0.05) 0 12px, rgba(0,0,0,0.4) 12px 24px),
    radial-gradient(ellipse at 50% 0%, transparent 0%, rgba(5,2,16,0.85) 60%);
  pointer-events: none;
  z-index: 5;
  transition: opacity 600ms;
}
.hw-section-locked.unlocked::after { opacity: 0; }

.hw-section-locked .hw-lock-banner {
  position: absolute;
  top: 30px; left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--red);
  background: rgba(8,4,26,0.9);
  padding: 10px 20px;
  border: 2px solid var(--red);
  text-shadow: 0 0 8px var(--red);
  animation: warning-flash 1.4s steps(2) infinite;
  white-space: nowrap;
}
.hw-section-locked.unlocked .hw-lock-banner {
  display: none;
}

/* ==================== GAME OVER MODAL ==================== */
#hw-gameover {
  position: fixed;
  inset: 0;
  background: rgba(5, 2, 16, 0.92);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  backdrop-filter: blur(4px);
}
#hw-gameover.show { display: flex; animation: fade-in 300ms; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.hw-go-card {
  border: 4px solid var(--red);
  background: var(--bg-2);
  padding: 50px 60px;
  text-align: center;
  max-width: 540px;
  box-shadow: 0 0 60px rgba(255,61,110,0.5), 12px 12px 0 rgba(255,61,110,0.4);
}
.hw-go-card h2 {
  font-size: 48px;
  color: var(--red);
  margin: 0 0 8px;
  text-shadow: 4px 4px 0 #5a0c2a, 8px 8px 0 var(--bg-2);
  letter-spacing: 4px;
}
.hw-go-card .sub {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: var(--ink);
  margin-bottom: 30px;
}
.hw-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 30px 0;
}
.hw-stat {
  border: 2px solid var(--cyan);
  padding: 12px;
  background: rgba(8,4,26,0.6);
}
.hw-stat .v {
  font-size: 22px;
  color: var(--yellow);
  text-shadow: 2px 2px 0 #8a6a00;
}
.hw-stat .l {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--cyan);
  letter-spacing: 2px;
  margin-top: 6px;
}
.hw-go-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.hw-go-section-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.hw-go-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}
.hw-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  padding: 14px 18px;
  background: var(--yellow);
  color: var(--bg-2);
  border: none;
  cursor: pointer;
  letter-spacing: 2px;
  box-shadow: 4px 4px 0 #8a6a00;
  transition: transform 80ms;
}
.hw-btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 #8a6a00; }
.hw-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #8a6a00; }
.hw-btn.alt {
  background: transparent;
  color: var(--cyan);
  border: 3px solid var(--cyan);
  box-shadow: 4px 4px 0 #1a4a6a;
}

/* ==================== HANGAR INTERACTIVE ==================== */
.hangar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 1100px;
  margin: 0 auto;
}
@media (max-width: 900px) { .hangar-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .hangar-grid { grid-template-columns: 1fr; } }

.ship-slot {
  border: 3px solid;
  background: rgba(8,4,26,0.85);
  padding: 22px 18px;
  position: relative;
  transition: transform 100ms;
}
.ship-slot.locked { border-color: rgba(94,240,255,0.25); filter: grayscale(0.4); }
.ship-slot.active-challenge { border-color: var(--yellow); box-shadow: 6px 6px 0 #8a6a00, 0 0 30px rgba(255,210,63,0.3); }
.ship-slot.unlocked { border-color: var(--green); box-shadow: 6px 6px 0 #2a5a1a, 0 0 30px rgba(163,255,63,0.2); }
.ship-slot.equipped { border-color: var(--yellow); background: rgba(255,210,63,0.08); }

.ship-slot .lock-tag {
  position: absolute;
  top: 12px; right: 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--yellow);
}
.ship-slot.unlocked .lock-tag { color: var(--green); }
.ship-slot .ship-art {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 10px currentColor);
  height: 80px;
  align-items: center;
}
.ship-slot .name {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  letter-spacing: 2px;
  margin-bottom: 8px;
  color: #fff;
}
.ship-slot .stat {
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--cyan);
  margin-bottom: 8px;
  text-shadow: 0 0 4px var(--cyan);
}
.ship-slot .desc {
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 14px;
}
.ship-slot .challenge {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--yellow);
  border-top: 2px dashed rgba(255,210,63,0.4);
  padding-top: 10px;
  text-shadow: 0 0 4px var(--yellow);
  line-height: 1.3;
}
.ship-slot .challenge .prog {
  display: block;
  margin-top: 6px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: var(--cyan);
}
.ship-slot .ch-actions {
  margin-top: 12px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.ship-slot .ch-actions .hw-btn { font-size: 9px; padding: 8px 12px; }

/* ==================== MOD SWAP MODAL ==================== */
#hw-mod-swap {
  position: fixed;
  inset: 0;
  background: rgba(5,2,16,0.85);
  z-index: 180;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
#hw-mod-swap.show { display: flex; }
.hw-swap-card {
  border: 4px solid var(--magenta);
  background: var(--bg-2);
  padding: 36px 40px;
  text-align: center;
  max-width: 520px;
  box-shadow: 0 0 50px rgba(255,61,240,0.4);
  font-family: 'Press Start 2P', monospace;
}
.hw-swap-card h3 {
  font-size: 18px;
  color: var(--magenta);
  margin: 0 0 16px;
  letter-spacing: 3px;
  text-shadow: 3px 3px 0 #5a0c54;
}
.hw-swap-card .new-mod {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: var(--yellow);
  margin-bottom: 24px;
}
.hw-swap-list {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.hw-swap-list .slot {
  border: 2px solid currentColor;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 80ms;
}
.hw-swap-list .slot:hover { transform: translate(-1px, -1px); }
.hw-swap-list .slot .icon { font-size: 28px; margin-bottom: 6px; }
.hw-swap-list .slot .name { font-size: 9px; letter-spacing: 1px; color: #fff; }

/* ==================== SECTOR-COMPLETE TOAST ==================== */
#hw-toast {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 150;
  font-family: 'Press Start 2P', monospace;
  font-size: 28px;
  color: var(--green);
  text-shadow: 4px 4px 0 #2a5a1a, 8px 8px 0 var(--bg-2), 0 0 30px var(--green);
  letter-spacing: 4px;
  pointer-events: none;
  display: none;
  text-align: center;
}
#hw-toast.show {
  display: block;
  animation: toast-pop 1.6s ease-out forwards;
}
@keyframes toast-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  40% { transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* nav skip button */
.nav-skip {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: rgba(232,226,255,0.7);
  background: transparent;
  border: 1px dashed rgba(232,226,255,0.3);
  padding: 6px 12px;
  cursor: pointer;
  letter-spacing: 1px;
  margin-right: 12px;
  transition: color 120ms, border-color 120ms;
}
.nav-skip:hover { color: var(--yellow); border-color: var(--yellow); }
.nav-skip.on { color: var(--green); border-color: var(--green); }

/* mod pickup label */
.hw-pickup-toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 110;
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: #fff;
  background: rgba(8,4,26,0.9);
  padding: 14px 22px;
  border: 2px solid currentColor;
  pointer-events: none;
  display: none;
}
.hw-pickup-toast.show {
  display: block;
  animation: pickup-pop 1.2s ease-out forwards;
}
@keyframes pickup-pop {
  0% { opacity: 0; transform: translate(-50%, calc(-50% - 30px)); }
  30% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% + 30px)); }
}

/* page-bg-raw layered behind hero, pixelated */
.hero-bg-real {
  position: absolute;
  inset: 0;
  background-image: url('assets/steam/page-bg-raw.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.4;
  z-index: 1;
  image-rendering: pixelated;
}
.hero-bg-real::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8,4,26,0.4) 0%, rgba(8,4,26,0.85) 100%);
}

/* scroll-locked body */
body.hw-scroll-locked { overflow: hidden; }

/* ==================== NEW SECTOR-AWARE OVERRIDES ==================== */
/* Boss section now uses real fight; hide static art/hp */
#sector-boss .boss-art { display: none; }
#sector-boss .boss-hp  { display: none; }

/* ensure all sections sit above the canvas with backdrop so DOM content stays readable */
section.hw-section {
  position: relative;
  z-index: 2;
}
section.hw-section .container { position: relative; z-index: 3; }

/* ==================== MEGA-LASER BAR ==================== */
.hw-mega-bar .hw-bar-track { border-color: var(--yellow) !important; }
.hw-mega-bar.ready .hw-bar-label {
  animation: mega-pulse 0.5s steps(2) infinite;
  color: var(--yellow);
}
.hw-mega-bar.ready .hw-bar-label::after {
  content: ' — READY';
  color: var(--yellow);
}
@keyframes mega-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ==================== VICTORY OVERLAY ==================== */
#hw-victory {
  display: none;
  position: fixed; inset: 0;
  z-index: 200;
  background: rgba(5,2,16,0.88);
  justify-content: center; align-items: center;
}
#hw-victory.show { display: flex; }
.hw-victory-inner {
  text-align: center;
  padding: 40px 60px;
  border: 3px solid var(--yellow);
  background: rgba(10,5,30,0.95);
  box-shadow: 0 0 60px rgba(255,210,63,0.3), inset 0 0 30px rgba(255,210,63,0.05);
}
.hw-victory-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 36px;
  color: var(--yellow);
  text-shadow: 0 0 20px var(--yellow);
  margin-bottom: 12px;
}
.hw-victory-sub {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: var(--orange);
  margin-bottom: 24px;
}
.hw-victory-stats {
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: var(--cyan);
  margin-bottom: 24px;
  line-height: 1.6;
}
.hw-victory-msg {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: var(--green);
  text-shadow: 0 0 12px var(--green);
  margin-bottom: 28px;
  animation: mega-pulse 1s steps(2) infinite;
}
.hw-victory-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
#hw-victory .hw-btn {
  font-size: 14px;
  padding: 12px 28px;
  width: 100%;
  max-width: 420px;
}
#hw-victory-freeplay {
  border-color: var(--red) !important;
  color: var(--red) !important;
  text-shadow: 0 0 8px var(--red);
  animation: warning-flash 1.5s steps(2) infinite;
}
#hw-victory-freeplay:hover {
  background: rgba(255,61,61,0.15) !important;
}

/* Void boss victory variant */
.hw-victory-void {
  border-color: var(--magenta) !important;
  box-shadow: 0 0 60px rgba(255,61,240,0.3), inset 0 0 30px rgba(255,61,240,0.05) !important;
}
.hw-victory-void .hw-victory-title {
  color: var(--magenta) !important;
  text-shadow: 0 0 20px var(--magenta), 4px 4px 0 #5a0c54 !important;
}
.hw-victory-void .hw-victory-msg {
  color: var(--magenta) !important;
  text-shadow: 0 0 8px var(--magenta) !important;
}

/* ==================== VOID ARENA SECTION ==================== */
.void-arena {
  background: #020010 !important;
}
.void-bg-effect {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(255,61,240,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 80%, rgba(94,240,255,0.04) 0%, transparent 40%),
    radial-gradient(ellipse at 80% 20%, rgba(255,61,61,0.04) 0%, transparent 40%);
  pointer-events: none;
  animation: void-pulse 4s ease-in-out infinite alternate;
}
@keyframes void-pulse {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* ==================== START SCREEN ==================== */
#hw-start-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}
#hw-start-screen.hidden {
  opacity: 0;
  pointer-events: none;
}
.hw-start-bg {
  position: absolute;
  inset: 0;
  background: url('../assets/hero-art.png') center center / cover no-repeat;
  opacity: 0.35;
  image-rendering: auto;
}
.hw-start-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(8,4,26,0.3) 0%, rgba(8,4,26,0.92) 70%);
}
.hw-start-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.hw-start-logo {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(32px, 6vw, 64px);
  color: var(--cyan);
  text-shadow: 0 0 30px var(--cyan), 0 0 60px rgba(94,240,255,0.4), 4px 4px 0 #0a2a3a;
  letter-spacing: 4px;
}
.hw-start-sub {
  font-family: 'VT323', monospace;
  font-size: clamp(16px, 3vw, 28px);
  color: var(--magenta);
  text-shadow: 0 0 12px var(--magenta);
  letter-spacing: 6px;
  margin-bottom: 24px;
}
.hw-start-play {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(16px, 2.5vw, 24px);
  color: var(--bg-2);
  background: var(--cyan);
  border: none;
  padding: 22px 48px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 6px 6px 0 #0a3a4a, 0 0 40px rgba(94,240,255,0.5);
  transition: transform 0.1s, box-shadow 0.1s;
  animation: start-pulse 2s ease-in-out infinite alternate;
}
.hw-start-play:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 #0a3a4a, 0 0 60px rgba(94,240,255,0.7);
}
.hw-start-play:active {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 #0a3a4a;
}
@keyframes start-pulse {
  0% { box-shadow: 6px 6px 0 #0a3a4a, 0 0 30px rgba(94,240,255,0.4); }
  100% { box-shadow: 6px 6px 0 #0a3a4a, 0 0 60px rgba(94,240,255,0.7); }
}
.hw-start-secondary {
  display: flex;
  gap: 24px;
  margin-top: 18px;
}
.hw-start-link {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: var(--magenta);
  background: transparent;
  border: 2px solid var(--magenta);
  padding: 12px 20px;
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow: 3px 3px 0 #3a0a36;
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.2s;
}
.hw-start-link:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #3a0a36, 0 0 20px rgba(255,61,240,0.4);
}
.hw-start-link:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: #555;
  color: #555;
}

/* ==================== RANKINGS MODAL ==================== */
.hw-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(5,2,16,0.85);
  display: none;
  align-items: center;
  justify-content: center;
}
.hw-modal-overlay.show {
  display: flex;
}
.hw-rankings-card {
  background: var(--bg-2);
  border: 3px solid var(--magenta);
  box-shadow: 0 0 40px rgba(255,61,240,0.3), 8px 8px 0 #1a0a1a;
  padding: 32px 36px;
  max-width: 500px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  text-align: center;
}
.hw-rankings-card h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  color: var(--magenta);
  text-shadow: 0 0 15px var(--magenta);
  margin: 0 0 18px 0;
}
.hw-rankings-tabs {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: 16px;
}
.hw-rank-tab {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 8px 16px;
  background: transparent;
  color: #888;
  border: 2px solid #333;
  cursor: pointer;
  transition: all 0.15s;
}
.hw-rank-tab.active {
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(94,240,255,0.3);
}
.hw-rank-tab:hover:not(.active) { color: #ccc; border-color: #666; }
.hw-rankings-list {
  min-height: 120px;
}
.hw-rankings-empty {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: #666;
  padding: 30px 0;
}
.hw-rank-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #1a1a2e;
  font-family: 'VT323', monospace;
  font-size: 18px;
}
.hw-rank-row:nth-child(1) .hw-rank-pos { color: var(--yellow); text-shadow: 0 0 8px var(--yellow); }
.hw-rank-row:nth-child(2) .hw-rank-pos { color: #c0c0c0; }
.hw-rank-row:nth-child(3) .hw-rank-pos { color: #cd7f32; }
.hw-rank-pos {
  width: 36px;
  text-align: center;
  color: #888;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
}
.hw-rank-name {
  flex: 1;
  text-align: left;
  color: var(--cyan);
  margin-left: 8px;
}
.hw-rank-val {
  color: var(--magenta);
  font-size: 20px;
  min-width: 80px;
  text-align: right;
}
.hw-rankings-close {
  margin-top: 20px;
}

/* ==================== LIGHTBOX ==================== */
#hw-lightbox {
  z-index: 220;
}
.hw-lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hw-lightbox-content video,
.hw-lightbox-content img,
.hw-lightbox-content iframe {
  max-width: 90vw;
  max-height: 82vh;
  min-width: min(800px, 88vw);
  border: 3px solid var(--cyan);
  box-shadow: 0 0 60px rgba(94,240,255,0.3);
  display: block;
}
.hw-lightbox-close {
  position: absolute;
  top: -18px;
  right: -18px;
  width: 40px;
  height: 40px;
  background: var(--bg-2);
  border: 2px solid var(--cyan);
  color: var(--cyan);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 2;
}
.hw-lightbox-close:hover {
  background: var(--cyan);
  color: var(--bg-2);
}

/* ==================== GAME OVER — Submit Score ==================== */
.hw-go-submit {
  margin: 14px 0 8px;
  padding: 14px;
  border: 2px solid var(--magenta);
  background: rgba(255,61,240,0.05);
}
.hw-go-submit-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
}
.hw-go-input {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  padding: 10px 14px;
  background: #0a0a1a;
  border: 2px solid var(--cyan);
  color: var(--cyan);
  width: 160px;
  text-transform: uppercase;
  outline: none;
}
.hw-go-input:focus {
  box-shadow: 0 0 12px rgba(94,240,255,0.4);
}
.hw-go-submit-msg {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--green);
  margin-top: 6px;
  min-height: 20px;
}

/* ==================== PRE-START STATE ==================== */
/* Only show hero background + start screen. Hide EVERYTHING else. */
body.hw-pre-start #hw-hud,
body.hw-pre-start #hw-mission-bar,
body.hw-pre-start #hw-gate,
body.hw-pre-start #hw-toast,
body.hw-pre-start #hw-pickup-toast,
body.hw-pre-start #hw-edge,
body.hw-pre-start #hw-canvas,
body.hw-pre-start .scanlines,
body.hw-pre-start nav { display: none !important; }
/* Hide ALL sections except hero during pre-start */
body.hw-pre-start .hw-section:not(.hero) { display: none !important; }
body.hw-pre-start footer { display: none !important; }
/* Hide hero content (top-left title block) — only bg + start screen visible */
body.hw-pre-start .hero-title,
body.hw-pre-start .touch-warn { display: none !important; }
/* Hero fills the viewport as the start screen backdrop */
body.hw-pre-start .hero {
  min-height: 100vh;
}
body.hw-pre-start .hero-bg-real {
  opacity: 0.45;
}
/* Prevent scroll during pre-start */
body.hw-pre-start { overflow: hidden; }

/* ==================== BROWSE MODE ==================== */
/* Hide void & boss sections in browse mode — they only make sense during gameplay */
body.hw-skipped #sector-void,
body.hw-skipped #sector-boss,
body.hw-browse #sector-void,
body.hw-browse #sector-boss { display: none !important; }

/* ==================== JUST BROWSE button (same size as START) ==================== */
.hw-start-browse {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(16px, 2.5vw, 24px);
  color: #ccc;
  background: transparent;
  border: 3px solid #666;
  padding: 22px 48px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 6px 6px 0 #1a1a2e;
  transition: transform 0.1s, box-shadow 0.1s, color 0.15s, border-color 0.15s;
}
.hw-start-browse:hover {
  color: #fff;
  border-color: #aaa;
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 #1a1a2e;
}
.hw-start-browse:active {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 #1a1a2e;
}

/* ==================== HOW TO PLAY MODAL ==================== */
.hw-howto-card {
  background: var(--bg-2);
  border: 3px solid var(--cyan);
  box-shadow: 0 0 40px rgba(94,240,255,0.25), 8px 8px 0 #0a1a2a;
  padding: 28px 32px 24px;
  max-width: 560px;
  width: 92vw;
  max-height: 82vh;
  overflow-y: auto;
  text-align: left;
}
.hw-howto-card h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  color: var(--cyan);
  text-shadow: 0 0 15px var(--cyan);
  text-align: center;
  margin: 0 0 20px 0;
}
.hw-howto-section {
  margin-bottom: 18px;
}
.hw-howto-section h3 {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: var(--magenta);
  text-shadow: 0 0 8px var(--magenta);
  margin: 0 0 10px 0;
  letter-spacing: 1px;
}
.hw-howto-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}
.hw-howto-key {
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: rgba(255,255,255,0.65);
  line-height: 1.6;
}
.hw-howto-key .kk,
.hw-howto-card .kk {
  color: var(--cyan);
  text-shadow: 0 0 5px rgba(94,240,255,0.5);
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  margin-right: 5px;
  vertical-align: middle;
}
.hw-howto-section p {
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: rgba(255,255,255,0.6);
  line-height: 1.5;
  margin: 0 0 8px 0;
}
.hw-howto-section em {
  color: #fff;
  font-style: normal;
}
.hw-howto-section .hl-cyan {
  color: var(--cyan);
  text-shadow: 0 0 4px rgba(94,240,255,0.4);
}
.hw-howto-section .hl-mag {
  color: var(--magenta);
  text-shadow: 0 0 4px rgba(255,61,240,0.4);
}
.hw-howto-sockets {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: 'VT323', monospace;
  font-size: 17px;
  color: rgba(255,255,255,0.55);
  line-height: 1.4;
}
.hw-howto-close {
  display: block;
  margin: 18px auto 0;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  padding: 12px 36px;
  cursor: pointer;
}

/* scrollbar inside modal */
.hw-howto-card::-webkit-scrollbar { width: 6px; }
.hw-howto-card::-webkit-scrollbar-track { background: transparent; }
.hw-howto-card::-webkit-scrollbar-thumb { background: var(--cyan); border-radius: 3px; }

/* ==================== BROWSE MODE — Hero actions ==================== */
.hw-browse-play-btn { display: none; }

body.hw-skipped .hero-actions {
  flex-direction: column;
  gap: 14px;
}
/* top row: Steam + Trailer side by side, stretch to fill */
body.hw-skipped .hero-actions .hw-hero-row {
  display: flex;
  gap: 14px;
}
body.hw-skipped .hero-actions .hw-hero-row > * {
  flex: 1;
  text-align: center;
}
/* Play button: matches row width, prominent magenta CTA */
body.hw-skipped .hw-browse-play-btn {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 15px;
  padding: 20px 24px;
  letter-spacing: 3px;
}
