/* ==========================================================================
   AVENGERS: QUANTUM DOOM — QUANTUM MISSION HUD
   Light desktop game UI with a high-contrast state visualization
   ========================================================================== */

/* ── Act 1 Stages Container ────────────────────────────────────────────── */
.act1-stages-container {
  position: absolute;
  inset: 0;
  z-index: 15;
  background: #000000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.act1-stages-container.visible {
  opacity: 1;
}

/* ── Common Stage Buttons (Spherical / Pill Capsules) ──────────────────── */
.stage-primary-btn {
  background: #ffffff;
  color: #000000;
  border: 1.5px solid #ffffff;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  padding: 13px 30px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 200ms ease;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

.stage-primary-btn:hover:not(:disabled) {
  background: #ffffff;
  color: #000000;
  transform: scale(1.03);
  box-shadow: 0 0 35px #ffffff, 0 0 60px rgba(255, 255, 255, 0.6);
}

.stage-primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(1);
  box-shadow: none;
}

.stage-secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding: 12px 24px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 200ms ease;
  text-transform: uppercase;
}

.stage-secondary-btn:hover:not(:disabled) {
  background: #ffffff;
  border-color: #ffffff;
  color: #000000;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
}

/* ── Stage Dialogue Screen (Act 1B, 1F, 1K, 1M, 1N, Complete) ─────────── */
.stage-dialogue-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: radial-gradient(circle at center, rgba(30, 30, 30, 0.4) 0%, #000000 70%);
}

.dialogue-box {
  max-width: 760px;
  width: 100%;
  background: rgba(8, 8, 10, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.9), inset 0 0 25px rgba(255, 255, 255, 0.02);
  padding: 36px 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  clip-path: polygon(
    0 0,
    calc(100% - 18px) 0,
    100% 18px,
    100% 100%,
    18px 100%,
    0 calc(100% - 18px)
  );
}

.dialogue-tag {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.52rem;
  letter-spacing: 0.35em;
  color: #888888;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.dialogue-speaker {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: #ffffff;
  margin-bottom: 22px;
  text-transform: uppercase;
}

.dialogue-lines {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  margin-bottom: 20px;
}

.d-line {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 500;
  letter-spacing: 0.05em;
  color: #cccccc;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 600ms ease, transform 600ms ease;
}

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

.d-line.dramatic {
  color: #ffffff;
  font-weight: 700;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.7);
}

.d-line.conclusion {
  color: #ffffff;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  margin-top: 10px;
}

/* ── Stage Roster Screen (Act 1C) ──────────────────────────────────────── */
.stage-roster-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 36px;
  overflow: hidden;
  background: #000000;
}

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

.stage-tag {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.52rem;
  letter-spacing: 0.35em;
  color: #888888;
  display: block;
  margin-bottom: 4px;
}

.stage-title {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: clamp(1.2rem, 2.2vw, 1.8rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  color: #ffffff;
  text-transform: uppercase;
}

.stage-metrics {
  display: flex;
  gap: 14px;
}

.metric-card {
  display: flex;
  flex-direction: column;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.18);
  min-width: 95px;
}

.m-label {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.46rem;
  letter-spacing: 0.25em;
  color: #888888;
}

.m-val {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.08em;
}

.roster-instruction-banner {
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid #ffffff;
  padding: 10px 18px;
  margin-bottom: 14px;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  color: #ffffff;
}

.banner-sub {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.85rem;
  color: #888888;
  margin-top: 3px;
  letter-spacing: 0.04em;
}

.roster-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding-right: 8px;
  margin-bottom: 14px;
}

.roster-hero-card {
  background: rgba(12, 12, 16, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 150ms ease;
}

.roster-hero-card:hover {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.15);
}

.hero-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hero-id-badge {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.5rem;
  color: #666666;
  letter-spacing: 0.1em;
}

.hero-reality-badge {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.48rem;
  letter-spacing: 0.12em;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.hero-card-name {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-card-role {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.68rem;
  color: #888888;
  letter-spacing: 0.05em;
}

.hero-card-counters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.counter-badge {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.42rem;
  letter-spacing: 0.1em;
  padding: 1px 4px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.hero-stat-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}

.stat-mini {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.44rem;
  color: #666666;
}

.stat-mini span {
  width: 22px;
}

.bar-fill {
  height: 3px;
  background: #ffffff;
  transition: width 300ms ease;
}

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

.footer-msg {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.95rem;
  color: #888888;
  letter-spacing: 0.05em;
}

/* ── Stage Interactive Screen (3D Viewport + HUD) ─────────────────────── */
.stage-interactive-screen {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000000;
}

.quantum-viewport {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.quantum-stage-hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 40px;
}

.hud-panel-top {
  pointer-events: all;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
  padding-bottom: 18px;
  max-width: 680px;
}

.stage-desc {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.95rem;
  color: #aaaaaa;
  margin-top: 6px;
  line-height: 1.4;
  letter-spacing: 0.04em;
}

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

.hud-info-card {
  background: rgba(10, 10, 14, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-width: 480px;
}

.info-label {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.48rem;
  letter-spacing: 0.25em;
  color: #888888;
}

.info-val {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.1em;
}

.info-sub {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.82rem;
  color: #aaaaaa;
  letter-spacing: 0.04em;
}

.hud-actions {
  display: flex;
  gap: 12px;
}

/* ── Phase Comparison Grid (Act 1F) ────────────────────────────────────── */
.phase-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
  margin: 16px 0;
}

.phase-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.phase-card.marked-highlight {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.15);
}

.pcard-label {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.52rem;
  letter-spacing: 0.25em;
  color: #888888;
}

.phase-indicator {
  font-size: 2.2rem;
  color: #ffffff;
  font-weight: 900;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
}

.pcard-stat {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.95rem;
  color: #aaaaaa;
  display: flex;
  justify-content: space-between;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 4px;
}

.pcard-stat strong {
  color: #ffffff;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.72rem;
}

/* ── Sandbox Panel (Act 1J, 1L) ────────────────────────────────────────── */
.stage-sandbox-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 36px 44px;
  background: radial-gradient(circle at center, rgba(20, 20, 25, 0.5) 0%, #000000 80%);
}

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

.sandbox-stats {
  display: flex;
  gap: 16px;
}

.sstat {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 12px;
}

.sandbox-desc {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 1.05rem;
  color: #aaaaaa;
  letter-spacing: 0.04em;
  margin: 14px 0;
  max-width: 720px;
}

.sandbox-curve-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: rgba(10, 10, 14, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 24px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.curve-bars {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 100%;
  width: 100%;
  min-height: 220px;
}

.curve-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
}

.bar-fill-track {
  flex: 1;
  width: 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: flex-end;
}

.bar-fill-level {
  width: 100%;
  background: #ffffff;
  transition: height 300ms ease;
}

.curve-bar-col.optimal .bar-fill-level {
  background: #ffffff;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.9);
}

.curve-bar-col.current .bar-fill-track {
  border-color: #ffffff;
  outline: 2px solid #ffffff;
}

.bar-t-label {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.48rem;
  color: #888888;
}

.sandbox-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 16px;
}

.step-counter {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.counter-num {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.15em;
}

.counter-prob {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.88rem;
  color: #aaaaaa;
}

.counter-warning {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.65rem;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.12em;
  opacity: 0;
  transition: opacity 200ms ease;
}

.counter-warning.active {
  opacity: 1;
}

.sandbox-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ── Query Complexity Screen (Act 1K) ─────────────────────────────────── */
.complexity-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
  margin: 18px 0;
}

.comp-col {
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.comp-col.quantum {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.15);
}

.comp-tag {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.52rem;
  letter-spacing: 0.25em;
  color: #888888;
}

.comp-big {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 2.4rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.1em;
}

.comp-desc {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.9rem;
  color: #aaaaaa;
}

.comp-stat {
  display: flex;
  justify-content: space-between;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 0;
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.88rem;
  color: #888888;
}

.comp-stat strong {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.68rem;
  color: #ffffff;
}

.comp-scientific-note {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.85rem;
  color: #888888;
  border-left: 2px solid #ffffff;
  padding-left: 12px;
  text-align: left;
  margin-top: 14px;
}

/* ── Multi Peaks Grid (Act 1L) ────────────────────────────────────────── */
.multi-peaks-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  width: 100%;
  margin: 18px 0;
}

.peak-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.peak-id {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.52rem;
  letter-spacing: 0.2em;
  color: #888888;
}

.peak-val {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

.peak-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  margin-top: 4px;
}

.peak-fill {
  height: 100%;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  transition: width 300ms ease;
}

/* ── Progressive Threshold Search Grid (Act 1O) ───────────────────────── */
.threshold-stages-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 18px;
  pointer-events: all;
}

.thresh-card {
  background: rgba(10, 10, 14, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 200ms ease;
}

.thresh-card.active {
  border-color: #ffffff;
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.2);
}

.tc-score {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 1.8rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.1em;
}

.tc-name {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  color: #ffffff;
}

.tc-count {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.88rem;
  color: #888888;
}

.tc-btn {
  margin-top: auto;
  width: 100%;
}

/* ── Measured Team HUD (Act 1I) ────────────────────────────────────────── */
.measured-team-hud {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 90%;
  max-width: 680px;
  pointer-events: all;
}

.result-banner {
  background: rgba(10, 10, 14, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.9);
  padding: 24px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

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

.r-status {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  color: #ffffff;
}

.r-title {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #ffffff;
}

.r-score {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.85rem;
  color: #cccccc;
}

.r-lesson {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.95rem;
  color: #888888;
  max-width: 520px;
}

/* ── Final Act 1 Manifestation HUD (Act 1P) ────────────────────────────── */
.final-act1-hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 36px;
  pointer-events: none;
}

.final-card {
  pointer-events: all;
  background: rgba(8, 8, 12, 0.92);
  border: 1px solid #ffffff;
  box-shadow: 0 0 45px rgba(255, 255, 255, 0.25), 0 0 60px rgba(0, 0, 0, 0.9);
  padding: 30px 40px;
  max-width: 820px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  clip-path: polygon(
    0 0,
    calc(100% - 20px) 0,
    100% 20px,
    100% 100%,
    20px 100%,
    0 calc(100% - 20px)
  );
}

.final-tag {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.52rem;
  letter-spacing: 0.35em;
  color: #888888;
  text-transform: uppercase;
}

.final-title {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #ffffff;
  text-transform: uppercase;
}

.final-team-roster {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  margin: 4px 0;
}

.fhero-slot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.fhero-pos {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.44rem;
  letter-spacing: 0.2em;
  color: #888888;
}

.fhero-name {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.76rem;
  font-weight: 700;
  color: #ffffff;
}

.fhero-reality {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.48rem;
  letter-spacing: 0.12em;
  color: #aaaaaa;
}

.final-stats-row {
  display: flex;
  justify-content: space-around;
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 0;
}

.fstat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fstat span {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.44rem;
  letter-spacing: 0.2em;
  color: #888888;
}

.fstat strong {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.88rem;
  color: #ffffff;
}

.final-narrative {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 1.15rem;
  color: #cccccc;
  line-height: 1.4;
}

.final-conclusion {
  color: #ffffff;
  font-weight: 700;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
  margin-top: 4px;
}

/* ── Act 2 Teaser Box (Act 1 Complete) ─────────────────────────────────── */
.act2-teaser-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.35);
  padding: 20px 24px;
  margin: 18px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.act2-label {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.52rem;
  letter-spacing: 0.3em;
  color: #888888;
}

.act2-title {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: #ffffff;
}

.act2-sub {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.55rem;
  letter-spacing: 0.25em;
  color: #aaaaaa;
}

.act2-desc {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.95rem;
  color: #888888;
  max-width: 540px;
}

/* ── Global Quantum Lens Drawer ────────────────────────────────────────── */
.quantum-lens-toggle {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 25;
  background: rgba(10, 10, 14, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 180ms ease;
  clip-path: polygon(4px 0%, 100% 0%, calc(100% - 4px) 100%, 0% 100%);
}

.quantum-lens-toggle:hover {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.quantum-lens-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 90vw;
  z-index: 20;
  background: rgba(6, 6, 8, 0.96);
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.9);
  padding: 68px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.quantum-lens-drawer.open {
  transform: translateX(0);
}

/* Persistent plain-language prompt for the guided and advanced search paths. */
.learning-guide {
  position: absolute;
  top: 14px;
  left: 28px;
  z-index: 24;
  width: min(470px, calc(100% - 250px));
  padding: 10px 14px 11px;
  color: #ffffff;
  background: rgba(5, 5, 7, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.learning-guide-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}

.learning-guide-count {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.46rem;
  letter-spacing: 0.2em;
  color: #c8c8c8;
  white-space: nowrap;
}

.learning-guide-progress {
  flex: 1;
  height: 3px;
  max-width: 96px;
  background: rgba(255, 255, 255, 0.16);
}

.learning-guide-progress span {
  display: block;
  height: 100%;
  background: #ffffff;
  transition: width 250ms ease;
}

.learning-guide-title {
  display: block;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  line-height: 1.35;
}

.learning-guide-action {
  margin-top: 3px;
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.78rem;
  line-height: 1.25;
  color: #c7c7c7;
}

/* Keep the guide clear of each page's own heading and footer controls. */
.quantum-stage-hud {
  padding-top: 126px;
}

.stage-roster-screen {
  padding-top: 118px;
}

.stage-sandbox-panel {
  padding-top: 118px;
}

.stage-dialogue-screen {
  padding-top: 104px;
}

.guided-complete-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.guided-complete-actions .stage-primary-btn,
.guided-complete-actions .stage-secondary-btn {
  justify-content: center;
}

.start-scan-btn:disabled {
  letter-spacing: 0.12em;
}

@media (max-width: 700px) {
  .learning-guide {
    top: 10px;
    left: 12px;
    width: calc(100% - 148px);
    padding: 8px 10px;
  }

  .learning-guide-title {
    font-size: 0.52rem;
  }

  .learning-guide-action {
    font-size: 0.7rem;
  }

  .quantum-stage-hud {
    padding: 112px 16px 18px;
  }

  .stage-roster-screen,
  .stage-sandbox-panel {
    padding: 108px 16px 20px;
  }

  .stage-dialogue-screen {
    padding: 100px 16px 18px;
    overflow-y: auto;
  }

  .hud-panel-bottom,
  .hud-actions,
  .stage-footer {
    flex-wrap: wrap;
  }

  .hud-actions {
    width: 100%;
  }

  .hud-actions > button {
    flex: 1 1 220px;
    justify-content: center;
  }
}

.lens-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 10px;
}

.lens-tag {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.46rem;
  letter-spacing: 0.3em;
  color: #888888;
  display: block;
}

.lens-title {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #ffffff;
}

.lens-stat-block {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 0;
}

.lstat-label {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.48rem;
  letter-spacing: 0.18em;
  color: #888888;
}

.lstat-val {
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffffff;
}

.lens-circuit-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.circuit-diagram {
  font-family: monospace;
  font-size: 0.65rem;
  color: #ffffff;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.4;
  background: rgba(0, 0, 0, 0.4);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lens-notes {
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.82rem;
  color: #aaaaaa;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.lens-notes strong {
  color: #ffffff;
}

/* ── Responsive Adjustments ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .threshold-stages-grid {
    grid-template-columns: 1fr 1fr;
  }
  .multi-peaks-grid {
    grid-template-columns: 1fr 1fr;
  }
  .stage-dialogue-screen {
    padding: 20px;
  }
  .dialogue-box {
    padding: 24px 20px;
  }
  .phase-comparison-grid {
    grid-template-columns: 1fr;
  }
  .complexity-comparison-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Search setup clarity (Act 1C) ─────────────────────────────────────── */
.roster-stage-header {
  align-items: flex-end;
  gap: 24px;
}

.roster-lede {
  margin-top: 6px;
  color: #b7b7b7;
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 1rem;
  letter-spacing: 0.03em;
}

.roster-stage-header .stage-metrics {
  gap: 8px;
}

.roster-stage-header .metric-card {
  min-width: 145px;
  padding: 8px 12px;
}

.search-brief {
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(0, 2fr);
  gap: 16px;
  margin: 2px 0 14px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(110deg, #111111, #080808 58%);
}

.search-rule,
.search-plan {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-rule {
  padding-right: 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
}

.brief-kicker {
  color: #999999;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.48rem;
  letter-spacing: 0.2em;
}

.search-rule > strong {
  color: #ffffff;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  line-height: 1.4;
}

.search-rule > span:last-child,
.plan-flow span {
  color: #b7b7b7;
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.86rem;
  line-height: 1.3;
}

.search-rule b,
.search-advantage b {
  color: #ffffff;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.74em;
  letter-spacing: 0.08em;
}

.plan-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.plan-flow > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 10px;
  border-left: 2px solid #777777;
}

.plan-flow > div b {
  color: #ffffff;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
}

.search-advantage {
  margin-top: 5px;
  color: #999999;
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.8rem;
  line-height: 1.25;
}

.roster-grid {
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 8px;
}

.roster-hero-card {
  min-height: 104px;
  padding: 9px 11px;
  gap: 4px;
  background: linear-gradient(145deg, #111111, #070707 72%);
}

.roster-hero-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(255, 255, 255, 0.08);
}

.hero-card-header {
  justify-content: flex-end;
}

.hero-card-name {
  font-size: 0.68rem;
}

.hero-card-counters {
  min-height: 14px;
}

.counter-badge {
  color: #e0e0e0;
  border-color: rgba(255, 255, 255, 0.2);
  font-size: 0.4rem;
}

.roster-grid .hero-stat-bars {
  display: none;
}

/* Grayscale state legend; it stays outside the main visualization. */
.state-visual-legend {
  position: absolute;
  z-index: 6;
  top: 138px;
  right: 40px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: min(250px, 25vw);
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(5, 5, 7, 0.84);
  color: #c5c5c5;
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.78rem;
  pointer-events: none;
}

.state-visual-legend .brief-kicker {
  margin-bottom: 2px;
}

.legend-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 7px 1px 0;
  border-radius: 50%;
  background: #858585;
}

.legend-dot-marked {
  background: #ffffff;
}

.legend-dot-large {
  width: 11px;
  height: 11px;
  background: #d8d8d8;
  vertical-align: -2px;
}

@media (max-width: 900px) {
  .roster-stage-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .search-brief {
    grid-template-columns: 1fr;
  }

  .search-rule {
    padding: 0 0 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  }

  .state-visual-legend {
    top: auto;
    right: 16px;
    bottom: 130px;
    width: 220px;
  }
}

@media (max-width: 600px) {
  .plan-flow {
    grid-template-columns: 1fr;
  }

  .roster-stage-header .stage-metrics {
    flex-wrap: wrap;
  }

  .roster-stage-header .metric-card {
    min-width: 125px;
  }

  .state-visual-legend {
    display: none;
  }
}

/* ── Post-scan campaign theme: a playable quantum mission ──────────────── */
.act1-stages-container {
  --game-ink: #07101f;
  --game-panel: rgba(10, 22, 40, 0.94);
  --game-panel-soft: rgba(15, 34, 57, 0.88);
  --game-line: rgba(104, 205, 255, 0.32);
  --game-cyan: #62dcff;
  --game-violet: #ae9bff;
  --game-gold: #ffca69;
  color: #edf7ff;
  background:
    radial-gradient(ellipse at 52% 38%, rgba(24, 72, 115, 0.28), transparent 56%),
    radial-gradient(ellipse at 90% 10%, rgba(93, 66, 152, 0.16), transparent 38%),
    #050a13;
}

.stage-primary-btn,
.stage-primary-btn:hover:not(:disabled) {
  color: #06101a;
  border-color: #8fe9ff;
  background: linear-gradient(135deg, #9aeeff, #55cfff 68%, #69a9ff);
  box-shadow: 0 0 24px rgba(73, 199, 255, 0.32), inset 0 1px rgba(255, 255, 255, 0.72);
}

.stage-primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(73, 199, 255, 0.42), inset 0 1px rgba(255, 255, 255, 0.85);
}

.stage-secondary-btn {
  color: #d9f6ff;
  border-color: rgba(98, 220, 255, 0.55);
  background: linear-gradient(135deg, rgba(22, 56, 88, 0.82), rgba(16, 27, 48, 0.92));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
}

.stage-secondary-btn:hover:not(:disabled) {
  color: #07101f;
  border-color: #9aeeff;
  background: #9aeeff;
  box-shadow: 0 0 18px rgba(73, 199, 255, 0.36);
}

.stage-dialogue-screen,
.stage-roster-screen,
.stage-sandbox-panel,
.stage-interactive-screen {
  background-color: transparent;
}

.stage-dialogue-screen {
  background: radial-gradient(ellipse at 50% 45%, rgba(28, 74, 115, 0.35), transparent 64%);
}

.dialogue-box,
.hud-info-card,
.search-brief,
.roster-hero-card,
.metric-card,
.phase-card,
.sandbox-stat-card,
.state-visual-legend {
  border-color: var(--game-line);
  background-color: var(--game-panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.36), inset 0 1px rgba(153, 225, 255, 0.055);
}

.dialogue-box {
  background: linear-gradient(145deg, rgba(13, 29, 49, 0.97), rgba(7, 13, 25, 0.97));
}

.stage-tag,
.dialogue-tag,
.info-label,
.m-label,
.brief-kicker,
.learning-guide-count {
  color: var(--game-cyan);
}

.stage-title,
.dialogue-speaker,
.dialogue-lines .dramatic,
.dialogue-lines .conclusion {
  color: #f2f8ff;
  text-shadow: 0 0 22px rgba(91, 201, 255, 0.22);
}

.d-line,
.stage-desc,
.info-sub,
.footer-msg,
.roster-lede {
  color: #b5c7dc;
}

.metric-card .m-val,
.info-val {
  color: #ffffff;
}

.roster-stage-header,
.stage-footer {
  border-color: var(--game-line);
}

.roster-hero-card {
  background: linear-gradient(145deg, rgba(16, 36, 58, 0.97), rgba(7, 16, 30, 0.96) 72%);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.roster-hero-card:hover {
  border-color: var(--game-cyan);
  box-shadow: 0 10px 24px rgba(30, 158, 226, 0.18), inset 0 1px rgba(255, 255, 255, 0.08);
}

.hero-reality-badge {
  color: #c6d8ee;
  border-color: rgba(98, 220, 255, 0.24);
  background: rgba(57, 143, 190, 0.12);
}

.counter-badge {
  color: #d6efff;
  border-color: rgba(98, 220, 255, 0.4);
  background: rgba(63, 179, 225, 0.1);
}

.plan-flow > div {
  border-color: var(--game-cyan);
}

.plan-flow > div:nth-child(2) {
  border-color: var(--game-violet);
}

.plan-flow > div:nth-child(3) {
  border-color: var(--game-gold);
}

.learning-guide {
  border-color: rgba(98, 220, 255, 0.42);
  background: linear-gradient(135deg, rgba(10, 26, 44, 0.96), rgba(11, 16, 31, 0.95));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), 0 0 20px rgba(53, 166, 221, 0.12);
}

.learning-guide-progress {
  background: rgba(98, 220, 255, 0.16);
}

.learning-guide-progress span {
  background: linear-gradient(90deg, var(--game-cyan), var(--game-violet));
  box-shadow: 0 0 10px rgba(98, 220, 255, 0.68);
}

.search-brief {
  background: linear-gradient(110deg, rgba(18, 42, 67, 0.92), rgba(10, 20, 37, 0.96) 58%);
}

.search-rule b,
.search-advantage b,
.plan-flow > div:nth-child(3) b {
  color: var(--game-gold);
}

.hud-panel-top {
  background: linear-gradient(180deg, rgba(5, 12, 23, 0.94), rgba(5, 12, 23, 0.6) 72%, transparent 100%);
}

.hud-panel-bottom {
  background: linear-gradient(0deg, rgba(5, 12, 23, 0.96), rgba(5, 12, 23, 0.72) 64%, transparent 100%);
}

.phase-card {
  background: linear-gradient(145deg, rgba(16, 35, 57, 0.94), rgba(9, 19, 34, 0.96));
}

.phase-card.marked-highlight {
  border-color: var(--game-gold);
  background: linear-gradient(145deg, rgba(83, 57, 27, 0.35), rgba(11, 20, 34, 0.96));
  box-shadow: 0 0 26px rgba(255, 190, 87, 0.16);
}

.phase-indicator,
.pcard-stat strong {
  color: var(--game-cyan);
  text-shadow: 0 0 16px rgba(98, 220, 255, 0.24);
}

.phase-card.marked-highlight .phase-indicator,
.phase-card.marked-highlight .pcard-stat strong {
  color: var(--game-gold);
  text-shadow: 0 0 16px rgba(255, 190, 87, 0.24);
}

.state-visual-legend {
  background: rgba(7, 17, 31, 0.92);
  color: #c9d9ec;
}

.legend-dot-dim {
  background: var(--game-cyan);
}

.legend-dot-marked {
  background: var(--game-gold);
  box-shadow: 0 0 8px rgba(255, 202, 105, 0.72);
}

.legend-dot-large {
  background: #b7aaff;
}

@media (prefers-reduced-motion: no-preference) {
  .stage-primary-btn:not(:disabled) {
    animation: mission-button-pulse 3.2s ease-in-out infinite;
  }

  @keyframes mission-button-pulse {
    0%, 100% { box-shadow: 0 0 18px rgba(73, 199, 255, 0.24), inset 0 1px rgba(255, 255, 255, 0.72); }
    50% { box-shadow: 0 0 28px rgba(73, 199, 255, 0.38), inset 0 1px rgba(255, 255, 255, 0.85); }
  }
}

/* ── Light campaign HUD: desktop roster and mission screens ───────────── */
.act1-stages-container {
  --game-ink: #172033;
  --game-panel: #ffffff;
  --game-panel-soft: #f5f6fb;
  --game-line: #dce1ec;
  --game-cyan: #187f87;
  --game-violet: #6947e8;
  --game-gold: #c77b0a;
  color: var(--game-ink);
  background:
    radial-gradient(ellipse at 15% 10%, rgba(143, 116, 255, 0.1), transparent 34%),
    radial-gradient(ellipse at 92% 14%, rgba(58, 188, 194, 0.1), transparent 32%),
    #f3f5f9;
}

.stage-primary-btn,
.stage-primary-btn:hover:not(:disabled) {
  color: #ffffff;
  border: 1px solid #6947e8;
  background: linear-gradient(135deg, #805fff, #6040db);
  box-shadow: 0 8px 20px rgba(94, 63, 213, 0.25), inset 0 1px rgba(255, 255, 255, 0.3);
}

.stage-primary-btn {
  border-radius: 12px;
  letter-spacing: 0.12em;
}

.stage-primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(94, 63, 213, 0.34), inset 0 1px rgba(255, 255, 255, 0.38);
}

.stage-secondary-btn {
  color: #4c3c99;
  border: 1px solid #c9c0f5;
  border-radius: 12px;
  background: #ffffff;
}

.stage-secondary-btn:hover:not(:disabled) {
  color: #5135cd;
  border-color: #8063ef;
  background: #f1edff;
  box-shadow: 0 6px 16px rgba(94, 63, 213, 0.12);
}

.stage-tag,
.dialogue-tag,
.brief-kicker,
.info-label,
.m-label,
.learning-guide-count {
  color: #6947e8;
}

.stage-title,
.dialogue-speaker,
.dialogue-lines .dramatic,
.dialogue-lines .conclusion,
.hero-card-name,
.info-val,
.metric-card .m-val {
  color: var(--game-ink);
  text-shadow: none;
}

.stage-desc,
.d-line,
.info-sub,
.footer-msg,
.roster-lede,
.banner-sub {
  color: #596579;
}

.stage-dialogue-screen {
  background: radial-gradient(ellipse at 50% 44%, rgba(141, 122, 230, 0.12), transparent 62%);
}

.dialogue-box,
.hud-info-card,
.metric-card,
.phase-card,
.state-visual-legend,
.learning-guide,
.quantum-lens-drawer {
  color: var(--game-ink);
  border-color: var(--game-line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(27, 37, 61, 0.1), inset 0 1px #ffffff;
}

.dialogue-box {
  background: linear-gradient(145deg, #ffffff, #f7f6ff);
}

.stage-roster-screen {
  min-height: 0;
  padding: 118px 34px 20px;
  background: transparent;
}

.roster-stage-header {
  flex: 0 0 auto;
  align-items: flex-end;
  margin-bottom: 18px;
  border-color: var(--game-line);
}

.roster-stage-header .stage-metrics {
  gap: 10px;
}

.roster-stage-header .metric-card {
  min-width: 160px;
  border-radius: 12px;
  background: #ffffff;
}

.roster-main-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 2.28fr);
  flex: 1 1 0;
  min-height: 0;
  gap: 20px;
}

.search-brief {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  margin: 0;
  padding: 20px;
  overflow-y: auto;
  border: 1px solid var(--game-line);
  border-radius: 18px;
  background: linear-gradient(160deg, #ffffff, #f6f5ff);
  box-shadow: 0 10px 28px rgba(27, 37, 61, 0.07);
}

.search-rule {
  gap: 9px;
  padding: 0 0 16px;
  border: 0;
  border-bottom: 1px solid var(--game-line);
}

.search-rule > strong {
  color: var(--game-ink);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}

.search-rule > span:last-child,
.plan-flow span {
  color: #58647a;
  font-size: 0.94rem;
  line-height: 1.42;
}

.plan-flow {
  grid-template-columns: 1fr;
  gap: 12px;
}

.plan-flow > div,
.plan-flow > div:nth-child(2),
.plan-flow > div:nth-child(3) {
  padding: 3px 0 3px 12px;
  border-color: #a997f4;
}

.plan-flow > div:nth-child(2) {
  border-color: #36a9ad;
}

.plan-flow > div:nth-child(3) {
  border-color: #efb448;
}

.plan-flow > div b {
  color: var(--game-ink);
  font-size: 0.64rem;
}

.search-rule b,
.search-advantage b,
.plan-flow > div:nth-child(3) b {
  color: #a76300;
}

.search-advantage {
  color: #68738a;
  font-size: 0.86rem;
  line-height: 1.4;
}

.roster-grid-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 14px 16px 10px;
  border: 1px solid var(--game-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 28px rgba(27, 37, 61, 0.07);
}

.roster-grid-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: 0 2px 12px;
  border-bottom: 1px solid var(--game-line);
}

.roster-grid-heading > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.roster-grid-heading strong {
  color: var(--game-ink);
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.65rem;
  letter-spacing: 0.07em;
}

.roster-pool-note {
  color: #68738a;
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.88rem;
}

.roster-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  align-content: start;
  flex: 1 1 0;
  min-height: 0;
  gap: 10px;
  margin: 10px 0 0;
  padding: 3px 8px 8px 3px;
  overflow: auto;
}

.roster-hero-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 104px;
  padding: 12px;
  border: 1px solid #e1e5ee;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(27, 37, 61, 0.055);
}

.roster-hero-card:hover {
  transform: translateY(-2px);
  border-color: #a997f4;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(98, 73, 220, 0.14);
}

.hero-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid #c9c0f5;
  border-radius: 14px;
  color: #5a42c9;
  background: linear-gradient(145deg, #eeeaff, #dff7f5);
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: inset 0 1px #ffffff;
}

.hero-card-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.hero-card-header {
  justify-content: flex-start;
}

.hero-reality-badge {
  border: 0;
  padding: 0;
  color: #7a8498;
  background: transparent;
  font-size: 0.43rem;
}

.hero-card-name {
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}

.hero-card-role {
  color: #667287;
  font-size: 0.73rem;
}

.hero-card-counters {
  min-height: 15px;
  gap: 4px;
  margin-top: 3px;
}

.counter-badge {
  padding: 2px 5px;
  border: 0;
  border-radius: 999px;
  color: #5944b3;
  background: #eeeaff;
  font-size: 0.4rem;
  letter-spacing: 0.06em;
}

.counter-tech {
  color: #087780;
  background: #e0f6f5;
}

.counter-dimensional {
  color: #a36500;
  background: #fff1d5;
}

.stage-footer {
  flex: 0 0 auto;
  margin-top: 14px;
  padding-top: 12px;
  border-color: var(--game-line);
}

.state-visual-legend {
  color: #343e52;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
}

.learning-guide {
  border-color: #dfd9ff;
  border-radius: 14px;
  color: var(--game-ink);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 8px 24px rgba(34, 35, 63, 0.12);
}

.learning-guide-title {
  color: var(--game-ink);
}

.learning-guide-action {
  color: #596579;
}

.learning-guide-progress {
  background: #e8e5f5;
}

.learning-guide-progress span {
  background: linear-gradient(90deg, #6947e8, #27a5a4);
  box-shadow: none;
}

.quantum-lens-toggle {
  border: 1px solid #d8d3ed;
  border-radius: 10px;
  color: #493995;
  background: #ffffff;
  box-shadow: 0 5px 16px rgba(27, 37, 61, 0.1);
}

.quantum-lens-toggle:hover {
  color: #ffffff;
  background: #6947e8;
  box-shadow: 0 7px 18px rgba(94, 63, 213, 0.24);
}

.quantum-lens-drawer {
  border-left: 1px solid var(--game-line);
}

.phase-card {
  background: linear-gradient(145deg, #ffffff, #f4f1ff);
}

.phase-card.marked-highlight {
  border-color: #f1bb61;
  background: linear-gradient(145deg, #fff8e9, #ffffff);
  box-shadow: 0 8px 22px rgba(188, 127, 25, 0.12);
}

.phase-indicator,
.pcard-stat strong {
  color: #4f39bb;
  text-shadow: none;
}

.phase-card.marked-highlight .phase-indicator,
.phase-card.marked-highlight .pcard-stat strong {
  color: #a76300;
  text-shadow: none;
}

.stage-interactive-screen {
  background: #f3f5f9;
}

.quantum-viewport {
  inset: 126px 32px 118px 34%;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(122, 128, 160, 0.36);
  border-radius: 24px;
  background: radial-gradient(ellipse at 50% 42%, #142744, #081120 75%);
  box-shadow: 0 20px 48px rgba(27, 37, 61, 0.2), inset 0 1px rgba(255, 255, 255, 0.1);
}

.quantum-viewport::before,
.quantum-viewport::after {
  position: absolute;
  z-index: -1;
  content: '';
  inset: 0;
  pointer-events: none;
}

.quantum-viewport::before {
  opacity: 0.45;
  background-image:
    radial-gradient(rgba(142, 187, 255, 0.6) 0.7px, transparent 1px),
    linear-gradient(rgba(96, 123, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 123, 184, 0.08) 1px, transparent 1px);
  background-size: 53px 53px, 48px 48px, 48px 48px;
}

.quantum-viewport::after {
  inset: 12px;
  border: 1px solid rgba(149, 163, 206, 0.15);
  border-radius: 17px;
  clip-path: polygon(0 0, 16% 0, 16% 1px, 84% 1px, 84% 0, 100% 0, 100% 18%, calc(100% - 1px) 18%, calc(100% - 1px) 82%, 100% 82%, 100% 100%, 84% 100%, 84% calc(100% - 1px), 16% calc(100% - 1px), 16% 100%, 0 100%, 0 82%, 1px 82%, 1px 18%, 0 18%);
}

.quantum-lattice-canvas {
  display: block;
  border-radius: inherit;
}

.quantum-stage-hud {
  padding: 126px 32px 20px;
}

.hud-panel-top {
  width: min(31vw, 500px);
  max-width: 500px;
  padding: 18px 20px;
  border: 1px solid var(--game-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 10px 28px rgba(27, 37, 61, 0.1);
}

.hud-panel-top .stage-desc {
  color: #596579;
}

.hud-panel-bottom {
  align-items: center;
  padding: 0;
  background: transparent;
}

.hud-info-card {
  max-width: 520px;
}

.state-visual-legend {
  top: 142px;
  right: 48px;
  width: 235px;
}

@media (max-width: 1150px) {
  .roster-main-layout {
    grid-template-columns: minmax(245px, 0.82fr) minmax(0, 1.8fr);
    gap: 14px;
  }

  .roster-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }

  .quantum-viewport {
    left: 39%;
  }

  .hud-panel-top {
    width: 36vw;
  }
}

@media (max-width: 850px) {
  .roster-main-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .search-brief {
    max-height: 250px;
  }

  .plan-flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quantum-viewport {
    inset: 250px 16px 170px;
  }

  .hud-panel-top {
    width: min(100%, 620px);
  }

  .state-visual-legend {
    display: none;
  }
}

/* ── Full-height roster board, Thor spotlight, and legible state particles ─ */
.stage-roster-screen {
  position: relative;
  isolation: isolate;
  background-color: #f3f5f9;
  background-image:
    radial-gradient(circle, rgba(105, 71, 232, 0.11) 1px, transparent 1.4px),
    radial-gradient(ellipse at 18% 70%, rgba(68, 190, 180, 0.09), transparent 36%),
    radial-gradient(ellipse at 90% 5%, rgba(160, 143, 255, 0.12), transparent 36%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(241, 243, 249, 0.92));
  background-size: 22px 22px, auto, auto, auto;
}

.roster-main-layout {
  grid-template-columns: minmax(218px, 0.68fr) minmax(286px, 0.92fr) minmax(0, 2.65fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
}

.thor-preview-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #d8ddec;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(27, 37, 61, 0.1);
}

.thor-preview-art {
  position: relative;
  flex: 1 1 0;
  min-height: 250px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 50% 34%, rgba(116, 93, 212, 0.68), transparent 35%),
    radial-gradient(ellipse at 52% 98%, rgba(37, 164, 166, 0.48), transparent 40%),
    linear-gradient(160deg, #151b30, #080d18 72%);
}

.thor-preview-art::before,
.thor-preview-art::after {
  position: absolute;
  z-index: 1;
  content: '';
  pointer-events: none;
}

.thor-preview-art::before {
  inset: 0;
  opacity: 0.4;
  background-image: radial-gradient(rgba(232, 225, 255, 0.88) 0.7px, transparent 1px);
  background-size: 31px 31px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
}

.thor-preview-art::after {
  right: -24%;
  bottom: -26%;
  left: -24%;
  height: 48%;
  border: 1px solid rgba(152, 139, 255, 0.52);
  border-radius: 50%;
  box-shadow: 0 0 0 16px rgba(152, 139, 255, 0.08), 0 0 0 34px rgba(74, 208, 201, 0.07);
}

.thor-preview-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 24%;
  opacity: 0.74;
  transition: opacity 260ms ease;
}

.thor-preview-art[data-model-state="ready"] .thor-preview-fallback {
  opacity: 0;
}

.thor-preview-canvas-host {
  position: absolute;
  z-index: 2;
  inset: 28px 0 20px;
}

.thor-preview-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.thor-model-badge,
.thor-preview-reality {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #f1efff;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.43rem;
  letter-spacing: 0.12em;
}

.thor-model-badge {
  top: 15px;
  left: 15px;
  padding: 7px 9px;
  border: 1px solid rgba(222, 216, 255, 0.2);
  border-radius: 999px;
  background: rgba(9, 14, 27, 0.72);
}

.thor-model-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #72e1b2;
  box-shadow: 0 0 8px rgba(114, 225, 178, 0.8);
}

.thor-preview-reality {
  right: 14px;
  bottom: 14px;
  left: 14px;
  justify-content: space-between;
  color: #ddd7ff;
  text-shadow: 0 1px 5px #080d18;
}

.thor-preview-reality b {
  color: #f6bf64;
}

.thor-preview-caption {
  flex: 0 0 auto;
  padding: 15px 16px 17px;
  background: linear-gradient(180deg, #ffffff, #faf9ff);
}

.thor-preview-caption > strong {
  display: block;
  margin-top: 4px;
  color: #172033;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

.thor-preview-caption p {
  margin-top: 6px;
  color: #626d81;
  font-family: var(--font-cinematic, 'Rajdhani', sans-serif);
  font-size: 0.88rem;
  line-height: 1.35;
}

.thor-loadout-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.thor-loadout-chips span {
  padding: 4px 7px;
  border-radius: 999px;
  color: #5944b3;
  background: #eeeaff;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.39rem;
  letter-spacing: 0.05em;
}

.search-brief,
.roster-grid-wrap {
  min-height: 0;
  overflow: auto;
}

.roster-grid-wrap {
  overflow: hidden;
}

.roster-grid {
  grid-auto-rows: minmax(94px, 1fr);
  grid-template-columns: repeat(auto-fill, minmax(174px, 1fr));
}

.roster-hero-card {
  min-height: 94px;
}

@media (max-width: 1150px) {
  .roster-main-layout {
    grid-template-columns: minmax(190px, 0.62fr) minmax(240px, 0.82fr) minmax(0, 2fr);
    gap: 12px;
  }

  .roster-grid {
    grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  }
}

@media (max-width: 850px) {
  .roster-main-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 270px auto minmax(360px, 1fr);
  }

  .thor-preview-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.72fr);
  }

  .thor-preview-art {
    min-height: 0;
  }

  .search-brief {
    max-height: 260px;
  }

  .search-plan {
    gap: 10px;
  }
}

/* Thor dialogue: keep the character in the scene, clear of the dialogue card. */
.stage-dialogue-screen.thor-dialogue-screen {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr);
  align-items: center;
  justify-content: stretch;
  gap: clamp(18px, 3.2vw, 62px);
  min-height: 0;
  padding: 126px clamp(28px, 4.2vw, 80px) 34px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 76% 52%, rgba(105, 71, 232, 0.18), transparent 34%),
    radial-gradient(ellipse at 79% 72%, rgba(44, 171, 167, 0.11), transparent 34%),
    radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.92), rgba(243, 245, 249, 0.97));
}

.thor-dialogue-screen .dialogue-box {
  position: relative;
  z-index: 2;
  grid-column: 1;
  width: 100%;
  max-width: 760px;
  max-height: calc(100vh - 172px);
  margin: 0;
  padding: clamp(24px, 2.8vw, 44px);
  align-items: flex-start;
  overflow-y: auto;
  text-align: left;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.97), rgba(248, 247, 255, 0.94));
}

.thor-dialogue-screen .dialogue-lines {
  align-items: flex-start;
  text-align: left;
}

.thor-screen-model {
  position: relative;
  z-index: 1;
  grid-column: 2;
  display: grid;
  align-self: stretch;
  min-width: 0;
  min-height: min(620px, calc(100vh - 172px));
  place-items: center;
  overflow: visible;
  pointer-events: none;
  isolation: isolate;
}

.thor-screen-model::before,
.thor-screen-model::after {
  position: absolute;
  content: '';
  pointer-events: none;
}

.thor-screen-model::before {
  z-index: -1;
  inset: 7% 4% 10%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(130, 107, 230, 0.28), rgba(44, 171, 167, 0.08) 36%, transparent 70%);
  filter: blur(22px);
}

.thor-screen-model::after {
  z-index: 0;
  bottom: 7%;
  left: 14%;
  width: 72%;
  height: 16%;
  border: 1px solid rgba(126, 103, 220, 0.75);
  border-radius: 50%;
  box-shadow: 0 0 26px rgba(126, 103, 220, 0.22), inset 0 0 20px rgba(48, 169, 165, 0.12);
  transform: perspective(320px) rotateX(68deg);
}

.thor-screen-model-canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.thor-model-loader {
  position: absolute;
  z-index: 2;
  bottom: 15%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border: 1px solid rgba(117, 101, 192, 0.2);
  border-radius: 999px;
  color: #655a97;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 24px rgba(40, 37, 76, 0.08);
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.47rem;
  letter-spacing: 0.12em;
  white-space: nowrap;
  transform: translateX(-50%);
  transition: opacity 260ms ease;
}

.thor-model-loader i,
.final-model-status i {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #8666ee;
  box-shadow: 0 0 12px rgba(134, 102, 238, 0.72);
}

.thor-screen-model[data-model-state="ready"] .thor-model-loader {
  opacity: 0;
}

.thor-model-caption {
  position: absolute;
  z-index: 2;
  right: 2%;
  bottom: 2%;
  color: #656e83;
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.48rem;
  letter-spacing: 0.16em;
}

.thor-model-caption b {
  margin: 0 8px;
  color: #be850e;
}

@media (max-width: 900px) {
  .stage-dialogue-screen.thor-dialogue-screen {
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    gap: 14px;
    padding-right: 20px;
    padding-left: 20px;
  }

  .thor-dialogue-screen .dialogue-box {
    padding: 24px;
  }
}

@media (max-width: 700px) {
  .stage-dialogue-screen.thor-dialogue-screen {
    display: flex;
    padding-top: 116px;
  }

  .thor-screen-model {
    position: absolute;
    top: 14%;
    right: -26%;
    bottom: 0;
    width: 85%;
    min-height: 0;
    opacity: 0.36;
  }

  .thor-dialogue-screen .dialogue-box {
    width: 100%;
    max-width: 680px;
    margin: auto;
    background: rgba(255, 255, 255, 0.92);
  }
}

/* Victory view: full-screen 3D stage with a compact, non-blocking squad card. */
.stage-interactive-screen.final-team-manifestation .quantum-viewport {
  inset: 126px 32px 118px 34%;
  overflow: hidden;
  border: 1px solid rgba(122, 128, 160, 0.36);
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 60% 40%, rgba(78, 60, 137, 0.36), transparent 42%),
    linear-gradient(150deg, #141624, #080a11 72%);
  box-shadow: 0 20px 48px rgba(27, 37, 61, 0.2), inset 0 1px rgba(255, 255, 255, 0.1);
}

.stage-interactive-screen.final-team-manifestation .quantum-stage-hud {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
  padding: 126px 32px 20px;
}

.final-team-manifestation .hud-panel-top {
  width: min(31vw, 560px);
  max-width: 560px;
  margin: 0;
}

.final-team-manifestation .universe-3d-canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.final-team-manifestation .final-act1-hud {
  position: relative;
  inset: auto;
  z-index: auto;
  display: block;
  flex: 0 0 auto;
  width: min(31vw, 560px);
  padding: 0;
  pointer-events: auto;
}

.final-team-manifestation .final-card {
  width: 100%;
  max-width: 560px;
  max-height: min(460px, calc(100vh - 430px));
  gap: 9px;
  align-items: stretch;
  overflow-y: auto;
  padding: 15px 18px 16px;
  border: 1px solid rgba(226, 223, 255, 0.36);
  border-left: 3px solid #8b70f0;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(12, 14, 23, 0.9), rgba(14, 15, 23, 0.72));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: left;
  clip-path: none;
}

.final-team-manifestation .final-tag {
  color: #c2b5ff;
  font-size: 0.45rem;
  letter-spacing: 0.2em;
}

.final-team-manifestation .final-title {
  font-size: clamp(1.12rem, 1.45vw, 1.5rem);
  line-height: 1.18;
  letter-spacing: 0.09em;
}

.final-model-status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(180, 169, 237, 0.2);
  border-radius: 999px;
  color: #d5d1e9;
  background: rgba(255, 255, 255, 0.055);
  font-family: var(--font-display, 'Orbitron', monospace);
  font-size: 0.43rem;
  letter-spacing: 0.1em;
}

.final-model-status i {
  width: 7px;
  height: 7px;
  flex-basis: 7px;
  background: #8b70f0;
}

.final-team-manifestation .final-team-roster {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.final-team-manifestation .fhero-slot {
  display: flex;
  min-width: 0;
  gap: 4px;
  padding: 8px 7px;
  border-color: rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
}

.final-team-manifestation .fhero-pos {
  color: #aaa3c9;
  font-size: 0.34rem;
  letter-spacing: 0.08em;
  line-height: 1.35;
}

.final-team-manifestation .fhero-name {
  font-size: 0.54rem;
  overflow-wrap: anywhere;
}

.final-team-manifestation .fhero-reality {
  font-size: 0.37rem;
}

.final-team-manifestation .final-stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 2px;
  border-color: rgba(255, 255, 255, 0.14);
}

.final-team-manifestation .fstat span {
  color: #aaa3c9;
  font-size: 0.31rem;
  letter-spacing: 0.08em;
  line-height: 1.35;
}

.final-team-manifestation .fstat strong {
  font-size: 0.64rem;
}

.final-team-manifestation .final-narrative {
  color: #d4d3dc;
  font-size: 0.82rem;
  line-height: 1.3;
  margin: 0;
}

.final-team-manifestation .final-narrative p:not(.final-conclusion) {
  display: none;
}

.final-team-manifestation .final-conclusion {
  color: #ffffff;
  text-shadow: 0 0 16px rgba(165, 144, 255, 0.45);
}

.final-team-manifestation #btn-finish-act1 {
  align-self: flex-start;
  margin-top: 1px;
  padding: 10px 15px;
  font-size: 0.58rem;
}

@media (max-width: 900px) {
  .stage-interactive-screen.final-team-manifestation .quantum-viewport {
    left: 40%;
  }

  .final-team-manifestation .final-act1-hud,
  .final-team-manifestation .hud-panel-top {
    width: min(36vw, 500px);
  }

  .final-team-manifestation .hud-panel-top {
    max-width: 500px;
  }

  .final-team-manifestation .final-card {
    max-width: 500px;
  }
}

@media (max-width: 700px) {
  .stage-interactive-screen.final-team-manifestation .quantum-viewport {
    inset: 250px 16px 170px;
  }

  .stage-interactive-screen.final-team-manifestation .quantum-stage-hud {
    padding: 126px 16px 20px;
  }

  .final-team-manifestation .final-act1-hud,
  .final-team-manifestation .hud-panel-top {
    width: 100%;
  }

  .final-team-manifestation .final-act1-hud {
    padding: 0;
  }

  .final-team-manifestation .final-card {
    width: 100%;
    max-width: none;
    max-height: min(460px, 55vh);
    padding: 13px;
  }

  .final-team-manifestation .final-team-roster {
    grid-template-columns: 1fr;
  }

  .final-team-manifestation .final-stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Roster character stage stays transparent so the model sits on the white page. */
.roster-character-stage {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.roster-character-model {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: transparent;
}

.roster-character-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.roster-hero-card {
  appearance: none;
  width: 100%;
  color: var(--game-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.roster-hero-card[aria-pressed="true"] {
  border-color: #7a5ce1;
  box-shadow: 0 0 0 2px rgba(122, 92, 225, 0.16), 0 9px 20px rgba(98, 73, 220, 0.12);
}

.roster-hero-card:focus-visible {
  outline: 3px solid rgba(105, 71, 232, 0.55);
  outline-offset: 2px;
}

@media (min-width: 1500px) {
  .roster-main-layout {
    grid-template-columns: minmax(218px, 0.58fr) minmax(260px, 0.75fr) minmax(0, 2.9fr);
  }

  .roster-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 850px) {
  .roster-character-stage {
    min-height: 270px;
  }
}

/* Keep the realization dialogue and its continue action in the first viewport. */
.stage-dialogue-screen.thor-dialogue-screen {
  align-items: start;
}

.thor-dialogue-screen .dialogue-box {
  position: absolute;
  top: 134px;
  left: clamp(20px, 4.2vw, 80px);
  width: min(45vw, 760px);
  align-self: start;
  max-height: calc(100vh - 156px);
  margin: 0;
}

.thor-dialogue-screen .dialogue-box > .stage-primary-btn {
  position: sticky;
  bottom: 0;
  align-self: flex-start;
}

@media (max-width: 700px) {
  .thor-dialogue-screen .dialogue-box {
    position: relative;
    inset: auto;
    width: 100%;
    margin: auto;
  }
}
