/* ==========================================================
   Sub-pages: /cv /research /talks /uses /security /ctf /404
   Builds on tokens + components from style.css
   ========================================================== */

.page {
  position: relative; z-index: 2;
  max-width: 1120px; margin: 0 auto;
  padding: 132px var(--gutter) 40px;
  min-height: 70vh;
}
.page-hero { margin-bottom: clamp(36px, 6vw, 72px); }
.crumb {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
  padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px;
  background: rgba(255,255,255,.03);
}
.crumb b { color: var(--red); font-weight: 500; }
.page-title {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(44px, 8vw, 104px); line-height: .95; letter-spacing: -0.04em;
  margin: 22px 0 18px;
}
.page-title .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.page-lead { font-size: clamp(17px, 1.6vw, 21px); color: var(--muted); max-width: 720px; margin: 0; }
.page-lead b { color: #fff; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 30px; }
.tabs a {
  font-family: var(--mono); font-size: 12.5px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: rgba(255,255,255,.02);
  transition: all .2s;
}
.tabs a:hover { color: #fff; border-color: var(--line-2); }
.tabs a.on { color: #fff; border-color: rgba(255,45,85,.6); background: rgba(255,45,85,.12); }

.sub-nav-links a.on { color: #fff; background: rgba(255,45,85,.12); }

.block { margin-top: clamp(48px, 7vw, 88px); }
.block-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; }
.block-head h2 { font-family: var(--display); font-size: clamp(24px, 3vw, 34px); letter-spacing: -0.02em; margin: 0; }
.block-head .sec-num { margin: 0; }
.block-head .sec-num::after { display: none; }

.panel {
  position: relative;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); padding: clamp(20px, 3vw, 32px);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono-label { font-family: var(--mono); font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--red); }
.pill {
  /* a label, not a button: no outline, no pill shape */
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); cursor: default;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: currentColor; opacity: .5; flex: none; }
.pill.red { color: var(--red); } .pill.red::before { opacity: 1; }
.pill.green { color: var(--green); } .pill.green::before { opacity: 1; }
.pill.amber { color: #ffb547; } .pill.amber::before { opacity: 1; }
.cta-band {
  margin-top: clamp(56px, 8vw, 100px);
  border-radius: 24px; padding: clamp(28px, 5vw, 56px);
  background:
    radial-gradient(600px 300px at 90% 0%, rgba(255,45,85,.25), transparent 60%),
    linear-gradient(140deg, rgba(255,255,255,.05), rgba(255,255,255,.01)), #0c0e13;
  border: 1px solid rgba(255,45,85,.25);
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.cta-band h3 { font-family: var(--display); font-size: clamp(24px, 3.4vw, 40px); letter-spacing: -0.03em; margin: 0 0 6px; line-height: 1.05; }
.cta-band p { margin: 0; color: var(--muted); }
.cta-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- research ---------------- */
.cve {
  position: relative; overflow: hidden;
  border-radius: 26px; border: 1px solid rgba(255,45,85,.3);
  background:
    radial-gradient(700px 400px at 100% 0%, rgba(255,45,85,.22), transparent 55%),
    linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.01) 50%), #0c0e13;
  padding: clamp(24px, 4vw, 48px);
}
.cve::after {
  content: "CVE"; position: absolute; right: -10px; bottom: -40px;
  font-family: var(--display); font-weight: 900; font-size: clamp(120px, 20vw, 240px); line-height: 1;
  color: transparent; -webkit-text-stroke: 1px rgba(255,45,85,.18); pointer-events: none;
}
.cve-id {
  font-family: var(--mono); font-weight: 700; font-size: clamp(22px, 3.4vw, 40px);
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -0.01em;
}
.cve h2 { font-family: var(--display); font-size: clamp(24px, 3.6vw, 44px); overflow-wrap: anywhere; letter-spacing: -0.03em; line-height: 1.05; margin: 10px 0 14px; max-width: 760px; }
.cve-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 26px; }
.cve-body { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; position: relative; z-index: 1; }
.cve-body p { color: #c3c8d2; margin: 0 0 14px; }
.cve-flow { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.cve-flow li {
  counter-increment: step; position: relative;
  padding: 0 0 18px 44px; color: #c3c8d2; font-size: 15px;
}
.cve-flow li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: -1px;
  font-family: var(--mono); font-size: 12px; color: var(--red);
  width: 30px; height: 24px; border: 1px solid rgba(255,45,85,.4); border-radius: 6px;
  display: grid; place-items: center; background: rgba(255,45,85,.08);
}
.cve-flow li::after { content: ""; position: absolute; left: 15px; top: 26px; bottom: 2px; width: 1px; background: var(--line-2); }
.cve-flow li:last-child::after { display: none; }
.cve-flow b { color: #fff; display: block; font-size: 15.5px; }
.code {
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
  background: #07080b; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; overflow-x: auto; white-space: pre; color: #c7ccd6;
}
.code .r { color: var(--red); } .code .g { color: var(--green); } .code .m { color: var(--dim); }
.focus-card h3 { font-size: 18px; margin: 14px 0 6px; font-weight: 600; }
.focus-card p { margin: 0; color: var(--muted); font-size: 15px; }

/* ---------------- talks ---------------- */
.talk {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 0; overflow: hidden;
  border-radius: 26px; border: 1px solid var(--line-2); background: #0c0e13;
}
.talk-poster {
  position: relative; min-height: 380px; padding: 32px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(500px 340px at 20% 10%, rgba(255,45,85,.55), transparent 60%),
    radial-gradient(420px 300px at 90% 100%, rgba(255,181,71,.35), transparent 60%),
    linear-gradient(160deg, #1a0b12, #07080b);
  overflow: hidden;
}
.talk-poster::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px) 0 0 / 100% 22px;
  mask-image: linear-gradient(to bottom, transparent, #000 40%, transparent);
}
.talk-poster h2 { position: relative; font-family: var(--display); font-weight: 900; font-size: clamp(34px, 4.6vw, 58px); line-height: .95; letter-spacing: -0.04em; margin: 0; }
.talk-poster .mono-label { position: relative; color: #fff; opacity: .8; }
.talk-glyph { position: absolute; right: 26px; top: 26px; font-family: var(--mono); font-size: 13px; color: rgba(255,255,255,.6); text-align: right; line-height: 1.6; }
.talk-info { padding: clamp(24px, 3.4vw, 40px); display: flex; flex-direction: column; gap: 16px; }
.talk-info p { margin: 0; color: #c3c8d2; }
.talk-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.talk-points li { padding-left: 26px; position: relative; color: #c3c8d2; font-size: 15px; }
.talk-points li::before { content: "▹"; position: absolute; left: 4px; color: var(--red); }
.topic { display: flex; flex-direction: column; gap: 10px; }
.topic-num { font-family: var(--display); font-weight: 900; font-size: 44px; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topic h3 { font-size: 19px; margin: 0; font-weight: 600; }
.topic p { margin: 0; color: var(--muted); font-size: 15px; }
.formats { display: flex; gap: 10px 24px; flex-wrap: wrap; }

/* ---------------- uses ---------------- */
.kit { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.kit-group { padding: 0; overflow: hidden; }
.kit-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.kit-head h3 { margin: 0; font-family: var(--mono); font-size: 12.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--red); font-weight: 500; }
.kit-list { list-style: none; margin: 0; padding: 6px 0; }
.kit-list li { display: grid; grid-template-columns: 170px 1fr; gap: 14px; padding: 11px 22px; border-top: 1px dashed var(--line); }
.kit-list li:first-child { border-top: 0; }
.kit-list b { color: #fff; font-weight: 600; font-size: 15px; }
.kit-list span { color: var(--muted); font-size: 14.5px; }
.principles { counter-reset: p; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.principle { counter-increment: p; }
.principle::before { content: "0" counter(p); font-family: var(--mono); color: var(--red); font-size: 12px; letter-spacing: .1em; }
.principle h3 { margin: 10px 0 6px; font-size: 18px; font-weight: 600; }
.principle p { margin: 0; color: var(--muted); font-size: 15px; }

/* ---------------- security ---------------- */
.posture { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.02);
}
.check .ico {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 13px;
  background: rgba(255,255,255,.05); color: var(--muted); transition: all .4s;
}
.check.ok .ico { background: rgba(61,255,154,.12); color: var(--green); }
.check.bad .ico { background: rgba(255,45,85,.12); color: var(--red); }
.check b { display: block; font-size: 14.5px; font-weight: 600; }
.check small { display: block; color: var(--dim); font-family: var(--mono); font-size: 11.5px; margin-top: 2px; word-break: break-all; }
.check .pill { white-space: nowrap; }
.grade {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
.grade-ring {
  --p: 0; width: 120px; height: 120px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--green) calc(var(--p) * 1%), rgba(255,255,255,.07) 0);
  display: grid; place-items: center; transition: --p 1s;
}
.grade-ring span {
  width: 96px; height: 96px; border-radius: 50%; background: #0c0e13; display: grid; place-items: center;
  font-family: var(--display); font-weight: 900; font-size: 38px; color: #fff;
}
.prose { color: #c3c8d2; max-width: 780px; }
.prose h3 { color: #fff; font-size: 20px; margin: 30px 0 8px; }
.prose p, .prose li { font-size: 16px; }
.prose ul { padding-left: 20px; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--red); }
.prose a { color: #fff; border-bottom: 1px solid rgba(255,45,85,.6); }
.hof { display: flex; align-items: center; gap: 14px; }
.hof-empty {
  font-family: var(--mono); font-size: 13px; color: var(--dim);
  border: 1px dashed var(--line-2); border-radius: 12px; padding: 16px 18px; width: 100%;
}

/* ---------------- ctf ---------------- */
.ctf-board { display: grid; gap: 12px; }
.flag-row {
  display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 18px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel);
  transition: border-color .4s, background .4s;
}
.flag-row.solved { border-color: rgba(61,255,154,.45); background: rgba(61,255,154,.05); }
.flag-num {
  width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 900; font-size: 22px;
  border: 1px solid var(--line-2); background: #0c0e13; color: var(--muted); transition: all .4s;
}
.flag-row.solved .flag-num { background: var(--green); color: #04130b; border-color: var(--green); box-shadow: 0 0 30px rgba(61,255,154,.35); }
.flag-meta h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.flag-hint { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.flag-hint button { color: var(--red-2); font-family: inherit; font-size: inherit; text-decoration: underline; text-underline-offset: 3px; padding: 0; }
.flag-hint .hint-text { color: #ffb547; }
.flag-form { display: flex; gap: 8px; margin-top: 12px; }
.flag-form input {
  flex: 1; min-width: 0; font-family: var(--mono); font-size: 14px; color: #fff;
  background: #07080b; border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 13px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.flag-form input:focus { border-color: rgba(255,45,85,.6); box-shadow: 0 0 0 3px rgba(255,45,85,.15); }
.flag-form input.shake { animation: shake .4s; border-color: var(--red); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.flag-form button {
  font-family: var(--mono); font-size: 13px; font-weight: 700; padding: 0 16px; border-radius: 10px;
  background: var(--red); color: #fff;
}
.flag-row.solved .flag-form { display: none; }
.flag-state { font-family: var(--mono); font-size: 12px; }
.ctf-progress { height: 6px; border-radius: 6px; background: rgba(255,255,255,.06); overflow: hidden; margin: 22px 0 10px; }
.ctf-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), #b6ff3d); transition: width .8s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 14px rgba(61,255,154,.5); }
.ctf-win {
  margin-top: 26px; border-radius: 26px; padding: clamp(26px, 5vw, 48px); text-align: center;
  border: 1px solid rgba(61,255,154,.45);
  background: radial-gradient(600px 300px at 50% 0%, rgba(61,255,154,.18), transparent 60%), #0b120e;
  animation: pop .6s cubic-bezier(.2,.9,.3,1.2);
}
.ctf-win[hidden] { display: none; }
.ctf-win h2 { font-family: var(--display); font-size: clamp(30px, 5vw, 56px); letter-spacing: -0.03em; margin: 12px 0; line-height: 1; }
.ctf-win p { color: #c3c8d2; max-width: 560px; margin: 0 auto 22px; }
.ctf-win .mono-label { color: var(--green); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 120; }

/* ---------------- classified ---------------- */
.dossier {
  position: relative; max-width: 760px; margin: 0 auto;
  border-radius: 8px; padding: clamp(26px, 5vw, 56px);
  background: #e9e3d3; color: #1a1712;
  box-shadow: 0 40px 120px rgba(0,0,0,.6);
  font-family: var(--mono);
  transform: rotate(-.6deg);
}
.dossier h1 { font-family: var(--display); font-size: clamp(28px, 5vw, 48px); margin: 0 0 10px; letter-spacing: -0.02em; }
.dossier p { font-size: 14.5px; line-height: 1.75; }
.stamp {
  position: absolute; right: 26px; top: 24px; transform: rotate(9deg);
  border: 3px solid #c8102e; color: #c8102e; font-weight: 700; letter-spacing: .2em;
  padding: 6px 14px; font-size: 14px; border-radius: 4px; opacity: .85;
}
.redact { background: #1a1712; color: #1a1712; padding: 0 4px; border-radius: 2px; transition: color .3s; cursor: help; }
.redact:hover { color: #e9e3d3; }
.dossier .flagline { background: #1a1712; color: #3dff9a; padding: 12px 14px; border-radius: 6px; font-size: 14px; word-break: break-all; }

/* ---------------- 404 ---------------- */
.nf { min-height: calc(100vh - 80px); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; text-align: center; padding: 120px var(--gutter) 60px; position: relative; z-index: 2; }
.nf-code {
  font-family: var(--display); font-weight: 900; line-height: .85; letter-spacing: -0.06em;
  font-size: clamp(80px, 24vw, 300px); position: relative;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nf-code::before, .nf-code::after {
  content: attr(data-text); position: absolute; inset: 0;
  background: inherit; -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nf-code::before { animation: glitch1 2.6s infinite steps(1); text-shadow: -3px 0 rgba(54,224,255,.6); }
.nf-code::after { animation: glitch2 2.2s infinite steps(1); text-shadow: 3px 0 rgba(255,45,85,.8); }
@keyframes glitch1 { 0%, 92%, 100% { clip-path: inset(0 0 100% 0); transform: none; } 93% { clip-path: inset(20% 0 55% 0); transform: translateX(-8px); } 96% { clip-path: inset(60% 0 15% 0); transform: translateX(6px); } }
@keyframes glitch2 { 0%, 88%, 100% { clip-path: inset(0 0 100% 0); transform: none; } 89% { clip-path: inset(40% 0 30% 0); transform: translateX(8px); } 94% { clip-path: inset(5% 0 80% 0); transform: translateX(-5px); } }
.nf h1 { font-family: var(--display); font-size: clamp(22px, 3.4vw, 38px); letter-spacing: -0.02em; margin: 6px 0 14px; }
.nf-term {
  max-width: 560px; margin: 26px auto 30px; text-align: left;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.8; color: #c7ccd6;
  background: #0a0c10; border: 1px solid var(--line-2); border-radius: 14px; padding: 16px 18px;
  white-space: pre-wrap; word-break: break-word;
}
.nf-term .r { color: var(--red); } .nf-term .g { color: var(--green); } .nf-term .y { color: #febc2e; }

/* ---------------- CV (screen) ---------------- */
.cv-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.cv-doc {
  margin-top: 40px; border-radius: 22px; border: 1px solid var(--line-2);
  background: #0c0e13; padding: clamp(24px, 5vw, 64px);
  box-shadow: 0 40px 120px -40px rgba(255,45,85,.25);
}
.cv-head { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; padding-bottom: 28px; border-bottom: 1px solid var(--line-2); }
.cv-photo { width: 104px; height: 128px; border-radius: 14px; object-fit: cover; object-position: 50% 20%; background: #f4f4f4; }
.cv-name { font-family: var(--display); font-weight: 900; font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.03em; line-height: 1; margin: 0; }
.cv-title { color: var(--red); font-weight: 600; margin: 8px 0 12px; font-size: 17px; }
.cv-contact { display: flex; flex-wrap: wrap; gap: 6px 20px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.cv-contact a, .cv-contact span { display: inline-flex; align-items: center; gap: 7px; }
.cv-ico { width: 14px; height: 14px; flex: none; color: var(--red); }
.cv-contact a:hover { color: #fff; }
.cv-cols { display: grid; grid-template-columns: 1fr 300px; gap: 48px; margin-top: 32px; }
.cv-sec + .cv-sec { margin-top: 34px; }
.cv-h { font-family: var(--mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--red); margin: 0 0 16px; display: flex; align-items: center; gap: 10px; }
.cv-h::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.cv-summary { color: #c3c8d2; margin: 0; }
.cv-job { break-inside: avoid; page-break-inside: avoid; }
.cv-job + .cv-job { margin-top: 24px; }
.cv-job-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.cv-job h3 { margin: 0; font-size: 17.5px; font-weight: 700; }
.cv-job .when { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.cv-job .role { color: #fff; opacity: .9; font-size: 15px; margin-top: 2px; }
.cv-job .where { font-family: var(--mono); font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.cv-job ul { margin: 10px 0 0; padding-left: 18px; color: #c3c8d2; font-size: 14.5px; line-height: 1.55; }
.cv-job li { margin: 4px 0; }
.cv-job li::marker { color: var(--red); }
.cv-side-item { margin-bottom: 14px; break-inside: avoid; }
.cv-side-item b { display: block; font-size: 14.5px; }
.cv-side-item span { display: block; font-size: 13px; color: var(--muted); }
.cv-skills { margin: 0; font-size: 13.5px; line-height: 1.6; color: #c3c8d2; }
.cv-skills i { font-style: normal; color: var(--red); }
.cv-cred { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: center; margin-bottom: 12px; break-inside: avoid; }
.cv-cred b { display: block; font-size: 14.5px; line-height: 1.3; }
.cv-cred span:not(.cv-mark) { display: block; font-size: 13px; color: var(--muted); }
.cv-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; }
.cv-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cv-mark.plate { background: #fff; padding: 3px; }
.cv-mark.mono {
  font-family: var(--mono); font-size: 8px; font-weight: 700; color: #fff; letter-spacing: -.02em;
  background: linear-gradient(135deg, #ff2d55, #7a1cff);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); border-radius: 0;
}
.cv-skill-group + .cv-skill-group { margin-top: 12px; }
.cv-skill-group > b { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; font-weight: 500; }
.cv-foot { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.cv-qr { width: 64px; height: 64px; background: #fff; padding: 3px; border-radius: 6px; }

/* ---------------- responsive ---------------- */
@media (max-width: 960px) {
  .cve-body, .talk, .cv-cols { grid-template-columns: minmax(0, 1fr); }
  .grid-3, .principles { grid-template-columns: 1fr 1fr; }
  .kit { grid-template-columns: 1fr; }
  .talk-poster { min-height: 300px; }
}
@media (max-width: 640px) {
  .page { padding-top: 110px; padding-left: 16px; padding-right: 16px; }
  .grid-2, .grid-3, .principles, .posture { grid-template-columns: 1fr; }
  .kit-list li { grid-template-columns: 1fr; gap: 2px; }
  .cv-head { grid-template-columns: 1fr; }
  .flag-row { grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 16px; }
  .flag-num { width: 44px; height: 44px; font-size: 18px; }
  .flag-state { grid-column: 2; }
  .cta-band { flex-direction: column; align-items: flex-start; }
}

/* ---------------- arcade ---------------- */
.shelf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.game-tile {
  position: relative; display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--text);
  padding: 18px 18px 20px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel);
  transition: transform .3s cubic-bezier(.2,.8,.2,1), border-color .3s, background .3s; cursor: pointer;
}
.game-tile:hover, .game-tile:focus-visible { transform: translateY(-4px); border-color: rgba(255,45,85,.45); outline: none; }
.game-tile.on { border-color: var(--red); background: linear-gradient(170deg, rgba(255,45,85,.14), transparent 60%), var(--panel); }
.gt-art {
  height: 120px; border-radius: 14px; margin-bottom: 8px; overflow: hidden; position: relative;
  display: grid; place-items: center; background: #0a0b10; border: 1px solid var(--line);
}
.gt-tag { font-size: 11px; color: var(--red); letter-spacing: .1em; text-transform: uppercase; }
.gt-title { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.gt-desc { font-size: 14px; color: var(--muted); line-height: 1.5; }
.gt-best { font-size: 11.5px; color: #ffb547; margin-top: 6px; }
.art-phish { background: radial-gradient(circle at 50% 120%, rgba(54,160,255,.35), transparent 60%), #0a0b10; }
.art-phish i { font-style: normal; font-size: 46px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-6deg); } }
.art-hack { font-size: 12px; line-height: 1.7; color: #3dff9a; text-shadow: 0 0 8px rgba(61,255,154,.6); background: repeating-linear-gradient(0deg, rgba(61,255,154,.05) 0 2px, transparent 2px 4px), #050806; }
.art-trivia i { font-style: normal; font-family: var(--display); font-weight: 900; font-size: 64px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; animation: bob 2.8s ease-in-out infinite; }
.art-ports { grid-template-columns: repeat(4, 46px); gap: 8px; }
.art-ports b { height: 58px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; background: #1a1d28; border: 1px solid var(--line-2); }
.art-ports b:nth-child(3) { background: var(--red); color: #fff; transform: rotateY(12deg); }
.art-snake { display: block; }
.art-snake i { position: absolute; width: 16px; height: 16px; border-radius: 4px; background: var(--red); top: 52px; }
.art-snake i:nth-child(1) { left: calc(50% + 16px); background: #fff; }
.art-snake i:nth-child(2) { left: calc(50% - 2px); }
.art-snake i:nth-child(3) { left: calc(50% - 20px); opacity: .85; }
.art-snake i:nth-child(4) { left: calc(50% - 38px); opacity: .7; }
.art-snake i:nth-child(5) { left: calc(50% - 38px); top: 70px; opacity: .55; }
.art-snake em { position: absolute; width: 12px; height: 12px; left: calc(50% + 62px); top: 54px; background: var(--green); box-shadow: 0 0 14px var(--green); animation: blinkPkt 1s steps(2) infinite; }
@keyframes blinkPkt { 50% { opacity: .35; } }
.art-ttt { grid-template-columns: repeat(3, 28px); gap: 4px; }
.art-ttt b { width: 28px; height: 28px; border-radius: 6px; background: #1a1d28; display: grid; place-items: center; font-size: 15px; }
.art-ttt .x { color: var(--red); } .art-ttt .o { color: #36a0ff; }

.stage {
  margin-top: 22px; border-radius: 26px; border: 1px solid rgba(255,45,85,.35);
  background: radial-gradient(800px 400px at 0% 0%, rgba(255,45,85,.12), transparent 60%), #0b0c11;
  padding: clamp(18px, 3vw, 32px); scroll-margin-top: 90px;
}
.stage[hidden] { display: none; }
.stage-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 20px; }
.stage-head h2 { font-family: var(--display); font-size: clamp(24px, 3vw, 34px); letter-spacing: -0.03em; margin: 4px 0 6px; }
.stage-hint { color: var(--muted); margin: 0; font-size: 14.5px; max-width: 560px; }
.stage-actions { display: flex; gap: 8px; }
.stage .g { color: var(--green); }

/* snake */
.snake-wrap { display: grid; justify-items: center; gap: 14px; }
.snake-hud { display: flex; gap: 22px; font-size: 13px; color: var(--muted); }
.snake-hud b { color: #fff; }
.snake-board { position: relative; width: min(520px, 100%); aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #050608; border: 1px solid var(--line-2); touch-action: none; }
.snake-board canvas { display: block; }
.snake-over { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; background: rgba(5,6,8,.78); backdrop-filter: blur(3px); }
.snake-over[hidden] { display: none; }
.snake-over h3 { font-family: var(--display); font-size: 30px; margin: 0; }
.snake-over p { margin: 0; font-size: 12px; }
.snake-over > span { font-size: 11px; color: var(--dim); }
.dpad { display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(3, 44px); gap: 6px; }
.dpad button { border-radius: 10px; border: 1px solid var(--line-2); background: rgba(255,255,255,.04); color: var(--text); font-size: 14px; }
.dpad button:active { background: var(--red); border-color: var(--red); }
.dpad button:nth-child(1) { grid-column: 2; grid-row: 1; }
.dpad button:nth-child(2) { grid-column: 1; grid-row: 2; }
.dpad button:nth-child(3) { grid-column: 3; grid-row: 2; }
.dpad button:nth-child(4) { grid-column: 2; grid-row: 3; }
@media (pointer: fine) { .dpad { display: none; } }

/* red vs blue */
.ttt { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; }
.ttt-side { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.ttt-score { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.ttt-score b { color: #fff; margin-left: 4px; }
.ttt-score .red { color: var(--red); }
.ttt-score .blue { color: #36a0ff; }
.ttt-status { font-size: 17px; margin: 0; min-height: 1.5em; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; }
.seg button { padding: 7px 14px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--red); color: #fff; }
.ttt-grid { display: grid; grid-template-columns: repeat(3, clamp(78px, 22vw, 108px)); gap: 8px; }
.ttt-cell {
  aspect-ratio: 1; border-radius: 16px; font-size: clamp(30px, 8vw, 44px); line-height: 1;
  background: #12141c; border: 1px solid var(--line-2); color: var(--text); transition: background .2s, border-color .2s, transform .2s;
}
.ttt-cell:not(:disabled):hover { border-color: rgba(255,45,85,.6); background: rgba(255,45,85,.08); }
.ttt-cell.X { color: var(--red); text-shadow: 0 0 18px var(--red-glow); }
.ttt-cell.O { color: #36a0ff; text-shadow: 0 0 18px rgba(54,160,255,.5); }
.ttt-cell.win { background: rgba(255,45,85,.16); border-color: var(--red); transform: scale(1.04); }
.ttt-cell.O.win { background: rgba(54,160,255,.16); border-color: #36a0ff; }
.ttt-cell:disabled { cursor: default; }

/* phish or legit */
.ph { display: grid; gap: 16px; max-width: 640px; margin: 0 auto; }
.ph-prog { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.ph-card { border-radius: 16px; padding: 20px; background: #f3f1ec; color: #1a1d24; border: 3px solid transparent; transition: border-color .3s; }
.ph-card.is-phish { border-color: var(--red); }
.ph-card.is-legit { border-color: var(--green); }
.ph-type { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #6b7080; margin-bottom: 10px; }
.ph-from { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.ph-msg { margin-top: 8px; font-size: 15.5px; line-height: 1.55; }
.ph-url { font-size: clamp(13px, 2.2vw, 16px); padding: 12px 14px; border-radius: 10px; background: #fff; border: 1px solid #d8d4cb; overflow-wrap: anywhere; }
.ph-card.sms { background: #e9f1ff; }
.ph-card.push { background: #eef0f4; }
.ph-card.qr { background: #fff6e6; }
.ph-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ph-btns .btn { justify-content: center; }
.ph-btns .btn:disabled { opacity: .5; cursor: default; }
.ph-why { font-size: 15px; color: #c3c8d2; line-height: 1.6; min-height: 24px; }
.ph-why .btn { margin-top: 12px; display: flex; width: fit-content; }
.ph-end, .tr-end, .pm-end { text-align: center; display: grid; justify-items: center; gap: 8px; padding: 10px 0; }
.ph-end h3, .tr-end h3 { font-family: var(--display); font-size: clamp(40px, 7vw, 64px); margin: 0; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ph-end p, .tr-end p { margin: 0; color: #c3c8d2; max-width: 440px; }

/* terminal hack */
.hk { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; }
.hk-screen, .hk-log {
  border-radius: 14px; padding: 18px; font-size: 14px; color: #3dff9a; text-shadow: 0 0 6px rgba(61,255,154,.45);
  background: repeating-linear-gradient(0deg, rgba(61,255,154,.04) 0 2px, transparent 2px 4px), #040705;
  border: 1px solid rgba(61,255,154,.25);
}
.hk-head { margin: 0 0 6px; font-size: 12px; opacity: .8; }
.hk-tries { margin: 0 0 14px; letter-spacing: .1em; }
.hk-dump { display: grid; gap: 2px; }
.hk-row { display: flex; gap: 10px; align-items: center; white-space: nowrap; overflow: hidden; }
.hk-addr { opacity: .55; }
.hk-junk { opacity: .45; }
.hk-word { color: inherit; font: inherit; text-shadow: inherit; padding: 1px 4px; border-radius: 3px; }
.hk-word:not(:disabled):hover, .hk-word:not(:disabled):focus-visible { background: #3dff9a; color: #040705; text-shadow: none; outline: none; }
.hk-word.no { text-decoration: line-through; opacity: .45; }
.hk-word.ok { background: #3dff9a; color: #040705; text-shadow: none; }
.hk-word:disabled { cursor: default; }
.hk-log { max-height: 360px; overflow-y: auto; }
.hk-log p { margin: 0 0 4px; }
.hk-log .red { color: var(--red); text-shadow: none; }
.hk-log .btn { margin-top: 12px; text-shadow: none; }

/* port match */
.pm { display: grid; gap: 14px; justify-items: center; }
.pm-hud { display: flex; gap: 22px; font-size: 13px; color: var(--muted); }
.pm-hud b { color: #fff; }
.pm-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: min(520px, 100%); }
.pm-card { aspect-ratio: 4 / 3; position: relative; perspective: 600px; border-radius: 12px; }
.pm-back, .pm-face {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: 12px;
  backface-visibility: hidden; transition: transform .45s cubic-bezier(.2,.8,.2,1);
}
.pm-back { background: linear-gradient(150deg, #1d2030, #12141c); border: 1px solid var(--line-2); color: var(--red); font-size: 18px; }
.pm-face { transform: rotateY(180deg); background: #f3f1ec; color: #1a1d24; font-weight: 700; font-size: clamp(13px, 2.6vw, 17px); }
.pm-face.port { font-family: var(--mono); background: #fff; color: var(--red); }
.pm-card.up .pm-back { transform: rotateY(180deg); }
.pm-card.up .pm-face { transform: rotateY(360deg); }
.pm-card.got .pm-face { background: var(--green); color: #04130b; box-shadow: 0 0 22px rgba(61,255,154,.35); }
.pm-end h3 { font-family: var(--display); font-size: 22px; margin: 8px 0 0; }

/* trivia rush */
.tr { display: grid; gap: 14px; max-width: 680px; margin: 0 auto; }
.tr-hud { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.tr-bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.06); overflow: hidden; }
.tr-bar span { display: block; height: 100%; width: 100%; background: var(--grad); transition: width 1s linear; }

.page-arcade .trivia-card { max-width: 760px; }

@media (max-width: 960px) { .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .ttt { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .ttt-side { align-items: center; }
  .hk { grid-template-columns: minmax(0, 1fr); }
  .hk-screen { font-size: 12.5px; padding: 14px; }
  .hk-log { max-height: 220px; }
}
@media (max-width: 560px) {
  .shelf { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .game-tile { display: grid; grid-template-columns: 88px minmax(0, 1fr); column-gap: 14px; row-gap: 2px; padding: 12px; }
  .gt-art { grid-row: 1 / span 4; height: 88px; margin: 0; }
  .art-hack { font-size: 7px; }
  .art-ports { grid-template-columns: repeat(2, 30px); gap: 4px; }
  .art-ports b { height: 30px; font-size: 9px; }
  .art-ttt { grid-template-columns: repeat(3, 20px); gap: 3px; }
  .art-ttt b { width: 20px; height: 20px; font-size: 11px; }
  .art-snake i { width: 10px; height: 10px; top: 38px; }
  .art-snake i:nth-child(1) { left: calc(50% + 10px); }
  .art-snake i:nth-child(2) { left: calc(50% - 1px); }
  .art-snake i:nth-child(3) { left: calc(50% - 12px); }
  .art-snake i:nth-child(4) { left: calc(50% - 23px); }
  .art-snake i:nth-child(5) { left: calc(50% - 23px); top: 49px; }
  .art-snake em { left: calc(50% + 30px); top: 39px; width: 8px; height: 8px; }
  .art-phish i, .art-trivia i { font-size: 36px; }
  .gt-title { font-size: 17px; }
  .gt-desc { font-size: 13px; }
  .pm-grid { gap: 6px; }
}

/* ---------------- PRINT: CV as a clean A4 document ---------------- */
@media print {
  @page { size: A4; margin: 10mm 12mm; }
  :root { --text: #111; --muted: #444; --dim: #666; --line: #ddd; --line-2: #ccc; }
  html, body { background: #fff !important; color: #111 !important; font-size: 9.5pt; line-height: 1.4; }
  body::before, .noise, .cursor-glow, #progress, .nav, .footer, .page-hero, .no-print, .toast, .share, .cta-band { display: none !important; }
  .page { padding: 0 !important; max-width: none; min-height: 0; }
  .cv-doc { margin: 0; padding: 0; border: 0; box-shadow: none; background: #fff; border-radius: 0; }
  .cv-head { gap: 18px; padding-bottom: 14px; border-color: #111; }
  .cv-photo { width: 78px; height: 96px; border-radius: 6px; }
  .cv-name { font-size: 22pt; color: #111; }
  .cv-title { color: #c8102e; font-size: 11.5pt; margin: 4px 0 6px; }
  .cv-contact { color: #333; font-size: 8.5pt; }
  .cv-cols { grid-template-columns: 1fr 56mm; gap: 7mm; margin-top: 12px; }
  .cv-h { color: #c8102e; font-size: 8.5pt; margin-bottom: 8px; }
  .cv-h::after { background: #ccc; }
  .cv-summary, .cv-job ul { color: #222; font-size: 8.8pt; line-height: 1.38; }
  .cv-job + .cv-job { margin-top: 8px; }
  .cv-job h3 { font-size: 11pt; color: #111; }
  .cv-job .role { color: #222; font-size: 9.5pt; }
  .cv-job .when, .cv-job .where { color: #555; font-size: 8pt; }
  .cv-job ul { margin-top: 4px; }
  .cv-job li { margin: 1px 0; }
  .cv-job li::marker { color: #c8102e; }
  .cv-sec + .cv-sec { margin-top: 11px; }
  .cv-side-item { margin-bottom: 5px; }
  .cv-side-item b { font-size: 8.6pt; color: #111; line-height: 1.3; }
  .cv-side-item span { font-size: 7.8pt; color: #444; line-height: 1.3; }
  .cv-skills { font-size: 8.2pt; color: #222; line-height: 1.45; }
  .cv-skills i { color: #c8102e; }
  .cv-ico { width: 9pt; height: 9pt; color: #c8102e; }
  .cv-contact { gap: 3px 14px; }
  .cv-cred { grid-template-columns: 22px minmax(0, 1fr); gap: 7px; margin-bottom: 5px; }
  .cv-cred b { font-size: 8.6pt; color: #111; }
  .cv-cred span:not(.cv-mark) { font-size: 7.8pt; color: #444; line-height: 1.3; }
  .cv-mark { width: 22px; height: 22px; border-radius: 4px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cv-mark.plate { padding: 1px; border: 0.5pt solid #ddd; }
  .cv-mark.mono { font-size: 5.5pt; border-radius: 0; }
  .cv-skill-group > b { color: #555; font-size: 7.5pt; }
  .cv-foot { color: #555; border-color: #ccc; margin-top: 14px; font-size: 7.5pt; }
  a { color: inherit !important; text-decoration: none; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
.dossier b { color: #1a1712; background: rgba(200,16,46,.12); padding: 0 4px; border-radius: 3px; }

/* /cv — the sheet itself is drawn by js/cv-render.js (css/cv-templates.css) */
.cv-stage { margin: 40px auto 0; max-width: 100%; }
