:root {
  color-scheme: dark;
  --bg: #101311;
  --raise: #181d1a;
  --inset: #0c0f0d;
  --line: #2c3833;
  --text: #e8eee9;
  --muted: #9aaba3;
  --faint: #738078;
  --save: #c6f54e;
  --save-ink: #142006;
  --cost: #ff8d72;
  --warn: #ffd27a;
  --focus: #c6f54e;
  --serif: Georgia, "Liberation Serif", "Nimbus Roman", serif;
  --sans: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Liberation Mono", monospace;
  --pad: clamp(16px, 3vw, 28px);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0 auto;
  max-width: 1120px;
  padding: 14px var(--pad) 40px;
  color: var(--text);
  background:
    radial-gradient(900px 280px at 0% -10%, rgba(198, 245, 78, 0.08), transparent 60%),
    var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--save);
  color: var(--save-ink);
  padding: 8px 12px;
  z-index: 2;
}

.skip:focus { top: 12px; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 28px 32px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.kicker {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--save);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.85rem, 4vw, 2.45rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.lede {
  margin: 8px 0 0;
  max-width: 38rem;
  color: var(--muted);
}

.setup {
  display: grid;
  grid-template-columns: repeat(3, minmax(8.5rem, 1fr));
  gap: 10px 12px;
  margin: 0;
  min-width: min(100%, 28rem);
  flex: 1 1 28rem;
}

.rates {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.rates span { white-space: nowrap; }

.rates span + span::before {
  content: "·";
  margin: 0 8px;
  color: var(--faint);
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

input, select, textarea {
  width: 100%;
  color: var(--text);
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
}

textarea {
  resize: vertical;
  min-height: 5.5rem;
  font-family: var(--mono);
  font-size: 0.82rem;
}

input[type="number"] { font-variant-numeric: tabular-nums; }

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

.verdict {
  background: var(--raise);
  border: 1px solid var(--line);
  border-left: 4px solid var(--faint);
  border-radius: 14px;
  padding: 14px 16px 12px;
}

.verdict.is-save { border-left-color: var(--save); }
.verdict.is-cost { border-left-color: var(--cost); }
.verdict.is-even { border-left-color: var(--muted); }

.delta {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4.6vw, 2.8rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.is-save .delta { color: var(--save); }
.is-cost .delta { color: var(--cost); }

.detail, .split, .flag, .blurb, .empty, footer p {
  margin: 8px 0 0;
  color: var(--muted);
}

.split {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text);
}

.flag {
  color: var(--warn);
}

.arms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.arm {
  background: var(--inset);
  border-radius: 10px;
  padding: 10px 12px;
}

.arm[data-arm="baseline"] { box-shadow: inset 3px 0 0 #5c6b63; }
.arm[data-arm="treatment"] { box-shadow: inset 3px 0 0 var(--save); }

.arm b {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.arm span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.blurb { margin-top: 12px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0 36px;
}

.btn {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
}

.btn:hover { border-color: var(--muted); }

.btn.primary {
  background: var(--save);
  border-color: var(--save);
  color: var(--save-ink);
  font-weight: 600;
}

.btn.primary:hover { filter: brightness(1.05); }

.status {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--save);
  min-height: 1.2em;
}

.empty { margin: 0 0 8px; }

.ledger { margin-top: 4px; }

.cols > * { min-width: 0; }

.cols {
  display: grid;
  grid-template-columns:
    minmax(8rem, 1.35fr)
    8.2rem
    repeat(4, minmax(4.6rem, 0.75fr))
    4.6rem
    44px;
  gap: 8px 10px;
  align-items: end;
}

.head {
  padding: 0 2px 6px 8px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.run {
  padding: 6px 0 6px 8px;
  border-top: 1px solid var(--line);
}

.run[data-arm="baseline"] { box-shadow: inset 3px 0 0 #5c6b63; }
.run[data-arm="treatment"] { box-shadow: inset 3px 0 0 var(--save); }

.run label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
  color: var(--text);
}

.lbl {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.ok {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--text);
}

.ok input { width: 1.1rem; height: 1.1rem; accent-color: var(--save); }

@media (min-width: 860px) {
  .ok span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
}

.remove {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.remove:hover { color: var(--cost); background: #2a1612; }

.paste {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.paste summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--text);
}

.paste-label { margin-top: 10px; text-transform: none; letter-spacing: 0; font-size: 0.95rem; }

.paste-row {
  display: grid;
  grid-template-columns: 1fr 10rem auto;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
}

.error { color: var(--cost); margin: 8px 0 0; }

footer {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

footer code { color: var(--text); }

@media (max-width: 859px) {
  .head { display: none; }

  .lbl {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .run {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
  }

  .setup, .arms, .paste-row { grid-template-columns: 1fr; }

  .paste-row .btn { width: 100%; }
}


