/* ==========================================================================
   XENITH — FIELD INSTRUMENT · CONSOLE THEME
   assets/xenith.css — Lane 1, full rewrite around the v6 DOM (index.html FINAL).

   v6 is a research console: deep blue-black field, a living particle formation
   at center (owned by fx.js), liquid-glass side panels, an expanding field
   map in the top bar, contextual inspector tabs, and the uplink terminal.
   Amber micro-labels, cyan primary, electric-blue accents, pulsing red for
   alert states only.

   Kept from v5: design-token core, boot overlay chrome, scanlines/CRT film
   (subtler), terminal block (.x-term-*), terminal line fallbacks +
   widget chrome (.xt-*), disclosures drawer block, buttons,
   thin scrollbar, ::selection, reduced-motion discipline. Everything else is
   new. Vanilla CSS, zero build. Fonts via Google Fonts in index.html.

   Layer map: #fx-bg 0 · .x-scanlines 1 · #x-scene-root 2 · field map 910 ·
   #x-disc-open 890 · #x-footer-strip 900 · #x-topbar 900 · drawer 9500 ·
   boot 10000. (Toasts/sweep are injected by game.js at 9000/9400.)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS
   -------------------------------------------------------------------------- */
:root {
  --x-void: #04060a;        /* page bg */
  --x-panel: #0a0f16;       /* solid panel bg (drawer, fallbacks) */
  --x-cyan: #00f0ff;        /* phosphor cyan — primary signal */
  --x-blue: #4f9fff;        /* electric blue — formation accent */
  --x-amber: #ffb000;       /* micro-labels, tabs, index numbers */
  --x-red: #ff2d3c;         /* alert states only — used sparingly */
  --x-text: #d7e3ee;        /* body text */
  --x-copy: #b7c9dd;        /* panel copy */
  --x-dim: #8fa8c4;         /* muted text (contrast floor — do not lower) */
  --x-line: rgba(0, 240, 255, .14); /* hairlines */
  --x-font-d: 'Space Grotesk', system-ui, sans-serif;
  --x-font-m: 'JetBrains Mono', ui-monospace, monospace;

  /* derived helpers */
  --x-cyan-dim: rgba(0, 240, 255, .55);
  --x-cyan-faint: rgba(0, 240, 255, .08);
  --x-red-dim: rgba(255, 45, 60, .14);
  --x-red-faint: rgba(255, 45, 60, .07);
  --x-glow-cyan: 0 0 18px rgba(0, 240, 255, .35);
  --x-ease-out: cubic-bezier(.22, 1, .36, 1);

  /* liquid-glass recipe (v7): clear enough that the formation reads
     THROUGH the panel; saturate+brighten makes what's behind bloom like
     light through curved glass instead of graying out. */
  --x-glass-bg: rgba(9, 14, 24, .47);
  --x-glass-blur: blur(20px) saturate(1.55) brightness(1.02);
  --x-glass-edge: rgba(151, 214, 255, .17);   /* rim hairline */
  --x-glass-rim: rgba(255, 255, 255, .16);    /* lit top edge */
  /* cursor-tracked specular (ui-fx.js writes --gx/--gy per panel) */
  --gx: 50%;
  --gy: 18%;
  --glare: 0;      /* 0 idle -> 1 hovered */
  /* fixed chrome metrics */
  --x-topbar-h: 54px;
  --x-footer-h: 34px;
  --x-gutter-l: clamp(2rem, 4.5vw, 5rem);
}

/* --------------------------------------------------------------------------
   2. BASE RESET — console is a fixed, non-scrolling instrument
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, .3) var(--x-void);
}

html,
body {
  height: 100%;
  overflow: hidden; /* scenes swap by class; the document itself never scrolls */
}

body {
  background:
    radial-gradient(55% 38% at 72% -4%, rgba(0, 240, 255, .05), transparent 62%),
    radial-gradient(48% 36% at 10% 104%, rgba(79, 159, 255, .05), transparent 62%),
    var(--x-void);
  color: var(--x-text);
  font-family: var(--x-font-d);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

code {
  font-family: var(--x-font-m);
  font-size: .92em;
  color: var(--x-cyan);
}

a:focus-visible,
input:focus-visible,
button:focus-visible {
  outline: 1px solid var(--x-cyan);
  outline-offset: 3px;
}

/* text selection: cyan wash, dark glyph */
::selection {
  background: var(--x-cyan);
  color: var(--x-void);
}
::-moz-selection {
  background: var(--x-cyan);
  color: var(--x-void);
}

/* thin neon scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--x-void);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, .22);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 240, 255, .45);
}

/* main.js strips x-preload on init; until then nothing transitions */
body.x-preload *,
body.x-preload *::before,
body.x-preload *::after {
  transition: none !important;
}

/* --------------------------------------------------------------------------
   3. FIXED ATMOSPHERE — canvas + scanlines/CRT film (subtler in v6)
   -------------------------------------------------------------------------- */
#fx-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  background: transparent;
}

/* CRT scanline film + vignette at half strength. Decorative, inert. */
.x-scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .5;
  background:
    radial-gradient(ellipse 82% 62% at 50% 42%, transparent 58%, rgba(2, 4, 8, .55) 100%),
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px);
  background-position: 0 0, 0 0;
  animation: x-scanlines 7s linear infinite, x-crt-flicker 7s linear infinite;
}

@keyframes x-scanlines {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 0, 0 3px; } /* exactly one tile: seamless loop */
}

/* tiny-amplitude flicker around the .5 base; irregular dips keep it organic */
@keyframes x-crt-flicker {
  0%, 5.5%    { opacity: .5; }
  6.5%        { opacity: .46; }
  8%, 31%     { opacity: .5; }
  32.5%       { opacity: .48; }
  34%, 52%    { opacity: .5; }
  53.5%       { opacity: .47; }
  55%, 76%    { opacity: .5; }
  77%         { opacity: .48; }
  78.5%, 100% { opacity: .5; }
}

/* breathing vignette riding beside the constant base vignette */
.x-scanlines::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 84% 64% at 50% 42%, transparent 56%, rgba(2, 4, 8, .5) 100%);
  opacity: .15;
  animation: x-vignette-breathe 9s ease-in-out infinite;
}

@keyframes x-vignette-breathe {
  0%, 100% { opacity: .14; }
  50%      { opacity: .3; }
}

/* v7: a slow radar sweep — one soft cyan band traveling down the console
   every 9s. Reads as an idle sensor pass; barely-there by design. */
.x-scanlines::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -22%;
  height: 18%;
  background: linear-gradient(to bottom,
    transparent 0%,
    rgba(0, 240, 255, .028) 42%,
    rgba(151, 214, 255, .075) 50%,
    rgba(0, 240, 255, .028) 58%,
    transparent 100%);
  animation: x-scan-beam 9s cubic-bezier(.4, 0, .6, 1) infinite;
}

@keyframes x-scan-beam {
  0%       { transform: translateY(0); opacity: 0; }
  6%       { opacity: 1; }
  62%      { opacity: 1; }
  70%, 100% { transform: translateY(72vh) translateY(122%); opacity: 0; }
}

/* --------------------------------------------------------------------------
   4. BOOT OVERLAY — #x-boot (boot.js types lines, then adds .is-done)
   -------------------------------------------------------------------------- */
#x-boot {
  position: fixed;
  inset: 0;
  z-index: 10000; /* topmost layer: above drawer, topbar, everything */
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(58% 42% at 50% 38%, rgba(0, 240, 255, .05), transparent 70%),
    linear-gradient(rgba(0, 240, 255, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, .04) 1px, transparent 1px),
    var(--x-void);
  background-size: 100% 100%, 44px 44px, 44px 44px, 100% 100%;
  opacity: 1;
  transform: scale(1);
  transition: opacity .5s ease, transform .5s ease;
}

#x-boot.is-done {
  opacity: 0;
  transform: scale(1.03);
  pointer-events: none;
}

/* no-JS users must never see the opaque boot wall (noscript lives beneath) */
html:not(.js) #x-boot {
  display: none;
}

.x-boot-inner {
  width: min(560px, 88vw);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.x-boot-mark {
  width: 84px;
  height: 84px;
  align-self: center;
  color: var(--x-cyan);
  filter: drop-shadow(0 0 14px rgba(0, 240, 255, .55));
}

/* the seal is a live instrument: bezel and shell counter-rotate slowly.
   Reduced motion freezes both via the global animation clamp. */
.x-boot-mark .xsl-bezel {
  animation: x-seal-spin 70s linear infinite;
  transform-origin: 16px 16px;
}

.x-boot-mark .xsl-shell {
  animation: x-seal-spin-r 110s linear infinite;
  transform-origin: 16px 16px;
}

@keyframes x-seal-spin {
  to { transform: rotate(360deg); }
}

@keyframes x-seal-spin-r {
  to { transform: rotate(-360deg); }
}

.x-boot-brand {
  font-family: var(--x-font-d);
  font-weight: 700;
  font-size: clamp(1.3rem, 3.6vw, 1.9rem);
  letter-spacing: .42em;
  text-indent: .42em; /* optically recenter letterspaced caps */
  text-align: center;
  color: var(--x-cyan);
  text-shadow: 0 0 18px rgba(0, 240, 255, .65), 0 0 46px rgba(0, 240, 255, .28);
}

#x-boot-log {
  width: 100%;
  min-height: 7em;
  font-family: var(--x-font-m);
  font-size: 13px;
  line-height: 1.7;
  color: var(--x-dim);
  overflow: hidden;
}

.x-boot-bar {
  width: 100%;
  height: 2px;
  background: rgba(0, 240, 255, .12);
  overflow: hidden;
}

#x-boot-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--x-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, .85), 0 0 26px rgba(0, 240, 255, .4);
  transition: width .2s linear;
}

.x-boot-pct {
  align-self: flex-end;
  font-family: var(--x-font-m);
  font-size: .72rem;
  letter-spacing: .22em;
  color: var(--x-amber);
  text-shadow: 0 0 12px rgba(255, 176, 0, .4);
}

/* --------------------------------------------------------------------------
   5. TOP FIELD BAR — brand left / field label center / tags + status right
   -------------------------------------------------------------------------- */
#x-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--x-topbar-h);
  padding: calc(.5rem + env(safe-area-inset-top)) clamp(.8rem, 2.5vw, 1.4rem) .5rem;
  background: rgba(4, 6, 10, .42);
  -webkit-backdrop-filter: blur(18px) saturate(1.55);
  backdrop-filter: blur(18px) saturate(1.55);
  border-bottom: 1px solid var(--x-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: background .3s ease, border-color .3s ease, box-shadow .3s ease;
}

/* session telemetry readout (ui-fx.js ticks it) */
#x-uptime {
  font-family: var(--x-font-m);
  font-size: .56rem;
  letter-spacing: .18em;
  color: var(--x-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  user-select: none;
  -webkit-user-select: none;
}

/* kept for main.js: deepen the bar once the console is live */
#x-topbar.is-scrolled {
  background: rgba(4, 6, 10, .86);
  border-bottom-color: rgba(0, 240, 255, .22);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .4);
}

.xtb-l,
.xtb-r {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
  flex: none;
}

.xtb-l .x-mark {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--x-cyan);
  filter: drop-shadow(0 0 6px rgba(0, 240, 255, .55));
}

.xtb-brand {
  font-family: var(--x-font-d);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .24em;
  color: var(--x-text);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

/* center field readout: "XC / FIELD 0N — SECTION NAME" (main.js rewrites) */
.xtb-c {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
}

#x-field-label {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  font-family: var(--x-font-m);
  font-size: .6rem;
  letter-spacing: .18em;
  color: var(--x-dim);
}

.xtb-tags {
  font-family: var(--x-font-m);
  font-size: .56rem;
  letter-spacing: .18em;
  color: var(--x-dim);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

/* SYS.ONLINE readout with the cyan pulse dot */
.xtb-status {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  font-family: var(--x-font-m);
  font-size: .58rem;
  letter-spacing: .2em;
  color: var(--x-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, .45);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   6. PULSE DOT — 6px dot + expanding ring (2s). CYAN by default (status);
      .x-pulse-red is the alert variant, used sparingly.
   -------------------------------------------------------------------------- */
.x-pulse-dot {
  position: relative;
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--x-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, .9);
}

.x-pulse-dot::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid rgba(0, 240, 255, .7);
  border-radius: 50%;
  animation: x-pulse-ring 2s var(--x-ease-out) infinite;
}

.x-pulse-red {
  background: var(--x-red);
  box-shadow: 0 0 8px rgba(255, 45, 60, .9);
}

.x-pulse-red::after {
  border-color: rgba(255, 45, 60, .7);
}

@keyframes x-pulse-ring {
  0%   { transform: scale(1);   opacity: .9; }
  60%  { transform: scale(2.2); opacity: .28; }
  100% { transform: scale(2.8); opacity: 0; }
}

/* --------------------------------------------------------------------------
   7. LEFT RAIL — five scene buttons (icon + number + vertical name);
      under 860px it becomes a full-width bottom icon bar (see responsive).
   -------------------------------------------------------------------------- */
#x-rail {
  position: fixed;
  top: 50%;
  left: calc(.9rem + env(safe-area-inset-left));
  transform: translateY(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.xr-item {
  position: relative;
  width: var(--x-rail-w);
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  padding: .75rem .25rem;
  background: rgba(10, 16, 27, .32);
  -webkit-backdrop-filter: blur(18px) saturate(1.55);
  backdrop-filter: blur(18px) saturate(1.55);
  border: 1px solid rgba(151, 214, 255, .13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color .25s ease, box-shadow .25s ease,
              background .25s ease, transform .25s var(--x-ease-out);
}

.xr-num {
  font-family: var(--x-font-m);
  font-size: .55rem;
  letter-spacing: .18em;
  color: var(--x-amber);
}

.xr-ico {
  font-size: 20px;
  line-height: 1;
  color: var(--x-dim);
  transition: color .25s ease, text-shadow .25s ease;
}

.xr-name {
  writing-mode: vertical-rl;
  font-family: var(--x-font-m);
  font-size: .56rem;
  letter-spacing: .3em;
  line-height: 1;
  color: var(--x-dim);
  transition: color .25s ease, text-shadow .25s ease;
}

/* active-scene left tick */
.xr-item::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 18%;
  bottom: 18%;
  width: 2px;
  background: var(--x-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, .8);
  opacity: 0;
  transition: opacity .25s ease;
}

.xr-item.is-active {
  border-color: rgba(0, 240, 255, .55);
  background: rgba(0, 240, 255, .06);
  box-shadow: 0 0 18px rgba(0, 240, 255, .18), inset 0 0 12px rgba(0, 240, 255, .05);
}

.xr-item.is-active::before {
  opacity: 1;
}

.xr-item.is-active .xr-ico,
.xr-item.is-active .xr-name {
  color: var(--x-cyan);
  text-shadow: 0 0 12px rgba(0, 240, 255, .55);
}

@media (hover: hover) {
  .xr-item:hover {
    border-color: rgba(0, 240, 255, .45);
    background: rgba(0, 240, 255, .05);
    transform: translateX(3px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14),
                0 0 22px rgba(0, 240, 255, .16);
  }

  .xr-item:hover .xr-ico {
    color: var(--x-cyan);
    text-shadow: 0 0 10px rgba(0, 240, 255, .5);
  }

  .xr-item:hover .xr-name,
  .xr-item:hover .xr-num {
    color: var(--x-cyan);
  }
}

/* --------------------------------------------------------------------------
   8. SCENE ROOT + TRANSITIONS — one scene visible; .is-in slides+fades in
      from the right, .is-out exits left (400ms cubic). Reduced-motion: instant.
      Both classes force visibility so they compose with or without .is-active.
   -------------------------------------------------------------------------- */
#x-scene-root {
  position: fixed;
  inset: 0;
  z-index: 2;
}

.x-scene {
  position: relative;
}

html.js .x-scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

html.js .x-scene.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.x-scene.is-in {
  visibility: visible;
  pointer-events: auto;
  animation: x-scene-in .4s cubic-bezier(.22, 1, .36, 1) both;
}

.x-scene.is-out {
  visibility: visible;
  pointer-events: none;
  animation: x-scene-out .4s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes x-scene-in {
  from { opacity: 0; transform: translateX(3.5vw); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes x-scene-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-3.5vw); }
}

/* --------------------------------------------------------------------------
   9. LIQUID GLASS PANELS (v7) — the formation shows THROUGH the panels.
      Recipe, per panel:
      · body: heavy blur + saturate/brighten (light blooms, never grays out)
      · directional smoke tint: darker behind the text mass, clearing to
        near-transparent on the edge that faces the formation — this is
        what keeps "visibility perfect" while the glass goes clear
      · micro-grain (inline SVG noise) so the surface reads as material
      · lit top rim + dark seat + cyan light pooling at the bottom edge
      · ::before — HUD chrome: corner brackets (extend on hover) + top edge
      · ::after — cursor-tracked specular glare (ui-fx.js drives --gx/--gy;
        :hover raises --glare)
   -------------------------------------------------------------------------- */
.xs-panel-l,
.xs-panel-r {
  background:
    radial-gradient(130% 90% at 8% 0%, rgba(151, 214, 255, .085), transparent 48%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--x-glass-bg);
  -webkit-backdrop-filter: var(--x-glass-blur);
  backdrop-filter: var(--x-glass-blur);
  border: 1px solid var(--x-glass-edge);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, .46),
    0 0 48px -10px rgba(0, 240, 255, .14),
    inset 0 1px 0 var(--x-glass-rim),
    inset 0 -1px 0 rgba(0, 0, 0, .38),
    inset -1px 0 0 rgba(151, 214, 255, .05),
    inset 0 -26px 52px -32px rgba(0, 240, 255, .26);
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, .25) transparent;
  transition: border-color .35s ease, box-shadow .35s ease;
}

/* directional smoke: text side dense, formation side clear */
.xs-panel-l {
  background-image:
    radial-gradient(130% 90% at 8% 0%, rgba(151, 214, 255, .085), transparent 48%),
    linear-gradient(100deg, rgba(4, 8, 15, .64) 0%, rgba(5, 10, 18, .42) 58%, rgba(8, 14, 25, .12) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.xs-panel-r {
  background-image:
    radial-gradient(130% 90% at 92% 0%, rgba(151, 214, 255, .085), transparent 48%),
    linear-gradient(260deg, rgba(4, 8, 15, .64) 0%, rgba(5, 10, 18, .42) 58%, rgba(8, 14, 25, .12) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (hover: hover) {
  .xs-panel-l:hover,
  .xs-panel-r:hover {
    --glare: 1;
    border-color: rgba(151, 214, 255, .30);
    box-shadow:
      0 30px 70px rgba(0, 0, 0, .46),
      0 0 58px -8px rgba(0, 240, 255, .22),
      inset 0 1px 0 rgba(255, 255, 255, .24),
      inset 0 -1px 0 rgba(0, 0, 0, .38),
      inset -1px 0 0 rgba(151, 214, 255, .05),
      inset 0 -26px 52px -32px rgba(0, 240, 255, .34);
  }
}

/* HUD chrome: top cyan edge + four corner brackets that extend on hover */
.xs-panel-l::before,
.xs-panel-r::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(0, 240, 255, .8), transparent) top center / 84% 1px,
    linear-gradient(rgba(0, 240, 255, .85), rgba(0, 240, 255, .85)) top left / 13px 1px,
    linear-gradient(rgba(0, 240, 255, .85), rgba(0, 240, 255, .85)) top left / 1px 13px,
    linear-gradient(rgba(0, 240, 255, .85), rgba(0, 240, 255, .85)) top right / 13px 1px,
    linear-gradient(rgba(0, 240, 255, .85), rgba(0, 240, 255, .85)) top right / 1px 13px,
    linear-gradient(rgba(0, 240, 255, .85), rgba(0, 240, 255, .85)) bottom left / 13px 1px,
    linear-gradient(rgba(0, 240, 255, .85), rgba(0, 240, 255, .85)) bottom left / 1px 13px,
    linear-gradient(rgba(0, 240, 255, .85), rgba(0, 240, 255, .85)) bottom right / 13px 1px,
    linear-gradient(rgba(0, 240, 255, .85), rgba(0, 240, 255, .85)) bottom right / 1px 13px;
  background-repeat: no-repeat;
  transition: background-size .4s var(--x-ease-out);
}

@media (hover: hover) {
  .xs-panel-l:hover::before,
  .xs-panel-r:hover::before {
    background-size:
      84% 1px,
      26px 1px, 1px 26px,
      26px 1px, 1px 26px,
      26px 1px, 1px 26px,
      26px 1px, 1px 26px;
  }
}

/* liquid specular: a soft light following the cursor across the glass */
.xs-panel-l::after,
.xs-panel-r::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: var(--glare);
  background:
    radial-gradient(260px circle at var(--gx) var(--gy),
      rgba(196, 236, 255, .15), rgba(151, 214, 255, .055) 42%, transparent 64%);
  transition: opacity .35s ease;
}

.xs-panel-l::-webkit-scrollbar,
.xs-panel-r::-webkit-scrollbar {
  width: 5px;
}

.xs-panel-l::-webkit-scrollbar-track,
.xs-panel-r::-webkit-scrollbar-track {
  background: transparent;
}

/* --- left panel: scene narrative ------------------------------------------ */
.xs-panel-l {
  position: absolute;
  left: var(--x-gutter-l);
  top: 50%;
  transform: translateY(-50%);
  width: min(530px, 38vw);
  max-height: calc(100vh - var(--x-topbar-h) - var(--x-footer-h) - 13rem);
  max-height: calc(100dvh - var(--x-topbar-h) - var(--x-footer-h) - 13rem);
  overflow-y: auto;
  padding: 2rem;
}

/* amber scene tab with a left tick */
.xs-tab {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  font-family: var(--x-font-m);
  font-size: .6rem;
  letter-spacing: .3em;
  color: var(--x-amber);
  text-shadow: 0 0 12px rgba(255, 176, 0, .35);
}

.xs-tab::before {
  content: "";
  width: 1.5rem;
  height: 1px;
  flex: none;
  background: var(--x-amber);
  box-shadow: 0 0 8px rgba(255, 176, 0, .6);
}

.xs-title {
  margin-top: 1rem;
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 3.45rem);
  line-height: 1.06;
  letter-spacing: -.01em;
  color: var(--x-text);
  text-shadow: 0 0 38px rgba(0, 240, 255, .1);
  /* idle signal instability: one 200ms chromatic tick every 12s */
  animation: x-title-idle 12s linear infinite 6s;
}

/* scene entry: chromatic aberration settling into focus */
.x-scene.is-in .xs-title {
  animation: x-chroma .55s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes x-chroma {
  0% {
    text-shadow: -7px 0 rgba(255, 45, 60, .5), 7px 0 rgba(0, 240, 255, .55),
                 0 0 38px rgba(0, 240, 255, .1);
    transform: skewX(-1.2deg);
  }
  45% {
    text-shadow: -2px 0 rgba(255, 45, 60, .35), 2px 0 rgba(0, 240, 255, .4),
                 0 0 38px rgba(0, 240, 255, .1);
    transform: skewX(0);
  }
  100% {
    text-shadow: 0 0 rgba(255, 45, 60, 0), 0 0 rgba(0, 240, 255, 0),
                 0 0 38px rgba(0, 240, 255, .1);
    transform: none;
  }
}

@keyframes x-title-idle {
  0%, 97.1%, 98.9%, 100% {
    text-shadow: 0 0 38px rgba(0, 240, 255, .1);
    transform: none;
  }
  97.7% {
    text-shadow: -4px 0 rgba(255, 45, 60, .38), 4px 0 rgba(0, 240, 255, .42),
                 0 0 38px rgba(0, 240, 255, .1);
    transform: translateX(1px);
  }
  98.3% {
    text-shadow: 2px 0 rgba(255, 45, 60, .3), -2px 0 rgba(0, 240, 255, .34),
                 0 0 38px rgba(0, 240, 255, .1);
    transform: translateX(-1px);
  }
}

.xs-copy {
  margin-top: 1.2rem;
  max-width: 58ch;
  color: var(--x-copy);
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.62;
}

.xs-micro {
  margin-top: 1.4rem;
  padding-top: .9rem;
  font-family: var(--x-font-m);
  font-size: .62rem;
  letter-spacing: .22em;
  line-height: 1.8;
  color: var(--x-dim);
  border-top: 1px solid var(--x-line);
}

/* --- scene 4 fact grid (lives inside .xs-panel-l) -------------------------- */
.xo-facts {
  margin-top: 1.6rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
  min-width: 0;
}

.x-fact {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .35rem;
  min-height: 5.4rem;
  padding: .8rem .85rem;
  background: rgba(0, 240, 255, .03);
  border: 1px solid var(--x-line);
}

.x-fact-num {
  font-weight: 500;
  font-size: clamp(1.9rem, 2.6vw, 2.4rem);
  line-height: 1;
  color: var(--x-cyan);
  text-shadow: 0 0 22px rgba(0, 240, 255, .35);
  font-variant-numeric: tabular-nums;
}

.x-fact-word {
  font-size: clamp(1rem, 1.8vw, 1.4rem);
  letter-spacing: .07em;
  overflow-wrap: anywhere;
}

.x-fact-label {
  font-family: var(--x-font-m);
  font-size: .54rem;
  letter-spacing: .24em;
  color: var(--x-dim);
}

/* --------------------------------------------------------------------------
   10. OBJECT INSPECTOR — .xs-panel-r.x-insp (right side). Field values are
       per-scene repeated classes; main.js swaps content on selection.
       Inspector fade swap hook: .x-insp.is-swap (opacity-only, 180ms) —
       main.js toggles it around a content rewrite.
   -------------------------------------------------------------------------- */
.xs-panel-r {
  position: absolute;
  right: clamp(1.25rem, 3vw, 3rem);
  top: 50%;
  transform: translateY(-50%);
  width: min(370px, 27vw);
  max-height: calc(100vh - var(--x-topbar-h) - var(--x-footer-h) - 13rem);
  max-height: calc(100dvh - var(--x-topbar-h) - var(--x-footer-h) - 13rem);
  overflow-y: auto;
  padding: 1.75rem 1.9rem;
}

.x-insp {
  transition: opacity .18s ease, border-color .35s ease, box-shadow .35s ease;
}

/* inspector content swap: main.js fades the panel out, rewrites, fades in */
.x-insp.xi-fade {
  opacity: 0;
}

.xi-head {
  font-family: var(--x-font-m);
  font-size: .58rem;
  letter-spacing: .26em;
  color: var(--x-amber);
  text-shadow: 0 0 10px rgba(255, 176, 0, .35);
  margin-bottom: .9rem;
}

.xi-title {
  font-weight: 500;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: -.01em;
  color: var(--x-text);
}

.xi-kicker {
  margin-top: .9rem;
  font-family: var(--x-font-m);
  font-size: .55rem;
  letter-spacing: .22em;
  line-height: 1.5;
  color: var(--x-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, .3);
}

.xi-role {
  margin: .3rem 0 1rem;
  padding: 0 0 .85rem;
  font-family: var(--x-font-d);
  font-size: 1.08rem;
  font-weight: 400;
  letter-spacing: -.01em;
  line-height: 1.4;
  color: var(--x-text);
  border-bottom: 1px solid var(--x-line);
}

.xi-desc {
  color: var(--x-copy);
  font-weight: 300;
  font-size: .92rem;
  line-height: 1.7;
}

/* two-row mono micro readout: dim label + value */
.xi-system,
.xi-auth {
  display: grid;
  gap: .35rem;
  margin-top: 1.1rem;
  padding-top: .9rem;
  font-family: var(--x-font-m);
  font-size: .62rem;
  letter-spacing: .14em;
  border-top: 1px solid var(--x-line);
}

.xi-system > span:first-child,
.xi-auth > span:first-child {
  color: var(--x-dim);
  letter-spacing: .2em;
}

.xi-system-v,
.xi-system > span:last-child {
  color: #c9d9ea;
  line-height: 1.6;
}

/* auth chip value: SEALED red until terminal.js proves the channel */
#xi-auth-state {
  color: var(--x-red);
  text-shadow: 0 0 12px rgba(255, 45, 60, .55);
  letter-spacing: .22em;
}

#xi-auth-state.is-verified {
  color: var(--x-cyan);
  text-shadow: 0 0 12px rgba(0, 240, 255, .55);
}

/* --------------------------------------------------------------------------
   11. CONTEXT OBJECTS — bottom row of four glass strips per scene.
   -------------------------------------------------------------------------- */
.xs-objects {
  position: absolute;
  left: var(--x-gutter-l);
  right: max(clamp(1.25rem, 3vw, 3rem), 9.5rem); /* clears #x-disc-open */
  bottom: calc(var(--x-footer-h) + .9rem);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.xo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .28rem;
  min-width: 0;
  min-height: 64px;
  padding: .75rem .9rem .8rem;
  text-align: left;
  background:
    linear-gradient(115deg, rgba(5, 9, 17, .58), rgba(7, 12, 22, .38) 70%, rgba(9, 15, 26, .26)),
    rgba(9, 14, 24, .40);
  -webkit-backdrop-filter: blur(16px) saturate(1.55) brightness(1.02);
  backdrop-filter: blur(16px) saturate(1.55) brightness(1.02);
  border: 1px solid rgba(151, 214, 255, .14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .12),
    inset 0 -1px 0 rgba(0, 0, 0, .3),
    0 12px 30px rgba(0, 0, 0, .3);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
  -webkit-user-select: none;
  /* ui-fx.js drives --tx/--ty (3D tilt) and --gx/--gy (glare) per card */
  transform: perspective(760px) rotateX(var(--tx)) rotateY(var(--ty));
  transition: transform .22s var(--x-ease-out), border-color .25s ease,
              box-shadow .25s ease, background .25s ease;
  will-change: transform;
}

/* per-card cursor glare */
.xo-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: var(--glare);
  background:
    radial-gradient(150px circle at var(--gx) var(--gy),
      rgba(196, 236, 255, .16), rgba(151, 214, 255, .05) 46%, transparent 68%);
  transition: opacity .3s ease;
}

/* selected-card top tick */
.xo-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 12%;
  right: 12%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--x-cyan), transparent);
  box-shadow: 0 0 10px rgba(0, 240, 255, .5);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}

.xo-num {
  font-family: var(--x-font-m);
  font-size: .55rem;
  letter-spacing: .2em;
  color: var(--x-amber);
}

.xo-name {
  font-weight: 500;
  font-size: .95rem;
  letter-spacing: .02em;
  line-height: 1.25;
  color: var(--x-text);
}

.xo-line {
  font-family: var(--x-font-m);
  font-size: .62rem;
  line-height: 1.55;
  color: var(--x-dim);
}

.xo-card.is-sel {
  background: rgba(0, 240, 255, .05);
  border-color: rgba(0, 240, 255, .65);
  box-shadow: inset 0 0 18px rgba(0, 240, 255, .06),
              0 10px 26px rgba(0, 0, 0, .35);
}

.xo-card.is-sel::before {
  opacity: 1;
}

@media (hover: hover) {
  .xo-card:hover {
    --glare: 1;
    transform: perspective(760px) rotateX(var(--tx)) rotateY(var(--ty)) translateY(-4px) scale(1.015);
    border-color: rgba(0, 240, 255, .5);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, .18),
      inset 0 -1px 0 rgba(0, 0, 0, .3),
      0 18px 40px rgba(0, 0, 0, .42),
      0 0 26px rgba(0, 240, 255, .16);
  }
}

/* --------------------------------------------------------------------------
   12. DIRECT CHANNEL — the terminal is the scene, not a widget beneath two
       competing explanations. It occupies the center of the available field.
   -------------------------------------------------------------------------- */
.xs-terminal-wrap {
  position: absolute;
  left: calc(50% + 28px);
  top: calc(var(--x-topbar-h) + clamp(2.5rem, 8vh, 5rem));
  bottom: calc(var(--x-footer-h) + clamp(3.2rem, 7vh, 5rem));
  transform: translateX(-50%);
  width: min(1040px, calc(100vw - var(--x-gutter-l) - 8rem));
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.x-channel-label {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-bottom: .75rem;
  padding: 0 .15rem;
  font-family: var(--x-font-m);
  font-size: .58rem;
  letter-spacing: .22em;
  color: var(--x-dim);
}

.x-scene[data-scene="5"] #x-terminal {
  flex: 1 1 auto;
  min-height: 0;
}

.x-scene[data-scene="5"] .x-term-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

/* --- mandate terminal (v5 block, preserved) -------------------------------- */
#x-terminal {
  position: relative; /* scopes the terminal's injected .xt-rain overlay */
  overflow: hidden;
  background: #05080d;
  border: 1px solid var(--x-line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5), 0 0 42px rgba(0, 240, 255, .06);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.x-term-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--x-line);
  background: rgba(255, 255, 255, .02);
  flex: none;
}

.x-term-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.x-term-dot:nth-child(1) {
  background: var(--x-red);
  box-shadow: 0 0 8px rgba(255, 45, 60, .6);
}

.x-term-dot:nth-child(2) {
  background: var(--x-amber);
  box-shadow: 0 0 8px rgba(255, 176, 0, .55);
}

.x-term-dot:nth-child(3) {
  background: var(--x-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, .6);
}

.x-term-title {
  min-width: 0;
  margin-left: .6rem;
  font-family: var(--x-font-m);
  font-size: .62rem;
  letter-spacing: .2em;
  color: var(--x-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.x-term-auth {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  margin-left: auto;
  font-family: var(--x-font-m);
  font-size: .55rem;
  letter-spacing: .18em;
  color: var(--x-dim);
  white-space: nowrap;
}

.x-term-body {
  font-family: var(--x-font-m);
  font-size: 14px;
  line-height: 1.7;
  color: #c9d9ea;
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  padding: 1rem 1.15rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, .3) transparent;
}

.x-term-body::-webkit-scrollbar {
  width: 6px;
}

.x-term-body::-webkit-scrollbar-track {
  background: transparent;
}

.x-term-body a {
  color: var(--x-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.x-term-form-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .8rem 1.15rem;
  border-top: 1px solid var(--x-line);
  transition: background .25s ease;
  flex: none;
}

.x-term-form-row:focus-within {
  background: rgba(0, 240, 255, .04);
}

.x-term-prompt {
  font-family: var(--x-font-m);
  font-size: 14px;
  color: var(--x-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, .6);
  flex: none;
}

.x-term-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}

#x-term-input {
  width: 100%;
  min-height: 44px; /* touch floor */
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  font-family: var(--x-font-m);
  font-size: 14px;
  color: var(--x-cyan);
  caret-color: var(--x-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, .35);
}

#x-term-input::placeholder {
  color: var(--x-dim); /* contrast floor — do not lower */
}

.x-term-submit {
  flex: none;
  min-width: 54px;
  min-height: 44px;
  padding: 0 .7rem;
  font-family: var(--x-font-m);
  font-size: .54rem;
  letter-spacing: .18em;
  color: var(--x-cyan);
  background: rgba(0, 240, 255, .045);
  border: 1px solid rgba(0, 240, 255, .24);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.x-term-submit:hover,
.x-term-submit:focus-visible {
  background: rgba(0, 240, 255, .1);
  border-color: rgba(0, 240, 255, .58);
  box-shadow: 0 0 18px rgba(0, 240, 255, .12);
}

/* --------------------------------------------------------------------------
   13. BUTTONS (v5 block, preserved)
   -------------------------------------------------------------------------- */
.x-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 48px;
  padding: .85rem 1.7rem;
  font-family: var(--x-font-m);
  font-size: .68rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-align: center;
  color: var(--x-cyan);
  background: rgba(0, 240, 255, .05);
  border: 1px solid rgba(0, 240, 255, .5);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .15s ease-out, box-shadow .3s ease,
              background .3s ease, color .3s ease, border-color .3s ease,
              text-shadow .3s ease;
}

/* light sweep crossing the face on hover */
.x-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -85%;
  width: 55%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .4), transparent);
  transform: skewX(-20deg);
  transition: left .55s ease;
  pointer-events: none;
}

.x-btn:hover {
  transform: translateY(-2px);
  background: rgba(0, 240, 255, .13);
  border-color: var(--x-cyan);
  box-shadow: 0 0 30px rgba(0, 240, 255, .35), inset 0 0 18px rgba(0, 240, 255, .08);
  text-shadow: 0 0 12px rgba(0, 240, 255, .65);
}

.x-btn:hover::before {
  left: 135%;
}

.x-btn:active {
  transform: translateY(0);
}

/* alert variant: red-bordered, red glow, red sweep */
.x-btn-red {
  color: var(--x-red);
  background: var(--x-red-dim);
  border-color: rgba(255, 45, 60, .55);
}

.x-btn-red::before {
  background: linear-gradient(100deg, transparent, rgba(255, 45, 60, .32), transparent);
}

.x-btn-red:hover {
  background: rgba(255, 45, 60, .16);
  border-color: var(--x-red);
  box-shadow: 0 0 30px rgba(255, 45, 60, .4), inset 0 0 18px rgba(255, 45, 60, .1);
  text-shadow: 0 0 12px rgba(255, 45, 60, .7);
}

/* --------------------------------------------------------------------------
   14. FOOTER STRIP — fixed bottom micro bar: coordinates / colophon / pager
   -------------------------------------------------------------------------- */
#x-footer-strip {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem 1.2rem;
  min-height: var(--x-footer-h);
  padding: .4rem clamp(.8rem, 2.5vw, 1.4rem) calc(.4rem + env(safe-area-inset-bottom));
  font-family: var(--x-font-m);
  font-size: .56rem;
  letter-spacing: .14em;
  color: var(--x-dim);
  white-space: nowrap;
  background: rgba(4, 6, 10, .44);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  border-top: 1px solid var(--x-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.xf-l,
.xf-c,
.xf-r {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xf-c {
  flex: 1 1 auto;
  text-align: center;
}

.xf-r {
  flex: none;
  color: var(--x-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, .4);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   15. DISCLOSURES — #x-disc-open fixed bottom-right tiny red-bordered mono;
       #x-disc drawer block preserved from v5 (drawer.js toggles .is-open and
       waits on the .x-disc-panel 450ms transition — keep in sync).
   -------------------------------------------------------------------------- */
/* quiet chip: present for anyone who looks for it, invisible to everyone
   else. Neutral glass, dim mono, no red, no glow at rest. */
.x-disc-btn {
  -webkit-appearance: none;
  appearance: none;
  font-family: var(--x-font-m);
  font-size: .56rem;
  letter-spacing: .2em;
  color: var(--x-dim);
  background: rgba(10, 16, 27, .32);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  backdrop-filter: blur(12px) saturate(1.4);
  border: 1px solid rgba(151, 214, 255, .12);
  padding: .55rem .8rem;
  min-height: 44px;
  cursor: pointer;
  transition: color .25s ease, border-color .25s ease,
              box-shadow .25s ease, background .25s ease;
}

.x-disc-btn:hover {
  color: var(--x-text);
  border-color: rgba(151, 214, 255, .3);
  background: rgba(0, 240, 255, .04);
  box-shadow: 0 0 16px rgba(0, 240, 255, .1);
}

/* right edge shares the footer's padding line; bottom sits one clean gap
   above the footer strip — visually seated in the corner. */
#x-disc-open {
  position: fixed;
  right: calc(clamp(.8rem, 2.5vw, 1.4rem) + env(safe-area-inset-right));
  bottom: calc(var(--x-footer-h) + .55rem + env(safe-area-inset-bottom));
  z-index: 890;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  overflow: hidden;
  border-radius: 50%;
  font-size: 0;
  letter-spacing: 0;
}

#x-disc-open::after {
  content: "i";
  font-family: var(--x-font-m);
  font-size: .72rem;
  line-height: 1;
  color: var(--x-text);
}

#x-disc[hidden] {
  display: none !important;
}

#x-disc {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(4, 6, 10, .72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .35s ease;
}

#x-disc.is-open {
  opacity: 1;
}

.x-disc-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--x-panel);
  border-left: 1px solid var(--x-line);
  box-shadow: -32px 0 90px rgba(0, 0, 0, .55), -1px 0 24px rgba(0, 240, 255, .08);
  transform: translateX(100%);
  transition: transform .45s cubic-bezier(.22, 1, .36, 1);
}

#x-disc.is-open .x-disc-panel {
  transform: translateX(0);
}

/* header bar mirroring the uplink terminal head (dots reuse .x-term-dot) */
.x-disc-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .8rem 1.1rem;
  border-bottom: 1px solid var(--x-line);
  background: rgba(255, 255, 255, .02);
  flex: none;
}

#x-disc-title {
  flex: 1;
  margin-left: .6rem;
  font-family: var(--x-font-m);
  font-size: .62rem;
  letter-spacing: .2em;
  color: var(--x-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#x-disc-close {
  flex: none;
  -webkit-appearance: none;
  appearance: none;
  font-family: var(--x-font-m);
  font-size: .6rem;
  letter-spacing: .16em;
  color: var(--x-amber);
  background: transparent;
  border: 1px solid rgba(255, 176, 0, .4);
  padding: .35rem .7rem;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  transition: border-color .25s ease, box-shadow .25s ease, text-shadow .25s ease;
}

#x-disc-close:hover {
  border-color: var(--x-amber);
  box-shadow: 0 0 16px rgba(255, 176, 0, .35);
  text-shadow: 0 0 10px rgba(255, 176, 0, .75);
}

.x-disc-body {
  padding: 1.6rem;
  font-family: var(--x-font-m);
  font-size: .92rem;
  line-height: 1.8;
  color: var(--x-dim);
  overflow-y: auto;
}

.x-disc-body p {
  margin-bottom: 1.1rem;
}

.x-disc-lead {
  font-family: var(--x-font-m);
  color: var(--x-amber);
  letter-spacing: .06em;
  text-shadow: 0 0 12px rgba(255, 176, 0, .3);
}

.x-disc-links {
  display: grid;
  gap: .8rem;
  margin: 1.4rem 0;
}

a.x-disc-doc {
  display: block;
  border: 1px solid var(--x-line);
  padding: .9rem 1rem;
  background: rgba(255, 255, 255, .015);
  transition: border-color .25s ease, box-shadow .25s ease, background .25s ease;
}

a.x-disc-doc:hover {
  border-color: rgba(0, 240, 255, .6);
  background: rgba(0, 240, 255, .035);
  box-shadow: 0 0 24px rgba(0, 240, 255, .14), inset 0 0 18px rgba(0, 240, 255, .05);
}

.x-disc-doc-k {
  display: block;
  font-family: var(--x-font-m);
  font-size: .72rem;
  letter-spacing: .24em;
  color: var(--x-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, .4);
  margin-bottom: .3rem;
}

.x-disc-doc-v {
  display: block;
  font-size: .8rem;
  line-height: 1.6;
  color: var(--x-dim);
}

.x-disc-note {
  font-size: .68rem;
  letter-spacing: .1em;
  color: var(--x-dim); /* regulatory text stays readable — no opacity fade */
}

/* scroll lock while the drawer is open (drawer.js toggles this class) */
body.x-disc-lock {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   16. TERMINAL LINE FALLBACKS — terminal.js injects the live colors for its
       own line classes; these keep output readable if that injection ever
       changes. Widget chrome (.xt-bar/.xt-win) is owned here.
   -------------------------------------------------------------------------- */
.xt-line { color: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.xt-user { color: var(--x-cyan); }
.xt-ok   { color: var(--x-cyan); }
.xt-err  { color: var(--x-amber); }

/* block progress bar: <div class="xt-bar"><span style="width:42%"></span></div>
   — 8px monochrome tiles, 2px gaps */
.xt-bar {
  display: block;
  height: 14px;
  margin: .45rem 0 .6rem;
  padding: 1px;
  border: 1px solid rgba(0, 240, 255, .35);
  background: repeating-linear-gradient(90deg, rgba(0, 240, 255, .06) 0 8px, transparent 8px 10px);
}

.xt-bar > *,
.xt-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(90deg, var(--x-cyan) 0 8px, transparent 8px 10px);
  box-shadow: 0 0 10px rgba(0, 240, 255, .35);
  transition: width .18s linear;
}

/* success block (CHANNEL OPEN): double hairline cyan frame, red corner
   ticks, soft outer/inner glow */
.xt-win {
  position: relative;
  margin: .9rem 0 1.1rem;
  padding: .85rem 1.05rem;
  color: var(--x-cyan);
  letter-spacing: .12em;
  text-shadow: 0 0 12px rgba(0, 240, 255, .5);
  border: 1px solid var(--x-cyan);
  outline: 1px solid rgba(0, 240, 255, .32);
  outline-offset: 3px;
  box-shadow: 0 0 24px rgba(0, 240, 255, .16), inset 0 0 20px rgba(0, 240, 255, .05);
}

.xt-win::before,
.xt-win::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid var(--x-red);
  pointer-events: none;
}

.xt-win::before {
  top: -5px;
  left: -5px;
  border-right: none;
  border-bottom: none;
}

.xt-win::after {
  bottom: -5px;
  right: -5px;
  border-left: none;
  border-top: none;
}

/* --------------------------------------------------------------------------
   17. GLASS FALLBACK — no backdrop-filter: solid panels, opaque chrome
   -------------------------------------------------------------------------- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #x-topbar,
  #x-footer-strip,
  #x-rail,
  .xs-panel-l,
  .xs-panel-r,
  .xo-card,
  #x-disc {
    background: rgba(8, 12, 20, .94);
  }
}

/* --------------------------------------------------------------------------
   18. RESPONSIVE — 1100 panels narrow / 860 panels stack into a compact
       bottom bar / 640 type clamps. Contract floor: flawless at 360×640.
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .xs-panel-l {
    width: min(500px, 46vw);
  }

  .xs-panel-r {
    width: min(360px, 32vw);
  }

  .xs-terminal-wrap {
    width: min(920px, calc(100vw - var(--x-gutter-l) - 4rem));
  }
}

@media (max-width: 860px) {
  /* --- rail → full-width bottom icon bar, names hidden -------------------- */
  #x-rail {
    top: auto;
    bottom: calc(var(--x-footer-h) + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    transform: none;
    z-index: 850;
    flex-direction: row;
    gap: 0;
    padding: 0 .25rem;
    background: rgba(4, 6, 10, .78);
    -webkit-backdrop-filter: blur(14px) saturate(1.25);
    backdrop-filter: blur(14px) saturate(1.25);
    border-top: 1px solid var(--x-line);
  }

  .xr-item {
    flex: 1 1 0;
    width: auto;
    min-width: 44px;
    min-height: 54px;
    gap: .15rem;
    padding: .35rem .1rem;
    background: transparent;
    border: none;
    border-left: 1px solid rgba(0, 240, 255, .08);
  }

  .xr-item:first-child {
    border-left: none;
  }

  .xr-ico {
    font-size: 18px;
  }

  .xr-num {
    font-size: .5rem;
  }

  .xr-name {
    display: none;
  }

  /* active tick rotates to the top edge of the bar item */
  .xr-item::before {
    left: 22%;
    right: 22%;
    top: 0;
    bottom: auto;
    width: auto;
    height: 2px;
  }

  .xr-item.is-active {
    background: rgba(0, 240, 255, .05);
    box-shadow: none;
  }

  /* --- scenes stack over the formation ------------------------------------
     Flex column: panel-l (top, scrollable) / auto space / inspector (bottom
     sheet, scrollable) / objects. min-height:0 + overflow keeps 360×640
     inside the viewport at all times; the auto margin absorbs free space. */
  .x-scene {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: calc(var(--x-topbar-h) + .6rem + env(safe-area-inset-top)) .8rem
             calc(var(--x-footer-h) + 96px + env(safe-area-inset-bottom));
  }

  /* stacked panels cover the formation: densify the glass for reading */
  .xs-panel-l,
  .xs-panel-r {
    --x-glass-bg: rgba(7, 12, 21, .64);
  }

  .xo-card {
    background-color: rgba(7, 12, 21, .58);
  }

  .xs-panel-l {
    position: relative; /* in flow as a flex child; keeps glass pseudos scoped */
    left: auto;
    right: auto;
    top: auto;
    transform: none;
    width: 100%;
    flex: 0 1 auto;
    min-height: 0;
    max-height: 46vh;
    max-height: 46dvh;
    margin-bottom: auto; /* free space goes between panel and lower sheets */
    padding: 1.2rem 1.25rem;
  }

  .xs-panel-r {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    transform: none;
    width: 100%;
    flex: 0 1 auto;
    min-height: 0;
    max-height: 34vh;
    max-height: 34dvh;
    padding: 1rem 1.15rem;
  }

  .xs-objects {
    position: static;
    flex: none;
    grid-template-columns: 1fr 1fr; /* 2×2 on phones */
    gap: .55rem;
    margin-right: 52px; /* clear the compact 44px disclosures touch target */
  }

  .xo-card {
    min-height: 56px;
    padding: .55rem .7rem .6rem;
  }

  .xs-terminal-wrap {
    position: static;
    inset: auto;
    transform: none;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    order: initial;
    display: flex;
    flex-direction: column;
  }

  #x-terminal {
    flex: 1 1 auto;
    min-height: 0;
  }

  .x-scene[data-scene="5"] .x-term-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }

  .x-scene[data-scene="5"] .x-channel-label {
    margin-bottom: .6rem;
  }

  /* disclosures trigger rides in its own band above the rail bar */
  #x-disc-open {
    bottom: calc(var(--x-footer-h) + 62px + env(safe-area-inset-bottom));
    right: calc(.6rem + env(safe-area-inset-right));
  }
}

@media (max-width: 640px) {
  /* topbar diet: tags and status text give way; brand + label + dot remain */
  .xtb-tags {
    display: none;
  }

  .xtb-status {
    font-size: 0; /* hides the text, keeps the pulsing dot */
    gap: 0;
  }

  .xtb-brand {
    font-size: .68rem;
    letter-spacing: .18em;
  }

  #x-field-label {
    font-size: .52rem;
    letter-spacing: .12em;
  }

  /* type clamps */
  .xs-title {
    font-size: clamp(1.5rem, 7vw, 2.2rem);
  }

  .xs-copy {
    font-size: .95rem;
    line-height: 1.6;
  }

  .xs-micro {
    display: none;
  }

  .xi-title {
    font-size: 1.35rem;
  }

  .xi-desc {
    font-size: .86rem;
    line-height: 1.5;
  }

  .xi-head {
    margin-bottom: .55rem;
  }

  .xi-kicker {
    margin-top: .65rem;
  }

  .xi-role {
    margin: .2rem 0 .7rem;
    padding-bottom: .65rem;
    font-size: 1rem;
  }

  .xi-system,
  .xi-auth {
    gap: .25rem;
    margin-top: .75rem;
    padding-top: .65rem;
    font-size: .56rem;
  }

  .xs-panel-r {
    padding: .9rem 1rem;
  }

  .x-term-title {
    margin-left: .3rem;
    font-size: .52rem;
    letter-spacing: .14em;
  }

  /* The live session clock remains in the desktop title. On phones the
     channel name is the useful identity; hiding the decorative clock keeps
     that identity readable instead of truncating it behind the auth chip. */
  .x-term-title > span {
    display: none;
  }

  .x-term-auth {
    gap: .35rem;
    font-size: .5rem;
    letter-spacing: .12em;
  }

  .x-term-auth > span:first-child {
    display: none;
  }

  .x-channel-label {
    font-size: .5rem;
    letter-spacing: .14em;
  }

  .x-fact-num {
    font-size: 1.8rem;
  }

  .x-fact-num.x-fact-word {
    font-size: clamp(.78rem, 3.7vw, 1rem);
    line-height: 1.12;
    letter-spacing: .04em;
    white-space: nowrap;
    overflow-wrap: normal;
  }

  .x-fact-label {
    font-size: .48rem;
    letter-spacing: .14em;
  }

  .x-fact {
    min-height: 4.6rem;
    padding: .65rem .7rem;
  }

  .x-scene[data-scene="4"] .xo-facts {
    margin-top: .45rem;
    gap: .3rem;
  }

  .x-scene[data-scene="4"] .xs-copy {
    margin-top: .7rem;
    font-size: .86rem;
    line-height: 1.48;
  }

  .x-scene[data-scene="4"] .x-fact {
    min-height: 2.75rem;
    gap: .15rem;
    padding: .25rem .5rem;
  }

  .x-scene[data-scene="4"] .x-fact-num {
    font-size: 1.3rem;
  }

  .x-scene[data-scene="4"] .x-fact-num.x-fact-word {
    font-size: .72rem;
  }

  .x-scene[data-scene="4"] .x-fact-label {
    font-size: .4rem;
  }

  /* footer: coordinates give way; colophon + pager remain */
  .xf-l {
    display: none;
  }

  .xf-c {
    text-align: left;
    font-size: .5rem;
    letter-spacing: .1em;
  }

  /* iOS Safari zooms focused inputs under 16px — floor it on phones */
  #x-term-input {
    font-size: 16px;
  }

  .x-term-body {
    padding: .8rem .95rem;
  }

  .x-term-form-row {
    padding: .6rem .95rem;
  }

  /* drawer goes full width on small screens */
  .x-disc-panel {
    width: 100vw;
    border-left: none;
  }

  .x-disc-body {
    padding: 1.2rem;
    font-size: .85rem;
  }
}

/* narrowest phones: object cards drop the descriptor line */
@media (max-width: 400px) {
  .xo-line {
    display: none;
  }

  .xo-card {
    min-height: 48px;
  }
}

/* Very short portrait phones use one continuous scene viewport. Two nested
   scroll panes made copy appear amputated at rest; a single field scroll keeps
   every layer intact while preserving the fixed operating-system chrome. */
@media (max-width: 400px) and (max-height: 700px) and (orientation: portrait) {
  .x-scene:not([data-scene="5"]) {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: calc(var(--x-topbar-h) + .6rem + env(safe-area-inset-top)) .8rem
             calc(var(--x-footer-h) + 72px + env(safe-area-inset-bottom));
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 240, 255, .28) transparent;
  }

  .x-scene:not([data-scene="5"]) .xs-panel-l,
  .x-scene:not([data-scene="5"]) .xs-panel-r {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    margin: 0 0 .6rem;
    transform: none;
    overflow: visible;
  }

  .x-scene:not([data-scene="5"]) .xs-objects {
    position: static;
    grid-template-columns: 1fr 1fr;
    margin: 0 52px 0 0;
  }
}

/* phone landscape is its own console, not a compressed portrait stack.
   The portrait layout above spends height on two stacked panels; on a short
   landscape viewport that collapsed the readable area to a few pixels. */
@media (max-height: 700px) and (orientation: landscape) {
  :root {
    --x-topbar-h: 44px;
    --x-footer-h: 28px;
  }

  .xtb-tags {
    display: none;
  }

  /* Short landscape viewports need one coherent grid regardless of width.
     Device-width cutoffs created collision cliffs when a wide phone or short
     desktop window crossed back into the absolute-positioned layout. */
  #x-rail {
    top: auto;
    bottom: calc(var(--x-footer-h) + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    transform: none;
    z-index: 850;
    flex-direction: row;
    gap: 0;
    padding: 0 .25rem;
    background: rgba(4, 6, 10, .78);
    -webkit-backdrop-filter: blur(14px) saturate(1.25);
    backdrop-filter: blur(14px) saturate(1.25);
    border-top: 1px solid var(--x-line);
  }

  .xr-item {
    flex: 1 1 0;
    width: auto;
    min-width: 44px;
    min-height: 48px;
    gap: .15rem;
    padding: .35rem .1rem;
    background: transparent;
    border: none;
    border-left: 1px solid rgba(0, 240, 255, .08);
  }

  .xr-item:first-child {
    border-left: none;
  }

  .xr-ico {
    font-size: 18px;
  }

  .xr-num {
    font-size: .5rem;
  }

  .xr-name {
    display: none;
  }

  .xr-item::before {
    left: 22%;
    right: 22%;
    top: 0;
    bottom: auto;
    width: auto;
    height: 2px;
  }

  .xr-item.is-active {
    background: rgba(0, 240, 255, .05);
    box-shadow: none;
  }

  #x-disc-open {
    bottom: calc(var(--x-footer-h) + 54px + env(safe-area-inset-bottom));
    right: calc(.6rem + env(safe-area-inset-right));
  }

  .x-scene {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
    grid-template-rows: minmax(0, 1fr) 48px;
    gap: .4rem .5rem;
    padding: calc(var(--x-topbar-h) + .35rem + env(safe-area-inset-top))
             calc(.55rem + env(safe-area-inset-right))
             calc(var(--x-footer-h) + 54px + env(safe-area-inset-bottom))
             calc(.55rem + env(safe-area-inset-left));
  }

  .xs-panel-l,
  .xs-panel-r {
    position: relative;
    inset: auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    margin: 0;
    transform: none;
    overflow-y: auto;
    padding: .62rem .78rem;
  }

  .xs-panel-l {
    grid-column: 1;
    grid-row: 1;
  }

  .xs-panel-r {
    grid-column: 2;
    grid-row: 1;
  }

  .xs-title {
    margin-top: .38rem;
    font-size: clamp(1.1rem, 2.8vw, 1.45rem);
    line-height: 1.06;
  }

  .xs-copy {
    margin-top: .42rem;
    font-size: .72rem;
    line-height: 1.35;
  }

  .xs-micro {
    display: none;
  }

  .xs-tab {
    font-size: .48rem;
    letter-spacing: .2em;
  }

  .xi-head {
    margin-bottom: .24rem;
    font-size: .48rem;
  }

  .xi-title,
  .x-scene[data-scene="5"] .xi-title {
    font-size: 1rem;
  }

  .xi-kicker {
    display: none;
  }

  .xi-role {
    margin: .22rem 0 .35rem;
    padding: .24rem 0 .35rem;
    font-size: .8rem;
    line-height: 1.3;
  }

  .xi-desc {
    font-size: .68rem;
    line-height: 1.35;
  }

  .xi-auth { display: none; }

  .xi-system {
    gap: .22rem;
    margin-top: .42rem;
    padding-top: .38rem;
    font-size: .44rem;
    line-height: 1.35;
  }

  .xi-system-v { font-size: .48rem; }

  .xo-facts {
    margin-top: .4rem;
    gap: .3rem;
  }

  .x-fact {
    min-height: 2.6rem;
    padding: .25rem .4rem;
  }

  .x-fact-num {
    font-size: 1rem;
  }

  .x-fact-num.x-fact-word {
    font-size: .72rem;
  }

  .x-fact-label {
    font-size: .4rem;
    letter-spacing: .1em;
  }

  .xs-objects {
    position: static;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .5rem;
    margin-right: 52px;
  }

  .xo-card {
    min-height: 0;
    height: 48px;
    padding: .3rem .5rem;
  }

  .xo-line {
    display: none;
  }

  /* Direct channel remains one coherent instrument in short landscape. */
  .x-scene[data-scene="5"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .xs-terminal-wrap {
    position: static;
    inset: auto;
    transform: none;
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    order: initial;
  }

  #x-terminal {
    height: 100%;
  }

  .x-scene[data-scene="5"] .x-term-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }
}

/* short viewports (incl. landscape phones): compact vertical rhythm */
@media (max-height: 700px) and (min-width: 1025px) {
  .xs-panel-l {
    padding: 1.5rem 1.6rem;
  }

  .xs-title {
    font-size: clamp(1.7rem, 3.8vw, 3rem);
  }

  #x-rail {
    gap: .35rem;
  }

  .xr-item {
    min-height: 48px;
    padding: .5rem .2rem;
    gap: .3rem;
  }

  .xr-ico {
    font-size: 17px;
  }

  .xr-name {
    font-size: .5rem;
    letter-spacing: .24em;
  }
}

/* --------------------------------------------------------------------------
   18A. FIELD MAP + INSPECTOR HIERARCHY

   This block supersedes the retired left rail and bottom object strip. The
   scene formation remains the visual center; a single expandable field map
   owns global navigation, while local layers stay inside the inspector.
   -------------------------------------------------------------------------- */
#x-field-nav {
  position: relative;
  isolation: isolate;
}

#x-field-trigger {
  position: relative;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  padding: .38rem .72rem .38rem .55rem;
  text-align: left;
  background:
    linear-gradient(110deg, rgba(151, 214, 255, .055), transparent 46%),
    rgba(5, 10, 18, .22);
  border: 1px solid transparent;
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background .24s ease, border-color .24s ease,
              box-shadow .24s ease, transform .24s var(--x-ease-out);
}

#x-field-trigger::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: .1rem;
  border-right: 1px solid var(--x-cyan);
  border-bottom: 1px solid var(--x-cyan);
  opacity: .7;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .28s var(--x-ease-out), opacity .25s ease;
}

#x-field-nav.is-open #x-field-trigger::after {
  opacity: 1;
  transform: rotate(225deg) translate(-1px, -1px);
}

#x-field-trigger:disabled {
  cursor: default;
}

@media (hover: hover) {
  #x-field-trigger:not(:disabled):hover,
  #x-field-nav.is-open #x-field-trigger {
    background:
      linear-gradient(110deg, rgba(151, 214, 255, .105), transparent 54%),
      rgba(5, 11, 20, .52);
    border-color: rgba(0, 240, 255, .24);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09),
                0 0 24px rgba(0, 240, 255, .09);
  }
}

.xft-state {
  min-width: 0;
  display: grid;
  gap: .02rem;
  padding-left: .72rem;
  border-left: 1px solid rgba(0, 240, 255, .16);
  font-family: var(--x-font-m);
  white-space: nowrap;
}

.xft-kicker {
  font-size: .42rem;
  letter-spacing: .25em;
  color: var(--x-dim);
}

.xft-current {
  font-size: .52rem;
  letter-spacing: .16em;
  color: var(--x-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, .28);
}

#x-field-menu {
  --glare: 0;
  position: absolute;
  top: calc(100% + .7rem);
  left: 0;
  z-index: 20;
  width: min(500px, calc(100vw - 2rem));
  padding: .85rem;
  overflow: hidden;
  background:
    radial-gradient(420px circle at var(--gx) var(--gy), rgba(151, 214, 255, calc(.11 * var(--glare))), transparent 64%),
    linear-gradient(135deg, rgba(151, 214, 255, .085), transparent 34%),
    linear-gradient(108deg, rgba(3, 8, 15, .94), rgba(7, 14, 25, .82) 62%, rgba(9, 17, 31, .72)),
    rgba(5, 10, 18, .86);
  -webkit-backdrop-filter: blur(24px) saturate(1.7) brightness(1.04);
  backdrop-filter: blur(24px) saturate(1.7) brightness(1.04);
  border: 1px solid rgba(151, 214, 255, .22);
  box-shadow:
    0 34px 90px rgba(0, 0, 0, .66),
    0 0 62px -16px rgba(0, 240, 255, .25),
    inset 0 1px 0 rgba(255, 255, 255, .16),
    inset 0 -1px 0 rgba(0, 0, 0, .5),
    inset 22px 0 52px -42px rgba(0, 240, 255, .3);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  clip-path: inset(0 72% 92% 0 round 2px);
  transform: translate3d(-8px, -7px, 0) scale(.96);
  transform-origin: top left;
  transition: opacity .2s ease, visibility 0s linear .36s,
              clip-path .42s var(--x-ease-out), transform .42s var(--x-ease-out);
}

#x-field-menu::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--x-cyan), transparent 42%) top left / 42% 1px,
    linear-gradient(var(--x-cyan), transparent 58%) top left / 1px 42%,
    linear-gradient(270deg, rgba(79, 159, 255, .8), transparent 45%) bottom right / 36% 1px,
    linear-gradient(0deg, rgba(79, 159, 255, .8), transparent 55%) bottom right / 1px 36%;
  background-repeat: no-repeat;
  opacity: .75;
}

#x-field-menu.is-open {
  --glare: 1;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  clip-path: inset(0 0 0 0 round 2px);
  transform: translate3d(0, 0, 0) scale(1);
  transition-delay: 0s;
}

.xfm-head,
.xfm-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--x-font-m);
  font-size: .52rem;
  letter-spacing: .18em;
  color: var(--x-dim);
}

.xfm-head {
  padding: .12rem .15rem .72rem;
  border-bottom: 1px solid var(--x-line);
}

.xfm-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: .28rem;
  padding: .45rem 0;
}

.xfm-item {
  position: relative;
  min-height: 58px;
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  align-items: center;
  gap: .2rem;
  width: 100%;
  padding: .58rem .72rem;
  text-align: left;
  color: var(--x-text);
  background: rgba(0, 240, 255, .018);
  border: 1px solid rgba(151, 214, 255, .08);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  opacity: 0;
  transform: translateX(-18px);
  transition: opacity .3s ease, transform .34s var(--x-ease-out),
              border-color .22s ease, background .22s ease, box-shadow .22s ease;
}

#x-field-menu.is-open .xfm-item {
  opacity: 1;
  transform: translateX(0);
}

#x-field-menu.is-open .xfm-item:nth-child(1) { transition-delay: .045s; }
#x-field-menu.is-open .xfm-item:nth-child(2) { transition-delay: .075s; }
#x-field-menu.is-open .xfm-item:nth-child(3) { transition-delay: .105s; }
#x-field-menu.is-open .xfm-item:nth-child(4) { transition-delay: .135s; }
#x-field-menu.is-open .xfm-item:nth-child(5) { transition-delay: .165s; }

.xfm-item::before {
  content: "";
  position: absolute;
  top: 14%;
  bottom: 14%;
  left: -1px;
  width: 2px;
  background: var(--x-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, .65);
  opacity: 0;
  transition: opacity .2s ease;
}

.xfm-item.is-active {
  background: linear-gradient(90deg, rgba(0, 240, 255, .09), rgba(79, 159, 255, .025));
  border-color: rgba(0, 240, 255, .34);
  box-shadow: inset 0 0 24px rgba(0, 240, 255, .035);
}

.xfm-item.is-active::before { opacity: 1; }

@media (hover: hover) {
  .xfm-item:hover {
    background: linear-gradient(90deg, rgba(0, 240, 255, .11), rgba(79, 159, 255, .04));
    border-color: rgba(0, 240, 255, .46);
    box-shadow: 0 0 22px rgba(0, 240, 255, .08), inset 0 1px 0 rgba(255, 255, 255, .06);
    transform: translateX(4px);
  }
}

.xfm-num {
  font-family: var(--x-font-m);
  font-size: .58rem;
  letter-spacing: .2em;
  color: var(--x-cyan);
  opacity: .8;
}

.xfm-copy {
  min-width: 0;
  display: grid;
  gap: .12rem;
}

.xfm-name {
  font-family: var(--x-font-d);
  font-size: .88rem;
  font-weight: 500;
  letter-spacing: .1em;
  line-height: 1.2;
  color: var(--x-text);
}

.xfm-desc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--x-font-m);
  font-size: .5rem;
  letter-spacing: .08em;
  color: var(--x-dim);
}

.xfm-foot {
  padding: .58rem .15rem .04rem;
  border-top: 1px solid var(--x-line);
  font-size: .46rem;
}

/* The retired global rail and scene-level object strip no longer participate
   in layout even if stale markup is introduced by a cached document. */
#x-rail,
.xs-objects {
  display: none !important;
}

.xs-panel-l {
  max-height: calc(100vh - var(--x-topbar-h) - var(--x-footer-h) - 6rem);
  max-height: calc(100dvh - var(--x-topbar-h) - var(--x-footer-h) - 6rem);
}

.xs-panel-r {
  width: min(440px, 31vw);
  max-height: calc(100vh - var(--x-topbar-h) - var(--x-footer-h) - 5rem);
  max-height: calc(100dvh - var(--x-topbar-h) - var(--x-footer-h) - 5rem);
  padding: 1.35rem 1.45rem 1.5rem;
}

.xi-nav,
.xi-content {
  position: relative;
  z-index: 1;
}

.xi-nav {
  margin: -.15rem 0 1.15rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--x-line);
}

.xi-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .62rem;
  font-family: var(--x-font-m);
  font-size: .5rem;
  letter-spacing: .2em;
  color: var(--x-dim);
}

.xi-nav-count {
  color: var(--x-cyan);
  font-variant-numeric: tabular-nums;
}

.xi-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .42rem;
}

.xi-layer-tab {
  position: relative;
  min-width: 0;
  min-height: 44px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .52rem;
  padding: .52rem .62rem;
  text-align: left;
  background: rgba(0, 240, 255, .018);
  border: 1px solid rgba(151, 214, 255, .1);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .2s ease, background .2s ease,
              box-shadow .2s ease, color .2s ease;
}

.xi-layer-tab::before {
  content: "";
  position: absolute;
  top: -1px;
  right: 18%;
  left: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--x-cyan), transparent);
  box-shadow: 0 0 9px rgba(0, 240, 255, .55);
  opacity: 0;
  transition: opacity .2s ease;
}

.xi-layer-tab .xo-num {
  font-size: .5rem;
  color: var(--x-cyan);
  opacity: .7;
}

.xi-layer-tab .xo-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--x-font-m);
  font-size: .58rem;
  font-weight: 400;
  letter-spacing: .09em;
  color: var(--x-copy);
}

.xi-layer-tab.is-sel {
  background: linear-gradient(110deg, rgba(0, 240, 255, .1), rgba(79, 159, 255, .025));
  border-color: rgba(0, 240, 255, .46);
  box-shadow: inset 0 0 16px rgba(0, 240, 255, .045), 0 0 18px rgba(0, 240, 255, .055);
}

.xi-layer-tab.is-sel::before { opacity: 1; }
.xi-layer-tab.is-sel .xo-name { color: var(--x-text); }

@media (hover: hover) {
  .xi-layer-tab:hover {
    background: rgba(0, 240, 255, .065);
    border-color: rgba(0, 240, 255, .34);
  }
}

.xi-content.xi-swap {
  animation: x-inspector-resolve .24s var(--x-ease-out) both;
}

@keyframes x-inspector-resolve {
  0%   { opacity: .38; transform: translateY(7px); filter: blur(3px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.xi-head {
  color: var(--x-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, .24);
}

.xs-terminal-wrap {
  left: 50%;
  width: min(1040px, calc(100vw - 8rem));
}

#x-disc-open {
  bottom: calc(var(--x-footer-h) + .7rem + env(safe-area-inset-bottom));
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #x-field-menu,
  #x-field-trigger,
  .xi-layer-tab {
    background: rgba(8, 12, 20, .96);
  }
}

@media (max-width: 1100px) {
  .xs-panel-l { width: min(500px, 45vw); }
  .xs-panel-r { width: min(400px, 36vw); }
  .xs-terminal-wrap { width: min(920px, calc(100vw - 4rem)); }
}

@media (max-width: 860px) {
  #x-field-menu {
    position: fixed;
    top: calc(var(--x-topbar-h) + .5rem + env(safe-area-inset-top));
    right: calc(.65rem + env(safe-area-inset-right));
    left: calc(.65rem + env(safe-area-inset-left));
    width: auto;
    max-height: calc(100dvh - var(--x-topbar-h) - var(--x-footer-h) - 1.5rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .x-scene:not([data-scene="5"]) {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: calc(var(--x-topbar-h) + .72rem + env(safe-area-inset-top))
             calc(.8rem + env(safe-area-inset-right))
             calc(var(--x-footer-h) + 1.25rem + env(safe-area-inset-bottom))
             calc(.8rem + env(safe-area-inset-left));
  }

  .x-scene:not([data-scene="5"]) .xs-panel-l,
  .x-scene:not([data-scene="5"]) .xs-panel-r {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    margin: 0 0 .72rem;
    transform: none;
    overflow: visible;
  }

  .x-scene:not([data-scene="5"]) .xs-panel-l { padding: 1.25rem 1.3rem; }
  .x-scene:not([data-scene="5"]) .xs-panel-r { padding: 1.15rem 1.25rem 1.3rem; }

  .x-scene[data-scene="5"] {
    display: flex;
    padding: calc(var(--x-topbar-h) + .7rem + env(safe-area-inset-top))
             calc(.8rem + env(safe-area-inset-right))
             calc(var(--x-footer-h) + .8rem + env(safe-area-inset-bottom))
             calc(.8rem + env(safe-area-inset-left));
  }

  .xi-nav { margin-bottom: 1rem; }
}

@media (max-width: 640px) {
  .xtb-c { display: none; }
  #x-field-trigger { min-height: 44px; gap: .5rem; padding-right: .58rem; }
  .xft-state { padding-left: .55rem; }
  .xft-kicker { display: none; }
  .xft-current { font-size: .48rem; }
  .xfm-item { min-height: 54px; }
  .xi-tabs { gap: .35rem; }
  .xi-layer-tab { padding: .48rem .5rem; gap: .4rem; }
  .xi-layer-tab .xo-name { font-size: .54rem; }
  .xi-title { font-size: 1.5rem; }
  .xi-desc { font-size: .88rem; }
}

@media (max-width: 420px) {
  #x-topbar { gap: .35rem; padding-right: .62rem; padding-left: .62rem; }
  #x-field-trigger { padding-left: .4rem; }
  .xtb-brand { font-size: .62rem; letter-spacing: .16em; }
  .xft-state { display: none; }
  #x-field-menu { right: .45rem; left: .45rem; }
  .xfm-desc { font-size: .46rem; }
  .xfm-foot span:first-child { display: none; }
}

@media (max-height: 700px) and (orientation: landscape) {
  #x-field-menu {
    top: calc(var(--x-topbar-h) + .35rem + env(safe-area-inset-top));
    max-height: calc(100dvh - var(--x-topbar-h) - var(--x-footer-h) - .9rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: .55rem;
  }

  .xfm-head { padding-bottom: .4rem; }
  .xfm-grid { grid-template-columns: 1fr 1fr; gap: .25rem; padding: .3rem 0; }
  .xfm-item { min-height: 42px; padding: .38rem .48rem; grid-template-columns: 2rem minmax(0, 1fr); }
  .xfm-item:last-child { grid-column: 1 / -1; }
  .xfm-desc { display: none; }
  .xfm-foot { padding-top: .35rem; }

  .x-scene:not([data-scene="5"]) {
    display: grid;
    grid-template-columns: minmax(0, 1.22fr) minmax(0, .78fr);
    grid-template-rows: minmax(0, 1fr);
    gap: .5rem;
    overflow: hidden;
    padding: calc(var(--x-topbar-h) + .35rem + env(safe-area-inset-top))
             calc(.55rem + env(safe-area-inset-right))
             calc(var(--x-footer-h) + .42rem + env(safe-area-inset-bottom))
             calc(.55rem + env(safe-area-inset-left));
  }

  .x-scene:not([data-scene="5"]) .xs-panel-l,
  .x-scene:not([data-scene="5"]) .xs-panel-r {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow-y: auto;
    padding: .62rem .78rem;
  }

  .x-scene:not([data-scene="5"]) .xs-panel-l { grid-column: 1; grid-row: 1; }
  .x-scene:not([data-scene="5"]) .xs-panel-r { grid-column: 2; grid-row: 1; }
  .xi-nav { margin: -.05rem 0 .48rem; padding-bottom: .48rem; }
  .xi-nav-head { margin-bottom: .32rem; font-size: .42rem; }
  .xi-tabs { gap: .25rem; }
  .xi-layer-tab { min-height: 34px; padding: .28rem .38rem; gap: .3rem; }
  .xi-layer-tab .xo-num { font-size: .4rem; }
  .xi-layer-tab .xo-name { font-size: .46rem; }
  .xi-head { margin-bottom: .28rem; }
  .x-scene[data-scene="5"] {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    padding: calc(var(--x-topbar-h) + .35rem + env(safe-area-inset-top))
             calc(.55rem + env(safe-area-inset-right))
             calc(var(--x-footer-h) + .42rem + env(safe-area-inset-bottom))
             calc(.55rem + env(safe-area-inset-left));
  }
}

@media (max-width: 860px), (max-height: 700px) and (orientation: landscape) {
  #x-footer-strip {
    padding-right: calc(3.4rem + env(safe-area-inset-right));
  }

  #x-disc-open {
    right: calc(.25rem + env(safe-area-inset-right));
    bottom: env(safe-area-inset-bottom);
    z-index: 910;
    background: transparent;
    border-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  #x-disc-open::before {
    content: "";
    position: absolute;
    inset: 7px;
    border: 1px solid rgba(151, 214, 255, .18);
    border-radius: 50%;
    background: rgba(7, 13, 23, .86);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  }

  #x-disc-open::after { position: relative; z-index: 1; }
}

@media (prefers-reduced-motion: reduce) {
  #x-field-menu,
  .xfm-item,
  .xi-content.xi-swap {
    animation: none !important;
    transition: none !important;
  }
}

/* --------------------------------------------------------------------------
   NO-JS FALLBACK — one coherent static field, no dead controls or false
   online status. The first scene remains the concise public explanation;
   the noscript band explains how to enter the full console.
   -------------------------------------------------------------------------- */
html:not(.js) #x-rail,
html:not(.js) #x-field-menu,
html:not(.js) #x-disc-open,
html:not(.js) .xtb-r,
html:not(.js) .xs-panel-r,
html:not(.js) .xs-objects,
html:not(.js) .x-scene:not([data-scene="1"]) {
  display: none;
}

html:not(.js) #x-field-trigger {
  padding-left: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

html:not(.js) #x-field-trigger::after,
html:not(.js) .xft-state {
  display: none;
}

html:not(.js) .x-scene[data-scene="1"] {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--x-topbar-h) + 1rem + env(safe-area-inset-top)) 1rem
           calc(var(--x-footer-h) + 5rem + env(safe-area-inset-bottom));
}

html:not(.js) .x-scene[data-scene="1"] .xs-panel-l {
  position: relative;
  inset: auto;
  width: min(720px, 100%);
  max-height: none;
  margin: 0;
  transform: none;
  overflow: visible;
}

html:not(.js) noscript p {
  position: fixed;
  z-index: 920;
  right: 0;
  bottom: calc(var(--x-footer-h) + env(safe-area-inset-bottom));
  left: 0;
  padding: .8rem 1rem !important;
  background: rgba(4, 6, 10, .92);
  border-top: 1px solid var(--x-line);
  color: var(--x-dim);
  font-family: var(--x-font-m) !important;
  font-size: .66rem;
  line-height: 1.5;
  letter-spacing: .08em;
}

/* --------------------------------------------------------------------------
   19. REDUCED MOTION — neutralize every animation path.
       Global .01ms clamp first; explicit static holds below for anything
       that must remain in a specific on-state.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }

  /* ambient film holds a static on-state at the subtler base strength */
  .x-scanlines {
    animation: none !important;
    opacity: .5 !important;
  }

  .x-scanlines::before {
    animation: none !important;
    opacity: .18 !important;
  }

  /* the radar sweep and title glitches never fire */
  .x-scanlines::after {
    animation: none !important;
    opacity: 0 !important;
  }

  .xs-title,
  .x-scene.is-in .xs-title {
    animation: none !important;
  }

  /* glass stays lit but static: no tilt, no traveling glare */
  .xo-card,
  .xo-card:hover {
    transform: none !important;
  }

  /* status dots keep their glow; the expanding ring never fires */
  .x-pulse-dot::after {
    animation: none !important;
    opacity: 0 !important;
  }

  /* scene swaps are instant: no slide, no fade */
  .x-scene,
  .x-scene.is-in,
  .x-scene.is-out {
    animation: none !important;
  }

  /* hover lifts and sweeps snap instead of traveling */
  .xo-card:hover,
  .x-btn:hover {
    transform: none;
  }

  /* boot fade + drawer slide become instant */
  #x-boot,
  #x-disc,
  .x-disc-panel {
    transition: none !important;
  }
}
