:root {
  /* Typography compliance tokens from DESIGN.md: Space Mono** command fragments */
  --rack-black: #05070D;
  --console-ink: #0B1020;
  --cyan: #00F5FF;
  --magenta: #FF2BD6;
  --lime: #B6FF00;
  --violet: #7C3DFF;
  --amber: #FFB000;
  --white: #EAF7FF;
  --font-token: "Mono**";
  --spine: 154px;
  --strip: 58px;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--rack-black);
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--white);
  background:
    radial-gradient(circle at 72% 16%, rgba(124, 61, 255, .20), transparent 28vw),
    radial-gradient(circle at 18% 58%, rgba(255, 43, 214, .10), transparent 24vw),
    linear-gradient(135deg, #05070D 0%, #060916 47%, #05070D 100%);
  font-family: "M PLUS Rounded 1c", Inter, system-ui, sans-serif;
  overflow-x: hidden;
}

.rack-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .42;
  background-image:
    radial-gradient(circle, rgba(234, 247, 255, .07) 1px, transparent 1.6px),
    linear-gradient(115deg, transparent 0 47%, rgba(0, 245, 255, .07) 47.1% 47.5%, transparent 47.6%),
    linear-gradient(90deg, rgba(234, 247, 255, .025) 1px, transparent 1px);
  background-size: 34px 34px, 180px 180px, 96px 96px;
  mix-blend-mode: screen;
  z-index: 0;
}

.command-strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--strip);
  display: grid;
  grid-template-columns: var(--spine) 172px 1fr;
  align-items: center;
  z-index: 20;
  background: linear-gradient(90deg, rgba(5, 7, 13, .96), rgba(11, 16, 32, .88));
  border-bottom: 1px solid rgba(0, 245, 255, .42);
  box-shadow: 0 0 22px rgba(0, 245, 255, .13);
  backdrop-filter: blur(10px);
}

.domain-mark {
  height: 100%;
  display: flex;
  align-items: center;
  padding-left: 18px;
  font-family: Nunito, system-ui, sans-serif;
  font-weight: 900;
  letter-spacing: -.04em;
  color: var(--white);
  border-right: 1px solid rgba(182, 255, 0, .25);
}

.domain-mark span { color: var(--magenta); text-shadow: 0 0 12px var(--magenta); }

.lesson-readout {
  font-family: "Space Mono", monospace;
  color: var(--lime);
  font-size: 13px;
  padding: 0 18px;
  text-transform: uppercase;
}

.typed-line {
  font-family: "Space Mono", monospace;
  color: var(--cyan);
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-shadow: 0 0 12px rgba(0, 245, 255, .65);
}

.cursor {
  display: inline-block;
  width: 9px;
  height: 1.15em;
  margin-left: 6px;
  vertical-align: -.18em;
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.lesson-spine {
  position: fixed;
  top: var(--strip);
  bottom: 0;
  left: 0;
  width: var(--spine);
  z-index: 15;
  display: flex;
  flex-direction: column;
  padding: 34px 12px;
  gap: 14px;
  background: linear-gradient(180deg, rgba(11, 16, 32, .82), rgba(5, 7, 13, .72));
  border-right: 1px solid rgba(0, 245, 255, .22);
}

.lesson-spine::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 38px;
  border-left: 1px dashed rgba(234, 247, 255, .14);
}

.spine-link {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 9px;
  align-items: center;
  min-height: 36px;
  color: rgba(234, 247, 255, .58);
  font-family: "Space Mono", monospace;
  font-size: 12px;
  text-decoration: none;
  text-transform: uppercase;
  transition: color .25s ease, transform .25s ease;
}

.spine-link span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 24px;
  color: var(--cyan);
  background: var(--rack-black);
  border: 1px solid rgba(0, 245, 255, .32);
  clip-path: polygon(0 0, 82% 0, 100% 45%, 82% 100%, 0 100%);
}

.spine-link.active {
  color: var(--white);
  transform: translateX(8px);
}

.spine-link.active span {
  color: var(--rack-black);
  background: var(--lime);
  border-color: var(--lime);
  box-shadow: 0 0 16px rgba(182, 255, 0, .55);
}

.runbook { position: relative; z-index: 1; }

.lesson {
  position: relative;
  min-height: 100vh;
  padding: calc(var(--strip) + 72px) 6vw 74px calc(var(--spine) + 5vw);
  display: grid;
  grid-template-columns: minmax(300px, 470px) minmax(460px, 1fr);
  gap: clamp(28px, 5vw, 84px);
  align-items: center;
  scroll-snap-align: start;
  isolation: isolate;
}

.lesson::before {
  content: "";
  position: absolute;
  left: var(--spine);
  right: 7vw;
  top: calc(var(--strip) + 28px);
  height: 1px;
  background: linear-gradient(90deg, var(--cyan), transparent 64%);
  opacity: .28;
}

.lesson-copy { max-width: 520px; }

.kicker {
  margin: 0 0 14px;
  color: var(--lime);
  font: 700 12px/1 "Space Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .18em;
}

h1, h2 {
  margin: 0;
  font-family: Nunito, system-ui, sans-serif;
  font-weight: 900;
  letter-spacing: -.055em;
  line-height: .9;
}

h1 { font-size: clamp(58px, 9vw, 124px); }
h2 { font-size: clamp(46px, 6.4vw, 92px); }

.lesson-copy p:not(.kicker) {
  max-width: 35rem;
  margin: 26px 0 18px;
  color: rgba(234, 247, 255, .78);
  font-size: clamp(17px, 1.5vw, 22px);
  line-height: 1.55;
}

code {
  display: inline-block;
  padding: 9px 13px;
  color: var(--cyan);
  font-family: "Space Mono", monospace;
  font-size: 13px;
  background: rgba(11, 16, 32, .74);
  border: 1px solid rgba(0, 245, 255, .32);
  box-shadow: inset 0 0 18px rgba(0, 245, 255, .06);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%);
}

.diagram {
  position: relative;
  min-height: min(62vh, 620px);
  background:
    linear-gradient(135deg, rgba(11, 16, 32, .56), rgba(5, 7, 13, .14)),
    repeating-linear-gradient(90deg, transparent 0 52px, rgba(234, 247, 255, .035) 53px 54px);
  border: 1px solid rgba(234, 247, 255, .08);
  clip-path: polygon(6% 0, 100% 0, 94% 100%, 0 100%, 0 10%);
  box-shadow: inset 0 0 0 1px rgba(0, 245, 255, .08), 0 0 42px rgba(0, 245, 255, .06);
}

.operator-note {
  position: absolute;
  z-index: 5;
  padding: 7px 10px;
  color: var(--white);
  font: 12px/1.2 "Space Mono", monospace;
  background: rgba(5, 7, 13, .86);
  border-left: 2px solid var(--cyan);
  box-shadow: 0 0 18px rgba(0, 245, 255, .12);
  opacity: .92;
}

.operator-note.amber, .amber { border-color: var(--amber); color: var(--amber); }

.n1 { left: 8%; top: 11%; }
.n2 { right: 8%; bottom: 12%; }

.limit-prism {
  position: absolute;
  inset: 14% 9% 16% 7%;
  background: linear-gradient(135deg, rgba(11, 16, 32, .92), rgba(5, 7, 13, .96));
  clip-path: polygon(12% 0, 88% 0, 100% 42%, 80% 100%, 7% 87%, 0 24%);
  border: 1px solid rgba(0, 245, 255, .5);
  box-shadow: 0 0 30px rgba(0, 245, 255, .15), inset 0 0 36px rgba(124, 61, 255, .16);
}

.prism-edge { position: absolute; background: var(--cyan); box-shadow: 0 0 14px var(--cyan); }
.e1 { left: 8%; top: 18%; width: 78%; height: 1px; transform: rotate(-10deg); }
.e2 { right: 17%; top: 10%; width: 1px; height: 78%; transform: rotate(16deg); background: var(--magenta); box-shadow: 0 0 14px var(--magenta); }
.e3 { left: 12%; bottom: 16%; width: 66%; height: 1px; transform: rotate(8deg); background: var(--lime); box-shadow: 0 0 14px var(--lime); }

.boot-word {
  position: absolute;
  left: 12%;
  top: 42%;
  color: var(--white);
  font-family: Nunito, system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(36px, 5.6vw, 74px);
  letter-spacing: -.05em;
  text-shadow: 0 0 18px rgba(255, 43, 214, .35);
}

.port-row { position: absolute; left: 13%; bottom: 18%; display: flex; gap: 16px; }
.port-row i { width: 13px; height: 13px; border: 1px solid var(--cyan); border-radius: 50%; box-shadow: 0 0 10px var(--cyan); animation: pulse 1.8s infinite alternate; }
.port-row i:nth-child(2n) { border-color: var(--lime); box-shadow: 0 0 10px var(--lime); animation-delay: .3s; }

@keyframes pulse { from { opacity: .35; transform: scale(.8); } to { opacity: 1; transform: scale(1.1); } }

.subnet-wedge {
  position: absolute;
  left: 4%; top: 22%; width: 88%; height: 46%;
  background: linear-gradient(100deg, rgba(124, 61, 255, .2), rgba(0, 245, 255, .08));
  clip-path: polygon(0 34%, 78% 0, 100% 100%, 18% 78%);
  border: 1px solid rgba(124, 61, 255, .7);
  box-shadow: inset 0 0 32px rgba(124, 61, 255, .12);
}

.gate-triangle {
  position: absolute;
  left: 47%; top: 31%; width: 160px; height: 160px;
  display: grid; place-items: center;
  color: var(--rack-black);
  font: 700 14px "Space Mono", monospace;
  background: var(--magenta);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  filter: drop-shadow(0 0 18px rgba(255, 43, 214, .65));
}

.packet { position: absolute; width: 12px; height: 12px; background: var(--cyan); border-radius: 50%; box-shadow: 0 0 14px var(--cyan); animation: packetMove 3.4s linear infinite; }
.p1 { left: 10%; top: 51%; }
.p2 { left: 16%; top: 45%; animation-delay: .8s; }
.blocked { left: 41%; top: 57%; background: var(--amber); box-shadow: 0 0 16px var(--amber); animation: blocked 1.7s ease-in-out infinite; }

@keyframes packetMove { 0% { transform: translateX(0); opacity: .2; } 70% { transform: translateX(335px); opacity: 1; } 100% { transform: translateX(455px); opacity: 0; } }
@keyframes blocked { 50% { transform: translate(34px, -10px) scale(1.45); } }

.route-svg { position: absolute; inset: 5% 3%; width: 94%; height: 86%; overflow: visible; }
.route-svg path { fill: none; stroke-linecap: square; stroke-linejoin: bevel; }
.route-shadow { stroke: rgba(234, 247, 255, .10); stroke-width: 12; }
.route-path { stroke-dasharray: 900; stroke-dashoffset: 900; animation: drawRoute 4s ease forwards infinite; }
.route-main { stroke: var(--cyan); stroke-width: 3; filter: drop-shadow(0 0 8px var(--cyan)); }
.route-alt { stroke: var(--violet); stroke-width: 2; animation-delay: .8s; filter: drop-shadow(0 0 8px var(--violet)); }
.node { fill: var(--console-ink); stroke-width: 3; }
.node-a { stroke: var(--lime); }
.node-b { stroke: var(--cyan); }
.node-c { stroke: var(--violet); }
@keyframes drawRoute { 0% { stroke-dashoffset: 900; } 55%, 100% { stroke-dashoffset: 0; } }
.route-packet { position: absolute; left: 8%; top: 52%; width: 14px; height: 14px; background: var(--lime); border-radius: 50%; box-shadow: 0 0 17px var(--lime); animation: routePacket 4s cubic-bezier(.7,0,.3,1) infinite; }
@keyframes routePacket { 0% { transform: translate(0,0); } 35% { transform: translate(185px,0); } 55% { transform: translate(290px,-92px); } 80%,100% { transform: translate(520px,-154px); } }

.container-box {
  position: absolute; left: 11%; top: 19%; width: 58%; height: 58%;
  background: rgba(11, 16, 32, .88);
  border: 1px solid var(--magenta);
  clip-path: polygon(0 0, 86% 0, 100% 18%, 92% 100%, 9% 100%, 0 86%);
  box-shadow: 0 0 22px rgba(255, 43, 214, .22), inset 0 0 30px rgba(255, 43, 214, .08);
}
.pressure { position: absolute; left: 5%; right: 6%; height: 1px; background: var(--amber); box-shadow: 0 0 12px var(--amber); animation: pressure 1.2s ease-in-out infinite alternate; }
.l1 { top: 24%; } .l2 { top: 50%; animation-delay: .2s; } .l3 { top: 76%; animation-delay: .4s; }
@keyframes pressure { to { transform: translateX(18px); opacity: .45; } }
.broken-chevron { position: absolute; left: 15%; top: 32%; color: var(--amber); font: 700 34px "Space Mono", monospace; text-shadow: 0 0 16px var(--amber); }
.nested-box { position: absolute; right: 8%; bottom: 14%; padding: 26px 20px; color: var(--cyan); font: 12px "Space Mono", monospace; border: 1px solid var(--cyan); box-shadow: inset 0 0 18px rgba(0, 245, 255, .14); }
.reroute-lane { position: absolute; right: 10%; top: 25%; width: 22%; height: 62%; border-top: 2px solid var(--lime); border-right: 2px solid var(--lime); transform: skewY(-22deg); box-shadow: 0 0 14px rgba(182, 255, 0, .55); }

.meter-shell { position: absolute; left: 10%; top: 24%; width: 72%; height: 28%; border: 1px solid var(--cyan); background: rgba(11, 16, 32, .7); clip-path: polygon(0 0, 95% 0, 100% 50%, 95% 100%, 0 100%); }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 68%; background: linear-gradient(90deg, rgba(182, 255, 0, .20), rgba(255, 176, 0, .65)); animation: meter 2.6s ease-in-out infinite alternate; }
@keyframes meter { to { width: 74%; } }
.cap-line { position: absolute; top: -28%; bottom: -28%; left: 75%; width: 2px; background: var(--amber); box-shadow: 0 0 18px var(--amber); }
.tick { position: absolute; top: 118%; width: 2px; height: 42px; background: var(--amber); box-shadow: 0 0 12px var(--amber); }
.t1 { left: 72%; } .t2 { left: 75%; height: 56px; } .t3 { left: 78%; }
.capped-route { position: absolute; left: 12%; right: 12%; bottom: 24%; height: 80px; border-bottom: 2px solid var(--cyan); transform: skewX(-18deg); }
.capped-route i { position: absolute; bottom: -8px; width: 14px; height: 14px; background: var(--cyan); border-radius: 50%; box-shadow: 0 0 14px var(--cyan); }
.capped-route i:nth-child(1) { left: 8%; } .capped-route i:nth-child(2) { left: 28%; } .capped-route i:nth-child(3) { left: 48%; }
.capped-route b { position: absolute; right: 22%; bottom: -22px; width: 34px; height: 44px; border: 2px solid var(--amber); border-left: 0; box-shadow: 0 0 16px var(--amber); }

.surface { background: radial-gradient(circle at 70% 51%, rgba(0, 245, 255, .08), transparent 17vw), #05070D; }
.surface-diagram { background: transparent; border-color: rgba(234, 247, 255, .035); box-shadow: none; }
.minimal-surface { position: absolute; right: 13%; top: 42%; width: 52%; height: 24%; }
.diamond { position: absolute; left: 0; top: 35%; width: 28px; height: 28px; background: var(--lime); transform: rotate(45deg); box-shadow: 0 0 20px var(--lime); animation: blink 1.4s steps(2,start) infinite; }
.surface-line { position: absolute; left: 45px; right: 82px; top: 50%; height: 1px; background: var(--cyan); box-shadow: 0 0 16px var(--cyan); }
.surface-cap { position: absolute; right: 55px; top: calc(50% - 31px); width: 2px; height: 62px; background: var(--magenta); box-shadow: 0 0 16px var(--magenta); }
.final-prompt { color: var(--lime); border-color: var(--lime); }

.lesson:not(.active-section) .operator-note { opacity: .45; }
.lesson.active-section .diagram { box-shadow: inset 0 0 0 1px rgba(0, 245, 255, .14), 0 0 60px rgba(0, 245, 255, .10); }

@media (max-width: 900px) {
  :root { --spine: 0px; --strip: 64px; }
  .command-strip { grid-template-columns: 130px 1fr; grid-template-areas: "mark typed" "lesson typed"; height: var(--strip); }
  .domain-mark { grid-area: mark; font-size: 15px; border-right: 0; }
  .lesson-readout { grid-area: lesson; padding-left: 18px; font-size: 10px; }
  .typed-line { grid-area: typed; font-size: 12px; padding-right: 10px; }
  .lesson-spine { display: none; }
  .lesson { grid-template-columns: 1fr; padding: calc(var(--strip) + 42px) 6vw 52px; }
  .diagram { min-height: 470px; }
  @keyframes packetMove { 70% { transform: translateX(180px); } 100% { transform: translateX(230px); opacity: 0; } }
}
