:root {
  --bg: #ffffff;
  --fg: #1a1d21;
  --muted: #6a737d;
  --accent: #0b5fff;
  --border: #d8dde3;
  --code-bg: #f4f6f8;
  --warn: #9a6700;
  --tag-bg: #e7f0ff;
  --tag-fg: #0b4fcc;
  --tag-border: #b6d2ff;
  --db-bg: #f4eefd;
  --db-fg: #6d3fc4;
  --db-border: #dcc8f3;
  --meas-bg: #e9f7ec;
  --meas-fg: #1a7f37;
  --meas-border: #b7e1c0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --fg: #e6e9ec;
    --muted: #9aa4ad;
    --accent: #6ea8ff;
    --border: #30363d;
    --code-bg: #1f242a;
    --warn: #d4a72c;
    --tag-bg: #14304f;
    --tag-fg: #9cc6ff;
    --tag-border: #285085;
    --db-bg: #2b2150;
    --db-fg: #c9b2f7;
    --db-border: #4d3a85;
    --meas-bg: #16301f;
    --meas-fg: #7ee2a8;
    --meas-border: #2b5d3f;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
}
main { max-width: 70rem; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
header { border-bottom: 1px solid var(--border); }
header nav { max-width: 70rem; margin: 0 auto; padding: .6rem 1.25rem; display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
header nav a { color: var(--fg); text-decoration: none; }
header nav a.active { color: var(--accent); }
header nav .brand { font-weight: 700; margin-right: 1rem; }
.social-links { display: inline-flex; align-items: center; gap: .4rem; margin-left: auto; }
.social-link { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid transparent; border-radius: 6px; color: var(--fg); transition: border-color .15s, color .15s, background .15s; }
.social-link:hover { color: var(--accent); border-color: var(--tag-border); background: var(--tag-bg); }
.social-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.social-link svg { width: 1rem; height: 1rem; fill: currentColor; }
footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
footer p { max-width: 70rem; margin: .8rem auto; padding: 0 1.25rem; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 1.2rem 0 .6rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1.1rem 0 .4rem; }
.lead { color: var(--muted); }
.muted { color: var(--muted); }
.note { margin: 1em 0; }
.subsection {
  margin: .9rem 0 1.2rem 1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
}
.subsection h3 { margin-top: 0; }
.subsection ul { margin: .4rem 0 .7rem; padding-left: 1.25rem; }
.warn { color: var(--warn); }
code {
  font: .85em/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--code-bg);
  padding: .1em .35em;
  border-radius: 4px;
  word-break: break-all;
}
table { border-collapse: collapse; width: 100%; margin: .6rem 0 1rem; }
th, td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.kv th { width: 14rem; font-weight: 600; }
.fpcell { max-width: 38rem; }
/* Muted country/ASN annotation; long names ellipsize, full value in title. */
.assoc-label { display: inline-block; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--code-bg);
  padding: .8rem 1.1rem;
  margin: 1.4rem 0;
}
.callout p { margin: .4rem 0; }
.cmdline { position: relative; margin: .5rem 0; }
.callout pre {
  margin: 0;
  padding: .55rem 6.4rem .55rem .8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
}
.callout pre code { background: none; padding: 0; }
.cmd-modes { position: absolute; top: .4rem; right: .45rem; display: inline-flex; gap: .2rem; padding: .15rem; border: 1px solid var(--border); border-radius: 6px; background: var(--code-bg); }
.cmd-modes button {
  appearance: none;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  font: 500 .78rem/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: .25rem .5rem;
}
.cmd-modes button:hover,
.cmd-modes button:focus-visible { color: var(--accent); background: var(--tag-bg); outline: none; }
.cmd-modes button.active { color: var(--tag-fg); background: var(--tag-bg); font-weight: 600; }
.ident {
  display: inline-block;
  font-size: .74em;
  line-height: 1.4;
  color: var(--tag-fg);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 999px;
  padding: .02rem .55rem;
  white-space: nowrap;
  vertical-align: middle;
}
/* Tag colour marks provenance: violet = inferred from the external JA4+
   database, green = measured by this site's controlled captures, blue
   (default) = derived directly from the wire. */
.ident.db {
  color: var(--db-fg);
  background: var(--db-bg);
  border-color: var(--db-border);
}
.ident.meas {
  color: var(--meas-fg);
  background: var(--meas-bg);
  border-color: var(--meas-border);
}
.callout.meas { border-left-color: var(--meas-fg); }
/* Confidence chips: ranked, not provenance — amber/grey scale so they read
   as a severity axis distinct from the provenance pill colours. */
.conf {
  display: inline-block; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em;
  border-radius: 999px; padding: .02rem .5rem; border: 1px solid transparent;
}
.conf.high   { color: #8a1c1c; background: #fdecec; border-color: #f3c0c0; }
.conf.medium { color: #8a5a00; background: #fdf3e2; border-color: #f0d8a8; }
.conf.low    { color: var(--muted); background: var(--code-bg); border-color: var(--border); }
@media (prefers-color-scheme: dark) {
  .conf.high   { color: #f6a6a6; background: #3a1a1a; border-color: #6a2e2e; }
  .conf.medium { color: #e8c07a; background: #382a14; border-color: #5e4a22; }
}
.ident.box {
  font-size: 1rem;
  border-radius: 8px;
  padding: .35rem .7rem;
  white-space: normal;
  margin: .3rem 0 .7rem;
}
.ident.box .muted { color: var(--muted); }
/* Hover/focus "what is this?" popover — no JS, no click state to get stuck
   in: it shows while the pointer is over the ? (or the box itself) and on
   keyboard focus, and disappears on its own. The ? badge is always visible
   but muted, brightening on hover. */
.whatis { display: inline-block; position: relative; vertical-align: middle; margin-left: .35rem; }
.whatis .q {
  display: inline-flex; align-items: center; justify-content: center;
  width: .95rem; height: .95rem;
  border: 1px solid var(--db-border); border-radius: 50%;
  font-size: .68rem; font-weight: 600; line-height: 1;
  color: var(--db-fg); background: var(--bg);
  opacity: .6; cursor: help; user-select: none;
}
.whatis:hover .q, .whatis:focus-within .q { opacity: 1; }
.whatis.meas .q {
  color: var(--meas-fg);
  border-color: var(--meas-border);
}
.whatis.wire .q {
  color: var(--tag-fg);
  border-color: var(--tag-border);
}
.whatis .pop {
  display: none; position: absolute; z-index: 10;
  top: calc(100% + .4rem); left: -1rem;
  width: min(30rem, calc(100vw - 3rem));
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
  padding: .55rem .8rem;
  font-size: .84rem; font-weight: 400; line-height: 1.5;
  white-space: normal;
}
.whatis:hover .pop, .whatis:focus-within .pop { display: block; }
/* Invisible bridge across the gap so the pointer can travel into the box
   (it contains links) without the hover breaking en route. */
.whatis .pop::before { content: ""; position: absolute; top: -.5rem; left: 0; right: 0; height: .55rem; }
/* Right-anchored variant for triggers that sit near the right edge. */
.whatis.r .pop { left: auto; right: -.5rem; }
.pop .p { display: block; margin: .3rem 0; }
details.fpx summary { cursor: pointer; }
details.fpx summary::marker { color: var(--muted); }
details.fpx > table.kv {
  margin: .5rem 0 .3rem;
  font-size: .88rem;
}
details.fpx > table.kv th {
  width: 13rem;
  font-weight: 500;
  color: var(--muted);
}
details.fpx > table.kv tr:last-child th,
details.fpx > table.kv tr:last-child td { border-bottom: none; }
.tabs { display: flex; gap: .4rem; margin: .6rem 0; flex-wrap: wrap; }
.tabs a {
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .15rem .7rem;
  color: var(--fg);
}
.tabs a.active { border-color: var(--accent); color: var(--accent); }
.pager { display: flex; gap: 1rem; margin: 1rem 0; }
.spark { width: 100%; height: 80px; color: var(--accent); border: 1px solid var(--border); border-radius: 6px; }
.fpkey code { font-size: 1rem; }
code.wrap { white-space: pre-wrap; word-break: break-word; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 2rem; }
#xt .cols article { border: 1px solid var(--border); border-radius: 8px; padding: .4rem .9rem .6rem; margin-bottom: 1rem; }
#xt h3 { margin-top: .5rem; }
