:root {
  --ink: #0e0c0a;
  --ink-deep: #090806;
  --panel: #12100d;
  --panel-raised: #18140f;
  --panel-soft: #15120e;
  --ivory: #eee6d5;
  --ivory-soft: #cabea9;
  --muted: #948977;
  --dim: #6f604c;
  --gold: #c89a4e;
  --gold-bright: #dfb96f;
  --gold-faint: #c89a4e1c;
  --line: #3d3326;
  --line-soft: #2b241b;
  --red: #e65740;
  --red-faint: #e6574018;
  --green: #8eae86;
  --serif: "Cormorant Garamond", Georgia, serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --page: min(1600px, calc(100vw - 52px));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--ink);
  color: var(--ivory);
  font-family: var(--sans);
  line-height: 1.5;
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  background:
    radial-gradient(circle at 50% 4%, #c89a4e12, transparent 28%),
    linear-gradient(90deg, transparent 20%, #d9ad5e08 38%, #d9ad5e15 50%, #d9ad5e08 62%, transparent 80%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: -2;
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p,
dl,
dd,
ol {
  margin-top: 0;
}

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

:focus-visible {
  outline: 1px solid var(--gold-bright);
  outline-offset: 3px;
}

.skip-link {
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  left: 16px;
  padding: 9px 13px;
  position: fixed;
  top: -60px;
  z-index: 1000;
}

.skip-link:focus {
  top: 16px;
}

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

.topbar {
  align-items: center;
  backdrop-filter: blur(18px);
  background: #0e0c0aed;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr auto 1fr;
  min-height: 72px;
  padding: 0 max(26px, calc((100vw - 1600px) / 2));
  position: sticky;
  top: 0;
  z-index: 40;
}

.wordmark {
  align-items: center;
  display: flex;
  gap: 15px;
  justify-self: start;
}

.wordmark > span:last-child {
  color: var(--ivory-soft);
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.03em;
}

.wordmark-glyph {
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.16em;
  line-height: 1;
}

.wordmark-glyph span {
  color: var(--gold);
  font-size: 13px;
}

.topbar-center,
.topbar-actions {
  align-items: center;
  display: flex;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topbar-center {
  color: var(--dim);
  gap: 10px;
  justify-self: center;
}

.status-light {
  animation: breathe 3.4s ease-in-out infinite;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 12px #c89a4e80;
  height: 5px;
  width: 5px;
}

.topbar-divider {
  background: var(--line);
  height: 14px;
  margin: 0 5px;
  width: 1px;
}

.topbar-actions {
  gap: 25px;
  justify-self: end;
}

.topbar-actions a,
.topbar-actions button {
  color: var(--muted);
}

.topbar-actions button {
  background: transparent;
  border: 0;
  letter-spacing: inherit;
  padding: 7px 0;
  text-transform: uppercase;
}

.topbar-actions a:hover,
.topbar-actions button:hover {
  color: var(--gold-bright);
}

.topbar-actions button {
  border-bottom: 1px solid var(--gold);
  color: var(--gold-bright);
}

.masthead {
  display: grid;
  gap: clamp(28px, 4vw, 72px);
  grid-template-columns: 38px minmax(430px, 1.15fr) minmax(250px, 0.58fr) minmax(210px, 0.42fr);
  margin: 0 auto;
  min-height: 500px;
  overflow: hidden;
  padding: clamp(58px, 7vw, 105px) 0 52px;
  position: relative;
  width: var(--page);
}

.masthead::after {
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  bottom: 0;
  content: "";
  height: 1px;
  left: 0;
  position: absolute;
  right: 0;
}

.volume-mark {
  align-self: center;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.14em;
  line-height: 1.8;
  transform: rotate(-90deg);
  white-space: nowrap;
}

.masthead-copy {
  align-self: center;
  position: relative;
  z-index: 2;
}

.eyebrow,
.section-label {
  color: #997e55;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  margin-bottom: 25px;
  text-transform: uppercase;
}

.masthead h1 {
  font-family: var(--serif);
  font-size: clamp(64px, 6.4vw, 105px);
  font-weight: 500;
  letter-spacing: -0.058em;
  line-height: 0.79;
  margin-bottom: 0;
}

.masthead h1 em {
  color: var(--gold-bright);
  font-style: italic;
}

.masthead-aside {
  align-self: end;
  padding-bottom: 18px;
  position: relative;
  z-index: 2;
}

.masthead-aside > p {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  margin-bottom: 30px;
  max-width: 34ch;
}

.masthead-stats {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
}

.masthead-stats div {
  padding: 12px 8px 11px 0;
}

.masthead-stats div + div {
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.masthead-stats dt {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.masthead-stats dd {
  color: var(--ivory-soft);
  font-family: var(--mono);
  font-size: 11px;
  margin: 5px 0 0;
}

.masthead-vault {
  align-self: stretch;
  min-height: 340px;
  position: relative;
}

.vault-arch {
  border: 1px solid #76582e;
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  bottom: -54px;
  position: absolute;
  top: 4%;
  width: 69%;
}

.vault-arch-left {
  left: -8%;
}

.vault-arch-right {
  right: -8%;
}

.vault-spine {
  background: linear-gradient(90deg, #17120d, #80613145, #17120d);
  border-left: 1px solid #6d522b;
  border-right: 1px solid #2c2115;
  bottom: -54px;
  left: 43%;
  position: absolute;
  top: 14%;
  width: 14%;
}

.masthead-vault > span {
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 74px;
  left: 50%;
  position: absolute;
  text-shadow: 0 0 36px #c9954590;
  top: 50%;
  transform: translate(-50%, -50%);
}

.chamber,
.memory-section {
  margin: 0 auto;
  padding: 65px 0 0;
  width: var(--page);
}

.chamber-head,
.memory-head {
  align-items: end;
  display: flex;
  gap: 35px;
  justify-content: space-between;
  margin-bottom: 30px;
}

.chamber-head .section-label,
.memory-head .section-label {
  margin-bottom: 9px;
}

.chamber-head h2,
.memory-head h2 {
  font-family: var(--serif);
  font-size: clamp(36px, 4vw, 56px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 0.96;
  margin-bottom: 8px;
}

.chamber-brief,
.memory-head > p {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 16px;
  margin-bottom: 0;
}

.memory-head > p {
  max-width: 38ch;
  text-align: right;
}

.chamber-head-actions {
  align-items: end;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.experiment-state,
.judge-seal {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.experiment-state::before {
  color: var(--gold);
  content: "○";
  margin-right: 7px;
}

.experiment-state.is-running::before {
  animation: breathe 1.1s ease-in-out infinite;
  content: "●";
}

.text-button {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  padding: 4px 0;
  text-transform: uppercase;
}

.text-button:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.loop-rail {
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  list-style: none;
  margin: 0;
  padding: 0;
}

.loop-rail li {
  align-items: center;
  background: #100e0b;
  display: grid;
  gap: 1px 12px;
  grid-template-columns: auto 1fr;
  min-height: 64px;
  opacity: 0.46;
  padding: 11px 16px;
  position: relative;
  transition: background 180ms ease, opacity 180ms ease;
}

.loop-rail li + li {
  border-left: 1px solid var(--line);
}

.loop-rail li::after {
  background: var(--gold);
  bottom: -1px;
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms ease;
  width: 100%;
}

.loop-rail li.is-active,
.loop-rail li.is-complete {
  opacity: 1;
}

.loop-rail li.is-active {
  background: var(--gold-faint);
}

.loop-rail li.is-active::after {
  transform: scaleX(1);
}

.loop-rail li.is-refuted::after {
  background: var(--red);
  transform: scaleX(1);
}

.loop-rail li > span {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 8px;
  grid-row: 1 / 3;
}

.loop-rail li strong {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.loop-rail li small {
  color: var(--dim);
  font-family: var(--serif);
  font-size: 13px;
}

.workbench {
  border-left: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(310px, 0.84fr) minmax(430px, 1.2fr) minmax(310px, 0.86fr);
}

.bench-panel {
  background: linear-gradient(180deg, #12100df5, #0f0d0af5);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-width: 0;
  padding: 23px;
  position: relative;
}

.panel-heading,
.subhead {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.panel-heading > div > span,
.subhead > span,
.panel-heading > span {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.panel-heading h3,
.subhead h3 {
  color: var(--ivory-soft);
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 4px 0 0;
}

.case-legend {
  display: flex;
  gap: 9px;
  padding-top: 2px;
}

.case-legend span {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
}

.case-legend span::before {
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: 5px;
  margin-right: 4px;
  width: 5px;
}

.case-legend .stable::before {
  background: var(--green);
}

.case-legend .unstable::before {
  background: var(--red);
}

.panel-intro {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.45;
  margin: 18px 0;
  max-width: 40ch;
}

.case-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 468px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

.case-card {
  background: #0c0a08;
  border: 1px solid var(--line-soft);
  min-height: 99px;
  overflow: hidden;
  padding: 10px;
  position: relative;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.case-card::after {
  background: var(--green);
  content: "";
  height: 1px;
  left: 0;
  position: absolute;
  top: 0;
  width: 28px;
}

.case-card.is-unstable::after {
  background: var(--red);
}

.case-card.is-error {
  animation: witnessFlash 680ms ease;
  background: var(--red-faint);
  border-color: var(--red);
}

.case-card.is-correct {
  border-color: #5c6347;
}

.case-card.is-new {
  animation: caseReveal 480ms ease both;
}

.case-top {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.case-id,
.case-outcome {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.case-id {
  color: var(--ivory-soft);
}

.case-outcome {
  color: var(--green);
}

.is-unstable .case-outcome {
  color: var(--red);
}

.case-values {
  display: grid;
  gap: 5px;
}

.case-value {
  align-items: center;
  display: grid;
  gap: 5px;
  grid-template-columns: 9px 1fr 12px;
}

.case-value span,
.case-value b {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 6px;
  font-weight: 400;
}

.case-value b {
  color: var(--muted);
  text-align: right;
}

.micro-bar {
  appearance: none;
  background: var(--line-soft);
  border: 0;
  height: 2px;
  overflow: hidden;
  width: 100%;
}

.micro-bar::-webkit-meter-bar {
  background: var(--line-soft);
  border: 0;
  border-radius: 0;
  height: 2px;
}

.micro-bar::-webkit-meter-optimum-value {
  background: var(--dim);
}

.micro-bar::-moz-meter-bar {
  background: var(--dim);
}

.prediction-mark {
  background: var(--panel-raised);
  bottom: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 6px;
  left: 0;
  letter-spacing: 0.06em;
  padding: 3px 5px;
  position: absolute;
  right: 0;
  text-align: right;
  text-transform: uppercase;
}

.is-error .prediction-mark {
  background: var(--red);
  color: var(--ink-deep);
}

.case-hidden {
  align-items: center;
  background: repeating-linear-gradient(135deg, #100e0b, #100e0b 7px, #12100d 7px, #12100d 14px);
  border: 1px dashed var(--line);
  color: var(--dim);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 99px;
}

.case-hidden strong {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 400;
}

.case-hidden span {
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.world-actions,
.candidate-actions,
.judgment-actions {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.world-actions,
.candidate-actions {
  grid-template-columns: 1fr 1fr;
}

.gold-button,
.quiet-button,
.retain-button {
  align-items: center;
  display: flex;
  font-family: var(--mono);
  font-size: 8px;
  justify-content: space-between;
  letter-spacing: 0.07em;
  min-height: 40px;
  padding: 0 12px;
  text-transform: uppercase;
}

.gold-button {
  background: var(--gold);
  border: 1px solid var(--gold);
  color: var(--ink-deep);
}

.gold-button:hover {
  background: var(--gold-bright);
  border-color: var(--gold-bright);
}

.quiet-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.quiet-button:hover {
  border-color: #806b4c;
  color: var(--ivory-soft);
}

.gold-button:disabled,
.quiet-button:disabled {
  opacity: 0.4;
}

.full-width {
  width: 100%;
}

.witness-composer {
  background: var(--panel-raised);
  border: 1px solid #6a5434;
  margin-top: 10px;
  padding: 14px;
}

.composer-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.composer-head strong {
  color: var(--ivory-soft);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.composer-head button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
}

.mini-controls {
  display: grid;
  gap: 9px;
  margin: 14px 0;
}

.mini-controls label {
  align-items: center;
  color: var(--muted);
  display: grid;
  font-family: var(--mono);
  font-size: 7px;
  gap: 7px;
  grid-template-columns: 36px 12px 1fr;
  text-transform: uppercase;
}

.mini-controls output {
  color: var(--gold-bright);
}

.outcome-picker {
  border: 0;
  display: flex;
  gap: 14px;
  margin: 13px 0;
  padding: 0;
}

.outcome-picker legend {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  margin-bottom: 7px;
  text-transform: uppercase;
  width: 100%;
}

.outcome-picker label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.outcome-picker input {
  accent-color: var(--gold);
  margin: 0 4px 0 0;
  vertical-align: -1px;
}

.witness-composer > p {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 6px;
  margin: 9px 0 0;
  text-align: center;
}

.proposal-mode {
  color: #806b4c !important;
  max-width: 100px;
  text-align: right;
}

.neural-stage {
  background:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px),
    radial-gradient(circle at 50% 45%, #c89a4e10, transparent 32%);
  background-size: 26px 26px, 26px 26px, auto;
  border: 1px solid var(--line-soft);
  margin: 20px 0 16px;
  overflow: hidden;
  position: relative;
}

.neural-stage::before,
.neural-stage::after {
  color: #6f604c;
  content: "+";
  font-family: var(--mono);
  font-size: 12px;
  position: absolute;
  z-index: 2;
}

.neural-stage::before {
  left: -5px;
  top: -8px;
}

.neural-stage::after {
  bottom: -8px;
  right: -5px;
}

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

.network-arches path {
  fill: none;
  opacity: 0.33;
  stroke: #76582e;
  stroke-width: 1;
}

.network-edges path {
  fill: none;
  opacity: 0.26;
  stroke: var(--dim);
  stroke-dasharray: 4 5;
  stroke-width: 1.2;
  transition: opacity 180ms ease, stroke 180ms ease;
}

.network-edges path.is-on {
  opacity: 0.85;
  stroke: var(--gold);
}

.network-edges .edge-judge,
.network-edges .edge-memory {
  opacity: 0.7;
  stroke: #806b4c;
}

.network-nodes circle,
.network-nodes rect,
.network-nodes path {
  fill: var(--ink);
  stroke: var(--dim);
  stroke-width: 1;
  transition: fill 180ms ease, filter 180ms ease, stroke 180ms ease;
}

.network-nodes [data-node].is-on {
  fill: #c89a4e2e;
  stroke: var(--gold-bright);
}

.candidate-node {
  fill: #c89a4e1c !important;
  stroke: var(--gold) !important;
}

.judge-node {
  stroke: var(--ivory-soft) !important;
}

.neural-stage.is-testing .candidate-node,
.neural-stage.is-testing .judge-node {
  animation: graphPulse 700ms ease infinite alternate;
}

.neural-stage.is-refuted .judge-node {
  fill: var(--red-faint);
  filter: drop-shadow(0 0 7px #e6574080);
  stroke: var(--red) !important;
}

.neural-stage.is-retained .memory-node {
  fill: var(--gold-faint);
  filter: drop-shadow(0 0 7px #c89a4e80);
  stroke: var(--gold) !important;
}

.network-labels text {
  fill: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  text-anchor: middle;
}

.network-labels text:nth-child(-n+7) {
  fill: var(--ivory-soft);
  font-family: var(--serif);
  font-size: 13px;
}

.formula-card {
  background: linear-gradient(90deg, #18140f, #12100d);
  border-left: 2px solid var(--gold);
  display: grid;
  gap: 5px;
  padding: 15px 17px;
}

.formula-card > span,
.formula-card > small {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.formula-card strong {
  color: var(--ivory);
  font-family: var(--serif);
  font-size: clamp(21px, 2vw, 29px);
  font-weight: 500;
  letter-spacing: -0.015em;
}

.law-editor {
  border: 0;
  margin: 18px 0 0;
  padding: 0;
}

.law-editor legend {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.09em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.clause-row {
  align-items: center;
  border-top: 1px solid var(--line-soft);
  display: grid;
  gap: 10px;
  grid-template-columns: 86px 18px 1fr 20px;
  min-height: 46px;
  transition: opacity 180ms ease;
}

.clause-row:last-child {
  border-bottom: 1px solid var(--line-soft);
}

.clause-row.is-disabled {
  opacity: 0.38;
}

.clause-switch {
  align-items: center;
  color: var(--ivory-soft);
  display: flex;
  font-family: var(--mono);
  font-size: 8px;
  gap: 8px;
  text-transform: uppercase;
}

.clause-switch input {
  appearance: none;
  border: 1px solid var(--dim);
  height: 11px;
  margin: 0;
  position: relative;
  width: 11px;
}

.clause-switch input:checked {
  background: var(--gold);
  border-color: var(--gold);
}

.clause-switch input:checked::after {
  color: var(--ink);
  content: "×";
  font-size: 9px;
  left: 1px;
  line-height: 9px;
  position: absolute;
  top: 0;
}

.operator,
.clause-row output {
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 17px;
  text-align: center;
}

.clause-row output {
  color: var(--ivory-soft);
  font-family: var(--mono);
  font-size: 9px;
}

input[type="range"] {
  accent-color: var(--gold);
  background: transparent;
  height: 18px;
  margin: 0;
  min-width: 0;
  width: 100%;
}

input[type="range"]::-webkit-slider-runnable-track {
  background: var(--line);
  height: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  background: var(--gold);
  border: 0;
  border-radius: 50%;
  height: 10px;
  margin-top: -4px;
  width: 10px;
}

input[type="range"]::-moz-range-track {
  background: var(--line);
  height: 2px;
}

input[type="range"]::-moz-range-thumb {
  background: var(--gold);
  border: 0;
  height: 10px;
  width: 10px;
}

.judge-seal {
  border: 1px solid var(--line);
  padding: 5px 7px;
}

.judge-seal.is-pass {
  border-color: var(--green);
  color: var(--green);
}

.judge-seal.is-fail {
  border-color: var(--red);
  color: var(--red);
}

.verdict-card {
  border: 1px solid var(--line-soft);
  margin-top: 20px;
  min-height: 165px;
  padding: 18px;
  position: relative;
}

.verdict-card::before {
  background: var(--dim);
  content: "";
  height: 1px;
  left: -1px;
  position: absolute;
  top: -1px;
  width: 48px;
}

.verdict-card.is-pass {
  background: #8eae860d;
  border-color: #4b5942;
}

.verdict-card.is-pass::before {
  background: var(--green);
}

.verdict-card.is-fail {
  background: var(--red-faint);
  border-color: #713d32;
}

.verdict-card.is-fail::before {
  background: var(--red);
}

.verdict-card > span {
  color: var(--dim);
  display: block;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  margin-bottom: 13px;
  text-transform: uppercase;
}

.verdict-card.is-pass > span {
  color: var(--green);
}

.verdict-card.is-fail > span {
  color: var(--red);
}

.verdict-card strong {
  color: var(--ivory);
  display: block;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.verdict-card p {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.45;
  margin: 12px 0 0;
}

.score-grid {
  border-bottom: 1px solid var(--line-soft);
  border-left: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 12px 0 0;
}

.score-grid > div {
  border-right: 1px solid var(--line-soft);
  border-top: 1px solid var(--line-soft);
  padding: 9px 8px;
}

.score-grid dt {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-grid dd {
  color: var(--ivory-soft);
  font-family: var(--mono);
  font-size: 10px;
  margin: 4px 0 0;
}

.counterexample-card {
  border: 1px solid #713d32;
  margin-top: 12px;
  min-height: 157px;
  padding: 14px;
}

.counterexample-card.is-empty {
  border-color: var(--line-soft);
  opacity: 0.58;
}

.counterexample-card > span {
  color: var(--red);
  display: block;
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: 0.09em;
  margin-bottom: 8px;
}

.counterexample-card strong {
  color: var(--ivory-soft);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
}

.counterexample-card p {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.4;
  margin: 7px 0 11px;
}

.witness-values {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, 1fr);
}

.witness-values span {
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 6px;
  padding-top: 6px;
  text-transform: uppercase;
}

.witness-values b {
  color: var(--ivory-soft);
  float: right;
  font-size: 8px;
}

.retain-button {
  background: var(--gold);
  border: 1px solid var(--gold);
  color: var(--ink-deep);
  min-height: 44px;
}

.retain-button:hover:not(:disabled) {
  background: var(--gold-bright);
}

.retain-button:disabled {
  background: transparent;
  border-color: var(--line);
  color: var(--dim);
  opacity: 0.55;
}

.judgment-actions .quiet-button {
  justify-content: center;
}

.judgment-actions .text-button {
  justify-self: center;
  margin-top: 2px;
}

.twice-result {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.04em;
  margin: 9px 0 0;
  min-height: 11px;
  text-align: center;
  text-transform: uppercase;
}

.section-receipt {
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.06em;
  padding: 12px 0;
  text-transform: uppercase;
}

.section-receipt::before {
  color: var(--gold);
  content: "receipt / ";
}

.memory-section {
  padding-top: 88px;
}

.memory-grid {
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.memory-vault,
.trace-vault {
  background: linear-gradient(180deg, #12100d, #0f0d0a);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-height: 320px;
  padding: 24px;
}

.subhead {
  border-bottom: 1px solid var(--line-soft);
  display: block;
  padding-bottom: 16px;
}

.memory-list {
  margin-top: 16px;
}

.empty-memory {
  align-items: center;
  border: 1px dashed var(--line);
  color: var(--dim);
  display: flex;
  font-family: var(--serif);
  font-size: 16px;
  justify-content: center;
  margin: 0;
  min-height: 170px;
  padding: 25px;
  text-align: center;
}

.memory-card {
  background: #17130e;
  border: 1px solid #6d522b;
  padding: 19px;
  position: relative;
}

.memory-card + .memory-card {
  margin-top: 9px;
}

.memory-card::before {
  background: var(--gold);
  content: "";
  height: 2px;
  left: -1px;
  position: absolute;
  top: -1px;
  width: 62px;
}

.memory-card.is-refuted {
  background: var(--red-faint);
  border-color: #713d32;
}

.memory-card.is-refuted::before {
  background: var(--red);
}

.memory-card-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.memory-card-head span,
.memory-card-seal,
.memory-card-meta {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.memory-status {
  border: 1px solid var(--green);
  color: var(--green) !important;
  padding: 4px 6px;
}

.is-refuted .memory-status {
  border-color: var(--red);
  color: var(--red) !important;
}

.memory-card h4 {
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 18px 0 13px;
}

.memory-card-meta {
  border-bottom: 1px solid var(--line-soft);
  border-top: 1px solid var(--line-soft);
  display: flex;
  gap: 20px;
  padding: 8px 0;
}

.memory-card-seal {
  color: var(--gold-bright);
  margin: 11px 0 0;
}

.trace-list {
  list-style: none;
  margin: 16px 0 0;
  max-height: 235px;
  overflow: auto;
  padding: 0;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

.trace-row {
  align-items: start;
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  gap: 13px;
  grid-template-columns: 35px minmax(110px, 0.52fr) 1fr auto;
  padding: 9px 3px;
}

.trace-row:first-child {
  border-top: 1px solid var(--line-soft);
}

.trace-id,
.trace-kind,
.trace-seal {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.04em;
}

.trace-id,
.trace-seal {
  color: var(--dim);
}

.trace-kind {
  color: var(--ivory-soft);
}

.trace-row p {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
}

.trace-row.is-refutation .trace-kind,
.trace-row.is-refutation .trace-seal {
  color: var(--red);
}

.trace-row.is-retention .trace-kind,
.trace-row.is-retention .trace-seal {
  color: var(--gold-bright);
}

.boundary-band {
  align-items: center;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 40px;
  grid-template-columns: auto 1fr auto;
  margin: 95px auto 0;
  padding: 25px 0;
  width: var(--page);
}

.boundary-band > span,
.boundary-band > a {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.boundary-band p {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 14px;
  margin: 0;
  text-align: center;
}

.boundary-band strong {
  color: var(--red);
  font-family: var(--mono);
  font-size: 8px;
}

.boundary-band a {
  border-bottom: 1px solid var(--gold);
  padding-bottom: 3px;
}

.footer {
  color: var(--dim);
  display: flex;
  font-family: var(--serif);
  font-size: 12px;
  gap: 30px;
  justify-content: space-between;
  margin: 0 auto;
  padding: 24px 0 40px;
  width: var(--page);
}

.guide-backdrop {
  background: #090806b8;
  inset: 0;
  position: fixed;
  z-index: 80;
}

.guide-drawer {
  background:
    linear-gradient(90deg, transparent, #c89a4e0a),
    var(--panel);
  border-left: 1px solid #76582e;
  bottom: 0;
  box-shadow: -28px 0 75px #0008;
  max-width: 480px;
  overflow-y: auto;
  padding: 30px;
  position: fixed;
  right: 0;
  top: 0;
  width: min(92vw, 480px);
  z-index: 90;
}

.guide-head {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding-bottom: 22px;
}

.guide-head span {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.1em;
}

.guide-head h2 {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
  margin: 9px 0 0;
}

.guide-head button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1;
}

.guide-steps {
  list-style: none;
  margin: 25px 0;
  padding: 0;
}

.guide-steps li {
  display: grid;
  gap: 15px;
  grid-template-columns: 24px 1fr;
  padding: 13px 0;
}

.guide-steps li + li {
  border-top: 1px solid var(--line-soft);
}

.guide-steps li > span {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 8px;
}

.guide-steps strong {
  color: var(--ivory-soft);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
}

.guide-steps p,
.guide-note p {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.45;
  margin: 4px 0 0;
}

.guide-note {
  border-left: 1px solid var(--gold);
  margin: 14px 0;
  padding: 3px 0 3px 15px;
}

.guide-note strong {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.guide-drawer > .gold-button {
  margin-top: 27px;
}

body.has-dialog {
  overflow: hidden;
}

@keyframes breathe {
  50% { opacity: 0.35; }
}

@keyframes witnessFlash {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-3px); }
  60% { transform: translateX(3px); }
}

@keyframes caseReveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes graphPulse {
  to { filter: drop-shadow(0 0 8px #c89a4e99); }
}

@media (max-width: 1260px) {
  :root {
    --page: min(1180px, calc(100vw - 40px));
  }

  .masthead {
    grid-template-columns: 34px minmax(400px, 1.15fr) minmax(260px, 0.7fr);
  }

  .masthead-vault {
    display: none;
  }

  .workbench {
    grid-template-columns: minmax(300px, 0.85fr) minmax(410px, 1.15fr);
  }

  .judgment-panel {
    grid-column: 1 / -1;
  }

  .judgment-panel {
    display: grid;
    gap: 12px 20px;
    grid-template-columns: minmax(290px, 1fr) repeat(2, minmax(260px, 0.8fr));
  }

  .judgment-panel .panel-heading {
    grid-column: 1 / -1;
  }

  .judgment-panel .verdict-card {
    grid-row: 2 / 4;
    margin-top: 0;
  }

  .judgment-panel .score-grid {
    grid-column: 2 / 4;
    margin-top: 0;
  }

  .judgment-panel .counterexample-card,
  .judgment-panel .judgment-actions {
    margin-top: 0;
  }

  .judgment-panel .twice-result {
    grid-column: 3;
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .topbar-center {
    display: none;
  }

  .masthead {
    gap: 24px;
    grid-template-columns: 30px 1fr;
    min-height: 430px;
  }

  .masthead-aside {
    grid-column: 2;
    padding: 0;
  }

  .masthead-aside > p {
    max-width: 52ch;
  }

  .chamber-head,
  .memory-head {
    align-items: start;
  }

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

  .judgment-panel {
    display: block;
    grid-column: auto;
  }

  .judgment-panel .verdict-card,
  .judgment-panel .score-grid,
  .judgment-panel .counterexample-card,
  .judgment-panel .judgment-actions {
    margin-top: 12px;
  }

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

  .boundary-band {
    gap: 18px;
    grid-template-columns: 1fr auto;
  }

  .boundary-band p {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: left;
  }
}

@media (max-width: 620px) {
  :root {
    --page: calc(100vw - 24px);
  }

  .topbar {
    min-height: 60px;
    padding: 0 12px;
  }

  .wordmark > span:last-child,
  .topbar-actions a {
    display: none;
  }

  .topbar-actions {
    gap: 0;
  }

  .masthead {
    display: block;
    min-height: 0;
    padding: 62px 0 46px;
  }

  .volume-mark {
    display: none;
  }

  .masthead h1 {
    font-size: clamp(54px, 17vw, 76px);
  }

  .masthead h1 em {
    display: block;
  }

  .masthead-aside {
    margin-top: 32px;
  }

  .masthead-aside > p {
    font-size: 16px;
  }

  .chamber,
  .memory-section {
    padding-top: 48px;
  }

  .chamber-head,
  .memory-head {
    display: block;
  }

  .chamber-head-actions {
    align-items: start;
    margin-top: 20px;
  }

  .memory-head > p {
    margin-top: 16px;
    text-align: left;
  }

  .loop-rail {
    grid-template-columns: repeat(4, minmax(72px, 1fr));
    overflow-x: auto;
  }

  .loop-rail li {
    display: block;
    min-height: 60px;
    padding: 10px;
  }

  .loop-rail li > span {
    display: block;
    margin-bottom: 4px;
  }

  .loop-rail li small {
    display: none;
  }

  .bench-panel,
  .memory-vault,
  .trace-vault {
    padding: 18px;
  }

  .case-grid {
    grid-template-columns: 1fr 1fr;
    max-height: 440px;
  }

  .case-card,
  .case-hidden {
    min-height: 95px;
  }

  .neural-stage {
    margin-top: 18px;
  }

  .proposal-mode {
    display: none;
  }

  .clause-row {
    grid-template-columns: 78px 16px 1fr 18px;
  }

  .world-actions,
  .candidate-actions {
    grid-template-columns: 1fr;
  }

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

  .trace-row {
    gap: 7px;
    grid-template-columns: 30px 1fr auto;
  }

  .trace-row p {
    grid-column: 2 / 4;
  }

  .boundary-band {
    align-items: start;
    margin-top: 60px;
  }

  .footer {
    flex-wrap: wrap;
    gap: 9px 18px;
  }

  .footer span:nth-child(2) {
    order: 3;
    width: 100%;
  }

  .guide-drawer {
    padding: 23px;
  }
}

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

  .case-card,
  .case-hidden {
    min-height: 97px;
  }

  .masthead-stats dd {
    font-size: 9px;
  }
}

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