:root {
  --phos: #A78BFA;
  --phos-dim: #5B21B6;
  --phos-hot: #E9D8FF;
  --acid: #2DD4BF;
  --acid-hot: #5EEAD4;
  --amber: #F5B14A;
  --danger: #FF5F57;
  --bg: #030108;
  --bg-1: #0A0614;
  --bg-2: #14102A;
  --grid: rgba(167,139,250,0.07);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--phos-hot); font-family: 'JetBrains Mono', ui-monospace, monospace; }
html { scroll-padding-top: 104px; }
body { min-height: 100vh; overflow-x: hidden; }
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}
body::before {
  z-index: 3;
  background:
    repeating-linear-gradient(115deg, transparent 0 42px, rgba(45,212,191,0.055) 43px, transparent 47px),
    repeating-linear-gradient(68deg, transparent 0 76px, rgba(245,177,74,0.04) 77px, transparent 81px);
  opacity: 0.5;
  animation: fieldDrift 9s linear infinite;
}
body::after {
  z-index: 72;
  background: linear-gradient(180deg, transparent 0%, rgba(94,234,212,0.16) 48%, transparent 56%);
  height: 34vh;
  transform: translateY(-130%);
  mix-blend-mode: screen;
  animation: globalScan 5.5s cubic-bezier(0.65,0,0.35,1) infinite;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--phos); color: #000; }

/* ===== Mitra cursor: refined minimal ===== */
body.mitra-cursor-ready,
body.mitra-cursor-ready *,
body.mitra-cursor-ready a,
body.mitra-cursor-ready button,
body.mitra-cursor-ready .hud-link,
body.mitra-cursor-ready .hud-cta,
body.mitra-cursor-ready .skill,
body.mitra-cursor-ready .model-card,
body.mitra-cursor-ready .pipe-step,
body.mitra-cursor-ready .continue-btn,
body.mitra-cursor-ready .hero-ascii,
body.mitra-cursor-ready .hud-brand { cursor: none; }
body.mitra-cursor-ready input,
body.mitra-cursor-ready textarea,
body.mitra-cursor-ready select { cursor: text; }

#mc-root { position: fixed; top: 0; left: 0; z-index: 9998; pointer-events: none; opacity: 0; will-change: transform, opacity; transition: opacity .16s ease; }
#mc-dot  { position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none; opacity: 0; will-change: transform, opacity; transition: opacity .16s ease; }
body.mitra-cursor-live #mc-root,
body.mitra-cursor-live #mc-dot { opacity: 1; }

/* outer ring - lags, subtle */
#mc-ring {
  width: 22px; height: 22px;
  margin: -11px 0 0 -11px;
  border: 1px solid rgba(167,139,250,0.55);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(167,139,250,0.25);
  transition: width .25s ease, height .25s ease, margin .25s ease,
              border-color .25s ease, box-shadow .25s ease, border-radius .25s;
}
/* inner dot - instant */
#mc-dot {
  width: 3px; height: 3px; margin: -1.5px 0 0 -1.5px;
  background: rgba(167,139,250,0.9);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(167,139,250,0.7);
}

/* hover state: ring grows slightly, shifts to acid */
body.cur-hot #mc-ring {
  width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border-color: rgba(45,212,191,0.7);
  box-shadow: 0 0 12px rgba(45,212,191,0.35);
  border-radius: 3px;
}
body.cur-hot #mc-dot { background: rgba(94,234,212,0.95); box-shadow: 0 0 8px rgba(45,212,191,0.8); }

/* click: quick shrink */
body.cur-click #mc-ring { transform: scale(0.7); border-color: rgba(245,177,74,0.8); transition: transform .08s ease; }

@media (hover: none), (pointer: coarse) {
  *, a, button { cursor: auto !important; }
  #mc-root, #mc-dot { display: none; }
}

/* ===== Custom scrollbar (phosphor) ===== */
html { scrollbar-width: thin; scrollbar-color: var(--phos) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }
::-webkit-scrollbar-track { background: rgba(167,139,250,0.04); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--phos), var(--phos-dim));
  border: 1px solid rgba(167,139,250,0.45);
  box-shadow: 0 0 8px rgba(167,139,250,0.4);
  border-radius: 0;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--phos-hot), var(--phos)); }
::-webkit-scrollbar-button { display: none; height: 0; width: 0; }
::-webkit-scrollbar-corner { background: transparent; }
.hero-ascii, .term-body, .run-log { scrollbar-width: none; }
.hero-ascii::-webkit-scrollbar, .term-body::-webkit-scrollbar, .run-log::-webkit-scrollbar { display: none; }
.hero-ascii { overflow: hidden; }

/* ===== Global CRT overlay ===== */
.crt-overlay {
  position: fixed; inset: 0; z-index: 70; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.02) 0, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
  mix-blend-mode: overlay;
}
.crt-flicker { position: fixed; inset: 0; z-index: 71; pointer-events: none; background: rgba(167,139,250,0.015); animation: flicker 6s linear infinite; }
@keyframes flicker { 0%,100% { opacity: 1; } 3% { opacity: 0.6; } 6% { opacity: 1; } 9% { opacity: 0.85; } 50% { opacity: 1; } 52% { opacity: 0.7; } }

/* ===== Matrix rain canvas ===== */
#rain { position: fixed; inset: 0; z-index: 1; opacity: 0.48; pointer-events: none; filter: saturate(1.35) contrast(1.1); }

/* ===== Grid floor ===== */
.grid-floor {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(to right, var(--grid) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px) 0 0 / 64px 64px,
    radial-gradient(ellipse at center top, rgba(167,139,250,0.08) 0%, transparent 60%);
  animation: gridPulse 6s ease-in-out infinite;
}
.grid-floor::before,
.grid-floor::after {
  content: "";
  position: absolute;
  inset: -20%;
  pointer-events: none;
}
.grid-floor::before {
  background:
    linear-gradient(90deg, transparent 0 47%, rgba(167,139,250,0.08) 50%, transparent 53%),
    linear-gradient(0deg, transparent 0 49%, rgba(167,139,250,0.1) 50%, transparent 51%);
  background-size: 420px 100%, 100% 240px;
  opacity: 0.58;
  transform: rotate(-8deg);
  animation: gridSurge 10s linear infinite;
}
.grid-floor::after {
  background: repeating-linear-gradient(135deg, transparent 0 58px, rgba(245,177,74,0.08) 59px, transparent 62px);
  opacity: 0.42;
  animation: hazardDrift 4.8s linear infinite;
}
@keyframes fieldDrift { to { background-position: 220px 0, -180px 0; } }
@keyframes globalScan { 0%,68% { transform: translateY(-130%); opacity: 0; } 76% { opacity: 0.82; } 100% { transform: translateY(330%); opacity: 0; } }
@keyframes gridPulse { 0%,100% { opacity: 1; filter: hue-rotate(0deg); } 50% { opacity: 0.72; filter: hue-rotate(28deg); } }
@keyframes gridSurge { to { background-position: 340px 0, 0 220px; } }
@keyframes hazardDrift { to { transform: translate3d(-140px, 90px, 0); } }

/* ===== BOOT OVERLAY ===== */
.boot {
  position: fixed; inset: 0; z-index: 999;
  background: #000;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: clamp(20px, 6vw, 80px);
  font-family: 'VT323', 'JetBrains Mono', monospace;
  font-size: clamp(14px, 1.4vw, 18px);
  line-height: 1.6;
  color: var(--phos);
  transition: opacity 0.6s ease;
  overflow: hidden;
}
.boot::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(167,139,250,0.08) 0, rgba(167,139,250,0.08) 1px, transparent 1px, transparent 3px);
}
.boot.is-done { opacity: 0; pointer-events: none; }
.boot-line { min-height: 1.6em; }
.boot-line .ok { color: var(--acid); }
.boot-line .warn { color: var(--amber); }
.boot-line .dim { color: rgba(167,139,250,0.45); }
.boot-bar {
  display: inline-block; color: var(--phos-hot);
  letter-spacing: 0;
}
.boot-logo {
  color: var(--phos-hot);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  white-space: pre;
  line-height: 1;
  margin: clamp(20px, 3vw, 40px) 0;
  text-shadow: 0 0 20px rgba(167,139,250,0.6), 0 0 40px rgba(167,139,250,0.3);
  font-size: clamp(8px, 1.5vw, 14px);
}
.boot-press {
  margin-top: clamp(20px, 4vw, 40px);
  color: var(--acid);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0.2; } }

/* ===== Nav (terminal HUD - elite edition) ===== */
.hud-rail {
  position: fixed; top: 0; left: 0; right: 0; z-index: 61;
  height: 3px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--phos) 20%, var(--acid) 50%, var(--phos) 80%, transparent);
  opacity: 0.55;
  filter: blur(0.5px);
  animation: railScan 4.5s ease-in-out infinite;
}
@keyframes railScan { 0%,100% { background-position: 0% 0; } 50% { background-position: 100% 0; } }

.hud-nav {
  position: fixed; top: 14px; left: 14px; right: 14px; z-index: 60;
  padding: 10px 14px 10px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  background:
    linear-gradient(90deg, rgba(45,212,191,0.1), transparent 24%, rgba(167,139,250,0.12) 55%, transparent 78%, rgba(245,177,74,0.09)),
    linear-gradient(180deg, rgba(10,6,20,0.9), rgba(3,1,8,0.82));
  background-size: 220% 100%, 100% 100%;
  border: 1px solid rgba(167,139,250,0.22);
  box-shadow:
    0 0 0 1px rgba(167,139,250,0.05),
    0 0 34px rgba(45,212,191,0.1),
    0 20px 60px -20px rgba(167,139,250,0.52),
    inset 0 0 34px rgba(167,139,250,0.08);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  animation: hudFlux 5.2s ease-in-out infinite;
}
/* corner brackets */
.hud-nav::before, .hud-nav::after {
  content: ""; position: absolute; width: 10px; height: 10px;
  border: 1px solid var(--phos);
  pointer-events: none;
}
.hud-nav::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.hud-nav::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.hud-brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; letter-spacing: 0.22em; color: var(--phos-hot);
  position: relative;
  padding-right: 14px;
  border-right: 1px dashed rgba(167,139,250,0.2);
}
.hud-brand .brand-logo {
  display: inline-block; width: 24px; height: 24px;
  filter: drop-shadow(0 0 8px rgba(167,139,250,0.7)) drop-shadow(0 0 14px rgba(167,139,250,0.4));
  animation: brandPulse 3.4s ease-in-out infinite;
}
@keyframes brandPulse { 0%,100% { filter: drop-shadow(0 0 8px rgba(167,139,250,0.7)) drop-shadow(0 0 14px rgba(167,139,250,0.4)); } 50% { filter: drop-shadow(0 0 12px rgba(233,216,255,0.9)) drop-shadow(0 0 22px rgba(167,139,250,0.6)); } }
.hud-brand b { font-size: 12.5px; position: relative; font-family: 'JetBrains Mono', monospace; letter-spacing: 0.18em; }
.hud-brand b .ai { color: var(--acid-hot); text-shadow: 0 0 8px rgba(94,234,212,0.5); margin-left: 2px; }
.hud-brand b::after {
  content: "v1.2";
  position: absolute; top: -6px; right: -34px;
  font-size: 8px; letter-spacing: 0.2em; color: var(--acid);
  padding: 1px 4px; border: 1px solid rgba(45,212,191,0.4);
  background: rgba(45,212,191,0.06);
}
.hud-brand:hover .glitch { animation: glitch 0.4s steps(3); }
@keyframes glitch { 0% { transform: translate(0); } 20% { transform: translate(-1px, 1px); } 40% { transform: translate(1px, -1px); } 60% { transform: translate(-1px, 0); } 80% { transform: translate(1px, 0); } 100% { transform: translate(0); } }

@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.8); opacity: 0.5; } }

.hud-links {
  display: none; gap: 2px;
  justify-self: center;
  color: rgba(232,230,240,0.6); font-weight: 500;
}
@media (min-width: 900px) { .hud-links { display: inline-flex; } }
.hud-link {
  --hud-accent: 167,139,250;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
.hud-link:nth-child(1) { --hud-accent: 45,212,191; }
.hud-link:nth-child(2) { --hud-accent: 167,139,250; }
.hud-link:nth-child(3) { --hud-accent: 245,177,74; }
.hud-link:nth-child(4) { --hud-accent: 96,165,250; }
.hud-link:nth-child(5) { --hud-accent: 244,114,182; }
.hud-link::before { content: "["; color: rgba(167,139,250,0.35); margin-right: 2px; }
.hud-link::after { content: "]"; color: rgba(167,139,250,0.35); margin-left: 2px; }
.hud-link:hover {
  color: rgb(var(--hud-accent));
  background: rgba(var(--hud-accent),0.08);
  border-color: rgba(var(--hud-accent),0.22);
}
.hud-link:hover::before, .hud-link:hover::after { color: rgb(var(--hud-accent)); }
.hud-link.is-here {
  color: rgb(var(--hud-accent));
  background: rgba(var(--hud-accent),0.13);
  border-color: rgba(var(--hud-accent),0.48);
  text-shadow: 0 0 12px rgba(var(--hud-accent),0.86), 0 0 28px rgba(var(--hud-accent),0.42);
  box-shadow:
    0 0 18px rgba(var(--hud-accent),0.34),
    0 0 46px rgba(var(--hud-accent),0.14),
    inset 0 0 16px rgba(var(--hud-accent),0.08);
}
.hud-link.is-here::before, .hud-link.is-here::after { color: rgb(var(--hud-accent)); }
@keyframes hudFlux {
  0%,100% { background-position: 0% 0, 0 0; border-color: rgba(167,139,250,0.22); }
  50% { background-position: 100% 0, 0 0; border-color: rgba(45,212,191,0.34); }
}

.hud-tail { display: flex; align-items: center; gap: 10px; font-size: 10px; color: rgba(167,139,250,0.6); }

/* LED bank */
.hud-leds { display: none; gap: 6px; padding: 4px 8px; border: 1px solid rgba(167,139,250,0.2); background: rgba(0,0,0,0.4); }
@media (min-width: 1100px) { .hud-leds { display: inline-flex; } }
.led { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; letter-spacing: 0.22em; color: rgba(232,230,240,0.55); }
.led i { width: 6px; height: 6px; background: var(--acid); box-shadow: 0 0 8px var(--acid); display: inline-block; animation: ledBlink 2.4s ease-in-out infinite; }
.led.warn i { background: var(--amber); box-shadow: 0 0 8px var(--amber); animation-duration: 1.4s; }
.led.hot i { background: var(--phos); box-shadow: 0 0 8px var(--phos); }
@keyframes ledBlink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.hud-trace {
  display: none; font-size: 9.5px; letter-spacing: 0.22em;
  color: rgba(167,139,250,0.55);
  padding: 4px 8px;
  border: 1px dashed rgba(167,139,250,0.2);
}
@media (min-width: 1000px) { .hud-trace { display: inline-flex; } }
.hud-trace b { color: var(--phos-hot); font-weight: 600; margin-left: 6px; font-family: 'VT323', monospace; letter-spacing: 0; font-size: 13px; }

.hud-cmd {
  display: none; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid rgba(167,139,250,0.25);
  background: rgba(167,139,250,0.05);
  color: rgba(232,230,240,0.7);
  font-size: 10px; letter-spacing: 0.2em;
}
@media (min-width: 700px) { .hud-cmd { display: inline-flex; } }
.hud-cmd kbd { font-family: 'JetBrains Mono', monospace; color: var(--phos-hot); font-size: 10px; padding: 1px 5px; border: 1px solid rgba(167,139,250,0.35); background: rgba(0,0,0,0.4); }
.hud-cmd:hover { border-color: var(--phos); color: var(--phos-hot); }

.hud-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--phos);
  color: #000; background: var(--phos);
  font-weight: 700; letter-spacing: 0.18em;
  box-shadow: 0 0 18px rgba(167,139,250,0.45), inset 0 0 12px rgba(255,255,255,0.2);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.hud-cta::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  transform: skewX(-20deg);
  animation: ctaSweep 3.6s ease-in-out infinite;
}
@keyframes ctaSweep { 0% { left: -40%; } 55%,100% { left: 130%; } }
.hud-cta:hover { background: var(--phos-hot); box-shadow: 0 0 34px rgba(167,139,250,0.9); }

@media (max-width: 760px) {
  .hud-nav {
    top: 8px;
    left: 8px;
    right: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px;
  }
  .hud-brand {
    gap: 8px;
    padding-right: 8px;
    border-right: 0;
    min-width: 0;
  }
  .hud-brand b {
    font-size: 11px;
    letter-spacing: 0.12em;
  }
  .hud-brand b::after {
    display: none;
  }
  .hud-tail {
    gap: 6px;
    min-width: 0;
  }
  .hud-cta {
    padding: 7px 9px;
    font-size: 9px;
    letter-spacing: 0.08em;
    white-space: nowrap;
  }
}

@media (max-width: 430px) {
  .hud-brand .brand-logo {
    width: 22px;
    height: 22px;
  }
  .hud-brand b {
    max-width: 86px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .hud-cta {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ===== Corner HUD readout (bottom-right) ===== */
.hud-readout {
  position: fixed; right: 14px; bottom: 14px; z-index: 55;
  padding: 8px 12px;
  border: 1px solid rgba(167,139,250,0.22);
  background: rgba(3,1,8,0.7);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 10px; letter-spacing: 0.18em; color: rgba(167,139,250,0.7);
  text-transform: uppercase;
  display: none; flex-direction: column; gap: 4px; line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 10px 30px -10px rgba(167,139,250,0.35);
}
@media (min-width: 800px) { .hud-readout { display: flex; } }
.hud-readout .row { display: flex; gap: 10px; justify-content: space-between; min-width: 170px; }
.hud-readout b { color: var(--phos-hot); font-weight: 600; font-family: 'VT323', monospace; letter-spacing: 0; font-size: 13px; }
.hud-readout .ok { color: var(--acid); }

/* ===== Glitch hero title ===== */
.glitch-wrap { position: relative; display: inline-block; }
.glitch-wrap::before, .glitch-wrap::after {
  content: attr(data-txt);
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0;
}
.glitch-wrap.go::before {
  color: var(--acid-hot);
  transform: translate(-2px, 0);
  animation: glitchA 0.7s steps(2) 1;
  mix-blend-mode: screen;
}
.glitch-wrap.go::after {
  color: var(--danger);
  transform: translate(2px, 0);
  animation: glitchB 0.7s steps(2) 1;
  mix-blend-mode: screen;
}
@keyframes glitchA { 0% { opacity: 0.6; clip-path: inset(0 0 80% 0); } 20% { clip-path: inset(40% 0 40% 0); } 40% { clip-path: inset(70% 0 10% 0); } 60% { clip-path: inset(20% 0 60% 0); } 100% { opacity: 0; clip-path: inset(0 0 100% 0); } }
@keyframes glitchB { 0% { opacity: 0.5; clip-path: inset(60% 0 10% 0); } 30% { clip-path: inset(10% 0 70% 0); } 55% { clip-path: inset(50% 0 30% 0); } 100% { opacity: 0; clip-path: inset(0 0 100% 0); } }

/* ===== Command palette ===== */
.cmdk {
  position: fixed; inset: 0; z-index: 990;
  background: rgba(3,1,8,0.75);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: none; justify-content: center; align-items: flex-start; padding-top: 14vh;
}
.cmdk.is-open { display: flex; }
.cmdk-box {
  width: min(560px, 92vw);
  background: linear-gradient(180deg, rgba(10,6,20,0.95), rgba(3,1,8,0.98));
  border: 1px solid rgba(167,139,250,0.35);
  box-shadow: 0 30px 80px -20px rgba(167,139,250,0.5), 0 0 0 1px rgba(167,139,250,0.08);
}
.cmdk-input {
  width: 100%; background: transparent; border: 0; outline: 0;
  color: var(--phos-hot); font-family: inherit; font-size: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(167,139,250,0.18);
  letter-spacing: 0.08em;
}
.cmdk-input::placeholder { color: rgba(167,139,250,0.4); }
.cmdk-list { padding: 8px 0; max-height: 48vh; overflow-y: auto; }
.cmdk-item {
  padding: 10px 18px; font-size: 12px; letter-spacing: 0.1em;
  color: rgba(232,230,240,0.75); display: flex; align-items: center; gap: 12px;
  text-transform: uppercase;
}
.cmdk-item.is-sel { background: rgba(167,139,250,0.12); color: var(--phos-hot); }
.cmdk-item .sig { color: var(--phos); font-size: 11px; letter-spacing: 0.2em; }
.cmdk-hint { padding: 8px 18px; border-top: 1px solid rgba(167,139,250,0.12); font-size: 10px; letter-spacing: 0.2em; color: rgba(167,139,250,0.5); display: flex; gap: 14px; }
.cmdk-hint kbd { font-family: inherit; color: var(--phos-hot); border: 1px solid rgba(167,139,250,0.3); padding: 1px 5px; background: rgba(0,0,0,0.4); }

/* Level load sweep */
.level::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--phos), transparent);
  transform: scaleX(0); transform-origin: left center;
  transition: transform 1.2s cubic-bezier(0.2,0.8,0.2,1);
}
.level.is-live::before { transform: scaleX(1); }

/* ===== Content wrapper ===== */
main { position: relative; z-index: 10; }

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  padding: calc(80px + 6vw) clamp(16px, 4vw, 48px) 60px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
}
.hero-tag {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  border: 1px solid rgba(167,139,250,0.3);
  background: rgba(167,139,250,0.06);
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--phos); width: fit-content;
  margin-bottom: 28px;
}
.hero-tag .dot { width: 6px; height: 6px; background: var(--acid); box-shadow: 0 0 8px var(--acid); animation: pulse 2.2s ease-in-out infinite; }

.hero-ascii {
  color: var(--phos-hot);
  white-space: pre;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  line-height: 1;
  font-size: clamp(9px, 1.7vw, 18px);
  text-shadow:
    0 0 14px rgba(167,139,250,0.85),
    0 0 28px rgba(167,139,250,0.54),
    0 0 50px rgba(45,212,191,0.36),
    0 0 90px rgba(245,177,74,0.12);
  margin-bottom: 36px;
  overflow-x: auto;
  animation: asciiOverload 3.2s steps(2) infinite;
}
.hero-title {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 300;
  font-size: clamp(22px, 3.5vw, 44px);
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--phos-hot);
  max-width: 26ch;
  margin-bottom: 24px;
}
.hero-title .acc { color: var(--acid-hot); font-weight: 500; text-shadow: 0 0 14px rgba(94,234,212,0.5); }
.glitch-wrap {
  text-shadow: 0 0 18px rgba(94,234,212,0.7), 0 0 42px rgba(167,139,250,0.42);
  animation: titleCharge 2.8s ease-in-out infinite;
}
@keyframes asciiOverload {
  0%,88%,100% { transform: translateX(0); filter: hue-rotate(0deg); }
  90% { transform: translateX(-2px); filter: hue-rotate(35deg); }
  92% { transform: translateX(2px); }
  94% { transform: translateX(0); filter: hue-rotate(-20deg); }
}
@keyframes titleCharge {
  0%,100% { filter: saturate(1); }
  50% { filter: saturate(1.6) brightness(1.12); }
}
.hero-sub {
  max-width: 68ch;
  font-size: clamp(13px, 1.1vw, 15px);
  line-height: 1.7;
  color: rgba(232,230,240,0.65);
  margin-bottom: 40px;
}

/* ===== AI reasoning core ===== */
.run {
  position: relative;
  margin-top: 40px;
  padding: 20px;
  border: 1px solid rgba(167,139,250,0.2);
  scroll-margin-top: 104px;
  background:
    radial-gradient(780px 320px at 50% 44%, rgba(45,212,191,0.08), transparent 64%),
    radial-gradient(620px 260px at 10% 92%, rgba(167,139,250,0.22), transparent 67%),
    radial-gradient(520px 260px at 92% 12%, rgba(245,177,74,0.1), transparent 62%),
    linear-gradient(180deg, rgba(10,6,20,0.9), rgba(3,1,8,0.98));
  border-radius: 4px;
  box-shadow:
    0 0 0 1px rgba(45,212,191,0.04),
    0 0 0 1px rgba(45,212,191,0.08),
    0 26px 90px -36px rgba(45,212,191,0.68),
    0 0 120px -72px rgba(167,139,250,0.9),
    inset 0 0 54px rgba(167,139,250,0.1);
  overflow: hidden;
}
.run::before,
.run::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.run::before {
  background:
    linear-gradient(rgba(255,255,255,0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167,139,250,0.055) 1px, transparent 1px),
    repeating-linear-gradient(115deg, transparent 0 70px, rgba(45,212,191,0.035) 72px, transparent 76px);
  background-size: 100% 4px, 42px 42px, 220px 220px;
  opacity: 0.48;
  mix-blend-mode: screen;
  animation: coreGridShift 10s linear infinite;
}
.run::after {
  background:
    linear-gradient(90deg, transparent, rgba(94,234,212,0.08), rgba(167,139,250,0.12), transparent),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.1), transparent 34%);
  width: 28%;
  animation: runSweep 5.4s ease-in-out infinite;
}
@keyframes coreGridShift { to { background-position: 0 28px, 42px 0, 220px 0; } }
@keyframes runSweep {
  0% { transform: translateX(-120%); opacity: 0; }
  18% { opacity: 0.8; }
  54%,100% { transform: translateX(330%); opacity: 0; }
}
.run-head {
  position: relative;
  z-index: 2;
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px dashed rgba(167,139,250,0.18);
  margin-bottom: 16px;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(232,230,240,0.55);
}
.run-title {
  color: var(--phos-hot);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-shadow: 0 0 16px rgba(167,139,250,0.72), 0 0 32px rgba(45,212,191,0.32);
}
.run-title .blinker { width: 8px; height: 8px; background: var(--acid); box-shadow: 0 0 10px var(--acid), 0 0 28px var(--acid); animation: blink 0.72s step-end infinite; }
.run-stats { display: flex; flex-wrap: wrap; gap: 14px; }
.run-stat { display: inline-flex; align-items: center; gap: 8px; }
.run-stat b { color: var(--phos-hot); font-weight: 600; letter-spacing: 0.08em; }
.bar { width: 80px; height: 6px; background: rgba(167,139,250,0.12); position: relative; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--acid), var(--phos)); box-shadow: 0 0 8px var(--phos); transition: width 0.4s ease; }
.bar.danger > i { background: linear-gradient(90deg, var(--amber), var(--danger)); }

#run-canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 360px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(45,212,191,0.04), transparent 56%),
    radial-gradient(ellipse at 50% 100%, rgba(167,139,250,0.2), transparent 72%),
    linear-gradient(180deg, rgba(3,1,8,0.08), rgba(0,0,0,0.28));
  border-radius: 2px;
  filter: saturate(1.04) contrast(1.03);
}
.run-log {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  padding: 14px 16px 16px;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.58), rgba(0,0,0,0.42)),
    radial-gradient(circle at top left, rgba(167,139,250,0.08), transparent 42%);
  border: 1px solid rgba(167,139,250,0.18);
  font-size: 12px;
  line-height: 1.65;
  color: rgba(232,230,240,0.72);
  min-height: 206px;
  max-height: 300px;
  overflow: hidden;
  box-shadow: inset 0 0 28px rgba(167,139,250,0.04);
}
@media (min-width: 800px) {
  .run-log { padding-right: 180px; }
}
.run-route-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.run-route-card {
  --route-rgb: 167,139,250;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(var(--route-rgb),0.54);
  background: rgba(3,1,8,0.78);
  opacity: 0;
  transform: translateY(4px);
  box-shadow:
    inset 0 0 22px rgba(var(--route-rgb),0.06),
    0 0 18px rgba(var(--route-rgb),0.1);
  animation: ln-in 0.24s forwards;
}
.run-route-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.run-route-id {
  color: rgb(var(--route-rgb));
  font-weight: 700;
}
.run-route-conf {
  padding: 1px 5px;
  border: 1px solid rgba(var(--route-rgb),0.26);
  color: rgba(232,230,240,0.62);
  font-size: 9px;
  letter-spacing: 0.08em;
}
.run-route-action {
  color: rgba(233,216,255,0.86);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-transform: uppercase;
}
.run-log-stream {
  min-height: 76px;
}
.run-log .ln {
  display: block;
  white-space: pre-wrap;
  opacity: 0;
  transform: translateY(4px);
  animation: ln-in 0.28s forwards;
}
@keyframes ln-in { to { opacity: 1; transform: translateY(0); } }
.run-log .mitra { color: var(--phos); font-weight: 500; }
.run-log .ok { color: var(--acid); }
.run-log .warn { color: var(--amber); }
.run-log .hit { color: var(--danger); }
.run-log .strong { color: var(--phos-hot); font-weight: 600; }

@media (max-width: 720px) {
  .run-route-stack { grid-template-columns: 1fr; }
  .run-log { min-height: 260px; max-height: 340px; }
}

/* ===== Section scaffold ===== */
section.level {
  padding: clamp(80px, 10vw, 160px) clamp(16px, 4vw, 48px);
  position: relative;
  border-top: 1px dashed rgba(167,139,250,0.15);
  scroll-margin-top: 104px;
}
.level-head {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: baseline; justify-content: space-between;
  margin-bottom: 48px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(167,139,250,0.12);
}
.level-tag {
  font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--phos);
  display: inline-flex; align-items: center; gap: 10px;
}
.level-tag .n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border: 1px solid var(--phos);
  color: var(--phos-hot);
  font-weight: 700;
}
.level-title {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 300;
  font-size: clamp(22px, 3vw, 38px);
  letter-spacing: -0.01em;
  color: var(--phos-hot);
  max-width: 24ch;
  line-height: 1.15;
  margin: 0;
}
.level-title .acc { color: var(--acid-hot); font-weight: 500; }
.level-meta { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(167,139,250,0.5); }

.max-w { max-width: 1300px; margin: 0 auto; }

/* ===== Reasoning pipeline ===== */
.pipeline {
  display: grid; grid-template-columns: 1fr; gap: 28px;
}
@media (min-width: 900px) { .pipeline { grid-template-columns: 0.9fr 1.1fr; gap: 48px; align-items: start; } }
.pipe-step {
  padding: 18px 20px;
  border: 1px solid rgba(167,139,250,0.15);
  background: rgba(10,6,20,0.55);
  display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center;
  margin-bottom: 10px;
  transition: all 0.2s;
}
.pipe-step:hover { border-color: var(--phos); background: rgba(20,12,40,0.8); }
.pipe-num {
  width: 36px; height: 36px; border: 1px solid var(--phos);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--phos-hot); font-weight: 700;
  background: rgba(167,139,250,0.08);
}
.pipe-step h4 { margin: 0 0 4px; font-weight: 600; color: var(--phos-hot); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.pipe-step p { margin: 0; font-size: 13px; color: rgba(232,230,240,0.65); line-height: 1.55; }

.term-window {
  border: 1px solid rgba(167,139,250,0.25);
  background: linear-gradient(180deg, rgba(10,6,20,0.9), rgba(3,1,8,0.96));
  overflow: hidden;
  position: relative;
  box-shadow: 0 30px 80px -20px rgba(167,139,250,0.25);
}
.term-window::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(167,139,250,0.03) 0, rgba(167,139,250,0.03) 1px, transparent 1px, transparent 3px);
}
.term-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(167,139,250,0.15);
  background: rgba(0,0,0,0.4);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(232,230,240,0.55);
}
.term-bar .dots { display: inline-flex; gap: 5px; }
.term-bar .dots i { width: 9px; height: 9px; background: var(--phos-dim); display: inline-block; }
.term-bar .dots i:nth-child(2) { background: var(--amber); }
.term-bar .dots i:nth-child(3) { background: var(--acid); }
.term-bar b { color: var(--phos-hot); font-weight: 600; }
.term-model-pill {
  margin-left: auto;
  padding: 4px 10px;
  border: 1px solid var(--phos);
  color: var(--phos-hot);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.22em;
  background: rgba(167,139,250,0.08);
}
.term-body {
  padding: 18px 20px 22px;
  font-size: 13px; line-height: 1.75;
  color: rgba(232,230,240,0.82);
  min-height: 300px;
  position: relative;
}
.term-body .ln { display: block; white-space: pre-wrap; }
.term-body .tok-user { color: var(--amber); }
.term-body .tok-mitra { color: var(--phos); font-weight: 500; }
.term-body .tok-sys { color: var(--acid); }
.term-body .tok-strong { color: var(--phos-hot); font-weight: 600; }
.term-body .ln-dim { color: rgba(232,230,240,0.4); }
.caret { display: inline-block; width: 8px; height: 14px; vertical-align: text-bottom; background: var(--phos); box-shadow: 0 0 10px var(--phos); animation: blink 0.9s step-end infinite; }
.term-foot {
  padding: 10px 14px; border-top: 1px solid rgba(167,139,250,0.12);
  display: flex; flex-wrap: wrap; gap: 14px;
  font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(167,139,250,0.55);
  background: rgba(0,0,0,0.35);
}
.term-foot b { color: var(--phos-hot); font-weight: 600; }

/* ===== Skill tree (capabilities) ===== */
.skills {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.skill {
  padding: 20px;
  border: 1px solid rgba(167,139,250,0.15);
  background: linear-gradient(180deg, rgba(10,6,20,0.75), rgba(3,1,8,0.9));
  position: relative;
  transition: all 0.25s;
}
.skill::before {
  content: ""; position: absolute; left: 20px; right: 20px; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--phos), transparent);
  opacity: 0; transition: opacity 0.2s;
}
.skill:hover { border-color: var(--phos); transform: translateY(-2px); }
.skill:hover::before { opacity: 1; }
.skill-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.skill-sigil {
  width: 36px; height: 36px; flex: none;
  border: 1px solid var(--phos); color: var(--phos-hot);
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(167,139,250,0.1);
  font-weight: 700; letter-spacing: 0.12em;
}
.skill-lvl {
  margin-left: auto;
  font-size: 10px; letter-spacing: 0.22em;
  padding: 3px 8px; border: 1px solid rgba(167,139,250,0.25);
  color: var(--acid); background: rgba(45,212,191,0.05);
}
.skill h3 {
  margin: 0 0 8px; font-size: 14px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--phos-hot);
}
.skill p { margin: 0; font-size: 12.5px; line-height: 1.6; color: rgba(232,230,240,0.6); }

/* ===== Model roster ===== */
.roster { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.model-card {
  padding: 22px;
  border: 1px solid rgba(167,139,250,0.18);
  background: linear-gradient(180deg, rgba(10,6,20,0.85), rgba(3,1,8,0.95));
  position: relative;
  transition: all 0.25s;
}
.model-card.is-active {
  border-color: var(--phos);
  background: linear-gradient(180deg, rgba(32,20,60,0.9), rgba(10,6,20,0.95));
  box-shadow: 0 0 40px -10px rgba(167,139,250,0.5), inset 0 0 40px rgba(167,139,250,0.06);
}
.model-card.is-locked { opacity: 0.5; }
.model-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.model-name { font-weight: 700; letter-spacing: 0.14em; color: var(--phos-hot); text-transform: uppercase; font-size: 14px; }
.model-chip {
  font-size: 10px; padding: 3px 8px; border: 1px solid rgba(167,139,250,0.3);
  color: var(--phos); letter-spacing: 0.2em; text-transform: uppercase;
}
.model-chip.active { background: var(--phos); color: #000; border-color: var(--phos); }
.model-chip.locked { color: rgba(232,230,240,0.45); border-color: rgba(255,255,255,0.15); }
.model-desc { font-size: 12.5px; line-height: 1.6; color: rgba(232,230,240,0.65); margin-bottom: 14px; }
.model-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(167,139,250,0.55); }
.model-stat b { display: block; color: var(--phos-hot); font-weight: 600; font-size: 14px; letter-spacing: 0.04em; margin-top: 2px; text-transform: none; }

/* ===== Codex (principles) ===== */
.codex { display: grid; gap: 10px; }
.codex-entry {
  display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start;
  padding: 22px 4px;
  border-top: 1px dashed rgba(167,139,250,0.15);
}
.codex-entry:last-child { border-bottom: 1px dashed rgba(167,139,250,0.15); }
.codex-num {
  font-family: 'VT323', monospace;
  font-size: 64px; line-height: 0.9;
  color: var(--phos);
  text-shadow: 0 0 10px rgba(167,139,250,0.4);
}
.codex-body h3 { margin: 0 0 8px; font-size: 20px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--phos-hot); }
.codex-body p { margin: 0; font-size: 13.5px; line-height: 1.7; color: rgba(232,230,240,0.65); max-width: 68ch; }

/* ===== Continue CTA ===== */
.continue {
  padding: clamp(80px, 12vw, 180px) clamp(16px, 4vw, 48px);
  text-align: center; position: relative;
  border-top: 1px dashed rgba(167,139,250,0.18);
}
.continue h2 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 300;
  font-size: clamp(22px, 3vw, 40px);
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--phos-hot);
  max-width: 28ch;
  margin: 0 auto 28px;
}
.continue h2 .acc { color: var(--acid-hot); font-weight: 500; }
.continue p { max-width: 54ch; margin: 0 auto 40px; color: rgba(232,230,240,0.6); font-size: 14px; line-height: 1.7; }
.continue-btn {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 16px 28px;
  border: 1px solid var(--phos);
  background: var(--phos); color: #000;
  font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase; font-size: 13px;
  box-shadow: 0 0 30px rgba(167,139,250,0.6), inset 0 0 16px rgba(255,255,255,0.2);
  transition: all 0.2s;
}
.continue-btn:hover { background: var(--phos-hot); box-shadow: 0 0 60px rgba(167,139,250,0.8); transform: translateY(-2px); }
.continue-btn .arrow { animation: arrow 1.2s ease-in-out infinite; }
@keyframes arrow { 0%,100% { transform: translateX(0); } 50% { transform: translateX(4px); } }

/* ===== Footer ===== */
.term-footer {
  padding: 40px clamp(16px, 4vw, 48px) 60px;
  border-top: 1px solid rgba(167,139,250,0.12);
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.4));
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(167,139,250,0.45);
}
.term-footer .row { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; }
.term-footer a:hover { color: var(--phos-hot); }
.term-footer .brand { color: var(--phos-hot); font-weight: 700; letter-spacing: 0.22em; }
.term-footer .sep { opacity: 0.5; }

/* Reveals */
.reveal { opacity: 0; transform: translateY(18px); transition: all 0.7s cubic-bezier(0.2,0.8,0.2,1); }
.reveal.is-in { opacity: 1; transform: translateY(0); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .crt-flicker, .boot { display: none; }
}
