:root {
  --bg: #f6f7f9; --card: #ffffff; --ink: #14202b; --sub: #4a5866; --mute: #7b8794; --line: #dfe3e8;
  --fab: #c23b32; --fab-bg: #fbe9e7; --perm: #2563a8; --perm-bg: #e7eef8; --sham: #8b95a1; --trunc: #d9822b;
  --accent: #0f766e; --code: #f1f3f5; --shadow: 0 1px 2px rgba(20, 32, 43, .06), 0 4px 16px rgba(20, 32, 43, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419; --card: #182028; --ink: #e6ebf0; --sub: #aab6c2; --mute: #7d8a96; --line: #2a3540;
    --fab: #f07167; --fab-bg: #3a1f1d; --perm: #6aa6ea; --perm-bg: #172a40; --sham: #8b95a1; --trunc: #f0a35a;
    --accent: #2dd4bf; --code: #111921; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1419; --card: #182028; --ink: #e6ebf0; --sub: #aab6c2; --mute: #7d8a96; --line: #2a3540;
  --fab: #f07167; --fab-bg: #3a1f1d; --perm: #6aa6ea; --perm-bg: #172a40; --sham: #8b95a1; --trunc: #f0a35a;
  --accent: #2dd4bf; --code: #111921; --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--perm); }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; }

/* top bar */
.bar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.bar-in { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; gap: 18px; align-items: center; }
.brand { font-weight: 700; letter-spacing: -.01em; white-space: nowrap; color: var(--ink); text-decoration: none; }
.brand span { color: var(--fab); }
nav.top { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
nav.top a { color: var(--sub); text-decoration: none; font-size: 14px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
nav.top a:hover, nav.top a.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.theme { border: 1px solid var(--line); background: var(--card); color: var(--sub); border-radius: 8px; padding: 5px 9px; font-size: 13px; cursor: pointer; }

main { max-width: 1120px; margin: 0 auto; padding: 8px 20px 60px; }
section { margin: 34px 0; }
h1 { font-size: clamp(28px, 4.4vw, 44px); line-height: 1.12; letter-spacing: -.02em; margin: 28px 0 8px; }
h2 { font-size: 26px; letter-spacing: -.015em; margin: 0 0 6px; }
h3 { font-size: 17px; margin: 18px 0 6px; }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.lede { color: var(--sub); max-width: 820px; }
.anon { display: inline-block; font-size: 13px; color: var(--sub); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--card); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
@media (min-width: 560px) and (max-width: 860px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* headline tiles */
.stat { padding: 18px; }
.stat .n { font-size: 34px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.stat .n.fab { color: var(--fab); } .stat .n.perm { color: var(--perm); }
.stat .l { color: var(--sub); font-size: 14px; margin-top: 4px; }
.abstract { font-size: 16.5px; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }

/* controls */
select, input[type=search], input[type=text] { font: inherit; font-size: 14px; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; max-width: 100%; }
.ctl { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0 14px; }
.ctl label { font-size: 13px; color: var(--sub); display: flex; gap: 6px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--card); color: var(--sub); padding: 6px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--bg); }

/* explorer */
.chat { display: flex; flex-direction: column; gap: 8px; }
.bubble { align-self: flex-start; background: var(--code); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 12px; max-width: 95%; }
.task { font-size: 14px; color: var(--sub); }
.fields { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.field { font-size: 12.5px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; background: var(--card); }
.field.miss { border-color: var(--fab); color: var(--fab); font-weight: 600; }
.outs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; align-content: start; align-items: start; align-self: start; }
.out { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--card); display: flex; flex-direction: column; min-width: 0; }
.out.leak { border-color: var(--fab); box-shadow: inset 3px 0 0 var(--fab); }
.out.ok { border-color: var(--perm); box-shadow: inset 3px 0 0 var(--perm); }
.out h4 { margin: 0 0 2px; font-size: 13px; }
.out .why { font-size: 12px; color: var(--mute); margin-bottom: 6px; }
.out pre { margin: 0; white-space: pre-wrap; word-break: break-word; background: var(--code); border-radius: 8px; padding: 8px; max-height: 260px; overflow: auto; font-size: 12px; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 1px 7px; margin-top: 8px; align-self: flex-start; }
.badge.leak { background: var(--fab-bg); color: var(--fab); } .badge.ok { background: var(--perm-bg); color: var(--perm); }
mark.v-leak { background: var(--fab-bg); color: var(--fab); font-weight: 700; border-radius: 3px; padding: 0 2px; }
mark.v-ok { background: var(--perm-bg); color: var(--perm); font-weight: 700; border-radius: 3px; padding: 0 2px; }
.tiles { display: grid; gap: 2px; font-size: 11px; }
.tile { width: 100%; aspect-ratio: 1; border-radius: 3px; cursor: pointer; border: 0; padding: 0; }
.tile.f { background: var(--fab); } .tile.a { background: color-mix(in srgb, var(--mute) 30%, transparent); }
.tile.l { background: var(--perm); } .tile.t { background: var(--trunc); } .tile.n { background: transparent; outline: 1px dashed var(--line); }
.tile.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
.tlab { font-size: 11px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* charts */
svg text { fill: var(--ink); font-family: inherit; }
svg .axis line, svg .axis path { stroke: var(--line); }
svg .grid line { stroke: var(--line); stroke-dasharray: 2 3; }
svg .sub { fill: var(--sub); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--sub); margin: 8px 0; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; pointer-events: none; z-index: 50; background: var(--ink); color: var(--bg); font-size: 12.5px; padding: 6px 9px; border-radius: 7px; max-width: 280px; opacity: 0; transition: opacity .12s; }
.cell2 { border-radius: 14px; padding: 18px; cursor: pointer; border: 2px solid transparent; transition: transform .1s; }
.cell2:hover { transform: translateY(-1px); }
.cell2.on { border-color: var(--ink); }
.cell2 .n { font-size: 38px; font-weight: 750; letter-spacing: -.02em; }
.cell2 .l { font-size: 13.5px; }
.note { font-size: 13px; color: var(--sub); }
.how { font-size: 13.5px; color: var(--sub); border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; margin: 12px 0 0; }

/* figures, tables */
.figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.fig { cursor: zoom-in; padding: 10px; }
.fig img { width: 100%; height: 170px; object-fit: contain; background: #fff; border-radius: 8px; }
.fig .c { font-size: 13px; color: var(--sub); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
dialog { border: 0; border-radius: 14px; padding: 0; max-width: min(1200px, 96vw); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(10, 15, 20, .7); }
dialog .in { padding: 16px; }
dialog img { width: 100%; background: #fff; border-radius: 8px; }
dialog .x { float: right; }
.tbl-wrap { overflow-x: auto; }
table.t { border-collapse: collapse; font-size: 13px; min-width: 100%; }
table.t th, table.t td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.t thead th { border-bottom: 2px solid var(--ink); font-weight: 650; }
table.t td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t td.tilecell { padding: 1px; width: 14px; }
table.t span.tl { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }
.tl-F { background: var(--fab); } .tl-A { background: color-mix(in srgb, var(--mute) 30%, transparent); } .tl-L { background: var(--perm); } .tl-T { background: var(--trunc); }
.caption { font-size: 14px; color: var(--sub); margin: 0 0 10px; }

/* files */
.files { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.frow { display: grid; grid-template-columns: 1fr 210px 70px 92px; gap: 10px; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.frow:hover { background: var(--code); }
.frow .p { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow .k { color: var(--sub); font-size: 12px; }
.frow .s { color: var(--mute); text-align: right; font-size: 12px; }
.frow .a { display: flex; gap: 8px; justify-content: flex-end; }
.frow .a a, .frow .a button { font-size: 12px; border: 0; background: none; color: var(--perm); cursor: pointer; padding: 0; text-decoration: underline; }
@media (max-width: 760px) { .frow { grid-template-columns: 1fr 64px; } .frow .k, .frow .s { display: none; } }
pre.viewer { max-height: 70vh; overflow: auto; background: var(--code); padding: 12px; border-radius: 8px; font-size: 12px; white-space: pre; }
.ok-list { list-style: none; padding: 0; margin: 8px 0; }
.ok-list li { padding-left: 24px; position: relative; margin: 6px 0; }
.ok-list li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 800; }
footer { border-top: 1px solid var(--line); color: var(--mute); font-size: 13px; padding: 22px 20px 40px; text-align: center; }
.small { font-size: 13px; }
.lim p { margin: 0 0 10px; }
