:root {
  --bg: #111; --surface: #161616; --fg: #fff; --fg-dim: #b0b0b0; --fg-mute: #7d7d7d; --hair: #262626;
  --accent: #35d07f; --on-accent: #0b0b0b;
  --good: #35d07f; --bad: #ff6b5e; --pending: #7d7d7d;
  /* tree-cover loss, one hue, faint to strong */
  --l0: #26211e; --l1: #55331f; --l2: #8a4322; --l3: #c25526; --l4: #ff7d42;
  --bar: #c25526; --bar-hi: #ff7d42; --counted: #35d07f; --taken: #ff6b5e;
  color-scheme: dark;
}
/* Dark is the default whatever the system says; light only when the viewer switches to it. */
:root[data-theme="light"] {
  --bg: #f3f4f1; --surface: #fafbf9; --fg: #0c0e0d; --fg-dim: #474c49; --fg-mute: #686e6a; --hair: #d6d9d4;
  --accent: #0b7a45; --on-accent: #fff;
  --good: #0b7a45; --bad: #b8291d; --pending: #686e6a;
  --l0: #ece4de; --l1: #e6c3ad; --l2: #db9770; --l3: #c8683a; --l4: #9c3d17;
  --bar: #c8683a; --bar-hi: #9c3d17; --counted: #0b7a45; --taken: #b8291d;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 Inter, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
code { font: 12.5px/1.4 ui-monospace, Consolas, monospace; color: var(--fg-dim); }

.top { border-bottom: 1px solid var(--hair); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; font-size: 12px; }
.brand-sub { color: var(--fg-mute); font-weight: 600; }
.glyph { width: 14px; height: 14px; border: 2px solid var(--accent); position: relative; }
.glyph::after { content: ""; position: absolute; inset: 3px; background: var(--accent); }
.net { font-size: 11px; letter-spacing: 1px; color: var(--fg-dim); text-align: right; }
.net b { color: var(--fg); font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.theme { font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; background: none; color: var(--fg); border: 1px solid var(--hair); padding: 8px 12px; font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.theme:hover { border-color: var(--fg-mute); }
.theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.intro { padding: 44px 0 26px; max-width: 800px; }
.eyebrow, h2 .n, th, .tile-label, .tabs button, .btn { font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.eyebrow { color: var(--accent); margin: 0 0 14px; }
h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 16px; font-weight: 700; }
h1 span { color: var(--fg-mute); }
.lede { color: var(--fg-dim); margin: 0; font-size: 16px; }
h2 { font-size: 20px; margin: 52px 0 18px; font-weight: 700; display: flex; align-items: baseline; gap: 12px; letter-spacing: -0.01em; }
h2 .n { color: var(--accent); }

.tabs { display: flex; gap: 0; border: 1px solid var(--hair); width: fit-content; max-width: 100%; flex-wrap: wrap; }
.tabs button { background: none; color: var(--fg-dim); border: 0; border-right: 1px solid var(--hair); padding: 13px 18px; cursor: pointer; font-family: inherit; }
.tabs button:last-child { border-right: 0; }
.tabs button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.tabs button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.note { border-left: 2px solid var(--fg-mute); padding: 4px 0 4px 14px; color: var(--fg-dim); font-size: 13.5px; margin: 16px 0 0; max-width: 800px; }
.note.warn { border-color: var(--bad); }
.small { color: var(--fg-mute); font-size: 13px; max-width: 800px; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--hair); border: 1px solid var(--hair); }
.tile { background: var(--surface); padding: 18px 18px 16px; min-width: 0; }
.tile-label { color: var(--fg-mute); display: block; margin-bottom: 10px; }
.tile-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-value small { font-size: 14px; font-weight: 600; color: var(--fg-dim); letter-spacing: 0; }
.tile-sub { color: var(--fg-dim); font-size: 12.5px; margin-top: 6px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.panel { background: var(--surface); border: 1px solid var(--hair); margin: 0; padding: 18px; min-width: 0; }
figcaption { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
figcaption strong { font-size: 14px; }
figcaption span { color: var(--fg-mute); font-size: 12.5px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--fg-mute); font: 10px Inter, Arial, sans-serif; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--hair); stroke-width: 1; }
.chart .bar { fill: var(--bar); }
.chart .bar:hover, .chart .bar.on { fill: var(--bar-hi); }
.chart .cell { stroke: var(--surface); stroke-width: 1; }
.chart .cell:hover { stroke: var(--fg); }
.chart .ring { stroke-width: 1.5; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12px; color: var(--fg-dim); align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; }
.legend .ramp i { margin-right: 1px; }
.legend .ramp span { margin: 0 6px; }
.legend .k-counted { border: 2px solid var(--counted); }
.legend .k-taken { border: 2px solid var(--fg); background: repeating-linear-gradient(45deg, var(--fg) 0 2px, transparent 2px 5px); }

.row-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.verdict { margin: 0; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { font-family: inherit; cursor: pointer; padding: 12px 18px; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: none; color: var(--fg); border-color: var(--hair); }
.btn.ghost:hover { border-color: var(--fg-mute); }
.btn[disabled] { opacity: 0.5; cursor: default; }

.table-wrap { overflow-x: auto; border: 1px solid var(--hair); }
table { border-collapse: collapse; width: 100%; background: var(--surface); min-width: 720px; }
th { text-align: left; color: var(--fg-mute); padding: 12px 14px; border-bottom: 1px solid var(--hair); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--hair); vertical-align: top; font-size: 13.5px; }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 600; white-space: nowrap; }
td .how { display: block; color: var(--fg-mute); font-size: 12px; font-weight: 400; margin-top: 2px; }
td.hash code { word-break: break-all; }
td.hash .mine { display: block; margin-top: 4px; color: var(--bad); }
.st { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; white-space: nowrap; }
.st::before { content: ""; width: 16px; height: 16px; display: inline-block; background: currentColor; -webkit-mask: var(--ico) center/contain no-repeat; mask: var(--ico) center/contain no-repeat; }
.st.ok { color: var(--good); --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.8' fill='none' stroke='%23000' stroke-width='2.2'/%3E%3C/svg%3E"); }
.st.no { color: var(--bad); --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 4l8 8M12 4l-8 8' fill='none' stroke='%23000' stroke-width='2.2'/%3E%3C/svg%3E"); }
.st.na { color: var(--pending); --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8h10' fill='none' stroke='%23000' stroke-width='2.2'/%3E%3C/svg%3E"); }

.claim { display: grid; gap: 14px; }
.claim p { margin: 0; color: var(--fg-dim); max-width: 800px; }
.claim p strong { color: var(--fg); }
.claim dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 13.5px; }
.claim dt { color: var(--fg-mute); }
.claim dd { margin: 0; word-break: break-all; }
.outcome { border: 1px solid var(--hair); padding: 14px 16px; display: grid; gap: 8px; }
.outcome.no { border-color: var(--bad); }
.outcome.ok { border-color: var(--good); }
.outcome code { word-break: break-all; }

.limits { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--hair); border: 1px solid var(--hair); }
.limits li { background: var(--surface); padding: 16px 18px; color: var(--fg-dim); font-size: 13.5px; }
.limits strong { color: var(--fg); display: block; margin-bottom: 4px; }

.foot { color: var(--fg-mute); font-size: 12px; padding-top: 40px; padding-bottom: 40px; margin-top: 56px; border-top: 1px solid var(--hair); }
.foot p { margin: 0 0 6px; word-break: break-all; }
.tip { position: fixed; z-index: 5; pointer-events: none; background: var(--fg); color: var(--bg); padding: 7px 10px; font-size: 12px; line-height: 1.4; max-width: 240px; }
.tip b { display: block; }

@media (max-width: 860px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .grid2, .limits { grid-template-columns: 1fr; }
}
@media (max-width: 460px) { .tiles { grid-template-columns: 1fr; } .tile-value { font-size: 24px; } }

/* loading states */
.spin { display: inline-block; flex: none; width: 14px; height: 14px; border: 2px solid var(--hair); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--fg-mute); font-size: 13px; min-height: 120px; padding: 16px; }
.tiles .loading { grid-column: 1 / -1; background: var(--surface); min-height: 104px; }
.chart .loading { min-height: 240px; }
.claim .loading { min-height: 0; justify-content: flex-start; padding: 6px 0; }
td .loading { min-height: 160px; }
.reading { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-mute); font-size: 12.5px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.verdict .reading { font-size: 15px; }
.net .spin { width: 10px; height: 10px; vertical-align: -1px; margin-right: 8px; }
