/* 本来也会好 — three quantities and one fan.
   Amber is what regression hands you for free, green is whatever is left after
   that, and nothing else on the page is saturated. The whole argument is the
   size of the amber number next to the green one. */
:root {
  --bg: #171412;
  --panel: #211d1a;
  --sunk: #1a1714;
  --line: #322c27;
  --ink: #ece7e2;
  --dim: #a89c93;
  --faint: #756a62;
  --reg: #c9a227;     /* what regression gives you anyway */
  --left: #5fae8a;    /* what's left over */
  --obs: #b9aca2;     /* what you observed */
  --hot: #d9694f;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
b { font-weight: 600; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--sunk);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--dim); }

.topbar { display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  border-bottom: 1px solid var(--line); background: #1d1917; }
.mark { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid;
  place-items: center; font-weight: 700; color: #1d1917;
  background: linear-gradient(140deg, #e6c65c, var(--reg)); }
.titles { min-width: 0; }
.titles h1 { margin: 0; font-size: 17px; letter-spacing: .06em; }
.titles p { margin: 0; font-size: 11px; color: var(--faint); }

main { padding: 14px 12px 24px; max-width: 820px; margin: 0 auto; }
textarea, button, input { font: inherit; font-family: inherit; }

.panel { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.panel h2 { margin: 0 0 6px; font-size: 15px; }
.panel.quiet { background: none; }
.panel.intro { background: none; border-style: dashed; }
.panel.bad { border-color: #4a2f28; background: #241713; }
.sub { color: var(--dim); font-size: 13.5px; margin: 0 0 8px; }
.sub:last-child { margin-bottom: 0; }
.tiny { color: var(--faint); font-size: 12px; line-height: 1.6; margin: 10px 0 0; }

/* ---- input ---- */
.egs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
@media (max-width: 400px) { .egs { grid-template-columns: 1fr; } }
.eg { text-align: left; padding: 10px 12px; background: var(--sunk); color: var(--ink);
  border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.eg b { display: block; font-size: 14px; }
.eg span { display: block; font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.eg.on { border-color: var(--reg); }

.lbl { display: block; font-size: 12.5px; color: var(--faint); margin-bottom: 6px;
  line-height: 1.7; }
textarea { width: 100%; padding: 12px; background: var(--sunk); color: var(--ink);
  border: 1px solid var(--line); border-radius: 11px; font-family: var(--mono);
  font-size: 13px; line-height: 1.7; resize: vertical; }
textarea:focus-visible { outline: 2px solid var(--reg); outline-offset: 1px; }

.prob { display: grid; grid-template-columns: 5em 1fr; gap: 4px 8px; padding: 8px 0;
  border-top: 1px solid var(--line); }
.prob .ln { font-size: 12px; color: var(--faint); font-family: var(--mono); }
.prob code { overflow-wrap: anywhere; }
.prob i { grid-column: 2; font-style: normal; font-size: 12px; color: var(--hot); }

/* ---- the headline sum ---- */
.verdict { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.verdict > b { display: block; font-size: 17px; }
.verdict.bad { border-color: #4a2f28; background: #241713; }
.verdict.bad > b { color: var(--hot); }
.verdict.warn { border-color: #4a3d1c; background: #221c11; }
.verdict.warn > b { color: var(--reg); }
.verdict.good { border-color: #2b4438; background: #14201b; }
.verdict.good > b { color: var(--left); }
.verdict .say { margin: 12px 0 0; font-size: 13.5px; color: var(--dim); }
.verdict .range { margin: 10px 0 0; font-size: 12.5px; color: var(--dim);
  font-variant-numeric: tabular-nums; }
.verdict .range b { font-family: var(--mono); }
.verdict .range em { font-style: normal; color: var(--faint); }

.three { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center; gap: 6px; margin-top: 12px; }
.three .op { color: var(--faint); font-family: var(--mono); font-size: 15px; }
.cell { background: var(--sunk); border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 6px; text-align: center; min-width: 0; }
.cell .k { display: block; font-size: 10.5px; color: var(--faint); line-height: 1.3; }
.cell .v { display: block; font-family: var(--mono); font-size: 21px; margin-top: 3px;
  font-variant-numeric: tabular-nums; }
.cell.obs .v { color: var(--obs); }
.cell.reg { border-color: #4a3d1c; }
.cell.reg .v { color: var(--reg); }
.cell.left { border-color: #2b4438; }
.cell.left .v { color: var(--left); }
@media (max-width: 430px) {
  .three { grid-template-columns: 1fr auto 1fr; }
  .three .cell.left { grid-column: 1 / -1; }
  .three .op:last-of-type { display: none; }
}

/* ---- the fan ---- */
.fan { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 12px; }
.col { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.track { position: relative; width: 100%; height: 150px; background: var(--sunk);
  border-radius: 7px; box-shadow: inset 0 0 0 1px var(--line); }
.stem { position: absolute; left: 50%; width: 2px; margin-left: -1px; }
.stem.up { background: linear-gradient(to top, transparent, var(--left)); }
.stem.down { background: linear-gradient(to bottom, transparent, var(--hot)); }
.dot { position: absolute; left: 50%; width: 10px; height: 10px; margin: -5px 0 -5px -5px;
  border-radius: 50%; }
.dot.from { background: var(--faint); }
.dot.to.up { background: var(--left); }
.dot.to.down { background: var(--hot); }
/* Hollow, because it is where the baseline says they would have landed — a
   prediction, not an observation, and the two should not look alike. */
.dot.pred { background: var(--sunk); border: 2px solid var(--reg); }
.col .lab { font-size: 10.5px; color: var(--faint); text-align: center;
  line-height: 1.25; }
.col .mv { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.col .mv.up { color: var(--left); }
.col .mv.down { color: var(--hot); }
.col.first .track { box-shadow: inset 0 0 0 1px var(--reg); }

.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; margin-top: 10px;
  font-size: 11.5px; color: var(--dim); }
.legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  margin-right: 5px; vertical-align: -1px; }
.sw.from { background: var(--faint); }
.sw.to { background: var(--left); }
.sw.pred { background: var(--sunk); border: 2px solid var(--reg); width: 9px; height: 9px; }
.sw.diagsw { border-radius: 2px; background: var(--faint); }
.sw.fitsw { border-radius: 2px; background: var(--reg); }
.sw.bandsw { background: var(--ink); }

/* ---- the scatter ---- */
.scatter { margin-top: 12px; }
.plot { position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 320px;
  margin: 0 auto; background: var(--sunk); border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
/* "Nothing changed" is the 45° line, drawn as a rotated bar so it needs no
   geometry at runtime. */
.diag { position: absolute; left: -20%; right: -20%; top: 50%; height: 1px;
  background: var(--faint); opacity: .5; transform: rotate(-45deg); }
.fit { position: absolute; inset: 0; width: 100%; height: 100%; }
.fit line { stroke: var(--reg); stroke-width: 2; }
.band-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 -6px -6px;
  border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px var(--sunk); }
.band-dot.b0 { background: var(--left); }
.band-dot.b4 { background: var(--hot); }

/* ---- the facts table ---- */
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
@media (max-width: 400px) { .facts { grid-template-columns: 1fr; } }
.fact { display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 8px 10px; background: var(--sunk); border: 1px solid var(--line);
  border-radius: 9px; font-size: 12.5px; color: var(--faint); }
.fact b { font-family: var(--mono); color: var(--ink); font-size: 13px;
  font-variant-numeric: tabular-nums; }

/* ---- the demonstration ---- */
.knob { padding: 10px 0 2px; }
.knob label { display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; font-size: 13px; color: var(--dim); }
.knob label b { font-family: var(--mono); color: var(--reg); font-size: 15px;
  font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; -webkit-appearance: none; appearance: none;
  background: transparent; height: 34px; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--hot), var(--line)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--hot), var(--line)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px;
  height: 26px; border-radius: 50%; background: var(--ink); border: none; margin-top: -10px; }
input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); border: none; }

.demo { display: grid; gap: 10px; margin-top: 6px; }
.drow { display: grid; grid-template-columns: 6.6em 1fr 3.4em; align-items: center; gap: 8px; }
.drow .k { font-size: 12px; color: var(--dim); }
.drow .t { position: relative; height: 24px; background: var(--sunk); border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--line); }
.drow .t > i { position: absolute; top: 50%; }
.drow .t > i.from { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%;
  background: var(--faint); z-index: 2; }
.drow .t > i.to { width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%;
  z-index: 2; }
.drow .t > i.to.up { background: var(--left); }
.drow .t > i.to.down { background: var(--hot); }
.drow .t > i.link { height: 2px; margin-top: -1px; z-index: 1; }
.drow .t > i.link.up { background: var(--left); opacity: .5; }
.drow .t > i.link.down { background: var(--hot); opacity: .5; }
.drow .v { text-align: right; font-family: var(--mono); font-size: 13px;
  font-variant-numeric: tabular-nums; }
.drow .v.up { color: var(--left); }
.drow .v.down { color: var(--hot); }

.foot { text-align: center; padding: 6px 12px max(18px, env(safe-area-inset-bottom));
  color: var(--faint); font-size: 11px; }
