:root {
  --bg-obsidian: #07070c;
  --bg-panel: #10111a;
  --bg-panel-elevated: #161826;
  --crimson: #ff2e4c;
  --crimson-soft: rgba(255, 46, 76, 0.16);
  --gold: #f5b942;
  --uv-violet: #b845ff;
  --uv-magenta: #ff2a9d;
  --uv-cyan: #00f0ff;
  --text-main: #f3f4f8;
  --text-muted: #9ca0b8;
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-guardian: rgba(255, 46, 76, 0.35);
  --border-uv: rgba(184, 69, 255, 0.55);
  --lens-x: 50vw;
  --lens-y: 40vh;
  --lens-r: 175px;
  --font-display: "Cinzel", "Playfair Display", Georgia, serif;
  --font-sans: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--bg-obsidian);
  color: var(--text-main);
  font-family: var(--font-sans);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 46, 76, 0.12), transparent 42%),
    radial-gradient(circle at 82% 24%, rgba(184, 69, 255, 0.13), transparent 46%),
    linear-gradient(180deg, #06060b 0%, #0b0c16 55%, #07070d 100%);
  overflow-x: hidden;
  transition: background 0.5s ease;
}

body.chrysalis-mode {
  background:
    radial-gradient(circle at 20% 15%, rgba(184, 69, 255, 0.22), transparent 45%),
    radial-gradient(circle at 80% 30%, rgba(0, 240, 255, 0.12), transparent 50%),
    linear-gradient(180deg, #090412 0%, #110822 55%, #06030d 100%);
}

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 2;
}

/* Top Tactical HUD */
.tactical-hud {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding: 0.75rem 1.5rem;
  background: rgba(8, 9, 16, 0.84);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.hud-sigil {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(255, 46, 76, 0.28), rgba(184, 69, 255, 0.28));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 18px rgba(255, 46, 76, 0.35);
}

body.chrysalis-mode .hud-sigil {
  box-shadow: 0 0 22px rgba(184, 69, 255, 0.65);
  border-color: var(--uv-violet);
}

.hud-title-group {
  display: flex;
  flex-direction: column;
}

.hud-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--crimson);
}

body.chrysalis-mode .hud-eyebrow {
  color: var(--uv-cyan);
}

.hud-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 0;
}

.hud-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.hud-pill:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.09);
}

.hud-pill[aria-pressed="true"] {
  background: rgba(184, 69, 255, 0.22);
  border-color: var(--uv-violet);
  box-shadow: 0 0 16px rgba(184, 69, 255, 0.35);
}

.hud-pill.reality-switch[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(184, 69, 255, 0.35), rgba(255, 42, 157, 0.3));
  border-color: var(--uv-cyan);
}

.lens-slider-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.11);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.lens-slider-wrap input[type="range"] {
  width: 78px;
  accent-color: var(--uv-violet);
  cursor: pointer;
}

.anomaly-counter-btn {
  border-color: rgba(245, 185, 66, 0.45);
  color: var(--gold);
}

/* Main Layout Container */
.archive-main {
  position: relative;
  z-index: 5;
  max-width: 1340px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 5rem;
}

/* Dual-Reality Hero Section */
.hero-stage {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--border-guardian);
  background: linear-gradient(145deg, rgba(22, 18, 30, 0.92), rgba(11, 11, 20, 0.96));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  margin-bottom: 2.5rem;
}

body.chrysalis-mode .hero-stage {
  border-color: var(--border-uv);
  box-shadow: 0 24px 70px rgba(135, 35, 255, 0.22);
}

.hero-layer {
  padding: 3rem 2.75rem;
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 2rem;
  align-items: center;
}

.hero-uv-layer {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 75% 35%, rgba(184, 69, 255, 0.28), transparent 55%),
    linear-gradient(135deg, #150726 0%, #0b0418 60%, #190624 100%);
  border: 1px solid var(--uv-violet);
  clip-path: circle(var(--local-r, 0px) at var(--local-x, -999px) var(--local-y, -999px));
  pointer-events: none;
  transition: clip-path 0.04s linear;
}

body.chrysalis-mode .hero-uv-layer {
  clip-path: circle(150% at 50% 50%) !important;
  pointer-events: auto;
}

.eyebrow-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.32rem 0.75rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(255, 46, 76, 0.16);
  color: #ff6b81;
  border: 1px solid rgba(255, 46, 76, 0.35);
  margin-bottom: 1rem;
}

.eyebrow-badge.uv-badge {
  background: rgba(184, 69, 255, 0.2);
  color: #e29eff;
  border-color: rgba(0, 240, 255, 0.45);
}

.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.6vw, 3.25rem);
  line-height: 1.1;
  margin: 0 0 1rem;
  letter-spacing: 0.02em;
}

.hero-headline .accent-crimson {
  color: var(--crimson);
  text-shadow: 0 0 24px rgba(255, 46, 76, 0.4);
}

.hero-headline .accent-uv {
  color: var(--uv-cyan);
  text-shadow: 0 0 24px rgba(184, 69, 255, 0.75);
}

.hero-lead {
  font-size: 1.04rem;
  line-height: 1.65;
  color: #ced2e6;
  margin: 0 0 1.5rem;
  max-width: 62ch;
}

.hero-interactive-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--gold);
}

/* Hero Right Portrait / X-Ray Emblem */
.hero-emblem-card {
  position: relative;
  border-radius: 16px;
  padding: 1.5rem;
  background: rgba(10, 11, 19, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.emblem-svg-wrap {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 50%, rgba(255, 46, 76, 0.16), rgba(8, 8, 14, 0.95));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.emblem-svg-wrap.uv-emblem {
  background: radial-gradient(circle at 50% 50%, rgba(184, 69, 255, 0.32), rgba(7, 3, 15, 0.96));
  border-color: rgba(0, 240, 255, 0.35);
}

.telemetry-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.telemetry-cell {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.telemetry-cell span {
  display: block;
  color: var(--text-muted);
  font-size: 0.64rem;
  margin-bottom: 0.2rem;
}

.telemetry-cell strong {
  color: var(--text-main);
  font-size: 0.82rem;
}

/* Section Navigation Tabs */
.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1rem;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1.15rem;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.28);
}

.nav-tab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 46, 76, 0.22), rgba(184, 69, 255, 0.22));
  border-color: var(--crimson);
  box-shadow: 0 6px 20px rgba(255, 46, 76, 0.2);
}

body.chrysalis-mode .nav-tab.active {
  border-color: var(--uv-cyan);
  box-shadow: 0 6px 20px rgba(184, 69, 255, 0.3);
}

/* Section Headers */
.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.3vw, 2rem);
  margin: 0.2rem 0 0;
  width: fit-content;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0.35rem 0 0;
  max-width: 68ch;
}

/* Dossier Dual-Reality Cards Grid */
.dossier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(370px, 1fr));
  gap: 1.35rem;
  margin-bottom: 3.5rem;
}

.dossier-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.11);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  display: flex;
  flex-direction: column;
  min-height: 330px;
}

.dossier-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 46, 76, 0.5);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.55);
}

body.chrysalis-mode .dossier-card:hover {
  border-color: var(--uv-cyan);
  box-shadow: 0 16px 38px rgba(184, 69, 255, 0.25);
}

.card-surface,
.card-uv-surface {
  padding: 1.45rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.card-uv-surface {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(184, 69, 255, 0.26), transparent 60%),
    linear-gradient(160deg, #17082a 0%, #0d051a 100%);
  border: 1px solid var(--uv-violet);
  clip-path: circle(var(--local-r, 0px) at var(--local-x, -999px) var(--local-y, -999px));
  pointer-events: none;
}

body.chrysalis-mode .card-uv-surface {
  clip-path: circle(150% at 50% 50%) !important;
}

.card-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  margin-bottom: 0.75rem;
}

.card-code {
  color: var(--crimson);
  letter-spacing: 0.08em;
}

.card-uv-surface .card-code {
  color: var(--uv-cyan);
}

.hype-meter-pill {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(245, 185, 66, 0.14);
  color: var(--gold);
  border: 1px solid rgba(245, 185, 66, 0.35);
}

.card-uv-surface .hype-meter-pill {
  background: rgba(255, 42, 157, 0.2);
  color: #ff85c8;
  border-color: rgba(255, 42, 157, 0.45);
}

.card-heading {
  font-family: var(--font-display);
  font-size: 1.28rem;
  margin: 0 0 0.65rem;
  line-height: 1.25;
  width: fit-content;
}

.card-uv-surface .card-heading {
  color: #f4d6ff;
  text-shadow: 0 0 14px rgba(184, 69, 255, 0.65);
}

.card-summary {
  font-size: 0.92rem;
  line-height: 1.58;
  color: #c2c7dc;
  margin: 0 0 1.1rem;
}

.card-uv-surface .card-summary {
  color: #e5c8ff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.uv-stamp-box {
  display: inline-block;
  padding: 0.32rem 0.65rem;
  border: 1px dashed var(--uv-cyan);
  color: var(--uv-cyan);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(0, 240, 255, 0.08);
  margin-bottom: 0.9rem;
  width: fit-content;
}

.card-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 4;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.lore-tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.inspect-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 600;
  background: rgba(255, 46, 76, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 46, 76, 0.45);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.inspect-btn:hover {
  background: var(--crimson);
}

/* Anomaly Secret Trigger Badge inside UV Cards */
.anomaly-hotspot {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 6;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(0, 240, 255, 0.18);
  color: var(--uv-cyan);
  border: 1px solid var(--uv-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
  cursor: pointer;
  opacity: 0;
  transform: scale(0.88);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.uv-target.uv-hovered .anomaly-hotspot,
body.chrysalis-mode .anomaly-hotspot {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.anomaly-hotspot.decrypted {
  background: rgba(66, 245, 155, 0.2);
  color: #42f59b;
  border-color: #42f59b;
  box-shadow: none;
}

/* Evidence Locker Interactive Artifacts Row */
.evidence-locker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.25rem;
  margin-bottom: 3.5rem;
}

.artifact-box {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-panel-elevated);
  border: 1px solid rgba(255, 255, 255, 0.12);
  min-height: 245px;
}

.artifact-layer {
  padding: 1.35rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.artifact-uv-layer {
  position: absolute;
  inset: 0;
  padding: 1.35rem;
  background: linear-gradient(145deg, #1b072e 0%, #090314 100%);
  border: 1px solid var(--uv-cyan);
  clip-path: circle(var(--local-r, 0px) at var(--local-x, -999px) var(--local-y, -999px));
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

body.chrysalis-mode .artifact-uv-layer {
  clip-path: circle(150% at 50% 50%) !important;
}

/* Replay Value Interactive Memory Scrubber Section */
.replay-engine-panel {
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(18, 19, 32, 0.95), rgba(9, 10, 18, 0.98));
  border: 1px solid rgba(184, 69, 255, 0.35);
  padding: 1.85rem;
  margin-bottom: 3.5rem;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.6);
}

.replay-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.tactical-map-stage {
  position: relative;
  border-radius: 14px;
  background:
    linear-gradient(rgba(184, 69, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184, 69, 255, 0.07) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, #131528 0%, #080912 100%);
  background-size: 28px 28px, 28px 28px, 100% 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  min-height: 340px;
  overflow: hidden;
}

.map-blueprint-svg {
  width: 100%;
  height: 100%;
  min-height: 340px;
  display: block;
}

.map-token {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  transition: left 0.45s cubic-bezier(0.22, 1, 0.36, 1), top 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 4;
}

.token-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 14px currentColor;
}

.token-marinette { color: var(--crimson); }
.token-marinette .token-dot { background: var(--crimson); }

.token-adrien { color: #38ef7d; }
.token-adrien .token-dot { background: #38ef7d; }

.token-aglae { color: var(--uv-violet); }
.token-aglae .token-dot { background: var(--uv-violet); }

.token-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.12rem 0.42rem;
  border-radius: 4px;
  background: rgba(6, 7, 13, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  white-space: nowrap;
  color: #fff;
}

.replay-readout-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.perspective-switcher {
  display: flex;
  gap: 0.45rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.3rem;
  border-radius: 10px;
}

.persp-btn {
  flex: 1;
  padding: 0.48rem 0.65rem;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.persp-btn.active {
  background: rgba(184, 69, 255, 0.28);
  color: #fff;
  box-shadow: 0 0 12px rgba(184, 69, 255, 0.35);
}

.scrubber-controls {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.timeline-step-buttons {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.step-marker-btn {
  padding: 0.5rem 0.4rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.18s ease;
}

.step-marker-btn.active {
  background: rgba(255, 46, 76, 0.22);
  border-color: var(--crimson);
  color: #fff;
}

.step-marker-btn.has-anomaly {
  border-color: var(--uv-cyan);
  color: var(--uv-cyan);
}

/* Interactive Red-String Conspiracy Board */
.conspiracy-section {
  margin-bottom: 3.5rem;
}

.conspiracy-workspace {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.35rem;
}

.conspiracy-board {
  position: relative;
  height: 540px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 50%, rgba(30, 22, 42, 0.7), rgba(9, 9, 16, 0.96)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 32px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  overflow: hidden;
  user-select: none;
}

#conspiracy-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.conspiracy-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 176px;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: rgba(16, 17, 28, 0.92);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
  cursor: grab;
  z-index: 3;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.conspiracy-node:active {
  cursor: grabbing;
}

.conspiracy-node[data-faction="villain"] {
  border-color: rgba(184, 69, 255, 0.6);
}

.conspiracy-node[data-faction="hero"] {
  border-color: rgba(255, 46, 76, 0.6);
}

.conspiracy-node[data-faction="deception"] {
  border-color: rgba(0, 240, 255, 0.55);
}

.conspiracy-node.selected-node {
  border-color: var(--gold);
  box-shadow: 0 0 22px rgba(245, 185, 66, 0.55);
}

.node-pin {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--crimson);
  margin: 0 auto 0.4rem;
  box-shadow: 0 0 8px var(--crimson);
}

.conspiracy-node[data-faction="villain"] .node-pin {
  background: var(--uv-violet);
  box-shadow: 0 0 8px var(--uv-violet);
}

.node-title {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  margin-bottom: 0.2rem;
}

.node-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
}

.theory-synthesizer-card {
  border-radius: 18px;
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

/* Modern Top-Layer Dialog Styling (Following modern-web-guidance: light-dismiss-a-dialog & animate-to-from-top-layer) */
dialog {
  max-width: 680px;
  width: calc(100% - 2rem);
  border-radius: 18px;
  background: #121320;
  color: var(--text-main);
  border: 1px solid rgba(184, 69, 255, 0.5);
  padding: 0;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.85);
  opacity: 0;
  /* MANDATORY: transition display and overlay for top-layer elements */
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.3s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;

  @media (prefers-reduced-motion: no-preference) {
    transform: scale(0.92);
  }
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0);
  backdrop-filter: blur(4px);
  transition-property: background-color, display, overlay;
  transition-duration: 0.3s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

:is(dialog[open], [popover]:popover-open):where(:not([data-closing])) {
  opacity: 1;

  @starting-style {
    opacity: 0;
  }

  @media (prefers-reduced-motion: no-preference) {
    transform: scale(1);

    @starting-style {
      transform: scale(0.92);
    }
  }

  &::backdrop {
    background-color: rgb(5 5 12 / 0.72);

    @starting-style {
      background-color: transparent;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog,
  [popover] {
    transition-duration: 0.1s;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

.dialog-inner {
  padding: 1.85rem;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.dialog-close-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
}

.dialog-close-btn:hover {
  background: var(--crimson);
  border-color: var(--crimson);
}

/* View Transition Morph Target */
.morph-active-card {
  view-transition-name: active-dossier-card;
}

#dossierDialogTitle {
  width: fit-content;
}

/* Toast Notification */
.decrypt-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 90;
  padding: 0.9rem 1.25rem;
  border-radius: 12px;
  background: rgba(17, 10, 32, 0.95);
  border: 1px solid var(--uv-cyan);
  box-shadow: 0 12px 32px rgba(0, 240, 255, 0.25);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #fff;
  transform: translateY(140%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.decrypt-toast.visible {
  transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 980px) {
  .hero-layer,
  .replay-grid,
  .conspiracy-workspace {
    grid-template-columns: 1fr;
  }

  .timeline-step-buttons {
    grid-template-columns: repeat(3, 1fr);
  }
}
