:root {
  --paper: #f4f1e8; --card: #fbf9f3; --ink: #1d2420; --ink-2: #4c5650;
  --ink-3: #87908a; --rule: rgba(29,36,32,.18); --rule-soft: rgba(29,36,32,.09);
  --accent: #2f5d46;
  --accent-2: #b0662a;
  --serif: "Fraunces", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--appnav-h, 0px) + 16px); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15.5px/1.55 var(--sans); }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.12; margin: 0; }
h1 em, h2 em { font-style: italic; color: var(--accent); }
.kicker { font: 500 11px/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px; }

.layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); align-items: start; }
.side {
  position: sticky; top: var(--appnav-h, 0px);
  height: calc(100vh - var(--appnav-h, 0px)); height: calc(100dvh - var(--appnav-h, 0px));
  overflow-y: auto; border-right: 1px solid var(--rule); background: var(--card);
}
.side-inner { padding: 24px 22px 28px; }
.side h1 { font-size: 34px; margin-bottom: 12px; }
.lede { margin: 0 0 18px; color: var(--ink-2); }
.lede cite { font-style: italic; }

.seg { display: flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; margin-bottom: 16px; }
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--ink-2); padding: 8px 6px;
  font: 500 13.5px/1.2 var(--sans); cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.seg button:focus-visible, input:focus-visible, select:focus-visible, .chart:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.seg.small { margin: 0; flex: 1; max-width: 180px; }
.seg.small button { padding: 6px 4px; font-size: 13px; }

.controls { display: grid; gap: 10px; margin-bottom: 16px; }
.need-only { display: grid; gap: 10px; }
.need-only[hidden], .row[hidden] { display: none; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lbl { font-size: 14px; color: var(--ink-2); }
.lbl small { font: 11px var(--mono); color: var(--ink-3); }
.row input, .row select {
  font: 500 14px var(--mono); color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 6px; padding: 6px 8px; width: 180px; max-width: 60%;
}
.row input { width: 90px; text-align: right; }

.readout { background: var(--paper); border: 1px solid var(--rule-soft); border-left: 3px solid var(--ink); border-radius: 6px; padding: 12px 14px; font-size: 14.5px; }
.readout p { margin: 0 0 8px; }
.readout p:last-child { margin-bottom: 0; }
.readout b { font-family: var(--mono); font-weight: 500; }
.readout ul { margin: 4px 0 0; padding: 0; list-style: none; }
.readout li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-top: 1px solid var(--rule-soft); font-size: 13.5px; }
.readout li span:last-child { font-family: var(--mono); white-space: nowrap; }
.readout li.gone span:last-child { color: var(--accent-2); }
.fine { font-size: 13px; color: var(--ink-3); margin: 16px 0 0; }

.main { min-width: 0; }
.chart-wrap {
  margin: 0; position: relative; display: flex; flex-direction: column;
  height: calc(100vh - var(--appnav-h, 0px)); height: calc(100dvh - var(--appnav-h, 0px));
  min-height: 460px; padding: 12px 12px 8px;
}
.chart { flex: 1; min-height: 0; position: relative; border-radius: 4px; }
.chart svg { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font: 12px var(--mono); color: var(--ink-2); padding: 6px 8px 0; }
.legend i { display: inline-block; width: 18px; height: 10px; vertical-align: -1px; margin-right: 6px; border-radius: 2px; }

svg text { font-family: var(--mono); }
.axis text { font-size: 11px; fill: var(--ink-3); }
.axis line, .grid line { stroke: var(--rule-soft); }
.axis .title { font-size: 11px; fill: var(--ink-2); }
.band { stroke: none; }
.pline { fill: none; stroke: var(--accent); stroke-width: 1; opacity: .55; }
.pline.median { stroke-width: 2; opacity: 1; }
.pline.ext { stroke-dasharray: 2 3; opacity: .4; }
.pdot { fill: var(--accent); }
.plabel { font-size: 10.5px; fill: var(--accent); }
.act line { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 1.5 3.5; }
.act text { font-family: var(--sans); font-size: 12px; fill: var(--ink-2); paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.act text .v { font-family: var(--mono); font-size: 10.5px; fill: var(--ink-3); }
.act.hot line { stroke: var(--accent-2); stroke-width: 1.6; stroke-dasharray: 3 3; }
.act.hot text { fill: var(--accent-2); font-weight: 600; }
.act.gone text { fill: var(--accent-2); }
.you { fill: none; stroke: var(--accent-2); stroke-width: 2.6; }
.you.ghost { stroke-dasharray: 5 4; stroke-width: 2; }
.youdot { fill: var(--accent-2); stroke: var(--paper); stroke-width: 2; }
.cross { fill: var(--paper); stroke: var(--accent-2); stroke-width: 2; }
.youlabel { font-size: 11.5px; fill: var(--accent-2); font-weight: 500; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; }
.vline { stroke: var(--accent-2); stroke-width: 1; stroke-dasharray: 2 3; }
.hover line { stroke: var(--ink-3); stroke-width: 1; }

.tip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--card); border: 1px solid var(--rule);
  border-radius: 6px; padding: 8px 10px; font: 12px/1.45 var(--mono); color: var(--ink); box-shadow: 0 4px 14px rgba(29,36,32,.12);
  min-width: 170px;
}
.tip h4 { margin: 0 0 4px; font: 600 12px var(--mono); }
.tip table { border-collapse: collapse; }
.tip td { padding: 0 0 0 10px; text-align: right; }
.tip td:first-child { padding: 0; text-align: left; color: var(--ink-3); }
.tip .you-row td { color: var(--accent-2); }
.tip p { margin: 4px 0 0; color: var(--ink-3); font-size: 11px; }

.panel { max-width: 760px; padding: 36px 28px 8px; margin: 0 auto; }
.panel h2 { font-size: 28px; margin-bottom: 12px; }
.panel h3 { font-size: 19px; margin: 24px 0 8px; }
.panel p { margin: 0 0 12px; }
.note { font-size: 13.5px; color: var(--ink-2); }
.hr-chart svg { display: block; width: 100%; height: auto; }
.hr-chart text { font-size: 12px; fill: var(--ink-2); }
.hr-chart .lab { font-family: var(--sans); font-size: 13.5px; fill: var(--ink); }
.hr-chart .num { font-family: var(--mono); font-size: 12px; fill: var(--ink); }
.hr-chart .bar { fill: var(--accent); }
.hr-chart .bar.risk { fill: var(--ink-3); }
.hr-chart .bar.mine { fill: var(--accent-2); }
.hr-chart .ci { stroke: var(--ink); stroke-width: 1.2; }
.hr-chart .ref { stroke: var(--ink-2); stroke-dasharray: 3 3; }
.hr-chart .head { font: 500 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; fill: var(--ink-3); }

.sources { padding-bottom: 60px; }
.cites { padding-left: 18px; }
.cites li { margin-bottom: 12px; }
table.acts { width: 100%; border-collapse: collapse; margin: 10px 0 4px; font-size: 13.5px; }
table.acts th { text-align: left; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); border-bottom: 1px solid var(--rule); padding: 4px 6px; }
table.acts td { border-bottom: 1px solid var(--rule-soft); padding: 4px 6px; vertical-align: top; }
table.acts td:nth-child(1), table.acts td:nth-child(3), table.acts td:nth-child(4) { font-family: var(--mono); white-space: nowrap; }
table.acts td:nth-child(3), table.acts td:nth-child(4), table.acts th:nth-child(3), table.acts th:nth-child(4) { text-align: right; }
.advice { border-left: 3px solid var(--accent); padding-left: 12px; }
.changelog { list-style: none; padding: 0; }
.changelog time { font: 12px var(--mono); color: var(--ink-3); margin-right: 10px; }

@media (max-width: 860px) {
  .layout { display: block; }
  .side { position: static; height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--rule); }
  .side-inner { padding: 20px 16px; }
  .chart-wrap { height: 78vh; min-height: 440px; padding: 8px 4px 6px; }
  .panel { padding: 28px 16px 8px; }
  table.acts { font-size: 12.5px; }
  table.acts td:nth-child(1), table.acts th:nth-child(1) { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .you, .youdot, .cross { transition: opacity .2s; }
}
