:root {
  --bg: #0a1020;
  --surface: #111a2e;
  --surface-2: #16223b;
  --border: #22304f;
  --text: #e7eef9;
  --muted: #94a6c6;
  --accent: #22d3ee;
  --accent-ink: #04212a;
  --amber: #fbbf24;
  --red: #f87171;
  --green: #34d399;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
code, pre { font-family: var(--mono); font-size: 0.88em; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
h1 { font-size: clamp(1.5rem, 3.5vw, 2rem); line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
h3 { font-size: 0.95rem; margin: 16px 0 8px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }

/* header */
.top { background: linear-gradient(180deg, #0d1730, var(--bg)); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
@media (max-width: 820px) { .top { position: static; } .brand-sub { display: none; } }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font-weight: 800;
  background: radial-gradient(circle at 30% 30%, #164e63, #0b1a33); color: var(--accent); border: 1px solid #1d4d63;
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.25); }
.brand-name { font-weight: 700; font-size: 1.1rem; }
.brand-sub { color: var(--muted); font-size: 0.82rem; }
.gh { font-size: 0.86rem; text-decoration: none; border: 1px solid var(--border); padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.gh:hover { border-color: var(--accent); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 10px 12px; font: inherit; font-weight: 600;
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.privacy { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.84rem; padding-top: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); flex: none; }

/* layout */
main { padding-bottom: 40px; }
.lede { margin: 22px 0 18px; max-width: 780px; }
.lede p { color: var(--muted); margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card > p:first-of-type { margin-top: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.row-between h2, .row-between h3 { margin: 0; }

/* controls */
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btns.col { flex-direction: column; align-items: stretch; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 0.92rem;
  padding: 9px 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 5px 10px; font-size: 0.82rem; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 520px) { .fields { grid-template-columns: 1fr; } }
label { display: flex; flex-direction: column; gap: 5px; font-size: 0.86rem; font-weight: 600; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.8rem; margin-top: -3px; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0; }
textarea { font-family: var(--mono); font-size: 0.85rem; resize: vertical; }
details { margin: 10px 0; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.defects ol { padding-left: 20px; margin: 8px 0 0; color: var(--muted); font-size: 0.88rem; }
.defects li strong { color: var(--text); }
.drop { border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 18px; text-align: center; transition: border-color 0.15s, background 0.15s; }
.drop p { margin: 0 0 6px; }
.drop.over { border-color: var(--accent); background: rgba(34, 211, 238, 0.06); }
.setup { margin-top: 14px; }

/* results */
.status { min-height: 1.5em; margin: 6px 0 10px; color: var(--muted); }
.status.error { color: var(--red); }
.verdict { scroll-margin-top: 140px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border-radius: var(--radius); margin-bottom: 14px;
  border: 1px solid var(--border); background: var(--surface); }
.verdict .badge { font-weight: 800; font-size: 1.1rem; padding: 4px 12px; border-radius: 8px; letter-spacing: 0.04em; }
.verdict.pass .badge { background: rgba(52, 211, 153, 0.15); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.4); }
.verdict.fail .badge { background: rgba(248, 113, 113, 0.15); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.4); }
.verdict p { margin: 0; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.tile .v { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .k { color: var(--muted); font-size: 0.8rem; }
.tile.err .v { color: var(--red); }
.tile.range { grid-column: span 2; }
.tile.range .v { font-size: 1.05rem; padding-top: 6px; word-break: break-all; }
.tile.warn .v { color: var(--amber); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select { width: auto; }
.filters input { width: 220px; }
@media (max-width: 520px) { .filters input { width: 100%; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.chip { font: inherit; font-size: 0.78rem; font-family: var(--mono); border-radius: 999px; padding: 3px 10px; cursor: pointer;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.chip.error { border-color: rgba(248, 113, 113, 0.45); }
.chip.warning { border-color: rgba(251, 191, 36, 0.45); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.code-help { color: var(--muted); font-size: 0.86rem; min-height: 1.2em; margin: 0 0 10px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
td.mono, .mono { font-family: var(--mono); font-size: 0.8rem; }
td.hash { font-family: var(--mono); font-size: 0.74rem; word-break: break-all; min-width: 220px; }
td.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sev { font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.sev.error { color: var(--red); }
.sev.warning { color: var(--amber); }
tr.total td { font-weight: 700; border-top: 1px solid var(--muted); }

/* TAR */
.big-stat { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.big { font-size: 2.4rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.big-label { color: var(--muted); }
.ci-bar { width: 100%; height: auto; margin: 6px 0 10px; }
.ci-bar text { fill: var(--muted); font: 11px system-ui, sans-serif; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.error-text { color: var(--red); min-height: 1.2em; margin: 0; font-size: 0.88rem; }
#assumptions input { padding: 5px 8px; width: 88px; }
#assumptions td:first-child { font-family: var(--mono); font-size: 0.78rem; overflow-wrap: anywhere; }
#assumptions td { padding-left: 6px; padding-right: 6px; }

/* memo */
.md { font-size: 0.9rem; max-height: 560px; overflow: auto; padding-right: 4px; }
.md h1 { font-size: 1.15rem; }
.md h2 { font-size: 0.98rem; margin-top: 16px; color: var(--accent); }
.md table { margin: 6px 0; }
.md p, .md li { color: var(--text); }
.md ol, .md ul { padding-left: 20px; }

/* about */
.checks { padding-left: 18px; margin: 0; }
.checks li { margin-bottom: 8px; color: var(--muted); }
.checks strong { color: var(--text); }
pre.code { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; white-space: pre; }
.dict { display: grid; gap: 6px; font-size: 0.84rem; }
.dict div { display: grid; grid-template-columns: minmax(150px, auto) 1fr; gap: 10px; }
@media (max-width: 520px) { .dict div { grid-template-columns: 1fr; gap: 0; margin-bottom: 6px; } }
.dict code { background: none; padding: 0; color: var(--accent); }
.dict span { color: var(--muted); }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--border); padding-top: 16px; padding-bottom: 28px; font-size: 0.84rem; }
[hidden] { display: none !important; }
