/* Palette from "colour theme for the site" + logo */
:root {
  --ink: #2b2c20;        /* logo background, dark olive-black */
  --olive: #8e8b63;
  --olive-deep: #5f5c3e; /* olive darkened for readable text */
  --sage: #d6d4ad;
  --blush: #eddada;
  --rose: #cb8587;
  --rose-deep: #a65f63;  /* rose darkened for readable text */
  --cream: #f7f1f1;      /* footer logo background */

  --bg: #fffdfc;
  --bg-alt: var(--cream);
  --text: var(--ink);
  --muted: #6b6a58;
  --border: #ead9d9;
  --radius: 18px;
  --shadow: 0 12px 32px rgba(43, 44, 32, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: var(--rose-deep); text-decoration: none; }
h1, h2, h3 { font-family: Outfit, Inter, sans-serif; line-height: 1.15; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); letter-spacing: -.01em; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0 0 1em; }
em { color: var(--rose-deep); font-style: normal; font-weight: 600; }

.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(720px, 100% - 32px); }
.center { text-align: center; }
.sub { color: var(--muted); margin-bottom: 2.5rem; }
.muted { color: var(--muted); }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--rose);
  color: var(--ink);
  padding: .4rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--rose);
  cursor: pointer;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  transition: background .2s, border-color .2s, transform .2s;
}
.btn:hover { background: #bf7376; border-color: #bf7376; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--blush); }
.btn-sm { padding: .24rem .8rem; font-size: .84rem; }
@media (max-width: 760px) { .btn-sm { padding: .34rem .85rem; } }   /* a little taller for fingers */

/* Nav (dark, matches the site logo) */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--ink);
  border-bottom: 1px solid #3a3b2c;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { display: block; }
/* The logo PNG has wide padding; this window shows just the mark + wordmark */
.logo-crop { display: block; width: 190px; aspect-ratio: 628 / 92; overflow: hidden; }
.logo-crop img { width: 140.13%; max-width: none; margin: -24.52% 0 0 -20.38%; }
.nav-links { display: flex; gap: 1.6rem; align-items: center; }
.nav-links a { color: var(--blush); font-weight: 500; }
.nav-links a:not(.btn):hover { color: var(--sage); }
.nav-links a.btn { color: var(--ink); }
.nav-toggle { display: none; background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--blush); }

/* Hero */
.hero {
  padding: 5rem 0 4.5rem;
  background:
    radial-gradient(circle at 88% 15%, rgba(214, 212, 173, .55), transparent 42%),
    radial-gradient(circle at 5% 90%, rgba(203, 133, 135, .25), transparent 45%),
    var(--blush);
}
.hero-inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; }
.eyebrow { color: var(--olive-deep); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-size: .85rem; }
.lead { font-size: 1.15rem; color: #4d4c3d; max-width: 36em; }
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1.8rem 0; }
.hero-points { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 1.2rem; color: #4d4c3d; font-size: .95rem; }
.hero-points li::before { content: "✓ "; color: var(--rose-deep); font-weight: 700; }

.code-card {
  background: var(--ink); color: var(--blush);
  border-radius: var(--radius); box-shadow: 0 20px 45px rgba(43, 44, 32, .25);
  overflow: hidden;
}
.code-bar { display: flex; gap: 7px; padding: .85rem 1rem; background: #36372a; }
.code-bar span { width: 11px; height: 11px; border-radius: 50%; background: var(--rose); }
.code-bar span:nth-child(2) { background: var(--blush); }
.code-bar span:nth-child(3) { background: var(--sage); }
.code-card pre { margin: 0; padding: 1.4rem; overflow-x: auto; font-family: "JetBrains Mono", monospace; font-size: .92rem; line-height: 1.75; }
.k { color: var(--rose); } .f { color: var(--sage); } .s { color: #e9b9ba; } .c { color: var(--olive); }

/* Sections */
.section { padding: 5rem 0; scroll-margin-top: 68px; } /* keep headings clear of the sticky nav */
.alt { background: var(--bg-alt); }

.about { display: grid; grid-template-columns: 320px 1fr; gap: 3rem; align-items: center; }
.avatar {
  width: 220px; height: 220px; border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), var(--sage));
  color: var(--ink); font-family: Outfit, sans-serif; font-size: 4rem; font-weight: 700;
  display: grid; place-items: center; box-shadow: var(--shadow);
  border: 6px solid var(--blush);
}
.schools { width: 100%; height: auto; }
.stats { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; gap: 2.5rem; flex-wrap: wrap; }
.stats strong { display: block; font-family: Outfit, sans-serif; font-size: 1.7rem; color: var(--rose-deep); }
.stats span { color: var(--muted); font-size: .9rem; }

.grid { display: grid; gap: 1.5rem; }
.cards { grid-template-columns: repeat(3, 1fr); }
.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.8rem; transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--rose); }
.card p { color: var(--muted); margin: 0; }
.icon {
  font-size: 1.6rem; margin-bottom: 1rem;
  width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px;
  background: var(--blush);
}
.card:nth-child(3n+2) .icon { background: var(--sage); }
.card:nth-child(3n) .icon { background: #e6e4cf; }

.steps { list-style: none; padding: 0; margin: 2.5rem 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.steps li { text-align: center; padding: 0 .5rem; }
.steps p { color: var(--muted); }
.num {
  display: inline-grid; place-items: center; width: 50px; height: 50px; border-radius: 50%;
  background: var(--ink); color: var(--blush); font-family: Outfit, sans-serif; font-weight: 700; font-size: 1.1rem; margin-bottom: 1rem;
}
.steps li:nth-child(2) .num { background: var(--rose); color: var(--ink); }
.steps li:nth-child(3) .num { background: var(--olive); color: #fff; }
.steps li:nth-child(4) .num { background: var(--sage); color: var(--ink); }

.pricing { grid-template-columns: repeat(3, 1fr); align-items: stretch; }
.price-card {
  position: relative; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2rem; display: flex; flex-direction: column;
}
.price-card.featured { background: var(--ink); color: var(--blush); border-color: var(--ink); box-shadow: 0 20px 45px rgba(43, 44, 32, .25); }
.price-card.featured ul, .price-card.featured .price span { color: #d9cfc6; }
.price-card ul { list-style: none; padding: 0; margin: 0 0 1.5rem; flex: 1; color: var(--muted); }
.price-card li { padding: .35rem 0; }
.price-card li::before { content: "✓ "; color: var(--rose); font-weight: 700; }
.price-card .btn { text-align: center; }
.price { font-family: Outfit, sans-serif; font-size: 2.4rem; font-weight: 700; margin-bottom: 1rem; }
.price span { font-size: 1rem; color: var(--muted); font-weight: 500; }
.tag {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: var(--sage); color: var(--ink); font-size: .75rem; font-weight: 700;
  padding: .3rem .9rem; border-radius: 999px; white-space: nowrap;
}

details {
  border: 1px solid var(--border); border-radius: 14px; padding: 1rem 1.2rem; margin-bottom: .8rem; background: #fff;
}
details[open] { border-color: var(--rose); background: #fffafa; }
summary { cursor: pointer; font-weight: 600; }
summary::marker { color: var(--rose); }
details p { margin: .8rem 0 0; color: var(--muted); }

.contact { background: linear-gradient(180deg, var(--blush), var(--cream)); }
.form { display: grid; gap: 1rem; background: #fff; padding: 2rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form label { display: grid; gap: .4rem; font-weight: 500; font-size: .95rem; }
.form input, .form select, .form textarea {
  font: inherit; padding: .75rem .9rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--ink);
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--rose); border-color: transparent; }
.form .btn { justify-self: start; }

/* Footer (matches the footer logo background) */
.footer { background: var(--cream); border-top: 1px solid var(--border); padding: 3rem 0 2rem; font-size: .9rem; }
.footer-inner { display: grid; justify-items: center; gap: 1.2rem; text-align: center; }
.footer-logo { width: 85px; }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: var(--ink); font-weight: 500; }
.footer-links a:hover { color: var(--rose-deep); }
.footer p { margin: 0; }

/* Responsive */
@media (max-width: 900px) {
  .hero-inner, .about { grid-template-columns: 1fr; }
  .about { text-align: center; }
  .schools { width: min(280px, 100%); margin: 0 auto; }
  .stats { justify-content: center; }
  .cards, .pricing { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
}
/* the menu needs about 900px on one line, so it folds away below that */
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .logo-crop { width: 160px; }
  .nav-links {
    display: none; position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--ink); border-bottom: 1px solid #3a3b2c;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .9rem 16px; width: 100%; text-align: center; }
  .nav-links .btn-sm { width: auto; margin: .5rem 0 1rem; }
}
@media (max-width: 720px) {
  .cards, .pricing, .steps, .form .row { grid-template-columns: 1fr; }
  .pricing { gap: 2rem; }
  .form { padding: 1.4rem; }
  .section { padding: 3.5rem 0; }
  .hero { padding: 3rem 0; }
}

/* Syllabus code badge on subject cards */
.code-badge {
  display: inline-block; margin-bottom: .6rem;
  font-family: "JetBrains Mono", monospace; font-size: .78rem; font-weight: 500;
  color: var(--rose-deep); background: var(--cream); border: 1px solid var(--border);
  padding: .15rem .6rem; border-radius: 999px;
}

/* Centre a lone last subject card in the 3-column grid */
@media (min-width: 901px) {
  .cards .card:last-child:nth-child(3n+1) { grid-column: 2; }
}

/* ---------- Course pages (o-level-2210.html) ---------- */
.card-link { display: inline-block; margin-top: 1rem; font-weight: 600; color: var(--rose-deep); }
.card-link:hover { color: var(--ink); }

.course-hero { padding: 3.5rem 0 3rem; }
.course-hero h1 { margin-top: .4rem; }
.back { display: block; width: fit-content; margin-bottom: 1.2rem; color: var(--olive-deep); font-weight: 600; font-size: .95rem; }
.jump { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.jump a {
  background: rgba(255, 255, 255, .7); border: 1px solid var(--border); color: var(--ink);
  padding: .4rem .9rem; border-radius: 999px; font-size: .9rem; font-weight: 500;
}
.jump a:hover { background: var(--ink); color: var(--blush); border-color: var(--ink); }
.narrow-wide { width: min(860px, 100% - 32px); }

.chapters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.chapter {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.6rem;
  scroll-margin-top: 84px;
}
.chapter-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.chapter-head h3 { margin: 0; }
.chapter-label { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--olive-deep); font-weight: 700; }
.chapter-num {
  flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--ink); color: var(--blush); font-family: Outfit, sans-serif; font-weight: 700; font-size: 1.2rem;
}
.chapter:nth-child(4n+2) .chapter-num { background: var(--rose); color: var(--ink); }
.chapter:nth-child(4n+3) .chapter-num { background: var(--olive); color: #fff; }
.chapter:nth-child(4n) .chapter-num { background: var(--sage); color: var(--ink); }
.soon { margin: 0; color: var(--muted); font-style: italic; }

.res-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.res {
  display: flex; align-items: center; gap: .8rem; padding: .75rem 1rem;
  background: var(--cream); border: 1px solid var(--border); border-radius: 12px; color: var(--ink);
  transition: border-color .2s, background .2s;
}
.res:hover { border-color: var(--rose); background: #fff; }
.res-icon { font-size: 1.2rem; }
.res-title { flex: 1; font-weight: 500; overflow-wrap: anywhere; }
.res-kind {
  flex: none; font-size: .75rem; font-weight: 600; color: var(--rose-deep);
  background: #fff; border: 1px solid var(--border); padding: .1rem .55rem; border-radius: 999px;
}

.code-item pre {
  margin: 1rem 0 .6rem; background: var(--ink); color: var(--blush); border-radius: 12px;
  padding: 1rem 1.2rem; overflow-x: auto; font-family: "JetBrains Mono", monospace; font-size: .88rem; line-height: 1.65;
}
.code-open { font-size: .85rem; font-weight: 600; }

/* Flashcards */
.flashcard {
  display: grid; place-items: center; gap: 1rem; width: 100%; min-height: 280px; margin: 0 0 1.5rem;
  padding: 2rem; border-radius: var(--radius); border: 2px solid var(--border); background: #fff;
  font: inherit; color: var(--ink); cursor: pointer; text-align: center; box-shadow: var(--shadow);
  transition: background .25s, border-color .25s;
}
.flashcard.is-answer { background: var(--ink); color: var(--blush); border-color: var(--ink); }
.flash-side { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--rose-deep); }
.flashcard.is-answer .flash-side { color: var(--sage); }
.flash-text { font-family: Outfit, sans-serif; font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 500; line-height: 1.4; }
.flash-controls { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.link-btn { background: none; border: 0; font: inherit; color: var(--rose-deep); font-weight: 600; cursor: pointer; margin-top: 1rem; }

@media (max-width: 720px) {
  .chapters { grid-template-columns: 1fr; }
  .flash-controls .btn { padding: .7rem 1rem; }
}

/* ---------- Course landing pages ---------- */
.course-hero-inner { display: grid; grid-template-columns: 1.3fr .9fr; gap: 3rem; align-items: center; }
.glance {
  background: #fff; border-radius: var(--radius); padding: 1.8rem; box-shadow: var(--shadow);
  border-top: 6px solid var(--rose);
}
.glance h2 { font-size: 1.3rem; margin-bottom: 1rem; }
.glance dl { margin: 0 0 1rem; display: grid; gap: .7rem; }
.glance dl div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dashed var(--border); padding-bottom: .6rem; }
.glance dt { color: var(--muted); }
.glance dd { margin: 0; font-weight: 600; text-align: right; }
.glance-for { margin: 0; font-size: .95rem; color: var(--muted); }
.glance-for strong { color: var(--ink); }

.topic-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.topic-group { background: var(--cream); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.8rem; }
.topic-group h3 { color: var(--rose-deep); }
.topic-list { margin: 0; padding-left: 1.4rem; display: grid; gap: .45rem; }
.topic-list li::marker { color: var(--olive); font-weight: 700; }

.mat-head { font-size: 1.4rem; margin: 2.5rem 0 1rem; scroll-margin-top: 84px; }
#materials .jump a { background: var(--cream); }
.cta-band { background: var(--ink); color: var(--blush); }
.cta-band h2 { color: var(--blush); }
.cta-band .sub { color: #cfc7bf; }

@media (max-width: 900px) {
  .course-hero-inner, .topic-groups { grid-template-columns: 1fr; }
}

/* ---------- Chapter pages ---------- */
.chapter-hero h1 { margin-top: .4rem; }
.crumbs { font-size: .9rem; color: var(--olive-deep); margin-bottom: 1rem; }
.crumbs a { color: var(--olive-deep); font-weight: 600; }
.objectives {
  background: rgba(255, 255, 255, .75); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.5rem; margin: 1.2rem 0 0; max-width: 760px;
}
.objectives h2 { font-size: 1.1rem; margin-bottom: .5rem; }
.objectives ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.objectives li::marker { content: "✓  "; color: var(--rose-deep); font-weight: 700; }
.chapter-open { margin-top: 1rem; }

/* Notes converted from Word */
.notes { font-size: .97rem; }
.notes p { margin: 0 0 .5em; }
.notes img { max-width: 100%; height: auto; display: inline-block; vertical-align: middle; border-radius: 6px; margin: .3rem 0; }
.notes ul, .notes ol { margin: .2em 0 .7em; padding-left: 1.3rem; }
.notes strong { color: var(--ink); }
.notes .table-wrap { overflow-x: auto; margin: 0 0 1.4rem; border-radius: 12px; }
.notes table { width: 100%; border-collapse: collapse; background: #fff; }
.notes td, .notes th { border: 1px solid var(--border); padding: .6rem .75rem; vertical-align: top; min-width: 120px; }
.notes > .table-wrap > table > tbody > tr:first-child > td,
.notes > .table-wrap > table > tr:first-child > td { background: var(--blush); }
.notes .table-wrap .table-wrap { margin: .5rem 0; }
.notes .table-wrap .table-wrap td { background: var(--cream); }
.notes-part { margin-top: 3rem; padding-top: 1.5rem; border-top: 2px dashed var(--border); }

.traps { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.traps li {
  background: #fff; border: 1px solid var(--border); border-left: 5px solid var(--rose);
  border-radius: 12px; padding: .9rem 1.1rem;
}
.traps li::before { content: "⚠ "; color: var(--rose-deep); font-weight: 700; }

.chapter-pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }
.chapter-pager a { color: var(--sage); font-weight: 600; }
.chapter-pager a:hover { color: var(--blush); }

/* Quiz */
.quiz { display: grid; gap: 1.2rem; }
.q { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; padding: 1.3rem 1.4rem; margin: 0; min-width: 0; }
.q legend { display: flex; gap: .7rem; align-items: baseline; width: 100%; padding: 0; margin-bottom: .9rem; font-weight: 600; float: left; }
.q legend + * { clear: both; }
.q-num {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--ink); color: var(--blush); font-size: .85rem; font-family: Outfit, sans-serif;
}
.q-text { flex: 1; }
.q-marks { flex: none; color: var(--muted); font-weight: 500; font-size: .9rem; }
.q-input {
  width: 100%; font: inherit; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); color: var(--ink); resize: vertical;
}
.q-input:focus { outline: 2px solid var(--rose); border-color: transparent; }
.q-options { display: grid; gap: .5rem; }
.q-option {
  display: flex; gap: .6rem; align-items: center; padding: .6rem .9rem; border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; background: var(--bg);
}
.q-option:hover { border-color: var(--rose); }
.q-option input { accent-color: var(--rose-deep); }
.q-feedback { margin-top: 1rem; padding: .9rem 1.1rem; border-radius: 12px; font-size: .95rem; display: grid; gap: .4rem; }
.q-feedback.full { background: #eef0e2; border: 1px solid var(--sage); }
.q-feedback.part { background: var(--cream); border: 1px solid var(--border); }
.q-feedback.none { background: #f9eaea; border: 1px solid var(--rose); }
.q-score { margin: 0; font-family: Outfit, sans-serif; font-weight: 700; font-size: 1.1rem; }
.mp-title { font-weight: 600; }
.mark-points { list-style: none; padding: 0; margin: .3rem 0 0; display: grid; gap: .2rem; }
.mark-points .got { color: var(--olive-deep); font-weight: 600; }
.mark-points .miss { color: var(--muted); }
.trap { color: var(--rose-deep); font-weight: 600; }
.quiz-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.quiz-result { background: var(--ink); color: var(--blush); border-radius: var(--radius); padding: 1.5rem; }
.quiz-result a:not(.btn) { color: var(--sage); }
.quiz-total { font-family: Outfit, sans-serif; font-size: 2rem; font-weight: 700; margin: 0 0 .5rem; }
.quiz-total span { font-size: 1.1rem; color: var(--sage); }
.quiz-result .muted { color: #cfc7bf; }
.small { font-size: .85rem; }

/* Notes: 1 Syllabus, 2 Key terms, 3 Detailed notes */
.notes-nav { margin: .5rem 0 2rem; }
.notes-nav a { background: var(--cream); }
.notes-part-block { margin-bottom: 3.5rem; scroll-margin-top: 84px; }
.notes-head { display: flex; align-items: center; gap: .7rem; font-size: 1.5rem; margin-bottom: 1rem; }
.notes-head span {
  width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center;
  background: var(--ink); color: var(--blush); font-size: 1rem;
}
.notes-part-block .sub { margin-bottom: 1.2rem; }

.syl-topics { display: grid; gap: 1rem; }
.syl-topic { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.syl-topic h4 { margin: 0; padding: .8rem 1.2rem; background: var(--blush); font-family: Outfit, sans-serif; font-size: 1.1rem; }
.syl-can { margin: .9rem 1.2rem .3rem; color: var(--rose-deep); font-weight: 600; font-size: .9rem; }
.syl-points { margin: 0 1.2rem 1rem; padding-left: 1.4rem; display: grid; gap: .45rem; }
.syl-points li::marker { font-weight: 700; color: var(--olive-deep); }
.syl-sub { display: inline-block; margin-left: .2rem; font-weight: 600; color: var(--olive-deep); }
.syl-subsub { display: inline-block; margin-left: 1.4rem; color: var(--olive-deep); }
.syl-guidance { border-top: 1px solid var(--border); padding: .7rem 1.2rem; background: var(--cream); }
.syl-guidance summary { cursor: pointer; font-weight: 600; color: var(--rose-deep); }
.syl-guidance ul { margin: .6rem 0 .2rem; padding-left: 1.2rem; display: grid; gap: .3rem; font-size: .95rem; }
.syl-guidance ul ul { margin: .2rem 0; list-style: "– "; }

.terms { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; margin: 0; }
.term { background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--sage); border-radius: 12px; padding: .8rem 1rem; }
.term dt { font-weight: 700; font-family: Outfit, sans-serif; margin-bottom: .2rem; }
.term dd { margin: 0; color: var(--muted); font-size: .93rem; }

.notes-sub {
  margin: 2.5rem 0 1rem; padding: .6rem 1rem; border-radius: 12px; background: var(--ink); color: var(--blush);
  font-size: 1.15rem; scroll-margin-top: 84px;
}
.notes-sub:first-child { margin-top: 0; }

/* Page-by-page PDF notes */
.pdf-viewer { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; scroll-margin-top: 80px; }
.pdf-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .7rem .9rem;
  background: var(--ink); color: var(--blush);
}
.pdf-btn {
  font: inherit; font-weight: 600; font-size: .9rem; padding: .45rem .9rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rose); background: var(--rose); color: var(--ink);
}
.pdf-btn.small { padding: .3rem .75rem; }
.pdf-btn:disabled { opacity: .4; cursor: default; }
.pdf-count { font-size: .9rem; }
.pdf-page { width: 3.4rem; font: inherit; padding: .2rem .3rem; border-radius: 8px; border: 0; text-align: center; }
.pdf-jump { font: inherit; font-size: .85rem; padding: .35rem .5rem; border-radius: 8px; border: 0; max-width: 16rem; }
.pdf-zoom { display: inline-flex; gap: .3rem; }
.pdf-open { margin-left: auto; color: var(--sage); font-weight: 600; font-size: .9rem; }
.pdf-stage { background: var(--cream); padding: 1rem; overflow: auto; outline: none; text-align: center; }
.pdf-stage:focus-visible { box-shadow: inset 0 0 0 3px var(--rose); }
.pdf-stage canvas { background: #fff; box-shadow: var(--shadow); max-width: none; display: inline-block; }
.pdf-status { margin: 2rem 0; color: var(--muted); }
.pdf-bottom { display: flex; justify-content: space-between; padding: .7rem .9rem; border-top: 1px solid var(--border); }
@media (max-width: 720px) {
  .pdf-toolbar { gap: .4rem; }
  .pdf-open { margin-left: 0; }
  .pdf-jump { max-width: 100%; flex: 1 1 100%; }
  .pdf-stage { padding: .4rem; }
}

/* ---------- Chapter sidebar layout ---------- */
.chapter-body { padding-top: 2.5rem; }
.ch-layout { display: grid; grid-template-columns: 250px 1fr; gap: 2rem; align-items: start; scroll-margin-top: 80px; }
.ch-sidebar { position: sticky; top: 88px; display: grid; gap: 1rem; }
.ch-nav { display: grid; gap: .3rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem; }
.ch-nav a {
  display: flex; gap: .6rem; align-items: center; padding: .65rem .8rem; border-radius: 12px;
  color: var(--ink); font-weight: 500; font-size: .95rem;
}
.ch-nav a:hover { background: var(--cream); }
.ch-nav a.active { background: var(--ink); color: var(--blush); }
.ch-nav hr { border: 0; border-top: 1px dashed var(--border); margin: .3rem .4rem; }
.side-icon { width: 1.4rem; text-align: center; }
.side-book { background: var(--blush); border-radius: var(--radius); padding: 1rem; text-align: center; }
.side-book p { margin: 0 0 .6rem; font-weight: 600; }
.ch-panels { min-width: 0; }
.ch-panel > h2 { margin-bottom: 1rem; }
.panel-sub { margin: 2rem 0 1rem; font-size: 1.3rem; }
.objectives-box { background: var(--cream); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.4rem; margin-bottom: 1.5rem; }
.objectives-box h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.objectives-box ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.objectives-box li::marker { content: "✓  "; color: var(--rose-deep); font-weight: 700; }
.soon-box { background: var(--cream); border: 1px dashed var(--rose); border-radius: var(--radius); padding: 1.5rem; text-align: center; }
.soon-box p { margin: 0 0 .5rem; }

/* quiz: objective headings, past-paper tags and results by objective */
.q-objective { margin: 1.4rem 0 -.2rem; font-size: 1.05rem; color: var(--rose-deep); }
.q-objective:first-child { margin-top: 0; }
.q-based { display: block; font-weight: 500; font-size: .8rem; color: var(--olive-deep); margin-top: .25rem; }
.obj-table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .92rem; }
.obj-table th, .obj-table td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid rgba(237, 218, 218, .2); }
.obj-table th { color: var(--sage); font-weight: 600; }
.obj-level { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.obj-level.secure { background: var(--sage); color: var(--ink); }
.obj-level.developing { background: var(--blush); color: var(--ink); }
.obj-level.help { background: var(--rose); color: var(--ink); }
.obj-book { margin-top: .5rem; }

@media (max-width: 900px) {
  .ch-layout { grid-template-columns: 1fr; gap: 1.2rem; }
  .ch-sidebar { position: sticky; top: 68px; z-index: 6; }
  .ch-nav { display: flex; overflow-x: auto; gap: .3rem; padding: .4rem; border-radius: 14px; scrollbar-width: none; }
  .ch-nav a { flex: none; padding: .5rem .8rem; font-size: .88rem; white-space: nowrap; }
  .ch-nav hr { display: none; }
  .side-book { display: none; }
}

/* PDF notes are view-only: never printed */
@media print { .pdf-viewer, .pdf-viewer * { display: none !important; } }
.pdf-stage canvas { user-select: none; -webkit-user-drag: none; }

/* Exam traps: question, wrong answer, correct answer */
.trap-list { display: grid; gap: 1.2rem; }
.trap-card { background: #fff; border: 1px solid var(--border); border-left: 5px solid var(--rose); border-radius: var(--radius); padding: 1.1rem 1.3rem; }
.trap-title { margin: 0 0 .7rem; font-weight: 700; }
.trap-title::before { content: "⚠ "; color: var(--rose-deep); }
.trap-q { background: var(--cream); border-radius: 10px; padding: .7rem .9rem; margin-bottom: .8rem; font-size: .95rem; }
.trap-answers { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.trap-wrong, .trap-right { border-radius: 10px; padding: .7rem .9rem; font-size: .95rem; }
.trap-wrong { background: #f9eaea; border: 1px solid var(--rose); }
.trap-right { background: #eef0e2; border: 1px solid var(--sage); }
.trap-answers p { margin: 0 0 .35rem; }
.trap-label { font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.trap-wrong .trap-label { color: var(--rose-deep); }
.trap-right .trap-label { color: var(--olive-deep); }
.trap-why { color: var(--muted); font-size: .88rem; font-style: italic; }

/* Revision key: key terms and infographics per subtopic */
.rev-nav a { background: var(--cream); }
.rev-sub { margin-top: 2rem; scroll-margin-top: 84px; }
.rev-sub > h3 { padding: .55rem 1rem; border-radius: 12px; background: var(--ink); color: var(--blush); font-size: 1.1rem; }
.rev-h { margin: 1.4rem 0 .7rem; font-size: 1rem; color: var(--rose-deep); }
.rev-figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.rev-fig { margin: 0; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem; }
.rev-fig img { width: 100%; height: auto; border-radius: 8px; }
.rev-fig figcaption { font-size: .85rem; color: var(--muted); margin-top: .4rem; text-align: center; }
@media (max-width: 720px) { .trap-answers { grid-template-columns: 1fr; } }

/* Sidebar sub-links (interactive practice topics) */
.ch-subnav { display: none; margin: -.1rem 0 .3rem .9rem; border-left: 2px solid var(--border); padding-left: .4rem; }
.ch-subnav.open { display: grid; gap: .1rem; }
.ch-subnav a { padding: .4rem .6rem; font-size: .86rem; border-radius: 8px; color: var(--muted); }
.ch-subnav a.active { background: var(--blush); color: var(--ink); font-weight: 600; }

/* Interactive practice */
.tool-pills { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.2rem; }
.tool-pills button, .mode-switch button {
  font: inherit; font-size: .88rem; padding: .4rem .85rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--cream); color: var(--ink);
}
.tool-pills button.active, .mode-switch button.active { background: var(--ink); color: var(--blush); border-color: var(--ink); }
.tool h3 { margin-bottom: .7rem; }
.mode-switch { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.tool-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem 1.4rem; }
.tool-q { font-size: 1.05rem; margin: 0 0 1rem; }
.grid-label { margin: .4rem 0 .3rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
.pv-grid-wrap { overflow-x: auto; }
.pv-grid { border-collapse: separate; border-spacing: 4px; margin: 0 0 .3rem; }
.pv-grid th { font-family: Outfit, sans-serif; font-size: .95rem; color: var(--olive-deep); padding: .2rem 0; min-width: 52px; text-align: center; }
.pv-grid.signed th:first-child { color: var(--rose-deep); }
.pv-grid td { padding: 0; text-align: center; }
.pv-grid .gap { padding-left: 14px; }
.pv-bit {
  display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 12px;
  font: 700 1.4rem "JetBrains Mono", monospace; border: 2px solid var(--border); background: var(--cream); color: var(--muted);
}
button.pv-bit { cursor: pointer; transition: transform .1s; }
button.pv-bit:hover { border-color: var(--rose); }
button.pv-bit:active { transform: scale(.94); }
.pv-bit.b1 { background: var(--ink); color: var(--blush); border-color: var(--ink); }
.pv-hex td { font: 700 1.2rem "JetBrains Mono", monospace; color: var(--rose-deep); padding-top: .2rem; }
.pv-total { margin: .2rem 0 .6rem; font-size: .95rem; }
.pv-help { display: inline-flex; gap: .4rem; align-items: center; font-size: .85rem; color: var(--muted); margin: .3rem 0 .8rem; cursor: pointer; }
.tool-answer { margin: .4rem 0 1rem; }
.tool-answer label { font-weight: 600; }
.tool-input { max-width: 14rem; margin-left: .5rem; }
.ovf { border: 1px solid var(--border); border-radius: 12px; padding: .6rem 1rem; }
.ovf label { margin-right: 1rem; font-weight: 500; }
.tool-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.tool-score { margin-left: auto; font-weight: 600; color: var(--olive-deep); }
.tool-feedback { margin-top: 1rem; padding: .7rem 1rem; border-radius: 12px; font-weight: 600; }
.tool-feedback.good { background: #eef0e2; border: 1px solid var(--sage); color: var(--olive-deep); }
.tool-feedback.bad { background: #f9eaea; border: 1px solid var(--rose); color: var(--rose-deep); }
.tool-working { margin-top: 1rem; padding: 1rem 1.2rem; background: var(--cream); border-radius: 12px; line-height: 1.8; }
.steps-list { margin: .4rem 0 .6rem; padding-left: 1.4rem; font-family: "JetBrains Mono", monospace; font-size: .9rem; line-height: 1.7; }
.sum-pre { font: 600 1.05rem/1.6 "JetBrains Mono", monospace; background: var(--cream); padding: .6rem 1rem; border-radius: 10px; display: inline-block; margin: .6rem 0; }
.tool-working .sum-pre { background: #fff; }
/* fraction for file size */
.frac-input { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; }
.fr-top { display: flex; gap: .4rem; align-items: center; font-weight: 700; }
.fr-line { width: 100%; height: 3px; background: var(--ink); margin: .45rem 0; border-radius: 2px; }
.fbox { width: 5.5rem; padding: .5rem; text-align: center; font: 600 1.05rem "JetBrains Mono", monospace; border: 2px solid var(--border); border-radius: 10px; }
.fbox:focus, .fsel:focus { outline: 2px solid var(--rose); }
.fsel { font: inherit; padding: .45rem .6rem; border-radius: 10px; border: 2px solid var(--border); }
.frac-eq { display: inline-flex; gap: .4rem; align-items: center; margin-left: .8rem; font-weight: 700; vertical-align: middle; }
.frac-labels { font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }
.frac-show { margin-bottom: .6rem; font-size: 1.05rem; }
.fr { display: inline-flex; flex-direction: column; text-align: center; vertical-align: middle; margin-right: .3rem; }
.fr span:first-child { border-bottom: 2px solid var(--ink); padding: 0 .4rem .1rem; }
@media (max-width: 900px) {
  .ch-subnav, .ch-subnav.open { display: none; }  /* phones: use the topic buttons inside the panel */
}
@media (max-width: 720px) {
  .pv-grid th { min-width: 34px; font-size: .78rem; }
  .pv-bit { width: 34px; height: 40px; font-size: 1.1rem; border-radius: 9px; }
  .pv-grid { border-spacing: 2px; }
  .pv-grid .gap { padding-left: 6px; }
  .fbox { width: 4.2rem; font-size: .95rem; }
  .frac-eq { margin: .8rem 0 0; }
  .tool-score { margin-left: 0; }
}

.pv-help[hidden] { display: none; }

/* Conversion practice: sets of 8 questions, 16-bit grids, effect options */
.set-progress { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin-bottom: 1rem; padding-bottom: .8rem; border-bottom: 1px dashed var(--border); }
.set-count { font-weight: 700; }
.set-dots { display: inline-flex; gap: .3rem; }
.set-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--border); display: inline-block; }
.set-dots i.done { background: var(--olive); }
.set-dots i.now { background: var(--rose); box-shadow: 0 0 0 3px var(--blush); }
.set-progress .tool-score { margin-left: auto; }
.set-result { text-align: center; padding: 1.5rem 0 .5rem; }
.set-total { font-family: Outfit, sans-serif; font-size: 2.4rem; font-weight: 700; margin: 0; }
.set-total span { font-size: 1.1rem; color: var(--muted); }
.pv-byte { margin: .5rem 0 .1rem; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pv-grid.w16 th { font-size: .82rem; }
.ovf-opt { display: block; margin: .35rem 0; font-weight: 500; cursor: pointer; }
.ovf legend { font-weight: 600; padding: 0 .3rem; }

/* Sound sampling lab */
.lab-intro { background: var(--cream); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.3rem; margin-bottom: 1.2rem; }
.lab-intro p { margin: 0 0 .4rem; }
.lab-defs { margin: 0; padding-left: 1.2rem; }
.lab-panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.lab-controls { display: grid; grid-template-columns: 1fr 1.4fr 1.4fr; gap: 1.2rem; margin-bottom: .8rem; }
.lab-ctrl { display: grid; gap: .35rem; font-weight: 600; font-size: .92rem; }
.lab-ctrl b { color: var(--rose-deep); }
.lab-ctrl select { font: inherit; font-weight: 500; padding: .45rem .6rem; border-radius: 10px; border: 1px solid var(--border); }
.lab-ctrl input[type=range] { width: 100%; accent-color: var(--rose-deep); }
.lab-scale { display: flex; justify-content: space-between; font-size: .75rem; font-weight: 500; color: var(--muted); }
.lab-toggles { display: flex; flex-wrap: wrap; gap: 1.1rem; font-size: .88rem; margin-bottom: .6rem; }
.lab-toggles label { display: inline-flex; gap: .35rem; align-items: center; cursor: pointer; }
.key { display: inline-block; width: 18px; height: 4px; border-radius: 2px; }
.k-wave { background: var(--rose); } .k-dig { background: var(--ink); }
.k-samp { width: 9px; height: 9px; border-radius: 50%; background: var(--olive); }
.lab-canvas-wrap { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.lab-canvas { width: 100%; display: block; }
.lab-axis { text-align: center; font-size: .8rem; color: var(--muted); margin: .3rem 0 .6rem; }
.lab-play { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.lab-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: 1.2rem 0; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; display: grid; gap: .2rem; font-size: .88rem; color: var(--muted); }
.stat-n { font: 700 1.6rem Outfit, sans-serif; color: var(--ink); }
.stat.wide { grid-column: 1 / -1; color: var(--ink); }
.acc-bar { height: 8px; background: var(--blush); border-radius: 4px; overflow: hidden; }
.acc-bar i { display: block; height: 100%; background: var(--olive); }
.lab-table { border-collapse: collapse; width: 100%; background: #fff; font-size: .92rem; }
.lab-table th, .lab-table td { border: 1px solid var(--border); padding: .45rem .7rem; text-align: left; }
.lab-table th { background: var(--blush); }
.mono { font-family: "JetBrains Mono", monospace; letter-spacing: .05em; }
.lab-tasks { padding-left: 1.3rem; display: grid; gap: .4rem; }
.lq { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1.1rem; margin-bottom: .8rem; }
.lq-q { margin: 0 0 .6rem; font-weight: 500; }
.lq-opts { display: flex; flex-wrap: wrap; gap: .5rem; }
.lq-opt { font: inherit; font-size: .9rem; padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--cream); cursor: pointer; }
.lq-opt.right { background: var(--sage); border-color: var(--olive); }
.lq-opt.wrong { background: #f9eaea; border-color: var(--rose); }
.lq-fb { margin: .6rem 0 0; font-size: .9rem; font-weight: 600; }
.lq-fb.good { color: var(--olive-deep); } .lq-fb.bad { color: var(--rose-deep); }
@media (max-width: 900px) { .lab-controls { grid-template-columns: 1fr; } .lab-stats { grid-template-columns: 1fr 1fr; } }

/* Image lab and text lab */
.lab-controls.two { grid-template-columns: 1fr 1fr; }
.img-stage { display: grid; grid-template-columns: minmax(0, 640px) 1fr; gap: 1.2rem; align-items: start; }
.img-canvas { display: block; max-width: 100%; border-radius: 10px; border: 1px solid var(--border); cursor: crosshair; image-rendering: pixelated; }
.img-inspect { background: var(--cream); border-radius: 12px; padding: .9rem 1rem; font-size: .92rem; }
.img-inspect p { margin: 0 0 .4rem; }
.swatch { display: inline-block; width: 44px; height: 44px; border-radius: 8px; border: 2px solid var(--ink); margin-bottom: .4rem; }
.swatch.sm { width: 14px; height: 14px; border-width: 1px; margin: 0 .25rem -2px 0; border-radius: 3px; }
.big-code { font-size: 1.05rem; font-weight: 700; word-break: break-all; }
.rle-ctrl { max-width: 360px; margin-bottom: .6rem; }
.rle-strip { display: flex; flex-wrap: wrap; gap: 1px; margin-bottom: .7rem; }
.rle-strip i { width: 14px; height: 18px; border-radius: 2px; border: 1px solid rgba(0,0,0,.12); }
.rle-runs { display: flex; flex-wrap: wrap; gap: .4rem; }
.rle-run { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: .2rem .5rem; font-size: .85rem; }
.good-txt { color: var(--olive-deep); font-weight: 600; } .bad-txt { color: var(--rose-deep); font-weight: 600; }
.txt-in { font-size: 1.1rem; }
.txt-table td, .case-table td { vertical-align: middle; }
.big-char { font-size: 1.3rem; font-weight: 700; }
.txt-table tr.not-ok td { background: #f9eaea; color: var(--rose-deep); }
.stat.chosen { border: 2px solid var(--ink); }
.case-ctrl { max-width: 160px; margin-bottom: .6rem; }
.case-in { text-align: center; font-size: 1.2rem; }
.case-table mark { background: var(--rose); color: var(--ink); padding: 0 .15rem; border-radius: 3px; }
.lab-steps { padding-left: 1.3rem; display: grid; gap: .35rem; }
.decode-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.3rem; display: grid; gap: .8rem; }
.decode-codes { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.code-chip { background: var(--ink); color: var(--blush); padding: .35rem .6rem; border-radius: 8px; font-size: 1rem; }
.decode-in { max-width: 14rem; margin-left: .5rem; }
.ascii-chart { margin-top: 1rem; background: var(--cream); border-radius: 12px; padding: .8rem 1rem; }
.ascii-chart summary { cursor: pointer; font-weight: 600; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 4px; margin: .8rem 0; }
.chart-cell { font: inherit; display: grid; padding: .3rem 0; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; text-align: center; }
.chart-cell b { font-size: 1.05rem; } .chart-cell span { font-size: .72rem; color: var(--muted); }
.chart-cell:hover { border-color: var(--rose); }
@media (max-width: 900px) { .img-stage, .lab-controls.two { grid-template-columns: 1fr; } }

/* Compression lab */
.kw-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; margin-bottom: 1rem; }
.kw { background: #fff; border: 1px solid var(--border); border-top: 5px solid var(--olive); border-radius: var(--radius); padding: .9rem 1.1rem; font-size: .93rem; }
.kw.lossy { border-top-color: var(--rose); } .kw.rle { border-top-color: var(--ink); }
.kw h4 { margin: 0 0 .4rem; font-size: 1.02rem; }
.kw p { margin: 0 0 .4rem; } .kw-eg { color: var(--muted); }
.rle-chars { display: flex; flex-wrap: wrap; gap: .35rem; }
.run-grp { display: inline-flex; padding: 2px; border-radius: 6px; background: var(--blush); }
.run-grp i { font: 700 .95rem "JetBrains Mono", monospace; font-style: normal; width: 1.3rem; text-align: center; }
.rle-code { background: var(--ink); color: var(--blush); padding: .15rem .5rem; border-radius: 6px; }
.ly-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: .8rem 0; }
.ly-pair figure { margin: 0; }
.ly-pair canvas { display: block; max-width: 100%; border-radius: 10px; border: 1px solid var(--border); image-rendering: pixelated; }
.ly-pair figcaption { font-size: .88rem; margin-top: .4rem; }
.scen-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.scen { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; }
.scen-t { margin: 0 0 .6rem; font-weight: 600; }
.scen-btns { display: flex; gap: .5rem; }
.scen-btns button, .chip { font: inherit; font-size: .88rem; padding: .35rem .9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--cream); cursor: pointer; }
.scen-btns .right, .gap.right { background: var(--sage); border-color: var(--olive); }
.scen-btns .wrong, .gap.wrong { background: #f9eaea; border-color: var(--rose); }
.scen-fb { margin: .5rem 0 0; font-size: .88rem; }
.build-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.3rem; display: grid; gap: .9rem; }
.build-s { margin: 0; line-height: 2.2; }
.gap { font: inherit; font-weight: 600; min-width: 7rem; padding: .1rem .6rem; border: 0; border-bottom: 2px dashed var(--rose-deep); background: var(--cream); border-radius: 6px 6px 0 0; cursor: pointer; }
.gap.active { outline: 2px solid var(--rose); }
.build-bank { display: flex; flex-wrap: wrap; gap: .45rem; padding-top: .6rem; border-top: 1px dashed var(--border); }
.chip:hover { border-color: var(--rose); }
@media (max-width: 900px) { .kw-grid, .ly-pair { grid-template-columns: 1fr; } }

/* ---------- Chapter structure: groups, next buttons, phone menu ---------- */
.side-group .group-head { font-weight: 600; }
.side-group .group-head.active { background: var(--blush); color: var(--ink); }
.side-group .ch-subnav { display: none; }
.side-group.open .ch-subnav { display: grid; gap: .1rem; }
.ch-subnav a.active { background: var(--ink); color: var(--blush); font-weight: 600; }
.panel-group { margin: 0 0 .2rem; font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--rose-deep); }
.panel-next { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px dashed var(--border); text-align: right; }
.how-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.4rem; margin-bottom: 1.5rem; }
.how-box h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.how-box ol { margin: 0; padding-left: 1.3rem; display: grid; gap: .35rem; }
.syl-mini { background: var(--cream); border: 1px solid var(--border); border-radius: 12px; padding: .7rem 1rem; margin-bottom: 1.2rem; }
.syl-mini summary { cursor: pointer; font-weight: 600; color: var(--rose-deep); }
.syl-mini .sub { display: none; }
.syl-mini .syl-topics { margin-top: .8rem; }
.rev-figs.big { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.rev-fig img { user-select: none; -webkit-user-drag: none; }
.ch-menu-btn { display: none; }
@media (max-width: 900px) {
  .ch-sidebar { position: sticky; top: 68px; z-index: 20; }
  .ch-menu-btn {
    display: flex; width: 100%; justify-content: space-between; align-items: center; gap: .6rem;
    font: inherit; padding: .7rem 1rem; border-radius: 14px; border: 1px solid var(--ink);
    background: var(--ink); color: var(--blush); cursor: pointer; text-align: left;
  }
  .ch-menu-btn span { font-size: .85rem; opacity: .85; white-space: nowrap; }
  .ch-menu-btn b { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ch-nav, .ch-nav.ch-nav { display: none; }
  .ch-sidebar.menu-open .ch-nav {
    display: grid; gap: .2rem; position: absolute; left: 0; right: 0; top: calc(100% + 6px);
    max-height: 70vh; overflow-y: auto; padding: .6rem; border-radius: 14px; box-shadow: var(--shadow);
  }
  .ch-sidebar.menu-open .ch-nav a { white-space: normal; flex: none; }
  .ch-sidebar.menu-open .side-group .ch-subnav { display: none; }
  .ch-sidebar.menu-open .side-group.open .ch-subnav { display: grid; }
  .ch-sidebar.menu-open .ch-nav hr { display: block; }
}
.ch-layout > * { min-width: 0; }
.ch-menu-btn b { min-width: 0; flex: 1; text-align: right; }
.ch-menu-btn { min-width: 0; max-width: 100%; overflow: hidden; }
.ch-menu-btn span { flex: none; }
.table-wrap, .ls-out { overflow-x: auto; max-width: 100%; }
@media (max-width: 720px) { .lab-table { font-size: .82rem; } .lab-table th, .lab-table td { padding: .35rem .45rem; } }

/* "Prepared by" credit at the bottom of every chapter section */
.panel-next { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; text-align: left; }
.credit { display: inline-flex; align-items: center; gap: .6rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
.credit img { height: 26px; width: auto; border-radius: 6px; user-select: none; }

/* ---------- Chapter 2 labs ---------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.seg button { font: inherit; font-size: .9rem; padding: .4rem .9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--cream); cursor: pointer; }
.seg button.active { background: var(--ink); color: var(--blush); border-color: var(--ink); }
/* packets */
.pk-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem; margin-bottom: .6rem; }
.pk { border: 2px solid var(--c); border-radius: 12px; overflow: hidden; background: #fff; font-size: .82rem; }
.pk > div { display: grid; gap: .1rem; padding: .45rem .7rem; }
.pk b { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.pk-h { background: var(--c); color: #fff; }
.pk-p { background: #fff; } .pk-p .mono { font-size: 1rem; }
.pk-t { background: var(--cream); color: var(--muted); }
.pk-net-wrap { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; margin-bottom: .6rem; }
.pk-net { width: 100%; display: block; }
.pk-chip { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 800; font-size: .85rem; margin: 0 .15rem; }
.pk-final { font-size: 1.05rem; font-weight: 600; }
/* methods */
.tm-stage { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; margin: .4rem 0 .6rem; }
.tm-svg { width: 100%; display: block; }
.tm-name { font-family: Outfit, sans-serif; font-size: 1.15rem; margin-left: .5rem; }
.kw-grid.two { grid-template-columns: 1fr 1fr; margin-top: 1rem; }
.kw ul { margin: .2rem 0 .5rem; padding-left: 1.2rem; }
/* error detection */
.err-tabs { margin-bottom: 1rem; }
.err-tab h3 { margin-bottom: .5rem; }
.eb-row { display: flex; gap: 5px; flex-wrap: wrap; margin: .3rem 0 .8rem; }
.eb { display: inline-grid; place-items: center; width: 40px; height: 44px; border-radius: 9px; font: 700 1.2rem "JetBrains Mono", monospace; border: 2px solid var(--border); background: var(--cream); color: var(--muted); }
button.eb { cursor: pointer; }
.eb.b1 { background: var(--ink); color: var(--blush); border-color: var(--ink); }
.eb.pbit { box-shadow: 0 0 0 3px var(--sage); }
.eb.flipped { border-color: var(--rose-deep) !important; box-shadow: 0 0 0 3px var(--rose); }
.pb-table { border-collapse: collapse; background: #fff; font-size: .9rem; }
.pb-table th, .pb-table td { border: 1px solid var(--border); padding: .3rem .4rem; text-align: center; }
.pb-table th { background: var(--blush); }
.pb-table th.bad, .pb-table tr.bad th { background: var(--rose); }
.pb-cell { font: 700 1rem "JetBrains Mono", monospace; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--cream); cursor: pointer; display: inline-grid; place-items: center; }
.pb-cell.fixed { cursor: default; background: #eef0e2; }
.pb-cell.sel { background: var(--rose); border-color: var(--rose-deep); color: #fff; }
.code-chip.chip-bad, .chip-bad { background: var(--rose-deep) !important; color: #fff; border-radius: 4px; }
.echo-flow, .en-flow { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .8rem 0; }
.echo-flow > div, .en-flow > div { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .9rem; display: grid; gap: .2rem; min-width: 0; }
.echo-flow b, .en-flow b { font-size: .8rem; color: var(--muted); }
.echo-flow .mono, .en-flow .mono { font-size: 1.05rem; word-break: break-all; }
.cd-table { display: flex; flex-wrap: wrap; gap: 4px; margin: .5rem 0; }
.cd-table span { display: grid; text-align: center; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: .25rem .4rem; font-size: .85rem; min-width: 44px; }
.cd-table i { font-style: normal; font-weight: 700; color: var(--rose-deep); border-top: 1px dashed var(--border); }
.arq-steps { display: grid; gap: .5rem; padding-left: 1.4rem; margin-top: 1rem; }
.arq-steps li { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: .5rem .8rem; animation: fadein .4s; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
/* encryption */
.en-flow .hacker { border: 2px dashed var(--rose); background: #fff7f7; }
.en-flow .hacker i { font-size: .82rem; color: var(--rose-deep); font-style: normal; font-weight: 600; }
.key-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.kp { border-radius: 12px; padding: .7rem 1rem; display: grid; gap: .2rem; font-size: .92rem; }
.kp.pub { background: #eef0e2; border: 1px solid var(--sage); }
.kp.priv { background: var(--blush); border: 1px solid var(--rose); }
@media (max-width: 720px) {
  .kw-grid.two, .key-pair { grid-template-columns: 1fr; }
  .eb { width: 32px; height: 38px; font-size: 1rem; }
  .pb-cell { width: 28px; height: 30px; font-size: .9rem; }
}
@media (max-width: 720px) {
  #errors-lab table th, #errors-lab table td, .practice-app .pb-table th, .practice-app .pb-table td { padding: .2rem .12rem; font-size: .75rem; }
  #errors-lab table button, .practice-app .pb-cell { width: 24px; height: 26px; font-size: .82rem; padding: 0; }
}

/* ---------- Chapter 4 labs ---------- */
pre.code-q { font: 600 .95rem/1.45 "JetBrains Mono", Consolas, monospace; background: #2b2c20; color: #eddada; padding: .6rem .9rem; border-radius: 10px; margin: .4rem 0; white-space: pre; overflow-x: auto; max-width: 100%; }
pre.code-q.big { font-size: 1.1rem; }
.steps-list li.now { color: var(--rose-deep); }
/* software layers */
.sw-choices { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; }
.sw-stack { display: grid; gap: 6px; max-width: 560px; }
.sw-layer { border-radius: 10px; padding: .55rem .9rem; background: var(--c); color: #fff; display: grid; gap: .1rem; transition: transform .2s, box-shadow .2s; }
.sw-layer span { font-size: .85rem; opacity: .9; }
.sw-layer.empty { background: var(--bg); border: 2px dashed var(--border); color: var(--muted); text-align: center; font-size: .85rem; }
.sw-layer.on { transform: scale(1.03); box-shadow: 0 0 0 4px var(--blush), 0 6px 16px rgba(0,0,0,.18); }
.sw-msg { min-height: 1.4em; margin: .5rem 0; }
.sort-list { display: grid; gap: .4rem; }
.sort-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: .4rem .7rem; }
.sort-name { flex: 1 1 160px; font-weight: 600; }
.sort-btn { font: inherit; font-size: .85rem; padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--cream); cursor: pointer; }
.sort-btn.right { background: #e3ead2; border-color: var(--olive); }
.sort-btn.wrong { background: var(--blush); border-color: var(--rose-deep); }
/* operating system */
.os-funcs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .8rem; }
.os-f { font-size: .8rem; padding: .25rem .65rem; border-radius: 999px; border: 1px solid var(--border); background: var(--cream); color: var(--muted); transition: all .2s; }
.os-f.on { background: var(--ink); color: var(--blush); border-color: var(--ink); }
.os-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1rem; }
.os-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.ram { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; margin: .2rem 0 .6rem; min-height: 34px; }
.ram.vm { grid-template-columns: repeat(4, 1fr); }
.ram i { font-style: normal; font-size: .62rem; line-height: 1.1; color: #fff; background: var(--c); border-radius: 5px; padding: .25rem; min-height: 32px; overflow: hidden; }
.ram i.free { background: var(--bg); border: 1px dashed var(--border); }
.os-files .code-chip { display: inline-block; margin: 0 .2rem .2rem 0; }
.os-log { margin-top: .9rem; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .7rem 1rem; }
.os-log ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.pill-s { display: inline-block; font-size: .78rem; background: var(--blush); border-radius: 999px; padding: .1rem .55rem; margin: .1rem; }
/* interrupts */
.int-events { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; }
.int-events small { opacity: .7; }
.int-board { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: .7rem; margin: .9rem 0; }
.int-box { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; display: grid; gap: .4rem; align-content: start; min-height: 130px; }
.int-cpu { font-size: .92rem; }
.fde { display: flex; gap: 4px; }
.fde span { flex: 1; text-align: center; font-size: .78rem; font-weight: 700; padding: .3rem 0; border-radius: 6px; background: var(--bg); color: var(--muted); }
.fde span.on { background: var(--olive); color: #fff; }
.int-q { border-radius: 8px; padding: .3rem .55rem; background: var(--cream); border: 1px solid var(--border); display: grid; font-size: .82rem; }
.int-q.top { border-color: var(--rose-deep); background: var(--blush); }
.int-q span { color: var(--muted); font-size: .76rem; }
.int-now { background: var(--blush); border-radius: 10px; padding: .6rem .9rem; min-height: 2.6em; }
/* translators */
.tl-levels { display: grid; grid-template-columns: 1fr 1.4fr; gap: .8rem; align-items: start; margin-top: .6rem; }
.tl-ide { display: grid; grid-template-columns: 1.2fr 1fr; gap: .8rem; }
.tl-code { background: #2b2c20; border-radius: 10px; padding: .5rem 0; font: .88rem/1.5 "JetBrains Mono", Consolas, monospace; color: #eddada; min-width: 0; overflow-x: auto; }
.tl-line { display: flex; align-items: center; gap: .6rem; padding: .05rem .7rem; white-space: pre; }
.tl-line .ln { color: #8e8b63; width: 1.2em; text-align: right; flex: none; }
.tl-line code { font: inherit; color: inherit; background: none; }
.tl-line.now { background: rgba(214,212,173,.25); }
.tl-line.err { background: rgba(203,133,135,.45); }
.tl-line .tl-fix { padding: .1rem .6rem; font-size: .75rem; margin-left: auto; }
.tl-side { min-width: 0; }
.tl-out { background: #111; color: #9fe0b0; font: .85rem/1.5 "JetBrains Mono", Consolas, monospace; border-radius: 8px; padding: .5rem .7rem; min-height: 90px; margin-bottom: .5rem; }
.tl-msg p { margin: .25rem 0; font-size: .9rem; }
.tl-report { background: #fff7f7; border: 1px solid var(--rose); border-radius: 10px; padding: .5rem .8rem; font-size: .9rem; }
.tl-report ul { margin: .3rem 0; padding-left: 1.2rem; }
/* IDE */
.ide-feats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .5rem; margin-bottom: .8rem; }
.ide-feat { display: grid; grid-template-columns: auto 1fr; gap: .1rem .4rem; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: .45rem .6rem; font-size: .88rem; cursor: pointer; }
.ide-feat span { grid-column: 2; font-size: .78rem; color: var(--muted); }
.ide-editor { display: flex; background: #2b2c20; border-radius: 10px; overflow: hidden; height: 250px; }
.ide-gutter { flex: none; width: 2.4em; padding: .6rem .3rem; text-align: right; color: #8e8b63; font: .9rem/1.5 "JetBrains Mono", Consolas, monospace; overflow: hidden; display: flex; flex-direction: column; }
.ide-gutter span.bad { color: #fff; background: var(--rose-deep); border-radius: 4px; }
.ide-area { position: relative; flex: 1; min-width: 0; }
.ide-hl, .ide-ta { position: absolute; inset: 0; margin: 0; padding: .6rem .7rem; font: .9rem/1.5 "JetBrains Mono", Consolas, monospace; white-space: pre; overflow: auto; tab-size: 3; border: 0; }
.ide-hl { color: #eddada; pointer-events: none; }
.ide-ta { background: transparent; color: transparent; caret-color: #fff; resize: none; outline: none; }
.ide-area.plain .ide-hl { color: #eddada; }
.hl-k { color: #e9a3a5; font-weight: 700; } .hl-s { color: #d6d4ad; } .hl-n { color: #9fd3d6; } .hl-v { color: #fff; }
.ide-suggest { margin: .4rem 0; } .ide-sug { cursor: pointer; border: 1px solid var(--border); }
.ide-note { min-height: 1.2em; margin: .4rem 0; }
.lab-ctrl.ide-in { display: flex; flex-wrap: wrap; flex-direction: row; align-items: center; gap: .4rem; } .ide-in .q-input { width: 90px; }
.ide-console { background: #111; color: #9fe0b0; font: .88rem/1.5 "JetBrains Mono", Consolas, monospace; border-radius: 10px; padding: .6rem .8rem; min-height: 70px; margin-top: .6rem; overflow-x: auto; }
.ide-console .lab-table { color: var(--text); }
@media (max-width: 720px) {
  .os-grid, .int-board, .tl-levels, .tl-ide { grid-template-columns: 1fr; }
  .int-box { min-height: 0; }
  .ide-editor { height: 220px; }
}

/* ---------- LabKit: drag-and-drop activities and games ---------- */
.lk-modes { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; align-items: center; }
.lk-mode { font: inherit; font-size: .88rem; font-weight: 600; padding: .4rem .95rem; border-radius: 999px; border: 1px solid var(--border); background: var(--cream); cursor: pointer; }
.lk-mode.active { background: var(--ink); color: var(--blush); border-color: var(--ink); }
.lk-bar { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .45rem .8rem; margin-bottom: .7rem; font-size: .9rem; min-height: 2.6em; }
.lk-bar b { color: var(--rose-deep); }
.lk-time b { font-size: 1.1rem; }
.lk-final { font-weight: 700; }
.lk-deck { display: flex; flex-wrap: wrap; gap: .45rem; min-height: 54px; padding: .55rem; border: 2px dashed var(--border); border-radius: 12px; background: var(--bg); margin-bottom: .7rem; }
.lk-card { touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; background: #fff; border: 1px solid var(--border); border-left: 5px solid var(--rose); border-radius: 10px; padding: .45rem .7rem; font-size: .9rem; line-height: 1.3; box-shadow: 0 2px 5px rgba(0,0,0,.06); transition: transform .12s, box-shadow .12s, opacity .12s; max-width: 100%; }
.lk-card:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,.1); }
.lk-card:focus-visible { outline: 3px solid var(--olive); outline-offset: 2px; }
.lk-card pre.code-q { margin: 0; pointer-events: none; font-size: .85rem; }
.lk-card.lk-dragging { opacity: .3; }
.lk-card.lk-picked { outline: 3px solid var(--rose-deep); transform: scale(1.03); }
.lk-card.locked { cursor: default; border-left-color: var(--olive); }
.lk-card.right { background: #eef2e2; }
.lk-ghost { box-shadow: 0 12px 28px rgba(0,0,0,.25) !important; cursor: grabbing; opacity: .95; }
.lk-picking [data-drop] { outline: 2px dashed var(--rose); outline-offset: 2px; }
.lk-bins { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: .6rem; }
.lk-bin { background: #fff; border: 2px solid var(--border); border-radius: 12px; padding: .55rem; min-height: 110px; transition: background .15s, border-color .15s; }
.lk-bin-h { font-weight: 700; margin: 0 0 .1rem; font-size: .92rem; }
.lk-bin-hint { margin: 0 0 .35rem; font-size: .76rem; color: var(--muted); }
.lk-bin-cards { display: grid; gap: .3rem; }
.lk-bin-cards .lk-card { font-size: .8rem; padding: .3rem .5rem; box-shadow: none; }
.lk-over { background: var(--blush) !important; border-color: var(--rose-deep) !important; }
.lk-flash-good { background: #e3ead2 !important; border-color: var(--olive) !important; }
.lk-flash-bad { background: #f6d6d6 !important; border-color: var(--rose-deep) !important; }
.lk-fb { min-height: 1.4em; margin: .6rem 0 0; font-size: .92rem; }
.lk-fb.good { color: #4c5a2a; } .lk-fb.bad { color: var(--rose-deep); }
.lk-order { display: grid; grid-template-columns: 1.3fr 1fr; gap: .8rem; align-items: start; }
.lk-slots { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.lk-slots.rev { display: flex; flex-direction: column-reverse; }
.lk-slot { display: flex; align-items: center; gap: .5rem; background: #fff; border: 2px dashed var(--border); border-radius: 10px; padding: .35rem .45rem; min-height: 48px; }
.lk-num { flex: none; min-width: 2em; padding: 0 .4rem; height: 2em; border-radius: 999px; background: var(--ink); color: var(--blush); display: grid; place-items: center; font-weight: 800; font-size: .8rem; white-space: nowrap; }
.lk-slot-in { flex: 1; min-width: 0; }
.lk-slot-in .lk-card { width: 100%; }
.lk-slot.right { border-style: solid; border-color: var(--olive); background: #f3f6ea; }
.lk-slot.wrong { border-style: solid; border-color: var(--rose-deep); background: #fbefef; }
.lk-deck-col { flex-direction: column; align-items: stretch; }
.shake { animation: lk-shake .4s; }
@keyframes lk-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.sw-boot-wrap .sw-stack { margin: .6rem 0; }
/* OS lab */
.os-progress { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; margin-bottom: .6rem; }
.os-meter { flex: 1 1 200px; height: 12px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.os-meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--olive), var(--rose)); transition: width .4s; }
.os-f.found:not(.on) { background: #eef2e2; color: var(--ink); border-color: var(--olive); }
.os-desk { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.os-login { grid-column: 1 / -1; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: end; font-size: .88rem; }
.os-login .q-input { width: 130px; }
.os-login label { display: grid; gap: .15rem; }
.os-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.os-zone-wrap { min-width: 0; }
.os-dock, .os-files, .os-hw { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; align-items: center; }
.os-ram-row { display: flex; gap: .4rem; align-items: stretch; }
.os-ram { flex: 1; border-radius: 8px; padding: 2px; }
.os-ram i.os-run { cursor: grab; border: 0; padding: .3rem .2rem; font-size: 1.05rem; text-align: center; color: #fff; background: var(--c); box-shadow: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-close { flex: none; width: 46px; display: grid; place-items: center; border: 2px dashed var(--rose); border-radius: 8px; color: var(--rose-deep); font-weight: 800; }
.os-targets { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin-bottom: .5rem; }
.os-target { background: #fff; border: 2px dashed var(--border); border-radius: 10px; padding: .45rem .55rem; display: grid; gap: .1rem; font-size: .85rem; min-height: 58px; }
.os-target span { font-size: .75rem; color: var(--muted); }
/* interrupts lab */
.int-make { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .5rem; }
.int-make small { opacity: .7; }
.int-board4 { display: grid; grid-template-columns: 1fr 1.1fr 1.2fr 1fr; gap: .6rem; margin: .7rem 0; }
.int-board4 .int-box { min-height: 160px; }
.int-in, .int-queue { display: grid; gap: .35rem; min-height: 60px; align-content: start; border-radius: 8px; padding: 2px; }
.int-card { display: grid; font-size: .8rem; padding: .35rem .5rem; }
.int-card span { color: var(--muted); font-size: .74rem; }
.int-slot:first-child .int-card { border-left-color: var(--rose-deep); background: var(--blush); }
.fde-b { flex: 1; font: inherit; font-size: .78rem; font-weight: 700; padding: .35rem 0; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--ink); cursor: pointer; }
.fde-b.done { background: var(--olive); color: #fff; border-color: var(--olive); }
.int-reg { font-size: .8rem; border-left-color: var(--olive); }
.int-decide { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.int-isrs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .4rem; margin-bottom: .7rem; }
.int-isr { background: #fff; border: 2px dashed var(--olive); border-radius: 10px; padding: .55rem .3rem; text-align: center; font-weight: 700; font-size: .82rem; }
/* translators lab */
.tl-line.ran { opacity: .6; }
.tl-line.flag { background: rgba(203,133,135,.3); }
.tl-line[role=button] { cursor: pointer; }
.tl-line[role=button]:hover { background: rgba(214,212,173,.18); }
.tl-flag { margin-left: auto; color: #ffb4a6; }
.tl-controls { display: grid; gap: .45rem; align-content: start; }
.tl-controls .btn { justify-self: start; }
.tl-fixes { display: grid; gap: .35rem; }
.tl-fixes code { font: .85rem "JetBrains Mono", Consolas, monospace; background: none; }
.tl-task { margin: .2rem 0 .6rem; }
/* IDE missions */
.ide-missions { margin-bottom: .8rem; }
.ide-mlist { display: grid; gap: .3rem; padding-left: 1.4rem; margin: .3rem 0 0; font-size: .9rem; }
.ide-mlist li.done { color: #4c5a2a; text-decoration: line-through; text-decoration-color: rgba(76,90,42,.5); }
.ide-mlist li.done::marker { content: "✓  "; color: var(--olive); font-weight: 800; }
@media (max-width: 900px) {
  .int-board4 { grid-template-columns: 1fr 1fr; }
  .int-isrs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .lk-bins { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lk-order { grid-template-columns: 1fr; }
  .os-desk { grid-template-columns: 1fr; }
  .lk-card { font-size: .85rem; }
}

.os-ram-key { margin: .2rem 0 .5rem; }

/* video lectures */
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #111; border-radius: 14px; overflow: hidden; margin: .4rem 0 1rem; box-shadow: var(--shadow); }
.video-frame iframe, .video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #111; }
.video-credit { font-size: .82rem; color: var(--muted); margin-top: -.4rem; }

/* ---------- differentiation: levels, hints, routes, confidence, self-tests ---------- */
.lv { display: inline-block; font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: .12rem .5rem; border-radius: 999px; margin-right: .45rem; vertical-align: 2px; }
.lv-f { background: #e3ead2; color: #4c5a2a; }
.lv-c { background: #f6e7c6; color: #6b5317; }
.lv-s { background: #f6d6d6; color: #8a3c40; }
.q-help { margin: .3rem 0 .6rem; font-size: .9rem; }
.q-help summary, .q-model summary { cursor: pointer; color: var(--rose-deep); font-weight: 600; }
.q-help p { margin: .35rem 0 0; padding: .5rem .8rem; background: var(--cream); border-left: 4px solid var(--sage); border-radius: 8px; font-style: italic; }
.q-model p { margin: .35rem 0 0; padding: .6rem .8rem; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.q-criteria { margin-top: .6rem; display: grid; gap: .3rem; }
.revisit { font-size: .82rem; }
.revisit a { color: var(--sage); font-weight: 600; }
.tool-hints { margin: .6rem 0 0; padding: .6rem .8rem .6rem 2rem; background: #fffbea; border: 1px solid #ecd9a0; border-radius: 10px; display: grid; gap: .35rem; font-size: .92rem; }

/* routes */
.route-picker { margin-bottom: 1.2rem; }
.route-picker h3 { margin-bottom: .2rem; }
.route-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin: .5rem 0 .8rem; }
.route-card { font: inherit; text-align: left; cursor: pointer; display: grid; gap: .25rem; padding: .8rem .9rem; border-radius: 14px; border: 2px solid var(--border); background: #fff; transition: border-color .15s, transform .15s; }
.route-card:hover { transform: translateY(-2px); }
.route-card.active { border-color: var(--ink); background: var(--cream); box-shadow: var(--shadow); }
.route-name { font-weight: 800; font-size: 1.02rem; }
.route-who { font-size: .85rem; color: var(--muted); }
.route-steps { background: var(--cream); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; }
.route-steps ol { margin: .3rem 0; padding-left: 1.3rem; display: grid; gap: .25rem; }
.ch-nav a.route-rec { box-shadow: inset 3px 0 0 var(--rose); font-weight: 600; }
.rag-b.rag-r { border-left: 4px solid #c96a6a; } .rag-b.rag-a { border-left: 4px solid #d1a640; } .rag-b.rag-g { border-left: 4px solid var(--olive); }
.rag-tag { font-size: .8rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; }
.rag-tag.rag-r { background: #f6d6d6; } .rag-tag.rag-a { background: #f6e7c6; } .rag-tag.rag-g { background: #e3ead2; }
/* confidence checks */
.rag { background: var(--cream); border: 1px dashed var(--border); border-radius: 12px; padding: .6rem .9rem; margin: 0 0 1rem; }
.rag p { margin: 0 0 .4rem; font-size: .92rem; }
.rag-btns { display: flex; flex-wrap: wrap; gap: .4rem; }
.rag-b { font: inherit; font-size: .85rem; cursor: pointer; padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--border); background: #fff; }
.rag-b.on.rag-r { background: #f6d6d6; border-color: #c96a6a; }
.rag-b.on.rag-a { background: #f6e7c6; border-color: #d1a640; }
.rag-b.on.rag-g { background: #e3ead2; border-color: var(--olive); }
.rag-summary { margin-top: 1.2rem; }
.rag-table { color: var(--text); }
.rag-table th { color: var(--muted); }
.rag-table td, .rag-table th { border-bottom-color: var(--border); }
/* key terms self-test */
.terms-test { margin-top: 1.4rem; }
.tt-meter { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; margin-bottom: .6rem; font-size: .9rem; }
.tt-card { font: inherit; width: 100%; min-height: 150px; display: grid; place-content: center; gap: .4rem; text-align: center; cursor: pointer; padding: 1.2rem; border-radius: 16px; border: 2px solid var(--ink); background: var(--ink); color: var(--blush); transition: transform .2s; }
.tt-card.flipped { background: #fff; color: var(--text); border-color: var(--rose); }
.tt-card:hover { transform: translateY(-2px); }
.tt-side { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.tt-term { font-family: Outfit, sans-serif; font-size: 1.6rem; font-weight: 700; }
.tt-def { font-size: 1.05rem; line-height: 1.45; max-width: 560px; }
.tt-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; justify-content: center; }
.tt-done { text-align: center; padding: 1rem; background: #eef2e2; border-radius: 12px; }
.tt-bin-def { font-weight: 500; font-size: .85rem; line-height: 1.35; display: block; }
.tt-match .lk-bin { min-height: 90px; }
@media (max-width: 720px) {
  .route-cards { grid-template-columns: 1fr; }
}

/* ARQ: OTP example */
.otp { margin-top: 1.4rem; border-top: 1px dashed var(--border); padding-top: .4rem; }
.otp-stage { display: grid; grid-template-columns: 150px 1fr 170px; gap: .6rem; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: .9rem; margin: .6rem 0; }
.otp-server, .otp-phone { display: grid; justify-items: center; gap: .25rem; text-align: center; font-size: .85rem; }
.otp-ico { font-size: 2rem; }
.otp-role { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.otp-timer { width: 64px; height: 64px; }
.otp-ring-bg { fill: #fff; stroke: var(--border); stroke-width: 6; }
.otp-ring { fill: none; stroke: var(--olive); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 169.65; stroke-dashoffset: 0; transform: rotate(-90deg); transform-origin: 32px 32px; transition: stroke .2s; }
.otp-late .otp-ring { stroke: var(--rose-deep); }
.otp-secs { font: 800 18px Outfit, sans-serif; fill: var(--ink); }
.otp-timer-l { font-size: .72rem; color: var(--muted); }
.otp-wire { position: relative; height: 70px; }
.otp-wire::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 3px dashed var(--border); }
.otp-env, .otp-ack { position: absolute; top: 50%; transform: translate(0, -50%); padding: .25rem .6rem; border-radius: 999px; font-weight: 700; font-size: .85rem; white-space: nowrap; transition: left 1.6s linear, opacity .4s; }
.otp-env { left: 0; background: var(--ink); color: var(--blush); }
.otp-env.go { left: calc(100% - 92px); }
.otp-env.go.lost { left: 45%; opacity: 0; transition: left .9s linear, opacity .5s .7s; }
.otp-env.go.lost::after { content: " 💥"; }
.otp-ack { left: calc(100% - 70px); background: var(--olive); color: #fff; transition: left 1.2s linear; }
.otp-ack.go { left: 0; }
.otp-phone { position: relative; width: 150px; justify-self: center; border: 3px solid var(--ink); border-radius: 22px; padding: .9rem .5rem .6rem; background: #fff; }
.otp-notch { width: 46px; height: 6px; border-radius: 6px; background: var(--ink); position: absolute; top: 6px; left: 50%; transform: translateX(-50%); }
.otp-screen { display: grid; gap: .35rem; min-height: 120px; align-content: center; width: 100%; }
.otp-sms { font-size: .78rem; margin: 0; background: var(--cream); border-radius: 10px; padding: .35rem .45rem; text-align: left; }
.otp-boxes { display: flex; gap: 2px; justify-content: center; min-height: 26px; }
.otp-boxes span { width: 18px; height: 24px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 5px; font: 700 .85rem "JetBrains Mono", Consolas, monospace; }
.otp-result { margin: 0; font-size: .8rem; font-weight: 700; min-height: 1.2em; }
.otp-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .4rem; }
.otp-chip { font-size: .8rem; padding: .25rem .7rem; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--muted); transition: all .2s; }
.otp-chip.on { background: var(--ink); color: var(--blush); border-color: var(--ink); }
@media (max-width: 720px) {
  .otp-stage { grid-template-columns: 1fr; }
  .otp-wire { height: 50px; }
}

/* ---------- Encryption lab v2 ---------- */
.en-steps { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0 .8rem; }
.en-step { font: inherit; font-size: .82rem; font-weight: 600; display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .75rem .35rem .4rem; border-radius: 999px; border: 1px solid var(--border); background: var(--cream); cursor: pointer; }
.en-step span { display: grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 50%; background: #fff; border: 1px solid var(--border); font-size: .75rem; }
.en-step.active { background: var(--ink); color: var(--blush); border-color: var(--ink); }
.en-step.done span { background: var(--olive); color: #fff; border-color: var(--olive); }
.en-pane h3 { margin-top: 0; }
.en-nav { display: flex; justify-content: space-between; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }
/* 1 padlocks */
.pl-scene { display: grid; grid-template-columns: 90px 1fr 90px; align-items: center; gap: .5rem; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: .8rem; margin: .6rem 0; }
.pl-person { display: grid; justify-items: center; text-align: center; font-size: .85rem; background: var(--ink); color: var(--blush); border-radius: 12px; padding: .7rem .4rem; }
.pl-person b { font-size: 1.15rem; }
.pl-person small { color: #cfc8c0; }
.pl-mid { display: grid; justify-items: center; gap: .4rem; position: relative; }
.pl-hacker { font-size: .85rem; font-weight: 700; color: var(--rose-deep); background: #fff7f7; border: 1px dashed var(--rose); border-radius: 999px; padding: .2rem .7rem; }
.pl-box { display: grid; justify-items: center; gap: .1rem; min-width: 190px; padding: .6rem 1rem; border: 3px dashed var(--olive); border-radius: 14px; background: #fff; transition: transform .8s ease; transform: translateX(-28%); }
.pl-scene.at-sara .pl-box { transform: translateX(28%); }
.pl-box-ico { font-size: 2.4rem; }
.pl-box-state { font-size: .8rem; font-weight: 700; color: var(--muted); }
.pl-task { margin: .3rem 0; }
.pl-tray { display: flex; flex-wrap: wrap; gap: .5rem; min-height: 46px; }
.pl-meaning { margin-top: .7rem; background: var(--cream); border: 1px solid var(--border); border-radius: 12px; padding: .7rem 1rem; }
.pl-meaning p { margin: .2rem 0; }
/* 2 send a secret */
.sc-grid { display: grid; grid-template-columns: 1.2fr 1fr 1.1fr; gap: .6rem; }
.sc-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .7rem .8rem; display: grid; gap: .4rem; align-content: start; font-size: .9rem; min-width: 0; }
.sc-card .mono { word-break: break-all; }
.sc-hack { border: 2px dashed var(--rose); background: #fff7f7; transition: transform .2s; }
.sc-hack.flash { transform: scale(1.04); }
.sc-banner { margin-top: .7rem; border-radius: 12px; padding: .7rem 1rem; }
.sc-banner.good { background: #eef2e2; border: 1px solid var(--olive); }
.sc-banner.bad { background: #fbefef; border: 1px solid var(--rose); }
/* 3 cipher wheel */
.cw-grid { display: grid; grid-template-columns: 300px 1fr; gap: 1rem; align-items: start; }
.cw-svg { width: 100%; max-width: 300px; display: block; }
.cw-turn { justify-content: center; }
.cw-ct { font-size: 1.3rem; letter-spacing: .08em; background: var(--ink); color: var(--blush); border-radius: 10px; padding: .4rem .7rem; display: inline-block; }
.cw-list { display: grid; gap: .2rem; padding-left: 1.6rem; max-height: 260px; overflow: auto; }
.cw-try { font: inherit; font-size: .85rem; background: none; border: 0; cursor: pointer; text-align: left; padding: .1rem .3rem; border-radius: 6px; }
.cw-try:hover { background: var(--cream); }
/* 5 label the diagram */
.ld-flow .lk-bin { position: relative; }
.ld-flow .lk-bin-h { font-weight: 600; font-size: .82rem; color: var(--muted); }
/* 6 myth-buster */
.mb-meter { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; margin-bottom: .6rem; font-size: .9rem; }
.mb-card { background: var(--ink); color: var(--blush); border-radius: 16px; padding: 1.2rem; text-align: center; display: grid; gap: .7rem; }
.mb-card.done { background: #eef2e2; color: var(--text); }
.mb-s { font-family: Outfit, sans-serif; font-size: 1.25rem; margin: 0; }
.mb-fb { margin: 0; background: #fff; border-radius: 10px; padding: .5rem .7rem; }
.mb-btns { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; }
.mb-card .btn-ghost { color: var(--blush); border-color: var(--blush); }
/* 7 answer builder */
.ab-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.ab-chip { font: inherit; font-size: .86rem; text-align: left; padding: .4rem .7rem; border-radius: 10px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.ab-chip.on { background: var(--ink); color: var(--blush); border-color: var(--ink); }
.ab-answer { min-height: 70px; background: var(--cream); border: 1px dashed var(--border); border-radius: 12px; padding: .7rem .9rem; line-height: 1.55; }
.ab-result { margin-top: .6rem; }
.quiz-total-sm { font-size: 1.3rem; margin: 0 0 .3rem; }
@media (max-width: 720px) {
  .pl-scene { grid-template-columns: 1fr; }
  .pl-box { transform: none !important; min-width: 0; }
  .sc-grid, .cw-grid { grid-template-columns: 1fr; }
}

.en-step.active span { color: var(--ink); }

/* ---------- Remember it! labs, classroom story, memory hotel ---------- */
.hk { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: .8rem 1rem; margin-bottom: .8rem; }
.hk h4 { margin: 0 0 .3rem; }
.hk-s { font-family: Outfit, sans-serif; font-size: 1.35rem; margin: .2rem 0 .5rem; line-height: 1.35; }
.hk-s b { color: var(--rose-deep); font-size: 1.15em; }
.hk-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .3rem .8rem; margin-bottom: .4rem; font-size: .9rem; }
.hk-map div { display: flex; gap: .4rem; }
.hk-map b { min-width: 5.5em; }
.hk-big { background: var(--ink); color: var(--blush); border-radius: 14px; padding: .8rem 1.1rem; margin-bottom: .8rem; }
.hk-big p { margin: .2rem 0; font-size: 1.05rem; }
.hk-big b { color: #fff; }
.hk-big .muted { color: #cfc7bf; }
.rc-boxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .7rem; }
.rc-box { border-radius: 12px; padding: .5rem .7rem; display: grid; text-align: center; border: 1px solid var(--border); }
.rc-box b { font-size: 1.5rem; font-family: Outfit, sans-serif; }
.rc-box span { font-size: .78rem; color: var(--muted); }
.rc-b1 { background: #fbefef; } .rc-b2 { background: #fdf6e3; } .rc-b3 { background: #eef2e2; }
.rc-card { background: #fff; border: 2px solid var(--ink); border-radius: 16px; padding: 1rem 1.1rem; display: grid; gap: .6rem; }
.rc-q { font-size: 1.1rem; font-weight: 600; margin: 0; }
.rc-opts { display: flex; flex-wrap: wrap; gap: .5rem; }
.rc-fb { margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.cz-text { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem 1rem; }
.cz-p { line-height: 2.4; margin: .4rem 0; }
.cz-gap { display: inline-flex; vertical-align: middle; min-width: 120px; min-height: 34px; border-bottom: 2px dashed var(--olive); border-radius: 6px; background: var(--cream); margin: 0 .2rem; padding: 1px; }
.cz-gap .lk-card { padding: .15rem .5rem; font-size: .88rem; box-shadow: none; }
.cz-gap.right { background: #e3ead2; border-bottom-color: var(--olive); }
.cz-gap.wrong { background: #f6d6d6; border-bottom-color: var(--rose-deep); }
.cls-kids { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.cls-kids small { opacity: .7; }
.cls-scene { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: .6rem; margin-bottom: .6rem; }
.cls-scene > div { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; display: grid; gap: .25rem; align-content: start; font-size: .9rem; }
.cls-teacher { font-size: 2rem !important; text-align: center; }
.cls-doing { font-size: .9rem; font-weight: 700; }
.cls-steps { display: grid; gap: .45rem; padding-left: 1.4rem; }
.cls-flip { font: inherit; width: 100%; text-align: left; cursor: pointer; display: grid; gap: .25rem; padding: .55rem .8rem; border-radius: 10px; border: 1px solid var(--border); background: var(--cream); }
.cls-word { color: var(--rose-deep); font-weight: 700; font-size: .9rem; }
.mh-grid { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: .8rem; }
.mh-wait { display: grid; gap: .35rem; }
.mh-rooms { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; margin-bottom: .6rem; }
.mh-annex { grid-template-columns: repeat(4, 1fr); }
.mh-room { min-height: 64px; border: 2px dashed var(--border); border-radius: 10px; padding: .3rem; display: grid; gap: .2rem; align-content: start; background: #fff; }
.mh-room small { color: var(--muted); font-size: .7rem; }
.mh-room.full { border-style: solid; border-color: var(--olive); background: #f3f6ea; }
.mh-annex .mh-room { background: var(--bg); }
.mh-room .lk-card { font-size: .74rem; padding: .25rem .35rem; }
.mh-out { border: 2px dashed var(--rose); border-radius: 10px; padding: .5rem; text-align: center; color: var(--rose-deep); font-weight: 700; font-size: .88rem; }
.mh-board { background: var(--ink); color: var(--blush); border-radius: 12px; padding: .6rem .8rem; display: grid; gap: .15rem; font-size: .82rem; }
.mh-board b { color: #fff; }
.mh-board .muted { color: #cfc7bf; }
.mh-sent { margin-top: .6rem; background: var(--cream); border: 1px solid var(--border); border-radius: 12px; padding: .7rem 1rem; }
.mh-sent ol { margin: .3rem 0 0; padding-left: 1.3rem; }
.mh-sent.done { background: #eef2e2; border-color: var(--olive); }
@media (max-width: 900px) { .mh-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) {
  .cls-scene, .mh-grid { grid-template-columns: 1fr; }
  .rc-boxes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cz-gap { min-width: 90px; }
}

/* OS lab: step tasks */
.os-found { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; margin-bottom: .8rem; }
.os-found .os-funcs { margin: .4rem 0 0; }
.os-tasks { background: var(--cream); border: 1px solid var(--border); border-radius: 12px; padding: .6rem .9rem; margin-bottom: .8rem; }
.os-tasks ol { list-style: none; margin: .35rem 0 0; padding: 0; display: grid; gap: .3rem; }
.os-tasks li { display: flex; gap: .55rem; align-items: baseline; }
.os-tick { flex: none; width: 1.05em; height: 1.05em; border: 2px solid var(--border); border-radius: 4px; background: #fff; transform: translateY(.15em); }
.os-tasks li.done { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.os-tasks li.done .os-tick { background: var(--olive); border-color: var(--olive); }
.os-complete { margin: .5rem 0 0; color: #4c5a2a; font-weight: 600; }
.os-body { margin-bottom: .8rem; }
.os-two { display: grid; grid-template-columns: 2fr 1fr; gap: .8rem; align-items: start; }
.os-ram-box { border: 2px dashed var(--olive); border-radius: 12px; padding: .5rem; background: #fff; }
.os-ram-box .ram { margin: 0 0 .3rem; }
.os-ram i.os-run { font-size: .72rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-dev-slot { min-height: 46px; display: flex; align-items: center; }
.os-login { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.os-log { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .9rem; }
.os-log ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.os-log .os-used { margin: .3rem 0 0; }
@media (max-width: 720px) { .os-two { grid-template-columns: 1fr; } }

.os-two .os-close { width: auto; min-height: 74px; font-size: 1rem; }

/* ---------- Chapter 5 labs ---------- */
.wb-urls { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-bottom: .5rem; }
.wb-urls p { margin: 0; background: var(--ink); color: var(--blush); border-radius: 8px; padding: .25rem .6rem; font-size: .9rem; }
.wb-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .6rem; }
.wb-addr { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: .25rem .8rem; min-width: 220px; min-height: 1.8em; }
.wb-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; margin-bottom: .6rem; }
.wb-box { background: #fff; border: 2px solid var(--border); border-radius: 12px; padding: .6rem .7rem; display: grid; gap: .4rem; align-content: start; font-size: .88rem; transition: border-color .2s, box-shadow .2s; }
.wb-box.on { border-color: var(--rose-deep); box-shadow: 0 0 0 3px var(--blush); }
.wb-screen { min-height: 70px; border: 1px dashed var(--border); border-radius: 8px; padding: .4rem; display: grid; place-items: center; background: var(--bg); }
.wb-html { margin: 0; font-size: .72rem; white-space: pre-wrap; }
.wb-page { display: grid; gap: .2rem; text-align: center; }
.wb-dns { font-size: .78rem; }
.wb-dns tr { cursor: pointer; }
.wb-dns tr:hover td { background: var(--cream); }
.wb-dns tr.hit td { background: #e3ead2; font-weight: 700; }
.wb-dns tr.miss td { background: #fbefef; }
.ck-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.ck-bar .lk-modes { margin: 0; }
.ck-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: .8rem; }
.ck-shop, .ck-files { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; display: grid; gap: .4rem; align-content: start; }
.ck-items { display: flex; flex-wrap: wrap; gap: .35rem; }
.ck-ram, .ck-disk { border: 1px dashed var(--border); border-radius: 8px; padding: .35rem .5rem; min-height: 52px; display: grid; gap: .2rem; }
.ck-ram small, .ck-disk small { color: var(--muted); }
.bc-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin-bottom: .5rem; }
.bc-form .q-input { width: 80px; }
.bc-pending { margin: .2rem 0; }
.bc-chain { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .4rem; }
.bc-block { background: #fff; border: 2px solid var(--olive); border-radius: 12px; padding: .5rem .7rem; display: grid; gap: .15rem; font-size: .82rem; min-width: 190px; }
.bc-block.bad { border-color: var(--rose-deep); background: #fbefef; }
.bc-block ul { margin: .1rem 0; padding-left: 1.1rem; }
.bc-block small { color: var(--muted); }
.bc-amt { width: 64px; padding: .1rem .3rem; }
.bc-link { font-size: .75rem; font-weight: 700; color: #4c5a2a; padding: .2rem .5rem; border-radius: 999px; background: #e3ead2; }
.bc-link.broken { background: #f6d6d6; color: var(--rose-deep); }
.bc-devs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; margin-bottom: .6rem; }
.bc-dev { background: #fff; border: 2px solid var(--olive); border-radius: 12px; padding: .5rem .7rem; display: grid; gap: .2rem; font-size: .85rem; }
.bc-dev.bad { border-color: var(--rose-deep); background: #fbefef; }
.ph-mail { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .7rem 1rem; font-size: .92rem; }
.ph-mail p { margin: .3rem 0; }
.ph-mail hr { border: 0; border-top: 1px solid var(--border); }
.ph-f { cursor: pointer; border-radius: 4px; padding: 0 .15rem; transition: background .15s; }
.ph-f:hover { background: var(--cream); outline: 1px dashed var(--border); }
.ph-f.found { background: #f6d6d6; outline: 2px solid var(--rose-deep); }
.bf-row { display: flex; flex-wrap: wrap; gap: .7rem; align-items: end; margin-bottom: .4rem; }
.bf-lim { display: flex; gap: .35rem; align-items: center; font-size: .9rem; }
.bf-checks { margin: .3rem 0; padding-left: 1.2rem; font-size: .88rem; }
.bf-out { white-space: pre-wrap; background: #111; color: #9fe0b0; border-radius: 10px; padding: .5rem .8rem; min-height: 2.5em; font-size: .82rem; }
.dd-scene { display: grid; grid-template-columns: 1fr auto 1fr; gap: .6rem; align-items: center; margin: .5rem 0; }
.dd-bots-box, .dd-server { background: #fff; border: 2px solid var(--border); border-radius: 12px; padding: .6rem .8rem; display: grid; gap: .3rem; font-size: .88rem; min-height: 90px; align-content: start; }
.dd-dots { color: var(--rose-deep); letter-spacing: -.1em; word-break: break-all; font-size: .8rem; }
.dd-arrow { font-weight: 700; color: var(--muted); }
.dd-server.bad { border-color: var(--rose-deep); background: #fbefef; }
.dd-server small { color: var(--muted); }
.dd-load { background: linear-gradient(90deg, var(--olive), var(--rose-deep)) !important; }
.fw-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: .8rem; }
.fw-rules, .fw-pkt { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; font-size: .88rem; }
.fw-rules ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.fw-pkt { display: grid; gap: .25rem; border: 2px solid var(--ink); }
.fw-logl { font-size: .85rem; display: grid; gap: .2rem; padding-left: 1.4rem; }
.tv-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: .8rem; align-items: start; }
.tv-bank { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; display: grid; gap: .45rem; justify-items: start; }
.tv-bank label { display: grid; gap: .15rem; }
.av-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.av-grid > div { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; font-size: .88rem; }
.av-grid ul { margin: .2rem 0 .5rem; padding-left: 1.2rem; }
@media (max-width: 720px) {
  .ck-grid, .fw-grid, .tv-grid, .av-grid, .dd-scene { grid-template-columns: 1fr; }
}

/* long URLs and code must wrap on phones */
.tool-q, .q-text, .q-option span, .en-pane, .lk-card, .wb-addr, .ck-files code, .ph-mail { overflow-wrap: anywhere; }
.wb-addr { min-width: 0; }

/* ---------- Chapter 6 labs ---------- */
.au-sys { display: flex; flex-wrap: wrap; align-items: stretch; gap: .5rem; margin: .5rem 0 .7rem; }
.au-slot, .au-mp { flex: 1 1 150px; border-radius: 12px; padding: .6rem .7rem; display: grid; gap: .2rem; align-content: start; font-size: .88rem; min-height: 70px; }
.au-slot { border: 2px dashed var(--olive); background: #fff; }
.au-mp { background: var(--ink); color: var(--blush); }
.au-slot small, .au-mp small { font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .7rem; opacity: .8; }
.au-arrow { align-self: center; font-weight: 800; color: var(--muted); }
.au-deck { min-height: 0; }
.li-scene { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: .6rem; margin-bottom: .6rem; }
.li-scene > div { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .7rem; display: grid; gap: .25rem; align-content: start; font-size: .86rem; }
.li-room { text-align: center; background: #3a3b33 !important; color: #cfc7bf; transition: background .3s; }
.li-room.lit { background: #fff3c4 !important; color: var(--ink); }
.li-bulb { font-size: 1.6rem; font-weight: 800; }
.li-feed { margin: 0; padding-left: 1.1rem; font-size: .78rem; display: grid; gap: .1rem; }
.li-t { font-size: 1.6rem; font-weight: 800; font-family: Outfit, sans-serif; }
.li-timer small { color: var(--muted); }
.mz-grid { display: grid; grid-template-columns: repeat(7, 36px); gap: 3px; margin: .5rem 0; }
.mz-c { width: 36px; height: 36px; border-radius: 6px; background: #fff; border: 1px solid var(--border); display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: .85rem; }
.mz-c.wall { background: var(--ink); border-color: var(--ink); }
.mz-c.start { background: #e3ead2; } .mz-c.end { background: var(--blush); }
.mz-c.path { background: #fdf6e3; } .mz-c.dead { background: #f6d6d6; }
.ex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .6rem; }
.ex-part { background: #fff; border: 2px solid var(--border); border-radius: 12px; padding: .6rem .8rem; display: grid; gap: .35rem; align-content: start; font-size: .86rem; transition: border-color .2s, box-shadow .2s; }
.ex-part.on { border-color: var(--rose-deep); box-shadow: 0 0 0 3px var(--blush); }
.ex-q { font-size: 1rem; font-weight: 600; min-height: 1.4em; }
.ex-facts, .ex-rules { margin: 0; padding-left: 1.2rem; display: grid; gap: .15rem; }
.ex-rules li.out { color: var(--muted); text-decoration: line-through; }
.ex-rules li.fire { background: #e3ead2; font-weight: 700; border-radius: 4px; }
@media (max-width: 720px) { .li-scene, .ex-grid { grid-template-columns: 1fr; } }

/* ---------- Chapter 3 hardware labs ---------- */
.cp-board { display: grid; grid-template-columns: 1.3fr auto 1fr; gap: .7rem; align-items: stretch; margin: .5rem 0 .7rem; }
.cp-cpu { background: var(--ink); color: var(--blush); border-radius: 14px; padding: .7rem; display: grid; gap: .5rem; align-content: start; }
.cp-regs { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: .4rem; }
.cp-reg, .cp-unit { background: #fff; color: var(--ink); border-radius: 10px; padding: .4rem .5rem; min-height: 58px; display: grid; gap: .2rem; align-content: start; border: 2px dashed transparent; }
.cp-reg small, .cp-unit small { font-weight: 800; font-size: .72rem; letter-spacing: .05em; color: var(--rose-deep); }
.cp-reg span, .cp-unit span { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; min-height: 1.4em; }
.cp-units { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.lk-picking .cp-reg, .lk-picking .cp-ram { border-color: var(--olive); }
.cp-buses { display: grid; align-content: center; gap: .4rem; font-size: .78rem; font-weight: 700; color: var(--muted); text-align: center; }
.cp-ram { background: var(--cream); border: 2px dashed var(--border); border-radius: 14px; padding: .6rem; }
.cp-ram .lab-table { width: 100%; font-size: .85rem; }
.cp-glow td { background: #fdf1d6; }
.cp-chip { display: inline-block; padding: .15rem .45rem; font-family: ui-monospace, Consolas, monospace; font-size: .82rem; cursor: grab; }
.pf-ctl { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .6rem; margin: .4rem 0 .6rem; }
.pf-ctl label { display: grid; gap: .2rem; font-size: .9rem; }
.pf-cores { display: grid; gap: .35rem; margin: .4rem 0; }
.pf-core { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.pf-core small { min-width: 52px; font-weight: 700; }
.pf-core .os-meter i { width: 0; }
.dv-flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: .45rem; margin: .5rem 0 .7rem; }
.dv-box { flex: 1 1 130px; background: #fff; border: 2px solid var(--border); border-radius: 12px; padding: .5rem .6rem; display: grid; gap: .15rem; align-content: start; font-size: .82rem; }
.dv-box small { font-weight: 800; text-transform: uppercase; letter-spacing: .05em; font-size: .7rem; color: var(--rose-deep); }
.dv-box b { font-size: 1.05rem; font-family: ui-monospace, Consolas, monospace; }
.dv-arr { align-self: center; font-weight: 800; color: var(--muted); }
.dv-temp { display: grid; gap: .2rem; max-width: 360px; }
.sq-q { font-size: 1.05rem; font-weight: 700; margin: .3rem 0 .6rem; }
.sq-opts { display: flex; flex-wrap: wrap; gap: .45rem; }
.sq-opts .sq-right { background: var(--olive); color: #fff; border-color: var(--olive); }
.sq-opts .sq-wrong { background: var(--rose); color: #fff; border-color: var(--rose); }
.sq-end { font-size: 1.05rem; }
.vm-board { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .5rem 0 .6rem; }
.vm-box { border: 2px solid var(--border); border-radius: 12px; padding: .6rem; display: grid; gap: .35rem; align-content: start; background: #fff; }
.vm-box small { color: var(--muted); font-size: .78rem; }
.vm-hd { background: var(--cream); }
.vm-ram, .vm-vm { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .3rem; }
.vm-pg { border-radius: 8px; padding: .35rem .4rem; font-size: .8rem; font-weight: 700; text-align: center; border: 0; color: var(--ink); font-family: inherit; }
button.vm-pg { cursor: pointer; outline: 2px dashed var(--ink); outline-offset: -3px; }
.vm-free { background: var(--bg); color: var(--muted); font-weight: 400; border: 1px dashed var(--border); }
.vm-0 { background: #f6d5cf; } .vm-1 { background: #dfe8c9; } .vm-2 { background: #f9e3b4; } .vm-3 { background: #d6e3ef; } .vm-4 { background: #e6d8ee; }
.nw-board { display: grid; grid-template-columns: 1fr auto 1fr; gap: .6rem; align-items: center; margin: .5rem 0 .6rem; }
.nw-in { display: grid; gap: .35rem; min-height: 60px; }
.nw-pk { display: grid; gap: .1rem; font-size: .85rem; }
.nw-pk small { color: var(--muted); }
.nw-router { background: var(--ink); color: var(--blush); border-radius: 12px; padding: .7rem; text-align: center; display: grid; }
.nw-router small { font-size: .72rem; opacity: .8; }
.nw-devs { display: grid; gap: .35rem; }
.nw-dev { border: 2px dashed var(--olive); border-radius: 12px; padding: .45rem .6rem; background: #fff; display: grid; gap: .1rem; min-height: 54px; }
.nw-dev small { color: var(--muted); }
.nw-dev .nw-pk { margin-top: .2rem; }
@media (max-width: 640px) {
  .cp-board, .nw-board, .vm-board { grid-template-columns: 1fr; }
  .cp-buses { grid-auto-flow: column; }
  .nw-router { order: -1; }
}

/* ---------- Games section ---------- */
.gm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.gm-chapter, .gm-card { display: grid; gap: .35rem; align-content: start; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s; }
.gm-chapter:hover, .gm-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.gm-chapter b { font-family: Outfit, sans-serif; font-size: 1.25rem; }
.gm-num, .gm-kind { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--rose-deep); }
.gm-count { color: var(--muted); font-size: .9rem; }
.gm-bar { height: 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.gm-bar i { display: block; height: 100%; background: var(--olive); }
.gm-go { justify-self: start; margin-top: .3rem; background: var(--ink); color: var(--blush); border-radius: 999px; padding: .35rem .9rem; font-weight: 600; font-size: .88rem; }
.gm-kinds { margin-bottom: 1rem; }
.gm-group { margin-bottom: 1.6rem; }
.gm-group h2 { font-size: 1.3rem; margin-bottom: .6rem; }
.gm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; }
.gm-card b { font-size: 1.05rem; }
.gm-card span:not(.gm-kind):not(.gm-played) { color: var(--muted); font-size: .9rem; }
.gm-card.played { border-color: var(--olive); }
.gm-played { justify-self: start; font-size: .75rem; font-weight: 700; color: var(--olive-deep); background: var(--cream); border-radius: 999px; padding: .15rem .6rem; }
.gm-back { margin-bottom: .6rem; }
.gm-player { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.gm-player h2 { margin-bottom: .6rem; }
.gm-stage > h3:first-child { display: none; }

.pk-what { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin-bottom: .7rem; }
.pk-imgctl { display: grid; gap: .5rem; justify-items: start; margin-bottom: .4rem; }
.pk-imgctl[hidden], .pk-textctl[hidden] { display: none; }
.pk-photo { width: min(300px, 100%); border-radius: 10px; border: 3px solid var(--ink); display: block; }
.pk-tile { width: 100%; max-width: 90px; display: block; aspect-ratio: 1; border-radius: 6px; }
.pk-grid { display: grid; grid-template-columns: repeat(3, 1fr); width: min(270px, 100%); border: 3px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--bg); }
.pk-grid .pk-tile { max-width: none; border-radius: 0; }
.pk-gap { aspect-ratio: 1; background: repeating-linear-gradient(45deg, #f6d5cf, #f6d5cf 8px, #fff 8px, #fff 16px); }
.pk-show { margin: .5rem 0; }

/* ---------- Scenario: Ali's photo (photo-lab) ---------- */
.pa-cut { display: grid; justify-items: center; gap: .6rem; }
.pa-cut[hidden], .pa-made[hidden] { display: none; }
.pa-cap { margin: 0; font-weight: 600; }
.pa-photo { width: min(420px, 100%); border-radius: 12px; border: 3px solid var(--ink); display: block; }
.pa-tile { width: 100%; display: block; aspect-ratio: 1; }
.pa-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: .4rem 0 .8rem; min-height: 0; }
.pa-chip { padding: .35rem .7rem; font-size: .88rem; }
.pa-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.pa-card { border: 2px solid var(--c); border-radius: 12px; overflow: hidden; background: #fff; display: grid; font-size: .78rem; }
.pa-card small { display: block; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; font-size: .66rem; opacity: .85; }
.pa-head { background: var(--c); color: #fff; padding: .4rem .5rem; display: grid; gap: .2rem; min-height: 92px; align-content: start; }
.pa-head .muted { color: #fff; opacity: .75; }
.pa-slot { border: 2px dashed rgba(255,255,255,.8); border-radius: 6px; padding: .2rem .35rem; font-size: .74rem; }
.pa-slot.done { border-style: solid; background: rgba(255,255,255,.18); }
.lk-picking .pa-slot { background: rgba(255,255,255,.25); }
.pa-pay { padding: .35rem .5rem; color: var(--ink); }
.pa-pay svg { border-radius: 6px; }
.pa-trail { background: var(--cream); color: var(--muted); padding: .35rem .5rem; }
.pa-net-wrap { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.pa-net { width: 100%; display: block; }
.pa-land { fill: #eef1e4; }
.pa-river { fill: none; stroke: #cfe3e3; stroke-width: 18; stroke-linecap: round; }
.pa-link line { stroke: var(--olive); stroke-width: 5; stroke-linecap: round; }
.pa-link line.pa-hit { stroke: transparent; stroke-width: 22; cursor: pointer; }
.pa-link:hover line:first-child { stroke: var(--olive-deep); }
.pa-link.blocked line:first-child { stroke: #c4543a; stroke-dasharray: 8 8; }
.pa-router { cursor: pointer; }
.pa-router rect { fill: var(--ink); }
.pa-router line { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.pa-router circle { fill: #9fd4a3; }
.pa-router text, .pa-dev text { font: 600 14px Inter, sans-serif; fill: var(--ink); }
.pa-router.on rect { fill: var(--rose-deep); }
.pa-dev rect { fill: var(--ink); } .pa-dev path { fill: var(--ink); } .pa-dev .pa-screen { fill: #cfe3e3; }
.pa-dev .pa-ip { font: 500 12px "JetBrains Mono", monospace; fill: var(--muted); }
.pa-pk text { font: 800 13px Inter, sans-serif; fill: #fff; }
.pa-pk.lost { opacity: .55; }
.pa-pk .pa-lost { fill: #c4543a; font-size: 14px; }
.pa-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--c); color: #fff; font-weight: 800; }
.pa-arrive { margin: .5rem 0; }
.pa-phone { width: min(330px, 100%); margin: .4rem auto; background: var(--ink); border-radius: 26px; padding: 18px 14px; }
.pa-phone.small { width: min(200px, 100%); padding: 12px 10px; border-radius: 20px; }
.pa-frame { display: grid; grid-template-columns: repeat(3, 1fr); background: #cfe3e3; border-radius: 10px; overflow: hidden; }
.pa-hole { aspect-ratio: 1; display: grid; place-items: center; border: 1px dashed #9bb5b5; color: var(--muted); font-weight: 800; font-size: 1.3rem; }
.pa-hole.done { border: 0; }
.pa-hole.gap { background: repeating-linear-gradient(45deg, #f6d5cf, #f6d5cf 8px, #fff 8px, #fff 16px); cursor: pointer; color: #c4543a; }
.lk-picking .pa-hole:not(.done) { background: #e3efe0; }
.pa-inbox { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; margin-top: .6rem; }
.pa-inbox:empty { display: none; }
.pa-in { border: 2px solid var(--c); border-radius: 10px; padding: .3rem; display: grid; gap: .2rem; font-size: .8rem; text-align: center; }
.pa-two { display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(0, 1fr); gap: .7rem; align-items: center; }
@media (max-width: 640px) { .pa-two { grid-template-columns: 1fr; } }

/* ---------- Scenario: Wire up the school (school-lab) ---------- */
.sc-links { display: grid; gap: .8rem; }
.sc-link { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: .7rem .8rem; display: grid; gap: .5rem; }
.sc-link.done { border-color: var(--olive); box-shadow: inset 4px 0 0 var(--olive); }
.sc-svg, .sc-big { width: 100%; display: block; }
.sc-svg { max-width: 520px; }
.sc-dev { fill: var(--ink); }
.sc-dl { font: 700 14px Inter, sans-serif; fill: var(--blush); }
.sc-ds { font: 500 12px Inter, sans-serif; fill: var(--muted); }
.sc-dev + .sc-dl + .sc-ds { fill: #cfc8c0; }
.sc-wire { stroke: var(--olive); stroke-width: 4; stroke-linecap: round; }
.sc-ab { fill: var(--rose-deep); } .sc-ba { fill: #6b8f71; }
.sc-res { font-size: .9rem; }
.sc-ctl { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; margin-bottom: .6rem; }
.sc-ctl > div { display: grid; gap: .3rem; }
.sc-stage { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.sc-one { fill: var(--rose-deep); } .sc-zero { fill: #5f7d7f; }
.sc-bt { font: 800 12px "JetBrains Mono", monospace; fill: #fff; }
.sc-break { stroke: var(--muted); stroke-width: 3; fill: none; }
.sc-got { font-size: .95rem; }
.sc-scr { fill: #cfe3e3; }
.sc-st { font: 600 13px Inter, sans-serif; fill: var(--ink); }
.sc-port { fill: #9bb5b5; }
.sc-cable { stroke: var(--ink); stroke-width: 6; fill: none; stroke-linecap: round; }
.sc-plug rect { fill: #5f7d7f; }
.sc-plug { transition: transform .4s; }
.sc-plug.sc-flip rect { fill: #c4543a; animation: lk-shake .45s; }
.sc-bat { fill: none; stroke: var(--ink); stroke-width: 3; }
.sc-charge { fill: #6b8f71; transition: all .8s; }
.sc-cap { font: 600 12px "JetBrains Mono", monospace; fill: var(--ink); }
.act-tabs { margin-bottom: 1rem; }
.act-pane[hidden] { display: none; }
.tm-box { display: grid; gap: .8rem; margin-top: 1rem; }
.tm-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .8rem; }
.tm-defs .tm-two p { margin: 0; }
.tm-good { border-top-color: var(--olive); } .tm-bad { border-top-color: var(--rose); }
.tm-good ul, .tm-bad ul { margin-bottom: 0; }
@media (max-width: 640px) { .tm-two { grid-template-columns: 1fr; } }

/* ---------- Compression lab: lossless or lossy on text, sound and image ---------- */
.cx-ctl { display: flex; flex-wrap: wrap; gap: .6rem 1.6rem; margin-bottom: .7rem; }
.cx-ctl > div { display: grid; gap: .3rem; }
.cx-txt[hidden] { display: none; }
.cx-txt { margin-bottom: .7rem; max-width: 480px; }
.cx-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.cx-col { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .7rem; display: grid; gap: .35rem; align-content: start; }
.cx-col > b { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--olive-deep); }
.cx-col small { color: var(--muted); font-size: .76rem; display: block; }
.cx-t { margin: 0; font-size: .92rem; overflow-wrap: anywhere; line-height: 1.7; }
.cx-t span { display: inline-block; background: var(--cream); border: 1px solid var(--border); border-radius: 5px; padding: 0 .25rem; margin: 1px 0; }
.cx-rows { font-size: .8rem; line-height: 1.5; }
.cx-wave { width: 100%; display: block; background: var(--bg); border-radius: 8px; }
.cx-axis { stroke: var(--border); stroke-width: 1; }
polyline.cx-orig, polyline.cx-lost, polyline.cx-ghost { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
polyline.cx-orig { stroke: #5f7d7f; } circle.cx-orig { fill: #5f7d7f; }
polyline.cx-lost { stroke: var(--rose-deep); }
polyline.cx-ghost { stroke: #5f7d7f; opacity: .25; }
.cx-pix { display: grid; grid-template-columns: repeat(var(--n), 1fr); width: 100%; max-width: 240px; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.cx-pix i { display: block; }
.cx-bars { margin: .8rem 0 .3rem; display: grid; gap: .3rem; }
.cx-bar { display: grid; grid-template-columns: 90px 1fr 70px; gap: .5rem; align-items: center; font-size: .85rem; }
.cx-bar i { display: block; height: 14px; border-radius: 999px; }
.cx-bar .cx-o { background: var(--olive); } .cx-bar .cx-s { background: #6b8f71; } .cx-bar .cx-big { background: var(--rose); }
.cx-verdict { margin: .3rem 0 0; }
.cx-why { margin: .4rem 0 .6rem; }
.cx-done { font-size: .88rem; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.cx-tick { border: 1px solid var(--border); border-radius: 999px; padding: .05rem .55rem; background: var(--cream); color: var(--muted); font-size: .78rem; }
.cx-tick.on { background: var(--olive); color: #fff; border-color: var(--olive); }
@media (max-width: 700px) { .cx-cols { grid-template-columns: 1fr; } }
.scc-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .8rem; padding: .6rem .9rem; background: var(--cream); border: 1px solid var(--border); border-radius: 12px; }
.cs-ch { font-size: 1.5rem; font-weight: 700; }
.scen-check select { width: 100%; max-width: 100%; text-overflow: ellipsis; }

/* ---------- Memory hook help (after 4 mistakes in practice) ---------- */
.hk-help { position: fixed; inset: 0; z-index: 200; background: rgba(43, 44, 32, .55); display: grid; place-items: center; padding: 16px; }
.hk-help[hidden] { display: none; }
.hk-card { background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow); border-top: 6px solid var(--rose); width: min(560px, 100%); max-height: 90vh; overflow-y: auto; padding: 1.3rem 1.4rem; }
.hk-card h3 { margin-bottom: .5rem; }
.hk-count { margin: 0 0 .2rem; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--olive-deep); }
.hk-sentence { font-family: Outfit, sans-serif; font-size: 1.35rem; line-height: 1.3; background: var(--blush); border-radius: 12px; padding: .7rem .9rem; }
.hk-sentence b { color: var(--rose-deep); font-size: 1.15em; }
.hk-means { margin: .3rem 0 .6rem; padding-left: 1.4rem; }
.hk-means li { margin: .15rem 0; }
.hk-note { background: var(--cream); border: 1px solid var(--border); border-radius: 10px; padding: .5rem .7rem; font-size: .92rem; }
body.hk-open { overflow: hidden; }

/* ---------- Arcade games (Chapter 3): falling / conveyor items with Easy, Medium, Hard ---------- */
.ar-top { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .5rem; }
.ar-hud { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: .95rem; margin-bottom: .5rem; }
.ar-hud b { font-family: "JetBrains Mono", monospace; color: var(--rose-deep); }
.ar-stage { position: relative; height: 340px; border-radius: 16px; overflow: hidden; border: 2px solid var(--ink); transition: box-shadow .2s; }
.ar-stage.ar-hit { box-shadow: inset 0 0 0 6px #c4543a; }
.ar-scene { position: absolute; inset: 0; pointer-events: none; }
.ar-sky { background: linear-gradient(#cfe3e3, #f6e7d8 70%, #8e8b63 70%, #6b8f71); }
.ar-sky .ar-scene { background: radial-gradient(circle at 85% 18%, #f7e08a 0 28px, transparent 29px), radial-gradient(ellipse at 20% 22%, #fff 0 34px, transparent 35px), radial-gradient(ellipse at 28% 18%, #fff 0 26px, transparent 27px), radial-gradient(ellipse at 62% 34%, #fff 0 24px, transparent 25px); }
.ar-net { background: var(--ink); }
.ar-net .ar-scene { background-image: radial-gradient(circle, rgba(237,218,218,.18) 1.5px, transparent 2px); background-size: 26px 26px; }
.ar-net .ar-scene::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14px; background: repeating-linear-gradient(90deg, var(--rose) 0 22px, var(--rose-deep) 22px 44px); }
.ar-belt { background: linear-gradient(var(--cream) 0 70%, #d9d4c4 70%); }
.ar-belt .ar-scene::after { content: ""; position: absolute; left: 0; right: 0; bottom: 16%; height: 28px; background: repeating-linear-gradient(90deg, #3a3b2c 0 18px, #55564a 18px 36px); animation: ar-roll 1.2s linear infinite; border-top: 4px solid var(--ink); }
@keyframes ar-roll { to { background-position: 36px 0; } }
.ar-belt .ar-scene::before { content: "end of the belt"; position: absolute; right: 8px; top: 8px; font-size: .72rem; font-weight: 700; color: var(--rose-deep); }
.ar-item { position: absolute; left: 0; top: 0; max-width: 230px; background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 12px; padding: .45rem .7rem; font-size: .88rem; font-weight: 600; line-height: 1.3; box-shadow: 0 6px 14px rgba(43,44,32,.18); will-change: transform; }
.ar-net .ar-item { background: #1f2018; color: var(--blush); border-color: var(--rose); }
.ar-item .mono { font-size: .82rem; overflow-wrap: anywhere; }
.ar-item.ar-target { outline: 4px solid var(--rose); outline-offset: 2px; }
.ar-item.ar-ok { transition: opacity .3s, scale .3s; opacity: 0; scale: 1.25; background: #dfe8c9; }
.ar-item.ar-miss { transition: opacity .35s; opacity: 0; background: #f6d5cf; }
.ar-msg { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 1rem; background: rgba(255,253,252,.82); font-size: 1.05rem; z-index: 2; }
.ar-msg[hidden] { display: none; }
.ar-over { font-family: Outfit, sans-serif; font-size: 1.8rem; color: var(--rose-deep); }
.ar-bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .4rem; margin-top: .6rem; }
.ar-bin { font: inherit; font-weight: 700; font-size: .9rem; padding: .6rem .4rem; border-radius: 12px; border: 2px solid var(--ink); background: var(--blush); color: var(--ink); cursor: pointer; display: flex; gap: .4rem; align-items: center; justify-content: center; }
.ar-bin:hover { background: var(--rose); }
.ar-bin:active { transform: translateY(1px); }
.ar-bin small { font-family: "JetBrains Mono", monospace; font-size: .7rem; background: var(--ink); color: var(--blush); border-radius: 4px; padding: 0 .3rem; }

/* CPU Rush */
.cr-q { font-size: 1.05rem; min-height: 1.6em; background: var(--cream); border: 1px solid var(--border); border-radius: 12px; padding: .55rem .8rem; }
.cr-board { position: relative; display: grid; grid-template-columns: 3fr 92px 1.2fr; gap: .6rem; align-items: stretch; }
.cr-cpu { background: var(--ink); border-radius: 16px; padding: 1.8rem .6rem .6rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; position: relative; }
.cr-lab { position: absolute; left: .8rem; top: .35rem; color: var(--blush); font-family: Outfit, sans-serif; letter-spacing: .08em; }
.cr-box { font: inherit; background: #fff; color: var(--ink); border: 2px solid transparent; border-radius: 10px; padding: .5rem .4rem; cursor: pointer; display: grid; gap: .1rem; text-align: center; transition: transform .15s, background .2s; min-height: 64px; align-content: center; }
.cr-box b { font-family: "JetBrains Mono", monospace; font-size: 1.05rem; color: var(--rose-deep); }
.cr-box small { font-size: .68rem; color: var(--muted); line-height: 1.2; }
.cr-box:hover, .cr-bus:hover { transform: translateY(-2px); }
.cr-ram { background: #cfe3e3; border: 2px solid var(--ink); }
.cr-ram .mono { font-size: .72rem; background: #fff; border-radius: 6px; padding: .15rem .3rem; margin-top: .3rem; }
.cr-buses { display: grid; gap: .45rem; align-content: center; }
.cr-bus { font: inherit; font-size: .74rem; font-weight: 700; padding: .55rem .2rem; border-radius: 8px; border: 0; cursor: pointer; color: #fff; background: repeating-linear-gradient(90deg, var(--olive) 0 8px, var(--olive-deep) 8px 16px); }
.cr-nobus .cr-bus { opacity: .35; pointer-events: none; }
.cr-ok { background: #dfe8c9 !important; }
.cr-bad { background: #f6d5cf !important; animation: lk-shake .4s; }
.cr-hint { box-shadow: 0 0 0 4px var(--rose); }
.cr-token { position: absolute; left: 0; top: 0; z-index: 3; width: 52px; text-align: center; font: 700 .72rem "JetBrains Mono", monospace; background: #f7e08a; color: var(--ink); border: 2px solid var(--ink); border-radius: 6px; padding: .2rem 0; transition: transform .45s cubic-bezier(.3,.7,.3,1); pointer-events: none; }
@media (max-width: 640px) { .cr-board { grid-template-columns: 1fr; } .cr-buses { grid-auto-flow: column; } .ar-stage { height: 300px; } }
.ar-key { background: var(--cream); border: 1px solid var(--border); border-radius: 12px; padding: .5rem .8rem; margin-bottom: .7rem; }
.ar-key summary { cursor: pointer; font-weight: 700; color: var(--rose-deep); }
.ar-keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-top: .5rem; font-size: .86rem; }
.ar-keys > div { background: #fff; border: 1px solid var(--border); border-top: 4px solid var(--olive); border-radius: 10px; padding: .5rem .6rem; }
.ar-keys ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.ar-keys li { margin: .1rem 0; }
.ar-keys .mono { font-size: .78rem; overflow-wrap: anywhere; }
.ar-keys .ar-both { grid-column: 1 / -1; border-top-color: var(--rose); }
@media (max-width: 700px) { .ar-keys { grid-template-columns: 1fr; } }
/* scenario questions in the labs: answer buttons */
.lab-scen { margin-top: 1.4rem; padding-top: 1rem; border-top: 2px dashed var(--border); }
.scc-opts { display: grid; gap: .35rem; }
.scc-opt { font: inherit; font-size: .9rem; text-align: left; padding: .45rem .7rem; border-radius: 10px; border: 1px solid var(--border); background: var(--cream); color: var(--ink); cursor: pointer; transition: background .15s, transform .1s; }
.scc-opt:hover { background: var(--blush); transform: translateX(2px); }
.scc-opt.right { background: #dfe8c9; border-color: var(--olive); font-weight: 600; }
.scc-opt.wrong { background: #f6d5cf; border-color: var(--rose); animation: lk-shake .4s; }

/* student accounts: login.html, account.html, plans.html, admin.html (account.js) */
.auth-card { padding-top: 1rem; }
.auth-card [hidden], #plans-app [hidden] { display: none; }
.auth-card h1 { font-family: Outfit, sans-serif; margin-bottom: .4rem; }
.auth-card .form { margin-top: 1.2rem; }
.auth-msg { min-height: 1.5em; margin-top: 1rem; font-weight: 500; color: var(--olive-deep); }
.auth-msg.bad { color: #b3412f; }
.admin-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.acct-plans { list-style: none; padding: 0; margin: 1.4rem 0; display: grid; gap: .8rem; }
.acct-plan { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; }
.acct-plan span { color: var(--muted); grid-column: 1; }
.acct-plan .btn { grid-column: 2; grid-row: 1 / span 2; }
.acct-plan.on span { color: var(--olive-deep); font-weight: 600; }
.plans-locked { background: var(--blush); border-radius: var(--radius); padding: .8rem 1.1rem; font-weight: 600; }
.plans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 760px; margin: 1.4rem 0 2rem; }
.plans-steps { padding-left: 1.3rem; display: grid; gap: .4rem; margin-bottom: 1.2rem; }
.admin { width: min(1100px, 100% - 32px); }
.admin .q-input { margin: 1.4rem 0 .8rem; max-width: 420px; }
.admin-table { overflow-x: auto; }
.admin-table table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); }
.admin-table th, .admin-table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; font-size: .95rem; }
.admin-table .bad { color: #b3412f; }
.admin-row-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.gm-locked { opacity: .75; }
@media (max-width: 640px) { .plans-grid { grid-template-columns: 1fr; } .acct-plan { grid-template-columns: 1fr; } .acct-plan .btn { grid-column: 1; grid-row: auto; justify-self: start; } }

/* ---------- Pseudocode editor (pseudocode.html) ---------- */
.pc-section { padding-top: 1.6rem; }
.pc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-bottom: .7rem; }
.pc-gap { flex: 1; }
.pc-pick { display: inline-flex; align-items: center; gap: .4rem; font-size: .88rem; font-weight: 600; }
.pc-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: .7rem; }
.pc-editor { display: flex; height: 460px; background: var(--ink); border-radius: 14px; overflow: hidden; }
.pc-gutter { flex: none; width: 3em; padding: .75rem .5rem .75rem 0; text-align: right; color: var(--olive); font: 15px/1.6 "JetBrains Mono", Consolas, monospace; overflow: hidden; user-select: none; }
.pc-gutter span { display: block; }
.pc-gutter .pc-bad-n { color: #fff; background: var(--rose-deep); border-radius: 0 4px 4px 0; }
.pc-area { position: relative; flex: 1; min-width: 0; }
.pc-colour, .pc-code { position: absolute; inset: 0; margin: 0; padding: .75rem .9rem; border: 0; font: 15px/1.6 "JetBrains Mono", Consolas, monospace; white-space: pre; tab-size: 3; overflow: auto; font-variant-ligatures: none; }
.pc-colour { color: #f7f1f1; overflow: hidden; pointer-events: none; }
.pc-colour > div { min-height: 1.6em; width: max-content; min-width: 100%; }
.pc-colour .pc-bad { background: rgba(203, 133, 135, .3); }
.pc-code { width: 100%; height: 100%; resize: none; outline: 0; background: transparent; color: transparent; caret-color: #fff; }
.pc-code::selection { background: rgba(214, 212, 173, .35); color: transparent; }
.pc-editor:focus-within { box-shadow: 0 0 0 3px var(--rose); }
.c-key { color: #e9a3a5; font-weight: 600; } .c-str { color: var(--sage); } .c-num { color: #9fd4c0; } .c-com { color: #a8a68a; }
.pc-side { display: flex; flex-direction: column; height: 460px; background: #fff; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.pc-side-h { margin: 0; padding: .5rem .9rem; background: var(--cream); border-bottom: 1px solid var(--border); font-weight: 700; font-size: .85rem; }
.pc-console { flex: 1; min-height: 0; overflow: auto; padding: .7rem .9rem; font: 15px/1.5 "JetBrains Mono", Consolas, monospace; overflow-wrap: anywhere; }
.pc-console p { margin: 0; white-space: pre-wrap; }
.pc-console .pc-hint { color: var(--muted); font-family: Inter, sans-serif; }
.pc-console .pc-typed { color: var(--rose-deep); font-weight: 600; }
.pc-console .pc-end { color: var(--olive-deep); font: 600 .85rem Inter, sans-serif; margin-top: .5rem; }
.pc-console .pc-note { margin: .35rem 0; padding: .35rem .6rem; background: var(--cream); border-radius: 8px; color: #4d4c3d; font: .85rem/1.4 Inter, sans-serif; }
.pc-err { display: block; width: 100%; margin: .4rem 0; padding: .55rem .7rem; text-align: left; cursor: pointer; background: #fbeeee; color: #8a3f43; border: 1px solid var(--rose); border-radius: 8px; font: 600 .92rem/1.4 Inter, sans-serif; overflow-wrap: anywhere; }
.pc-ask { padding: .6rem .9rem; background: var(--cream); border-top: 1px solid var(--border); }
.pc-ask-l { display: block; margin-bottom: .3rem; font-weight: 600; font-size: .85rem; }
.pc-ask-row { display: flex; gap: .4rem; }
.pc-ask-in { flex: 1; min-width: 0; padding: .4rem .6rem; font: 16px "JetBrains Mono", Consolas, monospace; border: 1px solid var(--border); border-radius: 8px; }
.pc-more { margin-top: .8rem; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: .6rem 1rem; }
.pc-more summary { cursor: pointer; font-weight: 600; }
.pc-more[open] summary { margin-bottom: .6rem; }
.pc-remind { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; }
.pc-remind b { font-size: .85rem; }
.pc-remind pre { margin: .2rem 0 0; padding: .5rem .6rem; background: var(--cream); border-radius: 8px; font: .8rem/1.5 "JetBrains Mono", Consolas, monospace; overflow-x: auto; }
.pc-file { margin-bottom: .6rem; }
.pc-file-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.pc-file-in { width: 100%; font-family: "JetBrains Mono", Consolas, monospace; }
@media (max-width: 760px) {
  .pc-grid { grid-template-columns: minmax(0, 1fr); }
  .pc-editor { height: 320px; }
  .pc-side { height: 280px; }
  .pc-gap { display: none; }
  .pc-colour, .pc-code, .pc-gutter { font-size: 16px; }   /* phones zoom in on anything smaller */
}

/* the menu has seven links on course pages: keep them on one line just above the phone menu's breakpoint */
.nav-links a { white-space: nowrap; }
@media (min-width: 901px) and (max-width: 1060px) {
  .logo-crop { width: 160px; }
  .nav-links { gap: .75rem; font-size: .92rem; }
}

/* ---------- Coding roadmap (roadmap.html) ---------- */
.rm-section { padding-top: 1.6rem; }
.rm-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.rm-side { position: sticky; top: 84px; display: grid; gap: .6rem; }
.rm-score { background: var(--ink); color: var(--blush); border-radius: 14px; padding: .8rem 1rem; }
.rm-score p { margin: 0; }
.rm-score-n { font-size: .95rem; } .rm-score-n b { font: 700 1.7rem Outfit, sans-serif; }
.rm-score-s { font-size: .82rem; color: var(--sage); }
.rm-bar { height: 9px; margin: .35rem 0; border-radius: 999px; background: #45463a; overflow: hidden; }
.rm-bar i { display: block; height: 100%; background: var(--rose); transition: width .4s; }
.rm-menu-btn { display: none; }
.rm-nav { display: grid; gap: .2rem; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: .5rem; max-height: calc(100vh - 220px); overflow-y: auto; }
.rm-week { margin: .6rem .4rem .2rem; font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--olive-deep); }
.rm-week:first-child { margin-top: .2rem; }
.rm-item { display: flex; justify-content: space-between; align-items: center; gap: .5rem; width: 100%; padding: .5rem .6rem; font: inherit; font-size: .88rem; font-weight: 500; line-height: 1.3; text-align: left; color: var(--ink); background: none; border: 0; border-radius: 10px; cursor: pointer; }
.rm-item small { flex: none; font-size: .72rem; font-weight: 600; color: var(--muted); }
.rm-item:hover:not(:disabled) { background: var(--cream); }
.rm-item:disabled { color: #a3a191; cursor: not-allowed; }
.rm-item:disabled small { color: #a3a191; }
.rm-item.passed small { color: var(--olive-deep); }
.rm-item.check { font-weight: 700; }
.rm-item.active, .rm-item.active:hover { background: var(--ink); color: var(--blush); }
.rm-item.active small { color: var(--sage); }
.rm-reset { margin-top: .5rem; padding: .4rem; font: inherit; font-size: .78rem; color: var(--muted); background: none; border: 0; text-decoration: underline; cursor: pointer; }
.rm-miles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin-bottom: .8rem; }
.rm-mile { display: grid; gap: .1rem; align-content: start; padding: .55rem .7rem; background: #fff; border: 1px solid var(--border); border-radius: 12px; font-size: .82rem; line-height: 1.3; }
.rm-mile small { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rm-mile span { color: var(--muted); font-size: .76rem; }
.rm-mile.reached { background: var(--olive); border-color: var(--olive); color: #fff; }
.rm-mile.reached small, .rm-mile.reached span { color: #fff; }
.rm-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem 1.4rem; min-height: 340px; }
.rm-card h2 { margin: 0 0 .5rem; font-size: 1.55rem; }
.rm-kicker { margin: 0; font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--rose-deep); }
.rm-count { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem 1rem; margin: 0 0 .3rem; font-size: .88rem; color: var(--muted); }
.rm-count b { color: var(--ink); }
.rm-dots { display: flex; gap: .3rem; margin-bottom: 1rem; }
.rm-dots i { flex: 1; height: 6px; border-radius: 999px; background: var(--cream); }
.rm-dots i.done { background: var(--olive); } .rm-dots i.now { background: var(--rose); }
.rm-q { font-size: 1.05rem; font-weight: 600; margin-bottom: .7rem; }
.rm-opts { display: grid; gap: .45rem; }
.rm-opt { padding: .6rem .9rem; font: inherit; line-height: 1.35; text-align: left; color: var(--ink); background: var(--cream); border: 2px solid var(--border); border-radius: 12px; cursor: pointer; overflow-wrap: anywhere; }
.rm-opt:hover:not(:disabled) { border-color: var(--rose); }
.rm-opt:disabled { cursor: default; opacity: .7; }
.rm-opt.right { background: #e6edd5; border-color: var(--olive); opacity: 1; }
.rm-opt.wrong { background: #fbeeee; border-color: var(--rose); opacity: 1; }
.rm-code, .rm-editor { display: block; width: 100%; margin: 0 0 .7rem; padding: .7rem .9rem; font: 15px/1.55 "JetBrains Mono", Consolas, monospace; font-variant-ligatures: none; tab-size: 3; background: var(--ink); color: #f7f1f1; border: 0; border-radius: 12px; overflow: auto; white-space: pre; }
.rm-editor { resize: vertical; caret-color: #fff; outline: 0; }
.rm-editor:focus { box-shadow: 0 0 0 3px var(--rose); }
.rm-answer-l { display: grid; gap: .25rem; font-weight: 600; font-size: .9rem; }
.rm-answer { width: min(340px, 100%); padding: .45rem .6rem; font: 16px/1.5 "JetBrains Mono", Consolas, monospace; font-variant-ligatures: none; border: 2px solid var(--border); border-radius: 10px; resize: vertical; }
.rm-answer:focus { outline: 0; border-color: var(--rose); }
.rm-output { margin-bottom: .6rem; padding: .5rem .8rem; background: var(--cream); border-radius: 10px; font-size: .85rem; }
.rm-output pre { margin: .2rem 0 0; font: .9rem/1.5 "JetBrains Mono", Consolas, monospace; font-variant-ligatures: none; overflow-x: auto; }
.rm-feedback:empty { display: none; }
.rm-feedback { margin: .7rem 0 0; padding: .55rem .8rem; border-radius: 10px; font-weight: 500; font-size: .95rem; overflow-wrap: anywhere; }
.rm-feedback.good { background: #e6edd5; color: var(--olive-deep); }
.rm-feedback.bad { background: #fbeeee; color: #8a3f43; }
.rm-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.rm-result { padding: .7rem .9rem; border-radius: 12px; font-size: 1.05rem; }
.rm-result.good { background: #e6edd5; color: var(--olive-deep); }
.rm-result.bad { background: #fbeeee; color: #8a3f43; }
.rm-won { display: grid; gap: .15rem; margin: .4rem 0 .8rem; padding: 1rem 1.2rem; background: var(--ink); color: var(--blush); border-radius: 14px; }
.rm-won small { font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--sage); }
.rm-won b { font: 700 1.45rem Outfit, sans-serif; }
@media (max-width: 900px) {
  .rm-layout { grid-template-columns: minmax(0, 1fr); }
  .rm-side { position: static; }
  .rm-menu-btn { display: flex; justify-content: space-between; gap: .6rem; width: 100%; padding: .65rem 1rem; font: inherit; color: var(--blush); background: var(--ink); border: 1px solid var(--ink); border-radius: 14px; cursor: pointer; text-align: left; }
  .rm-menu-btn span { font-size: .85rem; opacity: .85; }
  .rm-menu-btn b { min-width: 0; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rm-nav { display: none; max-height: 60vh; }
  .rm-side.menu-open .rm-nav { display: grid; }
  .rm-miles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .rm-card { padding: 1rem; }
  .rm-editor { font-size: 16px; }
}

/* ---------- Scenario levels (inside roadmap.html) ---------- */
.rm-week-sc { color: var(--rose-deep); }
.sp-based { margin: -.3rem 0 .6rem; font-size: .8rem; color: var(--muted); }
.sp-brief { margin-bottom: .7rem; padding: .55rem .9rem; background: var(--cream); border: 1px solid var(--border); border-radius: 12px; }
.sp-brief summary { cursor: pointer; font-weight: 600; }
.sp-brief p { margin: .5rem 0 .3rem; }
.sp-brief .rm-code { font-size: .82rem; margin-bottom: .2rem; }
.sp-set-l { font-size: .85rem; font-weight: 600; }
.sp-parts { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 .9rem; padding: 0; }
.sp-parts li { display: flex; gap: .4rem; align-items: baseline; padding: .22rem .6rem; font-size: .8rem; background: #fff; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); }
.sp-parts li small { font-size: .68rem; font-weight: 700; }
.sp-parts li.done { background: #e6edd5; border-color: var(--olive); color: var(--olive-deep); }
.sp-parts li.now { background: var(--ink); border-color: var(--ink); color: var(--blush); font-weight: 600; }
.sp-step { margin-top: .4rem; }
.sp-title { margin: .1rem 0 .3rem; }
.sp-uses { font-size: .85rem; color: var(--muted); margin: -.3rem 0 .7rem; }
.sp-topic { font: inherit; color: var(--rose-deep); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; margin-right: .5rem; }
.sp-hints { margin: .6rem 0 0; padding: .5rem .9rem .5rem 1.8rem; background: var(--cream); border-radius: 10px; font-size: .92rem; overflow-wrap: anywhere; }
.sp-compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem; }
.sp-compare .rm-code { font-size: .8rem; max-height: 340px; }
.sp-check-list { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .3rem; }
.sp-note { font-size: .88rem; color: var(--muted); }
@media (max-width: 720px) { .sp-compare { grid-template-columns: minmax(0, 1fr); } }

/* written Paper 2 style questions and topic notes */
.pq-item { padding: 1rem 1.1rem; margin-bottom: .9rem; background: var(--card, #fff); border: 1px solid var(--border); border-radius: 12px; }
.pq-item h4, .pq-panel h3 { margin: 0 0 .5rem; font-size: 1.05rem; }
.pq p { margin: 0 0 .5rem; }
.pq-part { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: .2rem .4rem; margin-bottom: .5rem; }
.pq-label { font-weight: 700; }
.pq-text ul { margin: .1rem 0 0 1.1rem; padding: 0; }
.pq-text li { margin-bottom: .2rem; }
.pq-marks { font-weight: 700; white-space: nowrap; }
.pq-total { font-size: .88rem; color: var(--muted); text-align: right; }
.pq-code { margin: .3rem 0 .7rem; padding: .7rem .9rem; overflow-x: auto; font-family: "JetBrains Mono", Consolas, monospace; font-size: .88rem; line-height: 1.5; font-variant-ligatures: none; background: var(--cream); border-radius: 10px; }
.pq-ans { margin: .3rem 0; }
.pq-item .code-item { margin: .4rem 0 .6rem; }
.pq-panel { padding: 1rem 1.1rem; margin-bottom: .7rem; background: var(--cream); border-radius: 12px; }
.pq-panel .pc-bar { margin: .5rem 0 0; }
.rm-notes h3, .rm-written h3 { margin: .4rem 0 .5rem; font-size: 1.15rem; }
.rm-notes ul { margin: 0 0 .8rem 1.2rem; padding: 0; }
.rm-notes li { margin-bottom: .4rem; }
.rm-notes code { font-family: "JetBrains Mono", Consolas, monospace; font-size: .9em; font-variant-ligatures: none; }
.rm-tip { padding: .7rem .9rem; background: #e6edd5; color: var(--olive-deep); border-radius: 10px; }
.rm-tip b { display: block; }
.rm-written { margin-top: 1rem; }
.rm-written .sub { margin-bottom: .7rem; }

/* A, B, C, D on multiple choice options */
.rm-opt { display: flex; align-items: flex-start; gap: .6rem; }
.rm-opt-l { flex: none; font-weight: 700; }
.rm-opt-t { min-width: 0; }
/* the editor page: the question beside the editor and the output */
.pc-section .container { width: min(1400px, 100% - 32px); }
.pc-grid.with-q { grid-template-columns: minmax(0, 3fr) minmax(0, 5fr) minmax(0, 3fr); }
.pq-panel { height: 460px; margin-bottom: 0; overflow-y: auto; }
.pq-show[hidden] { display: none; }
@media (max-width: 1000px) {
  .pc-grid.with-q { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .pq-panel { grid-column: 1 / -1; height: auto; max-height: 260px; }
}
@media (max-width: 760px) {
  .pc-grid.with-q { grid-template-columns: minmax(0, 1fr); }
}
/* the syntax guide page */
.sg-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.2rem; align-items: start; margin-bottom: 1.4rem; }
.sg-menu { position: sticky; top: 90px; display: grid; gap: .2rem; padding: .5rem; background: #fff; border: 1px solid var(--border); border-radius: 14px; }
.sg-menu a { display: block; padding: .55rem .8rem; border-radius: 10px; color: var(--ink); font-weight: 600; font-size: .95rem; text-decoration: none; }
.sg-menu a:hover { background: var(--cream); }
.sg-menu a.active { background: var(--ink); color: var(--blush); }
.sg-topic[hidden] { display: none; }
@media (max-width: 760px) {
  .sg-layout { grid-template-columns: minmax(0, 1fr); }
  .sg-menu { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.sg-topic { margin-bottom: 1.6rem; scroll-margin-top: 90px; }
.sg-topic h2 { margin: 0 0 .6rem; font-size: 1.35rem; }
.sg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: .6rem; }
.sg-card { min-width: 0; padding: .7rem .85rem; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.sg-card h3 { margin: 0 0 .35rem; font-size: .95rem; }
.sg-card pre { margin: 0; padding: .55rem .65rem; background: var(--cream); border-radius: 8px; font: .85rem/1.5 "JetBrains Mono", Consolas, monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.rm-notes h4 { margin: .7rem 0 .3rem; font-size: 1rem; color: var(--rose-deep); }
.rm-flow { display: flex; align-items: center; gap: .4rem; max-width: 520px; margin: .2rem 0 .9rem; font-size: .84rem; line-height: 1.3; }
.rm-flow-box { flex: 1 1 0; min-width: 0; padding: .5rem .6rem; text-align: center; background: var(--cream); border: 1px solid var(--border); border-radius: 10px; }
.rm-flow-box.end { background: #e6edd5; border-color: var(--olive); }
.rm-flow-box b, .rm-flow-box small { display: block; overflow-wrap: anywhere; }
.rm-flow-box small { color: var(--olive-deep); font-size: .78rem; }
.rm-flow-arrow { flex: none; width: 0; height: 0; border-block: 6px solid transparent; border-left: 9px solid var(--rose); }
@media (max-width: 480px) {
  .rm-flow { flex-direction: column; align-items: stretch; }
  .rm-flow-arrow { align-self: center; border-inline: 6px solid transparent; border-block: 0; border-top: 9px solid var(--rose); }
}
/* find-the-errors questions */
.rm-err-help { margin: 0 0 .6rem; font-size: .92rem; color: var(--muted); }
.rm-err-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: .6rem; margin-bottom: .6rem; }
.rm-err-row label { display: block; font-size: .85rem; font-weight: 600; }
.rm-err-row input { display: block; width: 100%; box-sizing: border-box; margin-top: .2rem; padding: .45rem .6rem; font: .92rem "JetBrains Mono", Consolas, monospace; font-variant-ligatures: none; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
/* the Coding practice page: topics, then the question, the editor and the output */
.cp-layout { grid-template-columns: 215px minmax(0, 1fr); }
.cp-menu { max-height: 560px; overflow-y: auto; }
.cp-menu a { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: .88rem; }
.cp-menu small { flex: none; font-weight: 500; font-size: .74rem; color: var(--muted); }
.cp-menu a.active small { color: var(--blush); }
.cp-layout .pq-panel { padding: .8rem .9rem; }
.cp-layout .pq-panel h3 { margin-bottom: .3rem; }
.cp-layout .rm-dots i { background: var(--border); }
.cp-layout .rm-dots i.done { background: var(--olive); }
.cp-layout .rm-dots i.now { background: var(--rose); }
.cp-model { margin-top: .5rem; font-size: .9rem; }
.cp-moves { margin-top: .6rem; }
@media (max-width: 1200px) {
  .cp-layout { grid-template-columns: minmax(0, 1fr); }
  .cp-menu { position: static; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); max-height: 190px; }
}
.cp-based { margin: -.3rem 0 .6rem; font-size: .8rem; font-weight: 600; color: var(--rose-deep); }
.cp-bullets { margin: 0 0 .6rem 1.1rem; padding: 0; font-size: .92rem; }
.cp-bullets li { margin-bottom: .25rem; }
.sg-topic > .mat-head { margin-top: 0; }
/* the Downloads page */
.dl-wrap { overflow-x: auto; margin-bottom: 1.2rem; }
.dl-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.dl-table th, .dl-table td { padding: .45rem .8rem; text-align: left; border-bottom: 1px solid var(--border); }
.dl-table tbody tr:last-child th, .dl-table tbody tr:last-child td { border-bottom: 0; }
.dl-table tbody th { font-weight: 600; }
.sg-topic > h2 { margin-top: 0; }
.dl-note { display: block; font-weight: 400; font-size: .78rem; color: var(--muted); }
.sg-menu a.sg-group-head.active { background: transparent; color: var(--ink); }
.sg-menu a.sg-group-head.active:hover { background: var(--cream); }
.sg-sub { display: none; gap: .15rem; margin: .15rem 0 0 .9rem; }
.sg-group.open .sg-sub { display: grid; }
@media (max-width: 760px) {
  .sg-group { grid-column: 1 / -1; }
  .sg-group.open .sg-sub { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Top menu: main links, a Resources drop-down, and the two buttons on the right ---------- */
.nav-inner { gap: 2rem; }
.nav-links { gap: 1.5rem; }
.nav-actions { display: flex; align-items: center; gap: .6rem; margin-left: .6rem; }
.nav-links a.nav-login { background: transparent; border-color: var(--blush); color: var(--blush); }
.nav-links a.nav-login:hover { background: var(--blush); border-color: var(--blush); color: var(--ink); }
.nav-drop { position: relative; }
.nav-drop-btn { font: inherit; font-weight: 500; color: var(--blush); background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; }
.nav-drop-btn:hover, .nav-drop.open .nav-drop-btn { color: var(--sage); }
.nav-drop-menu { display: none; position: absolute; top: calc(100% + 14px); left: 50%; transform: translateX(-50%); min-width: 170px;
  background: var(--ink); border: 1px solid #3a3b2c; border-radius: 14px; padding: .4rem; box-shadow: var(--shadow); z-index: 60; }
.nav-drop-menu::before { content: ""; position: absolute; inset: -16px 0 auto; height: 16px; }   /* keeps the menu open while the mouse moves down */
.nav-drop:hover .nav-drop-menu, .nav-drop:focus-within .nav-drop-menu, .nav-drop.open .nav-drop-menu { display: grid; }
.nav-drop-menu a { padding: .5rem .8rem; border-radius: 9px; }
.nav-drop-menu a:hover { background: #3a3b2c; color: var(--blush); }
@media (min-width: 901px) and (max-width: 1060px) {
  .nav-inner { gap: 1.2rem; }
  .nav-links { gap: 1rem; }
  .nav-actions { margin-left: 0; gap: .45rem; }
}
@media (max-width: 900px) {
  .nav-links { gap: 0; }
  .nav-drop { width: 100%; }
  .nav-drop-btn { display: block; width: 100%; padding: .9rem 16px .5rem; text-align: center; color: var(--sage); font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; cursor: default; }
  .nav-drop-menu { display: grid; position: static; transform: none; min-width: 0; border: 0; border-radius: 0; padding: 0; box-shadow: none; background: #34352a; }
  .nav-drop-menu::before { display: none; }
  .nav-drop-menu a { border-radius: 0; padding: .7rem 16px; }
  .nav-actions { flex-direction: column; width: 100%; margin: .4rem 0 1rem; gap: .5rem; }
  .nav-actions a.btn { width: auto; padding: .55rem 1.6rem; margin: 0; }
}

/* practice: topic, question type and number size are chosen from drop-downs */
.tool-pick { display: inline-flex; align-items: center; gap: .6rem; font-weight: 600; margin-bottom: 1.2rem; }
.tool-opts { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; margin-bottom: 1rem; }
.tool-opts label { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .95rem; }
.tool-pick .fsel, .tool-opts .fsel { background: #fff; min-width: 12rem; }
@media (max-width: 560px) { .tool-pick, .tool-opts label { display: grid; gap: .3rem; width: 100%; } .tool-pick .fsel, .tool-opts .fsel { width: 100%; } }

/* ---------- Matching terms game ---------- */
.mt-bar { margin: 0 0 .6rem; font-size: .92rem; color: var(--muted); }
.mt-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: .8rem; }
.mt-col { display: grid; gap: .45rem; align-content: start; }
.mt-h { margin: 0; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--olive-deep); }
.mt-card { font: inherit; font-size: .92rem; text-align: left; padding: .6rem .8rem; border-radius: 12px; border: 2px solid var(--border); background: #fff; color: var(--ink); cursor: pointer; overflow-wrap: anywhere; }
.mt-term { font-weight: 700; background: var(--cream); }
.mt-card:hover:not(:disabled) { border-color: var(--rose); }
.mt-card.picked { border-color: var(--ink); background: var(--ink); color: var(--blush); }
.mt-card.done { border-color: var(--olive); background: #eef1e4; color: var(--olive-deep); cursor: default; }
.mt-card.shake { animation: lk-shake .45s; border-color: var(--rose-deep); }
.mt-fb .btn { margin-left: .5rem; }
@media (max-width: 560px) { .mt-grid { grid-template-columns: 1fr 1fr; gap: .5rem; } .mt-card { font-size: .84rem; padding: .5rem .55rem; } }


/* Syntax guide, Basics: Output | Input, Assignment | Comments, Data types | Variable declarations, then the three operator cards */
@media (min-width: 1200px) {
  #basics .sg-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #basics .sg-card { grid-column: span 3; }
  #basics .sg-card:nth-child(n+7) { grid-column: span 2; }
}

/* Syntax guide, Selection: IF THEN ENDIF | IF THEN ELSE ENDIF | CASE, then Nested IF */
@media (min-width: 1200px) {
  #selection .sg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Syntax guide, Loops: FOR | WHILE | REPEAT, then FOR with STEP */
@media (min-width: 1200px) {
  #loops .sg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Syntax guide, Validation and verification: the check picker */
.sg-pick { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-bottom: .7rem; }
.sg-pick label { font-weight: 600; }
.sg-pick select { font: inherit; font-weight: 500; padding: .45rem .6rem; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--ink); max-width: 100%; }
.sg-pick .sg-about { flex-basis: 100%; margin: 0; color: var(--muted, #555); font-size: .92rem; }

/* Syntax guide, Arrays: two cards per row so the longer algorithms fit */
.sg-card[hidden] { display: none; }
@media (min-width: 900px) {
  #arrays .sg-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #arrays .sg-card { grid-column: span 2; }
  /* first row of each set: Declaration (half) | Assignment | Assignment using a loop (a quarter each); 1D = cards 1-13, 2D = cards 14-26 */
  #arrays .sg-card:is(:nth-child(2), :nth-child(3), :nth-child(15), :nth-child(16)) { grid-column: span 1; }
}

/* ---------- Overflow detective (binary addition) ---------- */
.ov-bar { margin: 0 0 .6rem; color: var(--muted); font-size: .92rem; }
.ov-grid { display: grid; grid-template-columns: 4.6rem repeat(9, minmax(0, 2.6rem)); gap: .3rem; align-items: center; justify-content: start; font-family: "JetBrains Mono", monospace; }
.ov-l { font-family: Inter, sans-serif; font-size: .78rem; font-weight: 700; color: var(--olive-deep); text-transform: uppercase; letter-spacing: .05em; text-align: right; padding-right: .4rem; }
.ov-c { display: grid; place-items: center; height: 2.4rem; border-radius: 8px; font-size: 1.1rem; font-weight: 600; }
.ov-pv { height: 1.6rem; font-size: .72rem; color: var(--muted); font-weight: 500; }
.ov-pv:nth-child(2) { color: var(--rose-deep); font-weight: 700; }
.ov-n { background: var(--cream); }
.ov-carry, .ov-ans { font: inherit; font-weight: 700; border: 2px dashed var(--border); background: #fff; cursor: pointer; color: var(--ink); }
.ov-carry { height: 1.7rem; font-size: .85rem; color: var(--rose-deep); }
.ov-carry.on { border-style: solid; border-color: var(--rose); }
.ov-carry.hint { color: var(--olive-deep); border-color: var(--olive); }
.ov-ans { border-style: solid; font-size: 1.15rem; }
.ov-ans:hover:not(:disabled), .ov-carry:hover:not(:disabled) { border-color: var(--ink); }
.ov-ans.ov-ninth { border-color: var(--rose); background: #fff7f7; }
.ov-ans.right { border-color: var(--olive); background: #eef1e4; }
.ov-ans.wrong { border-color: var(--rose-deep); background: #f6d5cf; }
.ov-ans:disabled, .ov-carry:disabled { cursor: default; }
.ov-none { visibility: hidden; height: 1.7rem; }
.ov-line { grid-column: 2 / -1; height: 3px; background: var(--ink); border-radius: 2px; }
.ov-ninth-note { font-size: .82rem; color: var(--muted); margin: .5rem 0 .8rem; }
.ov-ask p { margin: .3rem 0; }
.ov-why { display: grid; gap: .4rem; justify-items: start; }
.ov-check-d { background: var(--cream); border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; }
.ov-end { text-align: center; padding: 1rem 0; }
.ov-big { font-size: 1.4rem; font-family: Outfit, sans-serif; }
.ov-end .lab-play { justify-content: center; }
@media (max-width: 560px) {
  .ov-grid { grid-template-columns: 3.2rem repeat(9, minmax(0, 1fr)); gap: .2rem; }
  .ov-c { height: 2rem; font-size: .95rem; } .ov-pv { font-size: .6rem; } .ov-l { font-size: .62rem; padding-right: .2rem; }
}

/* ---------- Convert it, three ways / Spot the mistake ---------- */
.cv-bar { margin: 0 0 .6rem; color: var(--muted); font-size: .92rem; }
.cv-card, .sp-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: .9rem 1rem; display: grid; gap: .6rem; }
.cv-knowns { display: flex; flex-wrap: wrap; gap: .5rem; }
.cv-known { margin: 0; display: grid; gap: .1rem; background: var(--ink); color: var(--blush); border-radius: 12px; padding: .45rem .9rem; }
.cv-known.ok { background: #eef1e4; color: var(--olive-deep); border: 1px solid var(--olive); }
.cv-known span { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .85; }
.cv-known b { font-size: 1.25rem; }
.cv-ask { margin: .2rem 0; }
.cv-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 2.8rem)); gap: .3rem; }
.cv-pv { text-align: center; font-size: .75rem; color: var(--muted); font-family: "JetBrains Mono", monospace; }
.cv-bit { font: 700 1.15rem "JetBrains Mono", monospace; height: 2.5rem; border-radius: 8px; border: 2px solid var(--border); background: #fff; cursor: pointer; color: var(--muted); }
.cv-bit.on { background: var(--ink); color: var(--blush); border-color: var(--ink); }
.cv-bit.right { border-color: var(--olive); } .cv-bit.wrong { border-color: var(--rose-deep); box-shadow: 0 0 0 2px #f6d5cf; }
.cv-nibs { display: flex; gap: 1rem; flex-wrap: wrap; }
.cv-nib { background: var(--cream); border: 1px solid var(--border); border-radius: 12px; padding: .5rem .8rem; display: grid; justify-items: center; gap: .25rem; }
.cv-nib p { margin: 0; } .cv-841 { font-size: .72rem; color: var(--muted); font-family: "JetBrains Mono", monospace; letter-spacing: .2em; }
.cv-nb { font-size: 1.2rem; font-weight: 700; letter-spacing: .25em; }
.cv-hex { font-size: 1.05rem; font-weight: 700; min-width: 4.5rem; }
.cv-hex.right { border-color: var(--olive); } .cv-hex.wrong { border-color: var(--rose-deep); }
.cv-den { max-width: 10rem; font-size: 1.1rem; }
.sp-q { margin: 0; }
.sp-h { margin: 0; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--olive-deep); }
.sp-lines { margin: 0; padding-left: 1.4rem; display: grid; gap: .35rem; }
.sp-line { font: inherit; text-align: left; width: 100%; padding: .5rem .7rem; border-radius: 10px; border: 2px solid var(--border); background: var(--cream); cursor: pointer; color: var(--ink); }
.sp-line:hover:not(:disabled) { border-color: var(--rose); }
.sp-line:disabled { cursor: default; }
.sp-line.found { border-color: var(--rose-deep); background: #f6d5cf; text-decoration: line-through; }
.sp-line.shake { animation: lk-shake .45s; }
@media (max-width: 560px) { .cv-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .2rem; } .cv-bit { font-size: 1rem; height: 2.2rem; } }
