:root {
  color-scheme: light dark;
  --bg: #fbfbfa; --fg: #1d1d1f; --muted: #666; --line: #ddd; --card: #fff;
  --good: #1a7f37; --warn: #9a6700; --bad: #cf222e; --info: #0969da;
  --t0: #e8f0fe; --t1: #fef3e0; --t2: #eaf7ee; --t3: #f6e8fb; --t4: #e9f6f8; --t5: #f3f3e6;
  --exposed: #ffd7d5; --ech: #c9f0d2; --lit: #ffe066;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214; --fg: #e6e6e6; --muted: #9a9a9a; --line: #333; --card: #1a1b1e;
    --good: #3fb950; --warn: #d29922; --bad: #f85149; --info: #58a6ff;
    --t0: #1c2a40; --t1: #3a2c14; --t2: #17301f; --t3: #2f1d38; --t4: #15303a; --t5: #2c2c1c;
    --exposed: #5c1f1c; --ech: #18432a; --lit: #6b5a00;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); }
header { display: flex; flex-wrap: wrap; gap: 1rem; align-items: baseline; padding: .75rem 1.5rem; border-bottom: 1px solid var(--line); }
header h1 { margin: 0; font-size: 1.2rem; }
nav a { margin-right: 1rem; color: var(--info); text-decoration: none; }
nav a[aria-current] { color: var(--fg); font-weight: 600; }
main { min-width: 0; max-width: 72rem; margin: 0 auto; padding: 1rem 1.5rem 3rem; }
section { margin: 1.5rem 0; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
.hint { color: var(--muted); margin: 0 0 .75rem; }
.verdict { border-left: 6px solid; padding: 1rem 1.25rem; background: var(--card); border-radius: 6px; }
.verdict h2 { font-size: 1.4rem; margin: .1rem 0 .4rem; }
.verdict p { margin: .3rem 0; }
.verdict .code { color: var(--muted); font: 12px ui-monospace, monospace; }
.sev-label { font: 600 12px ui-monospace, monospace; letter-spacing: .05em; }
.sev-good { border-color: var(--good); } .sev-good .sev-label, td.sev-good { color: var(--good); }
.sev-warn { border-color: var(--warn); } .sev-warn .sev-label, td.sev-warn { color: var(--warn); }
.sev-bad { border-color: var(--bad); } .sev-bad .sev-label, td.sev-bad { color: var(--bad); }
.sev-info { border-color: var(--info); } .sev-info .sev-label, td.sev-info { color: var(--info); }
.caveats { margin: .5rem 0 0; padding-left: 1.2rem; color: var(--muted); }
.actions { display: flex; gap: .5rem; align-items: center; margin: .75rem 0; }
button { font: inherit; padding: .35rem .9rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--fg); cursor: pointer; }
button:disabled { opacity: .5; cursor: wait; }
.status { color: var(--muted); font-size: .9rem; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .3rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv th { width: 16rem; font-weight: 500; color: var(--muted); }
.kv td { overflow-wrap: anywhere; }
.diff td, .diff th { font: 13px ui-monospace, monospace; }
/* Field names wrap only between words; values wrap at ", " and break long
   cipher names only when nothing else fits (word-break squeezed the field
   column to two characters). */
.diff th { white-space: normal; overflow-wrap: normal; min-width: 10ch; width: 12ch; }
.diff td { overflow-wrap: anywhere; min-width: 18ch; }
.diff td.note { min-width: 12ch; }
.diff tr.differ td.note { color: var(--warn); }
.diff tr.same td.note { color: var(--muted); }
.hosts td.code { font: 13px ui-monospace, monospace; }
.hosts small { color: var(--muted); font-weight: 400; }
.hexview { display: grid; grid-template-columns: minmax(14rem, 24rem) minmax(0, 1fr); gap: 1rem; align-items: start; }
/* minmax(0, …): a 1fr track grows to the hex rows' width and widens the whole page. */
@media (max-width: 900px) { .hexview { grid-template-columns: minmax(0, 1fr); } }
.hex { font: 12.5px/1.45 ui-monospace, Menlo, monospace; overflow: auto; max-height: 34rem; background: var(--card); padding: .5rem; border-radius: 6px; border: 1px solid var(--line); }
.hex-row { white-space: nowrap; }
.hex .off { color: var(--muted); margin-right: 1ch; }
.hex .bytes .b { display: inline-block; width: 2.6ch; text-align: center; cursor: pointer; }
.hex .ascii { margin-left: 1ch; }
.hex .ascii .b { display: inline-block; width: 1.1ch; text-align: center; }
.t0 { background: var(--t0); } .t1 { background: var(--t1); } .t2 { background: var(--t2); }
.t3 { background: var(--t3); } .t4 { background: var(--t4); } .t5 { background: var(--t5); }
.hex .ech { background: var(--ech); }
.hex .exposed, .swatch.exposed { background: var(--exposed); font-weight: 700; }
.swatch.ech { background: var(--ech); }
.swatch { padding: 0 .3em; border-radius: 3px; }
.hex .lit { background: var(--lit); outline: 1px solid var(--warn); }
.fields { list-style: none; margin: 0; padding: 0; max-height: 34rem; overflow-y: auto; font: 12.5px/1.4 ui-monospace, monospace; border: 1px solid var(--line); border-radius: 6px; }
.fields li { padding: .15rem .5rem; cursor: default; border-bottom: 1px solid var(--line); }
.fields li:focus, .fields li:hover { outline: 2px solid var(--lit); }
.fields .d1 { padding-left: 1.5rem; } .fields .d2 { padding-left: 2.5rem; } .fields .d3 { padding-left: 3.5rem; }
.fields .fval { color: var(--muted); margin-left: .75ch; word-break: break-all; }
.field-info { font: 13px ui-monospace, monospace; min-height: 1.5em; }
pre { overflow-x: auto; background: var(--card); padding: .75rem; border-radius: 6px; font-size: 12px; }
.prose { max-width: 52rem; }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.25rem; margin: 0; }
.card h3 { margin-top: 0; }
.flow { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font: 13px ui-monospace, monospace; }
.flow span:not(.arrow) { border: 1px solid var(--line); padding: .15rem .5rem; border-radius: 4px; }
.flow .arrow { color: var(--muted); }
.walk { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: clamp(1rem, 3vw, 2rem); }
.walk-head, .walk-foot { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.walk-head select { font: inherit; max-width: 100%; }
.walk-head label { min-width: 0; color: var(--muted); }
.path { display: flex; align-items: center; margin: 1.5rem 0; }
.path button { flex: 1; min-height: 3rem; }
.path button + button { margin-left: 1rem; position: relative; }
.path button + button::before { content: ""; width: 1rem; height: 1px; background: var(--line); position: absolute; right: 100%; top: 50%; }
.path [aria-current="step"] { color: var(--card); background: var(--fg); }
#step-detail dl { display: flex; gap: 1rem 3rem; flex-wrap: wrap; }
#step-detail dt, #position { color: var(--muted); font-size: .9rem; }
#step-detail dd { margin: .2rem 0; font: 600 1.05rem ui-monospace, monospace; overflow-wrap: anywhere; }
#learn { margin: 1rem 0; }
#learn summary { cursor: pointer; }
#learn a { color: var(--info); }
.walk-foot { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
button:disabled { cursor: default; }
.fields button { font: inherit; background: transparent; border: 0; padding: .15rem; text-align: left; width: 100%; }
.fields button[aria-pressed="true"] { outline: 2px solid var(--warn); outline-offset: -2px; }
.table-scroll { overflow-x: auto; }
.actions { flex-wrap: wrap; }
[hidden] { display: none !important; }
.pair { border-top: 1px solid var(--line); margin: 1.25rem 0 0; padding-top: 1rem; }
.pair h3 { margin: 0 0 .25rem; }
.pair-table { table-layout: fixed; }
.pair-table thead th { width: 38%; } .pair-table thead th:first-child { width: 24%; }
.pair-table th small { display: block; color: var(--muted); font-weight: 400; }
.pair-table tbody th { font-weight: 500; color: var(--muted); }
.pair-table td { font: 600 14px ui-monospace, monospace; overflow-wrap: anywhere; }
.pair-table tr.differ td { background: color-mix(in srgb, var(--warn) 10%, transparent); }
.pair-table td button { font: inherit; padding: .1rem .5rem; color: var(--info); }
.pair-table td button[aria-pressed="true"] { outline: 2px solid var(--warn); }
.pair-table tr.divergence > td { font: inherit; background: none; border-left: 3px solid var(--warn); padding: .5rem .8rem; }
.pair-table tr.divergence summary { cursor: pointer; font-weight: 600; }
.pair-table tr.divergence p { margin: .5rem 0; font-weight: 400; }
.pair-table tr.divergence a { color: var(--info); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media(max-width: 600px) {
  main { padding-inline: .75rem; }
  .path button { font-size: .9rem; padding-inline: .25rem; }
  .kv th { width: auto; }
}
.intro { margin: 0 0 1rem; color: var(--muted); font-size: .95rem; }
.intro p { margin: 0; }
.intro a { color: var(--info); }
.intro summary { cursor: pointer; margin-top: .25rem; width: fit-content; }
.intro ol { margin: .4rem 0 0; padding-left: 1.3rem; }
.prose a { color: var(--info); }
.guide-map dt { font-weight: 600; margin-top: .6rem; }
.guide-map dd { margin: .1rem 0 0; }
.hex.collapsed .hex-row.extra { display: none; }
.hex-gap { display: none; width: 100%; margin: .15rem 0; padding: .1rem; font: inherit; color: var(--muted); border-style: dashed; }
.hex.collapsed .hex-gap { display: block; }
.no-ech { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--info); border-radius: 6px; padding: .75rem 1.25rem; }
.no-ech h2 { margin-top: 0; }
.no-ech p, .no-ech ol { margin: .4rem 0; }
.no-ech a { color: var(--info); }
.observer th[scope="row"] { font-weight: 500; color: var(--muted); width: 12rem; }
.observer td:nth-child(2) { font: 13px ui-monospace, monospace; overflow-wrap: anywhere; }
code { font: .9em ui-monospace, monospace; }
/* Guide diagrams. Colors come from the theme, so they work in dark mode. */
.diagram { margin: 1rem 0; }
.diagram svg { width: 100%; height: auto; max-width: 40rem; display: block; }
.diagram figcaption { color: var(--muted); font-size: .9rem; margin-top: .4rem; }
.dg text { fill: var(--fg); font: 13px system-ui, sans-serif; }
.dg text.mono { font: 12px ui-monospace, monospace; }
.dg text.small { font-size: 11px; fill: var(--muted); }
.dg .box { fill: var(--card); stroke: var(--muted); stroke-width: 1; }
.dg .line { stroke: var(--muted); stroke-width: 1; fill: none; }
.dg .dash { stroke-dasharray: 4 3; }
.dg .clear { fill: var(--exposed); stroke: var(--bad); }
.dg .enc { fill: var(--ech); stroke: var(--good); }
.dg .band { fill: var(--ech); opacity: .45; }
.dg .arrow-plain { stroke: var(--bad); stroke-width: 1.5; }
.dg .arrow-enc { stroke: var(--good); stroke-width: 1.5; }
.dg marker path { fill: var(--muted); }
.hosts-guide td:nth-child(1) { font: 13px ui-monospace, monospace; overflow-wrap: anywhere; }
