/* ==========================================================================
   MidorCyber Security — learn cybersecurity from zero
   Design language inherited from midorimax.com
   Dark, green-forward, Inter with tight tracking. Single committed theme.
   ========================================================================== */

:root {
  /* --- core palette, lifted from midorimax --- */
  --bg:         #0b0c0b;
  --surface:    #141514;
  --surface-2:  #191a19;
  --surface-3:  #252725;
  --ink:        #edeeec;
  --ink-soft:   #9ba19b;
  --ink-faint:  #6b716b;
  --line:       #252725;
  --line-soft:  #1c1e1c;

  --accent:     #3ecf8e;
  --accent-ink: #04150c;
  --accent-dim: #3ecf8e17;
  --accent-mid: #3ecf8e2e;
  --pop-2:      #a3e635;

  --glass:      #0e0f0e9e;
  --glass-line: #ffffff14;

  /* --- phase ramp, tuned to sit inside the green world --- */
  --p0: #3ecf8e;   /* foundations — the signature green */
  --p1: #a3e635;   /* core        — lime */
  --p2: #fb7185;   /* offense     — rose */
  --p3: #38bdf8;   /* defense     — sky */
  --p4: #fbbf24;   /* mastery     — amber */
  --p5: #a78bfa;   /* finishing   — violet */

  --good:      #3ecf8e;
  --good-soft: #3ecf8e1f;
  --bad:       #fb7185;
  --bad-soft:  #fb718522;
  --warn:      #fbbf24;

  --radius:    10px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px #00000059, 0 4px 12px #00000073;
  --shadow-2: 0 2px 4px #00000059, 0 12px 32px #00000073;
  --glow:     0 0 28px -6px #3ecf8ea6;

  --maxw: 1140px;
  --read: 70ch;

  --input-bg:  #0d0e0d;
  --code-bg:   #070807;
  --code-ink:  #d4d8d4;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ambient green halo, the midorimax "scene" glow */
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(760px 420px at 12% -6%, var(--accent-dim), transparent 68%),
    radial-gradient(620px 380px at 92% 4%, #a3e6350f, transparent 70%);
}
body > * { position: relative; z-index: 1; }

h1, h2, h3, h4 { font-family: var(--sans); line-height: 1.14; text-wrap: balance; margin-top: 0; }
h1 { font-weight: 800; letter-spacing: -.035em; }
h2 { font-weight: 700; letter-spacing: -.02em; }
h3, h4 { font-weight: 600; letter-spacing: -.01em; }
code, kbd, pre, .mono { font-family: var(--mono); }

.wrap   { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(18px, 4vw, 34px); }
.narrow { max-width: 800px;      margin: 0 auto; padding: 0 clamp(18px, 4vw, 34px); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--glass-line);
}
.topbar .wrap { display: flex; align-items: center; gap: 14px; height: 56px; min-width: 0; }
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: .97rem; letter-spacing: -.022em;
  color: var(--ink); text-decoration: none; margin-right: auto; white-space: nowrap;
  min-width: 0; flex-shrink: 1; overflow: hidden;
}
.logo .mark {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: .72rem; font-weight: 800;
  box-shadow: var(--glow);
}
.logo .dim { color: var(--ink-soft); font-weight: 500; }
.topbar nav { display: flex; gap: 3px; align-items: center; min-width: 0; flex-shrink: 0; }
.topbar nav a {
  font-size: .87rem; font-weight: 500; color: var(--ink-soft); text-decoration: none;
  padding: 7px 11px; border-radius: var(--radius-sm); border: 1px solid transparent; white-space: nowrap;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.topbar nav a:hover { color: var(--ink); background: var(--surface); border-color: var(--line); }
.topbar nav a.active { color: var(--accent); background: var(--accent-dim); border-color: var(--accent-mid); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 18px; font-size: .88rem; font-weight: 600; font-family: var(--sans);
  text-decoration: none; cursor: pointer; letter-spacing: -.01em;
  box-shadow: 0 1px 2px #00000059, 0 4px 12px #00000073, var(--glow);
  transition: filter .15s ease, transform .15s ease;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.ghost {
  background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: none;
}
.btn.ghost:hover { border-color: var(--accent-mid); color: var(--accent); transform: none; filter: none; }
.btn.sm { padding: 7px 13px; font-size: .82rem; }

/* ---------- hero ---------- */
.hero { padding: clamp(56px, 9vw, 118px) 0 clamp(26px, 4vw, 44px); }
.kicker {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 18px;
  display: inline-flex; align-items: center; gap: 9px;
}
.kicker::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px 1px var(--accent);
}
.hero h1 { font-size: clamp(2.1rem, 1.2rem + 3.9vw, 3.9rem); margin: 0; max-width: 16ch; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lede {
  font-size: clamp(1rem, .95rem + .34vw, 1.2rem); color: var(--ink-soft);
  max-width: 56ch; margin: 20px 0 0; line-height: 1.55;
}

/* ---------- progress panel ---------- */
.progress-panel {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 24px; margin-top: 34px; box-shadow: var(--shadow-1);
}
.ring { width: 64px; height: 64px; flex: none; position: relative; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .track { stroke: var(--surface-3); }
.ring .fill { stroke: var(--accent); transition: stroke-dashoffset .7s cubic-bezier(.4,0,.2,1); filter: drop-shadow(0 0 5px #3ecf8e88); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: .8rem; font-weight: 600; }
.progress-panel .txt { flex: 1; min-width: 210px; }
.progress-panel .txt b { display: block; font-size: 1rem; font-weight: 600; letter-spacing: -.012em; }
.progress-panel .txt span { color: var(--ink-soft); font-size: .88rem; }

/* ---------- phase blocks + lesson cards ---------- */
.phase-block { padding: clamp(38px, 5.5vw, 74px) 0 0; }
.phase-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; flex-wrap: wrap; }
.phase-head .pnum {
  font-family: var(--mono); font-weight: 700; font-size: .78rem; color: var(--ph, var(--accent));
  background: color-mix(in srgb, var(--ph, var(--accent)) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--ph, var(--accent)) 34%, transparent);
  border-radius: 20px; padding: 3px 11px; letter-spacing: .06em;
}
.phase-head h2 { font-size: clamp(1.35rem, 1.1rem + .8vw, 1.75rem); margin: 0; }
.phase-head .count {
  margin-left: auto; font-family: var(--mono); font-size: .74rem; color: var(--ink-faint);
  border: 1px solid var(--line); border-radius: 20px; padding: 4px 11px; background: var(--surface);
}
p.pdesc { color: var(--ink-soft); max-width: 64ch; margin: 0 0 24px; font-size: .95rem; }

.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 12px; }
.lcard {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 17px 15px; text-decoration: none; color: inherit; overflow: hidden;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.lcard::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: var(--ph, var(--accent)); opacity: .5;
}
a.lcard:hover {
  transform: translateY(-3px); border-color: color-mix(in srgb, var(--ph, var(--accent)) 42%, var(--line));
  box-shadow: var(--shadow-2);
}
a.lcard:hover::after { opacity: 1; }
.lcard .lnum { font-family: var(--mono); font-size: .7rem; color: var(--ph, var(--accent)); letter-spacing: .06em; }
.lcard h3 { margin: 0; font-size: 1rem; }
.lcard p { margin: 0; font-size: .855rem; color: var(--ink-soft); line-height: 1.48; }
.lcard .foot { margin-top: 7px; display: flex; align-items: center; gap: 9px; }
.lcard .time { font-family: var(--mono); font-size: .7rem; color: var(--ink-faint); }
.lcard.locked { opacity: .45; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--surface-3); flex: none; }
.lcard.done .status-dot { background: var(--accent); box-shadow: 0 0 9px 1px #3ecf8e99; }
.lcard.done h3::after { content: " ✓"; color: var(--accent); font-size: .84em; }
.badge-soon {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint); border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px;
}

/* ---------- lesson page ---------- */
.lesson-hero { padding: clamp(34px, 5vw, 62px) 0 26px; border-bottom: 1px solid var(--line); }
.crumb {
  font-family: var(--mono); font-size: .71rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ph, var(--accent)); margin: 0 0 14px;
}
.lesson-hero h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.7rem); margin: 0 0 14px; }
.lesson-hero .sub { font-size: 1.06rem; color: var(--ink-soft); max-width: var(--read); margin: 0; line-height: 1.6; }
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.meta-row span {
  font-family: var(--mono); font-size: .72rem; color: var(--ink-soft);
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px;
}

.lesson-body { padding: 8px 0 40px; }
.lesson-body section { padding: 30px 0; border-bottom: 1px solid var(--line-soft); }
.lesson-body section:last-of-type { border-bottom: none; }
.lesson-body h2 { font-size: 1.32rem; margin: 0 0 14px; display: flex; align-items: center; gap: 12px; }
.lesson-body h2 .step {
  font-family: var(--mono); font-size: .7rem; font-weight: 600; color: var(--ph, var(--accent));
  background: color-mix(in srgb, var(--ph, var(--accent)) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--ph, var(--accent)) 32%, transparent);
  border-radius: 6px; padding: 3px 8px; flex: none; letter-spacing: .04em;
}
.lesson-body h3 { font-size: 1.05rem; margin: 26px 0 9px; }
.lesson-body p, .lesson-body li { font-size: 1.005rem; line-height: 1.72; color: var(--ink-soft); max-width: var(--read); }
.lesson-body p { margin: 0 0 15px; }
.lesson-body strong { color: var(--ink); font-weight: 600; }
.lesson-body ul, .lesson-body ol { padding-left: 22px; margin: 0 0 15px; }
.lesson-body li { margin-bottom: 8px; }
.lesson-body a { color: var(--accent); text-underline-offset: 3px; }

.key { color: var(--accent); font-weight: 600; }
code.inline {
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 6px; font-size: .87em; color: var(--ink);
  overflow-wrap: anywhere; word-break: break-word;
}

/* callouts */
.callout {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--radius);
  padding: 16px 18px; margin: 0 0 20px; max-width: var(--read);
}
.callout .ci { font-size: 1.05rem; line-height: 1.4; flex: none; }
.callout .cb { flex: 1; min-width: 0; }
.callout .cb b { display: block; font-size: .9rem; margin-bottom: 4px; color: var(--ink); font-weight: 600; letter-spacing: -.01em; }
.callout p { margin: 0; font-size: .95rem; }
.callout p + p { margin-top: 9px; }
.callout.warn { border-left-color: var(--bad); background: linear-gradient(90deg, #fb718510, var(--surface) 42%); }
.callout.win  { border-left-color: var(--accent); background: linear-gradient(90deg, #3ecf8e12, var(--surface) 42%); }
.callout.tip  { border-left-color: var(--p3); background: linear-gradient(90deg, #38bdf810, var(--surface) 42%); }

/* code block */
pre.code {
  background: var(--code-bg); color: var(--code-ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; overflow-x: auto; font-size: .855rem; line-height: 1.62;
  margin: 0 0 15px; max-width: var(--read);
}
pre.code .c { color: var(--ink-faint); }
pre.code .p { color: var(--accent); }
pre.code .o { color: var(--pop-2); }
.copy-wrap { position: relative; max-width: var(--read); }
.copy-btn {
  position: absolute; top: 9px; right: 9px;
  background: #ffffff0f; color: var(--ink-soft);
  border: 1px solid #ffffff1a; border-radius: 6px;
  font-family: var(--mono); font-size: .67rem; padding: 4px 9px; cursor: pointer;
}
.copy-btn:hover { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-mid); }

/* tables */
.tbl-wrap {
  overflow-x: auto; max-width: var(--read); margin: 0 0 18px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.lesson-body table { border-collapse: collapse; width: 100%; font-size: .875rem; }
.lesson-body th, .lesson-body td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.lesson-body tr:last-child td { border-bottom: none; }
.lesson-body th {
  font-weight: 600; color: var(--ink); font-size: .71rem; text-transform: uppercase;
  letter-spacing: .09em; background: var(--surface-2); font-family: var(--mono);
}
.lesson-body td { color: var(--ink-soft); font-variant-numeric: tabular-nums; max-width: none; }
.lesson-body td.m, .lesson-body th.m { font-family: var(--mono); }
.lesson-body td strong { color: var(--ink); }

/* ---------- widgets ---------- */
.widget {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin: 0 0 20px; overflow: hidden; max-width: var(--read);
}
.widget-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.widget-head .wt {
  font-family: var(--mono); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-dim); border: 1px solid var(--accent-mid);
  border-radius: 5px; padding: 3px 8px;
}
.widget-head .wn { font-weight: 600; font-size: .88rem; margin-left: auto; color: var(--ink-soft); }
.widget-body { padding: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field label { font-size: .78rem; font-weight: 500; color: var(--ink-soft); }
.field input[type="text"], .field textarea, .field select {
  width: 100%; background: var(--input-bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
  font-family: var(--mono); font-size: .89rem; resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #3ecf8e24;
}

.out-grid { display: grid; gap: 8px; }
.out-row {
  display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: start;
  padding: 9px 12px; background: var(--surface-2); border-radius: var(--radius-sm); border: 1px solid var(--line-soft);
}
.out-row .ol { font-family: var(--mono); font-size: .67rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; padding-top: 2px; }
.out-row .ov { font-family: var(--mono); font-size: .84rem; word-break: break-word; overflow-wrap: anywhere; color: var(--accent); min-width: 0; }

/* byte breakdown */
.bytes { display: flex; flex-wrap: wrap; gap: 7px; }
.byte { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; min-width: 62px; text-align: center; background: var(--surface-2); }
.byte .ch { font-family: var(--mono); font-size: 1.05rem; font-weight: 600; padding: 7px 4px 2px; color: var(--accent); }
.byte .hx { font-family: var(--mono); font-size: .74rem; color: var(--ink); padding-bottom: 2px; }
.byte .dc { font-family: var(--mono); font-size: .66rem; color: var(--ink-faint); padding-bottom: 5px; }
.byte .bn { font-family: var(--mono); font-size: .58rem; color: var(--ink-faint); background: var(--input-bg); padding: 4px 2px; letter-spacing: .05em; }

/* bit toggles */
.bitrow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bit {
  width: 44px; height: 48px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-faint);
  font-family: var(--mono); font-size: 1.1rem; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  transition: all .14s ease;
}
.bit:hover { border-color: var(--accent-mid); }
.bit small { font-size: .56rem; color: var(--ink-faint); font-weight: 400; }
.bit.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: var(--glow); }
.bit.on small { color: var(--accent-ink); opacity: .75; }

/* quiz */
.quiz { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 19px; margin: 0 0 20px; max-width: var(--read); }
.quiz .qlabel { font-family: var(--mono); font-size: .65rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 9px; }
.quiz .q { font-weight: 600; font-size: 1.02rem; color: var(--ink); margin: 0 0 14px; max-width: none; letter-spacing: -.012em; line-height: 1.45; }
.quiz .opts { display: flex; flex-direction: column; gap: 7px; }
.quiz .opt {
  text-align: left; background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 14px;
  font-family: var(--sans); font-size: .92rem; cursor: pointer; display: flex; gap: 11px; align-items: center;
  transition: border-color .14s ease, background .14s ease;
}
.quiz .opt:hover:not(:disabled) { border-color: var(--accent-mid); background: var(--surface-3); }
.quiz .opt .mk { font-family: var(--mono); font-size: .75rem; color: var(--ink-faint); flex: none; width: 14px; }
.quiz .opt.right { background: var(--good-soft); border-color: var(--accent); }
.quiz .opt.right .mk { color: var(--accent); }
.quiz .opt.wrong { background: var(--bad-soft); border-color: var(--bad); }
.quiz .opt.wrong .mk { color: var(--bad); }
.quiz .opt:disabled { cursor: default; }
.quiz .why {
  margin-top: 13px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border-left: 3px solid var(--accent);
  font-size: .94rem; color: var(--ink-soft); display: none; line-height: 1.6;
}
.quiz .why.show { display: block; }
.quiz .why strong { color: var(--ink); }

/* reveal */
.reveal-box { margin: 0 0 20px; max-width: var(--read); }
.reveal-btn {
  background: var(--surface); border: 1px dashed var(--line); color: var(--ink-soft);
  border-radius: var(--radius-sm); padding: 11px 15px; cursor: pointer;
  font-family: var(--sans); font-size: .88rem; width: 100%; text-align: left;
}
.reveal-btn:hover { border-color: var(--accent); color: var(--accent); }
.reveal-content {
  display: none; margin-top: 10px; padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
}
.reveal-content.show { display: block; }
.reveal-content p { margin: 0 0 10px; font-size: .95rem; }
.reveal-content p:last-child { margin-bottom: 0; }

/* terminal */
.term { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0 0 8px; max-width: var(--read); }
.term-bar { display: flex; align-items: center; gap: 7px; padding: 9px 13px; background: var(--input-bg); border-bottom: 1px solid var(--line); }
.term-bar .dot { width: 10px; height: 10px; border-radius: 50%; }
.term-bar .t { margin-left: 8px; font-family: var(--mono); font-size: .69rem; color: var(--ink-faint); }
.term-screen { padding: 13px 15px; height: 300px; overflow-y: auto; font-family: var(--mono); font-size: .82rem; line-height: 1.58; color: var(--code-ink); }
.term-screen .ps1 { color: var(--accent); }
.term-screen .cmd { color: var(--ink); }
.term-screen .out { color: var(--ink-soft); white-space: pre-wrap; }
.term-screen .err { color: var(--bad); }
.term-screen .ok  { color: var(--pop-2); }
.term-input { display: flex; align-items: center; gap: 9px; padding: 10px 15px; border-top: 1px solid var(--line); background: var(--input-bg); }
.term-input .ps1 { color: var(--accent); font-family: var(--mono); font-size: .82rem; flex: none; }
.term-input input { flex: 1; background: transparent; border: none; outline: none; color: var(--ink); font-family: var(--mono); font-size: .82rem; }
.term-hint { font-family: var(--mono); font-size: .69rem; color: var(--ink-faint); margin: 0 0 20px; max-width: var(--read); }

/* tasks */
.tasks { list-style: none; padding: 0; margin: 0 0 20px; max-width: var(--read); }
.tasks li {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 15px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 7px; font-size: .95rem; color: var(--ink-soft); max-width: none;
}
.tasks input[type="checkbox"] { margin-top: 4px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; cursor: pointer; }
.tasks li > span { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.tasks li.checked { opacity: .45; border-color: var(--line-soft); }
.tasks li.checked span { text-decoration: line-through; }

/* diagram */
.diagram { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 20px; max-width: var(--read); overflow-x: auto; }
.diagram svg { display: block; margin: 0 auto; max-width: 100%; height: auto; color: var(--ink-soft); }
.dcap { font-family: var(--mono); font-size: .69rem; color: var(--ink-faint); text-align: center; margin: 12px 0 0; max-width: none; }

/* layers */
.layers { display: flex; flex-direction: column; gap: 6px; max-width: var(--read); margin: 0 0 20px; }
.layer { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 16px; background: var(--surface); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.layer .lname { font-weight: 600; font-size: .93rem; }
.layer .ldesc { font-size: .85rem; color: var(--ink-soft); margin-left: auto; text-align: right; max-width: 44ch; }
.layer.kernel { border-color: #fb718559; background: linear-gradient(90deg, #fb718512, var(--surface) 55%); }
.layer.kernel .lname { color: var(--p2); }
.layer.user { border-color: #3ecf8e59; background: linear-gradient(90deg, #3ecf8e12, var(--surface) 55%); }
.layer.user .lname { color: var(--accent); }

/* footer nav */
.lesson-nav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 30px 0 70px; border-top: 1px solid var(--line); }
.lesson-nav .spacer { flex: 1; }
.done-btn.is-done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: var(--glow); }

.footer { padding: 40px 0 54px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: .85rem; margin-top: 60px; }
.footer b { color: var(--ink-soft); font-weight: 600; }
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.hide { display: none !important; }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}

@media (max-width: 640px) {
  .out-row { grid-template-columns: 1fr; gap: 3px; }
  .layer .ldesc { margin-left: 0; text-align: left; }
  .lesson-body p, .lesson-body li { font-size: .97rem; }

  /* keep the top bar on one line: drop the second word of the wordmark,
     tighten the links, and let the nav scroll rather than push the page wide */
  .topbar .wrap { gap: 8px; }
  .logo .dim { display: none; }
  .logo { font-size: .9rem; gap: 8px; }
  .topbar nav { gap: 1px; min-width: 0; flex-shrink: 1; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { padding: 6px 8px; font-size: .8rem; }
}

@media (max-width: 400px) {
  .topbar nav a { padding: 5px 6px; font-size: .76rem; }
  .logo { font-size: .85rem; }
  .progress-panel { padding: 16px; gap: 14px; }
  .btn { padding: 9px 14px; font-size: .85rem; }
}

/* ==========================================================================
   Toolkit + Challenges (extension pages)
   ========================================================================== */
.page-intro { padding: clamp(40px,7vw,80px) 0 clamp(20px,3vw,34px); }
.page-intro h1 { font-size: clamp(1.9rem,1.2rem+3vw,3.1rem); margin: 0; max-width: 16ch; }
.page-intro h1 em { font-style: normal; color: var(--accent); }
.page-intro .lede { font-size: clamp(1rem,.95rem+.3vw,1.16rem); color: var(--ink-soft); max-width: 58ch; margin: 18px 0 0; line-height: 1.55; }

/* tool grid */
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; padding-bottom: 40px; align-items: start; }
.tools .widget { max-width: none; margin: 0; }
.tool-note { font-size: .8rem; color: var(--ink-faint); margin: 10px 0 0; }
.tool-note a { color: var(--accent); }

/* range slider */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 4px; background: var(--surface-3); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; box-shadow: var(--glow); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: none; border-radius: 50%; background: var(--accent); cursor: pointer; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row .sval { font-family: var(--mono); font-size: .9rem; color: var(--accent); min-width: 2.5ch; text-align: right; }

/* segmented control (CVSS) */
.seg-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 11px; }
.seg-group > label { font-size: .76rem; font-weight: 600; color: var(--ink-soft); }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { flex: 1; min-width: 54px; background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); border-radius: 6px; padding: 7px 6px; font-family: var(--sans); font-size: .78rem; font-weight: 500; cursor: pointer; transition: all .12s ease; }
.seg button:hover { border-color: var(--accent-mid); color: var(--ink); }
.seg button.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* score badge */
.score-badge { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); margin-top: 4px; }
.score-badge .num { font-family: var(--mono); font-size: 2.1rem; font-weight: 700; line-height: 1; }
.score-badge .rate { font-weight: 700; font-size: 1rem; letter-spacing: -.01em; min-width: 0; flex: 1; }
.score-badge .rate small { display: block; font-weight: 400; font-size: .74rem; color: var(--ink-soft); font-family: var(--mono); margin-top: 4px; overflow-wrap: anywhere; line-height: 1.45; }
.sev-critical { color: #fb7185; } .sev-high { color: #fb923c; } .sev-medium { color: #fbbf24; } .sev-low { color: #38bdf8; } .sev-none { color: var(--ink-soft); }
.score-badge.sev-critical { border-color: #fb718559; } .score-badge.sev-high { border-color: #fb923c59; } .score-badge.sev-medium { border-color: #fbbf2459; } .score-badge.sev-low { border-color: #38bdf859; }

.pill-strong { color: var(--accent); } .pill-weak { color: var(--bad); }

/* reference search */
.ref-search { width: 100%; background: var(--input-bg); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-family: var(--mono); font-size: .88rem; margin-bottom: 10px; }
.ref-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #3ecf8e24; }

/* brute-force list (caesar) */
.brute { max-height: 220px; overflow-y: auto; font-family: var(--mono); font-size: .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--input-bg); }
.brute div { padding: 4px 10px; border-bottom: 1px solid var(--line-soft); color: var(--ink-soft); }
.brute div:last-child { border-bottom: none; }
.brute div b { color: var(--accent); }

/* ---------- challenges ---------- */
.chal-summary { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 8px; box-shadow: var(--shadow-1); }
.chal-summary .big { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.chal-summary .txt b { display: block; font-size: .98rem; } .chal-summary .txt span { color: var(--ink-soft); font-size: .86rem; }
.chal-bar { flex: 1; min-width: 160px; height: 8px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.chal-bar i { display: block; height: 100%; background: var(--accent); box-shadow: var(--glow); transition: width .5s ease; }

.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 22px 0 16px; }
.filter-row button { background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px; font-family: var(--sans); font-size: .82rem; cursor: pointer; }
.filter-row button:hover { color: var(--ink); border-color: var(--accent-mid); }
.filter-row button.on { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.chals { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; padding-bottom: 50px; align-items: start; }
.chal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px 18px; display: flex; flex-direction: column; gap: 11px; }
.chal.solved { border-color: var(--accent); background: linear-gradient(180deg, #3ecf8e0f, var(--surface) 60%); }
.chal-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chal .cat { font-family: var(--mono); font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 5px; border: 1px solid var(--catc, var(--line)); color: var(--catc, var(--ink-soft)); }
.chal .diff { font-family: var(--mono); font-size: .66rem; color: var(--ink-faint); }
.chal .pts { margin-left: auto; font-family: var(--mono); font-size: .72rem; color: var(--accent); }
.chal h3 { margin: 0; font-size: 1.05rem; }
.chal p { margin: 0; font-size: .9rem; color: var(--ink-soft); line-height: 1.55; }
.chal pre.code { max-width: none; margin: 0; font-size: .8rem; }
.chal .solvebar { display: flex; gap: 8px; }
.chal .solvebar input { flex: 1; background: var(--input-bg); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px; font-family: var(--mono); font-size: .86rem; }
.chal .solvebar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #3ecf8e24; }
.chal .fb { font-size: .82rem; font-family: var(--mono); min-height: 1em; }
.chal .fb.ok { color: var(--accent); } .chal .fb.no { color: var(--bad); }
.chal .solved-tag { display: none; font-family: var(--mono); font-size: .72rem; color: var(--accent); }
.chal.solved .solved-tag { display: inline; }
.chal.solved .solvebar { display: none; }
.chal .hint-line { font-size: .82rem; }
.chal details summary { cursor: pointer; color: var(--ink-faint); font-size: .82rem; }
.chal details summary:hover { color: var(--accent); }
.chal details p { margin-top: 8px; padding: 10px 12px; background: var(--surface-2); border-left: 3px solid var(--p3); border-radius: 5px; font-size: .86rem; }

/* ==========================================================================
   Command palette (Cmd+K) + dashboard + review
   ========================================================================== */
.cmdk-btn {
  display: flex; align-items: center; gap: 8px; flex: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ink-faint); padding: 6px 9px 6px 12px; cursor: pointer;
  font-family: var(--sans); font-size: .8rem;
}
.cmdk-btn:hover { border-color: var(--accent-mid); color: var(--ink); }
.cmdk-btn kbd { font-family: var(--mono); font-size: .68rem; background: var(--surface-3); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--ink-soft); }
@media (max-width: 720px) { .cmdk-btn span { display: none; } .cmdk-btn { padding: 6px 8px; } }

.cmdk { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.62); backdrop-filter: blur(3px); display: none; padding: 12vh 16px 16px; }
.cmdk.show { display: block; }
.cmdk-box { max-width: 620px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); overflow: hidden; }
.cmdk-box input { width: 100%; background: transparent; border: none; border-bottom: 1px solid var(--line); color: var(--ink); padding: 16px 18px; font-family: var(--sans); font-size: 1rem; outline: none; }
.cmdk-box input::placeholder { color: var(--ink-faint); }
.cmdk-list { max-height: 52vh; overflow-y: auto; }
.cmdk-item { display: flex; gap: 12px; align-items: center; padding: 10px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line-soft); }
.cmdk-item:last-child { border-bottom: none; }
.cmdk-item.on { background: var(--accent-dim); }
.cmdk-item .ck { font-family: var(--mono); font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; flex: none; min-width: 42px; text-align: center; }
.cmdk-item .ct { min-width: 0; display: flex; flex-direction: column; }
.cmdk-item .ct b { font-size: .92rem; font-weight: 600; }
.cmdk-item .ct small { font-size: .78rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-empty { padding: 26px 18px; color: var(--ink-faint); font-size: .9rem; text-align: center; }
.cmdk-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: .72rem; color: var(--ink-faint); }
.cmdk-foot kbd { font-family: var(--mono); background: var(--surface-3); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; margin-right: 3px; }

/* ---------- dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat .n { font-family: var(--mono); font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1; }
.stat .l { font-size: .85rem; color: var(--ink-soft); margin-top: 7px; }
.stat .sub { font-size: .76rem; color: var(--ink-faint); margin-top: 3px; font-family: var(--mono); }

.phase-bars { display: flex; flex-direction: column; gap: 12px; }
.pbar { display: flex; align-items: center; gap: 14px; }
.pbar .pname { min-width: 150px; font-size: .89rem; font-weight: 600; }
.pbar .track { flex: 1; height: 9px; border-radius: 5px; background: var(--surface-3); overflow: hidden; min-width: 80px; }
.pbar .track i { display: block; height: 100%; background: var(--pc, var(--accent)); transition: width .6s ease; }
.pbar .pn { font-family: var(--mono); font-size: .78rem; color: var(--ink-soft); min-width: 52px; text-align: right; }
@media (max-width: 560px) { .pbar .pname { min-width: 0; flex: 1; } .pbar { flex-wrap: wrap; } .pbar .track { flex-basis: 100%; order: 3; } }

.next-up { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--accent-mid); border-radius: var(--radius); padding: 20px 22px; background: linear-gradient(90deg, #3ecf8e0f, var(--surface) 55%); }
.next-up .nu-t { flex: 1; min-width: 200px; }
.next-up .nu-t small { font-family: var(--mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 5px; }
.next-up .nu-t b { font-size: 1.1rem; display: block; letter-spacing: -.015em; }
.next-up .nu-t span { color: var(--ink-soft); font-size: .88rem; }

/* ---------- review / flashcards ---------- */
.rev-stage { max-width: 660px; margin: 0 auto; }
.rev-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 34px 30px; min-height: 230px; display: flex; flex-direction: column; justify-content: center; box-shadow: var(--shadow-1); }
.rev-card .rc-meta { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--rc, var(--accent)); margin-bottom: 14px; }
.rev-card .rc-front { font-size: 1.25rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.4; }
.rev-card .rc-back { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 1.02rem; line-height: 1.6; display: none; }
.rev-card.flipped .rc-back { display: block; }
.rev-actions { display: flex; gap: 9px; margin-top: 18px; flex-wrap: wrap; }
.rev-actions .btn { flex: 1; justify-content: center; min-width: 90px; }
.grade-again { background: #fb7185; border-color: #fb7185; color: #1a0b0d; box-shadow: none; }
.grade-hard  { background: #fbbf24; border-color: #fbbf24; color: #1a1408; box-shadow: none; }
.grade-good  { background: var(--accent); border-color: var(--accent); }
.grade-easy  { background: #38bdf8; border-color: #38bdf8; color: #06171f; box-shadow: none; }
.rev-progress { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; font-family: var(--mono); font-size: .78rem; color: var(--ink-soft); }
.rev-progress .track { flex: 1; height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.rev-progress .track i { display: block; height: 100%; background: var(--accent); transition: width .4s ease; }
.rev-done { text-align: center; padding: 50px 20px; }
.rev-done .big { font-size: 2.4rem; margin-bottom: 10px; }
.rev-done h2 { font-size: 1.5rem; margin: 0 0 10px; }
.rev-done p { color: var(--ink-soft); max-width: 46ch; margin: 0 auto 20px; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 26px; }
.deck { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--dc, var(--accent)); border-radius: var(--radius); padding: 14px 16px; }
.deck b { display: block; font-size: .95rem; }
.deck small { color: var(--ink-soft); font-size: .8rem; font-family: var(--mono); }

/* ==========================================================================
   Lesson simulators (assets/widgets.js)
   ========================================================================== */
.w-lead { font-size: .9rem; color: var(--ink-soft); margin: 0 0 13px; line-height: 1.55; max-width: none; }
.w-lead b { color: var(--ink); }
.w-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.w-lbl { font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 6px; }
.w-check { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; color: var(--ink-soft); cursor: pointer; }
.w-check input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.w-count { font-family: var(--mono); font-size: .74rem; color: var(--ink-faint); margin-top: 8px; }
.w-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.w-split pre.code { max-width: none; margin: 0; font-size: .78rem; }
@media (max-width: 620px) { .w-split { grid-template-columns: 1fr; } }

.w-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.w-chip { background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); border-radius: 20px; padding: 6px 13px; font-family: var(--sans); font-size: .8rem; cursor: pointer; }
.w-chip:hover { color: var(--ink); border-color: var(--accent-mid); }
.w-chip.on { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.w-note { margin-top: 14px; padding: 13px 15px; background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); }
.w-note b { display: block; font-size: .88rem; margin-bottom: 5px; color: var(--ink); }
.w-note b.g { color: var(--accent); } .w-note b.r { color: var(--bad); }
.w-note span { display: block; font-size: .88rem; color: var(--ink-soft); line-height: 1.6; }
.w-win { display: block; margin-top: 9px; color: var(--accent); font-weight: 500; }
.w-ul { margin: 6px 0 0; padding-left: 18px; }
.w-ul li { margin-bottom: 5px; font-size: .87rem; color: var(--ink-soft); }

pre.code .ok-l { color: #4ade80; } pre.code .warn-l { color: #fbbf24; }
pre.code .bad-l { color: #fb7185; } pre.code .dim-l { color: var(--ink-faint); }

/* process tree */
.ptree { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--input-bg); }
.pnode { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; border: none; border-bottom: 1px solid var(--line-soft); color: var(--ink); padding: 9px 12px; cursor: pointer; font-family: var(--mono); font-size: .82rem; }
.pnode:last-child { border-bottom: none; }
.pnode:hover { background: var(--surface-2); }
.pnode.sel { background: var(--accent-dim); }
.pnode.bad { background: #fb718518; }
.pnode.bad .pn-name { color: var(--bad); }
.pnode .tw { color: var(--ink-faint); }
.pn-name { font-weight: 600; }
.pn-meta { margin-left: auto; color: var(--ink-faint); font-size: .72rem; }

/* phishing mail */
.mail { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--input-bg); }
.mail-row { display: flex; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); font-size: .84rem; }
.mail-row span { color: var(--ink-faint); font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; min-width: 58px; padding-top: 2px; }
.mail-row b { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.mail-body { padding: 15px 14px; font-size: .89rem; color: var(--ink-soft); line-height: 1.6; }
.mail-link { display: inline-block; margin-top: 12px; color: #6ab7ff; text-decoration: underline; cursor: pointer; font-size: .89rem; }
.mail-status { margin-top: 11px; font-family: var(--mono); font-size: .74rem; color: var(--ink-faint); }
.mail-status.on { color: var(--bad); }

/* risk matrix */
.rm-wrap { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
.rm-yl { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--mono); font-size: .68rem; color: var(--ink-faint); letter-spacing: .1em; }
.rm-xl { grid-column: 2; font-family: var(--mono); font-size: .68rem; color: var(--ink-faint); letter-spacing: .1em; text-align: center; }
table.rm { border-collapse: collapse; width: 100%; }
table.rm th { font-family: var(--sans); font-size: .7rem; font-weight: 500; color: var(--ink-soft); text-align: right; padding: 0 8px 0 0; white-space: nowrap; }
table.rm td { text-align: center; padding: 9px 2px; font-family: var(--mono); font-size: .8rem; cursor: pointer; border: 1px solid var(--bg); color: #0b0c0b; font-weight: 600; }
table.rm td.rm-h { background: transparent; color: var(--ink-faint); font-size: .64rem; cursor: default; font-weight: 400; padding-top: 7px; }
table.rm td.c1 { background: #2f7d5a; } table.rm td.c2 { background: #a3a635; }
table.rm td.c3 { background: #d98324; } table.rm td.c4 { background: #d1495b; color: #fff; }
table.rm td.sel { outline: 2px solid var(--ink); outline-offset: -2px; }

/* kill chain */
.kc-row { display: flex; gap: 12px; align-items: center; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 7px; background: var(--surface-2); flex-wrap: wrap; }
.kc-row.ok { border-color: var(--accent); background: #3ecf8e14; }
.kc-row.no { border-color: var(--bad); background: #fb718514; }
.kc-t { flex: 1; min-width: 180px; font-size: .87rem; color: var(--ink-soft); }
.kc-row select { background: var(--input-bg); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font-family: var(--sans); font-size: .8rem; }

/* certificate */
.cert { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 15px; background: var(--input-bg); }
.cert.ok { border-color: #3ecf8e59; } .cert.bad { border-color: #fb718559; }
.cert-top { font-size: .95rem; font-weight: 600; }
.cert.ok .cert-top { color: var(--accent); } .cert.bad .cert-top { color: var(--bad); }

/* handshake */
.hs { display: grid; grid-template-columns: 70px 1fr 70px; gap: 10px; align-items: stretch; }
.hs-side { font-size: .8rem; font-weight: 600; color: var(--ink-soft); text-align: center; padding-top: 8px; }
.hs-mid { border-left: 2px dashed var(--line); border-right: 2px dashed var(--line); padding: 10px 8px; min-height: 120px; display: flex; flex-direction: column; gap: 7px; justify-content: center; }
.hs-pkt { font-family: var(--mono); font-size: .78rem; padding: 6px 11px; border-radius: 5px; border: 1px solid var(--accent); color: var(--accent); background: var(--accent-dim); }
.hs-pkt.in { align-self: flex-end; }
.hs-pkt.out { align-self: flex-start; }
.hs-pkt.bad { border-color: var(--bad); color: var(--bad); background: #fb718518; }
.hs-empty { text-align: center; color: var(--ink-faint); font-family: var(--mono); font-size: .74rem; }
.hs-est { text-align: center; color: var(--pop-2); font-family: var(--mono); font-size: .76rem; margin-top: 4px; }

/* batch 2 simulators */
.pv-row { display: block; padding: 3px 6px; border-radius: 4px; cursor: pointer; }
.pv-row:hover { background: #ffffff10; }
.pyr { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.pyr-row { border: 1px solid; border-radius: 6px; padding: 9px 12px; cursor: pointer; color: var(--ink); display: flex; align-items: baseline; justify-content: center; gap: 10px; font-family: var(--sans); font-size: .85rem; font-weight: 600; min-width: 150px; }
.pyr-row small { font-family: var(--mono); font-size: .68rem; opacity: .8; font-weight: 400; }
.pyr-row:hover, .pyr-row.on { filter: brightness(1.35); }
.pyr-row.on { outline: 2px solid var(--ink); outline-offset: -2px; }
@media (max-width: 560px) { .pyr-row { width: 100% !important; } }

/* batch 3 + 4 simulators */
.shellviz { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin-top: 14px; }
.sv-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 8px; text-align: center; font-size: .82rem; font-weight: 600; background: var(--surface-2); }
.sv-box small { display: block; color: var(--ink-faint); font-weight: 400; font-size: .7rem; margin-top: 3px; }
.sv-mid { text-align: center; min-width: 150px; }
.sv-fw { font-family: var(--mono); font-size: .64rem; letter-spacing: .1em; color: var(--bad); border: 1px dashed var(--bad); border-radius: 5px; padding: 5px 8px; margin-bottom: 8px; }
.sv-fw small { display: block; opacity: .75; letter-spacing: 0; }
.sv-fw.off { color: var(--ink-faint); border-color: var(--line); }
.sv-arrow { font-family: var(--mono); font-size: .76rem; padding: 7px; border-radius: 5px; }
.sv-arrow.ok { color: var(--accent); background: var(--accent-dim); }
.sv-arrow.blocked { color: var(--bad); background: #fb718518; text-decoration: line-through; }
.sv-arrow small { display: block; text-decoration: none; color: var(--ink-faint); font-size: .68rem; margin-top: 4px; }
@media (max-width: 560px) { .shellviz { grid-template-columns: 1fr; } }

.adp { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.adp-node { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm); padding: 9px 16px; cursor: pointer; color: var(--ink); min-width: 190px; text-align: center; }
.adp-node b { display: block; font-size: .9rem; } .adp-node small { color: var(--ink-faint); font-size: .7rem; font-family: var(--mono); }
.adp-node.on { border-color: var(--p2); background: #fb718518; }
.adp-link { color: var(--ink-faint); font-size: .9rem; }

.tr-click { cursor: pointer; } .tr-click:hover td { background: #ffffff08; }
.tr-click.bad td { color: var(--bad); } .tr-click.seen td { opacity: .55; }

.surf { display: flex; align-items: center; gap: 11px; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer; background: var(--surface-2); }
.surf.on { border-color: #fb718559; background: #fb718510; }
.surf.dim { opacity: .38; cursor: not-allowed; }
.surf input { accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.surf-n { flex: 1; font-size: .88rem; color: var(--ink-soft); min-width: 0; }
.surf-p { font-family: var(--mono); font-size: .74rem; color: var(--ink-faint); }

.deptree { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--input-bg); }
.dep { display: block; width: 100%; text-align: left; background: transparent; border: none; border-bottom: 1px solid var(--line-soft); color: var(--ink-soft); padding: 8px 12px; cursor: pointer; font-family: var(--mono); font-size: .8rem; }
.dep:last-child { border-bottom: none; } .dep:hover { background: var(--surface-2); }
.dep.vuln { color: var(--bad); }
.dep .tw { color: var(--ink-faint); margin-right: 6px; }
.dep-flag { float: right; font-size: .66rem; background: #fb718522; border: 1px solid var(--bad); border-radius: 4px; padding: 0 6px; }
.asm-on { color: var(--accent); font-weight: 600; }

.stackviz { margin-top: 14px; display: flex; flex-direction: column; gap: 5px; }
.sm-row { display: flex; align-items: center; gap: 10px; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.sm-n { font-family: var(--mono); font-size: .76rem; min-width: 118px; color: var(--ink-soft); }
.sm-bar { flex: 1; height: 9px; background: var(--input-bg); border-radius: 4px; overflow: hidden; min-width: 60px; }
.sm-bar i { display: block; height: 100%; background: var(--accent); transition: width .18s ease; }
.sm-b { font-family: var(--mono); font-size: .7rem; color: var(--ink-faint); }
.sm-row.sm-fill .sm-bar i { background: var(--accent); }
.sm-row.sm-over { border-color: #fbbf2459; } .sm-row.sm-over .sm-bar i { background: var(--warn); }
.sm-row.sm-canary { border-color: #38bdf859; } .sm-row.sm-canary .sm-bar i { background: var(--p3); }
.sm-row.sm-hit { border-color: var(--bad); background: #fb718514; }
.sm-row.sm-hit .sm-n { color: var(--bad); font-weight: 600; } .sm-row.sm-hit .sm-bar i { background: var(--bad); }

.purdue { display: flex; flex-direction: column; gap: 3px; }
.pur-row { border: 1px solid; border-radius: 6px; padding: 10px 13px; cursor: pointer; color: var(--ink); text-align: left; }
.pur-row b { font-size: .86rem; font-weight: 600; }
.pur-row.on { outline: 2px solid var(--ink); outline-offset: -2px; }
.pur-sep { text-align: center; font-family: var(--mono); font-size: .6rem; letter-spacing: .12em; color: var(--ink-faint); padding: 2px 0; }

.ecb-wrap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.ecb { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.ecb-r { display: flex; } .ecb-r i { flex: 1; aspect-ratio: 1; }
@media (max-width: 560px) { .ecb-wrap { grid-template-columns: 1fr; max-width: 200px; } }

.cov { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px; margin-bottom: 14px; }
.cov-c { border-radius: 5px; padding: 10px 6px; font-size: .74rem; cursor: pointer; border: 1px solid; font-family: var(--sans); }
.cov-c.yes { background: #3ecf8e22; border-color: var(--accent); color: var(--accent); }
.cov-c.no { background: #fb718518; border-color: #fb718555; color: var(--ink-faint); }
.filter-row .flabel { align-self:center; font-family:var(--mono); font-size:.68rem; letter-spacing:.1em; text-transform:uppercase; color:var(--ink-faint); margin-right:4px; }
.chal .diff-medium { color:#fbbf24; } .chal .diff-hard { color:#fb7185; }
.hintbox { margin-top: 2px; }
.hint-btn {
  width: 100%; text-align: left; background: transparent; border: 1px dashed var(--line);
  color: var(--ink-faint); border-radius: var(--radius-sm); padding: 8px 12px;
  font-family: var(--sans); font-size: .8rem; cursor: pointer;
}
.hint-btn:hover { border-color: var(--p3); color: var(--p3); }
.hint-item {
  margin-bottom: 7px; padding: 11px 13px; background: var(--surface-2);
  border-left: 3px solid var(--p3); border-radius: 5px;
  font-size: .86rem; color: var(--ink-soft); line-height: 1.6;
}
.hint-n {
  display: block; font-family: var(--mono); font-size: .64rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--p3); margin-bottom: 5px;
}
.hint-item:nth-child(2) { border-left-color: #fbbf24; } .hint-item:nth-child(2) .hint-n { color: #fbbf24; }
.hint-item:nth-child(3) { border-left-color: #fb7185; } .hint-item:nth-child(3) .hint-n { color: #fb7185; }

/* grid items default to min-width:auto, so long unbreakable content (a JWT, a log line)
   widens the whole track instead of scrolling inside its own code block */
.chals > .chal { min-width: 0; }
.chal pre.code { max-width: 100%; overflow-x: auto; }
.chal .chal-top, .chal h3, .chal p { min-width: 0; overflow-wrap: anywhere; }
/* hint text can contain long unbreakable commands */
.hintbox, .hint-list, .hint-item { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }

/* ---------- lesson "keep going" practice band ---------- */
.keepgoing { margin: 8px 0 4px; padding: 22px 0 6px; border-top: 1px solid var(--line); }
.keepgoing h2 { font-size: 1.15rem; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.keepgoing h2 .kg-ic { color: var(--accent); }
.keepgoing > p { color: var(--ink-soft); font-size: .92rem; margin: 0 0 16px; max-width: var(--read); }
.kg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; max-width: var(--read); }
.kg-card { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--kc, var(--accent)); border-radius: var(--radius); padding: 14px 16px;
  text-decoration: none; color: inherit; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.kg-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--kc, var(--accent)) 45%, var(--line)); box-shadow: var(--shadow-1); }
.kg-card .kg-k { font-family: var(--mono); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--kc, var(--accent)); }
.kg-card .kg-t { font-weight: 600; font-size: .95rem; letter-spacing: -.01em; }
.kg-card .kg-d { font-size: .82rem; color: var(--ink-soft); line-height: 1.45; }

/* ==========================================================================
   Exams
   ========================================================================== */
.exam-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.exam-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--ec, var(--accent)); border-radius: var(--radius); padding: 16px 18px; }
.exam-card .ex-num { font-family: var(--mono); font-weight: 700; font-size: 1.5rem; color: var(--ec, var(--accent)); flex: none; }
.exam-card .ex-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.exam-card .ex-body b { font-size: 1rem; }
.exam-card .ex-body span { font-size: .8rem; color: var(--ink-soft); }
.exam-card .btn { flex: none; }
.ex-badge { font-family: var(--mono); font-size: .68rem; padding: 2px 8px; border-radius: 20px; width: fit-content; margin-top: 3px; }
.ex-badge.none { color: var(--ink-faint); border: 1px solid var(--line); }
.ex-badge.pass { color: var(--accent); background: var(--accent-dim); border: 1px solid var(--accent-mid); }
.ex-badge.fail { color: var(--warn); background: #fbbf2418; border: 1px solid #fbbf2455; }
@media (max-width: 480px){ .exam-card { flex-wrap: wrap; } .exam-card .btn { width: 100%; justify-content: center; } }

.exam-run { max-width: 720px; margin: 0 auto; }
.ex-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ex-phase { font-family: var(--mono); font-size: .74rem; color: var(--ec, var(--accent)); }
.ex-time { font-family: var(--mono); font-size: .85rem; color: var(--ink-soft); }
.ex-time #ex-timer.low { color: var(--bad); font-weight: 600; }
.ex-prog { height: 5px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-bottom: 18px; }
.ex-prog i { display: block; height: 100%; background: var(--ec, var(--accent)); transition: width .3s ease; }
.ex-qmeta { font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 8px; }
.ex-q { font-size: 1.18rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.4; margin-bottom: 18px; }
.ex-opts { display: flex; flex-direction: column; gap: 9px; }
.ex-opt { display: flex; gap: 12px; align-items: center; text-align: left; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 15px; cursor: pointer;
  font-family: var(--sans); font-size: .95rem; transition: border-color .12s ease, background .12s ease; }
.ex-opt:hover { border-color: var(--accent-mid); }
.ex-opt.sel { border-color: var(--ec, var(--accent)); background: color-mix(in srgb, var(--ec, var(--accent)) 12%, var(--surface)); }
.ex-opt .ex-mk { font-family: var(--mono); font-size: .8rem; color: var(--ink-faint); border: 1px solid var(--line);
  border-radius: 5px; width: 24px; height: 24px; display: grid; place-items: center; flex: none; }
.ex-opt.sel .ex-mk { color: var(--ec, var(--accent)); border-color: var(--ec, var(--accent)); }
.ex-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.ex-count { font-family: var(--mono); font-size: .76rem; color: var(--ink-faint); }

.exam-result { max-width: 720px; margin: 0 auto; text-align: center; }
.exam-result .er-big { font-size: 3rem; }
.exam-result .er-score { font-family: var(--mono); font-size: 3.2rem; font-weight: 700; line-height: 1; }
.exam-result.pass .er-score { color: var(--accent); }
.exam-result.fail .er-score { color: var(--warn); }
.exam-result .er-verdict { font-weight: 600; font-size: 1.05rem; margin-top: 6px; }
.exam-result .er-note { color: var(--ink-soft); max-width: 52ch; margin: 12px auto 0; line-height: 1.6; }
.er-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 24px 0 10px; }
.er-h { text-align: left; font-size: 1.15rem; margin: 34px 0 14px; padding-top: 20px; border-top: 1px solid var(--line); }
.er-item { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.er-qq { font-weight: 600; font-size: 1rem; margin-bottom: 10px; }
.er-line { font-size: .9rem; padding: 4px 0; }
.er-your { color: var(--bad); } .er-right { color: var(--accent); }
.er-why { font-size: .88rem; color: var(--ink-soft); line-height: 1.6; margin-top: 8px; padding: 10px 12px;
  background: var(--surface-2); border-left: 3px solid var(--ink-faint); border-radius: 5px; }
.er-lesson { display: inline-block; margin-top: 10px; font-size: .84rem; color: var(--accent); text-decoration: none; }
.er-lesson:hover { text-decoration: underline; }

/* ---------- key takeaways recap ---------- */
.takeaways { max-width: var(--read); background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--ph, var(--accent)); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 20px; }
.takeaways h3 { margin: 0 0 12px; font-size: .95rem; display: flex; align-items: center; gap: 9px; }
.takeaways h3 .tk-ic { color: var(--ph, var(--accent)); }
.takeaways ol { margin: 0; padding-left: 20px; }
.takeaways li { font-size: .93rem; color: var(--ink-soft); line-height: 1.62; margin-bottom: 9px; max-width: none; }
.takeaways li:last-child { margin-bottom: 0; }
.takeaways li b { color: var(--ink); font-weight: 600; }


/* ==========================================================================
   Light mode — mirrors midorimax.com / life.midorimax.com light tokens
   Applied when the platform mode is light, or when mode is auto and the
   system prefers light. Same token names as midorimax so the two match.
   ========================================================================== */
:root[data-mode="light"] {
  --bg:         #fafaf9;
  --surface:    #ffffff;
  --surface-2:  #f5f6f4;
  --surface-3:  #eceee9;
  --ink:        #161816;
  --ink-soft:   #5f665f;
  --ink-faint:  #6b726a;
  --line:       #e6e7e4;
  --line-soft:  #f0f1ee;

  --accent:     #0a7a47;
  --accent-ink: #ffffff;
  --accent-dim: #0a7a4714;
  --accent-mid: #0a7a4740;
  --pop-2:      #65a30d;

  --glass:      #ffffffb8;
  --glass-line: #0000000f;

  --input-bg:   #ffffff;
  --code-bg:    #f6f7f5;
  --code-ink:   #2a2f2a;

  --p0: #0a7a47;  --p1: #4d7c0f;  --p2: #be123c;
  --p3: #0369a1;  --p4: #a16207;  --p5: #6d28d9;

  --good:      #0a7a47;
  --good-soft: #0a7a4714;
  --bad:       #be123c;
  --bad-soft:  #be123c14;
  --warn:      #a16207;

  --shadow-1: 0 1px 2px #0a0c0a0d, 0 4px 12px #0a0c0a12;
  --shadow-2: 0 2px 4px #0a0c0a0d, 0 12px 32px #0a0c0a12;
  --glow:     0 0 24px -8px #0a7a4759;
}

/* auto mode: follow the system when the platform has not been pinned to dark */
@media (prefers-color-scheme: light) {
  :root:not([data-mode="dark"]) {
    --bg: #fafaf9; --surface: #ffffff; --surface-2: #f5f6f4; --surface-3: #eceee9;
    --ink: #161816; --ink-soft: #5f665f; --ink-faint: #6b726a;
    --line: #e6e7e4; --line-soft: #f0f1ee;
    --accent: #0a7a47; --accent-ink: #ffffff; --accent-dim: #0a7a4714; --accent-mid: #0a7a4740;
    --pop-2: #65a30d; --glass: #ffffffb8; --glass-line: #0000000f;
    --input-bg: #ffffff; --code-bg: #f6f7f5; --code-ink: #2a2f2a;
    --p0: #0a7a47; --p1: #4d7c0f; --p2: #be123c; --p3: #0369a1; --p4: #a16207; --p5: #6d28d9;
    --good: #0a7a47; --good-soft: #0a7a4714; --bad: #be123c; --bad-soft: #be123c14; --warn: #a16207;
    --shadow-1: 0 1px 2px #0a0c0a0d, 0 4px 12px #0a0c0a12;
    --shadow-2: 0 2px 4px #0a0c0a0d, 0 12px 32px #0a0c0a12;
    --glow: 0 0 24px -8px #0a7a4759;
  }
}

/* light-mode corrections for the few surfaces that assume a dark ground */
:root[data-mode="light"] pre.code .c,
:root:not([data-mode="dark"]) pre.code .c { color: #5c635c; }
:root[data-mode="light"] .rm td.c1,
:root:not([data-mode="dark"]) .rm td.c1 { color: #fff; }

/* platform font-size preference (midori-fontsize) */
:root[data-fontsize="lg"] body { font-size: 18px; }
:root[data-fontsize="xl"] body { font-size: 19.5px; }

/* `.lesson-body a` (0,1,1) outranks `.btn` (0,1,0), which was repainting the
   primary button's label in the accent colour on an accent background, i.e.
   invisible text. Restore the button's own colours inside prose. */
.lesson-body a.btn { color: var(--accent-ink); }
.lesson-body a.btn.ghost { color: var(--ink); }
.lesson-body a.btn.ghost:hover { color: var(--accent); }
.lesson-body a.kg-card { color: inherit; }
