/* ==========================================================================
 * NEON WAVE RUNNER v1.24.76 — Batch D1: system pages console chrome.
 *
 * Story codex + Options (+ admin + save-transfer rows, which live inside
 * Options). CHROME-ONLY layer: the JS in this batch only adds hook classes
 * and moves no wiring — every id, listener, row order, and setting behaves
 * exactly as before.
 *
 * Theme-aware: every accent reads var(--cyan) (with a hardcoded fallback),
 * so the active filter theme — CLASSIC, neon, monokai, cyberpunk, anime…
 * — reskins these pages. color-mix is already used in shipped client CSS
 * (v1.24.73 lobby).
 *
 * 240ms slide+fade enter: #storyPanel.story-console / #optPanel.opt-console
 * replay their animation on every show (__nnPanel.show forces a reflow,
 * resetting the keyframes — the same pattern the lobby uses).
 * ========================================================================== */

/* shared enter animation — 240ms slide+fade, nn-dash-panel language */
@keyframes d1PageIn {
  from { transform: translateX(6%); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.d1-gone { display: none !important; }

/* ---------- shared console bits ---------- */
/* ‹ BACK pill — Orbitron 700, 13px, .18em tracking, 12px radius,
   1px cyan border @40%, cyan-tinted bg, light-cyan text. Never an X-close. */
#storyPanel.story-console .d1-back {
  flex: none;
  width: auto; margin: 0;
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-weight: 700; font-size: 13px;
  letter-spacing: .18em; text-indent: .18em; /* recenter tracked text */
  padding: 12px 14px; min-height: 44px; box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 40%, transparent);
  background: color-mix(in srgb, var(--cyan, #22d3ee) 10%, transparent);
  color: #c9f3ff;
  text-shadow: 0 0 10px color-mix(in srgb, var(--cyan, #22d3ee) 55%, transparent);
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
#storyPanel.story-console .d1-back:active { opacity: .75; }

/* centered glowing console title */
#storyPanel.story-console .d1-ctitle,
#optPanel.opt-console .d1-ctitle {
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-weight: 700;
  font-size: clamp(16px, 3.4vw, 24px);
  letter-spacing: .28em; text-indent: .28em; /* recenter tracked text */
  color: #f4fcff; text-align: center;
  text-shadow: 0 0 18px color-mix(in srgb, var(--cyan, #22d3ee) 65%, transparent),
               0 0 46px color-mix(in srgb, var(--cyan, #22d3ee) 28%, transparent);
  white-space: nowrap;
  margin: 0;
}

/* ==========================================================================
 * STORY CODEX — fullscreen console page, zero scroll (pager pattern).
 * ========================================================================== */
#storyPanel.story-console {
  position: fixed; inset: 0; z-index: 10;
  width: auto; max-height: none; margin: 0;
  display: flex; flex-direction: column; box-sizing: border-box;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px
           calc(14px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(120% 90% at 50% 0%,
      color-mix(in srgb, var(--cyan, #22d3ee) 10%, transparent) 0%,
      rgba(0, 0, 0, 0) 55%),
    linear-gradient(180deg, #05090f 0%, #030509 100%);
  color: #e8f6ff;
  overflow: hidden;
  font-family: 'Montserrat', Arial, sans-serif;
  text-align: left;
  border: 0; /* fullscreen page, not a card */
  box-shadow: none;
}
#storyPanel.story-console::before { display: none; } /* kill .panel double border */
#storyPanel.story-console:not(.hidden) { animation: d1PageIn 240ms ease-out; }

/* header: ‹ BACK + title centered in the free zone + widget dock.
   The draggable widget cluster (power / music / reset) parks top-right, so
   the dock reserves its width (battlepass pattern) — the title centers in
   the space between BACK and the dock, never sliding under the widgets.
   The title runs 14px/.22em here: the free zone is ~133px at 390px wide and
   "LORE CODEX" needs ~117px — measured, not guessed. */
#storyPanel.story-console .d1-chead {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 4px 2px 12px;
  position: relative;
}
#storyPanel.story-console .d1-ctitle {
  position: static; transform: none; pointer-events: auto;
  flex: 1 1 auto; min-width: 0; text-align: center;
  font-size: 11px;
  letter-spacing: .12em; text-indent: .12em;
  white-space: nowrap;
  overflow: visible;
}
#storyPanel.story-console .d1-dock {
  flex: none; width: 108px; /* parked widget-cluster reserve */
  display: flex; align-items: center; justify-content: flex-end;
  position: relative; z-index: 1;
}
#storyPanel.story-console .d1-back { position: relative; z-index: 1; }

/* body: the console page frame — 1px cyan @16%, 16px radius, .55 fill */
#storyPanel.story-console .d1-cbody {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 16%, transparent);
  border-radius: 16px;
  background: rgba(10, 18, 30, .55);
  padding: 14px;
  overflow: hidden;
  gap: 0;
}

/* the codex card: one entry per page — never truncated, never scrolled */
#storyPanel.story-console .d1-codex-card {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 16%, transparent);
  border-radius: 12px;
  background: rgba(8, 14, 26, .5);
  padding: 18px 16px;
  overflow: hidden;
  margin: 0;
}
#storyPanel.story-console .d1-kicker {
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 700; font-size: 10px;
  letter-spacing: .24em;
  color: var(--cyan, #22d3ee);
  margin: 0 0 8px;
}
#storyPanel.story-console .d1-ccard-title {
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-weight: 800;
  font-size: clamp(18px, 5vw, 26px);
  letter-spacing: .12em;
  color: #ffffff;
  margin: 0 0 10px;
  text-shadow: 0 0 14px color-mix(in srgb, var(--cyan, #22d3ee) 55%, transparent);
}
#storyPanel.story-console .d1-rule {
  height: 1px; flex: none;
  background: color-mix(in srgb, var(--cyan, #22d3ee) 35%, transparent);
  margin: 0 0 14px;
}
#storyPanel.story-console .d1-cbody-text {
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 400; font-size: 14px; line-height: 1.65;
  color: #d7ecf7;
  margin: 0;
  /* story text wraps — never ellipsized, never hidden */
  overflow: visible; text-overflow: clip; white-space: normal;
}
#storyPanel.story-console .d1-cfoot-micro {
  margin: auto 0 0; padding-top: 12px;
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 600; font-size: 10px;
  letter-spacing: .2em;
  color: rgba(205, 238, 255, .55);
}

/* pager footer: ‹ PREV | counter | NEXT ›, replay below as a full pill */
#storyPanel.story-console .d1-pager {
  flex: none;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  padding-top: 12px;
}
#storyPanel.story-console .d1-pgbtn {
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-weight: 700; font-size: 12px; letter-spacing: .14em;
  padding: 12px 18px; min-height: 44px; box-sizing: border-box;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 40%, transparent);
  background: rgba(10, 18, 30, .7);
  color: #c9f3ff;
  text-shadow: 0 0 10px color-mix(in srgb, var(--cyan, #22d3ee) 45%, transparent);
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
#storyPanel.story-console .d1-pgbtn:active { opacity: .75; }
#storyPanel.story-console .d1-pgbtn:disabled { opacity: .32; }
#storyPanel.story-console .d1-pgbtn.d1-primary {
  background: var(--cyan, #22d3ee);
  border-color: transparent;
  color: #04121a;
  text-shadow: none;
  box-shadow: 0 0 18px color-mix(in srgb, var(--cyan, #22d3ee) 55%, transparent);
}
#storyPanel.story-console .d1-count {
  flex: none; min-width: 72px; text-align: center;
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 700; font-size: 11px; letter-spacing: .2em;
  color: rgba(205, 238, 255, .6);
}
#storyPanel.story-console .d1-wide {
  flex: none; width: 100%; margin: 10px 0 0; box-sizing: border-box;
  border-radius: 12px;
}

/* v1.24.114: timeline view — horizontal swipeable strip of tappable nodes.
 * No vertical scroll; strip scrolls horizontally only. Nodes are 44px+ tap. */
#storyPanel.story-console .d1-timeline {
  flex: none;
  display: flex; align-items: stretch;
  gap: 0;
  overflow-x: auto; overflow-y: hidden;
  padding: 12px 4px;
  margin: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
#storyPanel.story-console .d1-timeline.hidden { display: none; }
#storyPanel.story-console .d1-tnode {
  flex: none;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  min-width: 88px; max-width: 120px; min-height: 64px;
  padding: 10px 12px; box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 40%, transparent);
  background: rgba(10, 18, 30, .7);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}
#storyPanel.story-console .d1-tnode:active { opacity: .75; }
#storyPanel.story-console .d1-tnode-active {
  border-color: var(--cyan, #22d3ee);
  background: color-mix(in srgb, var(--cyan, #22d3ee) 14%, rgba(10, 18, 30, .7));
  box-shadow: 0 0 14px color-mix(in srgb, var(--cyan, #22d3ee) 35%, transparent);
}
#storyPanel.story-console .d1-tnode-title {
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-weight: 700; font-size: 10px; letter-spacing: .1em;
  color: #ffffff;
  /* never clip: wrap, don't ellipsis */
  overflow: visible; text-overflow: clip; white-space: normal;
  line-height: 1.4;
  margin-bottom: 4px;
}
#storyPanel.story-console .d1-tnode-sub {
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 600; font-size: 8px; letter-spacing: .14em;
  color: var(--cyan, #22d3ee);
  overflow: visible; text-overflow: clip; white-space: normal;
  line-height: 1.4;
}
#storyPanel.story-console .d1-tnode-here {
  margin-top: 6px;
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 800; font-size: 8px; letter-spacing: .18em;
  color: #04121a;
  background: var(--cyan, #22d3ee);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}
#storyPanel.story-console .d1-tconn {
  flex: none; align-self: center;
  width: 18px; height: 2px;
  background: color-mix(in srgb, var(--cyan, #22d3ee) 35%, transparent);
}
#storyPanel.story-console .d1-timeline-empty {
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 600; font-size: 11px; letter-spacing: .2em;
  color: rgba(205, 238, 255, .55);
  margin: 0 auto; padding: 16px 0;
}

/* short landscape: compact the card so everything still fits, no scroll */
@media (orientation: landscape) and (max-height: 540px) {
  #storyPanel.story-console {
    padding: calc(8px + env(safe-area-inset-top, 0px)) 14px
             calc(8px + env(safe-area-inset-bottom, 0px));
  }
  #storyPanel.story-console .d1-chead { padding: 2px 2px 8px; }
  #storyPanel.story-console .d1-cbody { padding: 10px; }
  #storyPanel.story-console .d1-codex-card { padding: 12px 14px; }
  #storyPanel.story-console .d1-kicker { margin-bottom: 5px; }
  #storyPanel.story-console .d1-ccard-title { font-size: 18px; margin-bottom: 6px; }
  #storyPanel.story-console .d1-rule { margin-bottom: 8px; }
  #storyPanel.story-console .d1-cbody-text { font-size: 12px; line-height: 1.55; }
  #storyPanel.story-console .d1-cfoot-micro { padding-top: 8px; }
  #storyPanel.story-console .d1-pager { padding-top: 8px; }
  #storyPanel.story-console .d1-pgbtn { min-height: 44px; padding: 10px 16px; }
  #storyPanel.story-console .d1-wide { margin-top: 8px; }
}

/* ==========================================================================
 * OPTIONS — chrome-only console reskin. HARD CONSTRAINT honored:
 * the panel KEEPS its scrolling layout, every row stays exactly where it is,
 * every id/wiring/behavior unchanged. Only the look converts.
 * ========================================================================== */
#optPanel.opt-console {
  /* geometry untouched (fixed, centered column, overflow-y:auto) — just the
     console surface: dark gradient + cyan radial glow over the skybox */
  background:
    radial-gradient(120% 90% at 50% 0%,
      color-mix(in srgb, var(--cyan, #22d3ee) 8%, transparent) 0%,
      rgba(0, 0, 0, 0) 55%),
    linear-gradient(180deg, #05090f 0%, #030509 100%);
  color: #e8f6ff;
  font-family: 'Montserrat', Arial, sans-serif;
}
#optPanel.opt-console:not(.hidden) { animation: d1PageIn 240ms ease-out; }

/* the existing eyebrow becomes the console page title — same element,
   same position, console look.
   NOTE: the title text is long ("OPTIONS // TUNE YOUR RIDE"), so this header
   uses a slightly tighter clamp/tracking than the short .d1-ctitle pages —
   full words, never truncated, zero overflow at 320px+. */
#optPanel.opt-console > .eyebrow {
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-weight: 700;
  font-size: clamp(13px, 3.4vw, 24px);
  letter-spacing: .18em; text-indent: .18em;
  color: #f4fcff; text-align: center;
  text-shadow: 0 0 18px color-mix(in srgb, var(--cyan, #22d3ee) 65%, transparent),
               0 0 46px color-mix(in srgb, var(--cyan, #22d3ee) 28%, transparent);
  white-space: nowrap;
  margin: 8px 0 16px;
  padding: 16px 14px 16px 18px;
  /* full content-box width, never vw: the panel's own 20px padding means
     92vw/94vw elements overflow the content box and grow scrollWidth.
     Rows keep their centered position; they just stop clipping 4px a side. */
  width: min(560px, 100%); box-sizing: border-box;
  border: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 16%, transparent);
  border-radius: 16px;
  background: rgba(10, 18, 30, .55);
}
/* same content-box cap for every full-width options element — kills the
   pre-existing ~9px horizontal overflow at 390px (92vw > content box). */
#optPanel.opt-console .opt-sec,
#optPanel.opt-console .opt-row { width: min(420px, 100%); }
#optPanel.opt-console .donatebtn,
#optPanel.opt-console .applemusic { width: min(420px, 100%); }
/* style.css:#optPanel #appleMusicBtn is (2,0,0) — needs an ID-level override */
#optPanel.opt-console #appleMusicBtn { width: min(420px, 100%); }

/* section headers — Orbitron, glow, cyan divider. Geometry kept. */
#optPanel.opt-console .opt-sec {
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-weight: 700; font-size: 13px; line-height: 1.4;
  letter-spacing: .3em;
  color: #f4fcff;
  text-shadow: 0 0 14px color-mix(in srgb, var(--cyan, #22d3ee) 55%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 25%, transparent);
}

/* rows — nested console panels, same border language */
#optPanel.opt-console .opt-row {
  border: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 22%, transparent);
  background: rgba(10, 18, 30, .55);
  border-radius: 14px;
  box-shadow: none;
}
#optPanel.opt-console .opt-row.danger {
  border-color: color-mix(in srgb, var(--danger, #ff2d55) 45%, transparent);
}
#optPanel.opt-console .opt-row b { color: #ffffff; }
#optPanel.opt-console .opt-row .micro { color: rgba(205, 238, 255, .58); }

/* toggles — console pills, cyan glow */
#optPanel.opt-console .opt-toggle {
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-weight: 700; font-size: 12px; letter-spacing: .12em;
  min-height: 44px; min-width: 76px; box-sizing: border-box;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 45%, transparent);
  background: color-mix(in srgb, var(--cyan, #22d3ee) 14%, transparent);
  background-image: none;
  color: #d9f6ff;
  text-shadow: 0 0 10px color-mix(in srgb, var(--cyan, #22d3ee) 50%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--cyan, #22d3ee) 20%, transparent);
  padding: 12px 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#optPanel.opt-console .opt-toggle.off {
  filter: grayscale(.9) brightness(.7);
  box-shadow: none;
}
#optPanel.opt-console .opt-toggle:disabled { opacity: .45; }

/* ghost buttons inside options — secondary console pills */
#optPanel.opt-console button.ghost,
#optPanel.opt-console a.ghost {
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-weight: 700; font-size: 11px; letter-spacing: .14em;
  min-height: 44px; box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 40%, transparent);
  background: rgba(10, 18, 30, .6);
  background-image: none;
  color: #c9f3ff;
  text-shadow: 0 0 10px color-mix(in srgb, var(--cyan, #22d3ee) 45%, transparent);
  box-shadow: none;
  padding: 12px 16px;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#optPanel.opt-console button.ghost.wide,
#optPanel.opt-console a.ghost.wide { width: min(420px, 100%); }
#optPanel.opt-console .nuke-warn { color: rgba(205, 238, 255, .58); }

/* sliders — cyan accent, chrome-only */
#optPanel.opt-console input[type="range"] {
  accent-color: var(--cyan, #22d3ee);
  min-height: 44px;
}

/* text inputs + textareas (admin token, push, import/export) */
#optPanel.opt-console input[type="text"],
#optPanel.opt-console input[type="password"],
#optPanel.opt-console textarea {
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 13px;
  color: #e8f6ff;
  background: rgba(8, 14, 26, .7);
  border: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 30%, transparent);
  border-radius: 10px;
  padding: 12px;
  box-sizing: border-box;
}
#optPanel.opt-console input::placeholder,
#optPanel.opt-console textarea::placeholder {
  color: rgba(205, 238, 255, .38);
}

/* music track list — console pills */
#optPanel.opt-console .track {
  border: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 22%, transparent);
  background: rgba(10, 18, 30, .55);
  border-radius: 12px;
  color: #d9f6ff;
}
#optPanel.opt-console .track b {
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  letter-spacing: .1em;
  color: #ffffff;
}
#optPanel.opt-console .track span { color: rgba(205, 238, 255, .58); }
#optPanel.opt-console .track.on {
  border-color: color-mix(in srgb, var(--cyan, #22d3ee) 70%, transparent);
  background: color-mix(in srgb, var(--cyan, #22d3ee) 14%, transparent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--cyan, #22d3ee) 30%, transparent);
}

/* donate / apple-music links — console pills (anchors, not buttons) */
#optPanel.opt-console .donatebtn,
#optPanel.opt-console .applemusic {
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-weight: 700; font-size: 12px; letter-spacing: .14em;
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; box-sizing: border-box;
  width: min(420px, 100%);
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 40%, transparent);
  background: rgba(10, 18, 30, .6);
  background-image: none;
  color: #c9f3ff; text-decoration: none;
  text-shadow: 0 0 10px color-mix(in srgb, var(--cyan, #22d3ee) 45%, transparent);
  box-shadow: none;
  padding: 12px 16px; margin: 8px 0 0;
}

/* sound-diagnostic readout — readable console text */
#optPanel.opt-console #soundDiagOut { color: rgba(205, 238, 255, .72); }

/* ---------- admin section (lives inside Options) ---------- */
#optPanel.opt-console .admin-head b {
  color: #ffffff;
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  letter-spacing: .12em;
}
#optPanel.opt-console .admin-player {
  border: 1px solid color-mix(in srgb, var(--cyan, #22d3ee) 18%, transparent);
  background: rgba(8, 14, 26, .5);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
#optPanel.opt-console .admin-player .who b { color: #ffffff; font-size: 13px; }
#optPanel.opt-console .admin-player .you-tag {
  color: var(--cyan, #22d3ee); font-size: 11px; font-weight: 400; letter-spacing: .08em;
}
#optPanel.opt-console .admin-player .who span {
  color: rgba(205, 238, 255, .55); font-size: 11px;
}
#optPanel.opt-console .admin-player .ops {
  display: flex; gap: 8px; flex: none;
}
#optPanel.opt-console .admin-player .ops .ghost {
  min-height: 44px; min-width: 44px;
  padding: 10px 12px; font-size: 10px;
}
#optPanel.opt-console #adminPlayerList .micro { color: rgba(205, 238, 255, .58); }
#optPanel.opt-console .chat-row input {
  flex: 1 1 auto; min-width: 0;
}

/* ---------- reduced motion: enter animation off, layout unchanged ---------- */
@media (prefers-reduced-motion: reduce) {
  #storyPanel.story-console:not(.hidden),
  #optPanel.opt-console:not(.hidden) { animation: none; }
}
