:root {
  color-scheme: dark;
  --ink: #080b0d;
  --surface: #0d1214;
  --surface-raised: #11181a;
  --paper: #e8e5dc;
  --muted: #9aa5a5;
  --rule: #293235;
  --rule-bright: #3c484b;
  --sense: #62e0d0;
  --sense-soft: rgba(98, 224, 208, 0.13);
  --affect: #d6a764;
  --affect-soft: rgba(214, 167, 100, 0.12);
  --conflict: #ef776b;
  --meta: #a594eb;
  --meta-soft: rgba(165, 148, 235, 0.12);
  --focus: #8af5e8;
  --sans: "IBM Plex Sans", "Aptos", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --max-width: 1600px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(rgba(98, 224, 208, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(98, 224, 208, 0.025) 1px, transparent 1px),
    var(--ink);
  background-size: 24px 24px;
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
a,
input,
summary {
  -webkit-tap-highlight-color: transparent;
}

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

::selection {
  background: var(--sense);
  color: var(--ink);
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  transform: translateY(-150%);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
}

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

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.protocol-bar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  min-height: 56px;
  border-bottom: 1px solid var(--rule-bright);
  background: rgba(8, 11, 13, 0.96);
  backdrop-filter: blur(12px);
}

.protocol-mark,
.protocol-readout,
.protocol-actions {
  display: flex;
  align-items: center;
}

.protocol-mark {
  gap: 10px;
  padding: 0 20px;
  border-right: 1px solid var(--rule);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.protocol-mark__glyph {
  position: relative;
  width: 14px;
  height: 14px;
  border: 1px solid var(--sense);
  border-radius: 50%;
}

.protocol-mark__glyph::before,
.protocol-mark__glyph::after {
  position: absolute;
  content: "";
  background: var(--sense);
}

.protocol-mark__glyph::before {
  top: 6px;
  left: -4px;
  width: 20px;
  height: 1px;
}

.protocol-mark__glyph::after {
  top: -4px;
  left: 6px;
  width: 1px;
  height: 20px;
}

.protocol-readout {
  gap: 0;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  white-space: nowrap;
}

.protocol-readout > span {
  padding: 0 16px;
  border-right: 1px solid var(--rule);
}

.protocol-readout output {
  color: var(--paper);
}

.run-state {
  color: var(--affect);
}

.run-state::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.run-state[data-state="running"] {
  color: var(--sense);
}

.run-state[data-state="paused"] {
  color: var(--muted);
}

.protocol-actions {
  border-left: 1px solid var(--rule);
}

.instrument-button,
.preset-button {
  min-height: 44px;
  border: 0;
  border-left: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.instrument-button {
  padding: 0 18px;
}

.instrument-button:hover,
.preset-button:hover {
  background: var(--surface-raised);
}

.instrument-button:disabled {
  cursor: wait;
  opacity: 0.45;
}

.instrument-button--primary {
  background: var(--sense);
  color: var(--ink);
}

.instrument-button--primary:hover {
  background: #8aeadf;
}

.instrument-button--danger {
  background: var(--conflict);
  color: var(--ink);
}

.text-button {
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-transform: uppercase;
}

.text-button--danger {
  color: var(--conflict);
}

main {
  width: min(100%, var(--max-width));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(72px, 0.7fr) minmax(400px, 7fr) minmax(280px, 3.3fr);
  min-height: 420px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.hero__index {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 36px 20px;
  border-right: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  writing-mode: vertical-rl;
}

.hero__index span {
  color: var(--sense);
}

.hero__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 54px clamp(32px, 6vw, 96px);
}

.eyebrow,
.section-heading__meta {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 16px 0 20px;
  color: var(--paper);
  font-family: var(--sans);
  font-size: clamp(72px, 10vw, 152px);
  font-weight: 500;
  letter-spacing: -0.075em;
  line-height: 0.76;
}

.hero__lede {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(18px, 2vw, 26px);
  line-height: 1.35;
}

.simulation-notice {
  align-self: end;
  margin: 32px;
  padding: 22px;
  border-top: 1px solid var(--sense);
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(135deg, var(--sense-soft), transparent 70%);
}

.simulation-notice__label {
  color: var(--sense);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.simulation-notice p {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.simulation-notice strong {
  color: var(--paper);
  font-weight: 600;
}

.simulation-notice .simulation-notice__status {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.simulation-notice__status span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--affect);
}

.instrument {
  display: grid;
  grid-template-columns: minmax(260px, 3fr) minmax(420px, 5fr) minmax(300px, 4fr);
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.instrument-zone {
  min-width: 0;
  padding: 24px;
}

.stimulus-zone,
.field-zone {
  border-right: 1px solid var(--rule);
}

.section-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.section-heading__number {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border: 1px solid var(--rule-bright);
  color: var(--sense);
  font-family: var(--mono);
  font-size: 10px;
}

.section-heading h2 {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.section-heading--center {
  justify-content: center;
  text-align: left;
}

.preset-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 22px 0;
  border: 1px solid var(--rule);
}

.preset-button {
  min-width: 0;
  padding: 8px;
  border-left: 1px solid var(--rule);
  line-height: 1.25;
  text-transform: none;
}

.preset-button:first-child {
  border-left: 0;
}

.preset-button[aria-pressed="true"] {
  background: var(--sense-soft);
  color: var(--sense);
}

.stimulus-group {
  margin-top: 22px;
}

.stimulus-group:first-child {
  margin-top: 0;
}

.stimulus-group__title {
  display: flex;
  justify-content: space-between;
  margin: 0 0 9px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.stimulus-control {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 58px 38px;
  gap: 7px 10px;
  align-items: center;
  padding: 7px 0;
}

.stimulus-control__label {
  overflow: hidden;
  color: var(--paper);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stimulus-control__value {
  color: var(--sense);
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.stimulus-control__hold {
  display: flex;
  justify-content: flex-end;
}

.stimulus-control__hold input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--meta);
}

.stimulus-control__hold span {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0, 0, 0, 0);
}

.stimulus-control input[type="range"],
.recursion-controls input[type="range"] {
  width: 100%;
  height: 20px;
  margin: 0;
  grid-column: 1 / -1;
  accent-color: var(--sense);
  cursor: pointer;
}

.switch-control {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  cursor: pointer;
}

.switch-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-control > span:first-of-type {
  position: relative;
  width: 38px;
  height: 20px;
  flex: 0 0 38px;
  border: 1px solid var(--rule-bright);
  background: var(--surface);
}

.switch-control > span:first-of-type::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  background: var(--muted);
  content: "";
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.switch-control input:checked + span::after {
  transform: translateX(18px);
  background: var(--sense);
}

.switch-control input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.switch-control strong,
.switch-control small {
  display: block;
}

.switch-control strong {
  font-size: 11px;
  font-weight: 500;
}

.switch-control small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.field-zone {
  display: flex;
  flex-direction: column;
}

.aperture-wrap {
  position: relative;
  width: min(100%, 520px);
  margin: 16px auto 0;
  color: var(--sense);
}

.aperture {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.aperture__bloom {
  fill: url("#field-glow");
}

.aperture__calibration circle,
.aperture__calibration line {
  fill: none;
  stroke: var(--rule);
  stroke-width: 0.75;
}

.aperture__calibration circle:nth-child(2n) {
  stroke-dasharray: 2 5;
}

.aperture-axis {
  stroke: var(--rule-bright);
  stroke-width: 0.8;
}

.aperture-axis-label {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.05em;
  text-anchor: middle;
  text-transform: uppercase;
}

.aperture__signal {
  fill: rgba(98, 224, 208, 0.1);
  stroke: var(--sense);
  stroke-linejoin: round;
  stroke-width: 1.7;
  transition: points 240ms ease;
}

.aperture__signal--ghost {
  fill: none;
  stroke: var(--muted);
  stroke-dasharray: 4 5;
  stroke-width: 1;
}

.recursion-ring {
  fill: none;
  stroke: var(--meta);
  stroke-opacity: 0.35;
  stroke-width: 1;
}

.recursion-ring--active {
  stroke-opacity: 0.9;
}

.aperture__affect-axis {
  stroke: var(--affect);
  stroke-opacity: 0.5;
  stroke-width: 1;
}

.aperture__affect-glow {
  fill: var(--affect);
  filter: url("#soft-glow");
  opacity: 0.22;
}

.aperture__affect {
  fill: var(--affect);
  stroke: var(--ink);
  stroke-width: 1.5;
}

.aperture__center {
  fill: var(--paper);
}

.aperture__pulse {
  fill: none;
  stroke: var(--sense);
  stroke-width: 1;
  opacity: 0;
}

.aperture-wrap[data-pulse="true"] .aperture__pulse {
  animation: aperture-pulse 700ms ease-out;
}

@keyframes aperture-pulse {
  0% {
    opacity: 0.7;
    r: 28;
  }
  100% {
    opacity: 0;
    r: 160;
  }
}

.aperture-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.legend-line {
  width: 20px;
  height: 1px;
  background: var(--sense);
}

.legend-line--dash {
  background: repeating-linear-gradient(
    90deg,
    var(--muted) 0 3px,
    transparent 3px 6px
  );
}

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--affect);
}

.active-inquiry {
  margin: 26px 0 18px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-align: center;
}

.active-inquiry__label {
  margin: 0 0 8px;
  color: var(--sense);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.09em;
}

.active-inquiry blockquote {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(20px, 2.2vw, 29px);
  font-style: italic;
  line-height: 1.25;
}

.field-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
}

.field-readout output {
  color: var(--paper);
}

.loop-stages {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 22px 0 0;
  padding: 1px;
  background: var(--rule);
  list-style: none;
}

.loop-stages li {
  position: relative;
  min-height: 34px;
  padding: 9px 8px 7px 16px;
  background: var(--ink);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.loop-stages li::before {
  position: absolute;
  top: 14px;
  left: 7px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--rule-bright);
  content: "";
}

.loop-stages li[data-active="true"] {
  background: var(--sense-soft);
  color: var(--paper);
}

.loop-stages li[data-active="true"]::before {
  background: var(--sense);
}

.synthetic-report {
  margin: 22px 0 0;
  padding: 20px 0;
  border-top: 1px solid var(--affect);
  border-bottom: 1px solid var(--rule);
}

.synthetic-report__label {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.synthetic-report__label span {
  color: var(--affect);
}

.synthetic-report__feeling {
  margin: 10px 0 6px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1;
}

.synthetic-report__note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.metric-list {
  margin: 20px 0 0;
}

.metric-list > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}

.metric-list dt {
  color: var(--muted);
  font-size: 11px;
}

.metric-list dd {
  margin: 0;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 10px;
  text-align: right;
}

.recursion-controls {
  margin-top: 22px;
}

.recursion-controls label {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
}

.recursion-controls output {
  color: var(--meta);
  font-family: var(--mono);
}

.recursion-controls input[type="range"] {
  accent-color: var(--meta);
}

.recursion-trace {
  margin-top: 24px;
}

.recursion-trace__heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
}

.recursion-trace h3,
.recursion-trace__heading span {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.recursion-trace ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.recursion-trace li {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.recursion-trace li:last-child {
  color: var(--meta);
}

.ledger-section {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.wide-section-heading {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 0.65fr);
  gap: 32px;
  align-items: center;
  min-height: 112px;
  padding: 24px;
  border-bottom: 1px solid var(--rule);
}

.wide-section-heading > p {
  justify-self: end;
  max-width: 540px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.objective-table-wrap {
  overflow-x: auto;
}

.objective-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.objective-table th,
.objective-table td {
  padding: 14px 16px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  text-align: left;
}

.objective-table th:last-child,
.objective-table td:last-child {
  border-right: 0;
}

.objective-table thead th {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.objective-table th:nth-child(1) {
  width: 25%;
}

.objective-table th:nth-child(2) {
  width: 34%;
}

.objective-table th:nth-child(3) {
  width: 24%;
}

.objective-table th:nth-child(4) {
  width: 17%;
}

.objective-row[data-active="true"] {
  background: linear-gradient(90deg, var(--sense-soft), transparent 65%);
}

.objective-row[data-status="FAIL"] {
  box-shadow: inset 3px 0 var(--conflict);
}

.objective-row[data-status="UNRESOLVED"] {
  background: linear-gradient(90deg, var(--meta-soft), transparent 65%);
}

.objective-id {
  display: block;
  margin-bottom: 5px;
  color: var(--sense);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
}

.objective-question {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.25;
}

.objective-copy {
  color: var(--muted);
  font-size: 11px;
}

.objective-copy strong {
  color: var(--paper);
  font-weight: 500;
}

.verifier-details summary {
  min-height: 24px;
  color: var(--paper);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
}

.verifier-details p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.objective-result {
  display: inline-block;
  padding: 4px 6px;
  border: 1px solid var(--rule-bright);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.objective-result[data-status="PASS"] {
  border-color: rgba(98, 224, 208, 0.55);
  color: var(--sense);
}

.objective-result[data-status="FAIL"] {
  border-color: rgba(239, 119, 107, 0.65);
  color: var(--conflict);
}

.objective-result[data-status="UNRESOLVED"] {
  border-color: rgba(165, 148, 235, 0.65);
  color: var(--meta);
}

.objective-value {
  display: block;
  margin-top: 8px;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 10px;
}

.affect-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.affect-axis {
  min-width: 0;
  padding: 22px 24px;
  border-right: 1px solid var(--rule);
}

.affect-axis:last-child {
  border-right: 0;
}

.affect-axis > div,
.affect-axis > p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.affect-axis > div {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.07em;
}

.affect-axis output {
  color: var(--affect);
}

.affect-axis meter {
  width: 100%;
  height: 10px;
  margin: 14px 0 7px;
  border: 0;
  background: var(--surface-raised);
  accent-color: var(--affect);
}

.affect-axis meter::-webkit-meter-bar {
  border: 0;
  border-radius: 0;
  background: var(--surface-raised);
}

.affect-axis meter::-webkit-meter-optimum-value,
.affect-axis meter::-webkit-meter-suboptimum-value,
.affect-axis meter::-webkit-meter-even-less-good-value {
  background: var(--affect);
}

.affect-axis meter::-moz-meter-bar {
  background: var(--affect);
}

.affect-axis > p {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.affect-axis > p span {
  color: var(--rule-bright);
}

.ledger-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ledger-actions .instrument-button:first-child {
  border-left: 0;
}

.ledger-verification {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 44px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.ledger-verification span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.ledger-verification[data-valid="true"] span {
  background: var(--sense);
}

.ledger-verification[data-valid="false"] {
  color: var(--conflict);
}

.ledger-verification[data-valid="false"] span {
  background: var(--conflict);
}

.trace-disclosure {
  display: grid;
  grid-template-columns: minmax(180px, 0.38fr) 1fr;
  gap: 28px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(90deg, var(--meta-soft), transparent 58%);
}

.trace-disclosure span,
.panel-heading p,
.rail-heading p,
.ledger-audit-heading > span {
  color: var(--meta);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.09em;
}

.trace-disclosure p {
  max-width: 800px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.ledger-workbench {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(360px, 5fr);
  min-height: 780px;
  border-bottom: 1px solid var(--rule);
}

.dialogue-panel {
  min-width: 0;
  border-right: 1px solid var(--rule);
  background:
    linear-gradient(rgba(98, 224, 208, 0.018) 1px, transparent 1px),
    var(--ink);
  background-size: 100% 32px;
}

.panel-heading,
.rail-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 18px 20px;
  border-bottom: 1px solid var(--rule);
}

.panel-heading p,
.rail-heading p {
  margin: 0 0 4px;
}

.panel-heading h3,
.rail-heading h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.panel-heading > span,
.rail-heading > span,
.rail-heading > strong {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.dialogue-thread {
  display: flex;
  overflow-y: auto;
  flex-direction: column;
  gap: 26px;
  max-height: 980px;
  padding: 24px;
  scrollbar-color: var(--rule-bright) transparent;
}

.dialogue-empty {
  max-width: 540px;
  margin: auto;
  padding: 80px 24px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 21px;
  text-align: center;
}

.dialogue-cycle {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 26px;
  border-bottom: 1px dashed var(--rule);
}

.dialogue-cycle:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.dialogue-cycle__label {
  margin: 0 0 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.dialogue-message {
  width: min(78%, 720px);
  margin-right: auto;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-left: 2px solid var(--sense);
  border-radius: 2px;
  background: rgba(13, 18, 20, 0.96);
}

.dialogue-cycle[data-current="true"] .dialogue-message {
  animation: message-arrival 180ms ease-out both;
}

.dialogue-message[data-role="EXPECTATION"],
.dialogue-message[data-role="BELIEF_KEEPER"],
.dialogue-message[data-role="LEARNER"],
.dialogue-message[data-role="AUDITOR"] {
  margin-right: 0;
  margin-left: auto;
  border-right: 2px solid var(--meta);
  border-left-color: var(--rule);
}

.dialogue-message--counterevidence {
  border-left-color: var(--conflict);
}

.dialogue-message--recall {
  width: min(90%, 820px);
  margin-right: auto;
  margin-left: auto;
  border-color: var(--rule-bright);
}

.dialogue-message--revision,
.dialogue-message--improvement,
.dialogue-message--prediction {
  background: linear-gradient(110deg, var(--meta-soft), var(--surface) 62%);
}

.dialogue-message--continuity {
  width: 100%;
  border-right-color: var(--paper);
  background: var(--surface-raised);
}

.dialogue-message__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  align-items: center;
  margin-bottom: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.07em;
}

.dialogue-message__meta span {
  color: var(--paper);
}

.dialogue-message__meta em {
  padding: 2px 4px;
  border: 1px solid var(--rule-bright);
  color: var(--sense);
  font-style: normal;
}

.dialogue-message p {
  margin: 0;
  color: var(--paper);
  font-size: 12px;
  line-height: 1.6;
}

@keyframes message-arrival {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.belief-rail {
  min-width: 0;
  background: var(--surface);
}

.rail-panel {
  border-bottom: 1px solid var(--rule);
}

.rail-explainer {
  margin: 0;
  padding: 12px 20px;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-size: 10px;
}

.belief-row {
  border-bottom: 1px solid var(--rule);
}

.belief-row summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 64px;
  padding: 11px 20px;
  cursor: pointer;
  list-style: none;
}

.belief-row summary::-webkit-details-marker {
  display: none;
}

.belief-row__identity {
  display: grid;
  gap: 3px;
}

.belief-row__identity strong {
  color: var(--meta);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
}

.belief-row__identity span {
  color: var(--paper);
  font-size: 10px;
  line-height: 1.35;
}

.belief-row__change {
  align-self: start;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  text-align: right;
  white-space: nowrap;
}

.belief-row meter {
  display: block;
  width: calc(100% - 40px);
  height: 5px;
  margin: -8px 20px 13px;
  border: 0;
  background: var(--ink);
  accent-color: var(--meta);
}

.belief-row meter::-webkit-meter-bar {
  border: 0;
  border-radius: 0;
  background: var(--ink);
}

.belief-row meter::-webkit-meter-optimum-value,
.belief-row meter::-webkit-meter-suboptimum-value,
.belief-row meter::-webkit-meter-even-less-good-value {
  background: var(--meta);
}

.belief-row meter::-moz-meter-bar {
  background: var(--meta);
}

.belief-row__evidence {
  margin: 0;
  padding: 0 20px 14px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.epistemic-boundary {
  padding: 14px 20px;
  color: var(--muted);
  font-size: 10px;
}

.epistemic-boundary span {
  display: block;
  margin-bottom: 4px;
  color: var(--conflict);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.07em;
}

.improvement-list,
.memory-list {
  margin: 0;
  padding: 8px 20px 12px;
}

.improvement-list div,
.memory-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule);
}

.improvement-list dt,
.improvement-list dd,
.memory-list dt,
.memory-list dd {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.improvement-list dd,
.memory-list dd {
  margin: 0;
  color: var(--paper);
  text-align: right;
}

.rail-heading strong[data-status="IMPROVING"] {
  color: var(--sense);
}

.rail-heading strong[data-status="REGRESSING"] {
  color: var(--conflict);
}

.memory-badge {
  max-width: 150px;
  padding: 3px 5px;
  border: 1px solid var(--rule-bright);
  white-space: normal !important;
}

.ledger-audit-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  min-height: 58px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-raised);
}

.ledger-audit-heading p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.ledger-head,
.ledger-entry summary {
  display: grid;
  grid-template-columns: minmax(150px, 1.15fr) minmax(260px, 2fr) minmax(180px, 1fr);
  gap: 20px;
  align-items: center;
}

.ledger-head {
  min-height: 36px;
  padding: 0 24px;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.ledger-entry {
  border-bottom: 1px solid var(--rule);
}

.ledger-entry[open] {
  background: var(--surface);
}

.ledger-entry summary {
  position: relative;
  min-height: 64px;
  padding: 12px 42px 12px 24px;
  cursor: pointer;
  list-style: none;
}

.ledger-entry summary::-webkit-details-marker {
  display: none;
}

.ledger-entry summary::after {
  position: absolute;
  top: 50%;
  right: 24px;
  color: var(--muted);
  content: "+";
  font-family: var(--mono);
  transform: translateY(-50%);
}

.ledger-entry[open] summary::after {
  content: "−";
}

.ledger-entry__seq,
.ledger-entry__digest {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.ledger-entry__state {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
}

.ledger-entry__state strong {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
}

.ledger-entry__state span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.ledger-entry__digest {
  overflow: hidden;
  color: var(--sense);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-entry__detail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  padding: 1px 24px 24px;
  background: var(--rule);
}

.ledger-detail-block {
  min-width: 0;
  padding: 16px;
  background: var(--surface);
}

.ledger-detail-block h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ledger-detail-block p {
  margin: 0;
  color: var(--paper);
  font-size: 11px;
}

.ledger-detail-block dl {
  margin: 0;
}

.ledger-detail-block dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--rule);
}

.ledger-detail-block dt,
.ledger-detail-block dd {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.ledger-detail-block dd {
  margin: 0;
  color: var(--paper);
  text-align: right;
}

.ledger-detail-block--wide {
  grid-column: span 2;
}

.ledger-transcript {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ledger-transcript li {
  display: grid;
  grid-template-columns: minmax(130px, 0.35fr) 1fr;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.ledger-transcript strong {
  color: var(--meta);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
}

.ledger-transcript span {
  color: var(--paper);
  font-size: 10px;
}

.ledger-hash {
  overflow-wrap: anywhere;
  color: var(--sense) !important;
  font-family: var(--mono);
  font-size: 8px !important;
}

.ledger-empty {
  margin: 0;
  padding: 48px 24px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 18px;
  text-align: center;
}

.ledger-caveat {
  margin: 0;
  padding: 18px 24px;
  color: var(--muted);
  font-size: 10px;
}

.reset-cloud-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 18px;
  color: var(--muted);
  font-size: 11px;
}

.reset-cloud-option input {
  margin-top: 2px;
  accent-color: var(--conflict);
}

.epistemic-remainder {
  min-height: 440px;
  padding: clamp(56px, 9vw, 120px) clamp(32px, 12vw, 180px);
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  background:
    radial-gradient(circle at 80% 35%, var(--meta-soft), transparent 34%),
    linear-gradient(135deg, transparent 50%, rgba(165, 148, 235, 0.03));
}

.epistemic-remainder h2 {
  max-width: 980px;
  margin: 18px 0 24px;
  font-family: var(--serif);
  font-size: clamp(40px, 6vw, 82px);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.epistemic-remainder > p:last-child {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

footer {
  display: flex;
  justify-content: space-between;
  width: min(100%, var(--max-width));
  min-height: 80px;
  margin: 0 auto;
  padding: 26px 24px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.07em;
}

.mobile-run-controls {
  display: none;
}

.reset-dialog {
  width: min(92vw, 520px);
  padding: 0;
  border: 1px solid var(--rule-bright);
  border-radius: 0;
  background: var(--surface);
  color: var(--paper);
}

.reset-dialog::backdrop {
  background: rgba(2, 4, 5, 0.82);
  backdrop-filter: blur(4px);
}

.reset-dialog form {
  padding: 28px;
}

.reset-dialog h2 {
  margin: 10px 0;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 400;
}

.reset-dialog p:not(.section-heading__meta) {
  color: var(--muted);
  font-size: 13px;
}

.reset-dialog form > div {
  display: flex;
  justify-content: flex-end;
  margin: 24px -28px -28px;
  border-top: 1px solid var(--rule);
}

@media (max-width: 1180px) {
  .protocol-readout > span:nth-child(2) {
    display: none;
  }

  .hero {
    grid-template-columns: 64px 1fr 330px;
  }

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

  .field-zone {
    grid-column: 1 / -1;
    grid-row: 1;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .stimulus-zone {
    border-right: 1px solid var(--rule);
  }

  .aperture-wrap {
    width: min(62vw, 560px);
  }

  .ledger-entry__detail {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 820px) {
  body {
    padding-bottom: 68px;
  }

  .protocol-bar {
    grid-template-columns: auto 1fr;
  }

  .protocol-mark {
    padding: 0 14px;
  }

  .protocol-readout {
    justify-content: flex-end;
  }

  .protocol-readout > span:first-child,
  .protocol-actions {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero__index {
    display: none;
  }

  .hero__copy {
    padding: 54px 24px 34px;
  }

  .hero h1 {
    font-size: clamp(62px, 19.5vw, 110px);
  }

  .simulation-notice {
    margin: 0 24px 32px;
  }

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

  .field-zone,
  .stimulus-zone,
  .meta-zone {
    grid-column: auto;
    grid-row: auto;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .field-zone {
    grid-row: 1;
  }

  .stimulus-zone {
    grid-row: 2;
  }

  .meta-zone {
    grid-row: 3;
    border-bottom: 0;
  }

  .aperture-wrap {
    width: min(100%, 520px);
  }

  .wide-section-heading {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .wide-section-heading > p {
    justify-self: start;
  }

  .trace-disclosure {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .ledger-workbench {
    grid-template-columns: 1fr;
  }

  .dialogue-panel {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .dialogue-thread {
    overflow-y: visible;
    max-height: none;
  }

  .dialogue-message {
    width: 92%;
  }

  .dialogue-message--continuity {
    width: 100%;
  }

  .ledger-audit-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .objective-table,
  .objective-table tbody,
  .objective-table tr,
  .objective-table td {
    display: block;
    width: 100%;
  }

  .objective-table thead {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    clip: rect(0, 0, 0, 0);
  }

  .objective-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--rule);
  }

  .objective-table td {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .objective-table td:first-child,
  .objective-table td:nth-child(2) {
    grid-column: 1 / -1;
  }

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

  .affect-axis:nth-child(2) {
    border-right: 0;
  }

  .affect-axis:nth-child(-n + 2) {
    border-bottom: 1px solid var(--rule);
  }

  .ledger-head {
    display: none;
  }

  .ledger-entry summary {
    grid-template-columns: 1fr;
    gap: 5px;
    min-height: 82px;
  }

  .ledger-entry__state {
    grid-row: 1;
  }

  .ledger-entry__seq {
    grid-row: 2;
  }

  .ledger-entry__digest {
    grid-row: 3;
  }

  .ledger-entry__detail {
    grid-template-columns: 1fr;
  }

  .ledger-detail-block--wide {
    grid-column: auto;
  }

  .mobile-run-controls {
    position: fixed;
    z-index: 25;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 60px;
    border-top: 1px solid var(--rule-bright);
    background: var(--ink);
  }

  .mobile-run-controls .instrument-button {
    min-height: 60px;
  }
}

@media (max-width: 520px) {
  .protocol-mark span:last-child,
  .protocol-readout > span:nth-child(3) {
    display: none;
  }

  .protocol-readout {
    padding-right: 6px;
  }

  .protocol-readout > span {
    padding: 0 9px;
  }

  .instrument-zone,
  .wide-section-heading {
    padding: 20px 16px;
  }

  .hero__copy {
    padding-right: 16px;
    padding-left: 16px;
  }

  .simulation-notice {
    margin-right: 16px;
    margin-left: 16px;
  }

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

  .preset-button {
    border-top: 1px solid var(--rule);
    border-left: 0;
  }

  .preset-button:first-child {
    border-top: 0;
  }

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

  .objective-table tr {
    grid-template-columns: 1fr;
  }

  .objective-table td {
    grid-column: 1 / -1;
  }

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

  .affect-axis {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .ledger-actions {
    justify-content: flex-start;
  }

  .ledger-actions .instrument-button {
    border-right: 1px solid var(--rule);
    border-left: 0;
  }

  .trace-disclosure,
  .panel-heading,
  .rail-heading,
  .dialogue-thread,
  .ledger-audit-heading {
    padding-right: 16px;
    padding-left: 16px;
  }

  .dialogue-message,
  .dialogue-message--recall,
  .dialogue-message--continuity {
    width: 100%;
  }

  .dialogue-message[data-role="EXPECTATION"],
  .dialogue-message[data-role="BELIEF_KEEPER"],
  .dialogue-message[data-role="LEARNER"],
  .dialogue-message[data-role="AUDITOR"] {
    margin-left: 0;
  }

  .belief-row summary {
    grid-template-columns: 1fr;
  }

  .belief-row__change {
    text-align: left;
  }

  .ledger-transcript li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .epistemic-remainder {
    min-height: 0;
    padding: 64px 20px;
  }

  footer {
    flex-direction: column;
    gap: 8px;
  }
}

@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;
  }
}

@media (prefers-contrast: more) {
  :root {
    --muted: #c0c8c8;
    --rule: #566064;
    --rule-bright: #798386;
  }
}
