/* ============================================================
   AVENGERS: QUANTUM DOOM — Main Stylesheet
   THEME: STRICT MONOCHROME (BLACK & WHITE / GRAYSCALE)
   Rule: Everything other than 3D models and cutscenes MUST be black & white.
   ============================================================ */

/* ── CSS Custom Properties ── */
:root {
  --color-black: #000000;
  --color-void: #050507;
  --color-surface: #0e0e12;
  --color-surface-hover: #18181f;
  --color-surface-glass: rgba(10, 10, 14, 0.85);

  --color-border-bright: #ffffff;
  --color-border-medium: rgba(255, 255, 255, 0.4);
  --color-border-subtle: rgba(255, 255, 255, 0.16);
  --color-border-dim: rgba(255, 255, 255, 0.08);

  --color-text-primary: #ffffff;
  --color-text-secondary: #dcdcdc;
  --color-text-muted: #888888;
  --color-text-dim: #555555;

  --color-white-glow: rgba(255, 255, 255, 0.25);
  --color-white-glow-intense: rgba(255, 255, 255, 0.6);

  --font-display: 'Orbitron', monospace;
  --font-body: 'Inter', sans-serif;
  --font-cinematic: 'Rajdhani', sans-serif;

  --transition-fade: 800ms ease-in-out;
  --transition-scene: 1200ms ease-in-out;
  --transition-text: 600ms ease-out;

  --vignette-inner: 60%;
  --vignette-outer: 100%;
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--color-black);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* ── App Shell ── */
#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--color-black);
}

/* ── Particle Canvas ── */
#particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 1s ease;
}

#particle-canvas.active {
  opacity: 1;
}

/* ── Scene Container ── */
#scene-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

/* ── UI Overlay ── */
#ui-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

/* ── Skip Button (Monochrome) ── */
.skip-button {
  position: absolute;
  top: 28px;
  right: 32px;
  pointer-events: all;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--color-border-medium);
  color: var(--color-text-primary);
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 9px 20px;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease, border-color 200ms ease, box-shadow 200ms ease, opacity 300ms ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
}

.skip-button:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: #000000;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.skip-button.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   CINEMATIC SCENE
   ============================================================ */

.cinematic-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  opacity: 0;
  transition: opacity var(--transition-scene);
}

.cinematic-scene.visible {
  opacity: 1;
}

/* ── Image Layer (Camera zoom/pan) ── */
.scene-image-layer {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  will-change: transform;
}

/* ── Vignette Overlay (Monochrome) ── */
.scene-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent var(--vignette-inner),
    rgba(0, 0, 0, 0.75) var(--vignette-outer)
  );
  pointer-events: none;
  z-index: 1;
}

.scene-vignette.heavy {
  background: radial-gradient(
    ellipse at center,
    transparent 35%,
    rgba(0, 0, 0, 0.9) 100%
  );
}

/* ── Color Grade Layer (Neutral monochrome tone) ── */
.scene-grade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 2s ease;
}

.scene-grade.doom {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.04) 0%,
    transparent 60%,
    rgba(0, 0, 0, 0.25) 100%
  );
}

.scene-grade.collapse {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(0, 0, 0, 0.35) 100%
  );
}

/* ── Text Layer ── */
.scene-text-layer {
  position: absolute;
  bottom: 12%;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 8%;
}

.scene-text-line {
  font-family: var(--font-cinematic);
  font-size: clamp(1.15rem, 2.2vw, 1.7rem);
  font-weight: 400;
  color: #ffffff;
  text-align: center;
  letter-spacing: 0.06em;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--transition-text), transform var(--transition-text);
  text-shadow:
    0 0 30px rgba(0, 0, 0, 0.95),
    0 2px 10px rgba(0, 0, 0, 0.9),
    0 0 80px rgba(0, 0, 0, 0.8);
}

.scene-text-line.visible {
  opacity: 1;
  transform: translateY(0);
}

.scene-text-line.accent {
  color: #ffffff;
  font-weight: 600;
  text-shadow:
    0 0 25px rgba(255, 255, 255, 0.7),
    0 2px 10px rgba(0, 0, 0, 0.9);
}

/* ── Black Screen ── */
.black-screen {
  position: absolute;
  inset: 0;
  background: var(--color-black);
  z-index: 3;
  opacity: 1;
  transition: opacity var(--transition-scene);
}

.black-screen.transparent {
  opacity: 0;
  pointer-events: none;
}

/* ── Screen Shake ── */
@keyframes screenShake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  10% { transform: translate(-3px, -1px) rotate(-0.3deg); }
  20% { transform: translate(3px, 1px) rotate(0.2deg); }
  30% { transform: translate(-2px, 2px) rotate(-0.2deg); }
  40% { transform: translate(2px, -2px) rotate(0.1deg); }
  50% { transform: translate(-1px, 1px) rotate(-0.1deg); }
  60% { transform: translate(1px, -1px) rotate(0.2deg); }
  70% { transform: translate(-2px, -1px) rotate(-0.2deg); }
  80% { transform: translate(2px, 2px) rotate(0.1deg); }
  90% { transform: translate(-1px, -1px) rotate(-0.1deg); }
}

.shake {
  animation: screenShake 0.6s ease-in-out;
}

/* ============================================================
   DOOM ENGINE BRIEFING (STRICT MONOCHROME)
   ============================================================ */

.doom-engine-briefing {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: var(--color-void);
  z-index: 6;
  opacity: 0;
  transition: opacity 1.2s ease;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 40px 20px;
}

.doom-engine-briefing.visible {
  opacity: 1;
}

.doom-engine-briefing::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.doom-engine-briefing::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  animation: scanLine 4s linear infinite;
  pointer-events: none;
}

@keyframes scanLine {
  0% { top: 0; opacity: 0; }
  5% { opacity: 1; }
  95% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.briefing-content {
  position: relative;
  z-index: 1;
  max-width: 760px;
  width: 90%;
  padding: 48px 48px 40px;
  border: 1px solid var(--color-border-subtle);
  background: rgba(8, 8, 12, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  clip-path: polygon(
    0 0,
    calc(100% - 24px) 0,
    100% 24px,
    100% 100%,
    24px 100%,
    0 calc(100% - 24px)
  );
  margin: auto;
}

.briefing-header {
  margin-bottom: 36px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.briefing-tag {
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.35em;
  color: #000000;
  background: #ffffff;
  display: inline-block;
  padding: 4px 10px;
  text-transform: uppercase;
  margin-bottom: 12px;
  font-weight: 900;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.briefing-tag.visible {
  opacity: 1;
}

.briefing-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.6rem);
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.briefing-title .accent-doom {
  color: #ffffff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
}

.briefing-title.visible {
  opacity: 1;
  transform: translateY(0);
}

.briefing-line {
  font-family: var(--font-cinematic);
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  font-weight: 400;
  line-height: 1.65;
  color: var(--color-text-secondary);
  letter-spacing: 0.025em;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.briefing-line:last-of-type {
  border-bottom: none;
}

.briefing-line.visible {
  opacity: 1;
  transform: translateX(0);
}

.briefing-line.dramatic {
  font-size: clamp(1.0rem, 1.7vw, 1.2rem);
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.04em;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid var(--color-border-subtle);
  border-bottom: none;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.briefing-line.conclusion {
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.04em;
}

.continue-section {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  opacity: 0;
  transition: opacity 1s ease;
}

.continue-section.visible {
  opacity: 1;
}

.act-label {
  font-family: var(--font-display);
  font-size: 0.52rem;
  letter-spacing: 0.4em;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.continue-btn {
  background: transparent;
  border: 1px solid var(--color-border-bright);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding: 14px 48px;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
  position: relative;
  overflow: hidden;
}

.continue-btn:hover {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.5);
}

/* ============================================================
   ACT 1A — MULTIVERSE CHAMBER SCREEN (MONOCHROME)
   ============================================================ */

.multiverse-chamber-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-void);
  z-index: 8;
  opacity: 0;
  transition: opacity 1s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.multiverse-chamber-screen.visible {
  opacity: 1;
}

/* Chamber Background Grid */
.multiverse-chamber-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ── Chamber Header & Live Metrics ── */
.chamber-header {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 24px 48px 18px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: rgba(5, 5, 8, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.header-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.header-tag {
  font-family: var(--font-display);
  font-size: 0.5rem;
  letter-spacing: 0.35em;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.chamber-title {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.4vw, 1.8rem);
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chamber-metrics {
  display: flex;
  gap: 12px;
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 22px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 200ms ease;
}

.metric-item:hover {
  border-color: #ffffff;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.metric-label {
  font-family: var(--font-display);
  font-size: 0.44rem;
  letter-spacing: 0.25em;
  color: var(--color-text-secondary);
}

.metric-val {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.1em;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* ── Mission Banner ── */
.mission-bar {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 12px 48px;
  background: rgba(10, 10, 15, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.mission-badge {
  font-family: var(--font-display);
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  background: #ffffff;
  color: #000000;
  padding: 4px 14px;
  border-radius: 9999px;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
}

.mission-desc {
  font-family: var(--font-cinematic);
  font-size: 1.05rem;
  font-weight: 500;
  color: #ffffff;
  letter-spacing: 0.04em;
  flex: 1;
}

.profile-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 8px 22px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 200ms ease;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

.profile-toggle-btn:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.7);
}

/* ── Doom Defense Drawer ── */
.doom-profile-drawer {
  position: relative;
  z-index: 2;
  width: 100%;
  max-height: 0;
  overflow: hidden;
  transition: max-height 350ms cubic-bezier(0.16, 1, 0.3, 1), padding 350ms ease;
  background: rgba(10, 10, 15, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.doom-profile-drawer.open {
  max-height: 180px;
  padding: 18px 48px;
}

.drawer-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-title {
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.25em;
  color: var(--color-text-secondary);
  text-transform: uppercase;
}

.defense-req-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.req-chip {
  font-family: var(--font-cinematic);
  font-size: 0.95rem;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  padding: 8px 18px;
  border-radius: 9999px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.15);
}

.chip-code {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  color: #ffffff;
  margin-right: 8px;
}

/* ── Portals Grid ── */
.portals-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  padding: 28px 48px;
  flex: 1;
  align-content: center;
}

@media (max-width: 1100px) {
  .portals-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Portal Card (Curved High-Contrast White Aesthetics) ── */
.portal-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 22px;
  border-radius: 28px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.12) 0%, rgba(12, 12, 18, 0.9) 80%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  cursor: pointer;
  position: relative;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.4s ease, border-color 250ms ease, background 250ms ease, box-shadow 250ms ease;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  outline: none;
}

.portal-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.portal-card:hover,
.portal-card:focus {
  border-color: #ffffff;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.22) 0%, rgba(20, 20, 30, 0.95) 80%);
  box-shadow: 0 16px 45px rgba(255, 255, 255, 0.35), inset 0 0 20px rgba(255, 255, 255, 0.25);
  transform: translateY(-6px);
}

.portal-card.status-examined {
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 30px rgba(255, 255, 255, 0.25);
}

.portal-card.status-examined .card-status-badge {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.7);
}

.portal-card.status-rejected {
  border-color: rgba(255, 255, 255, 0.15);
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.04) 0%, rgba(6, 6, 10, 0.8) 80%);
  opacity: 0.8;
}

.portal-card.status-viable {
  border-color: #ffffff;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.3) 0%, rgba(25, 25, 35, 0.95) 80%);
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.6), inset 0 0 25px rgba(255, 255, 255, 0.4);
}

.portal-card.prime-candidate {
  border-color: rgba(255, 255, 255, 0.58);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.18), transparent 56%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(12, 12, 16, 0.96) 62%);
}

.portal-card.prime-candidate .card-portal-ring {
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.5);
}

.portal-card.prime-candidate .card-portal-core {
  width: 38px;
  height: 38px;
  box-shadow: 0 0 28px rgba(255, 255, 255, 0.9);
}

.card-prime-mark {
  margin-top: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.44rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  background: rgba(255, 255, 255, 0.06);
}

/* ── Portal Ring Graphic (Multi-Ring Glowing Spheres) ── */
.portal-ring-wrap {
  width: 68px;
  height: 68px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-portal-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  animation: portalSpin 10s linear infinite;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.card-portal-ring::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.35);
  animation: portalSpin 16s linear infinite reverse;
}

.card-portal-core {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 15%, rgba(255, 255, 255, 0.6) 60%, transparent 85%);
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 20px #ffffff;
  animation: corePulse 3s ease-in-out infinite;
}

@keyframes portalSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes corePulse {
  0%, 100% { transform: scale(0.92); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 28px #ffffff; }
}

.portal-card:hover .card-portal-core {
  background: radial-gradient(circle, #ffffff 30%, rgba(255, 255, 255, 0.9) 70%, transparent 95%);
  box-shadow: 0 0 35px #ffffff;
}

/* ── Card Meta & Team Preview ── */
.card-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.card-universe-num {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.card-universe-code {
  font-family: var(--font-display);
  font-size: 0.52rem;
  letter-spacing: 0.22em;
  color: var(--color-text-secondary);
}

.card-team-preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

.card-hero-chip {
  font-family: var(--font-cinematic);
  font-size: 0.72rem;
  font-weight: 600;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ── Card Status Badge (Pill Capsule with Glowing Spherical Indicator) ── */
.card-status-badge {
  font-family: var(--font-display);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  margin-top: 6px;
  padding: 5px 14px;
  border-radius: 9999px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 250ms ease;
}

.status-orb {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: #666666;
}

.status-orb.unexamined {
  background: #666666;
}

.status-orb.examined {
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff;
}

.status-orb.viable {
  background: #000000;
}

.status-orb.rejected {
  background: #888888;
}

.status-examined .card-status-badge {
  color: #ffffff;
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.status-viable .card-status-badge {
  color: #000000;
  background: #ffffff;
  font-weight: 900;
  border-color: #ffffff;
  box-shadow: 0 0 20px #ffffff;
}

.portal-card:focus-visible,
.profile-toggle-btn:focus-visible,
.hud-back-btn:focus-visible,
.start-scan-btn:focus-visible,
.proceed-summary-btn:focus-visible,
.return-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 4px;
}

.status-rejected .card-status-badge {
  color: var(--color-text-muted);
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.5);
}

/* ── Chamber Footer ── */
.chamber-footer {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 12px 48px;
  border-top: 1px solid var(--color-border-dim);
  background: rgba(5, 5, 8, 0.9);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-display);
  font-size: 0.5rem;
  letter-spacing: 0.25em;
  color: var(--color-text-muted);
}

/* ============================================================
   UNIVERSE 3D INSPECTION VIEW (MONOCHROME HUD OVER 3D)
   ============================================================ */

.universe-inspection-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: var(--color-black);
  opacity: 0;
  transition: opacity 400ms ease;
  overflow: hidden;
}

.universe-inspection-overlay.visible {
  opacity: 1;
}

.universe-3d-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.universe-3d-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* ── Model Loading Layer ── */
.universe-loading-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(5, 5, 8, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 350ms ease;
}

.universe-loading-layer.faded {
  opacity: 0;
  pointer-events: none;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 400px;
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--color-border-dim);
  border-top-color: #ffffff;
  animation: portalSpin 1s linear infinite;
}

.loader-title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  color: #ffffff;
  font-weight: 700;
}

.loader-subtitle {
  font-family: var(--font-display);
  font-size: 0.52rem;
  letter-spacing: 0.2em;
  color: var(--color-text-muted);
}

.loader-progress-bar {
  width: 240px;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin-top: 4px;
}

.progress-fill {
  height: 100%;
  background: #ffffff;
  transition: width 150ms ease;
}

.loader-pct {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--color-text-secondary);
}

/* ── Inspection HUD Overlay ── */
.inspection-hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px 48px;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: all;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
  padding-bottom: 20px;
}

.hud-universe-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-tag {
  font-family: var(--font-display);
  font-size: 0.52rem;
  letter-spacing: 0.3em;
  color: var(--color-text-muted);
}

.hud-universe-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.1em;
}

.hud-code {
  font-size: 0.6em;
  color: var(--color-text-muted);
  font-weight: 400;
  margin-left: 8px;
}

.hud-universe-desc {
  font-family: var(--font-cinematic);
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  max-width: 580px;
  margin-top: 2px;
}

.hud-back-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 10px 24px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 200ms ease;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hud-back-btn:hover {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.8);
}

/* ── Bottom HUD Row (Team Roster on Left, Scanner on Right) ── */
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  pointer-events: none;
  gap: 24px;
}

/* ── Team Bar (Bottom Left Pill Capsules) ── */
.hud-team-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: all;
  max-width: 360px;
}

.hud-team-header {
  font-family: var(--font-display);
  font-size: 0.52rem;
  letter-spacing: 0.28em;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.hud-team-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-hero-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  border-radius: 9999px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  background: rgba(14, 14, 20, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transition: all 200ms ease;
  width: fit-content;
}

.hud-hero-card:hover {
  border-color: #ffffff;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.4);
  transform: translateX(4px);
}

.hero-name {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #ffffff;
}

.hero-role {
  font-family: var(--font-cinematic);
  font-size: 0.76rem;
  color: var(--color-text-secondary);
  letter-spacing: 0.05em;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  padding-left: 8px;
}

/* ── Physical Scanner Panel (Bottom Right) ── */
.scanner-panel {
  align-self: flex-end;
  pointer-events: all;
  width: 440px;
  max-width: 90vw;
  background: rgba(10, 10, 16, 0.92);
  border-radius: 28px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  padding: 24px 26px;
  gap: 16px;
}

.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 12px;
}

.scanner-title {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.25em;
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.scanner-status {
  font-family: var(--font-display);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--color-text-secondary);
  padding: 4px 12px;
  border-radius: 9999px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.06);
}

.scanner-status.viable {
  color: #000000;
  background: #ffffff;
  font-weight: 900;
  border-color: #ffffff;
  box-shadow: 0 0 15px #ffffff;
}

.scanner-status.rejected {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.scanner-status.scanning {
  color: #ffffff;
  animation: scanBlink 500ms ease-in-out infinite alternate;
}

/* ── Scanner Conditions List ── */
.scanner-conditions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.condition-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-radius: 9999px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  transition: all 200ms ease;
}

.cond-name {
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #ffffff;
}

.cond-val {
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--color-text-muted);
}

.cond-val.scanning {
  color: #ffffff;
  animation: scanBlink 500ms ease-in-out infinite alternate;
}

@keyframes scanBlink {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

.cond-val.detected {
  color: #000000;
  background: #ffffff;
  padding: 3px 10px;
  border-radius: 9999px;
  font-weight: 900;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.7);
}

.cond-val.absent {
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 3px 10px;
  border-radius: 9999px;
}

/* ── Scanner Actions & Verdict ── */
.start-scan-btn {
  width: 100%;
  background: #ffffff;
  color: #000000;
  border: 1.5px solid #ffffff;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.25em;
  padding: 15px 28px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.6), 0 0 50px rgba(255, 255, 255, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.start-scan-btn:hover:not(:disabled) {
  background: #ffffff;
  color: #000000;
  transform: scale(1.03);
  box-shadow: 0 0 35px #ffffff, 0 0 70px rgba(255, 255, 255, 0.5);
}

.start-scan-btn:disabled {
  background: rgba(255, 255, 255, 0.15);
  color: #888888;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
  cursor: not-allowed;
}

.result-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--color-border-medium);
}

.result-rejected {
  background: rgba(255, 255, 255, 0.03);
}

.result-viable {
  background: rgba(255, 255, 255, 0.08);
  border-color: #ffffff;
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.25);
}

.result-tag {
  font-family: var(--font-display);
  font-size: 0.5rem;
  letter-spacing: 0.3em;
  color: var(--color-text-muted);
}

.result-progress-bar {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: #ffffff;
}

.result-verdict {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: #ffffff;
}

.result-reason {
  font-family: var(--font-cinematic);
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--color-text-secondary);
}

.return-btn,
.proceed-summary-btn {
  background: transparent;
  border: 1px solid var(--color-border-bright);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 12px;
  cursor: pointer;
  margin-top: 6px;
  transition: all 200ms ease;
}

.return-btn:hover,
.proceed-summary-btn:hover {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

/* ============================================================
   SEARCH DEBRIEF SCREEN — BRUTE FORCE COST (MONOCHROME)
   ============================================================ */

.search-debrief-screen {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: rgba(3, 3, 5, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  opacity: 0;
  transition: opacity 800ms ease;
}

.search-debrief-screen.visible {
  opacity: 1;
}

.debrief-content {
  max-width: 680px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.debrief-tag {
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.35em;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.debrief-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.debrief-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  margin: 12px 0;
}

.debrief-stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--color-border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.dstat-label {
  font-family: var(--font-display);
  font-size: 0.5rem;
  letter-spacing: 0.25em;
  color: var(--color-text-muted);
}

.dstat-val {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.1em;
}

.debrief-narrative {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 16px 0;
}

.narrative-line {
  font-family: var(--font-cinematic);
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  color: var(--color-text-secondary);
  letter-spacing: 0.05em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.narrative-line.visible {
  opacity: 1;
  transform: translateY(0);
}

.narrative-line.dramatic {
  color: #ffffff;
  font-weight: 700;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
  padding-top: 10px;
}

.debrief-actions {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  opacity: 0;
  transition: opacity 600ms ease;
}

.debrief-actions.visible {
  opacity: 1;
}

.debrief-replay-btn {
  background: transparent;
  border: 1px solid var(--color-border-bright);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  padding: 14px 32px;
  cursor: pointer;
  transition: all 200ms ease;
  clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
}

.debrief-replay-btn:hover {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* ── Utility ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 700px) {
  .chamber-header {
    padding: 18px 20px;
    align-items: flex-start;
  }

  .chamber-metrics {
    width: 100%;
    gap: 8px;
  }

  .metric-item {
    flex: 1;
    padding: 8px 10px;
  }

  .mission-bar {
    padding: 14px 20px;
    gap: 10px;
  }

  .mission-desc {
    flex-basis: calc(100% - 90px);
    font-size: 0.95rem;
  }

  .profile-toggle-btn {
    margin-left: auto;
  }

  .portals-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 20px;
  }

  .portal-card {
    min-height: 205px;
    padding: 20px;
  }

  .chamber-footer {
    padding: 14px 20px;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1.6;
  }

  .inspection-hud {
    padding: 18px 16px;
  }

  .hud-top {
    gap: 12px;
    flex-direction: column;
  }

  .hud-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    max-height: 56vh;
    overflow-y: auto;
  }

  .hud-team-bar {
    max-width: none;
  }

  .hud-team-chips {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .hud-hero-card {
    flex-wrap: wrap;
    border-radius: 14px;
  }

  .scanner-panel {
    width: 100%;
    max-width: none;
    padding: 18px;
    border-radius: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-card,
  .card-portal-ring,
  .card-portal-ring::before,
  .card-portal-core,
  .loader-spinner {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
