:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d67;
  --grid: #e7e6e0;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --hop: #8c6bb1;
  --prop: #e6a23c;
  --send: #3b8ea5;
  --good: #006300;
  --bad: #a3321f;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 15px; line-height: 1.55; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 20px 18px 60px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 6px 10px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
h1 { font-size: 23px; margin: 0 0 6px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 34px 0 8px; font-weight: 650; }
h3 { font-size: 14.5px; margin: 0 0 6px; font-weight: 650; }
h3 .tag { font-weight: 500; color: var(--ink-2); font-size: 12.5px; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; background: #efeee9; padding: 1px 5px; border-radius: 4px; }
.sub { color: var(--ink-2); margin: 0 0 6px; max-width: 70em; }
.meta { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
.note { color: var(--ink-2); font-size: 13px; margin: 6px 0; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

nav { position: sticky; top: 0; z-index: 5; background: rgba(249, 249, 247, 0.94); backdrop-filter: blur(4px);
  border-bottom: 1px solid var(--border); padding: 8px 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; }
nav a { text-decoration: none; }
nav a:hover { text-decoration: underline; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-top: 10px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 > .panel { margin-top: 10px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

/* insight cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; margin-top: 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 10px; display: flex; flex-direction: column; }
.card .src { font-size: 12px; color: var(--muted); }
.card h3 { font-size: 15px; margin: 2px 0 6px; line-height: 1.4; }
.card .big { font-size: 24px; font-weight: 650; line-height: 1.2; margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.card .big small { font-size: 13px; color: var(--ink-2); font-weight: 500; margin-left: 4px; }
.card p { margin: 4px 0; font-size: 13.5px; color: var(--ink-2); }
.card ul { margin: 4px 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-2); }
.card .foot { margin-top: auto; padding-top: 6px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.card .ev { font-size: 12px; color: var(--muted); }
.card button { font: inherit; font-size: 13px; background: #fff; border: 1px solid var(--axis); border-radius: 6px; padding: 3px 10px; cursor: pointer; color: var(--accent); }
.card button:hover { background: #f2f6fc; }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 14px; position: sticky; top: 38px; z-index: 4; }
.controls label { font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; }
.controls .wide input[type=range] { width: 170px; }
.controls output { font-variant-numeric: tabular-nums; min-width: 64px; display: inline-block; font-weight: 600; }
select { font: inherit; font-size: 13.5px; padding: 2px 4px; border: 1px solid var(--axis); border-radius: 6px; background: #fff; }
.toggles { border: 0; padding: 0; margin: 0; display: inline-flex; gap: 12px; flex-wrap: wrap; }
.toggles legend { position: absolute; left: -999px; }
.podline { font-size: 13px; color: var(--ink-2); margin: 8px 2px 0; font-variant-numeric: tabular-nums; }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--grid); }
.chart .tick, .chart .base { stroke: var(--axis); }
.chart .axis text, .chart .axis-text { fill: var(--muted); }
.chart .label { fill: var(--ink-2); font-size: 12px; }
.chart .marker { stroke: #b9b7ad; stroke-dasharray: 2 3; }
.chart .marker-label { fill: var(--muted); font-size: 10.5px; }
.chart .hline { stroke: var(--ink-2); stroke-dasharray: 4 3; }
.chart .bar-label { fill: var(--ink); font-size: 12.5px; }
.chart .bar-sub { fill: var(--muted); font-size: 10.5px; }
.chart .bar-total { fill: var(--ink-2); font-size: 11.5px; }
.chart .cell-text { fill: #fff; font-size: 10px; pointer-events: none; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; line-height: 1.45; padding: 6px 8px;
  border-radius: 6px; display: none; z-index: 6; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); max-width: 340px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.legend .sw { display: inline-block; width: 22px; height: 0; border-top: 3px solid; vertical-align: 3px; margin-right: 5px; }
.legend .box { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 5px; }

/* tables */
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 600; color: var(--ink-2); background: #f4f3ef; }
td.good { color: var(--good); font-weight: 600; }
td.bad { color: var(--bad); font-weight: 600; }
.tbl-wrap { overflow-x: auto; }
details { margin-top: 6px; font-size: 13px; }
summary { cursor: pointer; color: var(--accent); }

.canvas-wrap { position: relative; width: 100%; aspect-ratio: 1 / 1; margin-top: 8px; }
.canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 8px; background: #fff; cursor: grab; touch-action: none; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; font-size: 13px; font-variant-numeric: tabular-nums; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; }
.prose { font-size: 14px; }
.prose p, .prose li { max-width: 72em; }
