:root {
  --bg: #eef2f3;
  --panel: #ffffff;
  --line: #ced8db;
  --text: #182126;
  --muted: #56666e;
  --accent: #0d7186;
  --accent-strong: #07566a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

.hero {
  padding: 8px 0 20px;
  border-bottom: 2px solid var(--accent);
}

.hero h1 {
  margin: 0;
}

.hero + .panel {
  margin-top: 22px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 2px 8px rgba(23, 42, 49, 0.06);
}

.panel {
  padding: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 600;
}

.grid {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.two-up {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.inline-field {
  margin-top: 14px;
}

.stream-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 14px;
  color: var(--muted);
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #b9c6ca;
  border-radius: 6px;
  background: #ffffff;
  padding: 12px 14px;
  color: var(--text);
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #f6fbff;
  padding: 12px 16px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(13, 113, 134, 0.25);
  outline-offset: 2px;
}

.button-row {
  display: flex;
  gap: 12px;
}

.button-row.wrap {
  flex-wrap: wrap;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: #f8fafb;
  color: var(--text);
}

.output {
  margin-top: 14px;
  padding: 14px;
  border-radius: 6px;
  background: #f8fbfd;
  border: 1px solid #c8dce2;
  color: #21313a;
  min-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.proof-panel {
  margin-top: 22px;
  border-radius: 8px;
}

.status-badge {
  min-width: 72px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.status-badge[data-state="pass"] {
  border-color: #2e7d55;
  color: #1f6845;
  background: #e8f5ee;
}

.status-badge[data-state="pending"] {
  border-color: #a86c16;
  color: #87540c;
  background: #fff5dc;
}

.status-badge[data-state="fail"] {
  border-color: #b43c45;
  color: #982f38;
  background: #fff0f1;
}

.proof-readout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-block: 1px solid var(--line);
}

.proof-readout > div {
  min-width: 0;
  padding: 16px 14px;
}

.proof-readout > div + div {
  border-left: 1px solid var(--line);
}

.proof-readout span,
.proof-readout strong {
  display: block;
}

.proof-readout span {
  color: var(--muted);
  font-size: 12px;
}

.proof-readout strong {
  margin-top: 6px;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#visible-global-tension {
  color: #9b2f38;
  font-size: 28px;
}

.pulse-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 64px auto;
  align-items: end;
  gap: 12px;
  margin-top: 18px;
}

.pulse-controls output {
  min-height: 43px;
  padding: 11px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf9;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
}

.causal-chain {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 18px;
  border-block: 1px solid var(--line);
}

.causal-chain > div {
  min-width: 0;
  padding: 12px 8px;
  text-align: center;
}

.causal-chain > div + div {
  border-left: 1px solid var(--line);
}

.causal-chain span,
.causal-chain strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.causal-chain span {
  color: var(--muted);
  font-size: 11px;
}

.causal-chain strong {
  margin-top: 5px;
  font-size: 12px;
}

.causal-chain [data-state="pass"] strong {
  color: #1f6845;
}

.causal-chain [data-state="pending"] strong {
  color: #87540c;
}

.causal-chain [data-state="fail"] strong {
  color: #982f38;
}

.proof-message {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--muted);
}

.proof-message[data-state="fail"] {
  color: #982f38;
}

.proof-message[data-state="pass"] {
  color: #1f6845;
}

.proof-output {
  max-height: 260px;
}

@media (max-width: 760px) {
  .proof-readout,
  .causal-chain {
    grid-template-columns: 1fr 1fr;
  }

  .proof-readout > div + div,
  .causal-chain > div + div {
    border-left: 0;
  }

  .proof-readout > div:nth-child(even),
  .causal-chain > div:nth-child(even) {
    border-left: 1px solid var(--line);
  }

  .pulse-controls {
    grid-template-columns: 1fr 64px;
  }

  .pulse-controls button {
    grid-column: 1 / -1;
  }

  .shell {
    width: min(100% - 24px, 1180px);
    padding: 24px 0 40px;
  }

  .panel {
    padding: 20px;
  }
}
