/* LoopForge — main.css
 * Instrument-panel aesthetic: cold graphite surfaces, phosphor-amber primary
 * trace, cold-cyan comparison trace, signal-red for instability.
 * Design tokens live in :root — recolor the whole tool from one place.
 */
:root {
  --bg: #0e1216;
  --panel: #161c23;
  --panel-2: #121820;
  --line: #232c36;
  --text: #d8e0e8;
  --muted: #74808c;
  --amber: #ffb454;
  --cyan: #56b8e6;
  --red: #ff5a5a;
  --green: #63d58e;
  --radius: 10px;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-display: "Archivo", var(--font-body);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
header { padding: 26px 0 8px; }
.brandRow { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.wordmark span { color: var(--amber); }
.tagline { color: var(--muted); font-size: 14px; }
.chip {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--green);
  border: 1px solid rgba(99, 213, 142, 0.35);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.hero {
  margin: 26px 0 20px;
  max-width: 760px;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.15;
  margin: 0 0 12px;
}
.hero h1 em { color: var(--amber); font-style: normal; }
.hero p { color: var(--muted); margin: 0; max-width: 640px; }

/* ---------- verdict strip ---------- */
.verdict {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 18px 0;
}
#verdictLine { font-size: 17px; margin: 0 0 16px; }
#verdictLine b { color: var(--amber); }
.verdictGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.vcard {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}
.vcard .who {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.vcard.imc .who { color: var(--cyan); }
.vcard.da .who { color: var(--amber); }
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 6px;
}
.badge.ok { color: var(--green); border: 1px solid rgba(99,213,142,0.4); }
.badge.bad { color: var(--red); border: 1px solid rgba(255,90,90,0.5); background: rgba(255,90,90,0.08); }
.vspeed {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.1;
}
.vsub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.marginTrack {
  margin-top: 10px;
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
.marginTrack::after { /* the |z|=1 threshold mark at 1/1.3 of the track */
  content: "";
  position: absolute; top: 0; bottom: 0;
  left: calc(100% / 1.3);
  width: 2px;
  background: var(--red);
}
.marginFill { height: 100%; border-radius: 3px; transition: width 0.25s ease; }
.marginFill.ok { background: var(--green); }
.marginFill.warn { background: var(--amber); }
.marginFill.bad { background: var(--red); }

/* ---------- main grid ---------- */
.main {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 16px;
  align-items: start;
}
.main > *, .plots, .twoUp, .card, .rail { min-width: 0; }
.rail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  position: sticky;
  top: 12px;
}
.rail h2, .card h2 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.rail .group { margin-bottom: 16px; }
.rail label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 92px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 7px;
}
.rail label .u { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.fieldName { display: block; min-width: 0; white-space: nowrap; }
.fieldName small {
  display: block; color: var(--muted); font-size: 10.5px; font-weight: 400; line-height: 1.25;
  margin-top: 1px; white-space: normal;
}
.rail input, .rail select {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.rail input:focus, .rail select:focus { border-color: var(--amber); outline: none; }
.rail select { margin-bottom: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.definitionBox {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px;
  padding: 10px; margin-top: 10px; color: var(--muted); font-size: 11.5px;
  line-height: 1.4;
}
.definitionBox b { display: block; color: var(--text); margin-bottom: 5px; }
.definitionBox span { display: block; margin-bottom: 4px; }
.definitionBox a { display: inline-block; margin-top: 3px; }

.plots { display: grid; gap: 16px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card .legend {
  display: flex; gap: 18px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--muted);
  margin-bottom: 8px;
}
.legend .sw { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.sw.amber { background: var(--amber); }
.sw.cyan { background: var(--cyan); }
canvas { width: 100%; display: block; }
#sweepCanvas { height: 260px; }
#poleCanvas { height: 330px; }
#stepCanvas { height: 240px; }
.twoUp { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.sliderRow {
  display: flex; align-items: center; gap: 12px;
  margin-top: 10px;
  font-family: var(--font-mono); font-size: 12.5px;
}
.sliderRow input[type="range"] { flex: 1; accent-color: var(--amber); }
#speedReadout { min-width: 92px; text-align: right; color: var(--amber); }

/* ---------- gains ---------- */
.gains pre {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  overflow-x: auto;
  margin: 8px 0 12px;
  white-space: pre;
}
#gainsMeta { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.btnRow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
button {
  font-family: var(--font-body);
  font-size: 13.5px;
  border-radius: 7px;
  padding: 8px 14px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}
button:hover { border-color: var(--amber); }
button.primary { background: var(--amber); border-color: var(--amber); color: #201607; font-weight: 600; }
button.primary:hover { filter: brightness(1.06); }
#copyFlash { color: var(--green); font-size: 13px; opacity: 0; transition: opacity 0.2s; }
#copyFlash.show { opacity: 1; }

/* ---------- waitlist ---------- */
.waitlist {
  margin: 22px 0;
  background: linear-gradient(135deg, rgba(255, 180, 84, 0.07), rgba(86, 184, 230, 0.05));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.waitlist h2 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 6px;
}
.waitlist p { color: var(--muted); margin: 0 0 14px; max-width: 640px; }
.waitlist form { display: flex; gap: 10px; max-width: 480px; }
.waitlist input {
  flex: 1;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 14px;
}
#waitlistMsg { margin-top: 8px; font-size: 13px; color: var(--green); }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line);
  margin-top: 28px;
  padding: 18px 0 40px;
  color: var(--muted);
  font-size: 13px;
}
footer .method { max-width: 820px; }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .main { grid-template-columns: 1fr; }
  .rail { position: static; }
  .twoUp { grid-template-columns: 1fr; }
  .verdictGrid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- interactive block diagrams ---------- */
.diagPair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.diagCol { min-width: 0; }
.diagTitle {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 8px;
}
.tCyan { color: var(--cyan); }
.tAmber { color: var(--amber); }
.diagBox {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
}
.dSvg { width: 100%; height: auto; display: block; }
.dWire { stroke: rgba(160, 180, 200, 0.55); stroke-width: 1.4; }
.dArrHead { fill: rgba(160, 180, 200, 0.75); }
.dDot { fill: rgba(160, 180, 200, 0.75); }
.dSum circle { fill: var(--panel); stroke: rgba(160, 180, 200, 0.6); stroke-width: 1.4; }
.dSign { fill: var(--muted); font: 11px var(--font-mono); }
.dBlock rect {
  fill: #1a2129; stroke: #2c3742; stroke-width: 1.2;
  cursor: pointer; transition: stroke 0.12s ease;
}
.daCol .dBlock:hover rect, .daCol .dBlock:focus rect { stroke: var(--amber); stroke-width: 1.8; }
.imcCol .dBlock:hover rect, .imcCol .dBlock:focus rect { stroke: var(--cyan); stroke-width: 1.8; }
.dBlockLabel { fill: var(--text); font: 600 12.5px var(--font-body); pointer-events: none; }
.dBlockSub { fill: var(--muted); font: 9.5px var(--font-mono); pointer-events: none; }
.dLabel { fill: var(--muted); font: 10.5px var(--font-mono); }
.dIO { fill: var(--text); font: 11px var(--font-mono); }
.dCaption {
  min-height: 58px;
  color: var(--muted); font-size: 12.5px; line-height: 1.45;
  margin: 8px 2px 10px;
}
.dCaption b { color: var(--text); }
.dVal { font-family: var(--font-mono); font-size: 11.5px; color: var(--text); word-break: break-all; }

/* ---------- design chains ---------- */
.chainHead {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin: 4px 0 8px;
}
.chainStep {
  display: grid; grid-template-columns: 26px 1fr; gap: 10px;
  padding: 9px 0; border-top: 1px solid var(--line);
}
.chainStep > div:last-child { min-width: 0; }
.chainNum {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--muted);
  font: 600 11px var(--font-mono);
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}
.daCol .chainNum { border-color: rgba(255, 180, 84, 0.45); color: var(--amber); }
.imcCol .chainNum { border-color: rgba(86, 184, 230, 0.45); color: var(--cyan); }
.chainWhat { font-size: 13px; }
.chainFormula {
  font-family: var(--font-mono); font-size: 12px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 8px; margin: 6px 0 4px; overflow-x: auto; white-space: nowrap;
}
.chainValue { font-family: var(--font-mono); font-size: 11px; color: var(--muted); word-break: break-word; }
.chainWhat, .chainValue { overflow-wrap: anywhere; }

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

/* ---------- top navigation ---------- */
.topnav {
  border-bottom: 1px solid var(--line);
  background: rgba(14, 18, 22, 0.92);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 20;
}
.navRow { display: flex; align-items: center; gap: 18px; padding: 12px 20px; }
.navBrand {
  font-family: var(--font-display); font-weight: 800; font-size: 17px;
  letter-spacing: 0.02em; text-transform: uppercase; color: var(--text);
}
.navBrand span { color: var(--amber); }
.navBrand:hover { text-decoration: none; }
.navLinks { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.navLinks a { color: var(--muted); font-size: 14px; }
.navLinks a:hover { color: var(--text); text-decoration: none; }
.navLinks a.navActive { color: var(--amber); }
.navLinks a.navCta {
  color: #201607; background: var(--amber);
  border-radius: 6px; padding: 6px 12px; font-weight: 600;
}
.navLinks a.navCta:hover { filter: brightness(1.06); }

/* ---------- landing ---------- */
.heroLanding { margin: 44px 0 30px; max-width: 820px; }
.heroCompact { margin: 22px 0 6px; }
.heroCompact h1 { font-size: clamp(22px, 3vw, 30px); }
.ctaRow { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.btnLink {
  display: inline-block; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 18px; color: var(--text); font-weight: 600; font-size: 14.5px;
}
.btnLink:hover { border-color: var(--amber); text-decoration: none; }
.btnLink.primary { background: var(--amber); border-color: var(--amber); color: #201607; }

.topicGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 8px 0 24px; }
.topicCard {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.topicCard:hover { border-color: var(--amber); text-decoration: none; transform: translateY(-2px); }
.topicKicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; }
.tGreen { color: var(--green); }
.topicCard h2 { font-family: var(--font-display); font-size: 20px; margin: 0 0 8px; }
.topicCard p { color: var(--muted); font-size: 13.5px; margin: 0 0 10px; }
.topicCard ul { margin: 0 0 14px; padding-left: 18px; color: var(--muted); font-size: 13px; }
.topicCard li { margin-bottom: 4px; }
.topicGo { color: var(--amber); font-weight: 600; font-size: 14px; }

.strip { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 22px; }
.stripTitle { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.stepRow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stepCell { color: var(--text); font-size: 14px; display: flex; gap: 12px; align-items: flex-start; }
.stepN {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgba(255, 180, 84, 0.5); color: var(--amber);
  font: 600 12px var(--font-mono); display: flex; align-items: center; justify-content: center;
}

/* ---------- inside page ---------- */
.insideControls { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.inlineCtl { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.inlineCtl select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; font-family: var(--font-mono); font-size: 13px;
}
.sliderRow.grow { flex: 1; min-width: 260px; margin-top: 0; }
.prose h3 {
  font-family: var(--font-display); font-size: 16px; margin: 18px 0 6px; color: var(--text);
}
.prose p { color: var(--muted); font-size: 14px; max-width: 860px; }
.prose .mono { font-family: var(--font-mono); }

/* ---------- complete drive-loop overview ---------- */
.overviewCard { margin-top: 16px; }
.sectionIntro {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  margin-bottom: 16px;
}
.sectionIntro p { color: var(--muted); margin: 0; max-width: 760px; font-size: 13.5px; }
.modelTag {
  flex: none; border: 1px solid rgba(99, 213, 142, 0.35); color: var(--green);
  border-radius: 999px; padding: 4px 10px; font: 10.5px var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.systemFlow {
  display: grid;
  grid-template-columns: minmax(115px, .75fr) 24px minmax(170px, 1.15fr) 24px minmax(150px, .95fr) 24px minmax(170px, 1.1fr) 24px minmax(180px, 1.15fr);
  align-items: stretch; gap: 4px;
}
.flowNode {
  min-width: 0; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px; display: flex; flex-direction: column;
  justify-content: center; min-height: 128px;
}
.flowNode b { font-family: var(--font-display); font-size: 14px; line-height: 1.25; }
.flowNode small { color: var(--muted); font-size: 11.5px; line-height: 1.35; margin-top: 5px; }
.flowKicker {
  font: 9.5px var(--font-mono); color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.08em; margin-bottom: 5px;
}
.controllerNode { border-color: rgba(255, 180, 84, 0.34); }
.delayNode { border-color: rgba(255, 180, 84, 0.5); background: rgba(255, 180, 84, 0.045); }
.inverterNode { border-color: rgba(86, 184, 230, 0.4); }
.motorNode { border-color: rgba(99, 213, 142, 0.35); }
.flowArrow {
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  font: 22px var(--font-mono);
}
.bridgeIcon {
  display: grid; grid-template-columns: repeat(3, 10px); grid-template-rows: repeat(2, 10px);
  gap: 5px 12px; margin-top: 10px; width: max-content; position: relative;
}
.bridgeIcon::before, .bridgeIcon::after {
  content: ""; position: absolute; left: -4px; right: -4px; height: 1px; background: var(--cyan);
}
.bridgeIcon::before { top: -4px; }
.bridgeIcon::after { bottom: -4px; }
.bridgeIcon i { display: block; border: 1px solid rgba(86, 184, 230, 0.75); border-radius: 2px; }
.feedbackPath {
  margin: 10px 0 0; display: grid; grid-template-columns: 38px 1fr 38px; gap: 8px;
  align-items: center; border: 1px dashed rgba(86, 184, 230, 0.32); border-radius: 8px;
  padding: 9px 12px; background: rgba(86, 184, 230, 0.025);
}
.feedbackPath > div:nth-child(2) { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 18px; }
.feedbackPath b { color: var(--cyan); font-size: 12.5px; }
.feedbackPath span { color: var(--muted); font-size: 12px; }
.feedbackLead { color: var(--cyan); font: 22px var(--font-mono); text-align: center; }
.delayExplain {
  display: grid; grid-template-columns: 118px minmax(0, 1fr) auto; gap: 14px;
  align-items: center; background: rgba(255, 180, 84, 0.055);
  border: 1px solid rgba(255, 180, 84, 0.28); border-radius: 8px; padding: 12px 14px;
  margin-top: 14px;
}
.delayBadge {
  color: var(--amber); font: 600 11px var(--font-mono); text-transform: uppercase;
  letter-spacing: 0.06em;
}
.delayExplain p { color: var(--muted); font-size: 12.5px; margin: 0; line-height: 1.45; }
.delayExplain p b { color: var(--text); }
.delayNumbers { display: grid; gap: 4px; min-width: 150px; }
.delayNumbers span {
  font: 11px var(--font-mono); color: var(--text); border-left: 2px solid var(--amber);
  padding-left: 8px; white-space: nowrap;
}
.controllerPreview { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.previewCard { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.previewIMC { border-top: 2px solid var(--cyan); }
.previewDA { border-top: 2px solid var(--amber); }
.previewHead {
  font: 600 11px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.previewCard p { color: var(--muted); font-size: 12.5px; margin: 0 0 9px; }
.previewCard p b { color: var(--text); }
.miniLaw {
  background: #0e141a; border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 9px; color: var(--text); font: 11.5px var(--font-mono); overflow-x: auto;
}
.sampleTimeline { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.timelineTitle {
  color: var(--muted); font: 10.5px var(--font-mono); text-transform: uppercase;
  letter-spacing: 0.08em; margin-bottom: 8px;
}
.timelineTrack { display: grid; grid-template-columns: 1fr 24px 1fr 24px 1.25fr 24px 1fr; gap: 5px; align-items: center; }
.timeEvent { background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 9px; min-height: 64px; }
.timeEvent b { display: block; font: 11.5px var(--font-mono); color: var(--text); }
.timeEvent span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.timeEvent.emphasis { border-color: rgba(255, 180, 84, 0.45); }
.timeEvent.emphasis b { color: var(--amber); }
.timeArrow { text-align: center; color: var(--muted); }
.scopeGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
.scopeGrid > div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 13px; }
.scopeGrid b { font-size: 13px; color: var(--text); }
.scopeGrid ul { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; padding-left: 18px; }
.scopeGrid li { margin-bottom: 4px; }

@media (max-width: 920px) {
  .topicGrid, .stepRow { grid-template-columns: 1fr; }
  .navLinks { gap: 12px; }
  .navLinks a { font-size: 13px; }
  .systemFlow { grid-template-columns: 1fr; }
  .flowArrow { transform: rotate(90deg); height: 20px; }
  .flowNode { min-height: auto; }
  .delayExplain { grid-template-columns: 1fr; }
  .controllerPreview, .scopeGrid { grid-template-columns: 1fr; }
  .timelineTrack { grid-template-columns: 1fr; }
  .timeArrow { transform: rotate(90deg); height: 18px; }
  .sectionIntro { flex-direction: column; }
}

@media (max-width: 560px) {
  .rail label { grid-template-columns: minmax(0, 1fr) auto 82px; }
  .fieldName { white-space: normal; }
  .feedbackPath { grid-template-columns: 28px 1fr 28px; }
  .insideControls { width: 100%; }
  .inlineCtl { width: 100%; min-width: 0; }
  .inlineCtl select { min-width: 0; width: 100%; }
  .diagPair, .diagCol, .chain, .chainStep { min-width: 0; max-width: 100%; }
  .chainFormula { max-width: 100%; }
  .waitlist form { width: 100%; }
  .waitlist input { min-width: 0; }
}

/* ---------- live recompute + controller study mode ---------- */
.verdictTopline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.verdictTopline #verdictLine { margin: 0; flex: 1; }
.updateStatus {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  max-width: 360px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.35;
  text-align: right;
}
.updateDot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(99, 213, 142, 0.10);
  flex: 0 0 auto;
}
.updateStatus.busy .updateDot {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 180, 84, 0.10);
  animation: statusPulse 0.8s ease-in-out infinite alternate;
}
.updateStatus.invalid .updateDot {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 90, 90, 0.10);
}
@keyframes statusPulse { to { opacity: 0.35; } }

.modeBox {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 16px;
}
.rail .modeOption {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  margin: 0 0 10px;
  cursor: pointer;
}
.rail .modeOption input {
  width: 14px;
  height: 14px;
  margin: 3px 0 0;
  padding: 0;
  accent-color: var(--amber);
}
.modeOption span { min-width: 0; }
.modeOption b {
  display: block;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.25;
}
.modeOption small {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
  margin-top: 2px;
}
#captureBaseline {
  width: 100%;
  padding: 7px 9px;
  font-size: 12px;
  margin-top: 2px;
}
.baselineSummary {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
  margin-top: 8px;
}
.modeBox.isFrozen {
  border-color: rgba(255, 180, 84, 0.45);
  box-shadow: inset 3px 0 0 rgba(255, 180, 84, 0.75);
}
.modeBox.isFrozen .baselineSummary { color: var(--amber); }

@media (max-width: 700px) {
  .verdictTopline { display: block; }
  .updateStatus { margin-top: 8px; max-width: none; text-align: left; }
}
.rail label.designDeferred .fieldName,
.rail label.designDeferred .u { opacity: 0.58; }
.rail label.designDeferred input { border-style: dashed; }

/* ---------- adaptive learning experience ---------- */
.eyebrow {
  display: block;
  color: var(--muted);
  font: 10px var(--font-mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.experienceShell {
  display: grid;
  grid-template-columns: minmax(250px, .9fr) minmax(440px, 1.4fr);
  gap: 14px 24px;
  align-items: center;
  background: linear-gradient(135deg, rgba(255, 180, 84, .09), rgba(86, 184, 230, .045));
  border: 1px solid rgba(255, 180, 84, .25);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 4px 0 14px;
}
.experienceCopy h2, .coachCopy h2, .interpretationCard h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 18px;
}
.experienceCopy p, .coachCopy p, .interpretationCard p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.experienceActions { display: grid; gap: 10px; justify-items: end; }
.levelSwitch {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  width: min(100%, 430px);
}
.levelButton {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  font: 600 12px var(--font-body);
}
.levelButton:hover { border: 0; color: var(--text); }
.levelButton.active {
  color: #201607;
  background: var(--amber);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
}
.studioActions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.studioActions button { padding: 7px 10px; font-size: 12px; }
.learningProgress {
  grid-column: 1 / -1;
  border-top: 1px solid rgba(160, 180, 200, .15);
  padding-top: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.progressLabel { color: var(--muted); font: 10px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.progressSteps { display: flex; gap: 7px; flex-wrap: wrap; }
.progressSteps span {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  font: 10px var(--font-mono);
  transition: .18s ease;
}
.progressSteps span.done {
  color: var(--green);
  border-color: rgba(99, 213, 142, .35);
  background: rgba(99, 213, 142, .06);
}
.progressSteps span.done::before { content: "✓ "; }

.coachCard {
  display: grid;
  grid-template-columns: 44px minmax(220px, 1fr) auto;
  gap: 12px 16px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
  padding: 13px 15px;
  margin-bottom: 14px;
}
.coachAvatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #201607;
  background: var(--amber);
  font: 800 13px var(--font-display);
}
.coachButtons { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.coachButtons button { padding: 7px 10px; font-size: 11.5px; }
.quietButton { opacity: .76; }

.interpretationCard {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-top: 15px;
  padding: 13px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.interpretationSignal {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  border: 1px solid rgba(99, 213, 142, .4);
  background: rgba(99, 213, 142, .06);
  font-weight: 800;
}
.interpretationCard.risk .interpretationSignal {
  color: var(--red);
  border-color: rgba(255, 90, 90, .42);
  background: rgba(255, 90, 90, .07);
}
.interpretationCard.caution .interpretationSignal {
  color: var(--amber);
  border-color: rgba(255, 180, 84, .42);
  background: rgba(255, 180, 84, .07);
}
#explainWhy { padding: 6px 10px; font-size: 11.5px; }
.insightMetrics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.insightMetrics span {
  padding: 3px 7px;
  border-radius: 5px;
  background: #0f151b;
  border: 1px solid var(--line);
  color: var(--muted);
  font: 10.5px var(--font-mono);
}
.insightMetrics b { color: var(--text); font-weight: 500; }

.experimentBoard { border-top: 2px solid rgba(255, 180, 84, .62); }
.compactIntro { margin-bottom: 11px; }
.compactIntro p { margin-top: 4px; }
.experimentGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.experimentGrid button {
  text-align: left;
  min-height: 78px;
  padding: 11px 12px;
  background: var(--panel-2);
}
.experimentGrid button:hover { transform: translateY(-1px); }
.experimentGrid b { display: block; color: var(--text); font-size: 12.5px; margin-bottom: 4px; }
.experimentGrid span { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; }
#activeExperimentTag.active { color: var(--amber); border-color: rgba(255, 180, 84, .4); }

.advancedDiagnostics { border-top: 2px solid rgba(86, 184, 230, .5); }
.diagnosticGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.diagnosticGrid > div {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
}
.diagnosticGrid span { display: block; color: var(--muted); font: 10px var(--font-mono); margin-bottom: 4px; }
.diagnosticGrid b { color: var(--text); font: 500 13px var(--font-mono); }

body[data-level="beginner"] .levelEngineer,
body[data-level="beginner"] .levelAdvanced,
body[data-level="engineer"] .levelAdvanced { display: none !important; }
body[data-level="advanced"] .levelEngineer,
body[data-level="advanced"] .levelAdvanced,
body[data-level="engineer"] .levelEngineer { display: block; }
body[data-level="beginner"] .rail { position: static; }
body[data-level="beginner"] .main { grid-template-columns: 300px 1fr; }

.tourOverlay { position: fixed; inset: 0; z-index: 1000; }
.tourScrim { position: absolute; inset: 0; background: rgba(4, 8, 12, .74); backdrop-filter: blur(2px); }
.tourDialog {
  position: fixed;
  z-index: 1003;
  right: 22px;
  bottom: 22px;
  width: min(420px, calc(100vw - 28px));
  background: var(--panel);
  border: 1px solid rgba(255, 180, 84, .55);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .48);
}
.tourCounter { color: var(--amber); font: 10px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.tourDialog h2 { font-family: var(--font-display); font-size: 20px; margin: 7px 0 7px; }
.tourDialog p { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 14px; }
.tourActions { display: flex; gap: 8px; }
.tourActions #tourClose { margin-left: auto; }
.tourTarget {
  position: relative !important;
  z-index: 1002 !important;
  outline: 3px solid var(--amber);
  outline-offset: 5px;
  box-shadow: 0 0 0 9px rgba(255, 180, 84, .12), 0 20px 50px rgba(0, 0, 0, .45) !important;
}

@media (max-width: 920px) {
  .experienceShell { grid-template-columns: 1fr; }
  .experienceActions { justify-items: stretch; }
  .levelSwitch { width: 100%; }
  .studioActions { justify-content: flex-start; }
  .coachCard { grid-template-columns: 44px 1fr; }
  .coachButtons { grid-column: 1 / -1; justify-content: flex-start; }
  .experimentGrid, .diagnosticGrid { grid-template-columns: 1fr; }
  body[data-level="beginner"] .main { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .experienceShell { padding: 14px; }
  .experienceActions, .studioActions, .studioActions button { width: 100%; }
  .levelButton { padding: 8px 4px; font-size: 11px; }
  .learningProgress { align-items: flex-start; flex-direction: column; gap: 7px; }
  .coachCard { grid-template-columns: 1fr; }
  .coachAvatar { display: none; }
  .coachButtons { grid-column: auto; }
  .coachButtons button { width: 100%; }
  .interpretationCard { grid-template-columns: 34px 1fr; }
  #explainWhy { grid-column: 1 / -1; width: 100%; }
  .tourDialog { right: 14px; bottom: 14px; }
}

/* ---------- commercial launch layer ---------- */
.eyebrow {
  display: block; margin-bottom: 7px; color: var(--amber); font: 600 11px var(--font-mono);
  letter-spacing: .1em; text-transform: uppercase;
}
.commercialCta {
  margin: 22px 0; padding: 22px; display: flex; align-items: center;
  justify-content: space-between; gap: 24px; background: linear-gradient(135deg, rgba(255,180,84,.09), rgba(86,184,230,.04));
  border: 1px solid rgba(255,180,84,.28); border-radius: var(--radius);
}
.commercialCta h2 { margin: 0 0 7px; font: 700 clamp(20px, 3vw, 27px) var(--font-display); }
.commercialCta p { max-width: 700px; margin: 0; color: var(--muted); }
.commercialActions { flex: none; display: grid; justify-items: end; gap: 9px; }
.commercialPrice { color: var(--text); font: 500 12px var(--font-mono); white-space: nowrap; }
.offerGrid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; margin: 10px 0 22px; }
.offerCard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.featuredOffer { border-color: rgba(255,180,84,.48); box-shadow: 0 18px 55px rgba(0,0,0,.18); }
.offerKicker { color: var(--amber); font: 600 11px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.offerCard h2 { margin: 7px 0 10px; font: 700 25px var(--font-display); }
.offerPrice { color: var(--text); font: 700 clamp(24px, 4vw, 34px) var(--font-display); }
.offerDuration, .secureNote, .offerCard p { color: var(--muted); }
.offerList { padding-left: 20px; margin: 18px 0 22px; }
.offerList li { margin-bottom: 9px; }
.textAction { display: inline-block; margin: 15px 0 0 14px; font-size: 13px; }
.secureNote { font-size: 12px; margin: 14px 0 0; }
.consultationProcess span { color: var(--muted); }
.legalSummary { margin: 22px 0; padding: 20px; border-left: 3px solid var(--cyan); background: rgba(86,184,230,.045); }
.legalSummary h2 { margin-top: 0; font-family: var(--font-display); }
.legalSummary p { margin-bottom: 0; color: var(--muted); }
.successShell { max-width: 760px; min-height: 65vh; display: grid; place-items: center; }
.successCard { text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(28px, 6vw, 55px); }
.successCard h1 { font-family: var(--font-display); }
.successCard p { color: var(--muted); max-width: 580px; }
.successMark { width: 58px; height: 58px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: rgba(99,213,142,.12); border: 1px solid rgba(99,213,142,.45); color: var(--green); font-size: 28px; }
.legalPage { max-width: 860px; padding-top: 36px; }
.legalPage h1 { font: 700 clamp(28px,5vw,42px) var(--font-display); }
.legalPage h2 { margin: 28px 0 7px; font: 700 19px var(--font-display); }
.legalPage p { color: var(--muted); }
.legalFootnote { margin-top: 34px; padding: 14px; border: 1px solid rgba(255,180,84,.25); border-radius: 8px; }
.launchSetupNotice { margin: 24px 0; padding: 15px; color: var(--amber); background: rgba(255,180,84,.08); border: 1px solid rgba(255,180,84,.32); border-radius: 8px; }
.disabledLink { opacity: .72; }

@media (max-width: 760px) {
  .offerGrid { grid-template-columns: 1fr; }
  .commercialCta { align-items: flex-start; flex-direction: column; }
  .commercialActions { justify-items: start; width: 100%; }
  .commercialPrice { white-space: normal; }
  .textAction { display: block; margin: 14px 0 0; }
}
