:root {
  --bg: #f6f8f5;
  --body-gradient-start: #eef4ee;
  --body-gradient-end: #f6f8f5;
  --surface: #ffffff;
  --surface-soft: #eef3ef;
  --surface-raised: #fbfcfb;
  --surface-control: #f6f8f6;
  --ink: #14211d;
  --ink-strong: #26362f;
  --ink-soft: #34433c;
  --muted: #64716b;
  --line: #d7ded8;
  --line-strong: #aebbb2;
  --green: #1f8a62;
  --green-dark: #16674c;
  --green-soft: #eef7f2;
  --blue: #2f6fb7;
  --blue-soft: #dbe8f6;
  --amber: #d9822b;
  --amber-soft: #f4e3ce;
  --red: #b42318;
  --red-soft: #f7d8d6;
  --header-bg: #10231f;
  --header-ink: #f7fbf8;
  --header-muted: #dce8e1;
  --header-kicker: #afc6bb;
  --claim-bg: rgba(247, 251, 248, 0.06);
  --claim-border: rgba(247, 251, 248, 0.18);
  --button-bg: #ffffff;
  --matrix-head: #f4f7f4;
  --canvas-bg: #fbfcfb;
  --shadow: 0 18px 48px rgba(28, 42, 36, 0.09);
  --shadow-soft: 0 8px 24px rgba(28, 42, 36, 0.12);
  --shadow-primary: 0 20px 52px rgba(28, 42, 36, 0.13);
  --radius: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111816;
  --body-gradient-start: #15231f;
  --body-gradient-end: #111816;
  --surface: #18221f;
  --surface-soft: #22302b;
  --surface-raised: #1d2925;
  --surface-control: #131d1a;
  --ink: #eef6f1;
  --ink-strong: #f5faf7;
  --ink-soft: #c8d5ce;
  --muted: #9fb0a8;
  --line: #31423b;
  --line-strong: #536b61;
  --green: #40bd88;
  --green-dark: #61d49c;
  --green-soft: #183d31;
  --blue: #6fa6e6;
  --blue-soft: #1d3148;
  --amber: #efac5f;
  --amber-soft: #45301e;
  --red: #ef746b;
  --red-soft: #4a2524;
  --header-bg: #0b1714;
  --header-ink: #f7fbf8;
  --header-muted: #c8d8d0;
  --header-kicker: #9fcbb7;
  --claim-bg: rgba(238, 246, 241, 0.07);
  --claim-border: rgba(238, 246, 241, 0.18);
  --button-bg: #1f2b27;
  --matrix-head: #202e29;
  --canvas-bg: #17211e;
  --shadow: 0 20px 52px rgba(0, 0, 0, 0.26);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.32);
  --shadow-primary: 0 24px 60px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--body-gradient-start) 0, var(--body-gradient-end) 280px),
    var(--bg);
  font-family: var(--sans);
  font-size: 15px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 2000;
  transform: translateY(-160%);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
}

.skip-link:focus {
  transform: translateY(0);
}

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

.loading-state {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-6);
  color: var(--muted);
  text-align: center;
}

.loading-state strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.loading-indicator {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: loading-spin 800ms linear infinite;
}

@keyframes loading-spin {
  to { transform: rotate(360deg); }
}

.lab-header {
  border-bottom: 1px solid rgba(20, 33, 29, 0.1);
  background: var(--header-bg);
  color: var(--header-ink);
}

.header-inner {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  max-width: 1480px;
  margin: 0 auto;
  padding: var(--space-6) 28px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--header-kicker);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.lab-title {
  margin: 0;
  max-width: 900px;
  font-size: clamp(1.9rem, 3.4vw, 3.2rem);
  line-height: 0.98;
}

.lab-subtitle {
  max-width: 860px;
  margin: 14px 0 0;
  color: var(--header-muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.header-side {
  display: grid;
  align-content: end;
  justify-items: end;
  gap: 12px;
}

.language-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--claim-border);
  border-radius: var(--radius);
  background: var(--claim-bg);
  padding: 8px;
}

.language-label {
  color: var(--header-kicker);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.language-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(74px, 1fr));
  gap: 3px;
  border-radius: 7px;
  background: rgba(247, 251, 248, 0.08);
  padding: 3px;
}

.language-switch button {
  min-height: 40px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--header-muted);
  font-weight: 850;
}

.language-switch button.is-active {
  background: var(--header-ink);
  color: var(--header-bg);
}

.mode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mode-button {
  min-height: 40px;
  border: 1px solid var(--claim-border);
  border-radius: var(--radius);
  padding: 7px 11px;
  background: var(--claim-bg);
  color: var(--header-muted);
  font-weight: 800;
}

.mode-button.is-active {
  background: var(--header-ink);
  color: var(--header-bg);
}

.lab-main {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: var(--space-6);
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 28px 34px;
}

.control-column,
.workspace {
  display: grid;
  align-content: start;
  gap: var(--space-4);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(28, 42, 36, 0.07);
}

.panel-inner {
  padding: var(--space-4);
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.level-list {
  display: grid;
  gap: 8px;
}

.level-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-raised);
  color: inherit;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.level-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.level-card.is-active {
  border-color: var(--green);
  background: var(--green-soft);
}

.level-card.is-best {
  border-color: #91c9ae;
}

.level-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.level-name {
  font-weight: 750;
}

.level-badge {
  min-width: 42px;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.level-card.is-active .level-badge {
  background: var(--green);
  color: white;
}

.level-description,
.level-message {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.42;
}

.level-message {
  color: var(--ink-strong);
  font-weight: 680;
}

.field-stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.dataset-example-field {
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

#datasetExampleSelect {
  width: 100%;
}

.dataset-example-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-strong);
  font-size: 0.86rem;
  font-weight: 700;
}

.field-value {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.segmented {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-control);
  padding: 3px;
}

.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segmented button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 5px rgba(28, 42, 36, 0.11);
}

.range-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 10px;
  align-items: center;
}

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

select,
.number-input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--button-bg);
  color: var(--ink);
  padding: 0 10px;
}

.number-input {
  width: 100%;
}

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

.button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--button-bg);
  color: var(--ink);
  font-weight: 750;
}

.button.primary {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.button.primary:hover {
  background: var(--green-dark);
}

.button:active:not(:disabled),
.mode-button:active:not(:disabled) {
  transform: translateY(1px);
}

.button.compare {
  grid-column: span 2;
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--ink);
}

.button.secondary {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.button.tertiary {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.training-actions #startButton {
  grid-column: 1 / -1;
}

.advanced-controls-disclosure {
  margin-top: var(--space-4);
  border-top: 1px solid var(--line);
}

.advanced-controls-disclosure > summary,
.panel-disclosure > summary {
  min-height: 40px;
  cursor: pointer;
  color: var(--ink-strong);
  font-size: 0.82rem;
  font-weight: 750;
}

.advanced-controls-disclosure > summary {
  padding: var(--space-3) 0 0;
}

.disclosure-body {
  padding-top: var(--space-4);
}

.panel-disclosure > summary {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
}

.panel-disclosure > summary small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.panel-disclosure[open] > summary {
  border-bottom: 1px solid var(--line);
}

.panel-disclosure .panel-inner {
  padding-top: 0;
}

.theme-switch:has(input:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.theme-switch {
  position: relative;
  display: inline-grid;
  width: 118px;
  height: 34px;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-control);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
}

.theme-switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.theme-switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 4px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 5px rgba(28, 42, 36, 0.16);
  transition: transform 160ms ease;
}

.theme-switch.is-dark::before {
  transform: translateX(calc(100% + 2px));
}

.theme-switch span {
  position: relative;
  z-index: 1;
  text-align: center;
  pointer-events: none;
}

.theme-switch .theme-light-label,
.theme-switch.is-dark .theme-dark-label {
  color: var(--ink);
}

.theme-switch.is-dark .theme-light-label {
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  min-width: 88px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-pill.running {
  background: #e6f5ec;
  color: var(--green-dark);
}

.status-pill.preview {
  background: #e5eef8;
  color: #224d7f;
}

.methodology-kicker {
  margin: 0 0 5px;
  color: var(--green-dark);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.motor-visual {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--surface-soft), var(--surface-raised));
}

.motor-svg {
  display: block;
  width: 100%;
  min-height: 170px;
}

.machine-body rect,
.machine-body circle,
.machine-body line {
  fill: var(--surface);
  stroke: var(--ink-soft);
  stroke-width: 2;
}

.machine-body .motor-rotor,
.machine-body .bearing-ring {
  fill: var(--green-soft);
  stroke: var(--green-dark);
}

.machine-body .motor-rotor {
  stroke-dasharray: 8 5;
}

.motor-pipeline-panel[data-simulation-state="running"] .machine-stage.is-active .motor-rotor {
  transform-origin: 89px 78px;
  animation: motor-spin 900ms linear infinite;
}

.motor-pipeline-panel[data-simulation-state="paused"] .motor-rotor,
.motor-pipeline-panel[data-simulation-state="paused"] .stage-packet {
  animation-play-state: paused;
}

.motor-pipeline-panel[data-simulation-state="completed"] .motor-rotor {
  animation: none;
}

.sensors-stage.is-active .sensor-preview {
  transform-origin: center;
  animation: sensor-pulse 700ms ease-in-out infinite alternate;
}

.pipeline-stage-card.is-active .stage-packet {
  animation: stage-packet-flow 1.1s ease-in-out infinite;
}

@keyframes motor-spin {
  to { transform: rotate(360deg); }
}

@keyframes sensor-pulse {
  to { opacity: 0.45; }
}

@keyframes packet-flow {
  0% { transform: translateX(0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateX(150px); opacity: 0; }
}

@keyframes stage-packet-flow {
  0% { transform: translateX(-8px); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateX(24px); opacity: 0; }
}

.machine-readouts {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 9px 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.pipeline-head {
  align-items: flex-start;
}

.pipeline-status-group {
  display: grid;
  justify-items: end;
  gap: 5px;
  max-width: 260px;
  text-align: right;
}

.phase-status {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.pipeline-stage-card {
  position: relative;
  min-width: 0;
  min-height: 330px;
  scroll-snap-align: center;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 12px;
  background: linear-gradient(155deg, var(--surface-raised), var(--surface-soft));
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.pipeline-stage-card::after {
  content: "→";
  position: absolute;
  z-index: 2;
  top: 50%;
  right: -11px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
}

.pipeline-stage-card:last-child::after {
  content: none;
}

.pipeline-stage-card.is-active {
  border-color: var(--green);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 30%, transparent), var(--shadow-soft);
  transform: translateY(-2px);
}

.pipeline-stage-card.is-complete {
  border-color: color-mix(in srgb, var(--green) 55%, var(--line));
}

.pipeline-stage-card.is-complete .stage-index {
  background: var(--green-soft);
  color: var(--green-dark);
}

.decision-stage {
  border-width: 2px;
  background: linear-gradient(145deg, var(--surface-raised), color-mix(in srgb, var(--green-soft) 42%, var(--surface-raised)));
}

.stage-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.stage-heading > div {
  display: grid;
  gap: 2px;
}

.stage-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 900;
}

.stage-kind {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.stage-state {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  text-align: right;
}

.stage-sample-id {
  min-height: 1.25rem;
  margin: 0 0 8px;
  overflow: hidden;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-description,
.stage-note {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.stage-packet {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: -5px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--blue);
  opacity: 0;
}

.machine-stage .motor-visual {
  margin-top: 6px;
}

.machine-stage .motor-svg {
  min-height: 130px;
}

.vibration-mark {
  fill: none;
  stroke: var(--amber);
  stroke-width: 2;
}

.machine-readouts {
  flex-wrap: wrap;
  font-size: 0.7rem;
}

.sensor-preview {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px;
  background: var(--surface);
}

.sensor-preview > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.7rem;
}

.sensor-preview span,
.sensor-preview small {
  color: var(--muted);
  font-size: 0.64rem;
}

.sensor-preview svg {
  width: 100%;
  height: 42px;
  overflow: visible;
}

.sensor-preview polyline {
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
}

.sensor-preview[data-sensor="vibration"] polyline {
  stroke: var(--amber);
}

.preparation-operations {
  display: grid;
  gap: 5px;
  margin: 8px 0;
  padding: 0;
  list-style: none;
}

.preparation-operations li {
  border-left: 3px solid var(--line);
  padding: 5px 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 750;
}

.preparation-operations li.is-operation-active {
  border-left-color: var(--green);
  color: var(--ink);
}

.preparation-operations li.is-operation-bypassed {
  opacity: 0.48;
  text-decoration: line-through;
}

.feature-packet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 8px;
}

.feature-packet span,
.network-output {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.64rem;
}

.pipeline-mini-network {
  display: flex;
  min-height: 130px;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
  margin: 10px 0;
}

.mini-network-layer {
  display: grid;
  align-content: center;
  gap: 5px;
}

.mini-network-node {
  width: 12px;
  height: 12px;
  border: 2px solid var(--green-dark);
  border-radius: 50%;
  background: var(--surface);
  opacity: 0.55;
}

.network-stage.is-active .mini-network-node {
  animation: sensor-pulse 520ms ease-in-out infinite alternate;
  background: var(--green-soft);
  opacity: 1;
}

.mini-network-node.is-signal-active {
  background: var(--green);
  opacity: 1;
}

.mini-network-overflow {
  color: var(--muted);
  font: 800 0.6rem var(--mono);
  text-align: center;
}

.network-output {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.decision-stage .cockpit-grid {
  gap: 5px;
}

.decision-stage .cockpit-grid div {
  padding: 6px;
}

.simulation-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.simulation-actions #simulationStartButton {
  grid-column: 1 / -1;
}

.simulation-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(420px, 1.2fr);
  align-items: end;
  gap: 16px;
  margin: 14px 0;
}

.simulation-scenario-field,
.scenario-description {
  margin: 0;
}

.scenario-description {
  min-height: 2.5em;
  color: var(--muted);
  font-size: 0.78rem;
}

.simulation-stage-region {
  display: grid;
  gap: 10px;
}

.simulation-primary {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
}

.simulation-primary .pipeline-stage-card {
  min-height: 350px;
  padding: var(--space-4);
}

.simulation-stage-region .pipeline-stage-card::after {
  content: none;
}

.machine-indicators {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 0;
}

.machine-indicators div {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.machine-indicators dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.machine-indicators dd {
  margin: 4px 0 0;
  font-family: var(--mono);
  font-weight: 800;
}

.cockpit-primary-grid dd {
  font-size: 0.98rem;
}

.cockpit-explanation {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.cockpit-explanation p {
  display: grid;
  gap: 3px;
  margin: 0;
}

.cockpit-explanation strong {
  color: var(--muted);
  font-size: 0.72rem;
}

#cockpitPanel[data-outcome="tp"],
#cockpitPanel[data-outcome="tn"] {
  border-color: var(--green);
}

#cockpitPanel[data-outcome="fn"],
#cockpitPanel[data-outcome="fp"] {
  border-color: var(--red);
}

#cockpitPanel[data-outcome="uncertain"] {
  border-color: var(--amber);
}

.simulation-detail {
  border-top: 1px solid var(--line);
}

.simulation-detail > summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  cursor: pointer;
  padding: 8px 2px;
  color: var(--ink);
  font-weight: 800;
}

.simulation-detail[open] > summary {
  color: var(--green-dark);
}

.simulation-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-bottom: 10px;
}

.simulation-detail > .pipeline-stage-card,
.simulation-detail-grid > .pipeline-stage-card {
  min-height: 0;
  margin-bottom: 10px;
}

.technical-details-grid {
  display: grid;
  gap: 10px;
  padding-bottom: 12px;
}

.technical-details-grid > .stage-sample-id {
  margin: 0;
}

.motor-pipeline-panel[data-scenario-state="warning"] .machine-stage,
.motor-pipeline-panel[data-scenario-state="uncertain"] .machine-stage {
  border-color: color-mix(in srgb, var(--amber) 65%, var(--line));
}

.motor-pipeline-panel[data-scenario-state="fault"] .machine-stage {
  border-color: var(--red);
}

.motor-pipeline-panel[data-simulation-state="running"][data-scenario-state="fault"] .machine-body {
  transform-origin: center;
  animation: machine-jitter 260ms ease-in-out infinite alternate;
}

@keyframes machine-jitter {
  from { transform: translateX(-1px); }
  to { transform: translateX(1px); }
}

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

.cockpit-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
  background: var(--surface-raised);
}

.cockpit-grid dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.cockpit-grid dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 800;
}

.cockpit-scope-control {
  margin-top: 10px;
}

.sr-summary {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.matrix caption,
.comparison-table caption {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: left;
}

.tour-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
}

.tour-root[hidden] {
  display: none;
}

.tour-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 15, 12, 0.76);
}

.tour-backdrop-light {
  background: rgba(5, 15, 12, 0.56);
}

.tour-dialog {
  position: relative;
  z-index: 2;
  width: min(680px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  background: var(--surface);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
}

.step-dialog {
  align-self: end;
  justify-self: end;
  width: min(520px, 100%);
}

.tour-dialog h2 {
  margin: 0;
  font-size: 1.25rem;
}

.tour-dialog p {
  color: var(--ink-soft);
  line-height: 1.5;
}

.tour-dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.tour-icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 1.3rem;
}

.role-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.role-option {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  background: var(--surface-raised);
  color: var(--ink);
  text-align: left;
}

.role-option:hover {
  border-color: var(--green);
}

.role-option span,
.role-option small {
  color: var(--muted);
  line-height: 1.4;
}

.tour-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.tour-progress {
  margin: 0;
  color: var(--green-dark) !important;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.tour-target-note {
  border-left: 3px solid var(--amber);
  padding-left: 10px;
}

.tour-highlight {
  position: relative;
  z-index: 1001;
  box-shadow: 0 0 0 5px var(--green), 0 22px 70px rgba(0, 0, 0, 0.32);
}

.visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(330px, 0.82fr);
  gap: 14px;
}

.primary-visual-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.primary-visual-grid > .panel {
  box-shadow: var(--shadow-primary);
}

.primary-visual-grid > .panel > .panel-inner {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: var(--space-6);
}

.primary-visual-grid > .panel {
  min-width: 0;
}

.primary-visual-grid .canvas-wrap.boundary {
  min-height: 480px;
}

#confusionPanel {
  box-shadow: none;
}

.overlay-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 12px;
}

.check-control {
  min-height: 40px;
}

.check-control {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface-control);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.25;
}

.check-control:hover {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.check-control:focus-within {
  border-color: var(--blue);
}

.check-control input {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--green);
}

.check-control:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.58;
}

.canvas-wrap {
  position: relative;
  width: 100%;
}

.canvas-wrap.boundary {
  aspect-ratio: 1.28;
  padding: 0 0 1.65rem 1.75rem;
}

.plot-axis-label {
  position: absolute;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  line-height: 1.2;
  pointer-events: none;
}

.plot-axis-x {
  right: 0.45rem;
  bottom: 0.2rem;
  max-width: calc(100% - 2.5rem);
  text-align: right;
}

.plot-axis-y {
  left: 0.25rem;
  top: 50%;
  max-width: 13rem;
  transform: translate(-43%, -50%) rotate(-90deg);
  text-align: center;
}

.plot-tooltip {
  position: absolute;
  z-index: 4;
  display: grid;
  gap: 3px;
  width: min(212px, calc(100% - 16px));
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  font-size: 0.74rem;
  line-height: 1.25;
  pointer-events: none;
}

.plot-tooltip[hidden] {
  display: none;
}

.network-panel {
  min-width: 0;
}

.network-head {
  align-items: center;
  flex-wrap: wrap;
}

.network-head .status-pill {
  max-width: 100%;
  flex: 0 1 auto;
  white-space: normal;
  overflow-wrap: anywhere;
}

.network-live-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.network-live-bar span {
  flex: 1 1 130px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-raised);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.69rem;
  font-weight: 750;
  line-height: 1.3;
  text-align: center;
}

.network-overlay-controls {
  margin-bottom: 9px;
}

.network-input-legend,
.network-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.network-input-legend {
  margin: 0 2px 8px;
}

.network-input-legend span:last-child {
  margin-left: auto;
}

.network-input-legend strong {
  color: var(--ink);
  font-family: var(--mono);
}

.network-visualization {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: clamp(380px, 52vw, 560px);
  overflow: hidden;
  container-type: inline-size;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--green-soft) 45%, transparent), transparent 58%),
    linear-gradient(180deg, var(--surface-raised), var(--canvas-bg));
}

.network-panel .network-visualization {
  flex: 1 1 auto;
}

.network-svg,
.network-nodes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.network-svg {
  z-index: 1;
  display: block;
}

.network-nodes {
  z-index: 2;
  pointer-events: none;
}

.network-edge,
.network-gradient,
.network-signal,
.network-backprop {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.network-edge {
  stroke-width: var(--edge-width, 1);
  stroke-linecap: round;
  opacity: var(--edge-opacity, 0.35);
  cursor: help;
  pointer-events: stroke;
  transition: opacity 120ms ease, filter 120ms ease;
}

.network-edge.positive {
  stroke: var(--green);
}

.network-edge.negative {
  stroke: var(--red);
  stroke-dasharray: 7 4;
}

.network-edge.near-zero {
  stroke: var(--muted);
  stroke-dasharray: 2 5;
}

.network-edge.is-inactive,
.network-edge.is-pruned {
  stroke: var(--muted);
  stroke-dasharray: 3 7;
  opacity: 0.1;
}

.network-edge.is-pruned {
  stroke-dasharray: 1 8;
}

.network-edge.weight-hidden {
  opacity: 0;
  pointer-events: none;
}

.network-edge:hover {
  opacity: 1;
  filter: drop-shadow(0 0 3px color-mix(in srgb, currentColor 45%, transparent));
}

.network-edge:focus-visible {
  stroke: var(--blue);
  opacity: 1;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--blue) 55%, transparent));
}

.network-gradient {
  stroke-width: var(--gradient-width, 1);
  stroke-linecap: round;
  stroke-dasharray: 4 7;
  opacity: var(--gradient-opacity, 0.4);
  pointer-events: none;
}

.network-gradient.gradient-positive {
  stroke: var(--blue);
}

.network-gradient.gradient-negative {
  stroke: var(--amber);
  stroke-dasharray: 1 6;
}

.network-signal,
.network-backprop {
  stroke-width: var(--flow-width, 1.6);
  stroke-linecap: round;
  stroke-dasharray: 1 17;
  opacity: var(--flow-opacity, 0.45);
  pointer-events: none;
}

.network-signal {
  stroke: var(--blue);
}

.network-backprop {
  stroke: var(--amber);
  stroke-dasharray: 1 13;
}

.network-visualization.is-flowing .network-signal {
  animation: network-flow-forward 1.25s linear infinite;
  animation-delay: var(--flow-delay, 0s);
}

.network-visualization.is-backpropagating .network-backprop {
  animation: network-flow-backward 1.05s linear infinite;
  animation-delay: var(--flow-delay, 0s);
}

.network-node {
  --render-node-size: clamp(24px, 3.4cqw, var(--node-size));
  position: absolute;
  left: var(--node-left);
  top: var(--node-top);
  z-index: 2;
  display: grid;
  width: var(--render-node-size);
  height: var(--render-node-size);
  transform: translate(-50%, -50%);
  place-items: center;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--green) 62%, var(--line-strong));
  border-radius: 50%;
  padding: 0;
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: 0 0 calc(2px + var(--node-activation) * 9px) color-mix(in srgb, var(--green) 38%, transparent);
  font-family: var(--mono);
  font-size: clamp(0.46rem, 1.45cqw, 0.7rem);
  font-weight: 850;
  line-height: 1;
  pointer-events: auto;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.network-node::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--green);
  opacity: calc(0.08 + var(--node-activation) * 0.72);
}

.network-node > span {
  position: relative;
  z-index: 1;
  max-width: 94%;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

button.network-node {
  cursor: pointer;
}

button.network-node:hover {
  z-index: 4;
  border-color: var(--green-dark);
  transform: translate(-50%, -50%) scale(1.12);
}

button.network-node:focus-visible {
  z-index: 5;
  outline-offset: 4px;
}

.network-node.fixed-node {
  --render-node-size: clamp(24px, 5cqw, var(--node-size));
  border-color: var(--blue);
}

.network-node.fixed-node::before {
  background: var(--blue);
}

.network-node.is-off,
.network-node.is-pruned {
  border-color: var(--muted);
  background: var(--surface-control);
  color: var(--muted);
  box-shadow: none;
}

.network-node.is-off {
  min-width: 22px;
  min-height: 22px;
  border-style: dashed;
  text-decoration: line-through;
}

.network-node.is-pruned {
  border-style: double;
  opacity: 0.62;
}

.network-node.is-off::before,
.network-node.is-pruned::before {
  opacity: 0;
}

.network-node.is-pruned::after {
  content: "";
  position: absolute;
  z-index: 2;
  width: 120%;
  height: 2px;
  transform: rotate(-45deg);
  background: currentColor;
}

.network-tooltip {
  z-index: 8;
  width: min(250px, calc(100% - 16px));
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.network-legend {
  align-items: center;
  margin: 8px 2px 0;
}

.network-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.network-legend .edge-keyboard-hint {
  flex-basis: 100%;
  font-style: italic;
}

.edge-swatch {
  display: inline-block;
  width: 30px;
  height: 0;
  border-top: 3px solid var(--muted);
}

.edge-swatch.positive {
  border-color: var(--green);
}

.edge-swatch.negative {
  border-color: var(--red);
  border-top-style: dashed;
}

.edge-swatch.neutral {
  border-color: var(--muted);
  border-top-style: dotted;
}

.teaching-hint {
  margin: 10px 0 0;
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 9px 11px;
  background: color-mix(in srgb, var(--blue-soft) 62%, var(--surface));
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.45;
}

.teaching-hint[hidden] {
  display: none;
}

@keyframes network-flow-forward {
  to {
    stroke-dashoffset: -36;
  }
}

@keyframes network-flow-backward {
  to {
    stroke-dashoffset: 30;
  }
}

.development-diagnostics {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.development-diagnostics[hidden] {
  display: none;
}

.development-diagnostics pre {
  max-height: 280px;
  margin: 8px 0 0;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--ink);
}

.canvas-wrap.network,
.canvas-wrap.loss {
  aspect-ratio: 1.82;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas-bg);
}

.optimization-panel {
  min-width: 0;
}

.optimization-controls {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(190px, auto);
  gap: 10px 12px;
  align-items: end;
}

.fine-tune-control {
  align-self: end;
  justify-content: center;
  border-radius: var(--radius);
}

.optimization-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.optimization-actions .button {
  min-width: 0;
  padding: 7px 9px;
}

.optimization-preview {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-raised);
}

.optimization-preview > :first-child {
  margin-top: 0;
}

.optimization-preview > :last-child {
  margin-bottom: 0;
}

.optimization-preview h3 {
  margin: 0 0 10px;
  color: var(--ink-strong);
  font-size: 0.88rem;
}

.optimization-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.optimization-preview-grid > span {
  display: grid;
  min-height: 68px;
  align-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
  background: var(--surface);
}

.optimization-preview-grid small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.25;
}

.optimization-preview-grid strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.94rem;
  overflow-wrap: anywhere;
}

.optimization-candidates {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.optimization-candidates summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  cursor: pointer;
  font-weight: 800;
}

.optimization-candidates ol {
  margin: 8px 0 0;
  padding-left: 1.5rem;
}

.optimization-candidates li + li {
  margin-top: 4px;
}

.network-legend[hidden] {
  display: none;
}

.optimization-comparison {
  margin-top: 12px;
}

.optimization-table-scroll {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.optimization-table {
  min-width: 680px;
  font-size: 0.78rem;
}

.optimization-table th[scope="row"] {
  color: var(--ink-strong);
  font-weight: 800;
  text-align: left;
}

.optimization-table td small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.metric-value,
.metrics-grid strong,
.network-live-bar,
.cockpit-grid dd,
.comparison-table td {
  font-variant-numeric: tabular-nums;
}

.empty-state {
  min-height: 64px;
  margin: var(--space-3) 0 0;
  border-left: 3px solid var(--amber);
  padding: var(--space-3) var(--space-4);
  background: var(--amber-soft);
  color: var(--ink-strong);
  line-height: 1.5;
}

.metric-tile {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-raised);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.2;
}

.metric-value {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(1rem, 2vw, 1.22rem);
  font-weight: 800;
}

.metric-help {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.matrix th,
.matrix td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: center;
}

.matrix th {
  background: var(--matrix-head);
  color: var(--ink-strong);
  font-weight: 800;
}

.matrix td {
  font-family: var(--mono);
  font-weight: 800;
}

.table-scroll {
  overflow-x: auto;
}

.comparison-table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.comparison-table th,
.comparison-table td {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
}

.comparison-table th:first-child,
.comparison-table td:first-child {
  text-align: left;
}

.comparison-table th {
  background: var(--matrix-head);
  color: var(--ink-strong);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.error-panel {
  max-width: 720px;
  margin: 48px auto;
  border: 1px solid var(--red-soft);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
  color: var(--red);
}

body.preview-mode .lab-header .header-inner {
  padding-top: 18px;
  padding-bottom: 18px;
}

body.preview-mode .lab-title {
  font-size: clamp(1.85rem, 3.2vw, 3.1rem);
}

body.preview-mode .lab-subtitle {
  max-width: 760px;
  margin-top: 10px;
  font-size: 0.95rem;
}

body.preview-mode .lab-main {
  grid-template-columns: minmax(0, 1fr);
  padding-top: 14px;
  padding-bottom: 18px;
}

body.preview-mode .metric-help {
  display: none;
}

body.preview-mode .panel-inner {
  padding: 12px;
}

body.preview-mode .level-description {
  display: none;
}

body.preview-mode .experience-visual-stack {
  grid-template-columns: minmax(0, 1fr);
}

body.preview-mode .canvas-wrap.boundary {
  aspect-ratio: 1.65;
}

body.preview-mode .canvas-wrap.network,
body.preview-mode .canvas-wrap.loss {
  aspect-ratio: 2.05;
}

body.preview-mode .metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1180px) {
  .header-inner,
  .lab-main {
    grid-template-columns: 1fr;
  }

  body.preview-mode .lab-main {
    grid-template-columns: 1fr;
  }

  .header-side {
    justify-items: start;
  }

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

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

}

@media (max-width: 980px) {
  .primary-visual-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .header-inner,
  .lab-main {
    padding-left: 14px;
    padding-right: 14px;
  }

  .button,
  select,
  .number-input,
  .segmented button,
  .mode-button,
  .language-switch button,
  .check-control,
  .advanced-controls-disclosure > summary,
  .panel-disclosure > summary {
    min-height: 44px;
  }

  .primary-visual-grid > .panel > .panel-inner {
    padding: var(--space-4);
  }

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

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

  .network-input-legend span:last-child {
    width: 100%;
    margin-left: 0;
  }

  .network-live-bar span {
    flex-basis: calc(50% - 7px);
  }

  .optimization-controls {
    grid-template-columns: 1fr;
  }

  .optimization-actions {
    grid-column: 1;
  }

  .fine-tune-control {
    justify-content: flex-start;
  }

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

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

  .point-filter .segmented {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pipeline-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .pipeline-status-group {
    justify-items: start;
    max-width: none;
    text-align: left;
  }

  .simulation-toolbar,
  .simulation-primary,
  .simulation-detail-grid {
    grid-template-columns: 1fr;
  }

  .simulation-toolbar {
    align-items: stretch;
  }

  .simulation-primary .pipeline-stage-card {
    min-height: 0;
  }

  .pipeline-stage-card {
    min-height: 0;
    scroll-snap-align: none;
  }

  .pipeline-stage-card::after {
    content: "↓";
    top: auto;
    right: 50%;
    bottom: -12px;
    transform: translateX(50%);
  }

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

  .cockpit-grid,
  .role-options {
    grid-template-columns: 1fr;
  }

  .role-option {
    min-height: 0;
  }

  .tour-root {
    padding: 10px;
  }

  .tour-dialog {
    max-height: calc(100vh - 20px);
    padding: 16px;
  }
}

@media (max-width: 520px) {
  .network-tooltip {
    max-width: 250px;
  }
}

@media (max-width: 420px) {
  .header-inner,
  .lab-main {
    padding-left: 10px;
    padding-right: 10px;
  }

  .language-control,
  .panel-head {
    align-items: stretch;
  }

  .language-control,
  .panel-head {
    flex-direction: column;
  }

  .action-row,
  .simulation-actions,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .overlay-controls .check-control {
    flex: 1 1 100%;
    justify-content: flex-start;
    border-radius: var(--radius);
  }

  .network-live-bar span {
    flex-basis: 100%;
  }

  .optimization-actions {
    grid-template-columns: 1fr;
  }

  .motor-svg {
    min-height: 138px;
  }

  .tour-actions .button {
    flex: 1 1 100%;
  }
}

@media (forced-colors: active) {
  .level-card.is-active,
  .tour-highlight {
    outline: 3px solid Highlight;
    outline-offset: 2px;
  }

  .motor-rotor,
  .bearing-ring {
    forced-color-adjust: auto;
  }

  canvas,
  .network-visualization,
  .panel,
  .button,
  .mode-button,
  .check-control,
  .optimization-preview,
  .optimization-table-scroll {
    border-color: CanvasText;
  }

  .network-edge.positive,
  .network-signal {
    stroke: Highlight;
  }

  .network-edge.negative,
  .network-backprop {
    stroke: CanvasText;
  }

  .network-edge.near-zero,
  .network-edge.is-inactive,
  .network-edge.is-pruned {
    stroke: GrayText;
  }

  .network-gradient {
    stroke: LinkText;
  }

  .network-node {
    border-color: CanvasText;
    background: Canvas;
    color: CanvasText;
    forced-color-adjust: none;
  }

  .network-node::before {
    display: none;
  }

  .network-node.is-off,
  .network-node.is-pruned {
    border-color: GrayText;
    color: GrayText;
  }

  .edge-swatch.positive {
    border-color: Highlight;
  }

  .edge-swatch.negative {
    border-color: CanvasText;
  }

  .edge-swatch.neutral {
    border-color: GrayText;
  }
}

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

  .network-signal,
  .network-backprop {
    animation: none !important;
  }

  .network-node {
    transition: none;
  }
}

/* Additive compact experiment shell. These classes are opt-in so the existing
   generated layout and its stable selectors remain unchanged until wired. */
.compact-lab-header {
  border-bottom: 1px solid var(--claim-border);
  background: var(--header-bg);
  color: var(--header-ink);
}

.compact-header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  max-width: 1480px;
  margin: 0 auto;
  padding: var(--space-4) 28px;
}

.compact-brand {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
}

.compact-brand-title {
  margin: 0;
  color: var(--header-ink);
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  font-weight: 750;
  line-height: 1.15;
}

.compact-brand-copy {
  max-width: 76ch;
  margin: 0;
  color: var(--header-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.compact-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: flex-end;
}

.global-settings {
  display: flex;
  min-width: 0;
  align-items: stretch;
  gap: var(--space-1);
  border: 1px solid var(--claim-border);
  border-radius: var(--radius);
  padding: var(--space-1);
  background: var(--claim-bg);
}

.global-settings .language-control,
.theme-control {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-2);
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  padding: var(--space-1);
  background: transparent;
}

.theme-control-label {
  color: var(--header-kicker);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.global-settings .language-switch {
  grid-template-columns: repeat(2, minmax(54px, 1fr));
}

.global-settings .language-switch button,
.global-settings .theme-switch {
  min-height: 40px;
}

.global-settings .theme-switch {
  width: 112px;
  height: 40px;
  border-color: var(--claim-border);
  background: rgba(247, 251, 248, 0.08);
  color: var(--header-muted);
}

.global-settings .theme-switch::before {
  background: var(--header-ink);
}

.global-settings .theme-switch .theme-light-label,
.global-settings .theme-switch.is-dark .theme-dark-label {
  color: var(--header-bg);
}

.global-settings .theme-switch.is-dark .theme-light-label,
.global-settings .theme-switch:not(.is-dark) .theme-dark-label {
  color: var(--header-muted);
}

.contact-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--green) 76%, white);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  background: var(--green);
  color: white;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
}

.contact-link:hover {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.experiment-toolbar {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.experiment-toolbar-grid {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(360px, 1.7fr) auto;
  gap: var(--space-4);
  align-items: end;
  padding: var(--space-4);
}

.experiment-toolbar-field {
  display: grid;
  min-width: 0;
  gap: var(--space-2);
}

.experiment-toolbar-field > label,
.experiment-toolbar-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.25;
}

.experiment-toolbar-field select {
  width: 100%;
  min-height: 40px;
}

.experiment-stage-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-1);
  background: var(--surface-control);
}

.experiment-stage-selector .level-card,
.experiment-stage-selector button {
  min-height: 40px;
  border: 1px solid transparent;
  padding: var(--space-2);
  text-align: center;
}

.experiment-stage-selector .level-description,
.experiment-stage-selector .level-message,
.experiment-stage-selector .level-badge {
  display: none;
}

.experiment-stage-selector .level-topline {
  justify-content: center;
}

.experiment-primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: flex-end;
}

.experiment-primary-actions .button {
  min-width: 112px;
  padding-inline: var(--space-3);
}

.experience-visual-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  min-width: 0;
}

.experience-visual-stack > .panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-primary);
}

.experience-visual-stack > .panel > .panel-inner {
  padding: var(--space-6);
}

.experience-visual-stack .canvas-wrap.boundary {
  min-height: clamp(380px, 45vw, 620px);
  aspect-ratio: 1.65;
}

.metric-curves-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.metric-curve-figure {
  min-width: 0;
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.metric-curve-figure figcaption {
  margin-bottom: var(--space-2);
  font-size: 0.82rem;
  font-weight: 750;
}

.metric-curve {
  display: block;
  width: 100%;
  height: auto;
  color: var(--green);
}

.metric-curve-axis {
  stroke: var(--ink-soft);
  stroke-width: 1;
}

.metric-curve-baseline {
  stroke: var(--line-strong);
  stroke-dasharray: 4 4;
  stroke-width: 1;
}

.metric-curve-line {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.metric-curve-tick,
.metric-curve-label {
  fill: var(--ink-muted);
  font-family: var(--sans);
  font-size: 9px;
}

.unified-metrics-panel {
  min-width: 0;
}

.unified-metrics-panel > .panel-inner {
  display: grid;
  gap: var(--space-4);
}

.metric-mode-switch {
  display: inline-grid;
  width: min(100%, 360px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: var(--surface-control);
}

.metric-mode-switch button {
  min-width: 0;
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  padding: var(--space-2) var(--space-3);
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.25;
}

.metric-mode-switch button:hover {
  background: var(--surface-raised);
}

.metric-mode-switch button.is-active,
.metric-mode-switch button[aria-pressed="true"] {
  background: var(--green);
  color: white;
}

.metric-mode-switch button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.metric-mode-view {
  display: grid;
  min-width: 0;
  gap: var(--space-4);
}

.metric-mode-view[hidden] {
  display: none;
}

.metric-view-heading {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.4;
}

.metrics-selected-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.metrics-selected-details > * {
  min-width: 0;
}

.metrics-comparison-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  min-width: 0;
}

.metrics-stage-card {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  background: var(--surface-raised);
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.metrics-stage-card.is-active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--ink);
}

.metrics-stage-card.is-best {
  box-shadow: inset 0 0 0 1px var(--green);
}

.metrics-stage-card.is-running {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.metrics-stage-card:focus-within {
  border-color: var(--blue);
}

.metrics-stage-head {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.metrics-stage-head h3,
.metrics-stage-head p {
  min-width: 0;
  margin: 0;
}

.metrics-stage-head h3 {
  color: var(--ink-strong);
  font-size: 0.95rem;
  line-height: 1.3;
}

.metrics-stage-status {
  display: inline-flex;
  max-width: 62%;
  flex: 0 1 auto;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 3px var(--space-2);
  background: var(--surface-control);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-align: right;
}

.metrics-stage-card.is-active .metrics-stage-status,
.metrics-stage-card.is-best .metrics-stage-status {
  background: var(--surface);
  color: var(--green-dark);
}

.metrics-stage-card.is-running .metrics-stage-status {
  background: var(--blue-soft);
  color: var(--ink-strong);
}

.metrics-stage-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.metrics-stage-list > div,
.metrics-stage-list > li {
  display: grid;
  min-width: 0;
  gap: 2px;
  border-top: 1px solid var(--line);
  padding-top: var(--space-2);
}

.metrics-seed-context,
.metrics-best-label,
.metrics-seed-aggregate {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.4;
}

.metrics-seed-context {
  color: var(--muted);
  font-weight: 750;
}

.metrics-best-label {
  width: fit-content;
  border-radius: 999px;
  padding: 3px var(--space-2);
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 850;
}

.metrics-seed-aggregate {
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--line);
  padding-top: var(--space-2);
  color: var(--ink-soft);
}

.metrics-seed-details > summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  cursor: pointer;
  font-weight: 800;
}

.metrics-stage-list dt,
.metrics-stage-list dd,
.metrics-stage-list p {
  min-width: 0;
  margin: 0;
}

.metrics-stage-list dt,
.metrics-stage-list small,
.metrics-stage-list .metric-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
}

.metrics-stage-list dd,
.metrics-stage-list strong,
.metrics-stage-list .metric-value {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.94rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.optimization-metrics-section {
  display: grid;
  min-width: 0;
  gap: var(--space-3);
  border-top: 1px solid var(--line);
  padding-top: var(--space-4);
}

.optimization-metrics-section[hidden] {
  display: none;
}

.optimization-metrics-section > :first-child {
  margin-top: 0;
}

.optimization-metrics-section .optimization-table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.scientific-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.scientific-details > summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  padding: var(--space-3) var(--space-4);
  color: var(--ink-strong);
  font-weight: 750;
  list-style: none;
}

.scientific-details > summary::-webkit-details-marker,
.settings-subsection > summary::-webkit-details-marker {
  display: none;
}

.scientific-details > summary::after,
.settings-subsection > summary::after {
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  margin-left: auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-control);
  color: var(--green-dark);
  content: "+";
  font-size: 1.1rem;
  font-weight: 850;
  line-height: 1;
}

.scientific-details[open] > summary::after,
.settings-subsection[open] > summary::after {
  content: "−";
}

.scientific-details[open] > summary {
  border-bottom: 1px solid var(--line);
}

.scientific-details-body {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4);
}

.settings-details-body {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4);
}

.settings-primary-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.settings-primary-fields > .field {
  min-width: 0;
  align-content: start;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-3);
  background: var(--surface-raised);
}

.settings-details-body > .panel,
.settings-subsection > .panel {
  min-width: 0;
  margin: 0;
  box-shadow: none;
}

.settings-subsection {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.settings-subsection > summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  padding: var(--space-3) var(--space-4);
  color: var(--ink-strong);
  font-weight: 750;
  list-style: none;
}

.settings-subsection[open] > summary {
  border-bottom: 1px solid var(--line);
}

.optimization-settings-details > #optimizationPanel {
  border: 0;
  background: transparent;
}

.scientific-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.scientific-detail-section {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: var(--space-3);
}

.scientific-detail-section h2,
.scientific-detail-section h3 {
  margin: 0 0 var(--space-2);
  font-size: 0.94rem;
  line-height: 1.3;
}

.scientific-detail-section p,
.scientific-detail-section li,
.scientific-detail-section dd,
.scientific-detail-section dt {
  font-size: 0.82rem;
  line-height: 1.5;
}

.scientific-formula {
  overflow-wrap: anywhere;
  border-left: 3px solid var(--green);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-raised);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
}

.lab-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.lab-main.compact-experiment-layout {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1480px;
}

.experiment-toolbar .dataset-example-field {
  margin: 0;
}

.experiment-toolbar .dataset-example-help {
  display: none;
}

.experiment-stage-selector #levelList {
  display: contents;
}

.experiment-primary-actions .status-pill {
  min-height: 28px;
}

.documentation-tools {
  display: grid;
  min-width: 0;
  gap: var(--space-4);
  border-top: 1px solid var(--line);
  padding-top: var(--space-4);
}

.documentation-tools > h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 1rem;
  line-height: 1.3;
}

.documentation-tools > .panel,
.documentation-tools > #motorExperience > .panel,
.documentation-tools > details {
  margin: 0;
  box-shadow: none;
}

.documentation-tools > #motorExperience {
  min-width: 0;
}

.scientific-details dl {
  display: grid;
  gap: var(--space-3);
  margin: 0;
}

.scientific-details dt {
  margin-bottom: var(--space-1);
  font-weight: 750;
}

.scientific-details dd {
  margin: 0;
}

.lab-footer-inner {
  display: flex;
  min-height: 72px;
  max-width: 1480px;
  margin: 0 auto;
  padding: var(--space-4) 28px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.footer-copy {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  justify-content: flex-end;
}

.footer-links a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 700;
  text-underline-offset: 3px;
}

@media (max-width: 1180px) {
  .experiment-toolbar-grid {
    grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1.6fr);
  }

  .experiment-primary-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 780px) {
  .compact-header-inner,
  .lab-footer-inner {
    padding-left: 14px;
    padding-right: 14px;
  }

  .compact-header-inner,
  .experiment-toolbar-grid,
  .scientific-details-grid,
  .settings-primary-fields {
    grid-template-columns: 1fr;
  }

  .compact-header-actions,
  .experiment-primary-actions {
    justify-content: flex-start;
  }

  .contact-link,
  .global-settings .language-switch button,
  .global-settings .theme-switch,
  .experiment-toolbar-field select,
  .experiment-stage-selector .level-card,
  .experiment-stage-selector button,
  .experiment-primary-actions .button,
  .scientific-details > summary,
  .settings-subsection > summary,
  .metric-mode-switch button,
  .metrics-seed-details > summary {
    min-height: 44px;
  }

  .experience-visual-stack > .panel > .panel-inner {
    padding: var(--space-4);
  }

  .metrics-selected-details,
  .metrics-comparison-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .network-head .status-pill,
  .metrics-stage-status {
    max-width: 100%;
    flex: 1 1 100%;
    justify-content: flex-start;
    text-align: left;
  }

  body.preview-mode .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-curves-grid {
    grid-template-columns: 1fr;
  }

  button.network-node:not(:disabled) {
    overflow: visible;
  }

  button.network-node:not(:disabled)::after {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    content: "";
  }

  .lab-footer-inner {
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .compact-header-inner,
  .lab-footer-inner {
    padding-left: 10px;
    padding-right: 10px;
  }

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

  .experiment-primary-actions .button,
  .contact-link {
    width: 100%;
  }

  .global-settings {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(104px, 0.8fr);
  }

  .global-settings .language-control,
  .theme-control {
    width: 100%;
    padding: 0;
  }

  .global-settings .language-label,
  .theme-control-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .global-settings .language-switch {
    width: 100%;
    grid-template-columns: repeat(2, minmax(44px, 1fr));
  }

  .global-settings .theme-switch {
    width: 100%;
    min-width: 104px;
  }

  .metrics-stage-list {
    grid-template-columns: 1fr;
  }

  body.preview-mode .metrics-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .lab-footer-inner {
    flex-direction: column;
  }

  .footer-links {
    width: 100%;
    align-items: flex-start;
    justify-content: flex-start;
  }
}

@media (forced-colors: active) {
  .contact-link,
  .global-settings,
  .experiment-toolbar,
  .experience-visual-stack > .panel,
  .unified-metrics-panel,
  .metric-mode-switch,
  .metrics-stage-card,
  .optimization-metrics-section,
  .scientific-details,
  .settings-subsection,
  .scientific-formula,
  .lab-footer {
    border-color: CanvasText;
  }

  .metric-mode-switch button.is-active,
  .metric-mode-switch button[aria-pressed="true"],
  .global-settings .language-switch button[aria-pressed="true"],
  .mode-button[aria-pressed="true"],
  .metrics-stage-card.is-active,
  .metrics-stage-card.is-best,
  .metrics-stage-card.is-running {
    outline: 2px solid Highlight;
    outline-offset: 1px;
  }

  .metric-curve-axis,
  .metric-curve-baseline {
    stroke: CanvasText;
  }

  .metric-curve-line {
    stroke: Highlight;
  }

  .metric-curve-tick,
  .metric-curve-label {
    fill: CanvasText;
  }
}
