:root {
  color-scheme:dark;
  --bg:#0c1217;
  --panel:#141d25;
  --rule:#33414d;
  --text:#d1dbe3;
  --muted:#a0afba;
  --cyan:#54bcff;
  --gold:#e8ce6a;
  --green:#4ed69d;
  --mono:"Courier New",monospace
}
* {
  box-sizing:border-box
}
body {
  margin:0;
  background:var(--bg);
  color:var(--text);
  font:17px/1.5 Arial,Helvetica,sans-serif
}
main {
  max-width:960px;
  margin:auto;
  padding:24px 28px 42px
}
header a {
  font-size:18px;
  text-decoration:none
}
a {
  color:inherit;
  text-underline-offset:4px
}
a:hover {
  text-decoration:underline
}
.intro {
  padding:40px 0 28px;
  max-width:650px
}
h1 {
  font-size:clamp(40px,6.8vw,68px);
  line-height:1.02;
  letter-spacing:-.045em;
  margin:0 0 20px
}
.intro p {
  margin:0;
  max-width:540px;
  font-size:19px
}
h2 {
  font-size:28px;
  line-height:1.15;
  letter-spacing:-.025em;
  margin:0 0 10px
}
button,input {
  font:inherit
}
button {
  min-height:44px;
  border:1px solid var(--rule);
  color:var(--text);
  background:transparent;
  padding:9px 12px;
  cursor:pointer;
  touch-action:manipulation
}
button:hover {
  background:#1d2b36
}
button:focus-visible,input:focus-visible,a:focus-visible,summary:focus-visible {
  outline:3px solid var(--gold);
  outline-offset:3px
}
button[aria-pressed=true] {
  border-color:var(--cyan);
  color:var(--cyan);
  background:#142635
}
input[type=range] {
  width:100%;
  height:44px;
  margin:0;
  accent-color:var(--cyan);
  cursor:pointer
}
.workbench {
  border-top:3px solid var(--cyan);
  scroll-margin-top:12px
}
.steps {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  border-bottom:1px solid var(--rule)
}
.steps button {
  border:0;
  border-right:1px solid var(--rule);
  font-size:15px;
  text-align:left;
  padding:14px 12px
}
.steps button:last-child {
  border:0
}
.steps button[aria-current=step] {
  box-shadow:inset 0 -3px var(--cyan);
  color:var(--cyan);
  background:var(--panel)
}
.stage-heading {
  padding:22px 0 24px
}
.scope {
  color:var(--muted);
  font-size:14px;
  margin:0 0 10px
}
.stage-heading>p:last-child {
  margin:0;
  max-width:690px
}
.instrument {
  display:grid;
  grid-template-columns:300px minmax(0,1fr);
  gap:32px;
  align-items:start
}
.presets {
  display:flex;
  gap:8px
}
.world-controls .presets {
  margin-bottom:16px
}
.world-controls .presets button {
  flex:1;
  font-size:15px;
  line-height:1.25;
  text-align:left
}
label {
  display:flex;
  justify-content:space-between;
  gap:10px;
  font-size:15px
}
output {
  color:var(--cyan);
  font-family:var(--mono)
}
fieldset {
  padding:0;
  margin:0;
  border:0
}
legend {
  font-size:15px;
  padding:0;
  margin-bottom:8px
}
.widths button {
  flex:1;
  font-family:var(--mono);
  font-size:16px;
  padding:9px 6px
}
.totals {
  display:grid;
  grid-template-columns:1fr 16px 1fr;
  gap:8px;
  align-items:center;
  border-top:1px solid var(--rule);
  padding:16px 0 0;
  margin-top:16px
}
.totals>div>span {
  display:block;
  font-size:14px;
  line-height:1.3;
  min-height:36px
}
.totals strong {
  display:block;
  font:700 36px/1.25 var(--mono);
  letter-spacing:-.06em;
  color:var(--green)
}
.totals strong.price {
  color:var(--gold)
}
#relation {
  font:24px var(--mono);
  color:var(--muted);
  padding-top:26px
}
.ledger-head,.outcome {
  display:grid;
  grid-template-columns:54px minmax(0,1fr) 72px;
  gap:12px;
  align-items:center
}
.ledger-head {
  font-size:13px;
  color:var(--muted);
  padding:0 0 9px;
  border-bottom:2px solid var(--rule)
}
.ledger-head>span:last-child {
  text-align:right
}
.outcome {
  min-height:61px;
  border-bottom:1px solid var(--rule)
}
.terminal,.contribution {
  font:17px var(--mono)
}
.contribution {
  text-align:right;
  color:var(--green);
  font-weight:bold
}
.contribution.price {
  color:var(--gold)
}
.weight-math {
  font:16px/1.4 var(--mono);
  display:block;
  margin-bottom:5px
}
.bar-space {
  display:block;
  height:10px
}
.bar-base {
  display:block;
  height:10px;
  position:relative;
  overflow:hidden;
  border:1px solid #4ed69d88;
  background:repeating-linear-gradient(135deg,transparent 0,transparent 3px,#4ed69d66 3px,#4ed69d66 4px)
}
.bar-fill {
  display:block;
  height:100%;
  background:var(--green);
  transition:width .14s ease
}
.zero .weight-math,.zero .terminal,.zero .contribution {
  color:var(--muted)
}
.featured {
  background:#1a2529
}
.featured .terminal {
  color:var(--text);
  font-weight:bold
}
.ledger-key {
  font-size:13px;
  color:var(--muted);
  padding-top:9px
}
.ledger-key .sample {
  display:inline-block;
  width:12px;
  height:10px;
  background:var(--green);
  margin-right:5px
}
.ledger-key .missed {
  background:repeating-linear-gradient(135deg,transparent 0,transparent 3px,#4ed69d88 3px,#4ed69d88 4px);
  border:1px solid #4ed69d88;
  margin-left:12px
}
.result {
  border-left:3px solid var(--green);
  padding:2px 0 2px 14px;
  margin:22px 0;
  font-size:18px;
  max-width:780px
}
.optional {
  border-top:1px solid var(--rule);
  border-bottom:1px solid var(--rule);
  margin-top:18px
}
summary {
  min-height:44px;
  padding:10px 0;
  cursor:pointer;
  color:var(--muted);
  font-size:15px
}
.detail-body {
  padding:0 0 16px;
  max-width:760px
}
.receipt {
  font:16px/1.65 var(--mono);
  color:var(--gold);
  margin:8px 0 20px
}
.probe-math {
  font:15px/1.5 var(--mono);
  margin:10px 0
}
#payoffChart {
  display:block;
  width:100%;
  height:155px
}
.next {
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-top:20px
}
.primary {
  background:var(--cyan);
  border-color:var(--cyan);
  color:var(--bg);
  font-weight:bold;
  margin-left:auto
}
.primary:hover {
  background:#89d0ff
}
.quiet {
  color:var(--muted)
}
.landing {
  border-top:3px solid var(--rule);
  margin-top:36px;
  padding-top:24px;
  max-width:760px
}
.landing p {
  margin:16px 0
}
footer {
  border-top:1px solid var(--rule);
  margin-top:32px
}
footer p {
  font-size:15px;
  color:var(--muted)
}
[hidden] {
  display:none!important
}
@media(max-width:700px) {
  main {
    padding:18px 16px 28px
  }
  .intro {
    padding:28px 0 24px
  }
  .intro p {
    font-size:18px
  }
  .steps button {
    font-size:14px;
    padding:12px 8px
  }
  .stage-heading {
    padding:16px 0 18px
  }
  .scope {
    margin-bottom:8px
  }
  h2 {
    font-size:25px
  }
  .stage-heading>p:last-child {
    font-size:16px;
    line-height:1.45
  }
  .instrument {
    display:block
  }
  .world-controls .presets {
    margin-bottom:12px
  }
  .world-controls .presets button {
    text-align:center
  }
  .totals {
    margin-top:8px;
    padding-top:12px;
    padding-bottom:18px
  }
  .totals>div>span {
    min-height:0;
    font-size:14px
  }
  .totals strong {
    font-size:38px
  }
  #relation {
    padding-top:15px
  }
  .ledger-head,.outcome {
    grid-template-columns:48px minmax(0,1fr) 67px;
    gap:10px
  }
  .outcome {
    min-height:52px
  }
  .weight-math {
    font-size:16px;
    margin-bottom:4px
  }
  .ledger-head {
    font-size:13px
  }
  .terminal,.contribution {
    font-size:16px
  }
  .result {
    font-size:17px;
    line-height:1.45;
    margin:18px 0
  }
  .next {
    margin-top:18px
  }
  .next button {
    font-size:15px
  }
  .ledger-key {
    font-size:13px
  }
  body[data-phase="2"] .stage-heading {
    padding-bottom:16px
  }
  body[data-phase="2"] .totals {
    margin-top:12px;
    padding-bottom:14px
  }
  body[data-phase="2"] .result {
    margin-top:8px
  }
  body[data-phase="2"] .next {
    margin-top:14px
  }
}
@media(prefers-reduced-motion:reduce) {
  * {
    scroll-behavior:auto!important;
    transition:none!important
  }
}
