:root {
  color-scheme: dark;
  --black: #010303;
  --panel: rgba(2, 7, 8, 0.94);
  --ink: #d8d4ca;
  --muted: #9d9b93;
  --gold: #b88624;
  --gold-bright: #e0b556;
  --gold-line: rgba(190, 137, 32, 0.62);
  --gold-dim: rgba(190, 137, 32, 0.2);
  --cyan: #18c8d3;
  --cyan-dim: rgba(24, 200, 211, 0.22);
  --violet: #7651bb;
  --red: #c9594f;
  --green: #62b960;
  font-family: "Avenir Next Condensed", "Arial Narrow", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: #000;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 18%, rgba(21, 84, 93, 0.14), transparent 38rem),
    #000;
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

.codex {
  position: relative;
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 29%, rgba(42, 31, 75, 0.25), transparent 26%),
    radial-gradient(ellipse at 50% 44%, rgba(0, 134, 151, 0.1), transparent 34%),
    linear-gradient(rgba(184, 134, 36, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 200, 211, 0.018) 1px, transparent 1px),
    #010303;
  background-size: auto, auto, 26px 26px, 26px 26px, auto;
  box-shadow: 0 0 90px #000;
}

.codex::before,
.codex::after {
  content: "";
  position: absolute;
  z-index: 30;
  pointer-events: none;
  inset: 8px;
  border: 1px solid var(--gold-line);
}

.codex::after {
  inset: 13px;
  border-color: rgba(184, 134, 36, 0.24);
}

.edge {
  position: absolute;
  z-index: 31;
  left: 18px;
  right: 18px;
  height: 6px;
  pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--gold) 0 1px, transparent 1px 10px);
  opacity: 0.66;
}

.edge-top {
  top: 10px;
}

.edge-bottom {
  bottom: 10px;
}

.frame,
.rail,
.route-body {
  position: relative;
  border: 1px solid var(--gold-line);
  background:
    linear-gradient(145deg, rgba(24, 200, 211, 0.025), transparent 24%, transparent 76%, rgba(184, 134, 36, 0.04)),
    rgba(1, 5, 6, 0.9);
  box-shadow:
    inset 0 0 0 4px #010303,
    inset 0 0 0 5px rgba(184, 134, 36, 0.15);
}

.frame::before,
.rail::before,
.route-body::before {
  content: "";
  position: absolute;
  z-index: 2;
  pointer-events: none;
  inset: 5px;
  border: 1px solid rgba(184, 134, 36, 0.16);
  clip-path: polygon(0 0, 26px 0, 34px 8px, calc(100% - 34px) 8px, calc(100% - 26px) 0, 100% 0, 100% 100%, 0 100%);
}

.masthead {
  position: relative;
  display: grid;
  grid-template-columns: 125px minmax(0, 1fr) 125px;
  gap: 16px;
  align-items: center;
  padding: 16px 10px 12px;
}

.header-sigil,
.footer-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 104px;
  aspect-ratio: 1;
  margin: auto;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 16%, var(--gold-dim) 17% 18%, transparent 19% 36%, rgba(24, 200, 211, 0.2) 37% 38%, transparent 39%),
    repeating-conic-gradient(from 0deg, transparent 0 14deg, rgba(184, 134, 36, 0.35) 15deg 16deg);
  color: var(--gold-bright);
  font-family: Georgia, serif;
  font-size: 2rem;
}

.header-sigil::before,
.header-sigil::after,
.footer-orbit::before,
.footer-orbit::after {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1px solid var(--gold-line);
  transform: rotate(45deg);
}

.header-sigil::after,
.footer-orbit::after {
  inset: 27%;
  border-radius: 50%;
  transform: none;
}

.header-sigil:hover,
.header-sigil:focus-visible {
  outline: 1px solid var(--cyan);
  box-shadow: 0 0 24px var(--cyan-dim);
}

.mast-copy {
  min-width: 0;
}

.eyebrow,
.mast-copy h1,
.rail-title,
.section-cap,
.frame > h2,
.final-seal h2,
.final-seal p {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.09em;
  text-align: center;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 0.65rem;
}

.mast-copy h1 {
  margin: 0;
  color: #ddd6ca;
  font-size: clamp(2.2rem, 5.2vw, 4rem);
  font-weight: 500;
  line-height: 0.96;
  white-space: nowrap;
}

.mast-copy h1 span,
.final-seal h2 span {
  color: var(--gold-bright);
}

.meta-band {
  margin-top: 10px;
  border: 1px solid var(--gold-line);
  padding: 7px 12px;
  background: rgba(0, 0, 0, 0.54);
}

.meta-band p {
  margin: 2px 0;
  color: #b9b7b0;
  font-family: Georgia, serif;
  font-size: clamp(0.5rem, 1vw, 0.72rem);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.meta-band b {
  color: var(--gold-bright);
  font-weight: 500;
}

.pyramid-seal {
  position: relative;
  display: grid;
  place-items: center;
  width: 98px;
  aspect-ratio: 1;
  margin: auto;
  color: var(--gold);
  font-family: Georgia, serif;
}

.pyramid-seal::before,
.pyramid-seal::after {
  content: "";
  position: absolute;
  width: 78px;
  height: 70px;
  border: 1px solid var(--gold);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.pyramid-seal::after {
  width: 42px;
  height: 38px;
  top: 31px;
}

.pyramid-seal span {
  position: absolute;
  z-index: 1;
  top: 23px;
  font-size: 0.48rem;
}

.pyramid-seal b {
  z-index: 1;
  margin-top: 25px;
  font-size: 1.2rem;
  font-weight: 500;
}

.pyramid-seal small {
  position: absolute;
  bottom: -3px;
  font-size: 0.66rem;
  letter-spacing: 0.15em;
}

.master-grid {
  display: grid;
  grid-template-columns: 177px minmax(0, 1fr) 177px;
  gap: 8px;
  align-items: stretch;
}

.rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 4px;
}

.rail-title,
.section-cap {
  position: relative;
  z-index: 3;
  margin: 0;
  border-bottom: 1px solid var(--gold-line);
  padding: 6px 4px;
  color: var(--gold-bright);
  font-size: 0.74rem;
  font-weight: 500;
}

.rail-card,
.system-card,
.legend {
  position: relative;
  z-index: 3;
  flex: 1;
  border: 1px solid rgba(184, 134, 36, 0.38);
  margin-top: 5px;
  padding: 10px 7px;
  text-align: center;
}

.rail-card h3,
.system-card h3,
.legend h3 {
  margin: 0 0 8px;
  color: #d7d2c8;
  font-family: Georgia, serif;
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.25;
}

.rail-card p,
.system-card p,
.legend p {
  margin: 6px 0;
  color: #b2b2ab;
  font-family: Georgia, serif;
  font-size: 0.47rem;
  line-height: 1.55;
}

.rail-card strong {
  color: var(--gold-bright);
  font-family: Georgia, serif;
  font-size: 0.47rem;
  font-weight: 500;
  letter-spacing: 0.07em;
}

.mini-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 55px;
  aspect-ratio: 1;
  margin: 0 auto 9px;
  border: 1px solid var(--gold-line);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 18%, rgba(24, 200, 211, 0.26) 19% 20%),
    repeating-conic-gradient(transparent 0 20deg, rgba(184, 134, 36, 0.32) 21deg 22deg);
  color: var(--cyan);
  font-family: Georgia, serif;
  font-size: 1.3rem;
}

.mini-orbit::after {
  content: "";
  position: absolute;
  inset: 25%;
  border: 1px solid rgba(184, 134, 36, 0.52);
  transform: rotate(45deg);
}

.route-law-card {
  display: grid;
  align-content: center;
}

.route-loop {
  display: flex;
  justify-content: space-between;
  margin: 13px 5px;
}

.route-loop span {
  display: grid;
  place-items: center;
  width: 19px;
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-bright);
  font-size: 0.4rem;
}

.route-body {
  min-width: 0;
  overflow: hidden;
}

.section-cap {
  height: 30px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.section-cap b {
  color: var(--cyan);
  font-weight: 500;
}

.body-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 0.75;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 47% 42%, rgba(61, 42, 112, 0.25), transparent 24%),
    radial-gradient(ellipse at 48% 48%, rgba(18, 167, 180, 0.09), transparent 42%),
    #010405;
}

.body-stage::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 49.85%, rgba(224, 181, 86, 0.38) 50%, transparent 50.15%),
    linear-gradient(rgba(24, 200, 211, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184, 134, 36, 0.035) 1px, transparent 1px);
  background-size: auto, 24px 24px, 24px 24px;
}

.body-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.origin-label {
  position: absolute;
  z-index: 5;
  left: 4%;
  display: grid;
  width: 19%;
  color: var(--cyan);
  font-family: Georgia, serif;
  font-size: clamp(0.42rem, 0.8vw, 0.58rem);
  letter-spacing: 0.04em;
}

.origin-label::after {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(100% + 5px);
  width: 45px;
  border-top: 1px solid rgba(24, 200, 211, 0.45);
}

.origin-label span {
  margin-top: 2px;
  color: #86bfc3;
  font-size: 0.78em;
}

.label-source { top: 8%; }
.label-law { top: 18%; }
.label-body { top: 29%; }
.label-route { top: 43%; }
.label-memory { top: 58%; }
.label-return { top: 74%; }

.module-stack {
  position: absolute;
  z-index: 7;
  top: 4%;
  right: 3%;
  bottom: 8%;
  width: 36%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.module-card {
  position: relative;
  min-height: 7.6%;
  border: 1px solid rgba(184, 134, 36, 0.66);
  background: rgba(1, 5, 6, 0.82);
  padding: 4px 6px;
  color: var(--ink);
  text-align: left;
  transition: 160ms ease;
}

.module-card::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  width: 54%;
  border-top: 1px dotted rgba(224, 181, 86, 0.72);
}

.module-card::after {
  content: "";
  position: absolute;
  top: calc(50% - 3px);
  left: -57%;
  width: 5px;
  aspect-ratio: 1;
  border: 1px solid var(--gold-bright);
  border-radius: 50%;
  background: #030606;
}

.module-card:hover,
.module-card:focus-visible,
.module-card.is-active {
  border-color: var(--cyan);
  outline: none;
  color: white;
  box-shadow: 0 0 18px rgba(24, 200, 211, 0.12);
  transform: translateX(-4px);
}

.module-card b {
  display: block;
  font-family: Georgia, serif;
  font-size: clamp(0.43rem, 0.82vw, 0.62rem);
  font-weight: 500;
  line-height: 1.1;
}

.module-card span {
  display: block;
  margin-top: 2px;
  color: var(--gold-bright);
  font-family: Georgia, serif;
  font-size: clamp(0.31rem, 0.58vw, 0.45rem);
  line-height: 1.15;
}

.core-trigger {
  position: absolute;
  z-index: 8;
  top: 42%;
  left: 45.5%;
  display: grid;
  place-items: center;
  width: 13%;
  aspect-ratio: 1;
  border: 1px solid var(--gold-bright);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 134, 36, 0.23), rgba(0, 4, 5, 0.96) 67%);
  color: var(--gold-bright);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 22px rgba(24, 200, 211, 0.18);
}

.core-trigger span {
  font-family: Georgia, serif;
  font-size: clamp(0.8rem, 2.3vw, 1.8rem);
}

.core-trigger small {
  color: var(--cyan);
  font-size: 0.3rem;
  letter-spacing: 0.15em;
}

.return-mark {
  position: absolute;
  z-index: 4;
  bottom: 2%;
  left: 45.5%;
  display: grid;
  place-items: center;
  color: var(--gold-bright);
  font-family: Georgia, serif;
  transform: translateX(-50%);
}

.return-mark span {
  font-size: 2rem;
  line-height: 0.6;
}

.return-mark b {
  margin-top: 9px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
}

.system-card {
  display: grid;
  place-items: center;
  align-content: center;
}

.system-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 86px;
  aspect-ratio: 1;
  margin-bottom: 8px;
  border: 1px solid rgba(24, 200, 211, 0.42);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 12%, rgba(184, 134, 36, 0.4) 13% 14%, transparent 15% 21%, rgba(24, 200, 211, 0.28) 22% 23%),
    repeating-conic-gradient(transparent 0 15deg, rgba(24, 200, 211, 0.28) 16deg 17deg);
  color: #ddd6ca;
  font-family: Georgia, serif;
  font-size: 1.7rem;
}

.os-orbit span {
  color: #a8d9da;
}

.wire-poly {
  position: relative;
  width: 76px;
  aspect-ratio: 1;
  margin: 5px auto 12px;
  border: 1px solid var(--cyan);
  clip-path: polygon(50% 0, 96% 25%, 96% 75%, 50% 100%, 4% 75%, 4% 25%);
  background:
    linear-gradient(30deg, transparent 49%, rgba(24, 200, 211, 0.7) 50%, transparent 51%),
    linear-gradient(-30deg, transparent 49%, rgba(24, 200, 211, 0.7) 50%, transparent 51%),
    linear-gradient(90deg, transparent 49%, rgba(24, 200, 211, 0.7) 50%, transparent 51%);
}

.wire-poly::before,
.wire-poly::after {
  content: "";
  position: absolute;
  inset: 15%;
  border: 1px solid var(--cyan);
  transform: rotate(45deg);
}

.wire-poly::after {
  transform: rotate(0);
  border-radius: 50%;
}

.current-swirl {
  width: 80px;
  aspect-ratio: 1;
  margin-bottom: 10px;
  border-radius: 50%;
  background: repeating-radial-gradient(ellipse at center, transparent 0 7%, rgba(24, 200, 211, 0.58) 8% 9%, transparent 10% 16%);
  transform: rotate(-24deg) skewX(20deg);
}

.legend {
  flex: 0 0 auto;
  text-align: left;
}

.legend h3 {
  text-align: center;
}

.legend p {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 4px 7px;
}

.legend i {
  display: inline-block;
  width: 12px;
  height: 8px;
}

.key-node {
  border: 1px solid var(--cyan);
  border-radius: 50%;
}

.key-route { border-top: 1px solid var(--gold-bright); }
.key-law { border-top: 1px dotted var(--gold-bright); }
.key-flow { border-top: 2px solid var(--violet); }

.integration,
.anatomy-strip,
.equation-band,
.route-band,
.final-seal {
  margin-top: 8px;
}

.integration,
.anatomy-strip,
.equation-band {
  padding: 12px;
}

.frame > h2 {
  position: relative;
  z-index: 3;
  margin: 0 0 10px;
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-weight: 500;
}

.triptych {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.pillar {
  min-height: 175px;
  display: grid;
  place-items: center;
  align-content: space-between;
  border: 1px solid rgba(184, 134, 36, 0.42);
  background: rgba(0, 5, 6, 0.78);
  padding: 8px;
  color: var(--ink);
}

.pillar:hover,
.pillar:focus-visible {
  border-color: var(--cyan);
  outline: none;
  box-shadow: inset 0 0 20px rgba(24, 200, 211, 0.08);
}

.pillar-no {
  justify-self: start;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 0.55rem;
}

.pillar strong {
  color: #d6d2c9;
  font-family: Georgia, serif;
  font-size: 0.62rem;
  font-weight: 500;
  text-align: center;
}

.pillar small {
  color: var(--gold-bright);
  font-family: Georgia, serif;
  font-size: 0.4rem;
  line-height: 1.4;
  text-align: center;
}

.glyph-grid {
  width: 116px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--gold-line);
}

.glyph-grid i {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid rgba(184, 134, 36, 0.27);
  color: var(--cyan);
  font-family: Georgia, serif;
  font-style: normal;
}

.toroid {
  position: relative;
  display: grid;
  place-items: center;
  width: 110px;
  height: 80px;
  border: 1px solid var(--gold-line);
  border-radius: 50%;
  background: repeating-radial-gradient(ellipse, transparent 0 8%, rgba(24, 200, 211, 0.24) 9% 10%, transparent 11% 16%);
  color: var(--gold-bright);
  font-size: 0.38rem;
  line-height: 1.15;
}

.kernel-map {
  position: relative;
  display: grid;
  place-items: center;
  width: 110px;
  aspect-ratio: 1;
  border: 1px solid var(--gold-line);
  border-radius: 50%;
  background:
    linear-gradient(45deg, transparent 49%, rgba(24, 200, 211, 0.55) 50%, transparent 51%),
    linear-gradient(-45deg, transparent 49%, rgba(24, 200, 211, 0.55) 50%, transparent 51%);
}

.kernel-map span {
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  aspect-ratio: 1;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  background: #010505;
  color: var(--gold-bright);
  font-family: Georgia, serif;
}

.kernel-map i {
  position: absolute;
  width: 6px;
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  border-radius: 50%;
}

.kernel-map i:nth-of-type(1) { top: 4px; }
.kernel-map i:nth-of-type(2) { right: 4px; }
.kernel-map i:nth-of-type(3) { bottom: 4px; }
.kernel-map i:nth-of-type(4) { left: 4px; }

.arc-body {
  position: relative;
  width: 110px;
  height: 105px;
  border-radius: 46%;
  background:
    linear-gradient(90deg, transparent 49%, var(--gold-bright) 50%, transparent 51%),
    repeating-radial-gradient(ellipse, transparent 0 8%, rgba(118, 81, 187, 0.35) 9% 10%, transparent 11% 16%);
}

.arc-body::before,
.arc-body::after {
  content: "";
  position: absolute;
  top: 10%;
  bottom: 10%;
  width: 48%;
  border: 1px solid var(--cyan);
  border-radius: 50%;
}

.arc-body::before { left: 0; }
.arc-body::after { right: 0; }

#stateOutput {
  position: relative;
  z-index: 4;
  display: block;
  margin-top: 8px;
  color: var(--cyan);
  font-family: Georgia, serif;
  font-size: 0.54rem;
  letter-spacing: 0.1em;
  text-align: center;
}

.anatomy-grid {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 2.1fr repeat(4, 1fr);
  gap: 5px;
}

.anatomy-grid > div {
  min-height: 118px;
  border: 1px solid rgba(184, 134, 36, 0.36);
  background: rgba(0, 6, 7, 0.76);
  padding: 7px;
  color: var(--gold-bright);
  font-family: Georgia, serif;
  font-size: 0.46rem;
  text-align: center;
}

.safe-map {
  position: relative;
  display: grid;
  grid-template: 1fr 1.1fr 1fr / 1fr 1.3fr 1fr;
  gap: 4px;
}

.safe {
  display: grid;
  place-items: center;
  border: 1px solid var(--green);
  background: rgba(98, 185, 96, 0.09);
  color: #75ca73;
}

.safe-top { grid-column: 2; }
.safe-left { grid-row: 2; }
.safe-right { grid-row: 2; grid-column: 3; }
.safe-bottom { grid-row: 3; grid-column: 2; }

.target {
  display: grid;
  place-items: center;
  grid-row: 2;
  grid-column: 2;
  border: 1px dashed var(--gold);
}

.anchor-map,
.depth-map,
.occluder-map,
.cap-map {
  display: grid;
  place-items: center;
  align-content: space-between;
}

.anchor-map i {
  display: grid;
  place-items: center;
  width: 30px;
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--cyan);
  font-style: normal;
}

.depth-map span {
  width: 80%;
  border: 1px solid rgba(24, 200, 211, 0.36);
  padding: 2px;
  transform: skewX(-20deg);
}

.occluder-map span {
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  border: 1px solid var(--red);
  background: repeating-linear-gradient(45deg, transparent 0 5px, rgba(201, 89, 79, 0.3) 6px 7px);
  color: var(--red);
  font-size: 1rem;
}

.cap-map span {
  border: 1px solid var(--gold-line);
  padding: 8px;
  color: var(--cyan);
  font-size: 0.65rem;
}

.anatomy-grid small {
  color: var(--muted);
  font-size: 0.36rem;
  line-height: 1.4;
}

.equation-band > div {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr 70px 1fr;
  gap: 15px;
  align-items: center;
}

.equation,
.delta {
  margin: 0;
  color: #ddd8ce;
  font-family: Georgia, serif;
  font-size: clamp(1.1rem, 2.8vw, 2rem);
  text-align: center;
}

.delta small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.36em;
  line-height: 1.35;
}

.equation-seal {
  width: 62px;
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 17%, rgba(184, 134, 36, 0.45) 18% 19%),
    #010505;
  color: var(--gold-bright);
  font-family: Georgia, serif;
  font-size: 1.1rem;
}

.route-band {
  position: relative;
  display: flex;
  justify-content: space-around;
  align-items: center;
  min-height: 100px;
  padding: 28px 18px 10px;
}

.route-band h2 {
  position: absolute;
  top: 5px;
  left: 0;
  width: 100%;
}

.route-band button {
  display: grid;
  place-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: #d7d2c8;
  font-family: Georgia, serif;
}

.route-band button span {
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  font-size: 1.2rem;
}

.route-band button b {
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.route-band button:hover span,
.route-band button:focus-visible span,
.route-band button.is-active span {
  border-color: var(--cyan);
  color: var(--cyan);
  outline: none;
  box-shadow: 0 0 16px var(--cyan-dim);
}

.route-band i {
  color: var(--gold);
  font-family: Georgia, serif;
  font-style: normal;
}

.final-seal {
  display: grid;
  grid-template-columns: 130px 1fr 130px;
  gap: 15px;
  align-items: center;
  min-height: 165px;
  padding: 12px 25px;
}

.final-seal h2 {
  margin: 0;
  color: #ddd8ce;
  font-size: clamp(1.4rem, 3.8vw, 2.8rem);
  font-weight: 500;
}

.final-seal h2 b {
  color: var(--gold-bright);
  font-weight: 500;
}

.final-seal p {
  margin: 8px 0 5px;
  color: var(--gold-bright);
  font-size: clamp(1rem, 2.5vw, 1.8rem);
}

.final-seal small {
  display: block;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 0.5rem;
  letter-spacing: 0.14em;
  text-align: center;
}

.footer-orbit {
  width: 92px;
  font-size: 1.5rem;
}

.trust-seal {
  display: grid;
  place-items: center;
  width: 92px;
  aspect-ratio: 1;
  margin: auto;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-bright);
  font-family: Georgia, serif;
  font-size: 0.57rem;
  line-height: 1.55;
  text-align: center;
}

dialog {
  width: min(90vw, 500px);
  border: 1px solid var(--gold-bright);
  background:
    repeating-linear-gradient(rgba(24, 200, 211, 0.03) 0 1px, transparent 1px 24px),
    #020607;
  color: var(--ink);
  padding: 28px;
  box-shadow: 0 0 80px #000;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
}

.dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  aspect-ratio: 1;
  border: 1px solid var(--gold-line);
  background: #020607;
  color: var(--gold-bright);
}

#dialogNumber {
  color: var(--cyan);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
}

#dialogTitle {
  margin: 5px 0 12px;
  color: var(--gold-bright);
  font-family: Georgia, serif;
  font-weight: 500;
  letter-spacing: 0.08em;
}

#dialogKicker {
  color: #ddd8ce;
  font-family: Georgia, serif;
  font-weight: 500;
}

#dialogBody {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.7;
}

#dialogRoute {
  border-top: 1px solid var(--gold-line);
  margin-top: 15px;
  padding-top: 15px;
  color: var(--cyan);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
}

[data-state="body"] { --cyan: #5fd1a3; --cyan-dim: rgba(95, 209, 163, 0.22); }
[data-state="state"] { --cyan: #76a9e9; --cyan-dim: rgba(118, 169, 233, 0.22); }
[data-state="route"] { --cyan: #d6a642; --cyan-dim: rgba(214, 166, 66, 0.22); }
[data-state="image"] { --cyan: #a46fd4; --cyan-dim: rgba(164, 111, 212, 0.22); }
[data-state="return"] { --cyan: #bb70ff; --cyan-dim: rgba(187, 112, 255, 0.22); }

@media (max-width: 900px) {
  .codex {
    padding: 13px;
  }

  .masthead {
    grid-template-columns: 95px minmax(0, 1fr) 95px;
    gap: 7px;
  }

  .header-sigil {
    width: 80px;
  }

  .pyramid-seal {
    width: 80px;
  }

  .master-grid {
    grid-template-columns: 135px minmax(0, 1fr) 135px;
    gap: 5px;
  }

  .rail-card,
  .system-card {
    padding: 7px 4px;
  }

  .mini-orbit {
    width: 42px;
  }

  .system-orbit {
    width: 62px;
  }

  .wire-poly,
  .current-swirl {
    width: 58px;
  }
}

@media (max-width: 700px) {
  .codex {
    padding: 9px;
  }

  .codex::before {
    inset: 4px;
  }

  .codex::after,
  .edge {
    display: none;
  }

  .masthead {
    grid-template-columns: 1fr;
    padding: 14px 4px 8px;
  }

  .header-sigil,
  .pyramid-seal {
    display: none;
  }

  .mast-copy h1 {
    font-size: clamp(1.8rem, 9vw, 3rem);
  }

  .meta-band p {
    white-space: normal;
  }

  .master-grid {
    grid-template-columns: 1fr;
  }

  .law-rail,
  .system-rail {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
  }

  .rail-title,
  .legend {
    grid-column: 1 / -1;
  }

  .rail-card,
  .system-card {
    margin-top: 0;
  }

  .route-body {
    grid-row: 1;
  }

  .body-stage {
    aspect-ratio: 0.68;
  }

  .module-card::before {
    width: 30%;
  }

  .module-card::after {
    left: -33%;
  }

  .triptych {
    grid-template-columns: 1fr 1fr;
  }

  .anatomy-grid {
    grid-template-columns: 1fr 1fr;
  }

  .safe-map {
    grid-column: 1 / -1;
  }

  .equation-band > div {
    grid-template-columns: 1fr;
  }

  .equation-seal {
    margin: auto;
  }

  .route-band {
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 32px;
  }

  .route-band i {
    display: none;
  }

  .final-seal {
    grid-template-columns: 1fr;
  }

  .footer-orbit,
  .trust-seal {
    display: none;
  }
}

@media (max-width: 460px) {
  .mast-copy h1 {
    font-size: 7.2vw;
    letter-spacing: 0.035em;
  }

  .law-rail,
  .system-rail,
  .triptych,
  .anatomy-grid {
    grid-template-columns: 1fr;
  }

  .rail-title,
  .legend,
  .safe-map {
    grid-column: auto;
  }

  .origin-label {
    display: none;
  }

  .module-stack {
    right: 2%;
    width: 46%;
  }

  .core-trigger {
    left: 38%;
  }

  .return-mark {
    left: 38%;
  }
}
