/* ==========================================================================
 * NEON NULL v1.23.0 — Console platform: boot / power / reset chrome.
 * Worker A. Pairs with dashboard.css (worker C) and memcard.css (worker B).
 *
 * LAYOUT SAFETY (no-overlap rule), v1.23.1 revision:
 *   The top-right corner is occupied by game HUD (.mini-player top 12px,
 *   #scores top 55px, #soloStats/#hordeStats top 12px, #soloPause/#hordePause
 *   top 96px, #hordeAim top 146px) and the dashboard header text is wide and
 *   centered. The console power/reset buttons live at the BOTTOM-right,
 *   above the FPS counter (#fpsCounter, bottom ~10px+safe-area) and below
 *   the horde action buttons (bottom 276px+), side by side, 32px, so they
 *   never cover the dashboard header, story panels, or game HUD.
 *   z-index 9500 sits above game panels (<=80) and the dashboard/boot
 *   screens (9000), below the debug and storage-recovery overlays (99999+).
 * ========================================================================== */

/* 1) Console off: hide every game UI element. Console chrome ids, the
 *    dashboard / memory-card workers' roots, the storage-recovery screen,
 *    and script/style elements are excluded so other workers keep working.
 *    v1.24.1: #nnMaintenance is excluded too — the class is now baked into
 *    <body> from the first paint, so without this the maintenance overlay
 *    could never show.
 *    v1.24.1: #nn-skybox is excluded as well — the nebula canvas is console
 *    chrome. Each :not(#id) adds an ID to this rule's specificity, so a
 *    later !important exemption in console-fx.css can never beat it; the
 *    exclusion must live HERE.
 *    v1.24.168: #houseMedallion is excluded — the house switch medallion
 *    (house.css/house.js) floats over menus and the dashboard alike; its
 *    own rules decide when it hides (combat, console power screens). */
body.nn-console-off > *:not(#nn-powerscreen):not(#nn-boot):not(#nn-powerbtn):not(#nn-power-menu):not(#nn-resetbtn):not(#nn-musicbtn):not(#nn-reset-confirm):not(#nn-dashboard):not(#nn-storage-view):not(#nnStorageRecovery):not(#nnMaintenance):not(#nn-skybox):not(#houseMedallion):not(script):not(style) {
  display: none !important;
}

/* v1.24.1: the game menu must never paint before the console powerscreen.
 * browserInit() adds nn-console-off on DOMContentLoaded; before that runs,
 * the raw game UI (lobby/menu) would flash first — backwards. Hide every
 * direct body child until either console class is present. #nnMaintenance
 * is excluded (its own overlay script positions it fullscreen). */
body:not(.nn-console-on):not(.nn-console-off) > *:not(script):not(style):not(#nnMaintenance):not(#nn-skybox):not(#nn-power-menu) {
  display: none !important;
}

/* --------------------------------------------------------------------------
 * Power-off screen (#nn-powerscreen): fullscreen black, one glowing button.
 * -------------------------------------------------------------------------- */
#nn-powerscreen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 22px;
  margin: 0;
  padding: 0;
}
#nn-powerscreen.nn-show { display: flex; }

#nn-powerscreen-btn {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: #02060a;
  border: 2px solid #00e5ff;
  color: #00e5ff;
  font-size: 44px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 24px rgba(0, 229, 255, .6), inset 0 0 18px rgba(0, 229, 255, .27);
  text-shadow: 0 0 14px #00e5ff;
  animation: nn-power-breathe 2.4s ease-in-out infinite;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* v1.23.0: console icons are SVG assets — size them inside the buttons. */
#nn-powerscreen-btn svg { width: 46px; height: 46px; display: block; margin: auto; }
#nn-powerbtn svg, #nn-resetbtn svg { width: 18px; height: 18px; display: block; margin: auto; }
#nn-powerscreen-btn:active {
  background: #00e5ff;
  color: #02060a;
  text-shadow: none;
}
@keyframes nn-power-breathe {
  0%, 100% { box-shadow: 0 0 18px rgba(0,229,255,.45), inset 0 0 14px rgba(0,229,255,.2); }
  50%      { box-shadow: 0 0 34px rgba(0,229,255,.8),  inset 0 0 22px rgba(0,229,255,.35); }
}
#nn-powerscreen-hint {
  margin: 0;
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .35em;
  /* v1.24.2: bright white with dark halo — readable against all 4 backgrounds. */
  color: #ffffff;
  text-shadow: 0 0 12px #00e5ff, 0 0 32px #00e5ff88, 0 2px 4px #000, 0 0 2px #000;
}

/* --------------------------------------------------------------------------
 * Boot screen (#nn-boot): logo flicker-in, fake progress, PRESS START blink.
 * -------------------------------------------------------------------------- */
#nn-boot {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 26px;
  margin: 0;
  padding: 24px;
  box-sizing: border-box;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#nn-boot.nn-show { display: flex; }

#nn-boot-logo {
  font-family: 'Orbitron', 'Montserrat', sans-serif;
  font-weight: 900;
  font-size: clamp(34px, 9vw, 64px);
  letter-spacing: .18em;
  text-indent: .18em;
  color: #eafcff;
  text-shadow: 0 0 12px #00e5ff, 0 0 42px #00e5ff, 0 0 90px #00e5ff88;
  animation: nn-flicker-in 1.1s steps(1, end) both;
  margin: 0;
  text-align: center;
}
@keyframes nn-flicker-in {
  0%   { opacity: 0; }
  8%   { opacity: .85; }
  14%  { opacity: .15; }
  22%  { opacity: 1; }
  30%  { opacity: .35; }
  40%  { opacity: 1; }
  100% { opacity: 1; }
}
#nn-boot-status {
  margin: 0;
  /* v1.24.2: brightened — was muted #5b7a86, now white with glow for all backgrounds. */
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .35em;
  text-indent: .35em;
  color: #ffffff;
  text-shadow: 0 0 12px #00e5ff, 0 0 32px #00e5ff88, 0 2px 4px #000, 0 0 2px #000;
  min-height: 1.4em;
}
#nn-boot-press {
  display: none;
  background: none;
  border: none;
  padding: 12px 20px;
  font-family: 'Orbitron', 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: clamp(16px, 4.5vw, 24px);
  letter-spacing: .3em;
  text-indent: .3em;
  /* v1.24.2: brightened — white core with cyan glow + dark halo, readable on all backgrounds. */
  color: #ffffff;
  text-shadow: 0 0 14px #00e5ff, 0 0 42px #00e5ff, 0 2px 6px #000, 0 0 3px #000;
  cursor: pointer;
  animation: nn-press-breathe 2.4s ease-in-out infinite;
}
#nn-boot.nn-press #nn-boot-press { display: block; }
@keyframes nn-press-breathe {
  0%, 100% { opacity: .9;  text-shadow: 0 0 12px #00e5ff, 0 0 32px #00e5ff99, 0 2px 6px #000, 0 0 3px #000; }
  50%      { opacity: 1;   text-shadow: 0 0 20px #00e5ff, 0 0 64px #00e5ff, 0 2px 6px #000, 0 0 3px #000; }
}

/* --------------------------------------------------------------------------
 * Console corner buttons: power (hold 800ms) + reset. Only visible while
 * the console is powered on (body.nn-console-on). Never overlap game HUD —
 * see the layout-safety note at the top of this file.
 * -------------------------------------------------------------------------- */
/* v1.23.1: bottom-right pair, above the FPS counter, clear of every HUD stack
 * and of centered story/dashboard panels. 32px keeps them tappable but tiny. */
#nn-powerbtn,
#nn-resetbtn,
#nn-musicbtn {
  display: none;
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
  z-index: 9500;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(13, 2, 20, .95);
  border: 1px solid #00e5ff;
  color: #00e5ff;
  font-size: 15px;
  line-height: 1;
  padding: 0;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(0, 229, 255, .5);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  opacity: .85;
}
body.nn-console-on #nn-powerbtn,
body.nn-console-on #nn-resetbtn,
body.nn-console-on #nn-musicbtn { display: flex; }
#nn-powerbtn { right: 12px; }
#nn-resetbtn {
  right: 52px;
  border-color: #c470a0;
  color: #e8a4c8;
  box-shadow: 0 0 12px rgba(196, 112, 160, .5);
}
/* v1.24.3: music toggle widget — same geometry, warm amber accent */
#nn-musicbtn {
  right: 92px;
  border-color: #e8a83e;
  color: #ffd27a;
  box-shadow: 0 0 12px rgba(232, 168, 62, .5);
}
#nn-musicbtn svg { width: 18px; height: 18px; display: block; margin: auto; }
#nn-musicbtn.nn-muted { opacity: .45; }
#nn-powerbtn:active, #nn-resetbtn:active, #nn-musicbtn:active { transform: scale(.92); opacity: 1; }
/* v1.24.12: while dragging, kill the tap-scale and show a drag affordance. */
#nn-powerbtn.nn-dragging, #nn-resetbtn.nn-dragging, #nn-musicbtn.nn-dragging {
  transform: none;
  opacity: 1;
  box-shadow: 0 0 18px rgba(0, 229, 255, .9);
  cursor: grabbing;
}

/* Hold-to-power-off charge fill. */
#nn-powerbtn .nn-holdfill {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background: rgba(0, 229, 255, .28);
  box-shadow: inset 0 0 14px rgba(0, 229, 255, .6);
  transform: scale(0);
  transition: transform .15s ease-out;
  pointer-events: none;
}
#nn-powerbtn.nn-holding .nn-holdfill {
  transform: scale(1);
  transition: transform 500ms linear;
}

/* --------------------------------------------------------------------------
 * v1.24.2: Tiny power button menu — hold 500ms. Anchored above the button,
 * bottom-right, clear of thumbs and the FPS badge.
 * -------------------------------------------------------------------------- */
#nn-power-menu {
  display: none;
  position: fixed;
  z-index: 9502;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 132px);
  width: 208px;
  /* v1.24.2: solid opaque panel — never transparent, never behind other UI. */
  background: #0a0312;
  border: 1px solid #00e5ff;
  border-radius: 6px;
  box-shadow: 0 0 24px rgba(0, 229, 255, .4), 0 8px 32px rgba(0, 0, 0, .9);
  padding: 10px;
  box-sizing: border-box;
}
#nn-power-menu.nn-show { display: block !important; }
#nn-power-menu-title {
  margin: 0 0 8px 0;
  font-family: 'Orbitron', 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .25em;
  text-indent: .25em;
  color: #00e5ff;
  text-align: center;
}
.nn-power-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  margin: 0 0 4px 0;
  /* v1.24.2: solid option rows on the solid panel. */
  background: #12071f;
  border: 1px solid rgba(0, 229, 255, .25);
  border-radius: 4px;
  color: #eafcff;
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
}
.nn-power-opt:last-child { margin-bottom: 0; }
.nn-power-opt:active {
  background: rgba(0, 229, 255, .2);
  border-color: #00e5ff;
}
.nn-power-opt-ico {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  color: #00e5ff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nn-power-opt-ico svg { width: 20px; height: 20px; display: block; }
.nn-power-opt-label { flex: 1; }

/* --------------------------------------------------------------------------
 * Reset confirm — v1.23.1: centered modal, not anchored to the old corner
 * button position. Clean, clear of all content.
 * -------------------------------------------------------------------------- */
#nn-reset-confirm {
  display: none;
  position: fixed;
  z-index: 9501;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  max-width: calc(100vw - 48px);
  background: rgba(13, 2, 20, .97);
  border: 1px solid #ff5f7a;
  border-radius: 12px;
  box-shadow: 0 0 22px rgba(255, 95, 122, .35);
  padding: 16px 16px 18px;
  box-sizing: border-box;
  text-align: center;
}
#nn-reset-confirm.nn-show { display: block; }
#nn-reset-confirm .nn-reset-title {
  margin: 0 0 4px;
  font-family: 'Orbitron', 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .14em;
  color: #ffb3c1;
}
#nn-reset-confirm .nn-reset-sub {
  margin: 0 0 12px;
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 10px;
  letter-spacing: .12em;
  color: #8a97a5;
}
#nn-reset-confirm .nn-reset-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}
#nn-reset-confirm .nn-reset-yes,
#nn-reset-confirm .nn-reset-no {
  flex: 1;
  padding: 10px 6px;
  border-radius: 8px;
  font-family: 'Orbitron', 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .1em;
  cursor: pointer;
  touch-action: manipulation;
}
#nn-reset-confirm .nn-reset-yes {
  background: #ff5f7a;
  border: 1px solid #ff5f7a;
  color: #1a0208;
}
#nn-reset-confirm .nn-reset-no {
  background: transparent;
  border: 1px solid #5b7a86;
  color: #9fb3c8;
}

/* Respect reduced motion: no flicker / blink / breathe. */
@media (prefers-reduced-motion: reduce) {
  #nn-boot-logo,
  #nn-boot-press,
  #nn-powerscreen-btn { animation: none; }
  #nn-powerbtn .nn-holdfill,
  #nn-powerbtn.nn-holding .nn-holdfill { transition: none; }
}
