:root {
  --bg: #0a0c10;
  --bg-2: #0e1117;
  --panel: #12161d;
  --panel-2: #161b24;
  --line: #222934;
  --line-2: #2c3542;
  --text: #d7dde5;
  --text-hi: #f2f5f8;
  --muted: #818d9c;
  --muted-2: #5c6675;
  --red: #e5484d;
  --red-dim: #8a2a2d;
  --amber: #e8a13a;
  --green: #46b872;
  --blue: #5b9bd5;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
.wrap { width: min(1080px, 100% - 40px); margin-inline: auto; }
.muted { color: var(--muted); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd, pre, time { font-family: var(--mono); }
code { font-size: .88em; background: rgba(255,255,255,.05); padding: .1em .38em; border-radius: 4px; color: #c7d0da; }
pre code { background: none; padding: 0; }
.state-bad { color: var(--red); font-weight: 600; }
.state-ok { color: var(--green); font-weight: 600; }

/* ---------- TLP strip ---------- */
.tlp {
  background: #000;
  color: #c9d2dd;
  border-bottom: 1px solid var(--line);
  font: 500 11px/1 var(--mono);
  letter-spacing: .14em;
  white-space: nowrap;
  overflow: hidden;
  padding: 7px 0;
}
.tlp span { margin-right: 3.5em; opacity: .7; display: inline-block; animation: slide 48s linear infinite; }
.tlp { display: flex; }
@keyframes slide { to { transform: translateX(-100%); } }

/* ---------- masthead ---------- */
.masthead { border-bottom: 1px solid var(--line); background: var(--bg-2); }
.masthead__inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 0; flex-wrap: wrap; }
.masthead__brand { display: flex; align-items: center; gap: 12px; color: var(--red); }
.mark { width: 34px; height: 34px; flex: none; }
.masthead__brand strong { display: block; color: var(--text-hi); font-size: 15px; letter-spacing: .01em; }
.masthead__brand span { display: block; color: var(--muted); font-size: 12px; }
.masthead__meta { display: flex; gap: 18px; font: 500 12px var(--mono); color: var(--muted); flex-wrap: wrap; }
.masthead__meta .rev { color: var(--amber); }
.langtoggle { display: inline-flex; align-items: center; gap: 6px; font: 600 12px var(--mono); color: var(--muted-2); background: var(--panel); border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 10px; cursor: pointer; letter-spacing: .04em; }
.langtoggle:hover { border-color: var(--line-2); color: var(--muted); }
.langtoggle .langsep { color: var(--line-2); }
.langtoggle [data-lang] { padding: 1px 2px; border-radius: 3px; }
.langtoggle [data-lang].is-active { color: var(--red); }

/* ---------- banner ---------- */
.banner { border-bottom: 1px solid var(--line); background:
  linear-gradient(180deg, rgba(229,72,77,.06), transparent 60%); }
.banner__inner { display: grid; grid-template-columns: 1.3fr .9fr; gap: 36px; padding: 44px 0 40px; align-items: start; }
.eyebrow { font: 600 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--red); margin: 0 0 14px; }
.eyebrow::before { content: "● "; }
h1 { font: 800 clamp(34px, 6vw, 54px)/1.02 var(--sans); letter-spacing: -.02em; margin: 0 0 14px; color: var(--text-hi); }
h1 .alias { display: block; font: 500 clamp(18px,3vw,24px) var(--mono); color: var(--muted); letter-spacing: 0; margin-top: 6px; }
.subtitle { font-size: 18px; color: var(--text); max-width: 54ch; margin: 0 0 20px; }
.banner__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font: 600 12px var(--mono); padding: 6px 11px; border: 1px solid var(--line-2); border-radius: 6px; color: var(--muted); background: var(--panel); }
.tag--crit { color: #fff; background: var(--red-dim); border-color: var(--red); }

.scorecard { border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); overflow: hidden; }
.scorecard__score { display: flex; align-items: baseline; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(229,72,77,.12), transparent); }
.scorecard__score b { font: 800 44px/1 var(--mono); color: var(--red); }
.scorecard__score span { font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.scorecard__over { color: var(--amber); letter-spacing: .04em; text-transform: none; font-weight: 500; }
.scorecard dl { margin: 0; }
.scorecard dl div { padding: 12px 20px; border-bottom: 1px solid var(--line); }
.scorecard dl div:last-child { border-bottom: 0; }
.scorecard dt { font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 4px; }
.scorecard dd { margin: 0; font: 500 12.5px var(--mono); color: var(--text); overflow-wrap: anywhere; line-height: 1.5; }

/* ---------- toc ---------- */
.toc { position: sticky; top: 0; z-index: 40; background: rgba(10,12,16,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.toc__inner { display: flex; gap: 2px; overflow-x: auto; padding: 8px 0; scrollbar-width: none; }
.toc__inner::-webkit-scrollbar { display: none; }
.toc a { font: 500 13px var(--mono); color: var(--muted); padding: 6px 11px; border-radius: 6px; white-space: nowrap; }
.toc a:hover { color: var(--text-hi); background: var(--panel); text-decoration: none; }

/* ---------- document ---------- */
.doc { padding: 20px 0 40px; }
.sec { padding: 32px 0; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
h2 { font: 700 25px/1.2 var(--sans); color: var(--text-hi); margin: 0 0 18px; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 12px; }
.sec__n { font: 700 14px var(--mono); color: var(--red); border: 1px solid var(--line-2); border-radius: 6px; padding: 3px 9px; flex: none; }
h3 { font: 700 16px var(--sans); color: var(--text-hi); margin: 26px 0 12px; }
p { margin: 0 0 14px; }
.lead { font-size: 17.5px; color: var(--text-hi); }
.sec p:last-child { margin-bottom: 0; }

.note { border: 1px solid var(--line-2); border-left-width: 3px; border-radius: 0 8px 8px 0; padding: 14px 18px; background: var(--panel); font-size: 15px; margin: 20px 0 0; }
.note--warn { border-left-color: var(--amber); }
.note--ok { border-left-color: var(--green); }
.note strong { color: var(--text-hi); }

/* code figures */
.code { margin: 22px 0 0; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: #070a0e; }
.code figcaption { font: 500 12px var(--mono); color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.code pre { margin: 0; padding: 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.7; color: #c3ccd6; }
.c { color: var(--muted-2); } .pr { color: var(--blue); } .cmd { color: var(--red); } .ok { color: var(--green); } .dm { color: var(--amber); }

/* chain */
.chain { list-style: none; counter-reset: s; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.chain li { counter-increment: s; background: var(--panel); padding: 16px 18px; position: relative; }
.chain li::before { content: counter(s, decimal-leading-zero); position: absolute; top: 14px; right: 16px; font: 700 22px var(--mono); color: rgba(255,255,255,.05); }
.chain__ph { font: 600 11px var(--mono); letter-spacing: .08em; color: var(--amber); text-transform: uppercase; }
.chain p { margin: 7px 0 0; font-size: 14.5px; }

/* tables */
.table-wrap { margin: 18px 0 0; border: 1px solid var(--line-2); border-radius: 10px; overflow: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 520px; }
table.data th, table.data td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th { font: 600 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--panel-2); position: sticky; top: 0; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: rgba(255,255,255,.02); }
table.data--mono td { font-family: var(--mono); font-size: 13px; }

.pill { display: inline-block; font: 600 12px var(--mono); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill--red { background: rgba(229,72,77,.14); color: var(--red); }
.pill--amber { background: rgba(232,161,58,.14); color: var(--amber); }
.pill--green { background: rgba(70,184,114,.14); color: var(--green); }

/* mitigation / refs lists */
.mit, .refs { margin: 18px 0 0; padding-left: 0; list-style: none; counter-reset: m; }
.mit li { counter-increment: m; position: relative; padding: 12px 16px 12px 52px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: var(--panel); font-size: 15px; }
.mit li::before { content: counter(m); position: absolute; left: 14px; top: 11px; width: 24px; height: 24px; border-radius: 6px; background: var(--red-dim); color: #fff; font: 700 13px var(--mono); display: grid; place-items: center; }
.mit strong { color: var(--text-hi); }

.refs { counter-reset: r; }
.refs li { counter-increment: r; position: relative; padding: 10px 16px 10px 40px; font-size: 14px; border-bottom: 1px solid var(--line); }
.refs li::before { content: "[" counter(r) "]"; position: absolute; left: 0; top: 10px; font: 600 12.5px var(--mono); color: var(--muted-2); }
.refs__src { display: inline-block; font: 600 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--amber); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 6px; margin-right: 8px; }
.refs__link { font-family: var(--mono); font-size: .92em; color: var(--blue); }

/* timeline */
.timeline { list-style: none; margin: 20px 0 0; padding-left: 20px; border-left: 2px solid var(--line-2); }
.timeline li { position: relative; padding: 0 0 20px 20px; }
.timeline li::before { content: ""; position: absolute; left: -27px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--red); }
.timeline time { font: 600 13px var(--mono); color: var(--amber); }
.timeline p { margin: 3px 0 0; font-size: 14.5px; }

.sec--ack h3:first-child { margin-top: 0; }
.revhist { list-style: none; padding: 0; margin: 12px 0 0; font: 500 13.5px var(--mono); color: var(--muted); }
.revhist li { padding: 5px 0; }
.revhist b { color: var(--text); }

/* ---------- terminal ---------- */
.term {
  margin: 22px 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  overflow: hidden;
  background: #04070b;
  box-shadow: 0 24px 60px -34px rgba(0,0,0,.9);
}
.term__bar { display: flex; align-items: center; gap: 12px; padding: 9px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.term__dots { display: flex; gap: 7px; }
.term__dots i { width: 11px; height: 11px; border-radius: 50%; background: #3a424d; }
.term__dots i:first-child { background: #e5484d; }
.term__dots i:nth-child(2) { background: #e8a13a; }
.term__dots i:nth-child(3) { background: #46b872; }
.term__title { font: 500 12.5px var(--mono); color: var(--muted); margin-inline: auto; }
.term__badge { font: 500 10.5px var(--mono); letter-spacing: .08em; color: var(--muted-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 4px 9px; white-space: nowrap; }
.term__badge.breach { color: #fff; background: var(--red); border-color: var(--red); animation: led .7s infinite; }
@keyframes led { 50% { opacity: .4; } }

.term__screen {
  height: min(560px, 74vh);
  overflow-y: auto;
  padding: 14px 16px 16px;
  font: 13.5px/1.6 var(--mono);
  color: #c3ccd6;
  cursor: text;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.term__screen::-webkit-scrollbar { width: 9px; }
.term__screen::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; }
.term__row { white-space: pre-wrap; overflow-wrap: anywhere; animation: tfade .1s ease-out; }
@keyframes tfade { from { opacity: 0; } }
.term__err { color: #f08a8e; }
.term__dim { color: var(--muted-2); }
.term__motd { color: #8fb7d6; }
.term__file { color: #aeb8c4; }
.term__dir { color: #6ab0e8; font-weight: 600; }
.term__k { color: var(--amber); }
.term__cmd { color: var(--text-hi); }
.term__prompt { color: var(--green); font-weight: 600; }
.term__prompt--agent { font-weight: 700; }
.term__agentline { white-space: pre-wrap; }
.term__think { color: var(--muted); }

/* agent colors */
.ag { font-weight: 700; }
.ag--claude { color: #d9893f; }
.ag--gpt { color: #19c37d; }
.ag--gemini { color: #5b9bd5; }
.ag--copilot { color: #b78aff; }
.ag--grok { color: #d7dde5; }
.ag--llama { color: #e8a13a; }

.term__line { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.term__field {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  color: var(--text-hi);
  font: inherit;
  caret-color: var(--green);
  padding: 0;
}
.term__hint { font-size: 13px; margin-top: 0; }
.term__hint code { font-size: .92em; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--bg-2); padding: 32px 0 48px; }
.footer__inner { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.footer p { font-size: 14px; margin: 0 0 6px; }
.footer strong { color: var(--text-hi); }
.disclaimer { border: 1px solid var(--line-2); border-radius: 8px; padding: 14px 16px; background: var(--panel); font-size: 13.5px; color: var(--muted); }
.disclaimer strong { color: var(--amber); }

/* ---------- overlay / effects ---------- */
.overlay { position: fixed; inset: 0; z-index: 200; }
.overlay canvas { width: 100%; height: 100%; display: block; }
.bsod { position: fixed; inset: 0; background: #0a1a3a; color: #e6ecf5; z-index: 300; display: grid; place-items: center; font: 17px/1.6 var(--sans); padding: 24px; cursor: pointer; }
.bsod > div { max-width: 680px; }
.bsod big { font-size: 90px; line-height: 1; display: block; margin-bottom: 18px; }
.bsod code { background: rgba(255,255,255,.08); color: #c9d2dd; }
.shake { animation: shake .5s; }
@keyframes shake { 20% { transform: translate(-7px,2px); } 40% { transform: translate(7px,-2px); } 60% { transform: translate(-5px,2px); } 80% { transform: translate(4px,-1px); } }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .banner__inner { grid-template-columns: 1fr; gap: 24px; }
  .chain { grid-template-columns: 1fr; }
  .footer__inner { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 15.5px; }
  .masthead__inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .term__screen { height: 72vh; font-size: 12.5px; }
  .term__title { display: none; }
  h2 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
