:root {
  --bg: #F5F6F5; --surface: #FFFFFF; --sunk: #ECEEED; --ink: #141414; --muted: #5E6361; --line: #DADEDC;
  --mint: #00B98D; --mint-ink: #008A69; --ok: #00B98D; --bad: #E8405F;
  --rcf: #2F86EB; --rrf: #D9A300; --rcp: #7A5FF0;
  --font: "Poppins", "Segoe UI", system-ui, sans-serif; --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141414; --surface: #1D1E1E; --sunk: #0E0F0F; --ink: #F2F4F3; --muted: #9AA19E; --line: #2C2F2E;
    --mint: #00E8B1; --mint-ink: #00E8B1; --ok: #00E8B1; --bad: #FF5677;
    --rcf: #419DFF; --rrf: #FFCD3F; --rcp: #8B73FF; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141414; --surface: #1D1E1E; --sunk: #0E0F0F; --ink: #F2F4F3; --muted: #9AA19E; --line: #2C2F2E;
  --mint: #00E8B1; --mint-ink: #00E8B1; --ok: #00E8B1; --bad: #FF5677;
  --rcf: #419DFF; --rrf: #FFCD3F; --rcp: #8B73FF; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.15 var(--font); padding-inline: max(16px, 3vw); padding-block: 0 48px; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.label { font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding-block: 16px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand img { width: 30px; height: 30px; }
.brand h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: .01em; }
.brand span { color: var(--muted); font-size: 12px; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.summary { display: grid; grid-template-columns: minmax(200px, 1fr) repeat(3, minmax(0, 1fr)); gap: 16px; padding-block: 24px; }
.headline { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; padding: 20px; background: var(--ink); color: var(--bg); border-radius: 12px; }
.headline .big { font-size: 56px; font-weight: 600; line-height: 1; color: var(--mint); }
.headline .label { color: color-mix(in srgb, var(--bg) 70%, var(--ink)); }
.headline p { margin: 0; font-size: 13px; line-height: 1.4; color: color-mix(in srgb, var(--bg) 80%, var(--ink)); }
.kind { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 12px; }
.kind h2 { margin: 0; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kind h2 i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
.kind .acc { font-size: 28px; font-weight: 600; }
.cm { border-collapse: collapse; font-size: 12px; width: 100%; }
.cm th { font-weight: 500; color: var(--muted); padding: 3px; text-align: center; }
.cm td { padding: 0; }
.cm button { width: 100%; border: 0; padding: 7px 0; border-radius: 4px; background: color-mix(in srgb, var(--cell) calc(var(--a) * 100%), var(--sunk)); color: var(--ink); font-variant-numeric: tabular-nums; }
.cm button.on { outline: 2px solid var(--ink); outline-offset: -2px; }
.cm caption { caption-side: bottom; text-align: left; padding-top: 6px; color: var(--muted); font-size: 11px; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding-block: 8px 16px; }
.bar .count { margin-right: auto; color: var(--muted); }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 12px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.card:hover { border-color: var(--muted); }
.card .thumb { aspect-ratio: 1050 / 1010; width: 100%; object-fit: cover; background: var(--sunk); }
.card .meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.card .id { font-family: var(--mono); font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pill { font-family: var(--font); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; color: #141414; }
.pill.ok { background: var(--ok); } .pill.bad { background: var(--bad); }
.triple { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.triple div { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px; border-radius: 6px; background: var(--sunk); border-left: 3px solid var(--c); }
.triple b { font-size: 10px; font-weight: 500; color: var(--muted); letter-spacing: .06em; }
.triple span { font-variant-numeric: tabular-nums; font-size: 13px; }
.triple .wrong span { color: var(--bad); font-weight: 600; }
.more { display: block; margin: 24px auto 0; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 10px 20px; }

dialog { border: 0; padding: 0; background: var(--bg); color: var(--ink); border-radius: 14px; width: min(1180px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgb(0 0 0 / .6); }
.dlg { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.dlg-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.dlg-head h2 { margin: 0 auto 0 0; font: 500 18px var(--mono); }
.close { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 12px; }
.views { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.view { position: relative; border-radius: 10px; overflow: hidden; background: var(--sunk); }
.view canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; mix-blend-mode: normal; }
.view figcaption { position: absolute; left: 8px; top: 8px; background: rgb(20 20 20 / .75); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 6px; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toggle { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 12px; }
.toggle i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.toggle[aria-pressed="false"] { opacity: .5; }
.probs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.prob { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.prob h3 { margin: 0; font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; }
.prow { display: grid; grid-template-columns: 56px 1fr 44px; gap: 8px; align-items: center; font-size: 12px; }
.prow .track { height: 8px; background: var(--sunk); border-radius: 4px; overflow: hidden; }
.prow .fill { height: 100%; background: var(--c); }
.prow.gt { font-weight: 600; }
.note { color: var(--muted); font-size: 12px; line-height: 1.5; max-width: 70ch; margin: 0; }
.empty { padding: 48px 0; text-align: center; color: var(--muted); }

@media (max-width: 900px) { .summary { grid-template-columns: 1fr 1fr; } .headline { grid-column: 1 / -1; } }
@media (max-width: 560px) { .summary { grid-template-columns: 1fr; } .headline .big { font-size: 44px; } }
@media (prefers-reduced-motion: no-preference) { .card, .prow .fill { transition: border-color .15s, width .3s; } }

/* page switcher in the header */
.seg a { padding: 6px 12px; border-radius: 6px; font-size: 13px; color: var(--muted); text-decoration: none; }
.seg a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
