@import url("https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&family=Crimson+Pro:wght@500;600;700&display=swap");

:root {
  font-family: "Sora", "Segoe UI", sans-serif;
  color: #f3f5ff;
  background:
    radial-gradient(circle at top left, rgba(39, 214, 201, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(216, 107, 255, 0.22), transparent 30%),
    linear-gradient(180deg, #1a102e 0%, #321451 44%, #101522 100%);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  font-weight: 400;
  --panel: rgba(8, 15, 30, 0.72);
  --panel-border: rgba(181, 204, 255, 0.12);
  --muted: #9cb1d6;
  --cyan: #27d6c9;
  --amber: #f2c14b;
  --coral: #ff8d6d;
  --violet: #92a7ff;
  --green: #7bd88f;
  --purple: #8b5cf6;
  --magenta: #d86bff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1360px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 20px;
  align-items: stretch;
}

.hero-copy {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(43, 33, 70, 0.9), rgba(16, 21, 34, 0.82));
  min-height: 340px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: rise-in 0.7s ease both;
}

.hero-copy::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 30%, rgba(39, 214, 201, 0.12), transparent 54%);
  transform: translateX(-34%);
  animation: light-sweep 7s ease-in-out infinite;
  pointer-events: none;
}

.kicker,
.eyebrow,
.axis-label {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.73rem;
  letter-spacing: 0;
}

.hero h1 {
  margin: 10px 0 16px;
  font-size: clamp(2.4rem, 4vw, 4.2rem);
  line-height: 1.08;
  max-width: 15ch;
}

.lede {
  max-width: 64ch;
  color: #d7def2;
  font-size: 1.05rem;
}

.hero-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}

.hero-notes span,
.preset-chip {
  border: 1px solid rgba(164, 188, 255, 0.16);
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(154, 171, 219, 0.08);
}

.preset-chip {
  cursor: pointer;
  color: #e7ecff;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.preset-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(39, 214, 201, 0.4);
}

.preset-chip.active {
  background: rgba(39, 214, 201, 0.18);
  border-color: rgba(39, 214, 201, 0.35);
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(43, 33, 70, 0.74);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 50px rgba(2, 6, 18, 0.28);
}

.control-panel {
  padding: 18px;
}

.hero-visual {
  position: relative;
  min-height: 340px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(20, 25, 42, 0.82), rgba(9, 24, 43, 0.72)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 44px);
  display: grid;
  place-items: center;
  animation: rise-in 0.85s 0.08s ease both;
}

.orbit-ring {
  position: relative;
  width: min(72%, 320px);
  aspect-ratio: 1;
  border: 1px solid rgba(156, 177, 214, 0.3);
  border-radius: 50%;
  box-shadow:
    inset 0 0 50px rgba(39, 214, 201, 0.08),
    0 0 60px rgba(146, 167, 255, 0.12);
}

.orbit-ring::before,
.orbit-ring::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 8%;
  bottom: 8%;
  width: 1px;
  background: rgba(156, 177, 214, 0.18);
}

.orbit-ring::after {
  top: 50%;
  left: 8%;
  right: 8%;
  bottom: auto;
  width: auto;
  height: 1px;
}

.vector-dot,
.vector-line {
  position: absolute;
  display: block;
}

.vector-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  box-shadow: 0 0 22px currentColor;
}

.current-dot {
  color: var(--cyan);
  left: 72%;
  top: 28%;
  animation: pulse-dot 2.6s ease-in-out infinite;
}

.target-dot {
  color: var(--coral);
  left: 35%;
  top: 70%;
  animation: pulse-dot 2.6s 0.5s ease-in-out infinite;
}

.vector-line {
  left: 50%;
  top: 50%;
  width: 34%;
  height: 3px;
  border-radius: 999px;
  transform-origin: left center;
}

.current-line {
  background: var(--cyan);
  transform: rotate(-36deg);
}

.target-line {
  background: var(--coral);
  transform: rotate(128deg);
}

.mini-matrix {
  position: absolute;
  right: 26px;
  bottom: 24px;
  display: grid;
  grid-template-columns: repeat(2, 54px);
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(181, 204, 255, 0.15);
  border-radius: 8px;
  background: rgba(6, 13, 28, 0.66);
}

.mini-matrix span {
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(151, 171, 221, 0.08);
  color: #e8f1ff;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-heading h2,
.panel-heading h3,
.panel h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.panel-heading p,
.panel p,
.source-list span {
  margin: 0;
  color: #cfdaef;
}

.compact {
  margin-bottom: 12px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.slider-field {
  display: block;
  margin-top: 14px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #eff5ff;
}

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

.slider-help {
  margin-top: 6px;
  color: #b9aacf;
  font-size: 0.82rem;
  line-height: 1.45;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.story-path {
  grid-column: span 12;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.story-path span {
  padding: 12px 14px;
  border: 1px solid rgba(181, 204, 255, 0.12);
  border-radius: 8px;
  background: rgba(151, 171, 221, 0.06);
  color: #dbe7ff;
  animation: rise-in 0.65s ease both;
}

.story-path span:nth-child(2) {
  animation-delay: 0.08s;
}

.story-path span:nth-child(3) {
  animation-delay: 0.16s;
}

.intro-panel,
.text-panel,
.compare-panel,
.loop-panel,
.formula-panel,
.why-panel,
.source-panel {
  grid-column: span 12;
  padding: 22px;
}

.chart-panel,
.matrix-panel,
.report-panel {
  grid-column: span 6;
  padding: 18px;
}

.compare-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.compare-card {
  padding: 18px;
  border-radius: 8px;
  border: 1px solid rgba(181, 204, 255, 0.12);
  background: rgba(53, 39, 90, 0.72);
}

.compare-card h3,
.loop-copy p,
.formula-grid h3,
.why-grid h3 {
  margin-top: 0;
}

.stable-card {
  box-shadow: inset 0 0 0 1px rgba(16, 191, 165, 0.1);
}

.nonlinear-card {
  box-shadow: inset 0 0 0 1px rgba(216, 107, 255, 0.16);
}

.formula-chip {
  display: inline-flex;
  margin: 8px 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(16, 191, 165, 0.12);
  color: #f8ffff;
  font-weight: 800;
}

.formula-chip.hot {
  background: rgba(216, 107, 255, 0.14);
}

.compare-arrow {
  display: grid;
  place-items: center;
  min-width: 44px;
  color: var(--magenta);
  font-size: 2rem;
  font-weight: 800;
}

.loop-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 18px;
  align-items: center;
}

.loop-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.loop-track::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  opacity: 0.5;
}

.loop-node {
  position: relative;
  min-height: 110px;
  display: grid;
  place-items: center;
  padding: 14px;
  text-align: center;
  border-radius: 8px;
  border: 1px solid rgba(181, 204, 255, 0.12);
  background: rgba(7, 14, 29, 0.78);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.12);
  animation: pulse-panel 2.8s ease-in-out infinite;
}

.loop-node:nth-child(2) {
  animation-delay: 0.25s;
}

.loop-node:nth-child(3) {
  animation-delay: 0.5s;
}

.loop-node:nth-child(4) {
  animation-delay: 0.75s;
}

.loop-copy {
  padding: 18px;
  border-radius: 8px;
  background: rgba(151, 171, 221, 0.06);
}

.loop-sequence {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(139, 92, 246, 0.18);
  font-weight: 800;
}

.theory-panel,
.toy-panel {
  grid-column: span 12;
  padding: 28px;
}

.theory-flow,
.toy-grid,
.derivation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.theory-flow article,
.toy-grid article,
.derivation-grid article {
  position: relative;
  min-height: 150px;
  padding: 16px;
  border: 1px solid rgba(209, 222, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03)),
    rgba(9, 14, 28, 0.56);
}

.theory-flow article::after {
  content: "→";
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--magenta);
  font-size: 1.35rem;
  font-weight: 900;
}

.theory-flow article:last-child::after {
  display: none;
}

.theory-flow span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  border: 1px solid rgba(39, 214, 201, 0.36);
  border-radius: 999px;
  background: rgba(39, 214, 201, 0.12);
  color: #ffffff;
  font-weight: 900;
}

.theory-flow h3,
.toy-grid h3,
.derivation-grid h3 {
  margin: 0 0 8px;
}

.formula-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(39, 214, 201, 0.16);
  border-radius: 8px;
  background: rgba(39, 214, 201, 0.07);
}

.formula-strip span {
  min-height: 46px;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 8px;
  background: rgba(3, 8, 20, 0.44);
  color: #ffffff;
  font-weight: 900;
  text-align: center;
}

.experiment-panel {
  grid-column: span 12;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.7fr);
  gap: 18px;
  padding: 18px;
  align-items: start;
}

.experiment-chart {
  min-width: 0;
}

.lab-controls {
  position: sticky;
  top: 16px;
  border: 1px solid rgba(181, 204, 255, 0.12);
  border-radius: 8px;
  background: rgba(7, 14, 29, 0.72);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.status-strip span {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(151, 171, 221, 0.07);
  color: #c8d5ee;
}

.status-strip strong {
  color: #ffffff;
}

.chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: #c9d5ec;
}

.derivation-status {
  min-height: 44px;
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(39, 214, 201, 0.18);
  border-radius: 8px;
  background: rgba(6, 15, 30, 0.62);
  color: #d9e6ff;
  line-height: 1.45;
}

.derivation-status strong {
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.play-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid rgba(39, 214, 201, 0.34);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(39, 214, 201, 0.22), rgba(216, 107, 255, 0.2));
  color: #ffffff;
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.play-button[data-action="play-trail"] {
  min-width: 168px;
  justify-content: center;
}

[data-dynamic="main-iteration-chart"],
[data-dynamic="residual-chart"],
[data-dynamic="basin-chart"] {
  display: block;
  contain: layout paint;
}

.play-button:hover {
  transform: translateY(-2px);
  border-color: rgba(39, 214, 201, 0.62);
  background: linear-gradient(135deg, rgba(39, 214, 201, 0.32), rgba(216, 107, 255, 0.28));
}

.secondary-play {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(209, 222, 255, 0.14);
  box-shadow: none;
}

.derivation-panel {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid rgba(209, 222, 255, 0.13);
  border-radius: 8px;
  background:
    radial-gradient(circle at top left, rgba(39, 214, 201, 0.11), transparent 34%),
    rgba(6, 11, 24, 0.68);
}

.derivation-head {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.derivation-head h3 {
  margin: 0 0 4px;
  color: #ffffff;
}

.derivation-head p,
.derivation-grid p {
  margin: 0;
  color: #cfdaef;
}

.math-tag {
  display: inline-flex;
  margin-bottom: 10px;
  color: #9df6ef;
  font-size: 0.78rem;
  font-weight: 900;
}

.derivation-grid strong {
  display: block;
  margin-bottom: 8px;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.mini-equation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.mini-equation span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.chart-caption {
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 3px solid var(--amber);
  background: rgba(242, 193, 75, 0.08);
  border-radius: 8px;
}

.graph-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.graph-guide article {
  padding: 12px;
  border-radius: 8px;
  background: rgba(151, 171, 221, 0.06);
  border: 1px solid rgba(181, 204, 255, 0.08);
}

.graph-guide span {
  display: inline-flex;
  margin-bottom: 6px;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 800;
}

.graph-guide p {
  margin: 0;
  color: #cfdaef;
  font-size: 0.9rem;
}

.coordinate-story {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(181, 204, 255, 0.12);
}

.insight-grid,
.intro-steps,
.formula-grid,
.why-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.insight-grid article,
.intro-steps article,
.formula-grid article,
.why-grid article,
.report-grid article {
  padding: 16px;
  border-radius: 8px;
  background: rgba(151, 171, 221, 0.06);
  min-height: 148px;
}

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

.symbol {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 12px;
  border-radius: 8px;
  color: #fff;
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.28);
  font-weight: 800;
}

.intro-steps article {
  position: relative;
  padding-top: 54px;
  animation: rise-in 0.7s ease both;
}

.intro-steps article:nth-child(2) {
  animation-delay: 0.08s;
}

.intro-steps article:nth-child(3) {
  animation-delay: 0.16s;
}

.step-number {
  position: absolute;
  top: 16px;
  left: 16px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(39, 214, 201, 0.18);
  border: 1px solid rgba(39, 214, 201, 0.4);
  color: #f8ffff;
  font-weight: 700;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-bg {
  fill: rgba(4, 10, 24, 0.72);
  stroke: rgba(182, 204, 255, 0.08);
}

.chart-grid {
  stroke: rgba(184, 201, 240, 0.16);
  stroke-width: 1.2;
}

.chart-grid.strong {
  stroke: rgba(184, 201, 240, 0.26);
}

.chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw-line 1.1s ease forwards;
}

.chart-line.cyan {
  stroke: var(--cyan);
}

.chart-line.coral {
  stroke: var(--coral);
}

.chart-line.amber {
  stroke: var(--amber);
}

.chart-line.violet {
  stroke: var(--violet);
}

.dashed {
  stroke-dasharray: 8 8;
  stroke-dashoffset: 0;
  animation: dash-move 1.6s linear infinite;
}

.chart-dot {
  stroke: rgba(7, 17, 29, 0.9);
  stroke-width: 1.5;
  animation: pop-in 0.45s ease both;
}

.chart-dot.coral {
  fill: var(--coral);
}

.chart-dot.cyan {
  fill: var(--cyan);
}

.chart-dot.amber {
  fill: var(--amber);
}

.chart-dot.violet {
  fill: var(--purple);
}

.chart-dot.green {
  fill: var(--green);
}

.story-plot {
  overflow: visible;
}

.iteration-trail {
  fill: none;
  stroke: var(--magenta);
  stroke-width: 5.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw-line 1s ease forwards;
  filter: drop-shadow(0 0 12px rgba(216, 107, 255, 0.36));
}

.ghost-trail {
  stroke-width: 2.5;
  opacity: 0.24;
  filter: none;
}

.trail-playback {
  animation: draw-line 3s cubic-bezier(0.22, 0.7, 0.18, 1) forwards;
}

.background-iteration-dots {
  opacity: 0.36;
}

.background-iteration-dots .chart-dot,
.background-iteration-dots .chart-dot.coral,
.background-iteration-dots .chart-dot.violet,
.background-iteration-dots .chart-dot.green {
  fill: #91a3cf;
  opacity: 0.46;
  stroke: rgba(7, 17, 29, 0.72);
  filter: none;
}

.stage-vector {
  fill: none;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 9px rgba(255, 255, 255, 0.1));
}

.current-stage-vector {
  stroke: var(--cyan);
}

.transformed-stage-vector {
  stroke: var(--coral);
}

.target-stage-vector {
  stroke: var(--amber);
  stroke-dasharray: 7 7;
}

.next-stage-vector {
  stroke: var(--magenta);
  stroke-width: 3.6;
}

.vector-stage-circle {
  fill: rgba(39, 214, 201, 0.015);
}

.chart-help-label {
  fill: #b9c6df;
  font-size: 0.66rem;
  font-weight: 700;
}

.process-card rect,
.legend-card rect {
  fill: rgba(6, 12, 26, 0.7);
  stroke: rgba(181, 204, 255, 0.14);
}

.process-card text,
.legend-card text {
  fill: #dce6fb;
  font-size: 0.64rem;
  font-weight: 700;
}

.process-card text:first-of-type {
  fill: #9df6ef;
  font-size: 0.74rem;
  font-weight: 900;
}

.legend-cyan {
  fill: var(--cyan);
}

.legend-coral {
  fill: var(--coral);
}

.legend-amber {
  fill: var(--amber);
}

.legend-violet {
  fill: var(--magenta);
}

.solution-dot {
  fill: var(--green);
  stroke: rgba(7, 17, 29, 0.9);
  stroke-width: 1.5;
  opacity: 0.78;
  filter: drop-shadow(0 0 8px rgba(123, 216, 143, 0.5));
}

.traveler-dot {
  fill: #ffffff;
  stroke: var(--magenta);
  stroke-width: 4;
  filter:
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.75))
    drop-shadow(0 0 18px rgba(216, 107, 255, 0.75));
}

.focus-dot {
  stroke: rgba(7, 17, 29, 0.92);
  stroke-width: 2;
  filter: drop-shadow(0 0 12px currentColor);
}

.focus-dot.cyan {
  fill: var(--cyan);
  color: var(--cyan);
}

.focus-dot.amber {
  fill: var(--amber);
  color: var(--amber);
}

.focus-dot.coral {
  fill: var(--coral);
  color: var(--coral);
}

.focus-dot.violet {
  fill: var(--magenta);
  color: var(--magenta);
}

.step-dots-playback .chart-dot {
  opacity: 0;
  animation: pop-in 0.28s ease forwards;
}

.step-dots-playback .chart-dot:nth-of-type(1) {
  animation-delay: 0.05s;
}

.step-dots-playback .chart-dot:nth-of-type(2) {
  animation-delay: 0.22s;
}

.step-dots-playback .chart-dot:nth-of-type(3) {
  animation-delay: 0.4s;
}

.step-dots-playback .chart-dot:nth-of-type(4) {
  animation-delay: 0.58s;
}

.step-dots-playback .chart-dot:nth-of-type(5) {
  animation-delay: 0.76s;
}

.step-dots-playback .chart-dot:nth-of-type(6) {
  animation-delay: 0.94s;
}

.step-dots-playback .chart-dot:nth-of-type(7) {
  animation-delay: 1.12s;
}

.step-dots-playback .chart-dot:nth-of-type(8) {
  animation-delay: 1.3s;
}

.step-dots-playback .chart-dot:nth-of-type(9) {
  animation-delay: 1.48s;
}

.step-dots-playback .chart-dot:nth-of-type(10) {
  animation-delay: 1.66s;
}

.step-dots-playback .chart-dot:nth-of-type(11) {
  animation-delay: 1.84s;
}

.step-dots-playback .chart-dot:nth-of-type(12) {
  animation-delay: 2.02s;
}

.step-dots-playback .chart-dot:nth-of-type(13) {
  animation-delay: 2.2s;
}

.step-dots-playback .chart-dot:nth-of-type(14) {
  animation-delay: 2.38s;
}

.step-dots-playback .chart-dot:nth-of-type(15) {
  animation-delay: 2.56s;
}

.step-dots-playback .chart-dot:nth-of-type(16) {
  animation-delay: 2.74s;
}

.residual-bar {
  animation: grow-bar 0.7s ease both;
  transform-box: fill-box;
  transform-origin: center bottom;
}

.start-bar {
  fill: var(--purple);
}

.moving-bar {
  fill: var(--magenta);
}

.stable-bar {
  fill: var(--green);
}

.tiny-label,
.meter-value,
.basin-note {
  fill: #cfdaef;
  font-size: 0.72rem;
}

.meter-value {
  fill: #ffffff;
  font-weight: 700;
}

.basin-frame {
  fill: rgba(7, 14, 29, 0.6);
  stroke: rgba(181, 204, 255, 0.16);
}

.seed-marker {
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 5 5;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.35));
}

.angle-arc {
  fill: none;
  stroke: var(--amber);
  stroke-width: 2.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px rgba(242, 193, 75, 0.32));
}

.angle-label {
  fill: var(--amber);
  font-size: 0.78rem;
  font-weight: 800;
}

.stable-ping {
  fill: var(--green);
  filter: drop-shadow(0 0 8px rgba(123, 216, 143, 0.6));
}

.unit-circle {
  fill: rgba(39, 214, 201, 0.03);
  stroke: rgba(156, 177, 214, 0.28);
  stroke-width: 1.4;
}

.vector-arrow {
  stroke-width: 4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.08));
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: draw-line 0.9s ease forwards;
}

.current-vector {
  stroke: var(--cyan);
}

.transformed-vector {
  stroke: var(--coral);
  animation-delay: 0.12s;
}

.target-vector {
  stroke: var(--amber);
  stroke-width: 3;
  stroke-dasharray: 7 7;
  stroke-dashoffset: 0;
  animation: dash-move 1.7s linear infinite;
}

.vector-label {
  font-size: 0.78rem;
  font-weight: 700;
}

.cyan-label {
  fill: var(--cyan);
}

.coral-label {
  fill: var(--coral);
}

.amber-label {
  fill: var(--amber);
}

.violet-label {
  fill: var(--purple);
}

.green-label {
  fill: var(--green);
}

.matrix-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 20px;
  align-items: center;
}

.matrix-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 18px;
  border-radius: 8px;
  background: rgba(151, 171, 221, 0.08);
  margin-top: 12px;
}

.matrix-box span {
  display: grid;
  place-items: center;
  min-height: 72px;
  border-radius: 8px;
  background: rgba(2, 10, 24, 0.4);
  font-size: 1.15rem;
}

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

.stats-grid > div {
  padding: 14px;
  border-radius: 8px;
  background: rgba(151, 171, 221, 0.06);
}

.stats-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
}

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

.source-list li {
  display: grid;
  gap: 4px;
  padding: 14px 0;
  border-top: 1px solid rgba(181, 204, 255, 0.12);
}

.source-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.source-list a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
}

.story-equation {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  color: #f8fbff;
}

.story-equation span:not(.story-arrow) {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(151, 171, 221, 0.09);
  border: 1px solid rgba(181, 204, 255, 0.12);
  font-weight: 700;
}

.story-arrow {
  color: var(--amber);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes light-sweep {
  0%,
  60%,
  100% {
    transform: translateX(-38%);
  }
  78% {
    transform: translateX(38%);
  }
}

@keyframes pulse-dot {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.28);
    opacity: 1;
  }
}

@keyframes draw-line {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes dash-move {
  to {
    stroke-dashoffset: -32;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes grow-bar {
  from {
    opacity: 0.25;
    transform: scaleY(0.15);
  }
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes pulse-panel {
  0%,
  100% {
    transform: translateY(0);
    border-color: rgba(181, 204, 255, 0.12);
  }
  50% {
    transform: translateY(-3px);
    border-color: rgba(216, 107, 255, 0.36);
  }
}

@media (max-width: 1120px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .chart-panel,
  .experiment-panel,
  .matrix-panel,
  .report-panel {
    grid-column: span 12;
  }

  .experiment-panel {
    grid-template-columns: 1fr;
  }

  .lab-controls {
    position: static;
  }

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

  .compare-grid,
  .loop-grid,
  .formula-grid,
  .theory-flow,
  .toy-grid,
  .derivation-grid,
  .formula-strip {
    grid-template-columns: 1fr;
  }

  .theory-flow article::after {
    right: 50%;
    top: auto;
    bottom: -18px;
    transform: translateX(50%) rotate(90deg);
  }

  .compare-arrow {
    min-height: 36px;
    transform: rotate(90deg);
  }

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

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 20px, 1360px);
    padding-top: 18px;
  }

  .hero-copy,
  .hero-visual,
  .control-panel,
  .intro-panel,
  .experiment-panel,
  .theory-panel,
  .toy-panel,
  .text-panel,
  .chart-panel,
  .matrix-panel,
  .report-panel,
  .source-panel {
    padding: 16px;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 13vw, 3.6rem);
  }

  .insight-grid,
  .intro-steps,
  .story-path,
  .graph-guide,
  .why-grid,
  .report-grid,
  .status-strip,
  .matrix-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .loop-track {
    grid-template-columns: 1fr;
  }

  .loop-track::before {
    top: 8%;
    bottom: 8%;
    left: 50%;
    right: auto;
    width: 2px;
    height: auto;
  }

  .hero-visual {
    min-height: 260px;
  }

  .mini-matrix {
    right: 16px;
    bottom: 16px;
    grid-template-columns: repeat(2, 44px);
  }
}

/* Premium storytelling redesign */
html {
  scroll-behavior: smooth;
}

[id] {
  scroll-margin-top: 96px;
}

body {
  position: relative;
  color: #f7f8ff;
  background:
    radial-gradient(circle at 12% 6%, rgba(39, 214, 201, 0.2), transparent 26%),
    radial-gradient(circle at 86% 2%, rgba(216, 107, 255, 0.28), transparent 32%),
    radial-gradient(circle at 65% 76%, rgba(242, 193, 75, 0.12), transparent 24%),
    linear-gradient(180deg, #140d25 0%, #2b1350 42%, #0f1421 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent 78%);
}

.app-shell {
  width: min(1440px, calc(100vw - 28px));
  padding: 18px 0 72px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid rgba(209, 222, 255, 0.14);
  border-radius: 8px;
  background: rgba(13, 17, 31, 0.72);
  box-shadow: 0 18px 60px rgba(4, 7, 16, 0.32);
  backdrop-filter: blur(22px);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: #ffffff;
  text-decoration: none;
}

.brand-mark span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(39, 214, 201, 0.35);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(39, 214, 201, 0.24), rgba(216, 107, 255, 0.26));
  color: #ffffff;
  font-weight: 900;
}

.brand-mark strong {
  font-size: 0.92rem;
  letter-spacing: 0;
}

.topbar-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.topbar-links a,
.primary-link,
.secondary-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  text-decoration: none;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.topbar-links a {
  padding: 0 13px;
  color: #cbd6ef;
}

.topbar-links a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

.hero {
  gap: 22px;
  align-items: stretch;
}

.hero-copy,
.hero-visual,
.panel {
  border-color: rgba(209, 222, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(47, 34, 78, 0.88), rgba(13, 18, 32, 0.78)),
    rgba(13, 18, 32, 0.76);
  box-shadow:
    0 28px 90px rgba(3, 6, 16, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.hero-copy {
  min-height: 520px;
  padding: clamp(28px, 5vw, 58px);
}

.hero h1 {
  max-width: 12ch;
  font-size: clamp(2.8rem, 6vw, 5.8rem);
  line-height: 1.02;
}

.lede {
  max-width: 68ch;
  color: #e1e7f8;
  font-size: 1.08rem;
}

.hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.primary-link,
.secondary-link {
  padding: 0 18px;
  border: 1px solid rgba(209, 222, 255, 0.16);
  font-weight: 800;
}

.primary-link {
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  color: #08101d;
  box-shadow: 0 14px 38px rgba(39, 214, 201, 0.2);
}

.secondary-link {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.primary-link:hover,
.secondary-link:hover,
.preset-chip:hover {
  transform: translateY(-2px);
}

.hero-visual {
  min-height: 520px;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 42%, rgba(39, 214, 201, 0.14), transparent 32%),
    linear-gradient(145deg, rgba(18, 25, 46, 0.92), rgba(26, 15, 46, 0.86)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 48px);
}

.visual-caption {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 22px;
  padding: 12px 14px;
  border: 1px solid rgba(209, 222, 255, 0.13);
  border-radius: 8px;
  background: rgba(8, 12, 24, 0.72);
  color: #d9e2f6;
  backdrop-filter: blur(12px);
}

.orbit-ring {
  width: min(72%, 360px);
  border-color: rgba(209, 222, 255, 0.34);
}

.section-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 12px;
  padding: 0 10px;
  border: 1px solid rgba(39, 214, 201, 0.24);
  border-radius: 8px;
  background: rgba(39, 214, 201, 0.08);
  color: #9df6ef;
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.panel {
  overflow: hidden;
}

.intro-panel,
.text-panel,
.compare-panel,
.loop-panel,
.formula-panel,
.why-panel,
.source-panel {
  padding: 28px;
}

.chart-panel,
.matrix-panel,
.report-panel {
  padding: 22px;
}

.panel-heading {
  align-items: flex-start;
}

.panel-heading h2,
.panel-heading h3,
.panel h3 {
  color: #ffffff;
  font-size: 1.24rem;
}

.panel-heading p,
.panel p,
.source-list span,
.slider-help {
  color: #d2dcf0;
}

.story-path span,
.compare-card,
.loop-copy,
.graph-guide article,
.insight-grid article,
.intro-steps article,
.formula-grid article,
.why-grid article,
.report-grid article,
.stats-grid > div {
  border: 1px solid rgba(209, 222, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.035)),
    rgba(15, 22, 39, 0.54);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.story-path span {
  min-height: 86px;
  display: flex;
  align-items: center;
}

.compare-card {
  position: relative;
}

.compare-card::before,
.formula-grid article::before,
.why-grid article::before {
  content: "";
  display: block;
  width: 34px;
  height: 3px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
}

.loop-track::before {
  height: 3px;
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(216, 107, 255, 0.22);
}

.loop-node {
  background:
    radial-gradient(circle at 50% 18%, rgba(216, 107, 255, 0.16), transparent 44%),
    rgba(8, 13, 26, 0.84);
}

.experiment-panel {
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.72fr);
  padding: 22px;
}

.lab-controls {
  top: 86px;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(19, 25, 44, 0.94), rgba(10, 14, 25, 0.9)),
    rgba(7, 14, 29, 0.84);
  box-shadow: 0 18px 60px rgba(3, 6, 16, 0.28);
}

.status-strip span {
  border: 1px solid rgba(209, 222, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

.slider-field {
  padding: 12px;
  border: 1px solid rgba(209, 222, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.slider-label {
  align-items: baseline;
}

.slider-label span:last-child {
  color: #9df6ef;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.slider-field input[type="range"] {
  height: 28px;
}

.slider-help {
  padding-top: 6px;
  border-top: 1px solid rgba(209, 222, 255, 0.08);
}

.chart-bg {
  fill: rgba(5, 9, 22, 0.8);
  stroke: rgba(209, 222, 255, 0.12);
}

.chart-caption {
  border-left-color: var(--cyan);
  background: rgba(39, 214, 201, 0.075);
}

.graph-guide span {
  color: #9df6ef;
}

.matrix-box,
.mini-matrix {
  border: 1px solid rgba(209, 222, 255, 0.12);
  background: rgba(5, 9, 22, 0.62);
}

.source-list a:hover,
.topbar-links a:focus-visible,
.primary-link:focus-visible,
.secondary-link:focus-visible,
.preset-chip:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(39, 214, 201, 0.9);
  outline-offset: 3px;
}

@media (max-width: 1120px) {
  .topbar {
    align-items: flex-start;
  }

  .hero-copy,
  .hero-visual {
    min-height: auto;
  }

  .experiment-panel {
    grid-template-columns: 1fr;
  }

  .lab-controls {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 18px, 1440px);
    padding-top: 10px;
  }

  .topbar {
    position: static;
    display: grid;
  }

  .topbar-links {
    justify-content: flex-start;
  }

  .hero-copy {
    padding: 24px 18px;
  }

  .hero h1 {
    max-width: 11ch;
  }

  .hero-actions {
    display: grid;
  }

  .hero-visual {
    min-height: 360px;
    padding: 18px;
  }

  .visual-caption {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }

  .intro-panel,
  .text-panel,
  .compare-panel,
  .loop-panel,
  .formula-panel,
  .why-panel,
  .source-panel,
  .chart-panel,
  .matrix-panel,
  .report-panel,
  .experiment-panel {
    padding: 18px;
  }
}

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

/* Apple-like research interface redesign */
:root {
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Inter", "Segoe UI", sans-serif;
  color: #172033;
  background: #f5f7fb;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-border: rgba(15, 23, 42, 0.1);
  --muted: #667085;
  --ink: #111827;
  --soft-ink: #344054;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --glass: rgba(255, 255, 255, 0.66);
  --cyan: #0f766e;
  --amber: #b7791f;
  --coral: #c2410c;
  --violet: #4f46e5;
  --green: #15803d;
  --purple: #4338ca;
  --magenta: #7c3aed;
  --shadow-soft: 0 24px 70px rgba(15, 23, 42, 0.1);
  --shadow-card: 0 12px 36px rgba(15, 23, 42, 0.08);
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 6%, rgba(15, 118, 110, 0.12), transparent 28%),
    radial-gradient(circle at 82% 2%, rgba(79, 70, 229, 0.11), transparent 30%),
    linear-gradient(180deg, #fbfcff 0%, #f4f7fb 46%, #eef3f7 100%);
}

body::before {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.72), transparent 38%),
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
  background-size: auto, 80px 80px, 80px 80px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 74%);
}

.app-shell {
  width: min(1280px, calc(100vw - 40px));
  padding: 20px 0 80px;
}

.topbar {
  top: 14px;
  padding: 8px 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(26px) saturate(1.25);
}

.brand-mark,
.topbar-links a {
  color: #172033;
}

.brand-mark span {
  border: 1px solid rgba(15, 23, 42, 0.1);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(229, 236, 246, 0.78)),
    #ffffff;
  color: #111827;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.topbar-links a {
  color: #475467;
}

.topbar-links a:hover {
  color: #111827;
  background: rgba(15, 23, 42, 0.055);
}

.hero {
  gap: 24px;
  margin-top: 24px;
}

.hero-copy {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: clamp(26px, 5vw, 62px) clamp(8px, 2vw, 20px);
  min-height: 560px;
}

.hero-copy::before {
  display: none;
}

.kicker,
.eyebrow,
.axis-label {
  color: #667085;
  font-weight: 700;
}

.hero h1 {
  color: #0f172a;
  max-width: 12.5ch;
  font-size: clamp(3rem, 6.5vw, 6.4rem);
  letter-spacing: 0;
}

.lede {
  max-width: 66ch;
  color: #475467;
  font-size: 1.12rem;
  line-height: 1.72;
}

.hero-notes span,
.preset-chip,
.story-equation span:not(.story-arrow) {
  border-color: rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.68);
  color: #344054;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px) saturate(1.08);
}

.story-arrow {
  color: #2563eb;
}

.primary-link,
.play-button {
  border: 1px solid rgba(15, 23, 42, 0.88);
  background: #111827;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.18);
}

.secondary-link,
.secondary-play {
  border-color: rgba(15, 23, 42, 0.1);
  background: rgba(255, 255, 255, 0.68);
  color: #172033;
  box-shadow: none;
}

.primary-link:hover,
.secondary-link:hover,
.preset-chip:hover,
.play-button:hover {
  border-color: rgba(15, 23, 42, 0.2);
  background: #0b1220;
  color: #ffffff;
  transform: translateY(-2px);
}

.secondary-link:hover,
.secondary-play:hover {
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
}

.hero-visual,
.panel {
  border: 1px solid rgba(15, 23, 42, 0.09);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(24px) saturate(1.14);
}

.hero-visual {
  min-height: 560px;
  background:
    radial-gradient(circle at 50% 44%, rgba(37, 99, 235, 0.1), transparent 30%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(226, 232, 240, 0.64)),
    repeating-linear-gradient(90deg, rgba(15, 23, 42, 0.035) 0 1px, transparent 1px 54px),
    repeating-linear-gradient(0deg, rgba(15, 23, 42, 0.03) 0 1px, transparent 1px 54px);
}

.visual-caption {
  border-color: rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.72);
  color: #344054;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px) saturate(1.15);
}

.orbit-ring {
  border-color: rgba(15, 23, 42, 0.18);
  box-shadow:
    inset 0 0 54px rgba(37, 99, 235, 0.08),
    0 28px 80px rgba(15, 23, 42, 0.1);
}

.orbit-ring::before,
.orbit-ring::after {
  background: rgba(15, 23, 42, 0.12);
}

.mini-matrix {
  border-color: rgba(15, 23, 42, 0.09);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
}

.mini-matrix span,
.formula-strip span,
.matrix-box span {
  background: rgba(248, 250, 252, 0.9);
  color: #111827;
}

.section-label {
  border-color: rgba(37, 99, 235, 0.15);
  background: rgba(37, 99, 235, 0.07);
  color: #1d4ed8;
}

.panel-heading h2,
.panel-heading h3,
.panel h3,
.derivation-head h3 {
  color: #111827;
}

.panel-heading p,
.panel p,
.source-list span,
.slider-help,
.derivation-head p,
.derivation-grid p {
  color: #526071;
}

.story-path span,
.compare-card,
.loop-copy,
.loop-node,
.graph-guide article,
.insight-grid article,
.intro-steps article,
.formula-grid article,
.why-grid article,
.report-grid article,
.stats-grid > div,
.theory-flow article,
.toy-grid article,
.derivation-grid article,
.slider-field {
  border: 1px solid rgba(15, 23, 42, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.52)),
    rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px) saturate(1.08);
}

.compare-card::before,
.formula-grid article::before,
.why-grid article::before {
  background: linear-gradient(90deg, #0f766e, #2563eb);
}

.formula-chip {
  background: rgba(15, 118, 110, 0.08);
  color: #0f766e;
}

.formula-chip.hot,
.loop-sequence,
.symbol {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.compare-arrow {
  color: #2563eb;
}

.loop-track::before {
  background: linear-gradient(90deg, #0f766e, #2563eb, #b7791f);
  box-shadow: none;
}

.theory-flow span,
.step-number {
  border-color: rgba(15, 118, 110, 0.18);
  background: rgba(15, 118, 110, 0.08);
  color: #0f766e;
}

.theory-flow article::after {
  color: #2563eb;
}

.experiment-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.78);
}

.lab-controls {
  border-color: rgba(15, 23, 42, 0.09);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(248, 250, 252, 0.72)),
    rgba(255, 255, 255, 0.74);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(24px) saturate(1.16);
}

.preset-chip {
  color: #344054;
}

.preset-chip.active {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
}

.slider-label {
  color: #172033;
}

.slider-label span:last-child,
.math-tag {
  color: #0f766e;
}

.slider-help {
  border-top-color: rgba(15, 23, 42, 0.08);
}

.slider-field input[type="range"] {
  accent-color: #111827;
}

.status-strip span,
.derivation-status {
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.62);
  color: #526071;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.status-strip strong,
.derivation-status strong,
.derivation-grid strong,
.stats-grid strong,
.source-list a {
  color: #111827;
}

.derivation-panel {
  border-color: rgba(15, 23, 42, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(248, 250, 252, 0.64)),
    rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-card);
}

.mini-equation span,
.matrix-box,
.stats-grid > div {
  background: rgba(248, 250, 252, 0.76);
}

.chart-caption {
  border-left-color: #0f766e;
  background: rgba(15, 118, 110, 0.065);
  color: #344054;
}

.graph-guide span {
  color: #1d4ed8;
}

.chart-bg {
  fill: #111827;
  stroke: rgba(255, 255, 255, 0.08);
}

.chart-grid {
  stroke: rgba(226, 232, 240, 0.18);
}

.chart-grid.strong {
  stroke: rgba(226, 232, 240, 0.28);
}

.unit-circle {
  fill: rgba(37, 99, 235, 0.04);
  stroke: rgba(226, 232, 240, 0.28);
}

.process-card rect,
.legend-card rect {
  fill: rgba(255, 255, 255, 0.08);
  stroke: rgba(255, 255, 255, 0.16);
}

.process-card text,
.legend-card text,
.chart-help-label,
.tiny-label,
.meter-value,
.basin-note {
  fill: #dbe7f5;
}

.process-card text:first-of-type {
  fill: #8dd3c7;
}

.background-iteration-dots .chart-dot,
.background-iteration-dots .chart-dot.coral,
.background-iteration-dots .chart-dot.violet,
.background-iteration-dots .chart-dot.green {
  fill: #94a3b8;
  stroke: rgba(17, 24, 39, 0.72);
}

.current-stage-vector,
.current-vector,
.chart-line.cyan {
  stroke: #14b8a6;
}

.focus-dot.cyan,
.chart-dot.cyan,
.legend-cyan,
.current-dot {
  color: #14b8a6;
  fill: #14b8a6;
}

.transformed-stage-vector,
.transformed-vector,
.chart-line.coral {
  stroke: #f97316;
}

.focus-dot.coral,
.chart-dot.coral,
.legend-coral,
.target-dot {
  color: #f97316;
  fill: #f97316;
}

.target-stage-vector,
.target-vector,
.chart-line.amber {
  stroke: #eab308;
}

.focus-dot.amber,
.chart-dot.amber,
.legend-amber {
  color: #eab308;
  fill: #eab308;
}

.next-stage-vector,
.iteration-trail,
.chart-line.violet {
  stroke: #8b5cf6;
}

.focus-dot.violet,
.chart-dot.violet,
.legend-violet {
  color: #8b5cf6;
  fill: #8b5cf6;
}

.residual-bar.start-bar,
.start-bar {
  fill: #6366f1;
}

.moving-bar {
  fill: #2563eb;
}

.stable-bar,
.solution-dot,
.chart-dot.green {
  fill: #22c55e;
}

.matrix-box {
  border-color: rgba(15, 23, 42, 0.08);
}

.source-list li {
  border-top-color: rgba(15, 23, 42, 0.08);
}

.source-list a:hover,
.topbar-links a:focus-visible,
.primary-link:focus-visible,
.secondary-link:focus-visible,
.preset-chip:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.9);
  outline-offset: 3px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.16;
  background-image: radial-gradient(rgba(15, 23, 42, 0.34) 0.55px, transparent 0.55px);
  background-size: 4px 4px;
  mix-blend-mode: multiply;
}

.panel,
.hero-visual,
.topbar,
.lab-controls {
  position: relative;
}

.panel::before,
.hero-visual::before,
.lab-controls::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 36%),
    linear-gradient(315deg, rgba(15, 23, 42, 0.045), transparent 42%);
  opacity: 0.42;
}

.experiment-chart,
.control-panel > *,
.panel > * {
  position: relative;
  z-index: 1;
}

.story-plot .chart-dot,
.vector-plane .chart-dot,
.focus-dot {
  animation: none;
  transform: none;
  transform-box: fill-box;
  transform-origin: center;
}

.focus-dot {
  animation: data-breathe 2.6s ease-in-out infinite;
  filter:
    drop-shadow(0 0 10px currentColor)
    drop-shadow(0 0 18px rgba(255, 255, 255, 0.28));
}

.background-iteration-dots .chart-dot {
  animation: fade-dot-in 220ms ease-out both;
}

.current-dot,
.target-dot {
  box-shadow:
    0 0 0 8px color-mix(in srgb, currentColor 14%, transparent),
    0 0 28px currentColor;
}

.hero-visual .vector-line {
  box-shadow: 0 0 18px currentColor;
}

.current-line {
  color: #14b8a6;
}

.target-line {
  color: #f97316;
}

.solution-dot,
.stable-ping {
  animation: data-breathe 2.8s ease-in-out infinite;
}

.status-strip span,
.derivation-status,
.slider-field,
.graph-guide article {
  color: #3b4758;
}

.status-strip {
  grid-template-columns: repeat(3, minmax(138px, 1fr)) minmax(184px, 1.12fr);
}

.status-strip span {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.status-strip strong {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.chart-caption,
.slider-help,
.graph-guide p,
.panel-heading p,
.panel p {
  color: #3f4d5f;
}

/* Premium glass refinement: keep translucency, but never sacrifice contrast. */
.topbar {
  border-color: rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 250, 255, 0.58)),
    rgba(255, 255, 255, 0.64);
  box-shadow:
    0 22px 54px rgba(15, 23, 42, 0.14),
    0 2px 8px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(28px) saturate(1.18);
}

.brand-mark {
  gap: 12px;
  padding: 8px 18px 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(236, 245, 255, 0.52)),
    rgba(255, 255, 255, 0.7);
  color: #102033;
  box-shadow:
    0 14px 34px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(22px) saturate(1.16);
}

.brand-mark span {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #102033;
  box-shadow: none;
}

.brand-mark strong {
  color: #102033;
  font-weight: 800;
}

.panel,
.control-panel,
.hero-visual,
.story-path span,
.compare-card,
.loop-copy,
.loop-node,
.graph-guide article,
.insight-grid article,
.intro-steps article,
.formula-grid article,
.why-grid article,
.report-grid article,
.stats-grid > div,
.theory-flow article,
.toy-grid article,
.derivation-grid article,
.derivation-panel,
.slider-field,
.status-strip span,
.derivation-status,
.chart-caption,
.matrix-box,
.mini-equation span {
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow:
    0 18px 42px rgba(15, 23, 42, 0.12),
    0 2px 10px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(22px) saturate(1.14);
}

.story-path {
  gap: 14px;
}

.story-path span {
  color: #182437;
  font-weight: 760;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(237, 246, 255, 0.62)),
    rgba(255, 255, 255, 0.72);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.74);
}

.story-path span:nth-child(2),
.story-path span:nth-child(3) {
  color: #243247;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(235, 244, 255, 0.58)),
    rgba(255, 255, 255, 0.66);
}

.mini-equation {
  border-radius: 8px;
}

.mini-equation span {
  color: #172033;
  font-weight: 800;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(232, 242, 255, 0.7)),
    rgba(255, 255, 255, 0.76);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.78);
}

.slider-field input[type="range"] {
  height: 24px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(17, 24, 39, 0.86), rgba(37, 99, 235, 0.78)),
    rgba(226, 232, 240, 0.88);
  box-shadow:
    inset 0 1px 3px rgba(15, 23, 42, 0.16),
    0 10px 22px rgba(15, 23, 42, 0.08);
}

.slider-field input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.12);
}

.slider-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -8px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(226, 239, 255, 0.82)),
    rgba(255, 255, 255, 0.92);
  box-shadow:
    0 8px 18px rgba(15, 23, 42, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);
  cursor: grab;
}

.slider-field input[type="range"]:active::-webkit-slider-thumb {
  cursor: grabbing;
  box-shadow:
    0 10px 22px rgba(37, 99, 235, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

.slider-field input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.12);
}

.slider-field input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(226, 239, 255, 0.82)),
    rgba(255, 255, 255, 0.92);
  box-shadow:
    0 8px 18px rgba(15, 23, 42, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);
  cursor: grab;
}

@keyframes data-breathe {
  0%,
  100% {
    opacity: 0.82;
    filter:
      drop-shadow(0 0 7px currentColor)
      drop-shadow(0 0 14px rgba(255, 255, 255, 0.16));
  }
  50% {
    opacity: 1;
    filter:
      drop-shadow(0 0 14px currentColor)
      drop-shadow(0 0 28px rgba(255, 255, 255, 0.34));
  }
}

@keyframes fade-dot-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.46;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 20px, 1280px);
  }

  .hero-copy {
    min-height: auto;
    padding: 28px 6px;
  }

  .hero h1 {
    font-size: clamp(2.55rem, 13vw, 4rem);
  }

  .topbar {
    position: static;
  }
}

/* English editorial pass: readable classroom typography and a non-sticky top nav. */
:root {
  font-family:
    "Atkinson Hyperlegible", -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Inter", "Segoe UI", sans-serif;
}

body,
button,
input {
  font-family:
    "Atkinson Hyperlegible", -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Inter", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.app-shell {
  width: min(1280px, calc(100vw - 40px));
  padding-top: 0;
}

.topbar {
  position: static !important;
  top: auto !important;
  z-index: 10;
  width: 100%;
  margin: 0 0 clamp(28px, 5vw, 54px);
  padding: 14px clamp(18px, 4vw, 42px);
  border-radius: 0 0 20px 20px;
}

.brand-mark,
.topbar-links a,
.preset-chip,
.play-button,
.slider-label,
.section-label,
.eyebrow,
.math-tag {
  font-family:
    "Atkinson Hyperlegible", -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Inter", "Segoe UI", sans-serif;
}

h1,
h2,
h3,
.brand-mark strong {
  font-family:
    "Crimson Pro", "Iowan Old Style", Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 980px;
  font-size: clamp(3.2rem, 9vw, 7.6rem);
  line-height: 0.94;
}

.hero .lede,
.panel-heading p,
.panel p,
.graph-guide p,
.slider-help,
.chart-caption {
  line-height: 1.68;
}

.panel-heading {
  max-width: 860px;
}

.panel-heading h2 {
  line-height: 1.04;
}

.story-path span {
  font-size: clamp(0.98rem, 2vw, 1.14rem);
  line-height: 1.28;
}

.mini-equation span,
.matrix-box span,
.stats-grid strong,
.status-strip strong {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 20px, 1280px);
    padding-top: 0;
  }

  .topbar {
    margin-bottom: 26px;
    padding: 12px 14px;
    border-radius: 0 0 18px 18px;
  }

  .hero h1 {
    font-size: clamp(2.6rem, 12vw, 4.4rem);
    line-height: 0.98;
  }
}

/* Annotation fixes: Safari scale, theory connectors, status text, and glass sliders. */
.hero h1 {
  max-width: 1040px;
  font-size: clamp(3rem, 6.2vw, 5.7rem);
  line-height: 1.02;
}

.theory-flow {
  gap: 34px;
}

.theory-flow article {
  position: relative;
  overflow: visible;
  padding: 28px 30px;
}

.theory-flow article::after {
  content: "↓";
  position: absolute;
  left: 50%;
  right: auto;
  bottom: -29px;
  top: auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(219, 235, 255, 0.56)),
    rgba(255, 255, 255, 0.62);
  color: #2563eb;
  font-family: "Atkinson Hyperlegible", -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  box-shadow:
    0 12px 26px rgba(37, 99, 235, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px) saturate(1.22);
}

.theory-flow article:last-child::after {
  content: none;
}

.derivation-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 14px 18px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.derivation-status .status-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 8px 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(230, 241, 255, 0.66)),
    rgba(255, 255, 255, 0.72);
  color: #1e3a8a;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow:
    0 8px 18px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

.control-panel.lab-controls {
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(213, 232, 255, 0.44)),
    rgba(235, 245, 255, 0.46);
  box-shadow:
    0 28px 70px rgba(29, 78, 216, 0.14),
    0 12px 26px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(30px) saturate(1.24);
}

.slider-field {
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(224, 239, 255, 0.38)),
    rgba(255, 255, 255, 0.38);
  box-shadow:
    0 14px 30px rgba(15, 23, 42, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(22px) saturate(1.18);
}

.slider-field input[type="range"] {
  height: 28px;
  margin: 12px 0 10px;
}

.slider-field input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(199, 218, 240, 0.5)),
    rgba(226, 238, 252, 0.54);
  box-shadow:
    inset 0 2px 5px rgba(15, 23, 42, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.88);
}

.slider-field input[type="range"]::-webkit-slider-thumb {
  width: 34px;
  height: 22px;
  margin-top: -6px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(209, 229, 255, 0.76)),
    rgba(255, 255, 255, 0.76);
  box-shadow:
    0 9px 18px rgba(15, 23, 42, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(14px);
}

.slider-field input[type="range"]::-moz-range-track {
  height: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  background: rgba(226, 238, 252, 0.72);
}

.slider-field input[type="range"]::-moz-range-thumb {
  width: 34px;
  height: 22px;
  border-radius: 8px;
}

@media (min-width: 980px) {
  .theory-flow {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
  }

  .theory-flow article::after {
    content: "›";
    left: auto;
    right: -25px;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
  }
}

@media (max-width: 760px) {
  .hero h1 {
    font-size: clamp(2.55rem, 10vw, 3.65rem);
    line-height: 1.04;
  }

  .derivation-status {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .derivation-status .status-step {
    width: max-content;
  }
}

/* Book-journey motion pass: sticky-but-not-fixed navigation and page unfolding. */
.topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 60;
  min-height: 72px;
  transform-origin: top center;
  transition:
    min-height 260ms ease,
    padding 260ms ease,
    border-radius 260ms ease,
    box-shadow 260ms ease,
    background 260ms ease,
    backdrop-filter 260ms ease;
}

.topbar.is-scrolled {
  min-height: 58px;
  padding-block: 8px;
  border-radius: 0 0 16px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 250, 255, 0.68)),
    rgba(255, 255, 255, 0.72);
  box-shadow:
    0 16px 34px rgba(15, 23, 42, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.78) inset;
  backdrop-filter: blur(30px) saturate(1.22);
}

.topbar.is-scrolled .brand-mark {
  padding-block: 6px;
  box-shadow:
    0 9px 22px rgba(15, 23, 42, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.topbar-links a {
  position: relative;
}

.topbar-links a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 6px;
  height: 2px;
  border-radius: 999px;
  background: #0f766e;
  opacity: 0;
  transform: scaleX(0.4);
  transform-origin: center;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.topbar-links a.is-active {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.topbar-links a.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.book-reveal {
  opacity: 0;
  transform:
    perspective(1400px)
    translateY(36px)
    rotateX(7deg)
    scale(0.985);
  transform-origin: 50% 0;
  transition:
    opacity 520ms ease,
    transform 640ms cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.book-reveal.is-visible {
  opacity: 1;
  transform:
    perspective(1400px)
    translateY(0)
    rotateX(0)
    scale(1);
}

.panel.book-reveal {
  transform:
    perspective(1600px)
    translateY(42px)
    rotateX(9deg)
    rotateZ(-0.35deg)
    scale(0.985);
}

.panel.book-reveal:nth-of-type(even) {
  transform:
    perspective(1600px)
    translateY(42px)
    rotateX(9deg)
    rotateZ(0.35deg)
    scale(0.985);
}

.panel.book-reveal.is-visible {
  transform:
    perspective(1600px)
    translateY(0)
    rotateX(0)
    rotateZ(0)
    scale(1);
}

.panel::after {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.46), transparent 18%, transparent 74%, rgba(15, 23, 42, 0.035)),
    linear-gradient(90deg, rgba(120, 113, 108, 0.06), transparent 18%);
  opacity: 0.52;
  mix-blend-mode: multiply;
}

.panel > *,
.control-panel > * {
  position: relative;
  z-index: 1;
}

.hero {
  isolation: isolate;
}

.hero::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5%;
  z-index: -1;
  width: min(720px, 70vw);
  height: 220px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 113, 108, 0.12), transparent 64%);
  filter: blur(18px);
  pointer-events: none;
}

@media (max-width: 760px) {
  .topbar {
    top: 0 !important;
    min-height: 64px;
  }

  .topbar.is-scrolled {
    min-height: 54px;
  }

  .book-reveal,
  .panel.book-reveal,
  .panel.book-reveal:nth-of-type(even) {
    transform:
      perspective(1100px)
      translateY(28px)
      rotateX(5deg)
      scale(0.99);
  }
}

@media (prefers-reduced-motion: reduce) {
  .book-reveal,
  .book-reveal.is-visible,
  .panel.book-reveal,
  .panel.book-reveal:nth-of-type(even),
  .panel.book-reveal.is-visible {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
  }

  .topbar,
  .topbar-links a::after {
    transition: none !important;
  }
}

@media (max-width: 760px) {
  .hero-visual {
    min-height: 520px;
    padding-top: 86px;
  }

  .hero-visual .orbit-ring {
    width: min(76vw, 330px);
  }

  .hero-visual .mini-matrix {
    position: absolute;
    top: 18px;
    right: 18px;
    bottom: auto;
    z-index: 4;
    grid-template-columns: repeat(2, 44px);
    padding: 10px;
    gap: 7px;
  }

  .hero-visual .mini-matrix span {
    min-height: 36px;
    font-size: 0.92rem;
  }
}

.hero-visual .mini-matrix {
  top: 26px;
  right: 26px;
  bottom: auto;
  z-index: 4;
}
