:root {
  color-scheme: dark;
  --ink: #f5f0e6;
  --muted: #aaa49a;
  --panel: rgba(13, 15, 16, 0.72);
  --panel-strong: rgba(13, 15, 16, 0.9);
  --line: rgba(245, 240, 230, 0.14);
  --cyan: #68d8e8;
  --amber: #f2b24d;
  --rose: #ff6474;
  --green: #71d68f;
  --violet: #b9a8ff;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  margin: 0;
  min-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 22%, rgba(75, 55, 38, 0.34), transparent 33%),
    radial-gradient(circle at 78% 70%, rgba(28, 74, 65, 0.28), transparent 37%),
    #090a0a;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 1140px;
  isolation: isolate;
}

#field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #090a0a;
}

.topbar,
.readout,
.equation-panel,
.orbit-panel,
.rsg-loop-panel,
.controls {
  position: absolute;
  z-index: 3;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.3);
}

.topbar {
  top: 18px;
  left: 18px;
  right: 18px;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  border-radius: 8px;
}

.brand {
  min-width: 230px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-context-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.site-context-links a {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(245, 240, 230, 0.15);
  border-radius: 6px;
  color: rgba(245, 240, 230, 0.8);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
}

.site-context-links a:hover {
  border-color: rgba(104, 216, 232, 0.52);
  color: var(--ink);
  background: rgba(104, 216, 232, 0.1);
}

.live-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px rgba(113, 214, 143, 0.9);
}

h1 {
  margin: 0;
  font-size: clamp(1rem, 1.6vw, 1.36rem);
  line-height: 1.1;
  letter-spacing: 0;
}

p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0;
  white-space: nowrap;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: min(500px, 52vw);
}

.tabs button,
.toggle {
  min-width: 0;
  min-height: 38px;
  border: 1px solid rgba(245, 240, 230, 0.16);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.tabs button:hover,
.toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(245, 240, 230, 0.32);
  background: rgba(255, 255, 255, 0.08);
}

.tabs button.is-active {
  border-color: rgba(104, 216, 232, 0.7);
  background: rgba(104, 216, 232, 0.15);
  box-shadow: inset 0 0 0 1px rgba(104, 216, 232, 0.24);
}

.readout {
  top: 112px;
  right: 18px;
  width: min(330px, calc(100vw - 36px));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(245, 240, 230, 0.1);
}

.readout div {
  min-height: 66px;
  padding: 12px 14px;
  background: var(--panel-strong);
}

.readout span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.readout strong {
  display: block;
  margin-top: 5px;
  font-size: 1.28rem;
  line-height: 1;
  letter-spacing: 0;
}

.equation-panel {
  top: 264px;
  right: 18px;
  width: min(330px, calc(100vw - 36px));
  padding: 13px 14px;
  border-radius: 8px;
}

.equation-panel > span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.equation-panel code {
  display: block;
  margin: 8px 0 10px;
  white-space: normal;
}

.equation-panel div {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 8px;
  align-items: baseline;
}

.equation-panel div span {
  color: var(--muted);
  font-size: 0.7rem;
}

.equation-panel strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.equation-panel .shift-key {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 11px;
}

.shift-key b {
  grid-column: 1 / -1;
  color: rgba(245, 240, 230, 0.86);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shift-key span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(245, 240, 230, 0.68);
  font-size: 0.65rem;
  line-height: 1.24;
  overflow-wrap: anywhere;
}

.shift-key i {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.shift-key .blue {
  background: #56a7ff;
  box-shadow: 0 0 12px rgba(86, 167, 255, 0.6);
}

.shift-key .red {
  background: #ff5c5c;
  box-shadow: 0 0 12px rgba(255, 92, 92, 0.58);
}

.shift-key .twist {
  background: #d86cff;
  box-shadow: 0 0 12px rgba(216, 108, 255, 0.6);
}

.equation-panel .wave-key {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html[data-light-display="wave"] .light-key {
  display: none;
}

html:not([data-light-display="wave"]) .wave-key {
  display: none;
}

.shift-key .node-high {
  background: #71d68f;
  box-shadow: 0 0 12px rgba(113, 214, 143, 0.66);
}

.shift-key .node-low {
  background: #ff5c5c;
  box-shadow: 0 0 12px rgba(255, 92, 92, 0.58);
}

.shift-key .node-blue {
  background: #56a7ff;
  box-shadow: 0 0 12px rgba(86, 167, 255, 0.6);
}

.shift-key .node-captured {
  background: #f2b24d;
  box-shadow: 0 0 12px rgba(242, 178, 77, 0.62);
}

.orbit-panel {
  top: 426px;
  right: 18px;
  width: min(330px, calc(100vw - 36px));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
  padding: 8px 12px;
  border-radius: 8px;
}

.orbit-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.orbit-title span,
.orbit-panel label span,
.light-mode-control > span,
.orbit-readout span {
  color: var(--muted);
  font-size: 0.72rem;
}

.orbit-title strong {
  color: var(--cyan);
  font-size: 0.92rem;
}

.orbit-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  width: min(306px, 100%);
}

.orbit-actions button {
  min-height: 24px;
  padding: 0 5px;
  border: 1px solid rgba(104, 216, 232, 0.28);
  border-radius: 7px;
  color: rgba(245, 240, 230, 0.82);
  background: rgba(104, 216, 232, 0.06);
  font-size: 0.64rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.orbit-actions button:hover {
  border-color: rgba(104, 216, 232, 0.52);
  color: var(--ink);
  background: rgba(104, 216, 232, 0.12);
}

.orbit-actions button.is-active {
  border-color: rgba(242, 178, 77, 0.68);
  color: var(--ink);
  background: rgba(242, 178, 77, 0.14);
}

.orbit-actions strong {
  justify-self: stretch;
  text-align: right;
  white-space: nowrap;
}

.orbit-panel label {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.orbit-panel label:first-of-type,
.simulation-speed-control,
.step-controls,
.light-mode-control,
.wave-recursion-control,
.object-position-control {
  grid-column: 1 / -1;
}

.simulation-speed-control strong {
  float: right;
  color: rgba(245, 240, 230, 0.84);
  font-size: 0.72rem;
  font-weight: 700;
}

.step-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.step-controls button {
  min-width: 0;
  min-height: 25px;
  padding: 0 6px;
  border: 1px solid rgba(104, 216, 232, 0.24);
  border-radius: 7px;
  color: rgba(245, 240, 230, 0.78);
  background: rgba(104, 216, 232, 0.055);
  font-size: 0.72rem;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-controls button:hover {
  border-color: rgba(104, 216, 232, 0.5);
  color: var(--ink);
  background: rgba(104, 216, 232, 0.12);
}

.light-mode-control {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.light-mode-control strong {
  float: right;
  color: rgba(245, 240, 230, 0.84);
  font-size: 0.72rem;
  font-weight: 700;
}

.wave-recursion-control strong {
  float: right;
  color: rgba(245, 240, 230, 0.84);
  font-size: 0.72rem;
  font-weight: 700;
}

.object-position-control {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 5px 0 1px;
  border-top: 1px solid rgba(245, 240, 230, 0.08);
}

.object-position-control > span {
  color: var(--muted);
  font-size: 0.72rem;
}

.object-position-control strong {
  float: right;
  color: rgba(245, 240, 230, 0.84);
  font-size: 0.72rem;
  font-weight: 700;
}

.object-select,
.object-pan-pad {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.object-select button,
.object-pan-pad button,
#throw-asteroid {
  min-width: 0;
  min-height: 24px;
  padding: 0 4px;
  border: 1px solid rgba(245, 240, 230, 0.14);
  border-radius: 7px;
  color: rgba(245, 240, 230, 0.76);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-select button {
  font-size: 0.72rem;
}

.object-select button:hover,
.object-pan-pad button:hover,
#throw-asteroid:hover {
  border-color: rgba(104, 216, 232, 0.46);
  color: var(--ink);
  background: rgba(104, 216, 232, 0.1);
}

.object-select button.is-active {
  color: var(--ink);
  border-color: rgba(104, 216, 232, 0.68);
  background: rgba(104, 216, 232, 0.14);
}

#throw-asteroid {
  width: 100%;
  color: rgba(245, 240, 230, 0.86);
  border-color: rgba(242, 178, 77, 0.28);
  background: rgba(242, 178, 77, 0.08);
}

.light-mode-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.light-mode-buttons button {
  min-width: 0;
  min-height: 25px;
  padding: 0 6px;
  border: 1px solid rgba(245, 240, 230, 0.14);
  border-radius: 7px;
  color: rgba(245, 240, 230, 0.74);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.light-mode-buttons button:hover {
  border-color: rgba(104, 216, 232, 0.46);
  color: var(--ink);
  background: rgba(104, 216, 232, 0.1);
}

.light-mode-buttons button.is-active {
  color: var(--ink);
  border-color: rgba(104, 216, 232, 0.68);
  background: rgba(104, 216, 232, 0.14);
}

.orbit-readout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 3px 8px;
  align-items: baseline;
}

.orbit-readout strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.rsg-loop-panel {
  top: 112px;
  left: 18px;
  width: min(360px, calc(100vw - 36px));
  padding: 13px 14px;
  border-radius: 8px;
}

.loop-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.loop-title span,
.measure-title span {
  color: var(--muted);
  font-size: 0.72rem;
}

.loop-title strong {
  color: var(--ink);
  font-size: 0.88rem;
}

.loop-help {
  width: 100%;
  margin: 7px 0 0;
  color: rgba(245, 240, 230, 0.68);
  font-size: 0.74rem;
  line-height: 1.42;
  white-space: normal;
}

.loop-stages {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin: 10px 0 12px;
}

.loop-stages b {
  min-width: 0;
  padding: 6px 5px;
  border: 1px solid rgba(245, 240, 230, 0.12);
  border-radius: 6px;
  color: rgba(245, 240, 230, 0.56);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.loop-stages b.is-active {
  color: var(--ink);
  border-color: rgba(104, 216, 232, 0.55);
  background: rgba(104, 216, 232, 0.16);
}

.measure-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.measure-title code {
  font-size: 0.72rem;
}

.measure-list {
  display: grid;
  gap: 6px;
}

.measure-row {
  display: grid;
  grid-template-columns: 34px 1fr 44px;
  gap: 8px;
  align-items: center;
}

.measure-row span,
.measure-row strong {
  color: rgba(245, 240, 230, 0.78);
  font-size: 0.72rem;
}

.measure-row i {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(245, 240, 230, 0.1);
}

.measure-row em {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--amber));
}

.controls {
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
  gap: 10px 12px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
}

.presets {
  display: grid;
  grid-template-rows: repeat(2, 32px);
  grid-auto-flow: column;
  grid-auto-columns: clamp(122px, 9vw, 154px);
  gap: 8px;
  grid-column: 1 / 4;
  grid-row: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.presets button {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 32px;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid rgba(245, 240, 230, 0.14);
  border-radius: 7px;
  color: rgba(245, 240, 230, 0.78);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presets button::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 6px 0 0 6px;
  background: var(--preset-accent, rgba(245, 240, 230, 0.2));
  opacity: 0.7;
}

.presets button[data-group="core"] {
  --preset-accent: rgba(104, 216, 232, 0.74);
  border-color: rgba(104, 216, 232, 0.28);
  background: rgba(104, 216, 232, 0.045);
}

.presets button[data-group="support"] {
  --preset-accent: rgba(113, 214, 143, 0.76);
  border-color: rgba(113, 214, 143, 0.3);
  background: rgba(113, 214, 143, 0.055);
}

.presets button[data-group="measure"] {
  --preset-accent: rgba(255, 100, 116, 0.74);
  border-color: rgba(255, 100, 116, 0.28);
  background: rgba(255, 100, 116, 0.045);
}

.presets button[data-group="geometry"] {
  --preset-accent: rgba(185, 168, 255, 0.78);
  border-color: rgba(185, 168, 255, 0.3);
  background: rgba(185, 168, 255, 0.055);
}

.presets button[data-group="render"] {
  --preset-accent: rgba(242, 178, 77, 0.78);
  border-color: rgba(242, 178, 77, 0.3);
  background: rgba(242, 178, 77, 0.052);
}

.presets button[data-group="blackhole"] {
  --preset-accent: rgba(255, 122, 149, 0.78);
  border-color: rgba(255, 122, 149, 0.3);
  background: rgba(255, 122, 149, 0.045);
}

.presets button[data-group="external"] {
  --preset-accent: rgba(153, 218, 196, 0.72);
  border-color: rgba(153, 218, 196, 0.28);
  background: rgba(153, 218, 196, 0.045);
}

.presets button:hover {
  color: var(--ink);
  border-color: rgba(104, 216, 232, 0.46);
  background: rgba(104, 216, 232, 0.1);
}

.presets button[data-preset="vLens"],
.presets button[data-preset="phaseBloom"] {
  color: rgba(245, 240, 230, 0.86);
  border-color: rgba(185, 168, 255, 0.34);
  background: rgba(185, 168, 255, 0.08);
}

.presets button[data-preset="surteaAustin"] {
  border-color: rgba(113, 214, 143, 0.3);
  background: rgba(113, 214, 143, 0.07);
}

.presets button[data-preset="fftSpectrum"],
.presets button[data-preset="vacuumSupport"],
.presets button[data-preset="vopsonBridge"],
.presets button[data-preset="probabilityMap"],
.presets button[data-preset="analogueTest"],
.presets button[data-preset="surteaKelleyPhase"],
.presets button[data-preset="angleFreeLorentz"] {
  border-color: rgba(104, 216, 232, 0.28);
  background: rgba(104, 216, 232, 0.065);
}

.presets button[data-preset="probabilityMap"] {
  border-color: rgba(255, 100, 116, 0.3);
  background: rgba(255, 100, 116, 0.065);
}

.presets button[data-preset="analogueTest"] {
  border-color: rgba(104, 216, 232, 0.34);
  background: rgba(104, 216, 232, 0.07);
}

.presets button[data-preset="surteaKelleyPhase"] {
  border-color: rgba(185, 168, 255, 0.34);
  background: rgba(185, 168, 255, 0.08);
}

.presets button[data-preset="angleFreeLorentz"] {
  border-color: rgba(242, 178, 77, 0.34);
  background: rgba(242, 178, 77, 0.07);
}

.presets button[data-preset="vacuumSupport"] {
  border-color: rgba(113, 214, 143, 0.3);
  background: rgba(113, 214, 143, 0.065);
}

.presets button[data-preset="vopsonBridge"] {
  border-color: rgba(242, 178, 77, 0.3);
  background: rgba(242, 178, 77, 0.065);
}

.presets button.is-active {
  color: var(--ink);
  border-color: rgba(242, 178, 77, 0.7);
  background:
    linear-gradient(135deg, rgba(242, 178, 77, 0.18), rgba(104, 216, 232, 0.1)),
    rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(242, 178, 77, 0.18);
}

.controls label:nth-of-type(1) {
  grid-column: 1;
  grid-row: 2;
}

.controls label:nth-of-type(2) {
  grid-column: 2;
  grid-row: 2;
}

.controls label:nth-of-type(3) {
  grid-column: 3;
  grid-row: 2;
}

.controls label:nth-of-type(4) {
  grid-column: 4;
  grid-row: 2;
}

.controls label:nth-of-type(5) {
  grid-column: 5;
  grid-row: 2;
}

.controls label:nth-of-type(6) {
  grid-column: 6;
  grid-row: 2;
}

.controls label:nth-of-type(7) {
  grid-column: 7;
  grid-row: 2;
}

.explanation {
  position: relative;
  z-index: 2;
  padding: clamp(34px, 7vw, 72px) 18px clamp(54px, 8vw, 86px);
  border-top: 1px solid rgba(245, 240, 230, 0.12);
  background:
    linear-gradient(180deg, rgba(9, 10, 10, 0.94), rgba(12, 14, 13, 0.98)),
    radial-gradient(circle at 18% 0%, rgba(104, 216, 232, 0.1), transparent 34%),
    radial-gradient(circle at 84% 38%, rgba(242, 178, 77, 0.1), transparent 32%);
}

.explanation-inner {
  width: min(920px, 100%);
  margin: 0 auto;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--amber);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

h2 {
  margin: 0 0 20px;
  color: var(--ink);
  font-size: clamp(1.7rem, 3vw, 2.55rem);
  line-height: 1.05;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  scroll-margin-top: 24px;
}

.explanation p:not(.eyebrow) {
  width: min(760px, 100%);
  margin: 0 0 18px;
  color: rgba(245, 240, 230, 0.82);
  font-size: clamp(0.98rem, 1.5vw, 1.12rem);
  line-height: 1.68;
  white-space: normal;
  overflow-wrap: anywhere;
}

code {
  display: inline;
  padding: 0.08em 0.32em;
  border: 1px solid rgba(245, 240, 230, 0.16);
  border-radius: 5px;
  color: var(--cyan);
  background: rgba(255, 255, 255, 0.05);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.quick-read {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 28px;
}

.quick-read div,
.guide-grid article,
.mode-guide,
.plain-guide {
  min-width: 0;
  border: 1px solid rgba(245, 240, 230, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.quick-read div {
  padding: 14px;
}

.quick-read strong,
.quick-read span {
  display: block;
  overflow-wrap: anywhere;
}

.quick-read strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.quick-read span {
  margin-top: 6px;
  color: rgba(245, 240, 230, 0.68);
  font-size: 0.84rem;
  line-height: 1.45;
}

.chapter-gateway {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 28px;
}

.chapter-gateway a {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(104, 216, 232, 0.2);
  border-radius: 8px;
  color: rgba(245, 240, 230, 0.82);
  text-decoration: none;
  background:
    linear-gradient(135deg, rgba(104, 216, 232, 0.06), rgba(242, 178, 77, 0.035)),
    rgba(255, 255, 255, 0.032);
}

.chapter-gateway a:hover {
  border-color: rgba(104, 216, 232, 0.5);
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(104, 216, 232, 0.12), rgba(242, 178, 77, 0.055)),
    rgba(255, 255, 255, 0.045);
}

.chapter-gateway strong,
.chapter-gateway span {
  display: block;
  overflow-wrap: anywhere;
}

.chapter-gateway strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.chapter-gateway span {
  margin-top: 6px;
  color: rgba(245, 240, 230, 0.68);
  font-size: 0.84rem;
  line-height: 1.45;
}

.guide-grid {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 30px 0;
}

.plain-guide {
  width: min(840px, 100%);
  padding: 20px;
  margin: 0 0 26px;
  background:
    linear-gradient(135deg, rgba(104, 216, 232, 0.08), rgba(242, 178, 77, 0.05)),
    rgba(255, 255, 255, 0.035);
}

.guide-grid article {
  padding: 16px;
}

.legend-shot {
  width: 100%;
  aspect-ratio: 1.64;
  margin: 0 0 12px;
  overflow: hidden;
  border: 1px solid rgba(245, 240, 230, 0.12);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.24);
}

.legend-shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.plain-guide p,
.guide-grid p,
.mode-guide p {
  white-space: normal;
  overflow-wrap: anywhere;
}

.plain-guide p {
  width: 100%;
  margin: 0 0 14px;
  color: rgba(245, 240, 230, 0.8);
  font-size: 0.98rem;
  line-height: 1.62;
}

.plain-guide p:last-child {
  margin-bottom: 0;
}

.guide-grid p {
  margin: 0;
  color: rgba(245, 240, 230, 0.7);
  font-size: 0.9rem;
  line-height: 1.52;
}

.mode-guide {
  width: min(760px, 100%);
  padding: 18px;
  margin: 18px 0;
}

.preset-provenance {
  width: min(920px, 100%);
}

.mode-guide p {
  width: 100%;
  margin: 0 0 12px;
  color: rgba(245, 240, 230, 0.78);
  font-size: 0.94rem;
  line-height: 1.58;
}

.mode-guide p:last-child {
  margin-bottom: 0;
}

.glossary {
  width: min(920px, 100%);
  margin-top: 22px;
  border: 1px solid rgba(245, 240, 230, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.glossary summary {
  padding: 16px 18px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.glossary dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  border-top: 1px solid rgba(245, 240, 230, 0.1);
  background: rgba(245, 240, 230, 0.08);
}

.glossary div {
  min-width: 0;
  padding: 14px 16px;
  background: rgba(8, 10, 10, 0.74);
}

.glossary dt {
  color: var(--cyan);
  font-weight: 700;
}

.glossary dd {
  margin: 6px 0 0;
  color: rgba(245, 240, 230, 0.74);
  font-size: 0.92rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.surtea-zoom {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(360px, 1fr);
  gap: 26px;
  align-items: start;
  margin-top: clamp(34px, 7vw, 72px);
  padding-top: clamp(26px, 5vw, 48px);
  border-top: 1px solid rgba(245, 240, 230, 0.12);
}

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

.surtea-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(245, 240, 230, 0.13);
  border-radius: 8px;
  background:
    radial-gradient(circle at 42% 42%, rgba(104, 216, 232, 0.12), transparent 34%),
    rgba(255, 255, 255, 0.035);
}

.surtea-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(245, 240, 230, 0.11);
  border-radius: 8px;
  background: rgba(8, 10, 10, 0.72);
}

.surtea-grid span {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid rgba(245, 240, 230, 0.08);
  border-radius: 4px;
  background: rgba(245, 240, 230, 0.025);
}

.surtea-grid .interior,
.surtea-legend i.interior {
  background: rgba(113, 214, 143, 0.48);
  border-color: rgba(113, 214, 143, 0.72);
}

.surtea-grid .boundary,
.surtea-legend i.boundary {
  background: rgba(255, 100, 116, 0.5);
  border-color: rgba(255, 100, 116, 0.8);
}

.surtea-grid .closure,
.surtea-legend i.closure {
  background: rgba(242, 178, 77, 0.34);
  border-color: rgba(242, 178, 77, 0.72);
}

.surtea-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.surtea-legend div {
  min-width: 0;
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 4px 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(245, 240, 230, 0.1);
  border-radius: 7px;
  background: rgba(8, 10, 10, 0.52);
}

.surtea-legend i {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(245, 240, 230, 0.16);
  border-radius: 4px;
  background: rgba(245, 240, 230, 0.035);
}

.surtea-legend strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.surtea-legend span {
  grid-column: 2;
  color: rgba(245, 240, 230, 0.7);
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.surtea-formula {
  display: grid;
  gap: 9px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(104, 216, 232, 0.16);
  border-radius: 8px;
  background: rgba(104, 216, 232, 0.055);
}

.surtea-formula span {
  color: rgba(245, 240, 230, 0.76);
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.correspondence-layers {
  width: min(1040px, 100%);
  margin-top: clamp(34px, 7vw, 72px);
  padding-top: clamp(26px, 5vw, 48px);
  border-top: 1px solid rgba(245, 240, 230, 0.12);
}

.concept-grid {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.concept-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(250px, 0.78fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
  padding: 18px;
  border: 1px solid rgba(245, 240, 230, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(104, 216, 232, 0.055), rgba(242, 178, 77, 0.035)),
    rgba(255, 255, 255, 0.032);
}

.concept-card > div {
  min-width: 0;
}

.concept-card p {
  width: 100%;
  margin: 0 0 13px;
  color: rgba(245, 240, 230, 0.78);
  font-size: 0.94rem;
  line-height: 1.58;
  overflow-wrap: anywhere;
}

.concept-card p:last-child {
  margin-bottom: 0;
}

.concept-graphic {
  position: relative;
  min-width: 0;
  min-height: 210px;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(245, 240, 230, 0.11);
  border-radius: 8px;
  background:
    linear-gradient(rgba(245, 240, 230, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245, 240, 230, 0.045) 1px, transparent 1px),
    rgba(8, 10, 10, 0.72);
  background-size: 28px 28px;
}

.concept-graphic::after {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(104, 216, 232, 0.12), transparent 64%);
  pointer-events: none;
}

.layer-row,
.ghost-cell,
.cell-chip,
.maturation-cells,
.render-cell,
.pair-cell {
  position: relative;
  z-index: 1;
}

.layer-row {
  width: min(260px, 100%);
  display: grid;
  grid-template-columns: 58px repeat(5, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.layer-row span {
  color: rgba(245, 240, 230, 0.72);
  font-size: 0.78rem;
  font-weight: 700;
}

.layer-row i,
.ghost-cell i,
.cell-chip i,
.maturation-cells i,
.render-cell i,
.pair-cell i {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid rgba(245, 240, 230, 0.1);
  border-radius: 4px;
  background: rgba(245, 240, 230, 0.035);
}

.concept-graphic .interior {
  background: rgba(113, 214, 143, 0.48);
  border-color: rgba(113, 214, 143, 0.72);
}

.concept-graphic .boundary {
  background: rgba(255, 100, 116, 0.5);
  border-color: rgba(255, 100, 116, 0.8);
}

.concept-graphic .closure {
  background: rgba(242, 178, 77, 0.36);
  border-color: rgba(242, 178, 77, 0.72);
}

.concept-graphic .phase {
  background: rgba(104, 216, 232, 0.42);
  border-color: rgba(104, 216, 232, 0.72);
}

.concept-graphic .measure {
  background: rgba(242, 178, 77, 0.44);
  border-color: rgba(242, 178, 77, 0.72);
}

.concept-graphic .survive {
  background: rgba(113, 214, 143, 0.5);
  border-color: rgba(113, 214, 143, 0.72);
}

.concept-graphic .weak {
  opacity: 0.45;
}

.layered-graphic {
  align-content: center;
  gap: 10px;
}

.memory-stack {
  position: relative;
  z-index: 1;
  width: min(280px, 100%);
  height: 222px;
}

.ghost-cell {
  position: absolute;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: 118px;
  padding: 7px;
  border: 1px solid rgba(245, 240, 230, 0.11);
  border-radius: 8px;
  background: rgba(8, 10, 10, 0.76);
}

.ghost-cell.older {
  top: 4px;
  left: 18px;
  opacity: 0.42;
}

.ghost-cell.middle {
  top: 54px;
  left: 76px;
  opacity: 0.68;
}

.ghost-cell.current {
  top: 104px;
  left: 134px;
}

.memory-arc {
  position: absolute;
  z-index: 2;
  width: 168px;
  height: 102px;
  border-top: 2px solid rgba(104, 216, 232, 0.5);
  border-right: 2px solid rgba(104, 216, 232, 0.28);
  border-radius: 50%;
  transform: rotate(-18deg);
}

.clock-ring {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 126px;
  height: 126px;
  border: 2px dashed rgba(104, 216, 232, 0.55);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 0.9rem;
  font-weight: 800;
  background: rgba(104, 216, 232, 0.055);
}

.loss-channel {
  position: absolute;
  z-index: 2;
  top: 30px;
  right: 28px;
  display: grid;
  gap: 7px;
  width: 74px;
}

.loss-channel b {
  height: 12px;
  border-radius: 999px;
  background: rgba(245, 240, 230, 0.16);
}

.loss-channel b.hot {
  background: rgba(255, 100, 116, 0.64);
}

.loss-channel b.cool {
  background: rgba(113, 214, 143, 0.54);
}

.cell-chip {
  position: absolute;
  z-index: 2;
  left: 28px;
  bottom: 26px;
  display: grid;
  grid-template-columns: repeat(3, 24px);
  gap: 5px;
  padding: 8px;
  border: 1px solid rgba(245, 240, 230, 0.1);
  border-radius: 8px;
  background: rgba(8, 10, 10, 0.72);
}

.z-ladder {
  position: relative;
  z-index: 2;
  width: min(240px, 100%);
  display: grid;
  gap: 9px;
}

.z-ladder span {
  color: rgba(245, 240, 230, 0.72);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.z-ladder i {
  display: block;
  height: 13px;
  border-radius: 999px;
  background: rgba(245, 240, 230, 0.09);
  overflow: hidden;
}

.z-ladder i::before {
  content: "";
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 100, 116, 0.7), rgba(242, 178, 77, 0.7), rgba(113, 214, 143, 0.6));
}

.xi-path {
  position: absolute;
  z-index: 1;
  inset: 32px 24px 32px;
  display: grid;
  gap: 18px;
  transform: rotate(-10deg);
}

.xi-path i {
  display: block;
  height: 38px;
  border-top: 2px solid rgba(104, 216, 232, 0.58);
  border-bottom: 1px solid rgba(242, 178, 77, 0.2);
  border-radius: 50%;
}

.xi-ladder {
  position: absolute;
  z-index: 2;
  left: 26px;
  bottom: 24px;
  display: grid;
  grid-template-columns: 28px repeat(4, 16px);
  align-items: end;
  gap: 7px;
  height: 112px;
}

.xi-ladder span {
  align-self: center;
  color: var(--cyan);
  font-size: 0.84rem;
  font-weight: 800;
}

.xi-ladder b {
  display: block;
  height: var(--h);
  border: 1px solid rgba(104, 216, 232, 0.42);
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, rgba(104, 216, 232, 0.5), rgba(242, 178, 77, 0.42));
}

.xi-note {
  position: relative;
  z-index: 3;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(104, 216, 232, 0.28);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(8, 10, 10, 0.72);
}

.xi-note strong {
  color: var(--cyan);
  font-size: 0.9rem;
}

.xi-note span {
  color: rgba(245, 240, 230, 0.68);
  font-size: 0.78rem;
}

.zuom-ring {
  position: absolute;
  z-index: 1;
  width: 194px;
  height: 194px;
  border: 1px solid rgba(245, 240, 230, 0.22);
  border-radius: 50%;
}

.zuom-ring::before,
.zuom-ring::after {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(104, 216, 232, 0.24);
  transform: rotate(45deg);
}

.zuom-ring::after {
  inset: 48px;
  border-color: rgba(242, 178, 77, 0.26);
  border-radius: 50%;
  transform: none;
}

.zuom-ring span {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(242, 178, 77, 0.7);
  border-radius: 5px;
  background: rgba(242, 178, 77, 0.5);
  box-shadow: 0 0 18px rgba(242, 178, 77, 0.16);
}

.zuom-ring span:nth-child(1) { top: -8px; left: 89px; }
.zuom-ring span:nth-child(2) { top: 22px; right: 22px; }
.zuom-ring span:nth-child(3) { top: 89px; right: -8px; }
.zuom-ring span:nth-child(4) { right: 22px; bottom: 22px; }
.zuom-ring span:nth-child(5) { bottom: -8px; left: 89px; }
.zuom-ring span:nth-child(6) { left: 22px; bottom: 22px; }
.zuom-ring span:nth-child(7) { top: 89px; left: -8px; }
.zuom-ring span:nth-child(8) { top: 22px; left: 22px; }

.zuom-core {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border: 1px solid rgba(104, 216, 232, 0.5);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 0.9rem;
  font-weight: 800;
  background: rgba(104, 216, 232, 0.1);
}

.zuom-checks {
  position: absolute;
  z-index: 3;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 7px;
}

.zuom-checks b {
  padding: 5px 8px;
  border: 1px solid rgba(113, 214, 143, 0.36);
  border-radius: 6px;
  color: rgba(245, 240, 230, 0.82);
  font-size: 0.72rem;
  background: rgba(113, 214, 143, 0.08);
}

.zuom-checks b.muted {
  border-color: rgba(255, 100, 116, 0.28);
  color: rgba(245, 240, 230, 0.48);
  text-decoration: line-through;
  background: rgba(255, 100, 116, 0.055);
}

.maturation-cells {
  position: absolute;
  z-index: 1;
  right: 22px;
  bottom: 22px;
  display: grid;
  grid-template-columns: repeat(8, 16px);
  gap: 4px;
  opacity: 0.84;
}

.wave-lines {
  position: absolute;
  z-index: 1;
  top: 28px;
  left: 24px;
  right: 24px;
  display: grid;
  gap: 13px;
}

.wave-lines i {
  display: block;
  height: 18px;
  border-top: 2px solid rgba(104, 216, 232, 0.52);
  border-radius: 50%;
  transform: skewX(-18deg);
}

.render-cell {
  position: absolute;
  z-index: 2;
  right: 28px;
  bottom: 26px;
  display: grid;
  grid-template-columns: repeat(8, 16px);
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(245, 240, 230, 0.1);
  border-radius: 8px;
  background: rgba(8, 10, 10, 0.75);
}

.render-core {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border: 1px solid rgba(242, 178, 77, 0.58);
  border-radius: 50%;
  color: var(--amber);
  font-size: 0.88rem;
  font-weight: 800;
  background: rgba(242, 178, 77, 0.12);
  box-shadow: 0 0 36px rgba(242, 178, 77, 0.12);
}

.pair-waves {
  position: absolute;
  z-index: 1;
  inset: 34px 24px auto;
  display: grid;
  gap: 26px;
}

.pair-waves i {
  display: block;
  height: 42px;
  border-top: 2px solid rgba(104, 216, 232, 0.58);
  border-bottom: 1px solid rgba(104, 216, 232, 0.22);
  border-radius: 50%;
}

.pair-waves i:first-child {
  transform: rotate(8deg);
}

.pair-waves i:last-child {
  transform: rotate(-8deg);
}

.threshold-gauge {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  gap: 6px;
  width: min(210px, 92%);
  padding: 14px;
  border: 1px solid rgba(255, 100, 116, 0.52);
  border-radius: 8px;
  color: var(--ink);
  text-align: center;
  background: rgba(255, 100, 116, 0.12);
  box-shadow: 0 0 42px rgba(255, 100, 116, 0.1);
}

.threshold-gauge strong {
  color: var(--rose);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.threshold-gauge span {
  color: rgba(245, 240, 230, 0.72);
  font-size: 0.78rem;
}

.pair-cell {
  position: absolute;
  z-index: 2;
  right: 22px;
  bottom: 20px;
  display: grid;
  grid-template-columns: repeat(6, 16px);
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(245, 240, 230, 0.1);
  border-radius: 8px;
  background: rgba(8, 10, 10, 0.74);
}

.pair-products {
  position: absolute;
  z-index: 3;
  left: 26px;
  bottom: 26px;
  display: flex;
  gap: 10px;
}

.pair-products span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(104, 216, 232, 0.4);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 800;
  background: rgba(104, 216, 232, 0.08);
}

.pair-products span:last-child {
  border-color: rgba(255, 100, 116, 0.45);
  color: var(--rose);
  background: rgba(255, 100, 116, 0.08);
}

.concept-formula {
  display: inline-grid;
  max-width: 100%;
  margin-top: 2px;
}

.source-library {
  width: min(1040px, 100%);
  margin-top: clamp(38px, 7vw, 76px);
  padding-top: clamp(26px, 5vw, 48px);
  border-top: 1px solid rgba(245, 240, 230, 0.12);
}

.library-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 18px;
  align-items: end;
}

.library-head p:not(.eyebrow) {
  width: min(820px, 100%);
}

.library-link {
  min-width: max-content;
  padding: 10px 13px;
  border: 1px solid rgba(104, 216, 232, 0.28);
  border-radius: 7px;
  color: var(--ink);
  text-decoration: none;
  background: rgba(104, 216, 232, 0.08);
}

.library-link:hover {
  border-color: rgba(104, 216, 232, 0.54);
  background: rgba(104, 216, 232, 0.14);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.source-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(245, 240, 230, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(104, 216, 232, 0.05), rgba(113, 214, 143, 0.025)),
    rgba(255, 255, 255, 0.032);
}

.source-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid rgba(242, 178, 77, 0.28);
  border-radius: 999px;
  color: var(--amber);
  background: rgba(242, 178, 77, 0.06);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.source-card h3 {
  margin-top: 12px;
}

.source-card p {
  width: 100%;
  margin: 0 0 14px;
  color: rgba(245, 240, 230, 0.76);
  font-size: 0.92rem;
  line-height: 1.56;
  white-space: normal;
  overflow-wrap: anywhere;
}

.source-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-card li {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(245, 240, 230, 0.09);
  border-radius: 6px;
  color: rgba(245, 240, 230, 0.72);
  background: rgba(8, 10, 10, 0.48);
  font-size: 0.78rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.source-card li a {
  color: rgba(245, 240, 230, 0.76);
  text-decoration: none;
}

.source-card li a:hover {
  color: var(--cyan);
}

.site-footer {
  width: min(1040px, 100%);
  display: grid;
  gap: 18px;
  margin-top: clamp(38px, 7vw, 76px);
  padding-top: clamp(26px, 5vw, 48px);
  border-top: 1px solid rgba(245, 240, 230, 0.12);
}

.site-footer h2 {
  margin-bottom: 12px;
}

.site-footer p:not(.eyebrow) {
  width: min(820px, 100%);
  margin-bottom: 12px;
  font-size: 0.98rem;
  line-height: 1.62;
}

.bio-grid {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 18px;
}

.bio-grid article {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(245, 240, 230, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.032);
}

.bio-grid p {
  width: 100%;
  margin: 0;
  color: rgba(245, 240, 230, 0.74);
  font-size: 0.88rem;
  line-height: 1.54;
  overflow-wrap: anywhere;
}

.site-footer a {
  color: var(--cyan);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.site-footer a:hover {
  color: var(--ink);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.footer-links a {
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid rgba(104, 216, 232, 0.2);
  border-radius: 7px;
  color: rgba(245, 240, 230, 0.82);
  background: rgba(104, 216, 232, 0.06);
}

.footer-links a:hover {
  border-color: rgba(104, 216, 232, 0.48);
  color: var(--ink);
  background: rgba(104, 216, 232, 0.12);
}

.site-footer .footer-note {
  width: min(820px, 100%);
  color: rgba(245, 240, 230, 0.68);
  font-size: 0.9rem;
}

.controls label {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.controls label span {
  color: var(--muted);
  font-size: 0.75rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--amber);
}

.switches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  grid-column: 4 / -1;
  grid-row: 1;
}

.toggle {
  min-width: 0;
  padding: 0 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toggle.is-active {
  color: var(--ink);
  border-color: rgba(242, 178, 77, 0.62);
  background: rgba(242, 178, 77, 0.14);
}

@media (max-width: 980px) {
  .app-shell {
    min-height: 1320px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    width: 100%;
  }

  .readout {
    top: 156px;
    left: 18px;
    right: auto;
  }

  .equation-panel {
    top: 306px;
    left: 18px;
    right: auto;
  }

  .orbit-panel {
    top: 470px;
    left: 18px;
    right: auto;
  }

  .rsg-loop-panel {
    top: 598px;
    left: 18px;
    right: auto;
  }

  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 34vh;
    overflow: auto;
  }

  .presets {
    grid-column: 1 / -1;
    grid-row: auto;
    grid-auto-columns: clamp(118px, 38vw, 148px);
  }

  .switches {
    grid-column: 1 / -1;
    grid-row: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .controls label {
    grid-column: auto;
    grid-row: auto;
  }

  .controls label:nth-of-type(1),
  .controls label:nth-of-type(2),
  .controls label:nth-of-type(3),
  .controls label:nth-of-type(4),
  .controls label:nth-of-type(5),
  .controls label:nth-of-type(6),
  .controls label:nth-of-type(7) {
    grid-column: auto;
    grid-row: auto;
  }

  .quick-read,
  .chapter-gateway,
  .guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .glossary dl {
    grid-template-columns: 1fr;
  }

  .surtea-zoom {
    grid-template-columns: 1fr;
  }

  .concept-card {
    grid-template-columns: 1fr;
  }

  .library-head,
  .source-grid {
    grid-template-columns: 1fr;
  }

  .library-link {
    justify-self: start;
  }

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

  .concept-graphic {
    min-height: 190px;
  }
}

@media (max-width: 620px) {
  body {
    overflow-y: auto;
  }

  .app-shell {
    min-height: 100vh;
  }

  .topbar,
  .readout,
  .equation-panel,
  .orbit-panel,
  .rsg-loop-panel,
  .controls {
    position: absolute;
  }

  .presets {
    gap: 6px;
    grid-template-rows: repeat(2, 34px);
    grid-auto-columns: 126px;
  }

  .presets button {
    height: 34px;
    min-height: 34px;
    padding: 0 6px;
    font-size: 0.82rem;
  }

  .topbar {
    top: 10px;
    left: 10px;
    right: 10px;
    width: min(calc(100vw - 20px), 370px);
    max-width: min(calc(100vw - 20px), 370px);
  }

  .brand {
    min-width: 0;
  }

  p {
    white-space: normal;
  }

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

  .readout {
    top: 184px;
    left: 10px;
    right: auto;
    width: min(calc(100vw - 20px), 370px);
    max-width: min(calc(100vw - 20px), 370px);
  }

  .equation-panel {
    top: 322px;
    left: 10px;
    right: auto;
    width: min(calc(100vw - 20px), 370px);
    max-width: min(calc(100vw - 20px), 370px);
  }

  .orbit-panel {
    display: none;
  }

  .rsg-loop-panel {
    display: none;
  }

  .controls {
    left: 10px;
    right: auto;
    bottom: 10px;
    width: min(calc(100vw - 20px), 370px);
    max-width: min(calc(100vw - 20px), 370px);
    gap: 10px;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .controls label {
    gap: 6px;
  }

  .switches {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .toggle {
    min-height: 36px;
    padding: 0 6px;
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .quick-read,
  .chapter-gateway,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  .quick-read div,
  .chapter-gateway a,
  .guide-grid article,
  .plain-guide,
  .mode-guide {
    padding: 14px;
  }

  .surtea-card {
    padding: 12px;
  }

  .surtea-grid {
    gap: 3px;
    padding: 7px;
  }

  .surtea-grid span {
    border-radius: 3px;
  }

  .surtea-legend {
    grid-template-columns: 1fr;
  }

  .concept-card {
    padding: 14px;
  }

  .source-card {
    padding: 14px;
  }

  .concept-graphic {
    min-height: 176px;
    padding: 14px;
  }

  .layer-row {
    grid-template-columns: 50px repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  .memory-stack {
    transform: scale(0.9);
  }

  .cell-chip {
    left: 18px;
    bottom: 18px;
    grid-template-columns: repeat(3, 20px);
  }

  .loss-channel {
    right: 18px;
  }

  .maturation-cells,
  .render-cell,
  .pair-cell {
    right: 16px;
    bottom: 16px;
    grid-template-columns: repeat(8, 13px);
    gap: 3px;
  }

  .pair-cell {
    grid-template-columns: repeat(6, 13px);
  }

  .pair-products {
    left: 18px;
    bottom: 18px;
  }

  .pair-products span {
    width: 34px;
    height: 34px;
    font-size: 0.74rem;
  }

  .threshold-gauge {
    width: min(190px, 94%);
    padding: 12px;
  }

  .render-core {
    width: 72px;
    height: 72px;
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
