/* ═══════════════════════════════════════════
   NEXUS LABS — Bridge HUD Interface
   ═══════════════════════════════════════════ */

:root {
  --blue-50: #e8f4ff;
  --blue-100: #b8dcff;
  --blue-200: #7ec4ff;
  --blue-300: #4aadff;
  --blue-400: #2b9bff;
  --blue-500: #1488f0;
  --blue-600: #0a6fd4;
  --cyan: #3de0ff;
  --cyan-dim: rgba(61, 224, 255, 0.35);
  --cyan-glow: rgba(61, 224, 255, 0.55);
  --bg-deep: #02060e;
  --bg-panel: rgba(4, 12, 28, 0.72);
  --bg-card: rgba(6, 18, 40, 0.55);
  --bg-card-hover: rgba(8, 28, 58, 0.75);
  --border: rgba(61, 224, 255, 0.22);
  --border-bright: rgba(61, 224, 255, 0.55);
  --text: #e8f4ff;
  --text-muted: rgba(184, 220, 255, 0.72);
  --text-dim: rgba(184, 220, 255, 0.45);
  --font-display: "Orbitron", system-ui, sans-serif;
  --font-body: "Exo 2", system-ui, sans-serif;
  --radius: 4px;
  --shadow-glow: 0 0 40px rgba(43, 155, 255, 0.25);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text);
  background: var(--bg-deep);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.is-loading {
  overflow: hidden;
  height: 100vh;
}

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

/* ═══════════════════════════════════════════
   Cinematic warp preloader
   ═══════════════════════════════════════════ */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  /* Stack sits just under the bright central star / vanishing point */
  justify-content: flex-start;
  flex-direction: column;
  background: #010308;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.45s var(--ease), background 0.35s var(--ease);
  padding-top: clamp(30vh, 36vh, 40vh);
  padding-bottom: 1.5rem;
}

/* Once doors take over, let the live bridge (starfield) show through */
.preloader.is-entering {
  background: transparent;
  padding: 0;
}

.preloader.is-exiting {
  pointer-events: none;
  /* Long soft dissolve so the bright bridge shows through (no black dip) */
  transition: opacity 1.05s cubic-bezier(0.22, 0.8, 0.2, 1);
}

.preloader.is-gone {
  display: none;
}

/* Starry nebula field — bias upward so depth sits above the ship */
.preloader-space-bg {
  position: absolute;
  inset: -6%;
  z-index: 0;
  background:
    url("../assets/splash-bg.jpg") center 38% / cover no-repeat;
  transform: scale(1.05);
  filter: brightness(1.28) contrast(1.06) saturate(1.12);
  will-change: transform, filter;
}

.preloader.is-dropping .preloader-space-bg {
  animation: space-warp-push 1.1s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}

@keyframes space-warp-push {
  0% {
    transform: scale(1.05);
    filter: brightness(1.28) contrast(1.06) saturate(1.12) blur(0);
  }
  55% {
    transform: scale(1.28);
    filter: brightness(1.4) contrast(1.08) saturate(1.22) blur(1px);
  }
  100% {
    transform: scale(1.65);
    filter: brightness(1.75) saturate(1.15) blur(10px);
  }
}

.preloader-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* Soft blue corridor glow — horizon ahead / above the ship */
.preloader-glow {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 75% 50% at 50% 34%,
      rgba(90, 170, 255, 0.22) 0%,
      rgba(30, 100, 200, 0.1) 40%,
      transparent 72%
    ),
    radial-gradient(
      circle at 50% 32%,
      rgba(180, 230, 255, 0.12) 0%,
      transparent 30%
    );
  mix-blend-mode: screen;
  animation: preloader-glow-pulse 4s ease-in-out infinite;
}

@keyframes preloader-glow-pulse {
  0%,
  100% {
    opacity: 0.75;
  }
  50% {
    opacity: 1;
  }
}

.preloader-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, 0.38) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.22) 0%, transparent 24%, transparent 76%, rgba(0, 0, 0, 0.28) 100%);
}

/* Stage: ship + logo + CTA just below the central star */
.preloader-stage {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.85rem;
  padding: 0 1.5rem;
  max-width: 100%;
  margin: 0;
  transition:
    opacity 0.4s var(--ease),
    filter 0.4s var(--ease);
}

.preloader.is-dropping .preloader-stage {
  pointer-events: none;
}

/* Hero stack: ship behind, NEXUS LABS logo on top */
.preloader-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(92vw, 420px);
  /* Room for ship rest pose; logo centers over hull */
  min-height: clamp(7.5rem, 18vw, 9.5rem);
}

/*
  Single continuous fly-in (only 2 keyframes = no mid-keyframe jerk).
  fill-mode: forwards holds the rest pose forever — never kill the animation
  with animation:none (that was causing the snap).
*/
.preloader-ship-wrap {
  position: relative;
  z-index: 1;
  width: min(41vw, 380px);
  max-width: 92vw;
  aspect-ratio: 1731 / 475;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Match keyframe 0% so first paint isn't a jump */
  transform: translate3d(0, 42vh, 0) scale(3.15);
  opacity: 1;
  will-change: transform;
  animation: ship-fly-in 2.8s cubic-bezier(0.33, 0, 0.2, 1) forwards;
  filter: drop-shadow(0 0 22px rgba(61, 224, 255, 0.28))
    drop-shadow(0 14px 32px rgba(0, 0, 0, 0.5));
}

@keyframes ship-fly-in {
  from {
    transform: translate3d(0, 42vh, 0) scale(3.15);
  }
  to {
    /* Rests just above “Our Shared Universe” */
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* Logo overlay — above the ship; fades in after ship docks */
.preloader-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  transform: translate(-50%, -42%);
  pointer-events: none;
  text-align: center;
  opacity: 0;
  transition:
    opacity 0.9s var(--ease),
    filter 0.9s var(--ease),
    transform 0.9s var(--ease);
  filter: blur(6px);
}

.preloader-ship {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
  object-fit: contain;
  opacity: 1;
}

/* Tagline sits just under the ship rest position */
.preloader-tagline {
  position: relative;
  z-index: 4;
  opacity: 0;
  filter: blur(6px);
  transform: translateY(8px);
  transition:
    opacity 0.9s var(--ease) 0.08s,
    filter 0.9s var(--ease) 0.08s,
    transform 0.9s var(--ease) 0.08s;
}

/* Warp dive — only after Enter Nexus; starts from rest pose (scale 1) */
.preloader-ship-wrap.is-warping {
  animation: ship-warp-dive 1.15s cubic-bezier(0.4, 0.02, 0.2, 1) forwards;
  opacity: 1;
}

@keyframes ship-warp-dive {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    filter: drop-shadow(0 0 18px rgba(61, 224, 255, 0.35)) brightness(1)
      blur(0);
    opacity: 1;
  }
  40% {
    transform: translate3d(0, -6%, 0) scale(1.55);
    filter: drop-shadow(0 0 40px rgba(61, 224, 255, 0.65)) brightness(1.25)
      blur(0.5px);
    opacity: 1;
  }
  75% {
    transform: translate3d(0, -12%, 0) scale(2.8);
    filter: drop-shadow(0 0 60px rgba(100, 200, 255, 0.8)) brightness(1.55)
      blur(2px);
    opacity: 1;
  }
  100% {
    transform: translate3d(0, -18%, 0) scale(4.5);
    filter: drop-shadow(0 0 80px rgba(160, 230, 255, 0.9)) brightness(1.9)
      blur(5px);
    opacity: 0.15; /* only after Enter Nexus warp, not while parked */
  }
}

/* Blue warp trails from nacelles */
.ship-warp-trails {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
}

.preloader-ship-wrap.is-warping .ship-warp-trails {
  opacity: 1;
}

.trail {
  position: absolute;
  top: 38%;
  width: 10%;
  height: 0;
  border-radius: 40%;
  background: linear-gradient(
    180deg,
    rgba(180, 240, 255, 0.95) 0%,
    rgba(61, 224, 255, 0.7) 25%,
    rgba(40, 120, 255, 0.35) 55%,
    transparent 100%
  );
  box-shadow:
    0 0 16px rgba(61, 224, 255, 0.7),
    0 0 36px rgba(80, 160, 255, 0.45);
  filter: blur(1.5px);
  transform-origin: top center;
}

.trail--left {
  left: 7%;
}

.trail--right {
  right: 7%;
}

.preloader-ship-wrap.is-warping .trail {
  animation: trail-stream 1.1s cubic-bezier(0.35, 0, 0.2, 1) forwards;
}

@keyframes trail-stream {
  0% {
    height: 0;
    opacity: 0;
    transform: scaleX(0.6);
  }
  25% {
    height: 55%;
    opacity: 1;
    transform: scaleX(1);
  }
  100% {
    height: 160%;
    opacity: 0.35;
    transform: scaleX(1.15) translateY(20%);
  }
}

/* Ship docked — reveal title + CTA */
.preloader.is-ui-ready .preloader-logo {
  opacity: 1;
  filter: blur(0);
}

.preloader.is-ui-ready .preloader-tagline {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

.preloader.is-ui-ready .enter-btn {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
  pointer-events: auto;
  animation: enter-btn-breathe 3.6s ease-in-out infinite;
}

/* Fade logo + tagline + button together on warp */
.preloader.is-dropping .preloader-logo,
.preloader.is-dropping .preloader-tagline,
.preloader.is-dropping .enter-btn {
  opacity: 0 !important;
  transform: scale(1.04) translateY(-6px);
  filter: blur(8px) !important;
  pointer-events: none !important;
  animation: none !important;
  transition:
    opacity 0.35s var(--ease),
    transform 0.35s var(--ease),
    filter 0.35s var(--ease);
}

@media (max-width: 600px) {
  .preloader-hero {
    width: min(94vw, 360px);
  }

  .preloader-ship-wrap {
    width: min(70vw, 300px);
  }
}

.preloader-mark {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--cyan);
  transform: rotate(45deg);
  background: rgba(61, 224, 255, 0.12);
  box-shadow:
    0 0 16px var(--cyan-glow),
    0 0 40px rgba(43, 155, 255, 0.25);
  margin-bottom: 0.35rem;
  animation: pulse-mark 2s ease-in-out infinite;
}

.preloader-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.4rem, 4vw, 2rem);
  letter-spacing: 0.42em;
  margin-left: 0.42em;
  color: #f0f8ff;
  text-shadow:
    0 0 20px rgba(61, 224, 255, 0.55),
    0 0 50px rgba(43, 155, 255, 0.35);
}

.preloader-brand span {
  display: block;
  margin-top: 0.35rem;
  margin-left: -0.15em;
  font-weight: 400;
  font-size: 0.45em;
  letter-spacing: 0.55em;
  color: var(--cyan);
  opacity: 0.9;
}

.preloader-tagline {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 0.78rem;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0.1rem 0 1.1rem;
}

/* ─── Enter Nexus control ─── */

.enter-btn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 2.4rem 0.95rem;
  border: 1px solid var(--border-bright);
  border-radius: 2px;
  background: rgba(4, 16, 36, 0.55);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 0 0 1px rgba(61, 224, 255, 0.06),
    0 0 28px rgba(43, 155, 255, 0.18),
    inset 0 1px 0 rgba(180, 230, 255, 0.08);
  /* Hidden until ship docks (.is-ui-ready) */
  opacity: 0;
  filter: blur(6px);
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 0.95s var(--ease) 0.14s,
    filter 0.95s var(--ease) 0.14s,
    transform 0.95s var(--ease) 0.14s,
    border-color 0.35s var(--ease),
    box-shadow 0.35s var(--ease),
    background 0.35s var(--ease);
}

.enter-btn-glow {
  position: absolute;
  inset: -40%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(61, 224, 255, 0.2) 0%,
    transparent 55%
  );
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}

.enter-btn-label {
  position: relative;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #f0f8ff;
  text-shadow: 0 0 18px rgba(61, 224, 255, 0.45);
}

.enter-btn-hint {
  position: relative;
  font-family: var(--font-display);
  font-size: 0.52rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.enter-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(61, 224, 255, 0.7),
    transparent
  );
}

.enter-btn::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(61, 224, 255, 0.1);
  pointer-events: none;
  transition: border-color 0.35s var(--ease);
}

.enter-btn:hover,
.enter-btn:focus-visible {
  outline: none;
  transform: translateY(-2px) scale(1.02);
  border-color: var(--cyan);
  background: rgba(8, 28, 58, 0.72);
  box-shadow:
    0 0 0 1px rgba(61, 224, 255, 0.15),
    0 0 40px rgba(43, 155, 255, 0.35),
    0 12px 40px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(180, 230, 255, 0.12);
  animation: none;
}

.enter-btn:hover .enter-btn-glow,
.enter-btn:focus-visible .enter-btn-glow {
  opacity: 1;
}

.enter-btn:hover::after,
.enter-btn:focus-visible::after {
  border-color: rgba(61, 224, 255, 0.28);
}

.enter-btn:hover .enter-btn-hint,
.enter-btn:focus-visible .enter-btn-hint {
  color: var(--cyan);
}

.enter-btn:active {
  transform: translateY(0) scale(0.98);
}

.enter-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

@keyframes enter-btn-breathe {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(61, 224, 255, 0.06),
      0 0 22px rgba(43, 155, 255, 0.14),
      inset 0 1px 0 rgba(180, 230, 255, 0.08);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(61, 224, 255, 0.12),
      0 0 36px rgba(43, 155, 255, 0.28),
      inset 0 1px 0 rgba(180, 230, 255, 0.1);
  }
}

/* ─── Telescopic image doors + forward entry ─── */

.bridge-doors {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  /* Closed doors cover the gap; open state goes transparent to reveal live bridge */
  background: #02060e;
  transition: background 0.5s var(--ease);
}

.preloader.is-entering .bridge-doors {
  opacity: 1;
}

/* Clear plate once outer doors start so nothing masks the walk-on */
.preloader.is-doors-stage2 .bridge-doors,
.preloader.is-doors-open .bridge-doors {
  background: transparent;
}

/* Permanently kill space layers — no snap-back to stars */
.preloader.is-space-gone .preloader-space-bg,
.preloader.is-space-gone .preloader-canvas,
.preloader.is-space-gone .preloader-glow,
.preloader.is-space-gone .preloader-vignette,
.preloader.is-space-gone .preloader-stage {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  animation: none !important;
}

/*
  doors-world: bright hold plate while doors open, then soft crossfade
  into the live lit bridge (no dark intermediate).
*/
.doors-world {
  position: absolute;
  inset: 0;
  z-index: 1;
  transform-origin: 50% 52%;
  transform: scale(0.92) translate3d(0, 8px, 0);
  filter: brightness(1.08) saturate(1.05);
  opacity: 1;
  will-change: transform, opacity, filter;
  pointer-events: none;
  transition:
    transform 2.6s cubic-bezier(0.22, 0.78, 0.18, 1),
    opacity 1.15s cubic-bezier(0.22, 0.8, 0.2, 1) 0.35s,
    filter 1.15s ease 0.35s;
}

.preloader.is-doors-stage2 .doors-world,
.preloader.is-doors-open .doors-world {
  transform: scale(1.05) translate3d(0, 0, 0);
  /* Fade toward the already-bright live scene underneath */
  opacity: 0;
  filter: brightness(1.12) saturate(1.06);
}

.doors-bridge {
  position: absolute;
  inset: -2%;
  /* Full bridge still so first light is the environment, not black */
  background: url("../assets/bridge-empty.jpg") center center / cover no-repeat;
  filter: brightness(1.06);
}

.doors-depth {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse 70% 42% at 50% 92%,
      rgba(50, 140, 255, 0.32) 0%,
      rgba(30, 100, 210, 0.14) 38%,
      transparent 72%
    ),
    linear-gradient(
      0deg,
      rgba(40, 120, 230, 0.2) 0%,
      rgba(30, 90, 190, 0.08) 30%,
      transparent 55%
    );
  opacity: 0.9;
  mix-blend-mode: screen;
  transition: opacity 0.9s ease 0.25s;
}

.preloader.is-doors-stage2 .doors-depth,
.preloader.is-doors-open .doors-depth {
  opacity: 0;
}

/* ── Stage 1: inner / back telescopic panels ── */
.door-rear {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 54%;
  z-index: 2;
  will-change: transform;
  /* Slow back-layer pull so outer stage can cover corners early */
  transition: transform 1.75s cubic-bezier(0.4, 0.05, 0.2, 1);
  background:
    linear-gradient(
      105deg,
      #3a3f46 0%,
      #555b64 18%,
      #6a7078 36%,
      #4a5058 52%,
      #5c626c 70%,
      #3e444c 100%
    );
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.door-rear::before {
  content: "";
  position: absolute;
  inset: 5% 8%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 36px,
      rgba(0, 0, 0, 0.12) 36px,
      rgba(0, 0, 0, 0.12) 37px
    );
  opacity: 0.7;
  pointer-events: none;
}

.door-rear--left {
  left: 0;
  transform: translate3d(0, 0, 0);
  border-right: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow:
    inset -12px 0 28px rgba(0, 0, 0, 0.35),
    8px 0 24px rgba(0, 0, 0, 0.35);
}

.door-rear--right {
  right: 0;
  transform: translate3d(0, 0, 0);
  border-left: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow:
    inset 12px 0 28px rgba(0, 0, 0, 0.35),
    -8px 0 24px rgba(0, 0, 0, 0.35);
}

/* Stage 1 — back layer opens first, fully off-screen */
.preloader.is-doors-stage1 .door-rear--left,
.preloader.is-doors-open .door-rear--left {
  transform: translate3d(-110%, 0, 0);
}

.preloader.is-doors-stage1 .door-rear--right,
.preloader.is-doors-open .door-rear--right {
  transform: translate3d(110%, 0, 0);
}

/* ── Stage 2: outer PNG door leaves ── */
.door {
  position: absolute;
  inset: 0;
  z-index: 3;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  will-change: transform;
  /* Starts ~0.28s after back layer so edges stay covered */
  transition: transform 1.2s cubic-bezier(0.42, 0.02, 0.18, 1);
}

.door--left {
  background-image: url("../assets/left-door.png");
  transform: translate3d(0, 0, 0);
}

.door--right {
  background-image: url("../assets/right-door.png");
  transform: translate3d(0, 0, 0);
}

/* Stage 2 — outer doors open fully clear of frame (none remaining on screen) */
.preloader.is-doors-stage2 .door--left,
.preloader.is-doors-open .door--left {
  transform: translate3d(-105%, 0, 0);
}

.preloader.is-doors-stage2 .door--right,
.preloader.is-doors-open .door--right {
  transform: translate3d(105%, 0, 0);
}

/* Center seam while closed */
.doors-seam {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  z-index: 4;
  background: linear-gradient(
    180deg,
    transparent 5%,
    rgba(180, 200, 220, 0.35) 30%,
    rgba(230, 240, 255, 0.65) 50%,
    rgba(180, 200, 220, 0.35) 70%,
    transparent 95%
  );
  box-shadow: 0 0 12px rgba(61, 224, 255, 0.25);
  opacity: 0.85;
  transition: opacity 0.35s var(--ease);
}

.preloader.is-doors-stage1 .doors-seam,
.preloader.is-doors-stage2 .doors-seam,
.preloader.is-doors-open .doors-seam {
  opacity: 0;
}

/* Warp flash into doors */
.doors-flash {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(230, 245, 255, 0.9) 0%,
    rgba(140, 200, 240, 0.4) 30%,
    transparent 70%
  );
  opacity: 0;
  mix-blend-mode: screen;
  pointer-events: none;
}

.preloader.is-entering:not(.is-doors-open) .doors-flash {
  animation: doors-flash 0.55s ease-out forwards;
}

@keyframes doors-flash {
  0% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
  }
}

.doors-blur {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(200, 220, 240, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
}

.preloader.is-entering:not(.is-doors-open) .doors-blur {
  animation: doors-blur-clear 0.5s ease-out forwards;
}

@keyframes doors-blur-clear {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Bridge scene — matched handoff + walk-on */
.scene {
  position: relative;
  min-height: 100vh;
}

body.is-loading .scene {
  opacity: 0;
  visibility: hidden;
}

body.is-bridge-ready .scene {
  opacity: 1;
  visibility: visible;
}

body.is-revealing .scene {
  opacity: 1;
  visibility: visible;
}

/*
  During door entry / walk-on: only the bridge environment is visible.
  Hero + chrome stay fully offline until body.is-hud-in (choreographed below).
*/
body.is-loading .topbar,
body.is-loading .hud-frame,
body.is-loading .hero,
body.is-loading .section,
body.is-loading .footer,
body.is-loading .nav-toggle,
body.is-bridge-ready:not(.is-hud-in) .topbar,
body.is-bridge-ready:not(.is-hud-in) .hud-frame,
body.is-bridge-ready:not(.is-hud-in) .hero,
body.is-bridge-ready:not(.is-hud-in) .section,
body.is-bridge-ready:not(.is-hud-in) .footer,
body.is-bridge-ready:not(.is-hud-in) .nav-toggle {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Keep bridge lighting layers on during walk-on */
body.is-bridge-ready .bg-overlay,
body.is-bridge-ready .bridge-floor-light,
body.is-bridge-ready .scanlines,
body.is-bridge-ready .vignette {
  visibility: visible;
}

/*
  During entry, lift the environment: softer overlay/vignette so the
  walk-on fades into the bright bridge instead of a dark plate.
*/
body.is-walking-on .bg-overlay,
body.is-bridge-ready:not(.is-revealing) .bg-overlay {
  opacity: 0.72;
  background:
    linear-gradient(
      180deg,
      rgba(2, 8, 20, 0.28) 0%,
      rgba(4, 16, 40, 0.08) 30%,
      rgba(6, 22, 52, 0.04) 55%,
      rgba(4, 18, 44, 0.12) 80%,
      rgba(4, 14, 36, 0.28) 100%
    ),
    radial-gradient(
      ellipse 95% 75% at 50% 42%,
      transparent 0%,
      rgba(2, 8, 20, 0.14) 100%
    );
  transition: opacity 1.2s var(--ease), background 1.2s var(--ease);
}

body.is-walking-on .vignette,
body.is-bridge-ready:not(.is-revealing) .vignette {
  opacity: 0.45;
  background: radial-gradient(
    ellipse at 50% 42%,
    transparent 52%,
    rgba(0, 0, 0, 0.22) 100%
  );
  transition: opacity 1.2s var(--ease), background 1.2s var(--ease);
}

body.is-walking-on .bridge-floor-light,
body.is-bridge-ready:not(.is-revealing) .bridge-floor-light {
  opacity: 1;
  filter: brightness(1.08);
}

body.is-walking-on .viewer-nebula,
body.is-bridge-ready:not(.is-revealing) .viewer-nebula {
  filter: brightness(1.5) contrast(1.18) saturate(1.5);
}

/* After handoff, ease lighting back to the normal bright bridge grade */
body.is-revealing .bg-overlay,
body.is-revealing .vignette,
body.is-revealing .bridge-floor-light {
  transition:
    opacity 1.1s var(--ease),
    background 1.1s var(--ease),
    filter 1.1s var(--ease);
}

/* Smooth walk onto the bridge — slight bright lift then settle */
body.is-walking-on .bg-stack {
  animation: bridge-walk-on 2.9s cubic-bezier(0.22, 0.78, 0.18, 1) forwards;
}

@keyframes bridge-walk-on {
  0% {
    transform: scale(1.1) translate3d(0, 18px, 0);
    filter: brightness(1.14) saturate(1.04);
  }
  55% {
    transform: scale(1.17) translate3d(0, 6px, 0);
    filter: brightness(1.08) saturate(1.02);
  }
  100% {
    transform: scale(1.22) translate3d(0, 0, 0);
    filter: brightness(1) saturate(1);
  }
}

/* Soft cyan wash as doors clear — sells “entering the lit bridge” */
body.is-walking-on::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  background: radial-gradient(
    ellipse 80% 60% at 50% 40%,
    rgba(120, 190, 255, 0.14) 0%,
    rgba(40, 100, 180, 0.05) 45%,
    transparent 70%
  );
  mix-blend-mode: screen;
  animation: entry-light-wash 2.4s ease-out forwards;
}

@keyframes entry-light-wash {
  0% {
    opacity: 0.85;
  }
  40% {
    opacity: 0.45;
  }
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .preloader-glow,
  .enter-btn,
  .viewer-nebula,
  .viewer-nebula-glow,
  .preloader-ship-wrap,
  .preloader.is-dropping .preloader-space-bg {
    animation: none;
  }

  .preloader-ship-wrap {
    width: min(41vw, 380px) !important;
    transform: translate3d(0, 0, 0) scale(1) !important;
    opacity: 1 !important;
    animation: none !important;
  }

  .door,
  .door-rear,
  .doors-world,
  .doors-depth,
  .doors-seam {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  .preloader.is-entering:not(.is-doors-open) .doors-flash,
  .preloader.is-entering:not(.is-doors-open) .doors-blur,
  body.is-walking-on .bg-stack {
    animation-duration: 0.01ms !important;
  }
}

/* ─── Scene shell ─── */

/* Full-screen bridge stack (parallax target) */
.bg-stack {
  position: fixed;
  inset: -8%;
  z-index: 0;
  transform: scale(1.22);
  will-change: transform;
  pointer-events: none;
}

/* Living space visible only through transparent panoramic window */
.viewer-space {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 55% 38%, #122a58 0%, #071428 45%, #030a16 100%);
}

.viewer-nebula {
  position: absolute;
  inset: -18%;
  background:
    url("../assets/splash-bg.jpg") center center / cover no-repeat;
  opacity: 1;
  filter: brightness(1.45) contrast(1.2) saturate(1.55);
  transform: scale(1.08);
  will-change: transform;
  animation: viewer-nebula-drift 90s linear infinite;
}

/* Extra purple-blue nebula punch through the glass */
.viewer-nebula-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 55% 40% at 58% 36%,
      rgba(120, 90, 220, 0.35) 0%,
      rgba(40, 120, 220, 0.22) 35%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 40% 30% at 42% 42%,
      rgba(80, 160, 255, 0.2) 0%,
      transparent 65%
    );
  mix-blend-mode: screen;
  animation: viewer-nebula-drift 90s linear infinite reverse;
}

@keyframes viewer-nebula-drift {
  0% {
    transform: scale(1.08) translate3d(0, 0, 0);
  }
  50% {
    transform: scale(1.14) translate3d(-1.5%, 1%, 0);
  }
  100% {
    transform: scale(1.08) translate3d(0, 0, 0);
  }
}

.viewer-stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 1;
  mix-blend-mode: screen;
}

/* Bridge interior with transparent panoramic glass */
.bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    url("../assets/bridge-frame.png") center center / cover no-repeat;
}

/* Ambient blue floor spill — moves with parallax stack */
.bridge-floor-light {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    /* Primary floor pool underfoot */
    radial-gradient(
      ellipse 70% 42% at 50% 92%,
      rgba(50, 140, 255, 0.38) 0%,
      rgba(30, 100, 210, 0.18) 38%,
      transparent 72%
    ),
    /* Seam / edge strip spill rising up walls */
    linear-gradient(
      0deg,
      rgba(40, 120, 230, 0.28) 0%,
      rgba(30, 90, 190, 0.12) 28%,
      rgba(20, 60, 140, 0.04) 48%,
      transparent 62%
    ),
    /* Soft side strip glows */
    radial-gradient(
      ellipse 28% 55% at 8% 70%,
      rgba(40, 130, 255, 0.16) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 28% 55% at 92% 70%,
      rgba(40, 130, 255, 0.16) 0%,
      transparent 70%
    );
  mix-blend-mode: screen;
  opacity: 0.95;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    /* Lighter overall — especially lower half so floor reads */
    linear-gradient(
      180deg,
      rgba(2, 6, 14, 0.55) 0%,
      rgba(2, 8, 20, 0.28) 22%,
      rgba(2, 12, 28, 0.12) 42%,
      rgba(4, 16, 40, 0.08) 62%,
      rgba(6, 20, 48, 0.18) 82%,
      rgba(4, 14, 36, 0.42) 100%
    ),
    radial-gradient(
      ellipse 90% 70% at 50% 45%,
      transparent 0%,
      rgba(2, 6, 14, 0.28) 100%
    );
  pointer-events: none;
}

/* Subtle CRT-style scanlines */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.04;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.35) 2px,
    rgba(0, 0, 0, 0.35) 4px
  );
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  /* Softer edge falloff — don't crush floor brightness */
  background: radial-gradient(
    ellipse at 50% 42%,
    transparent 48%,
    rgba(0, 0, 0, 0.32) 100%
  );
}

/* ─── HUD frame corners ─── */

.hud-frame {
  position: fixed;
  inset: 12px;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
}

.corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--cyan);
  border-style: solid;
  opacity: 0;
  filter: drop-shadow(0 0 6px var(--cyan-dim));
  transform: scale(0.72);
  transform-origin: center;
}

.corner.tl {
  top: 0;
  left: 0;
  border-width: 2px 0 0 2px;
  transform-origin: top left;
}

.corner.tr {
  top: 0;
  right: 0;
  border-width: 2px 2px 0 0;
  transform-origin: top right;
}

.corner.bl {
  bottom: 0;
  left: 0;
  border-width: 0 0 2px 2px;
  transform-origin: bottom left;
}

.corner.br {
  bottom: 0;
  right: 0;
  border-width: 0 2px 2px 0;
  transform-origin: bottom right;
}

/* ─── Top bar ─── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem 0.75rem;
  background: linear-gradient(
    180deg,
    rgba(2, 8, 20, 0.85) 0%,
    rgba(2, 8, 20, 0.55) 70%,
    transparent 100%
  );
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(
      90deg,
      transparent,
      var(--border) 20%,
      var(--border-bright) 50%,
      var(--border) 80%,
      transparent
    )
    1;
  /* Offline until is-hud-in choreography */
  opacity: 0;
  transform: translateY(-14px);
  filter: blur(8px);
  pointer-events: none;
  will-change: opacity, transform, filter;
}

body.is-loading .topbar {
  opacity: 0 !important;
  transform: translateY(-14px) !important;
  filter: blur(8px) !important;
  pointer-events: none !important;
  transition: none;
  animation: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--cyan);
  transform: rotate(45deg);
  box-shadow:
    0 0 12px var(--cyan-glow),
    inset 0 0 6px var(--cyan-dim);
  background: rgba(61, 224, 255, 0.15);
  animation: pulse-mark 3s ease-in-out infinite;
}

@keyframes pulse-mark {
  0%,
  100% {
    box-shadow: 0 0 8px var(--cyan-dim), inset 0 0 4px var(--cyan-dim);
  }
  50% {
    box-shadow: 0 0 18px var(--cyan-glow), inset 0 0 8px var(--cyan-dim);
  }
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  color: var(--text);
}

.brand-sub {
  margin-left: 0.35em;
  font-weight: 400;
  font-size: 0.75em;
  letter-spacing: 0.28em;
  color: var(--cyan);
  opacity: 0.9;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  position: relative;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.55rem 1rem;
  transition: color 0.25s var(--ease);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.2rem;
  width: 0;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
  transform: translateX(-50%);
  transition: width 0.3s var(--ease);
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.is-active {
  color: var(--cyan);
  outline: none;
}

.nav-link:hover::after,
.nav-link:focus-visible::after,
.nav-link.is-active::after {
  width: 60%;
}

/* ─── System Status row: FIXED under nav — agents left, boxes right of agents ─── */
.system-status-row {
  --status-h: 3.5rem;
  --status-w: 5rem;
  --disc-size: 3.5rem;
  position: fixed;
  top: 4.25rem;
  left: 0;
  right: 0;
  z-index: 55;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 1.25rem;
  padding: 0.55rem 2rem 1.25rem;
  min-height: 4.25rem;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(2, 8, 20, 0.55) 0%,
    rgba(2, 8, 20, 0.2) 70%,
    transparent 100%
  );
}

.system-status-row > * {
  pointer-events: auto;
}

.system-status-row[hidden] {
  display: none !important;
}

/* Shown once bridge is live */
body.is-bridge-live .system-status-row,
.system-status-row.is-visible {
  display: flex !important;
}

/* Free-floating discs — no surrounding frame */
.agent-discs--row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  box-shadow: none;
}

.agent-discs--row .agent-disc {
  width: var(--disc-size);
  height: var(--disc-size);
  flex-shrink: 0;
}

.agent-discs--row .agent-disc-letter {
  font-size: 1.05rem;
}

.agent-discs--row .agent-disc-label {
  bottom: -1rem;
  font-size: 0.48rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.agent-discs--row .agent-disc-core {
  inset: 14%;
}

.status-boxes {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.5rem;
}

.status-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  width: var(--status-w);
  height: var(--status-h);
  min-width: var(--status-w);
  padding: 0.35rem 0.55rem;
  background: rgba(4, 16, 36, 0.72);
  border: 1px solid rgba(61, 224, 255, 0.24);
  border-radius: 2px;
  box-shadow:
    0 0 12px rgba(43, 155, 255, 0.1),
    inset 0 1px 0 rgba(140, 210, 255, 0.1);
  box-sizing: border-box;
}

.status-box-label {
  font-family: var(--font-display);
  font-size: 0.45rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.22rem;
}

.status-box-value {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  text-shadow: 0 0 10px rgba(61, 224, 255, 0.25);
  line-height: 1.15;
}

.status-box-value--live {
  color: var(--cyan);
}

/* Visibility is driven by [hidden] + body.is-bridge-live (see app.js) */

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
  animation: blink 2.2s ease-in-out infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.status-text {
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.6rem;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--cyan);
  box-shadow: 0 0 4px var(--cyan-dim);
}

/* ─── Hero ─── */

.hero {
  position: relative;
  z-index: 10;
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem 4rem;
}

.hero-content {
  width: 100%;
  max-width: 1100px;
  text-align: center;
}

/* Pre-online: hero pieces wait for the bridge handoff (no early animation burn) */
.hero .eyebrow,
.hero .title,
.hero .subtitle,
.hero .title-divider,
.hero .cards .card {
  opacity: 0;
  transform: translateY(22px);
  filter: blur(6px);
  will-change: opacity, transform, filter;
}

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.eyebrow-line {
  display: block;
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.7;
}

.title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.5rem, 12vw, 7.5rem);
  letter-spacing: 0.28em;
  line-height: 1;
  margin-left: 0.28em; /* optical center for letter-spacing */
  margin-bottom: 0.35rem;
}

.title-glow {
  display: inline-block;
  color: #f0f8ff;
  text-shadow:
    0 0 20px rgba(61, 224, 255, 0.55),
    0 0 60px rgba(43, 155, 255, 0.4),
    0 0 120px rgba(20, 136, 240, 0.25),
    0 2px 0 rgba(0, 0, 0, 0.4);
  animation: title-breathe 4s ease-in-out infinite;
}

@keyframes title-breathe {
  0%,
  100% {
    text-shadow:
      0 0 20px rgba(61, 224, 255, 0.5),
      0 0 60px rgba(43, 155, 255, 0.35),
      0 0 100px rgba(20, 136, 240, 0.2);
  }
  50% {
    text-shadow:
      0 0 30px rgba(61, 224, 255, 0.7),
      0 0 80px rgba(43, 155, 255, 0.5),
      0 0 140px rgba(20, 136, 240, 0.35);
  }
}

.subtitle {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--blue-100);
  opacity: 0.9;
  margin-bottom: 1.75rem;
}

.title-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.div-bar {
  width: min(120px, 18vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.6;
}

.div-diamond {
  width: 8px;
  height: 8px;
  border: 1px solid var(--cyan);
  transform: rotate(45deg);
  box-shadow: 0 0 10px var(--cyan-glow);
  background: rgba(61, 224, 255, 0.2);
}

/* ─── Module cards ─── */

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  max-width: 960px;
  margin: 0 auto;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 0.65rem;
  padding: 1.6rem 1.4rem 1.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
  transition:
    transform 0.35s var(--ease),
    border-color 0.35s var(--ease),
    background 0.35s var(--ease),
    box-shadow 0.35s var(--ease);
  /* Entrance is orchestrated under body.is-hud-in (see choreography block) */
}

/* Inner frame lines */
.card-frame {
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(61, 224, 255, 0.08);
  pointer-events: none;
  transition: border-color 0.35s var(--ease);
}

.card-frame::before,
.card-frame::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--cyan);
  border-style: solid;
  opacity: 0.4;
  transition: opacity 0.35s var(--ease);
}

.card-frame::before {
  top: -1px;
  left: -1px;
  border-width: 1.5px 0 0 1.5px;
}

.card-frame::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 1.5px 1.5px 0;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-6px);
  border-color: var(--border-bright);
  background: var(--bg-card-hover);
  box-shadow:
    0 0 0 1px rgba(61, 224, 255, 0.1),
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 50px rgba(43, 155, 255, 0.18);
  outline: none;
}

.card:hover .card-frame,
.card:focus-visible .card-frame {
  border-color: rgba(61, 224, 255, 0.2);
}

.card:hover .card-frame::before,
.card:hover .card-frame::after,
.card:focus-visible .card-frame::before,
.card:focus-visible .card-frame::after {
  opacity: 1;
}

.card-icon {
  width: 42px;
  height: 42px;
  color: var(--cyan);
  margin-bottom: 0.35rem;
  filter: drop-shadow(0 0 8px var(--cyan-dim));
  transition: filter 0.35s var(--ease), transform 0.35s var(--ease);
}

.card-icon svg {
  width: 100%;
  height: 100%;
}

.card:hover .card-icon {
  filter: drop-shadow(0 0 14px var(--cyan-glow));
  transform: scale(1.05);
}

.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}

.card-desc {
  font-size: 0.88rem;
  font-weight: 300;
  line-height: 1.5;
  color: var(--text-muted);
  flex: 1;
}

.card-cta {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-top: 0.5rem;
  opacity: 0.85;
  transition: opacity 0.25s var(--ease), letter-spacing 0.25s var(--ease);
}

.card:hover .card-cta {
  opacity: 1;
  letter-spacing: 0.22em;
}

/* Soft top highlight on cards */
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(61, 224, 255, 0.5),
    transparent
  );
  opacity: 0.6;
}

/* ─── Sections ─── */

.section {
  position: relative;
  z-index: 10;
  padding: 5rem 1.5rem;
  scroll-margin-top: 80px;
  opacity: 0;
  transform: translateY(18px);
  filter: blur(4px);
  will-change: opacity, transform, filter;
}

.panel-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-glow);
  position: relative;
}

.panel-inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--cyan) 30%,
    var(--cyan) 70%,
    transparent
  );
  opacity: 0.45;
}

.section-label {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  color: var(--cyan);
  margin-bottom: 0.75rem;
  opacity: 0.85;
}

.panel-inner h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
  text-shadow: 0 0 24px rgba(61, 224, 255, 0.3);
}

.panel-inner p {
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text-muted);
}

/* ─── Footer ─── */

.footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2rem 1.5rem 2.5rem;
  opacity: 0;
  transform: translateY(10px);
  filter: blur(4px);
  will-change: opacity, transform, filter;
}

.footer-line {
  width: min(280px, 50%);
  height: 1px;
  margin: 0 auto 1.25rem;
  background: linear-gradient(90deg, transparent, var(--border-bright), transparent);
}

.footer p {
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  color: var(--text-dim);
}

.footer-brand {
  color: var(--text-muted);
}

.footer-sep {
  color: var(--cyan);
  opacity: 0.5;
  margin: 0 0.4em;
}

/* ─── Responsive ─── */

@media (max-width: 900px) {
  .cards {
    grid-template-columns: 1fr;
    max-width: 400px;
  }

  .system-status-row {
    --status-w: 4.4rem;
    --disc-size: 3rem;
    gap: 0.85rem;
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }
}

@media (max-width: 720px) {
  .system-status-row {
    --status-h: 3.2rem;
    --status-w: 4rem;
    --disc-size: 2.75rem;
    flex-wrap: wrap;
    gap: 1rem 0.75rem;
    padding-bottom: 1.5rem;
  }

  .agent-discs--row {
    gap: 0.75rem;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0.9rem 1.1rem;
    flex-wrap: wrap;
  }

  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.75rem;
    background: rgba(2, 10, 24, 0.95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
  }

  .nav.open {
    display: flex;
  }

  .nav-link {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(61, 224, 255, 0.08);
  }

  .nav-toggle {
    display: flex;
    margin-left: auto;
  }

  .title {
    letter-spacing: 0.18em;
    margin-left: 0.18em;
  }

  .subtitle {
    letter-spacing: 0.22em;
  }

  .eyebrow {
    font-size: 0.52rem;
    letter-spacing: 0.16em;
    gap: 0.5rem;
  }

  .eyebrow-line {
    width: 20px;
  }

  .panel-inner {
    padding: 1.75rem 1.25rem;
  }

  .hud-frame {
    inset: 8px;
  }

  .corner {
    width: 18px;
    height: 18px;
  }
}

/* ═══════════════════════════════════════════
   Bridge online — hero + HUD fade choreography
   Triggered by body.is-hud-in after door handoff
   ═══════════════════════════════════════════ */

@keyframes hud-rise {
  from {
    opacity: 0;
    transform: translateY(22px);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes hud-rise-soft {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes topbar-settle {
  from {
    opacity: 0;
    transform: translateY(-16px);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes corner-ignite {
  0% {
    opacity: 0;
    transform: scale(0.55);
    filter: drop-shadow(0 0 0 transparent);
  }
  55% {
    opacity: 0.85;
    transform: scale(1.06);
    filter: drop-shadow(0 0 10px var(--cyan-glow));
  }
  100% {
    opacity: 0.55;
    transform: scale(1);
    filter: drop-shadow(0 0 6px var(--cyan-dim));
  }
}

@keyframes frame-breathe-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.97);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes deck-rise {
  from {
    opacity: 0;
    transform: translateY(28px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes player-settle {
  from {
    opacity: 0;
    transform: translateY(-18px) scale(0.98);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Ease curve: gentle start, soft landing */
body.is-hud-in .topbar {
  animation: topbar-settle 1.65s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
  pointer-events: auto;
}

body.is-hud-in .hud-frame {
  animation: frame-breathe-in 0.8s ease-out 0.05s both;
}

body.is-hud-in .corner {
  animation: corner-ignite 1.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.is-hud-in .corner.tl {
  animation-delay: 0.08s;
}
body.is-hud-in .corner.tr {
  animation-delay: 0.16s;
}
body.is-hud-in .corner.br {
  animation-delay: 0.24s;
}
body.is-hud-in .corner.bl {
  animation-delay: 0.32s;
}

body.is-hud-in .nav-toggle {
  animation: hud-rise-soft 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.28s both;
  pointer-events: auto;
}

/* Hero cascade — eyebrow → title → tagline → divider → cards */
body.is-hud-in .hero .eyebrow {
  animation: hud-rise 1.25s cubic-bezier(0.16, 1, 0.3, 1) 0.28s both;
}

body.is-hud-in .hero .title {
  animation: hud-rise 1.45s cubic-bezier(0.16, 1, 0.3, 1) 0.48s both;
}

body.is-hud-in .hero .subtitle {
  animation: hud-rise 1.3s cubic-bezier(0.16, 1, 0.3, 1) 0.68s both;
}

body.is-hud-in .hero .title-divider {
  animation: hud-rise-soft 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.82s both;
}

body.is-hud-in .hero .cards .card {
  animation: card-rise 1.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.is-hud-in .hero .cards .card:nth-child(1) {
  animation-delay: 0.95s;
}
body.is-hud-in .hero .cards .card:nth-child(2) {
  animation-delay: 1.08s;
}
body.is-hud-in .hero .cards .card:nth-child(3) {
  animation-delay: 1.21s;
}

/* Module panels + footer — soft trailing fade */
body.is-hud-in .section {
  animation: hud-rise-soft 1.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.is-hud-in .section:nth-of-type(1) {
  animation-delay: 1.15s;
}
body.is-hud-in .section:nth-of-type(2) {
  animation-delay: 1.25s;
}
body.is-hud-in .section:nth-of-type(3) {
  animation-delay: 1.35s;
}
body.is-hud-in .section:nth-of-type(4) {
  animation-delay: 1.45s;
}
body.is-hud-in .section:nth-of-type(5) {
  animation-delay: 1.55s;
}

body.is-hud-in .footer {
  animation: hud-rise-soft 1.2s cubic-bezier(0.16, 1, 0.3, 1) 1.55s both;
}

/* Deck console (bottom HUD) */
body.is-hud-in .deck-console {
  animation: deck-rise 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.85s both;
  visibility: visible;
  pointer-events: none; /* children re-enable their own hits */
}

/* Music player — longer, softer settle after systems online */
body.is-hud-in .hud-player.is-online:not(.is-dragging):not(.is-dragged) {
  animation: player-settle 1.35s cubic-bezier(0.16, 1, 0.3, 1) 1.05s both;
  pointer-events: auto;
}

/*
  After the cascade finishes, drop animation locks so hover/transform
  interactions work normally and will-change can release.
*/
body.is-hud-in.is-systems-settled .topbar,
body.is-hud-in.is-systems-settled .hud-frame,
body.is-hud-in.is-systems-settled .corner,
body.is-hud-in.is-systems-settled .nav-toggle,
body.is-hud-in.is-systems-settled .hero .eyebrow,
body.is-hud-in.is-systems-settled .hero .title,
body.is-hud-in.is-systems-settled .hero .subtitle,
body.is-hud-in.is-systems-settled .hero .title-divider,
body.is-hud-in.is-systems-settled .hero .cards .card,
body.is-hud-in.is-systems-settled .section,
body.is-hud-in.is-systems-settled .footer,
body.is-hud-in.is-systems-settled .deck-console,
body.is-hud-in.is-systems-settled .hud-player.is-online:not(.is-dragging) {
  animation: none;
  opacity: 1;
  transform: none;
  filter: none;
  will-change: auto;
  visibility: visible;
}

body.is-hud-in.is-systems-settled .corner {
  opacity: 0.55;
  filter: drop-shadow(0 0 6px var(--cyan-dim));
}

body.is-hud-in.is-systems-settled .topbar,
body.is-hud-in.is-systems-settled .nav-toggle {
  pointer-events: auto;
}

body.is-hud-in.is-systems-settled .hud-player.is-online {
  pointer-events: auto;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .hero .eyebrow,
  .hero .title,
  .hero .subtitle,
  .hero .title-divider,
  .hero .cards .card,
  .section,
  .footer,
  .topbar,
  .hud-frame,
  .corner,
  .deck-console {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}

/* ═══════════════════════════════════════════
   Digital HUD Music Player
   ═══════════════════════════════════════════ */

.hud-player {
  position: fixed;
  /* Default dock: top-right of bridge */
  top: clamp(4.5rem, 10vh, 5.5rem);
  right: clamp(0.75rem, 2vw, 1.5rem);
  left: auto;
  bottom: auto;
  z-index: 60;
  width: min(420px, calc(100vw - 1.5rem));
  font-family: var(--font-body);
  color: var(--text);
  opacity: 0;
  transform: translateY(-16px);
  filter: blur(6px);
  pointer-events: none;
  touch-action: none;
  will-change: opacity, transform, filter;
}

/* is-online alone only unhides structure; full settle runs under is-hud-in */
.hud-player.is-online {
  /* Fallback if is-hud-in already set (nointro / re-show) */
  opacity: 1;
  transform: translateY(0);
  filter: none;
  pointer-events: auto;
  transition:
    opacity 1.1s cubic-bezier(0.16, 1, 0.3, 1),
    transform 1.1s cubic-bezier(0.16, 1, 0.3, 1),
    filter 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* After user drags, position is left/top in px — kill slide transition on move */
.hud-player.is-dragging {
  transition: none !important;
  animation: none !important;
  opacity: 1 !important;
  filter: none !important;
  cursor: grabbing;
  user-select: none;
}

.hud-player.is-dragged {
  /* right/bottom cleared in JS; keep fixed top-left coords */
  right: auto;
  bottom: auto;
  transform: none;
  filter: none;
}

.hud-player[hidden] {
  display: none !important;
}

.hud-player-chrome {
  position: relative;
  background: linear-gradient(
    165deg,
    rgba(6, 18, 40, 0.92) 0%,
    rgba(4, 12, 28, 0.88) 50%,
    rgba(2, 8, 20, 0.94) 100%
  );
  border: 1px solid var(--border-bright);
  border-radius: 2px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 0 0 1px rgba(61, 224, 255, 0.08),
    0 16px 48px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(43, 155, 255, 0.12),
    inset 0 1px 0 rgba(180, 230, 255, 0.1);
  overflow: hidden;
}

.hud-player-chrome::before {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(61, 224, 255, 0.7),
    transparent
  );
  pointer-events: none;
}

.hud-player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem 0.55rem;
  border-bottom: 1px solid rgba(61, 224, 255, 0.12);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.hud-player-head:active,
.hud-player.is-dragging .hud-player-head {
  cursor: grabbing;
}

/* Buttons inside the drag handle must stay clickable */
.hud-player-head-actions,
.hud-player-head-actions * {
  cursor: pointer;
  touch-action: manipulation;
}

.hud-player-id {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.hud-player-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
  flex-shrink: 0;
  animation: blink 2.2s ease-in-out infinite;
}

.hud-player.is-playing .hud-player-led {
  animation: blink 0.9s ease-in-out infinite;
  background: #7ef0ff;
}

.hud-player-sys {
  font-family: var(--font-display);
  font-size: 0.52rem;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}

.hud-player-mode {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--cyan);
  margin-top: 0.15rem;
}

.hud-player-head-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.hud-icon-btn {
  font-family: var(--font-display);
  font-size: 0.52rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  background: rgba(8, 28, 58, 0.55);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  transition:
    color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.hud-icon-btn:hover,
.hud-icon-btn:focus-visible,
.hud-icon-btn.is-active {
  color: var(--cyan);
  border-color: var(--border-bright);
  box-shadow: 0 0 12px rgba(61, 224, 255, 0.2);
  outline: none;
}

.hud-icon-btn--min {
  min-width: 1.75rem;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
  font-size: 0.85rem;
  line-height: 1;
}

.hud-player-body {
  padding: 0.75rem 0.85rem 0.9rem;
}

.hud-player.is-collapsed .hud-player-body {
  display: none;
}

/* High-end display surface */
.hud-display {
  position: relative;
  padding: 0.75rem 0.8rem 0.65rem;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(40, 100, 180, 0.18), transparent 55%),
    linear-gradient(180deg, rgba(2, 12, 28, 0.95), rgba(1, 6, 16, 0.98));
  border: 1px solid rgba(61, 224, 255, 0.22);
  border-radius: 2px;
  box-shadow:
    inset 0 0 30px rgba(0, 40, 80, 0.45),
    inset 0 1px 0 rgba(140, 210, 255, 0.12);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.hud-display-scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.5) 2px,
    rgba(0, 0, 0, 0.5) 4px
  );
}

.hud-viz {
  display: block;
  width: 100%;
  height: 52px;
  margin-bottom: 0.55rem;
  opacity: 0.95;
}

.hud-now-label {
  font-family: var(--font-display);
  font-size: 0.5rem;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.hud-now-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  color: #f0f8ff;
  text-shadow: 0 0 18px rgba(61, 224, 255, 0.35);
  line-height: 1.25;
  margin-bottom: 0.2rem;
}

.hud-now-meta {
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.hud-progress-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
  font-family: var(--font-display);
  font-size: 0.52rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.55rem;
}

.hud-progress {
  height: 4px;
  background: rgba(61, 224, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.35);
}

.hud-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue-600), var(--cyan));
  box-shadow: 0 0 10px var(--cyan-glow);
  transition: width 0.15s linear;
}

.hud-telemetry {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  font-family: var(--font-display);
  font-size: 0.48rem;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}

.hud-telemetry b {
  color: var(--cyan);
  font-weight: 500;
  margin-left: 0.25em;
}

/* Transport */
.hud-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.15rem;
}

.hud-ctrl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: rgba(8, 28, 58, 0.55);
  color: var(--text-muted);
  cursor: pointer;
  transition:
    color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    background 0.2s var(--ease);
}

.hud-ctrl svg {
  width: 1rem;
  height: 1rem;
}

.hud-ctrl:hover,
.hud-ctrl:focus-visible {
  color: var(--cyan);
  border-color: var(--border-bright);
  outline: none;
  box-shadow: 0 0 14px rgba(61, 224, 255, 0.22);
}

.hud-ctrl--main {
  width: 2.75rem;
  height: 2.75rem;
  color: var(--text);
  border-color: var(--border-bright);
  background: rgba(20, 80, 140, 0.35);
  box-shadow: 0 0 18px rgba(61, 224, 255, 0.15);
}

.hud-player.is-playing .hud-ctrl--main {
  color: var(--cyan);
  box-shadow: 0 0 22px rgba(61, 224, 255, 0.3);
}

.hud-vol {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  min-width: 0;
  flex: 1;
  max-width: 9rem;
}

.hud-vol-label {
  font-family: var(--font-display);
  font-size: 0.5rem;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}

.hud-vol input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: rgba(61, 224, 255, 0.15);
  border-radius: 2px;
  outline: none;
}

.hud-vol input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
  cursor: pointer;
  border: none;
}

.hud-vol input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
  cursor: pointer;
  border: none;
}

/* Catalog */
.hud-catalog {
  margin-top: 0.85rem;
  border-top: 1px solid rgba(61, 224, 255, 0.12);
  padding-top: 0.75rem;
  max-height: min(42vh, 320px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hud-catalog[hidden] {
  display: none !important;
}

.hud-catalog-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.55rem;
}

.hud-tab {
  flex: 1;
  font-family: var(--font-display);
  font-size: 0.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(4, 16, 36, 0.5);
  border: 1px solid rgba(61, 224, 255, 0.12);
  border-radius: 2px;
  padding: 0.45rem 0.3rem;
  cursor: pointer;
  transition:
    color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}

.hud-tab:hover,
.hud-tab:focus-visible {
  color: var(--text-muted);
  outline: none;
}

.hud-tab.is-active {
  color: var(--cyan);
  border-color: var(--border-bright);
  background: rgba(20, 80, 140, 0.28);
  box-shadow: 0 0 12px rgba(61, 224, 255, 0.12);
}

.hud-catalog-hint {
  font-family: var(--font-display);
  font-size: 0.48rem;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  margin-bottom: 0.45rem;
}

.hud-catalog-panels {
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.hud-catalog-panel {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hud-catalog-panel[hidden] {
  display: none !important;
}

.hud-tracklist {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  max-height: min(32vh, 240px);
  scrollbar-width: thin;
  scrollbar-color: rgba(61, 224, 255, 0.35) transparent;
}

.hud-track {
  border-bottom: 1px solid rgba(61, 224, 255, 0.08);
}

.hud-track-btn {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.35rem;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.hud-track-btn:hover,
.hud-track-btn:focus-visible {
  background: rgba(20, 80, 140, 0.22);
  outline: none;
}

.hud-track.is-active .hud-track-btn {
  background: rgba(20, 100, 170, 0.22);
  box-shadow: inset 2px 0 0 var(--cyan);
}

.hud-track-idx {
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.hud-track.is-active .hud-track-idx {
  color: var(--cyan);
}

.hud-track-name {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.25;
}

.hud-track-sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 300;
  color: var(--text-muted);
  margin-top: 0.12rem;
  line-height: 1.3;
}

.hud-track-tag {
  font-family: var(--font-display);
  font-size: 0.45rem;
  letter-spacing: 0.12em;
  color: var(--cyan);
  border: 1px solid rgba(61, 224, 255, 0.25);
  padding: 0.2rem 0.35rem;
  border-radius: 2px;
  opacity: 0.85;
}

@media (max-width: 720px) {
  .hud-player:not(.is-dragged) {
    top: 4.25rem;
    right: 0.5rem;
    left: auto;
    bottom: auto;
    width: min(420px, calc(100vw - 1rem));
  }

  .hud-now-title {
    font-size: 0.95rem;
  }
}

/* Hide player during preloader */
body.is-loading .hud-player {
  opacity: 0;
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   Deck console — Power Levels + Agent discs
   ═══════════════════════════════════════════ */

.deck-console {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  padding: 0 clamp(0.75rem, 2vw, 1.5rem) clamp(0.65rem, 1.5vh, 1rem);
  pointer-events: none;
  /* Offline until is-hud-in cascade */
  opacity: 0;
  visibility: hidden;
  will-change: opacity, transform, filter;
}

.deck-console-inner {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: stretch;
  max-width: 520px;
  margin: 0 auto 0 0;
  padding: 0.85rem 1rem 0.95rem;
  background: linear-gradient(
    180deg,
    rgba(4, 14, 32, 0.55) 0%,
    rgba(2, 10, 24, 0.88) 40%,
    rgba(1, 6, 16, 0.94) 100%
  );
  border: 1px solid rgba(61, 224, 255, 0.22);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 -8px 40px rgba(0, 0, 0, 0.45),
    0 0 30px rgba(43, 155, 255, 0.1),
    inset 0 1px 0 rgba(140, 210, 255, 0.12);
}

.deck-console-inner::before {
  content: "";
  position: absolute;
  /* decorative top edge line — need position relative on parent */
}

.deck-console-inner {
  position: relative;
}

.deck-console-inner::after {
  content: "";
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(61, 224, 255, 0.55),
    transparent
  );
  pointer-events: none;
}

.deck-section-head {
  margin-bottom: 0.65rem;
}

.deck-section-label {
  font-family: var(--font-display);
  font-size: 0.5rem;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  margin-bottom: 0.2rem;
}

.deck-section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 0 14px rgba(61, 224, 255, 0.25);
}

/* Power bars */
.power-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.power-bar {
  display: grid;
  grid-template-columns: 4.2rem 1fr 2.4rem;
  gap: 0.55rem;
  align-items: center;
}

.power-bar-name {
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.power-bar-track {
  height: 6px;
  border-radius: 2px;
  background: rgba(61, 224, 255, 0.1);
  border: 1px solid rgba(61, 224, 255, 0.15);
  overflow: hidden;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.35);
}

.power-bar-fill {
  height: 100%;
  width: var(--level, 50%);
  border-radius: 1px;
  background: linear-gradient(90deg, var(--blue-600), var(--cyan));
  box-shadow: 0 0 10px var(--cyan-glow);
  animation: power-hum 2.8s ease-in-out infinite;
}

.power-bar-fill--mid {
  background: linear-gradient(90deg, #0a6fd4, #4aadff);
  animation-delay: 0.35s;
}

.power-bar-fill--hi {
  background: linear-gradient(90deg, #1488f0, #7ef0ff);
  animation-delay: 0.7s;
}

@keyframes power-hum {
  0%,
  100% {
    filter: brightness(1);
    opacity: 0.92;
  }
  50% {
    filter: brightness(1.15);
    opacity: 1;
  }
}

.power-bar-val {
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: var(--cyan);
  text-align: right;
}

/* ─── Tron agent discs ─── */

.agent-discs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 3vw, 1.75rem);
  padding: 0.25rem 0 0.15rem;
}

.agent-disc {
  position: relative;
  width: clamp(4.75rem, 11vw, 6.25rem);
  height: clamp(4.75rem, 11vw, 6.25rem);
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.agent-disc-core {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 35% 30%, rgba(180, 230, 255, 0.35), transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(20, 80, 140, 0.55), rgba(2, 10, 24, 0.95));
  border: 2px solid rgba(61, 224, 255, 0.65);
  box-shadow:
    0 0 18px rgba(61, 224, 255, 0.45),
    0 0 40px rgba(43, 155, 255, 0.25),
    inset 0 0 20px rgba(61, 224, 255, 0.2),
    inset 0 0 4px rgba(200, 240, 255, 0.35);
  z-index: 2;
  transition:
    transform 0.3s var(--ease),
    box-shadow 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

.agent-disc-letter {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.35rem, 3.2vw, 1.75rem);
  letter-spacing: 0.06em;
  color: #e8f7ff;
  text-shadow:
    0 0 12px rgba(61, 224, 255, 0.9),
    0 0 28px rgba(43, 155, 255, 0.55);
}

.agent-disc-ring {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1.5px solid rgba(61, 224, 255, 0.45);
  box-shadow:
    0 0 12px rgba(61, 224, 255, 0.35),
    inset 0 0 10px rgba(61, 224, 255, 0.12);
  z-index: 1;
  animation: disc-pulse 2.6s ease-in-out infinite;
}

.agent-disc-ring--outer {
  inset: 0;
  border-width: 1px;
  border-color: rgba(61, 224, 255, 0.28);
  box-shadow: 0 0 20px rgba(61, 224, 255, 0.2);
  animation: disc-pulse-outer 3.2s ease-in-out infinite;
}

.agent-disc-label {
  position: absolute;
  left: 50%;
  bottom: -1.15rem;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 0.5rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0.85;
}

/* Color variants — Tron light identities
   Qwen = Cyan · Repairs = Green · Security = Red */
.agent-disc--q .agent-disc-core {
  border-color: rgba(61, 224, 255, 0.9);
  background:
    radial-gradient(circle at 35% 30%, rgba(180, 240, 255, 0.4), transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(20, 90, 150, 0.55), rgba(2, 10, 24, 0.95));
  box-shadow:
    0 0 22px rgba(61, 224, 255, 0.6),
    0 0 48px rgba(43, 155, 255, 0.32),
    inset 0 0 22px rgba(61, 224, 255, 0.3);
}

.agent-disc--q .agent-disc-ring,
.agent-disc--q .agent-disc-ring--outer {
  border-color: rgba(61, 224, 255, 0.5);
  box-shadow: 0 0 16px rgba(61, 224, 255, 0.4);
}

.agent-disc--q .agent-disc-letter {
  text-shadow:
    0 0 12px rgba(61, 224, 255, 0.95),
    0 0 28px rgba(43, 155, 255, 0.55);
}

.agent-disc--r .agent-disc-core {
  border-color: rgba(60, 255, 120, 0.9);
  background:
    radial-gradient(circle at 35% 30%, rgba(180, 255, 200, 0.35), transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(20, 110, 50, 0.55), rgba(2, 10, 24, 0.95));
  box-shadow:
    0 0 22px rgba(60, 255, 120, 0.55),
    0 0 48px rgba(40, 200, 90, 0.3),
    inset 0 0 22px rgba(80, 255, 140, 0.25);
}

.agent-disc--r .agent-disc-ring,
.agent-disc--r .agent-disc-ring--outer {
  border-color: rgba(60, 255, 120, 0.45);
  box-shadow: 0 0 16px rgba(60, 255, 120, 0.35);
}

.agent-disc--r .agent-disc-letter {
  text-shadow:
    0 0 12px rgba(120, 255, 160, 0.95),
    0 0 28px rgba(40, 220, 100, 0.55);
}

.agent-disc--s .agent-disc-core {
  border-color: rgba(255, 70, 90, 0.9);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 180, 190, 0.35), transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(140, 20, 40, 0.55), rgba(2, 10, 24, 0.95));
  box-shadow:
    0 0 22px rgba(255, 60, 80, 0.55),
    0 0 48px rgba(220, 40, 60, 0.3),
    inset 0 0 22px rgba(255, 90, 110, 0.25);
}

.agent-disc--s .agent-disc-ring,
.agent-disc--s .agent-disc-ring--outer {
  border-color: rgba(255, 70, 90, 0.45);
  box-shadow: 0 0 16px rgba(255, 60, 80, 0.35);
}

.agent-disc--s .agent-disc-letter {
  text-shadow:
    0 0 12px rgba(255, 120, 140, 0.95),
    0 0 28px rgba(255, 50, 70, 0.55);
}

.agent-disc:hover .agent-disc-core,
.agent-disc:focus-visible .agent-disc-core {
  transform: scale(1.06);
  outline: none;
}

.agent-disc:focus-visible {
  outline: none;
}

.agent-disc:focus-visible .agent-disc-ring--outer {
  border-color: rgba(255, 255, 255, 0.55);
}

.agent-disc[aria-pressed="true"] .agent-disc-core {
  transform: scale(1.08);
  box-shadow:
    0 0 28px rgba(61, 224, 255, 0.7),
    0 0 60px rgba(43, 155, 255, 0.4),
    inset 0 0 28px rgba(61, 224, 255, 0.35);
}

.agent-disc--r[aria-pressed="true"] .agent-disc-core {
  box-shadow:
    0 0 28px rgba(60, 255, 120, 0.7),
    0 0 60px rgba(40, 200, 90, 0.4),
    inset 0 0 28px rgba(80, 255, 140, 0.35);
}

.agent-disc--s[aria-pressed="true"] .agent-disc-core {
  box-shadow:
    0 0 28px rgba(255, 60, 80, 0.7),
    0 0 60px rgba(220, 40, 60, 0.4),
    inset 0 0 28px rgba(255, 90, 110, 0.35);
}

@keyframes disc-pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes disc-pulse-outer {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(1);
    box-shadow: 0 0 12px rgba(61, 224, 255, 0.15);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.06);
    box-shadow: 0 0 28px rgba(61, 224, 255, 0.35);
  }
}

/* Stagger pulse per agent */
.agent-disc--q .agent-disc-ring {
  animation-delay: 0s;
}
.agent-disc--r .agent-disc-ring {
  animation-delay: 0.45s;
}
.agent-disc--s .agent-disc-ring {
  animation-delay: 0.9s;
}
.agent-disc--q .agent-disc-ring--outer {
  animation-delay: 0.15s;
}
.agent-disc--r .agent-disc-ring--outer {
  animation-delay: 0.6s;
}
.agent-disc--s .agent-disc-ring--outer {
  animation-delay: 1.05s;
}

/* Give main content a little bottom room */
.scene {
  padding-bottom: 3rem;
}

/* Deck stays offline until is-hud-in cascade (see choreography block) */
body.is-loading .deck-console,
body.is-bridge-ready:not(.is-hud-in) .deck-console {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 800px) {
  .deck-console-inner {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding-bottom: 1.1rem;
  }

  .agent-discs {
    padding-bottom: 0.85rem;
  }

  .scene {
    padding-bottom: clamp(16rem, 42vh, 22rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .agent-disc-ring,
  .agent-disc-ring--outer,
  .power-bar-fill {
    animation: none !important;
  }
}
