:root {
  color-scheme: light dark;
  --bg: #EEF3F8; --ink: #13243B; --muted: #53657D; --line: #D0DAE6; --panel: #FFFFFF;
  --prefix: #0A6C9E; --iid: #B05F08; --ok: #12805C; --warn: #A33A2A; --btn: #13243B; --btn-ink: #EEF3F8; --field: #FFFFFF;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C1625; --ink: #E7EEF8; --muted: #97A8BF; --line: #243650; --panel: #111F33;
    --prefix: #6CC5EE; --iid: #F0B14B; --ok: #4FD1A1; --warn: #FF8F7A; --btn: #E7EEF8; --btn-ink: #0C1625; --field: #0C1625;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.55 var(--sans); }
main { max-width: 62rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
a { color: var(--prefix); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--prefix); outline-offset: 2px; }

.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem 2rem; margin: 0 0 2.5rem; }
.site { font-weight: 700; margin: 0; }
.site a { color: inherit; text-decoration: none; }
.lang { display: flex; gap: .25rem 1.1rem; margin: 0; padding: 0; list-style: none; font-size: .95rem; }
.lang a { color: var(--muted); text-decoration: none; padding: .2rem 0; border-bottom: 2px solid transparent; }
.lang a[aria-current] { color: var(--ink); font-weight: 700; border-bottom-color: var(--prefix); }

h1 { font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.1; margin: 0 0 .75rem; letter-spacing: -.02em; }
.intro { color: var(--muted); max-width: 44rem; margin: 0 0 2rem; }
h2 { font-size: 1.5rem; margin: 0 0 .5rem; }
h3 { font-size: 1.05rem; margin: 1.75rem 0 .5rem; }

.toc { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.toc a { display: inline-block; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--panel); color: var(--ink); text-decoration: none; font-size: .95rem; }
.toc a:hover { border-color: var(--prefix); }

.tool { margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.tool > p.lead { color: var(--muted); max-width: 46rem; margin: 0 0 1.25rem; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem 1.5rem; align-items: start; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
label { font-weight: 700; font-size: .95rem; }
.hint { color: var(--muted); font-size: .85rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: .35rem; padding: .55rem .65rem; width: 100%; min-width: 0; }
input.m, textarea { font-family: var(--mono); font-size: .95rem; }
textarea { resize: vertical; min-height: 5.5rem; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(7rem, auto); gap: .5rem; }
button { font: inherit; font-weight: 700; background: var(--btn); color: var(--btn-ink); border: 0; border-radius: .35rem; padding: .6rem 1.1rem; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
button.small { padding: .3rem .7rem; font-size: .85rem; margin: .5rem 0; }
button.chip { background: var(--panel); color: var(--ink); border: 1px solid var(--line); padding: .35rem .7rem; font-weight: 400; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }

.out { margin-top: 1.5rem; min-height: 1rem; }
.err, .warn { color: var(--warn); font-weight: 700; margin: .5rem 0 0; }
.note { color: var(--muted); font-size: .9rem; max-width: 46rem; margin: .6rem 0 0; }
.result { font-size: 1.5rem; font-weight: 700; margin: 0 0 .75rem; }
.status-open { color: var(--ok); } .status-closed, .status-filtered { color: var(--warn); }
.verdict { font-weight: 700; margin: .75rem 0 0; } .verdict.good { color: var(--ok); } .verdict.poor { color: var(--warn); }

dl { display: grid; grid-template-columns: minmax(10rem, 17rem) minmax(0, 1fr); margin: 0; }
dt, dd { margin: 0; padding: .5rem 0; border-top: 1px solid var(--line); }
dt { color: var(--muted); padding-right: 1rem; }
dd { overflow-wrap: anywhere; }
.m { font-family: var(--mono); font-size: .92rem; }
.bin .net, .net { color: var(--prefix); font-weight: 700; } .bin .host, .host { color: var(--iid); }
.legend { font-size: .85rem; margin: .4rem 0 0; }
.bin { font-family: var(--mono); font-size: .85rem; word-break: break-all; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: .25rem 0; border-top: 1px solid var(--line); }
.code-block { background: var(--panel); border: 1px solid var(--line); border-radius: .35rem; padding: .75rem 1rem; overflow-x: auto; margin: 1rem 0 0; font-family: var(--mono); font-size: .9rem; }

.scroll { overflow-x: auto; margin-top: .75rem; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .45rem .7rem .45rem 0; border-top: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { color: var(--muted); font-weight: 700; border-top: 0; }
table.dns td:last-child { width: 30%; }
.barwrap { display: block; background: var(--line); border-radius: 3px; height: .6rem; min-width: 5rem; }
.bar { display: block; background: var(--prefix); height: 100%; border-radius: 3px; width: 0; }
.tag { color: var(--ok); font-size: .8rem; }

#lat-chart { width: 100%; height: 7.5rem; margin-top: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: .35rem; }
#lat-chart .line { fill: none; stroke: var(--prefix); stroke-width: 2; }
#lat-chart .lost { stroke: var(--warn); stroke-width: 2; stroke-dasharray: 3 3; }
#lat-chart text { fill: var(--muted); font-size: 11px; }

footer { margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; max-width: 46rem; }

@media (max-width: 700px) {
  .tool { margin-top: 2.75rem; }
  dl { grid-template-columns: 1fr; }
  dt { border-top: 1px solid var(--line); padding-bottom: 0; }
  dd { border-top: 0; padding-top: .1rem; }
}

/* ===== tools section layout: category bar, sidebar with icons, stage ===== */
.icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cats { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; margin: 0; padding: 0; }
.cats a { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .75rem; border: 1px solid transparent; border-radius: .5rem; color: var(--muted); text-decoration: none; font-size: .92rem; }
.cats a:hover { color: var(--ink); border-color: var(--line); }
.cats a[aria-current] { color: var(--ink); background: var(--panel); border-color: var(--line); font-weight: 700; }
.top nav { max-width: 100%; }
.crumbs { margin: 0 0 .5rem; color: var(--muted); font-size: .9rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.card { display: block; padding: 1.25rem; background: var(--panel); border: 1px solid var(--line); border-radius: .75rem; color: var(--ink); text-decoration: none; }
.card:hover { border-color: var(--prefix); }
.card .icon { width: 1.75rem; height: 1.75rem; color: var(--prefix); }
.card h2 { font-size: 1.15rem; margin: .6rem 0 .3rem; }
.card p { margin: 0 0 .75rem; color: var(--muted); font-size: .92rem; }
.card .count { font-size: .85rem; color: var(--prefix); font-weight: 700; }

.layout { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 2rem; align-items: start; margin-top: 1.5rem; }
.side { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
.sidelist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
.navbtn { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border: 1px solid transparent; border-radius: .55rem; color: var(--ink); text-decoration: none; font-size: .93rem; line-height: 1.3; }
a.navbtn:hover { background: var(--panel); border-color: var(--line); }
a.navbtn[aria-current] { background: var(--panel); border-color: var(--prefix); font-weight: 700; }
a.navbtn[aria-current] .icon { color: var(--prefix); }
.navbtn.planned { color: var(--muted); opacity: .65; cursor: default; }
.soon { margin-left: auto; padding: .05rem .4rem; border: 1px solid var(--line); border-radius: 1rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.stage { min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: .75rem; padding: 1.5rem; }
.panel[hidden], [hidden] { display: none !important; }
.panel > .lead { color: var(--muted); max-width: 46rem; margin: 0 0 1.25rem; }
.tcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; }
.tcard { display: flex; flex-direction: column; gap: .35rem; padding: 1rem; border: 1px solid var(--line); border-radius: .6rem; color: var(--ink); text-decoration: none; background: var(--bg); }
a.tcard:hover { border-color: var(--prefix); }
.tcard .icon { color: var(--prefix); }
.tcard span { color: var(--muted); font-size: .88rem; }
.tcard.planned { opacity: .6; }
.findings { list-style: none; margin: .75rem 0 0; padding: 0; }
.findings li { padding: .45rem 0; border-top: 1px solid var(--line); }
.f-ok strong { color: var(--ok); } .f-warn strong { color: var(--iid); } .f-fail strong { color: var(--warn); } .f-info strong { color: var(--prefix); }
.wrap td { white-space: normal; min-width: 8rem; }
.pwlist li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.pw { font-family: var(--mono); font-size: 1rem; overflow-wrap: anywhere; }
input[type=range] { padding: 0; }
label input[type=checkbox] { width: auto; margin-right: .5rem; }
.field label { font-weight: 400; display: block; }
.field > label[for] { font-weight: 700; }
output { font-family: var(--mono); }


tr.sel td { background: var(--bg); font-weight: 700; color: var(--prefix); }
.verdict.fair { color: var(--iid); }
#sq-feedback { min-height: 1.5rem; font-weight: 700; }
.actions input { max-width: 22rem; }

progress { width: 100%; height: .6rem; margin: .75rem 0; accent-color: var(--prefix); }
details { margin-top: 1rem; }
summary { cursor: pointer; font-weight: 700; }

/* ===== small screens: no sideways scrolling anywhere ===== */
.side-toggle { display: none; }
@media (max-width: 860px) {
  main { padding: 1rem .9rem 3rem; }
  .top { flex-direction: column; align-items: stretch; gap: .75rem; margin-bottom: 1.5rem; }
  .cats { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
  .cats a { width: 100%; padding: .5rem .6rem; font-size: .88rem; line-height: 1.25; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 1rem; margin-top: 1rem; }
  .side { position: static; max-height: none; overflow: visible; }
  .side.collapsible .side-toggle { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; padding: .75rem .9rem;
    background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: .6rem; font-weight: 400; text-align: left; }
  .side-toggle span { color: var(--muted); font-size: .8rem; flex: none; }
  .side-toggle strong { flex: 1; text-align: right; overflow-wrap: anywhere; }
  .side-toggle::after { content: ''; flex: none; width: .55rem; height: .55rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: 0 .2rem .2rem .4rem; }
  .side.open .side-toggle::after { transform: rotate(-135deg); margin: .2rem .2rem 0 .4rem; }
  .side.collapsible:not(.open) .sidelist { display: none; }
  .sidelist { flex-direction: column; overflow: visible; gap: .2rem; margin-top: .5rem; }
  .navbtn { white-space: normal; background: var(--panel); border-color: var(--line); padding: .65rem .8rem; }
  .soon { display: inline-block; }
  .panel { padding: 1rem; border-radius: .6rem; }
  .tcards, .cards { grid-template-columns: minmax(0, 1fr); }
  .form { grid-template-columns: minmax(0, 1fr); }
  input, select, textarea, input.m, textarea { font-size: 1rem; }
  .pair { grid-template-columns: minmax(0, 1fr) minmax(5.5rem, auto); }
  .code-block { white-space: pre-wrap; overflow-wrap: anywhere; }
  .actions { gap: .6rem; }
  .actions input { max-width: none; width: 100%; }
}
@media (max-width: 700px) {
  /* tables become one card per row: label on the left, value on the right */
  .scroll { overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tr { margin: 0 0 .6rem; padding: .35rem .8rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--bg); }
  td { display: flex; gap: .9rem; justify-content: space-between; align-items: baseline; padding: .3rem 0; border: 0; white-space: normal; min-width: 0; overflow-wrap: anywhere; text-align: right; }
  td::before { content: attr(data-label); flex: 0 0 36%; max-width: 36%; color: var(--muted); font-size: .82rem; font-weight: 700; text-align: left; overflow-wrap: normal; }
  td[data-label=""]::before { display: none; }
  .wrap td { min-width: 0; }
  table.dns td:last-child { width: 100%; }
  .barwrap { min-width: 0; flex: 1; }
  tr.sel { border-color: var(--prefix); }
  tr.sel td { background: transparent; }
}

.bar.mid { background: var(--iid); }
.bar.slow { background: var(--warn); }

/* ===== search box ===== */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tsearch { max-width: 38rem; margin: 0 0 1.5rem; }
.tsearch label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .3rem; }
.tsearch-box { position: relative; }
.tsearch-box > .icon { position: absolute; left: .8rem; top: .85rem; width: 1.1rem; height: 1.1rem; color: var(--muted); pointer-events: none; }
.tsearch-box input { padding: .7rem .8rem .7rem 2.5rem; font-size: 1rem; border-radius: .6rem; }
#tsearch-results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + .3rem); margin: 0; padding: .3rem; list-style: none; background: var(--panel); border: 1px solid var(--line);
  border-radius: .6rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); max-height: min(24rem, 60vh); overflow-y: auto; }
#tsearch-results[hidden] { display: none; }
#tsearch-results li a { display: block; padding: .55rem .7rem; border-radius: .45rem; color: var(--ink); text-decoration: none; }
#tsearch-results li a strong { display: block; }
#tsearch-results li a span { display: block; color: var(--muted); font-size: .85rem; line-height: 1.35; }
#tsearch-results li.active a, #tsearch-results li a:hover { background: var(--bg); }
#tsearch-results li.active { outline: 2px solid var(--prefix); border-radius: .45rem; }
#tsearch-results li.none { padding: .6rem .7rem; color: var(--muted); }

.st { font-weight: 700; }
.st-ok { color: var(--ok); } .st-warn { color: var(--iid); } .st-fail { color: var(--warn); } .st-info { color: var(--prefix); }
