/* VICTORIA INSTITUTIONS — Cybersecurity Fundamentals course pages (same design as the other courses) */

:root {
  --vi-blue: #2c3e8f;
  --vi-blue-dark: #1a2d7a;
  --vi-gold: #ffd580;
  --ink: #1e2233;
  --muted: #5b6078;
  --bg: #f4f5fb;
  --paper: #ffffff;
  --line: #dde2f5;
  --tint: #eef0ff;
  --accent: #2c3e8f;
  --code-bg: #f7f8fc;
  --code-ink: #1b2040;
  --out-bg: #10162e;
  --out-ink: #e4e8ff;
  --out-err: #ff9d9d;
  --good: #1f7a45;
  --good-bg: #e7f6ec;
  --bad: #a3361f;
  --bad-bg: #fdf0ec;
  --diff: rgba(255, 213, 128, 0.28);
  --warn-bg: #fff6de;
  --focus: #6d82ff;
  --sans: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --serif: Georgia, "Noto Serif", "Times New Roman", serif;
  --mono: "JetBrains Mono", Consolas, "Courier New", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #e4e7f5;
    --muted: #a4aac6;
    --bg: #11152a;
    --paper: #181d36;
    --line: #2d3561;
    --tint: #212a55;
    --accent: #a9b8ff;
    --code-bg: #0f1428;
    --code-ink: #e4e8ff;
    --out-bg: #0a0e1f;
    --good: #7fdca3;
    --good-bg: #173327;
    --bad: #ffab96;
    --bad-bg: #3a1e1a;
    --warn-bg: #3a3218;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e4e7f5;
  --muted: #a4aac6;
  --bg: #11152a;
  --paper: #181d36;
  --line: #2d3561;
  --tint: #212a55;
  --accent: #a9b8ff;
  --code-bg: #0f1428;
  --code-ink: #e4e8ff;
  --out-bg: #0a0e1f;
  --good: #7fdca3;
  --good-bg: #173327;
  --bad: #ffab96;
  --bad-bg: #3a1e1a;
  --warn-bg: #3a3218;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
}

/* Top bar, matching the main site */
.top-bar {
  background: var(--vi-blue);
  padding: 10px 24px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
  gap: 16px;
  flex-wrap: wrap;
}
.top-bar-logo img { height: 42px; width: auto; display: block; }
.top-bar-nav { display: flex; gap: 20px; font-family: var(--sans); font-size: 14px; flex-wrap: wrap; }
.top-bar-nav a { color: #ccd6ff; text-decoration: none; }
.top-bar-nav a:hover { color: #fff; }
/* Course button in the nav bar — always visible on every lesson page so a
   reader can get back to the course's Contents / enroll page from anywhere,
   the same way read.php's nav always has a "Free Books" button. Added
   2026-09-28 at VED's instruction. */
.nav-course-btn {
  background: var(--vi-gold);
  color: #1a1a1a !important;
  padding: 5px 12px;
  border-radius: 5px;
  font-weight: 600;
}
.nav-course-btn:hover { background: #ffdf9e; color: #1a1a1a !important; }

/* Lesson header */
.lesson-head {
  background: linear-gradient(135deg, var(--vi-blue) 0%, var(--vi-blue-dark) 70%, #0f1f5c 100%);
  color: #fff;
  padding: 28px 16px 26px;
}
.lesson-head-inner { max-width: 760px; margin: 0 auto; }
.crumbs { font-family: var(--sans); font-size: 13px; color: #ccd6ff; margin: 0 0 10px; }
.crumbs a { color: #ccd6ff; }
.lesson-head h1 {
  font-weight: normal;
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  line-height: 1.25;
  margin: 0 0 8px;
  text-wrap: balance;
}
.lesson-meta { font-family: var(--sans); font-size: 14px; color: #dfe5ff; margin: 0 0 16px; }
.lesson-meta .pill {
  display: inline-block;
  background: var(--vi-gold);
  color: var(--vi-blue-dark);
  font-weight: bold;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 10px;
  margin-right: 8px;
  vertical-align: 1px;
}
.head-row { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }

.lesson-progress { font-family: var(--sans); font-size: 13px; display: flex; align-items: center; gap: 10px; }
.prog-track { width: 140px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.22); overflow: hidden; }
.prog-fill { height: 100%; width: 0; background: var(--vi-gold); transition: width 0.4s; }
.lesson-progress.on-paper .prog-track { background: var(--tint); }
.lesson-progress.on-paper .prog-fill { background: var(--vi-blue); }

.engine-status { font-family: var(--sans); font-size: 12.5px; color: #dfe5ff; }
.engine-status::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: #9aa3c8;
  vertical-align: 1px;
}
.engine-status[data-state="loading"]::before { background: var(--vi-gold); animation: pulse 1s infinite alternate; }
.engine-status[data-state="ready"]::before { background: #62d98f; }
.engine-status[data-state="failed"]::before { background: #ff7b7b; }
@keyframes pulse { from { opacity: 0.35; } to { opacity: 1; } }

/* Main column */
main { max-width: 760px; margin: 0 auto; padding-inline: 16px; padding-block: 12px 64px; }
main h2 {
  font-weight: normal;
  color: var(--accent);
  font-size: 1.55rem;
  line-height: 1.3;
  margin: 2.2em 0 0.5em;
  text-wrap: balance;
}
main h3 { font-size: 1.15rem; line-height: 1.35; margin: 1.6em 0 0.4em; }
main p { margin: 0 0 1em; }
main ul, main ol { padding-left: 1.3em; margin: 0 0 1em; }
main li { margin-bottom: 0.35em; }
a { color: var(--accent); }
code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--tint);
  color: var(--code-ink);
  padding: 1px 5px;
  border-radius: 4px;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

main table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 1.2em;
  font-family: var(--sans);
  font-size: 0.92rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
main th, main td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
main th { background: var(--tint); font-weight: bold; }
main tr:last-child td { border-bottom: none; }
main td code, main th code { white-space: nowrap; }
@media (max-width: 600px) {
  main table { display: block; overflow-x: auto; }
}

.goals {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px 8px;
  margin: 22px 0;
}
.goals h2 { margin: 0 0 6px; font-size: 1.1rem; font-family: var(--sans); font-weight: bold; color: var(--ink); }

.note {
  background: var(--tint);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 0.96em;
}
.note p:last-child { margin-bottom: 0; }
.note-title { font-family: var(--sans); font-weight: bold; font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 4px; }

/* Breakdown of one line of code */
.anatomy { overflow-x: auto; margin: 16px 0 20px; }
.anatomy-line { display: flex; flex-wrap: wrap; gap: 10px 4px; font-family: var(--mono); font-size: 1.15rem; }
.anatomy-part { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.anatomy-part code { font-size: 1.15rem; padding: 6px 8px; background: var(--code-bg); border: 1px solid var(--line); }
.anatomy-part span { font-family: var(--sans); font-size: 12.5px; color: var(--muted); text-align: center; max-width: 130px; line-height: 1.3; }

/* Code boxes */
.databox {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 16px 0 22px;
  overflow: hidden;
}
.jsbox-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.jsbox-tag { font-weight: bold; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.databox textarea {
  display: block;
  width: 100%;
  border: 0;
  margin: 0;
  resize: none;
  overflow: hidden;
  overflow-x: auto;
  white-space: pre;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  padding: 12px 14px;
  background: var(--code-bg);
  color: var(--code-ink);
  tab-size: 4;
}
.databox textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.jsbox-input { padding: 8px 12px; border-top: 1px dashed var(--line); font-family: var(--sans); font-size: 13px; color: var(--muted); }
.jsbox-input label { display: block; margin-bottom: 4px; }
.jsbox-input textarea { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 14px; }
.jsbox-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }

.btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: bold;
  border-radius: 7px;
  padding: 8px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  line-height: 1.2;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-run { background: var(--vi-blue); color: #fff; }
.btn-run:hover:not(:disabled) { background: var(--vi-blue-dark); }
.btn-check { background: var(--vi-gold); color: var(--vi-blue-dark); }
.btn-check:hover:not(:disabled) { background: #ffca4a; }
.btn-quiet { background: transparent; color: var(--accent); border-color: var(--line); font-weight: normal; }
.btn-quiet:hover:not(:disabled) { background: var(--tint); }
.btn-small { font-size: 13px; padding: 5px 12px; background: var(--vi-blue); color: #fff; }

.jsbox-out { background: var(--out-bg); color: var(--out-ink); padding: 8px 14px 12px; }
.out-label { font-family: var(--sans); font-size: 11px; font-weight: bold; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; margin-bottom: 2px; }
.out-text { margin: 0; font-family: var(--mono); font-size: 14.5px; line-height: 1.55; white-space: pre; overflow-x: auto; }
.out-err { color: var(--out-err); }
.out-none, .out-wait { color: #a3abd6; font-style: italic; white-space: normal; }
.jsbox-out .explain {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 10px 0 0;
}
.jsbox-out .explain .btn-small { margin-top: 6px; background: var(--vi-gold); color: var(--vi-blue-dark); }

/* Static output shown in the text */
.shows { margin: -10px 0 20px; }
.shows pre { background: var(--out-bg); color: var(--out-ink); font-family: var(--mono); font-size: 14.5px; padding: 10px 14px; border-radius: 0 0 10px 10px; margin: 0; overflow-x: auto; }

/* Mistakes list */
.mistake { border-top: 1px solid var(--line); padding-top: 6px; }

/* Exercises */
.exercise {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px 18px 16px;
  margin: 26px 0;
}
.exercise h3 { font-family: var(--sans); font-size: 1rem; color: var(--accent); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.exercise .databox { margin: 12px 0 10px; }
.expected-label { font-family: var(--sans); font-size: 12px; font-weight: bold; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.expected { background: var(--code-bg); border: 1px dashed var(--line); border-radius: 8px; font-family: var(--mono); font-size: 14.5px; padding: 8px 12px; margin: 0 0 8px; white-space: pre; overflow-x: auto; }
.done-badge { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; background: var(--good-bg); color: var(--good); padding: 2px 9px; border-radius: 10px; }
.done-badge::before { content: "✓ "; }

.feedback { border-radius: 8px; padding: 12px 14px; font-family: var(--sans); font-size: 15px; line-height: 1.5; margin-top: 4px; }
.feedback p { margin: 4px 0 0; }
.feedback.good { background: var(--good-bg); color: var(--good); }
.feedback.bad { background: var(--bad-bg); color: var(--ink); }
.feedback.bad .fb-title { color: var(--bad); }
.feedback.pending { background: var(--tint); }
.fb-title { display: block; }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 10px; }
.compare-col { background: var(--out-bg); color: var(--out-ink); border-radius: 8px; padding: 8px 12px; min-width: 0; }
.diff-line { background: var(--diff); outline: 1px solid rgba(255, 213, 128, 0.6); }

.solution-box { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--code-bg); font-family: var(--sans); font-size: 14px; }
.sol-code { font-family: var(--mono); font-size: 14.5px; margin: 4px 0 8px; overflow-x: auto; color: var(--code-ink); }
.sol-note { margin: 0 0 8px; }

/* Quiz */
.quiz { margin: 18px 0; }
.quiz-q { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; margin-bottom: 14px; }
.quiz-q > p { margin-bottom: 8px; }
.quiz-q ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.opt {
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  font-size: 15px;
  background: var(--code-bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
}
.opt code { background: transparent; padding: 0; }
.opt:hover:not([aria-disabled="true"]) { border-color: var(--accent); }
.opt[aria-disabled="true"] { cursor: default; }
.opt.is-right { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.opt.is-wrong { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.why { font-family: var(--sans); font-size: 14.5px; line-height: 1.5; margin: 10px 0 0; }
.opt-mark { font-weight: bold; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.why:focus { outline: none; }
.quiz-score { font-family: var(--sans); font-weight: bold; color: var(--accent); }

/* Summary and footer */
.summary { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 6px 20px 10px; margin-top: 30px; }
.course-complete { background: var(--vi-blue); color: #fff; border-radius: 12px; padding: 22px 24px 26px; margin-top: 30px; }
.course-complete h2 { color: #fff; margin-top: 0; }
.course-complete p { font-family: var(--sans); font-size: 15.5px; line-height: 1.6; }
.course-complete p:last-child { margin-bottom: 0; }

/* Buy/enroll promo banner — shown on the free preview lessons (1.1, 1.2) */
.course-promo {
  background: var(--paper);
  border: 2px solid var(--vi-blue);
  border-radius: 12px;
  padding: 18px 22px 20px;
  margin-top: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.course-promo-text h2 { margin: 0 0 6px; font-size: 1.15rem; color: var(--vi-blue); }
.course-promo-text p { font-family: var(--sans); font-size: 14.5px; line-height: 1.55; color: var(--ink); margin: 0; max-width: 46em; }
.btn-buy {
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: bold;
  border-radius: 8px;
  padding: 11px 20px;
  background: var(--vi-gold);
  color: var(--vi-blue-dark);
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
}
.btn-buy:hover { background: #ffca4a; }
@media (max-width: 600px) {
  .course-promo { flex-direction: column; align-items: stretch; text-align: center; }
  .btn-buy { text-align: center; }
}
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 30px; font-family: var(--sans); font-size: 15px; }
.lesson-nav a, .lesson-nav span { padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); text-decoration: none; }
.lesson-nav .next { background: var(--vi-blue); color: #fff; border-color: var(--vi-blue); }
.lesson-nav .soon { color: var(--muted); }
.lesson-nav .course-done { background: var(--good-bg); color: var(--good); border-color: var(--good); font-weight: 600; }
.report { font-family: var(--sans); font-size: 13.5px; color: var(--muted); margin-top: 26px; }
footer { text-align: center; font-family: var(--sans); font-size: 13px; color: var(--muted); padding: 24px 16px 40px; border-top: 1px solid var(--line); }

@media (max-width: 600px) {
  body { font-size: 17px; }
  .top-bar { padding-inline: 14px; }
  .top-bar-logo img { height: 36px; }
  .top-bar-nav { gap: 14px; font-size: 13px; }
  .exercise { padding-inline: 12px; }
  .databox textarea, .jsbox-input textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .prog-fill { transition: none; }
  .engine-status[data-state="loading"]::before { animation: none; }
}

/* Ordered instruction lists (Lesson 1.1) */
.order-safe, .order-unsafe {
  font-family: var(--mono);
  font-size: 1.05rem;
  background: var(--code-bg);
  border-radius: 8px;
  padding: 14px 16px 14px 40px;
  margin: 14px 0 20px;
}
.order-safe { border-left: 4px solid var(--good); }
.order-unsafe { border-left: 4px solid var(--bad); }
.order-safe li, .order-unsafe li { margin-bottom: 6px; }

/* ---- JavaScript course additions ---- */
/* The hidden sealed-off frame each Run uses when there is no practice page */
.jsbox-hidden-frame { position: absolute; width: 0; height: 0; border: 0; visibility: hidden; }
/* The practice web page shown in Module 12 onwards */
.jsbox-page { border-top: 1px solid var(--line); padding: 8px 12px 12px; background: var(--tint); }
.jsbox-page .out-label { color: var(--muted); opacity: 1; margin-bottom: 6px; }
.jsbox-frame { display: block; width: 100%; height: 120px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.out-warn { color: var(--vi-gold); }
.out-errlog { color: var(--out-err); }
/* Source code of a practice page, shown in the lesson text */
.page-src { margin: -10px 0 20px; }
.page-src pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 0 0 10px 10px; font-family: var(--mono); font-size: 14px; padding: 10px 14px; margin: 0; overflow-x: auto; color: var(--code-ink); }
/* The practice page's HTML, shown above the code in Module 12 onwards */
.page-html { border-bottom: 1px solid var(--line); font-family: var(--sans); font-size: 13px; }
.page-html summary { cursor: pointer; padding: 7px 12px; color: var(--accent); }
.page-html pre { margin: 0; padding: 8px 14px 12px; font-family: var(--mono); font-size: 13.5px; line-height: 1.5; overflow-x: auto; background: var(--paper); color: var(--code-ink); }
/* Long inline code (e.g. document.querySelector("#message")) may break
   onto the next line on a narrow phone instead of widening the page. */
main p code, main li code, .why code, .note code, .opt code { overflow-wrap: anywhere; }



/* ---------- Humanoid Robot Hardware Fundamentals: exercises, diagrams, explorers ---------- */
.formula { font-family: var(--serif); font-size: 1.15rem; text-align: center; background: var(--tint); border-radius: 8px; padding: 10px 12px; margin: 14px 0; overflow-x: auto; }
.worked { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--vi-gold); border-radius: 8px; padding: 8px 18px 10px; margin: 18px 0; }
.worked-title { font-family: var(--sans); font-weight: bold; font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 4px; }
.worked p:last-child { margin-bottom: 0; }

figure.dg { margin: 18px auto; max-width: 640px; text-align: center; }
figure.dg svg { width: 100%; height: auto; display: block; font-family: var(--sans); }
figure.dg figcaption { font-family: var(--sans); font-size: 14px; color: var(--muted); margin-top: 6px; text-align: center; }
.dg .line, .dg .thin, .dg .thick, .dg .dash, .dg .acc, .dg .red, .dg .green { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.dg .line { stroke: var(--ink); stroke-width: 2; }
.dg .thin { stroke: var(--muted); stroke-width: 1; }
.dg .thick { stroke: var(--ink); stroke-width: 4; }
.dg .dash { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.dg .acc { stroke: var(--vi-blue); stroke-width: 2.5; }
.dg .red { stroke: #c0392b; stroke-width: 2.5; }
.dg .green { stroke: #1f7a45; stroke-width: 2.5; }
.dg .fill-a { fill: #dfe6ff; stroke: var(--ink); stroke-width: 1.5; }
.dg .fill-b { fill: #ffe9b8; stroke: var(--ink); stroke-width: 1.5; }
.dg .fill-c { fill: #d6f0df; stroke: var(--ink); stroke-width: 1.5; }
.dg .fill-d { fill: #f8d8d0; stroke: var(--ink); stroke-width: 1.5; }
.dg .fill-n { fill: #eceef6; stroke: var(--ink); stroke-width: 1.5; }
.dg .head-acc { fill: var(--vi-blue); stroke: none; }
.dg .head-red { fill: #c0392b; stroke: none; }
.dg .head-green { fill: #1f7a45; stroke: none; }
.dg .head-line, .dg .head-thick { fill: var(--ink); stroke: none; }
.dg .lbl { font-size: 14px; fill: var(--ink); }
.dg .lbl-s { font-size: 13px; fill: var(--ink); }
.dg .lbl-b { font-size: 14px; font-weight: bold; fill: var(--ink); }
.dg .lbl-m { font-size: 13px; fill: var(--muted); }
.dg .lbl-a { font-size: 14px; font-weight: bold; fill: var(--vi-blue); }
.dg .lbl-r { font-size: 14px; font-weight: bold; fill: #c0392b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dg .fill-a { fill: #26336e; }
  :root:not([data-theme="light"]) .dg .fill-b { fill: #5a4a1c; }
  :root:not([data-theme="light"]) .dg .fill-c { fill: #1d4a33; }
  :root:not([data-theme="light"]) .dg .fill-d { fill: #5a2a22; }
  :root:not([data-theme="light"]) .dg .fill-n { fill: #262c4d; }
  :root:not([data-theme="light"]) .dg .acc { stroke: #a9b8ff; }
  :root:not([data-theme="light"]) .dg .head-acc { fill: #a9b8ff; }
  :root:not([data-theme="light"]) .dg .lbl-a { fill: #a9b8ff; }
}
:root[data-theme="dark"] .dg .fill-a { fill: #26336e; }
:root[data-theme="dark"] .dg .fill-b { fill: #5a4a1c; }
:root[data-theme="dark"] .dg .fill-c { fill: #1d4a33; }
:root[data-theme="dark"] .dg .fill-d { fill: #5a2a22; }
:root[data-theme="dark"] .dg .fill-n { fill: #262c4d; }
:root[data-theme="dark"] .dg .acc { stroke: #a9b8ff; }
:root[data-theme="dark"] .dg .head-acc { fill: #a9b8ff; }
:root[data-theme="dark"] .dg .lbl-a { fill: #a9b8ff; }

.explorer { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 4px 18px 16px; margin: 22px 0; }
.explorer-title { font-family: var(--sans); font-weight: bold; color: var(--accent); margin: 10px 0 4px; }
.explorer-intro, .explorer-note { font-family: var(--sans); font-size: 14.5px; color: var(--muted); margin: 4px 0 8px; }
.explorer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.explorer-row { display: grid; grid-template-columns: 1fr; gap: 2px; margin-bottom: 10px; font-family: var(--sans); font-size: 14.5px; }
.explorer-row input[type=range] { width: 100%; accent-color: var(--vi-blue); }
.explorer-read { font-weight: bold; color: var(--accent); font-variant-numeric: tabular-nums; }
.explorer-out { font-family: var(--sans); font-size: 14.5px; margin-bottom: 10px; }
.explorer-out-name { display: block; color: var(--muted); }
.explorer-out-val { font-size: 1.25rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.explorer-track { height: 10px; background: var(--tint); border-radius: 5px; overflow: hidden; margin-top: 4px; }
.explorer-fill { height: 100%; width: 0; transition: width 0.15s; }
.explorer-fill.ok { background: var(--vi-blue); }
.explorer-fill.warn { background: #e0a020; }
.explorer-fill.danger { background: #c0392b; }
.explorer-tag { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .explorer-grid { grid-template-columns: 1fr; } }

.hw-body { margin: 10px 0; }
.hw-inputrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-family: var(--sans); }
.hw-num { font-family: var(--mono); font-size: 16px; padding: 8px 10px; width: 9em; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.hw-num:focus-visible, .hw-match select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.hw-unit { font-family: var(--sans); color: var(--muted); }
.hw-options { display: grid; gap: 8px; }
.hw-option { display: flex; gap: 10px; align-items: flex-start; background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; cursor: pointer; font-family: var(--sans); font-size: 15px; }
.hw-option:hover { border-color: var(--accent); }
.hw-option input { margin-top: 4px; }
.hw-order { list-style: decimal; padding-left: 26px; display: grid; gap: 8px; margin: 0; }
.hw-order-item { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-family: var(--sans); font-size: 15px; }
.hw-order-item .hw-order-text { display: inline-block; width: calc(100% - 96px); vertical-align: middle; }
.hw-order-item button { margin-left: 6px; padding: 3px 9px; }
.hw-match { display: grid; gap: 8px; }
.hw-match-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 44%); gap: 10px; align-items: center; font-family: var(--sans); font-size: 15px; }
.hw-match select { width: 100%; min-width: 0; text-overflow: ellipsis; font-size: 15px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); max-width: 100%; }
@media (max-width: 560px) { .hw-match-row { grid-template-columns: 1fr; } .hw-order-item .hw-order-text { width: 100%; display: block; margin-bottom: 6px; } }
.hw-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }
.exercise figure.dg { margin: 12px auto; }
.sol-body p:last-child { margin-bottom: 0; }

@media (max-width: 600px) {
  figure.dg { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  figure.dg svg { min-width: 460px; }
  figure.dg figcaption { position: sticky; left: 0; }
}

/* ---- AI and Machine Learning course: the AI workbench ---- */
.labbox {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 16px 0 22px;
  overflow: hidden;
}
.labbox textarea {
  display: block;
  width: 100%;
  border: 0;
  margin: 0;
  resize: none;
  overflow: hidden;
  overflow-x: auto;
  white-space: pre;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  padding: 12px 14px;
  background: var(--code-bg);
  color: var(--code-ink);
  tab-size: 4;
}
.labbox textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.exercise .labbox { margin: 10px 0 12px; }

.lab-vis { border-top: 1px solid var(--line); background: var(--tint); padding: 10px; display: grid; gap: 12px; }
.lab-card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px 10px; max-width: 580px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.lab-card-title { font-family: var(--sans); font-size: 13px; font-weight: bold; color: var(--muted); margin: 0 0 6px; }
.lab-chart { display: block; width: 100%; height: auto; }
.lab-table-wrap { max-height: 360px; overflow: auto; margin: 0; }
.lab-table { font-family: var(--mono); font-size: 13.5px; margin: 0; }
.lab-table th { position: sticky; top: 0; }
.lab-empty { color: var(--bad); font-style: italic; }
.lab-more { font-family: var(--sans); font-size: 13px; color: var(--muted); margin: 6px 0 0; }

.ch-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-family: var(--sans); font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.ch-key { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.ch-swatch { display: inline-block; width: 18px; height: 0; border-top: 3px solid currentColor; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-axis { stroke: var(--muted); stroke-width: 1; }
.ch-lbl { font-family: var(--sans); font-size: 11px; fill: var(--muted); }
.ch-name { font-family: var(--sans); font-size: 12px; font-weight: bold; fill: var(--ink); }
.bar-lbl { font-size: 12px; fill: var(--ink); }
.ch-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.c1 { stroke: #d9822b; color: #d9822b; }
.c2 { stroke: #b0306a; color: #b0306a; }
.c3 { stroke: #1f7a45; color: #1f7a45; }
.c4 { stroke: #6a4fb3; color: #6a4fb3; }
.pt { stroke: var(--paper); stroke-width: 1; }
.g1 { fill: #2c3e8f; }
.g2 { fill: #d9822b; }
.g3 { fill: #1f7a45; }
.g4 { fill: #b0306a; }
.g5 { fill: #6a4fb3; }
.g6 { fill: #6b6f80; }
.pt-lbl { font-family: var(--sans); font-size: 11.5px; fill: var(--ink); }
.bar { fill: #2c3e8f; }

.lab-images { display: flex; flex-wrap: wrap; gap: 10px; }
.lab-img { margin: 0; text-align: center; font-family: var(--sans); font-size: 12.5px; color: var(--muted); }
.lab-px { display: block; width: 88px; height: 88px; border: 1px solid var(--line); border-radius: 4px; shape-rendering: crispEdges; }
.px-bg { fill: #ffffff; }
.px-on { fill: #10162e; }

/* the reference card of workbench commands */
.cmdcard { font-family: var(--sans); font-size: 15px; }
.cmdcard td:first-child { font-family: var(--mono); font-size: 14px; white-space: nowrap; }
@media (max-width: 560px) { .cmdcard td:first-child { white-space: normal; word-break: break-word; } }
@media (max-width: 560px) { .labbox textarea { font-size: 16px; } }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .g1, :root:not([data-theme="light"]) .bar { fill: #a9b8ff; }
  :root:not([data-theme="light"]) .g3 { fill: #7fdca3; }
  :root:not([data-theme="light"]) .g4 { fill: #f08bbb; }
  :root:not([data-theme="light"]) .g5 { fill: #c3b0ff; }
  :root:not([data-theme="light"]) .g6 { fill: #a4aac6; }
  :root:not([data-theme="light"]) .c2 { stroke: #f08bbb; color: #f08bbb; }
  :root:not([data-theme="light"]) .c3 { stroke: #7fdca3; color: #7fdca3; }
  :root:not([data-theme="light"]) .c4 { stroke: #c3b0ff; color: #c3b0ff; }
  :root:not([data-theme="light"]) .px-bg { fill: #0a0e1f; }
  :root:not([data-theme="light"]) .px-on { fill: #e4e8ff; }
}
:root[data-theme="dark"] .g1, :root[data-theme="dark"] .bar { fill: #a9b8ff; }
:root[data-theme="dark"] .g3 { fill: #7fdca3; }
:root[data-theme="dark"] .g4 { fill: #f08bbb; }
:root[data-theme="dark"] .g5 { fill: #c3b0ff; }
:root[data-theme="dark"] .g6 { fill: #a4aac6; }
:root[data-theme="dark"] .c2 { stroke: #f08bbb; color: #f08bbb; }
:root[data-theme="dark"] .c3 { stroke: #7fdca3; color: #7fdca3; }
:root[data-theme="dark"] .c4 { stroke: #c3b0ff; color: #c3b0ff; }
:root[data-theme="dark"] .px-bg { fill: #0a0e1f; }
:root[data-theme="dark"] .px-on { fill: #e4e8ff; }
.lab-table th, .lab-table td { padding: 5px 12px; }
/* long answers in the output wrap instead of running off the side */
.jsbox-out .out-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- Cyber Safety and Security Basics ---- */
.lab { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; margin: 16px 0 22px; padding: 12px 14px 14px; }
.lab-tag, .msgdemo-tag { font-family: var(--sans); font-size: 12px; font-weight: bold; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.lab-warn { font-family: var(--sans); font-size: 13.5px; color: var(--muted); margin: 0 0 8px; }
.lab-input { width: 100%; box-sizing: border-box; font-family: var(--mono); font-size: 16px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--code-bg); color: var(--code-ink); }
textarea.lab-input { resize: vertical; }
.lab-input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.lab-row { display: flex; gap: 8px; align-items: center; }
.lab-row .lab-input { flex: 1 1 auto; min-width: 0; }
.lab-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 0; font-family: var(--sans); font-size: 13px; color: var(--muted); }
.lab-grid { display: grid; gap: 10px; grid-template-columns: 2fr 1fr; }
@media (max-width: 560px) { .lab-grid { grid-template-columns: 1fr; } }
.lab-field { display: grid; gap: 4px; font-family: var(--sans); font-size: 13px; color: var(--muted); margin-top: 8px; }
.pw-out { margin-top: 10px; font-family: var(--sans); font-size: 14.5px; }
.pw-meter { height: 10px; background: var(--tint); border-radius: 6px; overflow: hidden; }
.pw-fill { height: 100%; border-radius: 6px; transition: width .2s; }
.lv0 { background: #b3261e; } .lv1 { background: #d9822b; } .lv2 { background: #c9a227; } .lv3 { background: #3b8f4f; } .lv4 { background: #1f6f3a; }
.lv0-text { color: #b3261e; } .lv1-text { color: #b8651a; } .lv2-text { color: #8f7212; } .lv3-text { color: #2e7d42; } .lv4-text { color: #1f6f3a; }
.pw-label { margin: 6px 0; }
table.pw-times, table.link-parts { width: 100%; margin: 6px 0; font-size: 14px; }
table.pw-times th, table.link-parts th { text-align: left; font-weight: normal; color: var(--muted); width: 60%; }
.pw-parts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.pw-parts-lbl { color: var(--muted); font-size: 13px; }
.pw-chip { background: var(--tint); border: 1px solid var(--line); border-radius: 14px; padding: 2px 9px; font-size: 13px; }
.pw-chip.rnd { background: var(--good-bg); }
.pw-tips { margin: 6px 0 0; padding-left: 20px; font-size: 14px; }
.link-out { margin-top: 10px; font-family: var(--sans); font-size: 14.5px; }
.link-addr { font-family: var(--mono); font-size: 15px; overflow-wrap: anywhere; margin: 0 0 6px; }
.link-addr .dim { color: var(--muted); }
.link-reg { font-weight: bold; background: var(--warn-bg); padding: 0 2px; border-radius: 3px; color: var(--ink); }
.link-where { font-weight: bold; margin: 0 0 6px; overflow-wrap: anywhere; }
.link-note { margin: 4px 0; padding: 6px 9px; border-radius: 7px; background: var(--tint); }
.link-note.bad { background: var(--bad-bg); color: var(--bad); }
.link-note.warn { background: var(--warn-bg); }
.link-note.good { background: var(--good-bg); color: var(--good); }
.cipher-out { margin: 8px 0; font-family: var(--sans); font-size: 14px; overflow-wrap: anywhere; }
.cipher-out code, .hash-out { font-family: var(--mono); font-size: 14px; background: var(--code-bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.cipher-lbl { color: var(--muted); font-family: var(--sans); font-size: 13px; display: block; margin-top: 8px; }
.hash-out { display: block; margin: 6px 0; overflow-wrap: anywhere; word-break: break-all; font-size: 12.5px; }
.hash-verdict { font-family: var(--sans); font-size: 14.5px; font-weight: bold; margin: 8px 0 0; }
.hash-verdict.same { color: var(--good); } .hash-verdict.diff { color: var(--bad); }
.msgdemo { margin: 16px 0 22px; }
.msg { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-family: var(--sans); font-size: 15px; line-height: 1.5; max-width: 620px; box-shadow: 0 1px 3px rgba(20,30,70,.08); }
.msg-head { background: var(--tint); padding: 10px 14px; border-bottom: 1px solid var(--line); }
.msg-row { display: flex; gap: 8px; margin: 1px 0; overflow-wrap: anywhere; }
.msg-lbl { color: var(--muted); min-width: 70px; font-size: 13px; padding-top: 1px; }
.msg-subject .msg-val { font-weight: bold; }
.msg-body { padding: 10px 14px 12px; }
.msg-body p { margin: 6px 0; }
.msg-phonebar, .msg-popbar { background: var(--vi-blue); color: #fff; padding: 9px 14px; font-weight: bold; }
.msg-popbar { background: #b3261e; }
.msg-time { text-align: center; color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.msg-sms .msg-body, .msg-chat .msg-body { background: var(--bg); }
.msg-bubble { background: var(--paper); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 12px; max-width: 85%; }
.msg-bubble.me { margin-left: auto; background: var(--tint); border-radius: 14px 14px 4px 14px; }
.msg-browser { display: flex; gap: 10px; align-items: center; background: var(--tint); padding: 7px 10px; border-bottom: 1px solid var(--line); }
.msg-dots { color: var(--muted); font-size: 10px; letter-spacing: 2px; }
.msg-address { flex: 1; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 3px 10px; font-family: var(--mono); font-size: 13.5px; overflow-wrap: anywhere; }
.msg-title { font-weight: bold; font-size: 18px; padding: 10px 14px 0; }
.msg-field { display: grid; gap: 3px; margin: 8px 0; font-size: 14px; }
.msg-input { display: block; height: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--code-bg); }
.msg-attach { margin: 8px 0; padding: 6px 10px; border: 1px dashed var(--line); border-radius: 8px; display: inline-block; }
.msg-button { display: inline-block; margin: 8px 0 4px; background: var(--vi-blue); color: #fff; padding: 8px 16px; border-radius: 8px; font-weight: bold; }
.msg-footer { color: var(--muted); font-size: 13px; }
.msg-line { margin: 5px 0; }
.seg { border-radius: 3px; }
.msg-spot .seg { cursor: pointer; border-bottom: 1px dotted var(--muted); }
.msg-spot .seg:hover { background: var(--tint); }
.msg-spot .seg:focus-visible { outline: 2px solid var(--focus); }
.seg.seg-on { background: #ffe2a8; color: #1e2233; border-bottom: 2px solid #d9822b; }
.msg-button .seg.seg-on, .msg-phonebar .seg.seg-on, .msg-popbar .seg.seg-on { color: #1e2233; }
.seg.seg-flag { outline: 2px solid #b3261e; outline-offset: 1px; background: rgba(179,38,30,.12); }
.seg.seg-flag[data-n]::after { content: attr(data-n); display: inline-block; margin-left: 3px; background: #b3261e; color: #fff; font-size: 11px; font-weight: bold; border-radius: 8px; padding: 0 5px; vertical-align: super; line-height: 1.4; }
.msg-notes { font-family: var(--sans); font-size: 14.5px; margin: 8px 0 0; padding-left: 22px; }
.msg-notes li { margin: 4px 0; }
.msgdemo .btn-small { margin-top: 8px; }
.sec-ex { margin: 10px 0; }
.sec-howto { font-family: var(--sans); font-size: 13.5px; color: var(--muted); margin: 0 0 6px; }
.sec-options { display: grid; gap: 8px; }
.sec-option { display: flex; gap: 10px; align-items: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-family: var(--sans); font-size: 15px; cursor: pointer; }
.sec-option input { margin-top: 4px; flex: none; }
.sec-option:hover { border-color: var(--accent); }
.sec-order { list-style: decimal; padding-left: 26px; display: grid; gap: 8px; margin: 0; }
.sec-order-item { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-family: var(--sans); font-size: 15px; display: flex; gap: 8px; align-items: center; }
.sec-order-text { flex: 1; }
.sec-order-btns { display: flex; gap: 4px; flex: none; }
.sec-match { display: grid; gap: 8px; }
.sec-match-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 46%); gap: 10px; align-items: center; font-family: var(--sans); font-size: 15px; }
.sec-match select { width: 100%; font-size: 15px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
@media (max-width: 560px) { .sec-match-row { grid-template-columns: 1fr; } }
.sec-inputrow { display: flex; gap: 8px; align-items: center; max-width: 520px; }
.sec-num { max-width: 180px; }
.sec-unit { font-family: var(--sans); color: var(--muted); }
.sec-toggles { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; max-width: 520px; overflow: hidden; font-family: var(--sans); }
.sec-toggles-title { background: var(--tint); padding: 9px 14px; font-weight: bold; border-bottom: 1px solid var(--line); }
.sec-toggle { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.sec-toggle:last-child { border-bottom: 0; }
.sec-toggle-text { flex: 1; display: grid; }
.sec-toggle-note { color: var(--muted); font-size: 13px; }
.sec-toggle input { position: absolute; opacity: 0; width: 44px; height: 24px; right: 14px; margin: 0; cursor: pointer; }
.sec-switch { width: 44px; height: 24px; border-radius: 12px; background: #b9bdd0; position: relative; flex: none; transition: background .15s; }
.sec-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.sec-toggle input:checked + .sec-switch { background: #3b8f4f; }
.sec-toggle input:checked + .sec-switch::after { left: 23px; }
.sec-toggle input:focus-visible + .sec-switch { outline: 2px solid var(--focus); outline-offset: 2px; }
.sec-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.sol-body p:last-child { margin-bottom: 0; }
.checklist td:first-child { width: 36px; text-align: center; }
/* ---- Cybersecurity Fundamentals: record search ---- */
.log-cols { font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin: 6px 0 0; overflow-wrap: anywhere; }
.log-out { margin-top: 10px; font-family: var(--sans); font-size: 14px; }
.log-count { margin: 0 0 6px; }
.log-wrap { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; -webkit-overflow-scrolling: touch; }
table.log-table { margin: 0; font-family: var(--mono); font-size: 12px; border-collapse: collapse; width: max-content; min-width: 100%; }
table.log-table th { position: sticky; top: 0; background: var(--tint); z-index: 1; }
table.log-table th, table.log-table td { padding: 4px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; }
table.log-groups { margin: 4px 0; font-family: var(--mono); font-size: 13px; width: 100%; max-width: 560px; }
table.log-groups td, table.log-groups th { padding: 3px 8px; text-align: left; overflow-wrap: anywhere; }
.log-bar-cell { width: 55%; white-space: nowrap; }
.log-bar { display: inline-block; height: 12px; background: #2c3e8f; border-radius: 3px; vertical-align: middle; margin-right: 6px; }
.log-bar-n { font-size: 12.5px; }
.log-ex { font-family: var(--mono); font-size: 12px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .log-bar { background: #a9b8ff; } }
:root[data-theme="dark"] .log-bar { background: #a9b8ff; }
.lab-row .btn { white-space: nowrap; flex: none; }
