/* Delta-V "bring your runs" pages: workbench, evidence, landing additions.
   Uses the existing tokens from app.css. In charts Delta-V's data takes the accent and both baselines are grey;
   series are also told apart by marker shape and dash, never by colour alone. */
:root {
  --c-pre: var(--accent);
  --c-gp: var(--line-strong);
  --c-scr: var(--text-2);
  --mock: #f5c273;
}
html[data-theme="light"] {
  --mock: #936015;
}

/* ---------- MOCK labelling ---------- */
.mock-tag,
.badge.mock-badge {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid var(--mock);
  color: var(--mock);
  background: transparent;
  vertical-align: middle;
  line-height: 1.3;
}
.badge.mock-badge {
  margin-left: 4px;
}
.mock-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 20px;
  padding: 12px 16px;
  border: 1px solid var(--mock);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
}
.mock-banner strong {
  color: var(--text);
}
.mock-banner .mock-tag {
  flex: none;
  margin-top: 2px;
}
body:not([data-mock]) .mock-badge {
  display: none;
}
body[data-page="workbench"] #wake,
body[data-page="evidence"] #wake,
body[data-page="workbench"] .sidebar-info,
body[data-page="evidence"] .sidebar-info {
  display: none;
}

/* ---------- Charts ---------- */
/* Charts are drawn at their container's measured width (mountChart) and never
   scaled up past it, so their text renders at its specified size. */
.chart-mount {
  width: 100%;
  min-height: 280px;
}
.chart-figure {
  margin: 16px 0 0;
}
.chart-title {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.flow-chart {
  display: block;
  width: 100%;
  height: auto;
}
.flow-chart .grid {
  stroke: var(--line);
}
.flow-chart .axis,
.flow-chart .tickmark {
  stroke: var(--line-strong);
}
.flow-chart .tick {
  fill: var(--text-3);
  font: 12px "IBM Plex Mono", monospace;
}
.flow-chart .axis-label {
  fill: var(--text-2);
  font-size: 12px;
}
.flow-chart .line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
}
.flow-chart .s-pre {
  --c: var(--c-pre);
}
.flow-chart .s-gp {
  --c: var(--c-gp);
}
.flow-chart .s-scr {
  --c: var(--c-scr);
}
.flow-chart .line,
.flow-chart .whisker {
  stroke: var(--c);
}
.flow-chart .whisker {
  stroke-width: 1.5;
  opacity: 0.6;
}
.flow-chart .dot {
  fill: var(--c);
  stroke: var(--bg);
  stroke-width: 1.5;
}
.flow-chart .band {
  fill: var(--c);
  opacity: 0.2;
}
.flow-chart .band.s-gp {
  opacity: 0.14;
}
.flow-chart .bound {
  fill: none;
  stroke: var(--c);
  stroke-width: 1;
  stroke-opacity: 0.55;
}
.flow-chart .obs {
  fill: var(--text);
  stroke: var(--bg);
  stroke-width: 2;
}
/* Runs whose held controls differ from the slice: hollow, so they never read as
   observations the curve should pass through. */
.flow-chart .proj {
  fill: none;
  stroke: var(--text-3);
  stroke-width: 1.5;
}
.flow-chart .nextline {
  stroke: var(--mock);
  stroke-dasharray: 4 4;
  stroke-width: 1.5;
}
.flow-chart .next-label {
  fill: var(--text-2);
  font: 600 12px "IBM Plex Mono", monospace;
}
.flow-chart .target {
  stroke: var(--text-3);
  stroke-dasharray: 2 4;
}
.flow-chart .target-label {
  fill: var(--text-2);
  font-size: 12px;
}
.flow-chart .direct {
  fill: var(--text-2);
  font-size: 12px;
}
.flow-chart .watermark {
  fill: var(--text);
  opacity: 0.07;
  font: 700 58px "IBM Plex Sans", sans-serif;
  letter-spacing: 0.12em;
  pointer-events: none;
}
.flow-chart .hit {
  fill: transparent;
}
.flow-chart .hit:hover {
  stroke: var(--text-3);
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  list-style: none;
  margin: 10px 0 0;
  padding: 16px 0;
  font-size: 12px;
  color: var(--text-2);
}
.chart-legend .swatch {
  display: inline-block;
  width: 20px;
  height: 0;
  border-top: 2px solid var(--c, var(--text-3));
  margin-right: 8px;
  vertical-align: middle;
}
.chart-legend .s-pre {
  --c: var(--c-pre);
}
.chart-legend .s-gp {
  --c: var(--c-gp);
}
.chart-legend .s-scr {
  --c: var(--c-scr);
}
.chart-legend .swatch[data-dash] {
  border-top-style: dashed;
}
.chart-legend .swatch[data-shape] {
  width: 22px;
  height: 10px;
  border-top: 0;
  background:
    linear-gradient(var(--c), var(--c)) center / 22px 2px no-repeat;
  position: relative;
}
.chart-legend .swatch[data-dash][data-shape] {
  background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 8px) center / 22px 2px no-repeat;
}
.chart-legend .swatch[data-shape]::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 1px;
  width: 8px;
  height: 8px;
  background: var(--c);
  border-radius: 50%;
}
.chart-legend .swatch[data-shape="square"]::after {
  border-radius: 0;
}
.chart-legend .swatch[data-shape="diamond"]::after {
  border-radius: 0;
  transform: rotate(45deg) scale(0.9);
}
.chart-legend .swatch.band-sw[data-shape]::after {
  display: none;
}
.chart-legend .swatch.proj-sw {
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--text-3);
  border-radius: 50%;
}
.chart-legend .swatch.obs-sw {
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
}
.chart-legend .swatch.band-sw {
  width: 20px;
  height: 10px;
  border: 0;
  background: var(--c, var(--c-pre));
  opacity: 0.3;
}
.chart-legend .swatch.next-sw {
  border-top-color: var(--mock);
  border-top-style: dashed;
}
#flow-tip {
  position: absolute;
  z-index: 60;
  max-width: 280px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  box-shadow: var(--shadow);
  pointer-events: none;
}

/* ---------- Shared bits ---------- */
.flow-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.flow-table th,
.flow-table td {
  padding: 10px 14px 10px 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
/* Headers carry the user's own column names, so they are shown exactly as written, never re-cased. */
.flow-table thead th {
  font: 500 13px "IBM Plex Sans", sans-serif;
  color: var(--text-3);
  white-space: nowrap;
  border-bottom-color: var(--line-strong);
}
.flow-table td.num,
.flow-table th.num {
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums;
  padding-left: 14px;
}
.flow-table thead th.num {
  font-family: "IBM Plex Sans", sans-serif;
}
.flow-table tr[aria-current] td {
  color: var(--accent);
}
/* Positioned, so visually hidden header text cannot escape the scroll box and widen the page. */
.table-scroll {
  position: relative;
  max-width: 100%;
  overflow: auto;
}
.plain-list code {
  overflow-wrap: anywhere;
}
.table-scroll:focus-visible {
  outline-offset: 2px;
}
.flow-note {
  max-width: 78ch;
  color: var(--text-3);
  margin: 12px 0 0;
}
.pad {
  padding: 18px;
}

/* ---------- Workbench ---------- */
/* Stepper: quiet text steps on a hairline. State comes from the server (see stepStates). */
.wb-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  list-style: none;
  margin: 24px 0 32px;
  padding: 0;
  border-bottom: 1px solid var(--line);
}
.wb-steps button {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  padding: 10px 8px 12px 0;
  min-height: 56px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.wb-steps button:hover:not(:disabled) {
  color: var(--text);
}
.wb-steps button:disabled {
  color: var(--text-3);
  cursor: not-allowed;
}
.wb-steps button[aria-current="step"] {
  color: var(--accent);
  border-bottom-color: var(--text);
  font-weight: 500;
}
.wb-steps .n {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--text-3);
  font: 12px "IBM Plex Mono", monospace;
}
.wb-steps .is-done .n {
  border-color: var(--text-2);
  color: var(--text);
}
.wb-steps .is-running .n,
.wb-steps .is-stale .n {
  border-color: var(--mock);
  color: var(--mock);
}
.wb-steps .lbl {
  display: grid;
  gap: 2px;
}
.wb-steps small {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
}
.mobile-step {
  display: none;
}
.wb-page-head {
  margin-bottom: 16px;
}
#wb-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 14px;
}
.scope-banner {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-2);
}
.state {
  font-size: 13px;
  color: var(--text-2);
}
.state::before {
  content: none;
}

/* Step content: one heading, a lede, then sections divided by hairlines (no nested cards). */
.wb-head h2 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: -0.02em;
}
.wb-head h2:focus {
  outline: none;
}
.wb-lede {
  max-width: 72ch;
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.6;
}
.status-line {
  max-width: 72ch;
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--text-2);
}
.wb-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.wb-section > h3,
.section-bar h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.section-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}
.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px;
}
.entry {
  padding-top: 20px;
  border-top: 1px solid var(--line-strong);
}
.entry h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.facts {
  display: grid;
  gap: 0;
  margin: 0 0 8px;
  max-width: 900px;
}
.facts > div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.facts dt {
  font: 14px "IBM Plex Sans", sans-serif;
  color: var(--text-3);
}
.facts dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 16px;
  margin-bottom: 8px;
}
.toolbar-note {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-2);
}
.table-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  margin: 16px 0 8px;
}
.table-bar .flow-note {
  margin: 0;
}

/* Explore: the figure first; a 300px controls column only when the panel can hold both. */
#wb-panel {
  container-type: inline-size;
}
.explore-main,
.explore-side {
  min-width: 0;
}
.explore-side {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}
@container (min-width: 860px) {
  .explore {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 32px;
    align-items: start;
  }
  .explore-side {
    margin-top: 0;
    padding-left: 24px;
    border-left: 1px solid var(--line);
  }
}
.side-group {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 14px;
}
.side-group legend {
  padding: 0;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.side-group + .side-group {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.side-group .actions {
  margin-top: 0;
}
.chart-status {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-2);
}
.is-stale {
  opacity: 0.45;
  transition: opacity 0.2s;
}
.interval-help {
  margin-top: 8px;
}
.interval-help p {
  max-width: 72ch;
  font-size: 14px;
}
.wb-next-step {
  margin-top: 32px;
}

/* Fields and controls */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 4px 0 16px;
}
.field {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--text-2);
}
.field.inline {
  flex: 1 1 140px;
  max-width: 240px;
}
.toolbar-note {
  flex-basis: 100%;
}

.field input,
.field select,
.mobile-step select {
  min-height: 44px;
  padding: 8px 10px;
  color: var(--text);
  background-color: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  min-width: 0;
}
.field select,
.mobile-step select {
  padding-right: 40px;
}
.field input[type="range"] {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
}
.field input[aria-invalid="true"] {
  border-color: #e5707a;
}
.field output {
  font: 14px "IBM Plex Mono", monospace;
  color: var(--text);
}
.field small {
  color: var(--text-3);
  font-size: 12px;
}
.check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--text-2);
}
.check input {
  margin-top: 3px;
  accent-color: var(--text-2);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
}
.text-link {
  color: var(--accent);
  font-size: 14px;
}
.dropzone {
  display: grid;
  gap: 10px;
  place-items: center;
  text-align: center;
  padding: 40px 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--text-2);
  font-size: 15px;
}
.dropzone.compact {
  padding: 20px;
  justify-items: start;
  text-align: left;
}
.dropzone strong {
  color: var(--text);
  font-weight: 500;
}
.dropzone.over {
  border-color: var(--text-2);
  background: var(--surface);
}
.dropzone:focus-within label.btn {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.dropzone label.btn {
  cursor: pointer;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.issues {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-width: 900px;
}
.issues li {
  display: flex;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface);
}
.issues .lvl {
  flex: none;
  font-size: 14px;
  font-weight: 600;
}
.issues .error .lvl {
  color: #e5707a;
}
.issues .warn .lvl {
  color: var(--mock);
}
.issues .ok .lvl {
  color: var(--live);
}
html[data-theme="light"] .issues .error .lvl {
  color: #b3263a;
}
.progress {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
  margin: 14px 0 6px;
}
.progress > div {
  height: 100%;
  width: 0;
  background: var(--text-2);
  transition: width 0.25s linear;
}
/* Fit progress: runs against the budget, settings within target, uncertainty per fit */
.fit-progress .progress-heading {
  border-top: 1px solid var(--line);
  margin: 20px 0 8px;
  padding-top: 16px;
  font-size: 1rem;
}
.uncert-bar .target small {
  position: absolute;
  left: 0;
  bottom: 100%;
  transform: translateX(-50%);
  font: 11px "IBM Plex Sans", sans-serif;
  color: var(--text-2);
}
.uncert-list .uncert-bar { margin-top: 18px; }
.fit-progress .field.inline input {
  width: 7em;
}
.meter-item {
  min-width: 0;
}
.meter-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
  color: var(--text-2);
}
.meter-head strong {
  font: 500 20px "IBM Plex Sans", sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.progress.meter {
  height: 8px;
  border-radius: 4px;
  margin: 8px 0 6px;
}
.progress.meter > div {
  background: var(--accent);
}
.progress.meter.over > div {
  background: var(--warn);
}
.fit-progress {
  margin-bottom: 24px;
}
.meter-item small {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-3);
}
.meter-title {
  margin: 20px 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.uncert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.uncert-list li {
  max-width: 760px;
  display: grid;
  grid-template-columns: minmax(0, 15em) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-2);
}
.uncert-bar {
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: var(--line);
}
.uncert-bar .fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 5px;
  background: var(--warn);
  transition: width 0.25s linear;
}
.uncert-bar .fill.ok {
  background: var(--live);
}
.uncert-bar .target {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: var(--text);
}
.uncert-val {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
}
@media (max-width: 640px) {
  .uncert-list li {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .uncert-bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}
.chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 12px;
  color: var(--text-2);
}
.limits-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
}

/* Report */
.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 8px 0 12px;
}
.metric-strip > div {
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 16px 16px 16px 0;
}
.metric-strip > div + div {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}
.metric-strip span {
  font-size: 13px;
  color: var(--text-3);
}
.metric-strip strong {
  font: 500 22px "IBM Plex Sans", sans-serif;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.metric-strip small {
  font-size: 12px;
  color: var(--text-3);
}
.ledger th[scope="row"] {
  color: var(--text);
  font: 14px "IBM Plex Sans", sans-serif;
  white-space: nowrap;
}
.ledger td:last-child {
  color: var(--text-2);
  font-size: 13px;
  min-width: 240px;
}
.scenario {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.scenario-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.scenario-form .actions {
  grid-column: 1 / -1;
  margin-top: 0;
}
.scenario-out .flow-table th[scope="row"] {
  color: var(--text-2);
  font: 14px "IBM Plex Sans", sans-serif;
}
.danger-zone {
  border-top-color: #e5707a55;
}
.danger-zone h3 {
  color: #e5707a;
}
html[data-theme="light"] .danger-zone h3 {
  color: #b3263a;
}
@media (max-width: 760px) {
  .entry-grid,
  .scenario,
  .scenario-form {
    grid-template-columns: 1fr;
  }
  .facts > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* ---------- Landing additions ---------- */
.claim-chip {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 18px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-2);
}
.claim-chip a {
  color: var(--accent);
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.how-card {
  padding: 24px 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  border-top: 1px solid var(--line);
}
.how-card h3 {
  font-size: 17px;
  margin: 10px 0 8px;
}
.how-card p {
  font-size: 15px;
  line-height: 1.65;
  margin: 0;
}
.example-split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}
.example-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

@media (max-width: 1100px) {
  .wb-grid,
  .example-split {
    grid-template-columns: 1fr;
  }
  .how-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}
@media (max-width: 640px) {
  .how-grid {
    grid-template-columns: 1fr;
  }
  .wb-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .flow-chart .watermark {
    font-size: 44px;
  }
  .pad {
    padding: 14px;
  }
}

/* ---------- Workbench form bits ---------- */
.code-sample {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font: 12px/1.6 "IBM Plex Mono", monospace;
  overflow-x: auto;
}
textarea.paste {
  width: 100%;
  padding: 10px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: 12px/1.5 "IBM Plex Mono", monospace;
  resize: vertical;
}

body[data-page="workbench"] .sidebar-bottom,
body[data-page="evidence"] .sidebar-bottom {
  display: none;
}
.flow-chart .target-label {
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 3px;
}

/* Marks never swallow pointer events; only the larger invisible hit targets do. */
.flow-chart .line,
.flow-chart .dot,
.flow-chart .whisker,
.flow-chart .band,
.flow-chart .obs,
.flow-chart .nextline,
.flow-chart .watermark,
.flow-chart .proj,
.flow-chart .bound,
.flow-chart text {
  pointer-events: none;
}
.flow-chart .hit {
  pointer-events: all;
}

/* ---------- Study workflow (Tasks 10/11) ---------- */
.evidence-tag,
.data-tag {
  display: inline-block;
  font: 500 12px "IBM Plex Sans", sans-serif;
  letter-spacing: 0;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  vertical-align: middle;
  line-height: 1.3;
}
.data-tag.customer_simulation {
  color: var(--text);
}
.claim-card {
  max-width: 62ch;
  margin: 0 0 18px;
  padding: 20px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 14px;
  line-height: 1.55;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.claim-card p {
  margin: 0 0 6px;
}
.claim-card .claim-qual {
  font-size: 13px;
  color: var(--text-2);
}
.claim-card a {
  font-size: 14px;
  color: var(--accent);
}
.issues .fix {
  display: block;
  font-style: normal;
  color: var(--text-2);
  margin-top: 2px;
}
.issues .fix::before {
  content: "Fix: ";
  font-weight: 600;
}
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.job {
  margin: 16px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.job p {
  margin: 0;
}
.parity-mount {
  max-width: 480px;
}
.result-split {
  display: grid;
  grid-template-columns: minmax(0, 480px) minmax(200px, 1fr);
  gap: 40px;
  align-items: start;
}
.result-notes {
  display: grid;
  gap: 0;
  margin: 16px 0 0;
}
.result-notes > div {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.result-notes dt {
  font: 13px "IBM Plex Sans", sans-serif;
  color: var(--text-3);
}
.result-notes dd {
  margin: 2px 0 0;
  font: 500 20px "IBM Plex Sans", sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.result-notes small {
  display: block;
  font: 400 12px "IBM Plex Sans", sans-serif;
  color: var(--text-3);
}
@media (max-width: 900px) {
  .result-split {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
/* Predicted fields: native 64 x 64 grid, square domain, numeric colour bar under each. */
.field-maps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.field-maps figure {
  margin: 0;
  min-width: 0;
}
.field-maps canvas:not(.cbar-strip) {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  image-rendering: pixelated;
  display: block;
}
.field-maps figcaption {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-2);
}
.field-maps figcaption strong {
  font-weight: 500;
  color: var(--text);
}
.cbar-strip {
  width: 100%;
  height: 6px;
  display: block;
}
.cbar-ticks {
  display: flex;
  justify-content: space-between;
  font: 12px "IBM Plex Mono", monospace;
  color: var(--text-3);
}
/* Solver and predicted fields: 64 x 128 grid, so panels keep a 2:1 shape. */
.fc-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 12px 0;
}
.fc-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.fc-seg button {
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  cursor: pointer;
}
.fc-seg button[aria-pressed="true"] {
  color: var(--text);
  background: var(--surface-2);
  font-weight: 500;
}
.fc-maps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.fc-stage {
  position: relative;
}
.fc-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.fc-motion {
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  cursor: pointer;
}
.fc-motion[aria-pressed="true"] {
  color: var(--text);
  background: var(--surface-2);
}
.fc-maps figure {
  margin: 0;
  min-width: 0;
}
.fc-map {
  display: block;
  width: 100%;
  aspect-ratio: 2;
  height: auto;
  image-rendering: pixelated;
  background: var(--surface-2);
}
.fc-maps figcaption {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-2);
}
.fc-maps figcaption strong {
  font-weight: 500;
  color: var(--text);
}
@media (max-width: 760px) {
  .fc-maps {
    grid-template-columns: minmax(0, 1fr);
  }
}
.budget .eyebrow {
  margin: 0 0 6px;
}
.budget .verdict {
  margin: 8px 0;
  font-weight: 500;
  color: var(--text);
}
.flow-table td.neg {
  color: #e5707a;
}
html[data-theme="light"] .flow-table td.neg {
  color: #b3263a;
}
/* Evidence: one measured finding, one figure, then findings and limits side by side. */
.ev-lead {
  padding: 8px 0 32px;
  border-bottom: 1px solid var(--line);
}
.ev-figure {
  margin: 0 0 12px;
  font-size: 20px;
  color: var(--text);
  max-width: 40ch;
  line-height: 1.35;
}
.ev-figure strong {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ev-lead-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px 40px;
}
.ev-label {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text-3);
}
.ev-qual {
  max-width: 72ch;
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}
.ev-section {
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
}
.ev-section h2 {
  font-size: 22px;
  margin: 0 0 8px;
}
.ev-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
}
.ev-sources {
  padding: 24px 0;
}
@media (max-width: 760px) {
  .ev-two {
    grid-template-columns: 1fr;
  }
}
.btn.danger {
  border-color: #e5707a;
  color: #e5707a;
  background: transparent;
}
html[data-theme="light"] .btn.danger {
  border-color: #b3263a;
  color: #b3263a;
}
.fit-form {
  margin-top: 12px;
}
.fit-form .field {
  max-width: 420px;
}
.plain-list {
  margin: 8px 0 14px;
  padding-left: 20px;
  color: var(--text-2);
}
.plain-list li + li {
  margin-top: 4px;
}
.plain-list strong {
  color: var(--text);
}
.page-heading p,
.plain-list,
.hero-description {
  max-width: 72ch;
}
.plain-list {
  font-size: 15px;
  line-height: 1.65;
}
.flow-note,
.chart-legend {
  font-size: 13px;
  line-height: 1.6;
}
.chart-data {
  margin: 12px 0 0;
}
.chart-data summary,
details > summary {
  cursor: pointer;
  color: var(--text-2);
  font-size: 14px;
}
.chart-data .table-scroll {
  max-height: 320px;
  margin-top: 8px;
}

/* Responsive composition */
@media (max-width: 900px) {
  .workspace-content {
    padding: 24px;
  }
  .hero {
    gap: 32px;
  }
}
@media (max-width: 640px) {
  .workspace-content {
    padding: 20px 16px;
  }
  .mobile-step {
    display: grid;
    gap: 6px;
    margin: 16px 0 24px;
  }
  .wb-steps {
    display: none;
  }
  .hero {
    grid-template-columns: 1fr;
  }
  .flow-table td,
  .flow-table th {
    padding: 10px 8px;
  }
  .actions .btn {
    white-space: normal;
  }
  #run {
    position: static;
    width: 100%;
  }
}

/* ---------- Home flow strip, How it works, Research ledger, Predict ---------- */
.flow-strip h2 {
  font-size: clamp(24px, 2.6vw, 32px);
  letter-spacing: -0.02em;
  margin: 0 0 28px;
  max-width: 24ch;
}
/* A real sequence, so the numbers carry meaning. */
.flow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  border-top: 1px solid var(--line-strong);
}
.flow-steps li {
  counter-increment: step;
  padding: 20px 24px 0 0;
}
.flow-steps li::before {
  content: counter(step);
  display: block;
  margin-bottom: 14px;
  font: 500 15px "IBM Plex Sans", sans-serif;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.flow-steps h3 {
  margin: 0 0 6px;
  font-size: 17px;
}
.flow-steps p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}
.flow-strip-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 32px 0 0;
}
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.site-footer nav a {
  color: var(--text-2);
}
.site-footer nav a:hover {
  color: var(--text);
}

/* Long-form pages: one reading column, sections divided by hairlines. */
.doc {
  max-width: 760px;
}
.doc-section {
  padding: 28px 0;
  border-top: 1px solid var(--line);
}
.doc-section h2 {
  margin: 0 0 12px;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.doc-section > p {
  font-size: 16px;
  line-height: 1.7;
  max-width: 68ch;
}
.how-flow {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 12px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-2);
}
.how-flow strong {
  color: var(--text);
  font-weight: 500;
}
.saving-grid {
  display: grid;
  gap: 16px;
  max-width: 68ch;
}
.saving-grid h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.saving-grid p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}
#how-budget {
  margin-top: 16px;
}
/* How it works: cost and comparison tables inside the reading column. */
.how-table-title {
  margin: 28px 0 4px;
  font-size: 16px;
}
.doc-section > .how-table-note {
  margin: 0 0 12px;
  max-width: 68ch;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-3);
}
.doc-section > .table-scroll + .how-table-note {
  margin-top: 12px;
}
.how-table {
  min-width: 560px;
  line-height: 1.55;
}
.how-table tbody th[scope="row"] {
  width: 28%;
  font-weight: 500;
  color: var(--text);
}
.how-table td {
  color: var(--text-2);
}
.how-table.has-status td:last-child {
  width: 22%;
  color: var(--text);
}

/* Research ledger: number rail, question and finding, a light verdict word. */
.ledger-section {
  padding: 40px 0 8px;
  border-top: 1px solid var(--line);
  margin-top: 32px;
}
.ledger-section > h2 {
  font-size: 26px;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.test-ledger {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
}
.test-ledger li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 190px;
  gap: 24px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  align-items: start;
}
.t-num {
  font: 600 34px/1 "IBM Plex Sans", sans-serif;
  letter-spacing: -0.02em;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.t-body h3 {
  margin: 4px 0 8px;
  font-size: 19px;
  letter-spacing: -0.01em;
  max-width: 40ch;
}
.t-body p {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.65;
  max-width: 70ch;
}
.t-result {
  color: var(--text);
}
.t-note {
  font-size: 13px !important;
  color: var(--text-3);
}
.t-verdict {
  justify-self: end;
  margin-top: 6px;
  font-size: 14px;
  font-weight: 500;
  text-align: right;
}
.v-good {
  color: var(--live);
}
.v-mixed {
  color: var(--mock);
}
.v-neutral {
  color: var(--text-2);
}
.stand-grid {
  display: grid;
  gap: 24px;
  margin-top: 16px;
  max-width: 76ch;
}
.stand-grid h3 {
  margin: 0 0 8px;
  font-size: 17px;
}
.earlier-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  max-width: 760px;
}
.earlier-list li {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.earlier-list a {
  color: var(--accent);
}
.earlier-list span {
  color: var(--text-2);
}

/* Predict: one setting in, two outcomes out, as the first thing on the step. */
.predict-box {
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  margin-bottom: 8px;
}
.predict-inputs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 12px;
}
.predict-result {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.pr-item {
  display: grid;
  gap: 2px;
}
.pr-label {
  font-size: 14px;
  color: var(--text-2);
}
.pr-value {
  font: 600 30px/1.15 "IBM Plex Sans", sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.pr-range {
  font-size: 14px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 900px) {
  .flow-steps,
  .saving-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 24px;
  }
  .test-ledger li {
    grid-template-columns: 52px minmax(0, 1fr);
  }
  .t-verdict {
    grid-column: 2;
    justify-self: start;
    text-align: left;
    margin-top: -8px;
  }
  .t-num {
    font-size: 26px;
  }
  .predict-inputs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .flow-steps,
  .saving-grid,
  .stand-grid,
  .predict-inputs,
  .predict-result {
    grid-template-columns: 1fr;
  }
  .earlier-list li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .predict-box {
    padding: 16px;
  }
}

/* Explanations under controls, user limits, verdicts */
.hint,
.field small.hint {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-3);
  max-width: 46ch;
}
.limits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px 32px;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}
.limits > .actions {
  grid-column: 1 / -1;
  margin-top: 0;
}
.limit-group {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  display: grid;
  gap: 10px;
  align-content: start;
}
.limit-group legend {
  padding: 0;
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.range-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) minmax(0, 88px) auto minmax(0, 88px);
  gap: 8px;
  align-items: center;
  font-size: 14px;
  color: var(--text-2);
}
.range-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.range-row input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 6px 8px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: 14px "IBM Plex Sans", sans-serif;
  font-variant-numeric: tabular-nums;
}
.range-row .to {
  color: var(--text-3);
}
.verdict-box {
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 15px;
  line-height: 1.6;
  max-width: 80ch;
}
.verdict-box strong {
  display: block;
  color: var(--text);
}
.why,
.new-problem,
.confidence-note {
  max-width: 72ch;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-2);
}
.confidence-note {
  margin: 12px 0 0;
}
.new-problem {
  margin: -8px 0 20px;
}
.flow-table .muted {
  color: var(--text-3);
}
@media (max-width: 1000px) {
  .limits {
    grid-template-columns: 1fr;
  }
}

/* Vision graphic: two 10 x 10 run grids, one square per solver run. */
.vision {
  margin: 0;
}
.vision figcaption h2 {
  margin: 0 0 8px;
  font-size: clamp(20px, 2vw, 24px);
  letter-spacing: -0.02em;
}
.vision figcaption p {
  max-width: 64ch;
  margin: 0 0 24px;
}
.vision-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 300px));
  gap: 48px;
}
.vision-col h3 {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  margin: 0 0 12px;
  font-size: 17px;
}
.vision-col h3 span {
  font-weight: 400;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.vision-col p {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.6;
}
.run-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  max-width: 220px;
}
.vision-tag {
  display: inline-block;
  margin: 0 0 12px !important;
  padding: 4px 10px;
  border: 1px solid var(--mock);
  border-radius: 4px;
  font-size: 13px;
  color: var(--mock);
}
.run-grid i,
.vision-key i {
  display: block;
  aspect-ratio: 1;
  border-radius: 2px;
}
.c-run {
  background: var(--text-3);
}
.c-train {
  background: var(--c-pre);
}
.c-check {
  background: var(--c-gp);
  opacity: 0.55;
}
.c-next {
  background: var(--c-scr);
}
.c-saved {
  border: 1px dashed var(--line-strong);
}
.vision-key {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--text-2);
}
.vision-key li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.vision-key i {
  width: 12px;
}
.doc-wide {
  max-width: 100%;
}
@media (max-width: 700px) {
  .vision-pair {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* Predict story strip: learned from, fitted, used. A real sequence, read left to right. */
.story {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}
.story li {
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 16px 20px 16px 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}
.story li + li {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}
.story strong {
  font: 600 22px/1.2 "IBM Plex Sans", sans-serif;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.story-count strong {
  color: var(--accent);
}
.unsure-list {
  margin: 12px 0;
  padding-left: 22px;
  display: grid;
  gap: 6px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
#wb-unsure p {
  max-width: 76ch;
  font-size: 15px;
  line-height: 1.6;
}
@media (max-width: 700px) {
  .story {
    grid-template-columns: 1fr;
  }
  .story li + li {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

.wb-kicker {
  max-width: 80ch;
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
}
.wb-kicker strong {
  font-weight: 500;
  color: var(--accent);
}

/* Next runs form: budget row first, then the range/target disclosure. */
.limits {
  display: block;
}
.limits > .limit-group {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
}
.limits > .limit-group legend {
  grid-column: 1 / -1;
}
.limits-more {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.limits-more summary .muted {
  margin-left: 8px;
  color: var(--text-3);
  font-size: 13px;
}
.limits-inner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 32px;
  margin-top: 16px;
}
.limits > .actions {
  margin-top: 20px;
}
@media (max-width: 760px) {
  .limits > .limit-group,
  .limits-inner {
    grid-template-columns: 1fr;
  }
}
/* Model-at-a-glance row sits under the prediction, quieter than the result. */
.story-strip .story {
  margin: 20px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.story-strip .story strong {
  font-size: 18px;
}
.story-strip .story li {
  padding-bottom: 0;
}
/* Home proof */
.proof-fig {
  margin: 0 0 4px !important;
  font-size: 16px;
  color: var(--text);
}
.proof-fig strong {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.proof-more {
  margin: 8px 0;
}
.proof-more p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 60ch;
}

h1,
h2,
h3 {
  scroll-margin-top: 90px;
}
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}
.findings {
  margin: 12px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
  max-width: 76ch;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-2);
}
.findings strong {
  color: var(--text);
  font-weight: 500;
}
.t-how summary {
  font-size: 14px;
  margin-bottom: 6px;
}

/* Balanced headings and paragraphs without stranded last words. */
h1, h2, h3 { text-wrap: balance; }
p, li, dd, figcaption { text-wrap: pretty; }

/* Reading measure: running text stays near 70 characters, whatever the column width. */
.page p, .page li, .landing p, .landing li, .prose p, .prose li { max-width: 62ch; }
.flow-table p, .chart-legend li, .story li, .pr-item, .metric-strip p { max-width: none; }
.story-line {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
}
.story-line strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.progress-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 32px;
}
.fit-progress .section-bar { align-items: flex-start; }
@media (max-width: 700px) {
  .progress-checks { grid-template-columns: 1fr; }
  .fit-progress .section-bar { display: grid; gap: 10px; }
}

.claim-card .generated-proof { margin-top: 16px !important; }

/* ---------- Your study: the full cycle on a real CFD study (study.js, studyviz.js) ----------
   One grid for the whole page: a side column for headings, text and controls, a main column for pictures,
   charts and tables. Sections are separated by space alone. Type has three levels (--t-1 decision and page
   title, --t-2 headings, --t-3 text) with --t-fine for labels and captions. */
#page-study .page-heading {
  margin-bottom: 20px;
}
#page-study .page-heading p {
  max-width: 62ch;
}
#study-root {
  --side: 296px;
  --gutter: 40px;
  display: grid;
  gap: 44px;
  max-width: 1120px;
  font-size: var(--t-3);
  letter-spacing: 0;
  color: var(--text);
}
#study-root h2,
#study-root h3,
#study-root h4 {
  margin: 0;
  font-size: var(--t-2);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
#study-root h3,
#study-root h4 {
  font-size: var(--t-3);
}
#study-root p {
  margin: 0;
}
#study-root .lead {
  color: var(--text);
  max-width: 60ch;
}
.st-note {
  font-size: var(--t-fine);
  color: var(--text-3);
  max-width: 68ch;
  margin-top: 10px !important;
}
.eyebrow-plain {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-fine);
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px !important;
}
#study-root .mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92em;
  overflow-wrap: anywhere;
}
#study-root .ic {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.12em;
}
#study-root .ic.big {
  width: 28px;
  height: 28px;
  stroke-width: 1.5;
}
#study-root .actions {
  margin-top: 16px;
}
#study-root button.link {
  color: var(--text-2);
  font-size: var(--t-fine);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  padding: 6px 0;
  min-height: 32px;
}
#study-root button.link:hover {
  color: var(--text);
}
.st-quiet {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
/* The offer to run the example by itself, and the line that says it is running. */
#study-root .st-auto {
  max-width: none;
  margin: 28px 0 0;
}
.st-auto {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin: 0;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--tint-2);
  font-size: var(--t-fine);
  line-height: 1.5;
}
.st-auto > span:not(.spin) {
  flex: 1 1 320px;
  max-width: 72ch;
}
/* The confirmation before the example runs by itself. */
.auto-ask {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 4px 0 0 var(--accent-deep), 0 0 0 1px var(--line-strong);
}
#study-root > .auto-ask {
  margin-top: 28px;
}
#study-root .auto-ask h3 {
  font-size: var(--t-2);
}
.auto-ask p {
  margin: 0;
  max-width: 68ch;
}
.auto-points {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.3em;
  max-width: 68ch;
}
.auto-ask .auto-own {
  color: var(--text);
  font-weight: 600;
}
/* The visitor's turn: the one state of the automatic run that asks for something. */
.st-auto.is-turn {
  justify-content: flex-start;
  background: var(--surface);
  box-shadow: inset 4px 0 0 var(--accent-deep), 0 0 0 1px var(--line-strong);
  font-size: inherit;
}
.auto-own {
  align-items: flex-start !important;
  max-width: 60ch;
}
.auto-own {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--t-fine);
  color: var(--text-2);
  cursor: pointer;
}
.auto-own input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-deep);
}
.st-auto.is-on {
  justify-content: flex-start;
  box-shadow: inset 3px 0 0 var(--accent-deep);
}
/* What the page is doing, in view wherever the visitor has scrolled to. */
.st-working {
  position: fixed;
  z-index: 45;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow);
  font-size: var(--t-fine);
  font-weight: 600;
  color: var(--text);
}
#study-root.has-bar .st-working {
  bottom: calc(24px + var(--st-bar-lift, 0px));
}
.spin {
  flex: none;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#study-root .btn.is-working {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
#study-root.is-busy .drop-choose {
  pointer-events: none;
  opacity: 0.5;
}

/* The step rail: the same picture on the home page and here. */
.step-rail {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  counter-reset: none;
}
.rail-step {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
  font-size: var(--t-fine);
  color: var(--text-3);
  min-width: 0;
}
.rail-step::before {
  content: "";
  position: absolute;
  top: 13px;
  right: 50%;
  width: 100%;
  height: 2px;
  background: var(--line);
}
.rail-step:first-child::before {
  content: none;
}
.rail-step.is-done::before,
.rail-step.is-current::before {
  background: var(--text);
}
.rail-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line-strong);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.rail-dot svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rail-step.is-done .rail-dot {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.rail-step.is-current {
  color: var(--text);
  font-weight: 600;
}
.rail-step.is-current .rail-dot {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: var(--on-accent);
}
.rail-name {
  overflow-wrap: anywhere;
}
/* On the study page a step is a button: it goes to the step, or says what a later step will do. */
#study-root .rail-pick {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: center;
  cursor: pointer;
  opacity: 1;
}
.rail-pick:hover .rail-name,
.rail-pick[aria-expanded="true"] .rail-name {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.rail-pick:hover .rail-dot,
.rail-pick[aria-expanded="true"] .rail-dot {
  border-color: var(--accent-deep);
}
.rail-pick:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
  border-radius: 6px;
}
.rail-info {
  flex: 1 1 100%;
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
.rail-info[hidden] {
  display: none;
}
#study-root .rail-info h3 {
  font-size: var(--t-2);
}
.rail-info p {
  margin: 0;
  max-width: 68ch;
}
.rail-so-far {
  font-weight: 600;
}
/* The loop closes: after Refit the study is back at Predict. */
.step-rail.is-loop .rail-dot,
.step-rail.is-loop .rail-step {
  color: var(--text-2);
}
.st-rail {
  display: grid;
  gap: 6px;
}
.rail-round {
  font-size: var(--t-fine);
  color: var(--text-3);
}

/* Sections on the shared grid */
.st-sec {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  column-gap: var(--gutter);
  row-gap: 20px;
  align-items: start;
}
.sec-side,
.sec-main {
  min-width: 0;
  display: grid;
  gap: 4px;
  align-content: start;
}
.sec-main {
  gap: 24px;
}
.st-sec.is-new,
.st-results.is-new,
.st-stop-card.is-new {
  animation: st-reveal 420ms var(--ease) both;
}
.is-new:focus,
.st-alert:focus {
  outline: none;
}
.fit-done {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--met);
}
@keyframes st-reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.st-head {
  display: grid;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: -16px;
}
.st-head-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 24px;
}
#study-root .st-head h2 {
  font-size: var(--t-2);
}
.st-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 32px;
  margin: 0;
}
.st-facts dt {
  font-family: inherit;
  font-size: var(--t-fine);
  color: var(--text-3);
}
.st-facts dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.st-link code {
  word-break: break-all;
}
.decision {
  font-size: var(--t-1);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 6px 0 4px !important;
}
.decision.is-met {
  color: var(--met);
}

/* Results per output: no boxes, type and space group them */
.st-outputs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px 32px;
}
.out-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 10px;
}
.out-figure {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 10px !important;
}
.out-figure strong {
  font-size: var(--t-1);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.out-note {
  font-size: var(--t-fine);
  color: var(--text-3);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--t-fine);
  font-weight: 600;
}
.status.is-met {
  color: var(--met);
}
.status.is-above {
  color: var(--above);
}
.chip {
  position: relative;
  font-size: var(--t-fine);
  line-height: 1.3;
  border-radius: 999px;
  background: var(--surface-2);
  padding: 4px 10px;
  white-space: nowrap;
  cursor: help;
}
.chip-k {
  color: var(--text-3);
}
.chip::after {
  content: attr(data-tip);
  display: none;
  position: absolute;
  z-index: 5;
  left: 0;
  top: calc(100% + 6px);
  width: min(260px, 70vw);
  white-space: normal;
  background: var(--text);
  color: var(--bg);
  padding: 8px 10px;
  border-radius: 6px;
  font-weight: 400;
}
.chip:hover::after,
.chip:focus::after {
  display: block;
}
.meter {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  margin: 26px 0 14px;
}
.meter-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  max-width: 100%;
}
.meter-fill.is-met,
.key.is-met {
  background: var(--met);
}
.meter-fill.is-above {
  background: repeating-linear-gradient(-45deg, var(--above) 0 6px, color-mix(in srgb, var(--above) 72%, var(--bg)) 6px 9px);
}
.meter-target {
  position: absolute;
  top: -7px;
  bottom: -7px;
  width: 2px;
  margin-left: -1px;
  background: var(--text);
}
.meter-target span {
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
}

/* Charts written as SVG */
.viz {
  display: block;
  width: 100%;
  height: auto;
  font-family: inherit;
  overflow: visible;
}
.viz-grid {
  stroke: var(--line);
  stroke-width: 1;
}
.viz-tick,
.viz-axis {
  fill: var(--text-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.viz-axis {
  fill: var(--text-2);
}
.viz-tick.is-chosen {
  fill: var(--text);
  font-weight: 600;
}
.viz-target {
  stroke: var(--text);
  stroke-width: 1.6;
  stroke-dasharray: 6 3;
}
.viz-target-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 600;
}
.viz-line {
  fill: none;
  stroke: var(--text-2);
  stroke-width: 1.6;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.viz-pt.is-met {
  fill: var(--met);
}
.viz-pt.is-above {
  fill: var(--above);
}
.viz-pt.is-live {
  fill: var(--accent-deep);
}
.viz-dot {
  fill: var(--text-2);
}
.st-conv {
  display: grid;
  gap: 10px;
}
.conv-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 32px;
}
.conv-grid figure,
.st-map,
.st-field,
.fit-line {
  margin: 0;
}
.conv-grid figcaption {
  font-size: var(--t-fine);
  color: var(--text-2);
}
.key {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin: 0 5px 0 12px;
  border-radius: 50%;
  vertical-align: 0;
}
.st-note .key:first-child {
  margin-left: 0;
}
.key.is-above {
  background: var(--above);
  border-radius: 0;
  transform: rotate(45deg) scale(0.85);
}
.key.is-target {
  width: 16px;
  height: 0;
  border-radius: 0;
  border-top: 2px dashed var(--text);
  vertical-align: 3px;
}
.key.is-train {
  background: var(--text);
}
.key.is-check {
  border-radius: 0;
  border: 1.6px solid var(--text);
  width: 8px;
  height: 8px;
}
.key.is-candidate {
  background: var(--text-3);
  opacity: 0.55;
  width: 6px;
  height: 6px;
  vertical-align: 1px;
}
.key.is-pick {
  background: var(--accent-deep);
  width: 12px;
  height: 12px;
  vertical-align: -2px;
}
.st-details summary {
  cursor: pointer;
  font-size: var(--t-fine);
  color: var(--text-2);
  width: fit-content;
  padding: 6px 0;
}
.st-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.st-table caption {
  text-align: left;
  font-weight: 600;
  padding-bottom: 6px;
}
.st-table th,
.st-table td {
  padding: 9px 16px 9px 0;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.st-table th {
  font-size: var(--t-fine);
  font-weight: 500;
  color: var(--text-3);
  border-bottom-color: var(--line-strong);
}
.st-table .num {
  text-align: right;
  padding: 9px 0 9px 16px;
}
.cell-mark {
  display: inline-block;
  width: 1.3em;
  text-align: right;
  color: var(--met);
}

/* The fit while it runs */
.fit-card {
  display: grid;
  gap: 14px;
  background: var(--surface);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 0 0 1px var(--line);
  min-height: 150px;
  align-content: start;
}
.fit-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
}
#study-root .fit-top h3 {
  font-size: var(--t-2);
}
.fit-stages {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
}
.fit-stages li {
  width: 22px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}
.fit-stages li.is-done {
  background: var(--text);
}
.fit-stages li.is-current {
  background: var(--accent-deep);
}
.fit-count {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.fit-count strong {
  color: var(--text);
}
.bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent-deep);
  transition: width var(--dur) var(--ease);
}
.bar.is-waiting span {
  width: 100%;
  opacity: 0.22;
  animation: bar-wait 1.6s ease-in-out infinite alternate;
}
@keyframes bar-wait {
  to {
    opacity: 0.5;
  }
}
.fit-line figcaption {
  font-size: var(--t-fine);
  color: var(--text-2);
  margin-top: 6px;
}
.fit-line strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Sliders and the numbers beside them */
.st-sliders {
  display: grid;
  gap: 18px;
  margin-top: 14px;
}
.slider {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  align-items: baseline;
}
.slider label {
  font-size: var(--t-fine);
  color: var(--text-2);
}
.slider output {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.slider input,
.slider .ticks,
.slider .tick-ends {
  grid-column: 1 / -1;
}
#study-root input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  margin: 0;
  background: none;
  cursor: pointer;
  --at: 0%;
}
#study-root input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent-deep) var(--at), var(--line-strong) var(--at));
}
#study-root input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent-deep) var(--at), var(--line-strong) var(--at));
}
#study-root input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--accent-deep);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent-deep);
}
#study-root input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-deep);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent-deep);
}
#study-root input[type="range"]:focus-visible {
  outline: none;
}
#study-root input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 1px var(--accent-deep), 0 0 0 4px color-mix(in srgb, var(--focus) 45%, transparent);
}
#study-root input[type="range"]:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 1px var(--accent-deep), 0 0 0 4px color-mix(in srgb, var(--focus) 45%, transparent);
}
.ticks {
  display: flex;
  justify-content: space-between;
  padding: 0 9px;
  margin-top: -4px;
}
.ticks i {
  width: 1px;
  height: 6px;
  background: var(--line-strong);
}
.tick-ends {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.st-numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 0;
}
.st-numbers dt {
  font-family: inherit;
  font-size: var(--t-fine);
  color: var(--text-3);
}
.st-numbers dd {
  margin: 0;
  font-size: var(--t-fine);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.st-numbers strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* Field pictures */
.pic-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}
.segmented {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-2);
}
.segmented label {
  position: relative;
  flex: none;
}
.segmented input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.segmented span {
  display: block;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: var(--t-fine);
  white-space: nowrap;
  color: var(--text-2);
}
.segmented input:checked + span {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px #0000001a;
}
.segmented input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
.plane-picker {
  display: flex;
  align-items: center;
  gap: 12px;
}
.plane-picker > div:first-child {
  width: 132px;
  flex: none;
}
.plane-window {
  fill: var(--surface-2);
  stroke: var(--line-strong);
  stroke-width: 1;
}
.plane-window.is-chosen {
  stroke: var(--accent-deep);
  stroke-width: 2.5;
}
.plane-body {
  fill: var(--text-3);
}
.plane-floor {
  stroke: var(--text);
  stroke-width: 2;
}
.plane-line {
  stroke: var(--line-strong);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
  cursor: pointer;
}
.plane-line.is-chosen {
  stroke: var(--accent-deep);
  stroke-width: 3;
  stroke-dasharray: none;
}
.pic-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
}
/* A field is 128 cells wide. Past about four screen pixels a cell it turns soft, so a picture stops growing there. */
.st-field .pic-row,
.cmp-panel .pic-row:not(:has(.pair)) {
  max-width: 600px;
}
.pic {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  touch-action: pan-y;
}
.pic canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.pic.fade canvas {
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.pic.fade canvas.is-front {
  opacity: 1;
}
.pic-tip {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, calc(-100% - 10px));
  background: var(--text);
  color: var(--bg);
  font-size: var(--t-fine);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
}
.pic-tip.is-below {
  transform: translate(-50%, 14px);
}
.colorbar {
  display: grid;
  grid-template-columns: 12px auto;
  grid-template-rows: auto minmax(0, 1fr);
  column-gap: 6px;
  row-gap: 4px;
  height: 100%;
  min-width: 62px;
  font-size: 11px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.colorbar-unit {
  grid-column: 1 / -1;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.colorbar-strip {
  border-radius: 3px;
  background: linear-gradient(to top, var(--stops));
}
.colorbar-ticks {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
#study-root .st-field figcaption,
.pic-cap,
.pair figcaption {
  font-size: var(--t-fine);
  color: var(--text-2);
  margin-top: 6px !important;
}
.pair figcaption {
  font-weight: 600;
  color: var(--text);
}
.st-compare {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}
.cmp-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
}
.select {
  display: grid;
  gap: 4px;
  font-size: var(--t-fine);
  color: var(--text-2);
  min-width: 0;
}
.select select {
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
  max-width: 100%;
  padding: 9px 38px 9px 12px;
  font-size: var(--t-3);
  color: var(--text);
  background: var(--surface) var(--chevron) no-repeat right 13px center / 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-variant-numeric: tabular-nums;
}
.select.small select {
  min-height: 36px;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: var(--t-fine);
}
.cmp-list {
  display: grid;
  gap: 22px;
}
.cmp-panel {
  display: grid;
  gap: 8px;
  min-width: 0;
}
#study-root .cmp-plane {
  font-size: var(--t-fine);
  font-weight: 600;
  color: var(--text-2);
}
.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.pair figure {
  margin: 0;
  min-width: 0;
}
.pic.split .split-top {
  clip-path: inset(0 calc(100% - var(--split)) 0 0);
}
.split-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split);
  width: 2px;
  margin-left: -1px;
  background: var(--bg);
  box-shadow: 0 0 0 1px #0006;
}
.split-tag {
  position: absolute;
  top: 8px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
}
.split-tag.is-left {
  left: 8px;
}
.split-tag.is-right {
  right: 8px;
}
.cmp-count {
  display: none;
}
.cmp-outcomes {
  max-width: 420px;
}

/* The design space */
.st-map {
  display: grid;
  gap: 8px;
  max-width: 520px;
}
.st-map figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px 16px;
}
.map-axes {
  display: flex;
  gap: 10px;
}
.map-frame {
  fill: none;
  stroke: var(--line-strong);
}
.map-pt.is-train {
  fill: var(--text);
}
.map-pt.is-check {
  fill: var(--bg);
  stroke: var(--text);
  stroke-width: 1.6;
}
.map-pt.is-candidate {
  fill: var(--text-3);
  opacity: 0.5;
}
.map-pick circle {
  fill: var(--accent-deep);
  stroke: var(--bg);
  stroke-width: 2;
}
.map-pick text {
  fill: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
}

/* Start, upload, alerts, the stop */
.st-start {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.start-card {
  display: grid;
  gap: 10px;
  align-content: start;
  justify-items: start;
  background: var(--surface);
  border-radius: 14px;
  padding: 26px;
  box-shadow: 0 0 0 1px var(--line);
}
.start-card > .btn {
  margin-top: 8px;
}
.start-card.is-empty {
  color: var(--text-2);
}
.start-card .drop {
  width: 100%;
}
.drop {
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  padding: 22px;
  margin-top: 12px;
}
.drop-idle {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 4px;
  color: var(--text-2);
}
.drop-title {
  font-weight: 600;
  color: var(--text);
}
.drop-idle .st-note {
  margin-top: 0 !important;
}
.drop-choose {
  margin-top: 12px;
  cursor: pointer;
}
.drop-choose:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.drop.is-over {
  border-color: var(--accent-deep);
  background: color-mix(in srgb, var(--accent-deep) 7%, transparent);
}
.drop.is-busy {
  border-style: solid;
  border-color: var(--line);
}
.drop.is-busy .drop-idle {
  display: none;
}
.drop-busy {
  display: grid;
  gap: 8px;
}
.drop-state {
  font-weight: 600;
}
.drop-facts,
.drop-resumed {
  font-size: var(--t-fine);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  min-height: 1.4em;
}
.drop-resumed {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--met);
  font-weight: 600;
}
.st-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px 20px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--above) 10%, var(--surface));
  color: var(--text);
}
.st-alert > .ic {
  color: var(--above);
}
#study-root .issue-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: var(--t-fine);
}
.issue-group.is-error {
  color: var(--above);
}
.issue-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
}
.issue-list li {
  display: grid;
  gap: 2px;
  padding: 9px 0;
  border-top: 1px solid color-mix(in srgb, var(--above) 25%, var(--line));
}
.issue-about {
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-fine);
  color: var(--text-2);
}
.issue-fix {
  font-size: var(--t-fine);
  color: var(--text-2);
}
.st-stop-card {
  display: grid;
  gap: 14px;
  background: var(--surface);
  border-radius: 16px;
  padding: 30px 32px;
  box-shadow: 0 0 0 1px var(--line), var(--shadow);
  border-top: 4px solid var(--met);
}
.st-stop-card .eyebrow-plain {
  color: var(--met);
  margin: 0 !important;
}
#study-root .st-stop-card h2 {
  font-size: 2rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.stop-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 32px;
  margin: 6px 0;
}
.stop-stats dt {
  font-family: inherit;
  font-size: var(--t-fine);
  color: var(--text-3);
}
.stop-stats dd {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.stop-stats p {
  font-size: var(--t-fine);
  color: var(--text-2);
}
.stop-answers {
  max-width: 640px;
}
.stop-answers th,
.stop-answers td {
  white-space: normal;
}
.st-stop-card,
.st-stop-card > * {
  min-width: 0;
}

/* Placeholders while the study loads: the page keeps its shape */
.st-skeleton {
  display: grid;
  gap: 18px;
}
.sk {
  border-radius: 8px;
  background: var(--surface-2);
}
.sk-rail {
  height: 52px;
}
.sk-line {
  height: 16px;
}
.sk-line.w40 {
  width: 40%;
}
.sk-line.w70 {
  width: 70%;
}
.sk-cols {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  gap: var(--gutter);
}
.sk-block {
  height: 320px;
}

/* Phones: one column, the decision and the next action stay in reach */
.st-bar {
  display: none;
}
@media (max-width: 860px) {
  #study-root {
    gap: 36px;
  }
  .st-sec,
  .sk-cols {
    grid-template-columns: minmax(0, 1fr);
  }
  .st-outputs {
    grid-template-columns: minmax(0, 1fr);
  }
  /* The three small charts sit in one row to swipe, not in a tall stack. */
  .conv-grid {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding-bottom: 4px;
  }
  .conv-grid figure {
    flex: 0 0 min(72%, 280px);
    scroll-snap-align: start;
  }
  .st-start {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .rail-step {
    font-size: 11px;
  }
  .rail-dot {
    width: 24px;
    height: 24px;
  }
  .rail-step::before {
    top: 11px;
  }
  .pic-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .colorbar {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: 10px auto;
    column-gap: 10px;
    height: auto;
    align-items: center;
  }
  .colorbar-unit {
    grid-column: 1;
    grid-row: 1 / 3;
  }
  .colorbar-strip {
    background: linear-gradient(to right, var(--stops));
  }
  .colorbar-ticks {
    flex-direction: row-reverse;
  }
  .pair {
    grid-template-columns: minmax(0, 1fr);
  }
  /* Comparison planes one at a time: swipe sideways in place of a long stack. */
  .cmp-list.is-many {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .cmp-list.is-many .cmp-panel {
    flex: 0 0 100%;
    scroll-snap-align: start;
    align-content: start;
  }
  .cmp-count {
    display: block;
    margin-top: 0 !important;
  }
  .stop-stats {
    grid-template-columns: minmax(0, 1fr);
  }
  .st-stop-card {
    padding: 22px 20px;
  }
  #study-root.has-bar {
    padding-bottom: 96px;
    --st-bar-lift: 64px;
  }
  .st-bar {
    position: fixed;
    z-index: 40;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface);
    box-shadow: 0 -1px 0 var(--line), 0 -8px 24px #00000014;
  }
  .st-bar p {
    font-size: var(--t-fine);
    font-weight: 600;
    line-height: 1.25;
    min-width: 0;
  }
  .st-bar .btn {
    flex: none;
    padding: 10px 14px;
  }
  /* The filled button is in the bar; the same action in the page is quiet here. */
  #study-root.has-bar .st-sec .btn.primary,
  #study-root.has-bar .st-stop-card .btn.primary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line-strong);
  }
}

/* Print: the summary, the results with who answered them, and the convergence charts, on one or two pages */
@media print {
  @page {
    size: A4;
    margin: 16mm;
  }
  body[data-page="study"] .topbar,
  body[data-page="study"] #site-loading,
  body[data-page="study"] #site-slow,
  body[data-page="study"] .skip,
  body[data-page="study"] #notice,
  body[data-page="study"] #wake,
  .st-rail,
  .st-predict,
  .st-next,
  .st-bar,
  .st-quiet,
  .st-working,
  .st-alert,
  #study-root .actions,
  #study-root .st-details summary,
  #page-study .page-heading p {
    display: none !important;
  }
  body[data-page="study"] {
    background: #fff;
  }
  body[data-page="study"] .workspace-content {
    padding: 0;
    max-width: none;
  }
  #study-root {
    max-width: none;
    gap: 22px;
    padding: 0 !important;
  }
  .st-sec {
    grid-template-columns: minmax(0, 1fr);
  }
  .st-stop-card,
  .st-outputs li,
  .conv-grid,
  .st-conv {
    break-inside: avoid;
  }
  .st-stop-card {
    box-shadow: none;
    border: 1px solid #999;
    border-top: 4px solid var(--met);
  }
  .st-outputs,
  .conv-grid,
  .stop-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }
  .conv-grid figure {
    flex: none;
  }
  .table-scroll {
    overflow: visible;
  }
  .chip::after {
    display: none !important;
  }
}

.fc-3d-head {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.fc-plane {
  margin: 22px 0 8px;
  font-size: 15px;
  font-weight: 500;
}

/* ---------- Brand palette ----------
   Neutral, untinted pages: warm off-white in light, warm near-black in dark. Lilac is the one accent and appears
   in three places only: the primary button, links, and Delta-V's data in charts. The five lilac tints are for
   highlights, never a page background. In dark the accent is split: --accent (light lilac) for text and links,
   --accent-deep for fills with white text. --met and --above stay for pass and fail inside the product only.
   Contrast (AA) is checked for every text and background pair in tests/frontend.test.cjs. */
:root {
  --tint-1: #1f1c26;
  --tint-2: #272330;
  --tint-3: #302a3c;
  --tint-4: #3a3249;
  --tint-5: #4b4063;
  --bg: #141312;
  --surface: #1c1b19;
  --surface-2: #252320;
  --line: #34312d;
  --line-strong: #8a8780;
  --text: #edebe6;
  --text-2: #bdb9b1;
  --text-3: #9c988f;
  --accent: #c4b0f5;
  --accent-deep: #7b5cd6;
  --accent-hover: #6a4bc4;
  --on-accent: #ffffff;
  --focus: #c4b0f5;
  --met: #6fe3b8;
  --above: #f2bd6b;
  --glow: #252320;
}
html[data-theme="light"] {
  --tint-1: #f6f2fc;
  --tint-2: #ece4f8;
  --tint-3: #e0d4f3;
  --tint-4: #d2c1ed;
  --tint-5: #bea6e5;
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-2: #f2efea;
  --line: #e4e0d9;
  --line-strong: #8a8780;
  --text: #1a1917;
  --text-2: #4a4741;
  --text-3: #6b6860;
  --accent: #6a4bc4;
  --accent-deep: #5a3db0;
  --accent-hover: #4a3192;
  --on-accent: #ffffff;
  --focus: #6a4bc4;
  --met: #0f6b50;
  --above: #855306;
  --glow: #f2efea;
}
html[data-theme] .btn.primary:hover,
html[data-theme] .btn.primary:active,
html[data-theme="dark"] .btn.primary:hover,
html:not([data-theme="light"]) .btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}

/* ---------- WS11 study page: one step at a time ----------
   A study is a column of steps. The current step is open; finished ones fold to a one-line summary that opens
   again. No side column: every block uses the width it has at 1280, 1024 and 390 px. */
#study-root {
  gap: 20px;
  max-width: 1080px;
}
.st-rail {
  display: flex;
  align-items: center;
  gap: 8px 20px;
  flex-wrap: wrap;
}
.st-rail .step-rail {
  flex: 1 1 420px;
}
.rail-round {
  flex: none;
  margin: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--tint-2);
  color: var(--text);
  font-size: var(--t-fine);
  font-weight: 600;
}
.st-head {
  padding-bottom: 0;
  border-bottom: 0;
}
.st-card,
.st-step,
.link-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.st-card {
  display: grid;
  gap: 14px;
  padding: 24px;
  min-width: 0;
}
.st-card > *,
.step-body > * {
  min-width: 0;
}
#study-root .st-card h2.decision {
  margin: 0;
  font-size: var(--t-1);
  line-height: 1.25;
  max-width: 34ch;
}
#study-root .st-card .lead {
  margin: 0;
}
.link-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 16px 20px;
  background: var(--tint-1);
}
.link-card > div {
  flex: 1 1 320px;
  min-width: 0;
  display: grid;
  gap: 4px;
}
.link-card h3 {
  margin: 0;
}
.link-card .st-link {
  overflow-wrap: anywhere;
}
.link-card .st-link .ic {
  color: var(--met);
  vertical-align: -3px;
  margin-right: 4px;
}
/* A step: a line that opens */
.st-step > summary {
  display: flex;
  align-items: baseline;
  gap: 4px 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  border-radius: 12px;
}
.st-step > summary::-webkit-details-marker {
  display: none;
}
.st-step > summary:hover {
  background: var(--tint-1);
}
.step-title {
  font-weight: 600;
  font-size: var(--t-2);
  color: var(--text);
}
.step-sum {
  flex: 1 1 200px;
  color: var(--text-2);
  font-size: var(--t-3);
}
.step-more::after {
  content: "Open";
  color: var(--accent);
  font-size: var(--t-fine);
  font-weight: 600;
}
.st-step[open] > summary .step-more::after {
  content: "Close";
}
.st-step[open] > summary {
  border-bottom: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
}
.st-step.is-past {
  background: transparent;
}
.step-body {
  display: grid;
  gap: 20px;
  padding: 20px;
}
/* Words with a definition */
.term {
  position: relative;
  border-bottom: 1px dotted var(--line-strong);
  cursor: help;
}
.term::after {
  content: attr(data-tip);
  display: none;
  position: absolute;
  z-index: 6;
  left: 0;
  top: calc(100% + 6px);
  width: min(300px, 72vw);
  white-space: normal;
  background: var(--text);
  color: var(--bg);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: var(--t-fine);
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
}
.term:hover::after,
.term:focus::after {
  display: block;
}
.term-list {
  margin: 12px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--text-2);
  font-size: var(--t-fine);
  max-width: 76ch;
}
/* One line per output */
.out-lines,
.change-notes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.out-lines li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
}
.out-lines .status {
  flex: 0 0 132px;
}
.out-target {
  color: var(--text-3);
  margin-left: 6px;
}
.change-notes li {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--tint-1);
  color: var(--text);
  max-width: 78ch;
}
.added {
  display: grid;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.added h3,
.results-in h3 {
  margin: 0;
}
/* The first screen of a study */
.what-card {
  padding: 16px 18px;
  border-radius: 10px;
  background: var(--tint-1);
  max-width: 82ch;
}
.what-card h3 {
  margin: 0 0 4px;
}
.what-card p {
  margin: 0;
  color: var(--text);
}
.study-pics {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.study-pic {
  margin: 0;
  display: grid;
  gap: 6px;
}
.study-pic figcaption {
  font-size: var(--t-fine);
  color: var(--text-2);
}
.study-pic.is-wide {
  max-width: 560px;
}
.body-pic {
  border-radius: 8px;
  background: var(--tint-1);
}
.viz.body .body-shape {
  fill: var(--surface);
  stroke: var(--text);
  stroke-width: 1.5;
}
.viz.body .body-flow {
  fill: none;
  stroke: var(--text-3);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.st-facts {
  margin: 0;
}
/* Pictures: larger, smooth, the body as a clean outline */
.st-field .pic-row,
.cmp-panel .pic-row:not(:has(.pair)) {
  max-width: 760px;
}
.pic canvas {
  image-rendering: auto;
}
.pic-body {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.pic-body ellipse {
  fill: var(--surface);
  stroke: var(--text);
  stroke-width: 1.25px;
  vector-effect: non-scaling-stroke;
}
.predict-grid {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: 24px 40px;
  align-items: start;
}
.predict-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}
/* Charts */
.conv-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px 28px;
  overflow: visible;
}
.conv-grid figure {
  min-width: 0;
  flex: none;
  display: grid;
  gap: 6px;
  align-content: start;
}
#study-root .conv-grid figcaption {
  font-weight: 600;
  font-size: var(--t-3);
  color: var(--text);
  line-height: 1.35;
  min-height: 2.7em;
}
.viz-here,
.viz-here-value,
.viz-band {
  font-size: 11px;
  fill: var(--text-2);
}
.viz-here-value {
  font-size: 12px;
  font-weight: 600;
  fill: var(--text);
}
.viz-band {
  font-weight: 600;
  fill: var(--text);
}
.map-multi {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.st-map {
  display: grid;
  gap: 10px;
  max-width: none;
  margin: 0;
}
.cmp-outcomes {
  max-width: 640px;
}
.cmp-outcomes td:last-child,
.added td:nth-child(4),
.added td:nth-child(7) {
  padding-left: 14px;
  white-space: nowrap;
}
.st-map > .viz.map {
  max-width: 520px;
}
/* Planning the next runs */
.plan-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 20px;
}
.field {
  display: grid;
  gap: 4px;
  font-size: var(--t-fine);
  color: var(--text-2);
}
#study-root input[type="number"] {
  min-height: 44px;
  width: 9ch;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.plan-form .field input {
  width: 12ch;
}
#study-root .plan-form .actions {
  margin: 0;
}
.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 20px;
  margin-top: 12px;
}
.region-grid fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
}
.region-grid legend {
  padding: 0;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: var(--t-fine);
  color: var(--text);
}
.region-grid label {
  display: grid;
  gap: 2px;
  font-size: var(--t-fine);
  color: var(--text-2);
}
.st-details.region.is-set > summary::after {
  content: " · narrowed";
  color: var(--text-2);
  font-weight: 400;
}
.next-table th:last-child,
.next-table .why {
  padding-left: 20px;
}
.next-table .why {
  min-width: 26ch;
  max-width: 46ch;
  color: var(--text-2);
  font-size: var(--t-fine);
  white-space: normal;
}
.downloads,
.guide-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}
.results-in {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 10px;
  background: var(--tint-1);
}
.results-in .drop {
  background: var(--surface);
}
.either {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.4fr);
  gap: 16px 24px;
  align-items: stretch;
}
.either-way {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
}
#study-root .either-way h4 {
  margin: 0;
  font-size: var(--t-3);
}
.either-or {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: var(--t-fine);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-2);
}
.either-or::before,
.either-or::after {
  content: "";
  flex: 1;
  width: 1px;
  background: var(--line-strong);
  opacity: 0.5;
}
@media (max-width: 860px) {
  .either {
    grid-template-columns: minmax(0, 1fr);
  }
  .either-or {
    flex-direction: row;
  }
  .either-or::before,
  .either-or::after {
    width: auto;
    height: 1px;
  }
}
.targets {
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 12px;
  min-width: 0;
}
.targets legend {
  padding: 0 6px;
  font-weight: 600;
  color: var(--text);
}
.target-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
.choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--tint-1);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.choice input {
  margin-top: 4px;
  accent-color: var(--accent-deep);
}
.choice span {
  display: grid;
  gap: 2px;
  font-weight: 600;
  color: var(--text);
}
.choice small {
  font-weight: 400;
  font-size: var(--t-fine);
  color: var(--text-2);
}
.target-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 20px;
}
.target-fields .field input {
  width: 12ch;
}
.field-hint {
  color: var(--text-3);
}
#study-root .target-fields .actions {
  margin: 0 0 18px;
}
.partner-line {
  margin: 4px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: var(--t-fine);
}
.st-stop-card {
  background: var(--surface);
}
.why-list {
  display: none;
}
@media (max-width: 860px) {
  /* On a narrow screen the reasons sit under the table as a numbered list, so no column hides off to the side. */
  .next-table th:last-child,
  .next-table .why,
  .next-table .pred {
    display: none;
  }
  .pred-line {
    display: block;
    color: var(--text);
  }
  .why-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 22px;
    color: var(--text-2);
    font-size: var(--t-fine);
  }
  .next-table th,
  .next-table td {
    padding-left: 6px;
    padding-right: 6px;
  }
  .st-card,
  .step-body {
    padding: 16px;
  }
  .predict-grid,
  .study-pics {
    grid-template-columns: minmax(0, 1fr);
  }
  /* Charts stack: nothing scrolls sideways out of sight. */
  .conv-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
    padding-bottom: 0;
  }
  .conv-grid figure {
    max-width: 420px;
    scroll-snap-align: none;
  }
  #study-root .conv-grid figcaption {
    min-height: 0;
  }
  .map-multi {
    grid-template-columns: minmax(0, 1fr);
    max-width: 380px;
  }
  .body-pic {
    max-width: 200px;
  }
  .out-lines .status {
    flex-basis: 100%;
  }
  .st-step > summary {
    padding: 14px 16px;
  }
}
@media print {
  .link-card,
  .step-more,
  .results-in,
  .plan-form {
    display: none;
  }
}

/* ---------- WS11: fewer boxes ----------
   A step is a section between two hairlines, not a card. Boxes stay only where they help: a field you type in,
   a button, a place to drop a file, a picture, and the stop summary (the answer the page works towards). */
#study-root {
  gap: 0;
}
#study-root > * {
  margin-top: 20px;
}
#study-root > .st-rail {
  margin-top: 0;
}
.st-card,
.st-step,
.link-card,
.start-card,
.fit-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.st-card,
.st-step,
.link-card {
  border-top: 1px solid var(--line);
}
.st-card {
  padding: 24px 0 4px;
}
.fit-card {
  padding: 0;
  min-height: 0;
}
.link-card {
  padding: 16px 0 0;
}
.st-step > summary {
  padding: 16px 0;
  border-radius: 0;
}
.st-step > summary:hover {
  background: transparent;
}
.st-step > summary:hover .step-title {
  color: var(--accent);
}
.st-step[open] > summary {
  border-bottom: 0;
  border-radius: 0;
  padding-bottom: 4px;
}
.step-body {
  padding: 12px 0 8px;
}
#study-root > .st-bar {
  margin-top: 0;
}
.what-card,
.results-in,
.body-pic,
.change-notes li {
  background: transparent;
  border-radius: 0;
  padding: 0;
}
.change-notes li {
  padding-left: 12px;
  border-left: 3px solid var(--above);
}
.results-in {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.targets {
  border: 0;
  border-radius: 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}
.targets legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 4px;
}
.targets legend + * {
  clear: both;
}
.target-choices {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.choice,
.choice:has(input:checked) {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
/* The empty screen: two ways in, side by side, parted by one line instead of two cards. */
.start-card {
  padding: 4px 0;
}
.st-start {
  gap: 0;
}
.st-start .start-card + .start-card {
  padding-left: 32px;
  border-left: 1px solid var(--line);
}
.st-start .start-card:first-child {
  padding-right: 32px;
}
.st-stop-card {
  box-shadow: 0 0 0 1px var(--line);
}
@media (max-width: 860px) {
  .st-card {
    padding: 20px 0 4px;
  }
  .step-body {
    padding: 8px 0;
  }
  .st-step > summary {
    padding: 14px 0;
  }
  .st-start .start-card + .start-card {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 20px;
    margin-top: 16px;
  }
  .st-start .start-card:first-child {
    padding-right: 0;
  }
}

/* Controls that wait while something runs stay readable: a little quieter, never faint. */
#study-root button:disabled,
#study-root .btn:disabled,
#study-root select:disabled,
#study-root input:disabled {
  opacity: 0.72;
  cursor: default;
}
/* A short wait does not dim the page: the pressed button and the status line say what is happening. Only a fit,
   which locks the page for minutes beside its own progress card, keeps the quieter look. */
#study-root.is-busy:not(.is-fitting) button:disabled,
#study-root.is-busy:not(.is-fitting) .btn:disabled,
#study-root.is-busy:not(.is-fitting) select:disabled,
#study-root.is-busy:not(.is-fitting) input:disabled,
#study-root.is-busy:not(.is-fitting) .segmented input:disabled + span {
  opacity: 1;
  cursor: progress;
}
#study-root.is-busy:not(.is-fitting) .segmented input:disabled {
  opacity: 0;
}
/* A segmented choice hides its radio under the label: it stays hidden while it waits, and the label goes quiet. */
#study-root .segmented input:disabled {
  opacity: 0;
}
#study-root .segmented input:disabled + span {
  opacity: 0.72;
}
#study-root button.link {
  color: var(--text);
  text-decoration-color: var(--text-3);
}
#study-root button.link:hover {
  color: var(--accent);
}

/* How much of the design space has a solver run */
.space {
  display: grid;
  gap: 8px;
  max-width: 720px;
  margin-top: 4px;
}
.space-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--tint-2);
}
.space-known {
  background: var(--text);
}
.space-next {
  background: var(--accent-deep);
}
#study-root .space-text {
  margin: 0;
  font-size: var(--t-fine);
  color: var(--text-2);
}
.space-text strong {
  color: var(--text);
}
.space-text .key {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin: 0 6px 0 0;
  vertical-align: -1px;
}
.space-text .key.is-known {
  background: var(--text);
}
.space-text .key.is-next {
  background: var(--accent-deep);
  margin-left: 14px;
}
.space-field {
  grid-template-columns: auto auto;
  justify-content: start;
  align-items: center;
  gap: 4px 12px;
}
.space-field .field-hint {
  grid-column: 1 / -1;
}
#study-root .space-field input {
  width: 11ch;
  min-height: 38px;
}

.space-hint {
  margin-left: 10px;
  color: var(--text-3);
}

.space {
  max-width: none;
}
.space-bar {
  max-width: 720px;
}

/* Explanations as short points */
.points {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  color: var(--text-2);
  font-size: var(--t-fine);
  line-height: 1.5;
  max-width: 76ch;
}
.what-card .points {
  font-size: var(--t-3);
  color: var(--text);
  margin-top: 6px;
}
.st-details > .points {
  margin-top: 10px;
}
/* The exact settings of a mark on a map */
.map-wrap {
  position: relative;
}
.map-tip {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, calc(-100% - 10px));
  width: max-content;
  max-width: 220px;
  padding: 6px 9px;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font-size: var(--t-fine);
  line-height: 1.4;
  pointer-events: none;
}
.map-tip.is-below {
  transform: translate(-50%, 10px);
}
.map-pt[data-tip],
.map-pick[data-tip] {
  cursor: pointer;
  outline-offset: 3px;
}
/* A wider place to point at than the dot itself */
.map-pt.is-candidate[data-tip],
.map-pt.is-train[data-tip] {
  stroke: transparent;
  stroke-width: 9px;
}

#study-root .space-text,
#study-root .space-field .field-hint {
  max-width: none;
}

/* Help that opens: easy to spot, the same everywhere */
.st-details > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 6px 12px 6px 10px;
  margin: 2px 0;
  border-radius: 999px;
  background: var(--tint-2);
  color: var(--accent);
  font-size: var(--t-fine);
  font-weight: 600;
}
.st-details > summary::-webkit-details-marker {
  display: none;
}
.st-details > summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--dur) var(--ease);
}
.st-details[open] > summary::before {
  transform: rotate(45deg) translate(-1px, -1px);
}
.st-details > summary:hover {
  background: var(--tint-3);
}
@media (prefers-reduced-motion: reduce) {
  .st-details > summary::before {
    transition: none;
  }
  .bar.is-waiting span {
    animation: none;
  }
  .spin {
    animation: none;
    border-right-color: currentColor;
    opacity: 0.5;
  }
}
/* Hover cards: light, soft shadow, a small pointer. One look for maps, pictures and defined words. */
.map-tip,
.pic-tip,
.term::after,
.chip::after {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--tint-4);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgb(30 33 48 / 0.16), 0 2px 6px rgb(30 33 48 / 0.08);
}
.term::after,
.chip::after {
  padding: 10px 12px;
}
.pic-tip {
  padding: 5px 10px;
  font-weight: 600;
}
.map-tip {
  display: grid;
  gap: 6px;
  max-width: 260px;
  padding: 10px 12px 11px;
  transform: translate(-50%, calc(-100% - 12px));
}
.map-tip[hidden] {
  display: none;
}
.map-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: var(--surface);
  border-right: 1px solid var(--tint-4);
  border-bottom: 1px solid var(--tint-4);
  transform: rotate(45deg);
}
.map-tip.is-below {
  transform: translate(-50%, 12px);
}
.map-tip.is-below::after {
  bottom: auto;
  top: -6px;
  transform: rotate(225deg);
}
.tip-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}
.tip-title .key {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text);
}
.tip-title .key.is-check {
  border-radius: 1px;
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--text);
}
.tip-title .key.is-candidate {
  background: var(--text-3);
  opacity: 0.6;
}
.tip-title .key.is-pick {
  background: var(--accent-deep);
}
.tip-rows {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 18px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.tip-rows strong {
  text-align: right;
  color: var(--text);
}
