/* "Course Light" design system — TWN AI-DevOps sample module.
   Light learning-platform look: indigo primary, teal progress/success,
   amber for the "explain it to your VP" callouts. Zero emoji; SVG glyphs. */

:root {
  --canvas: #f7f8fa;
  --surface: #ffffff;
  --inset: #eef0f4;
  --line: #e6e9ee;
  --line-2: #d5dae2;
  --ink: #111827;
  --body: #2f3947;
  --muted: #5b6472;
  --faint: #98a2b3;
  --indigo: #4338ca;
  --indigo-deep: #3730a3;
  --indigo-tint: #eef0fd;
  --indigo-line: #c7cdf4;
  --teal: #0f766e;
  --teal-tint: #e6f5f3;
  --teal-line: #a7d9d3;
  --amber: #b45309;
  --amber-ink: #92600a;
  --amber-tint: #fff8eb;
  --amber-line: #f2d9a4;
  --red: #b91c1c;
  --red-tint: #fdeeee;
  --code-bg: #0f172a;
  --code-ink: #d7dee9;
  --sh-1: 0 1px 2px rgba(17, 24, 39, .05);
  --sh-2: 0 1px 2px rgba(17, 24, 39, .05), 0 8px 24px rgba(17, 24, 39, .07);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--canvas); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
a { color: var(--indigo); text-decoration: none; }

/* ---------- topbar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 22px; height: 58px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 15px; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--indigo);
  display: grid; place-items: center; color: #fff;
}
.brand .mark svg { width: 17px; height: 17px; }
.brand small { color: var(--faint); font-weight: 550; font-size: 12px; margin-left: 2px; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sample-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600;
  color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 5px 12px;
  background: var(--surface); white-space: nowrap;
}
.sample-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.progress-pill {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650;
  color: var(--indigo-deep); background: var(--indigo-tint); border: 1px solid var(--indigo-line);
  border-radius: 999px; padding: 5px 12px; white-space: nowrap;
}

/* ---------- layout ---------- */
#view { min-height: calc(100vh - 58px - 64px); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 22px; }
.wrap-read { max-width: 780px; margin: 0 auto; padding: 0 22px; }
#pagefoot {
  border-top: 1px solid var(--line); background: var(--surface);
  font-size: 12px; color: var(--faint); text-align: center; padding: 22px;
}
#pagefoot b { color: var(--muted); }

/* ---------- type ---------- */
.kicker { font-size: 12px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; color: var(--indigo); margin-bottom: 10px; }
h1.hero-t { font-size: 40px; font-weight: 800; letter-spacing: -0.022em; line-height: 1.12; }
.hero-sub { font-size: 17px; color: var(--muted); line-height: 1.65; max-width: 640px; margin-top: 14px; }
h2.sec-t { font-size: 22px; font-weight: 750; letter-spacing: -0.015em; margin: 0 0 6px; }
.sec-sub { font-size: 14px; color: var(--muted); margin-bottom: 18px; }

/* lesson reading */
.lesson-body { font-size: 16.5px; line-height: 1.78; color: var(--body); }
.lesson-body h2 { font-size: 21px; font-weight: 750; color: var(--ink); letter-spacing: -0.01em; margin: 34px 0 12px; }
.lesson-body p { margin: 0 0 16px; }
.lesson-body ul { margin: 0 0 16px; padding-left: 2px; list-style: none; }
.lesson-body li { padding-left: 26px; position: relative; margin-bottom: 9px; }
.lesson-body li::before {
  content: ""; position: absolute; left: 4px; top: 11px;
  width: 7px; height: 7px; border-radius: 2px; background: var(--indigo); opacity: .55;
}
.lesson-body b, .lesson-body strong { color: var(--ink); }
.lesson-body code { background: var(--inset); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 14px; }

/* code blocks */
.codeblock {
  background: var(--code-bg); color: var(--code-ink); border-radius: 12px;
  padding: 16px 18px; margin: 6px 0 18px; overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.6; white-space: pre;
}
.codeblock .c { color: #7d8aa0; }     /* comment */
.codeblock .k { color: #93c5fd; }     /* key/keyword */
.codeblock .s { color: #86efac; }     /* string */
.codeblock .hl { color: #fcd34d; }    /* highlight */
.code-label {
  display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 14px 0 6px;
}

/* VP callout — the module's signature element */
.vp-callout {
  background: var(--amber-tint); border: 1px solid var(--amber-line);
  border-left: 4px solid var(--amber); border-radius: 12px;
  padding: 16px 18px; margin: 26px 0;
}
.vp-callout .vt {
  display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 750;
  letter-spacing: .08em; text-transform: uppercase; color: var(--amber); margin-bottom: 8px;
}
.vp-callout .vb { font-size: 15px; line-height: 1.65; color: var(--amber-ink); font-style: italic; }

/* generic note */
.note {
  background: var(--indigo-tint); border: 1px solid var(--indigo-line); border-radius: 12px;
  padding: 14px 16px; margin: 0 0 18px; font-size: 14.5px; line-height: 1.6; color: var(--indigo-deep);
}

/* diagrams */
.diagram { border: 1px solid var(--line); border-radius: 14px; background: #fcfcfd; padding: 16px; margin: 6px 0 8px; }
.diagram svg { display: block; width: 100%; height: auto; }
.diagram svg text { font-family: ui-sans-serif, system-ui, sans-serif; }
.dia-cap { font-size: 13px; color: var(--muted); margin: 8px 2px 20px; line-height: 1.55; }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-1); }
.card.pad { padding: 20px; }

.mod-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.mod-card { position: relative; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-height: 150px; }
.mod-card .mnum { font-size: 11px; font-weight: 750; letter-spacing: .1em; color: var(--faint); }
.mod-card .mtitle { font-size: 14.5px; font-weight: 700; line-height: 1.35; }
.mod-card .mdesc { font-size: 12.5px; color: var(--muted); line-height: 1.5; flex: 1; }
.mod-card .mfoot { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650; color: var(--faint); }
.mod-card.sample { border: 2px solid var(--indigo); box-shadow: var(--sh-2); cursor: pointer; }
.mod-card.sample .mfoot { color: var(--indigo); }
.mod-card.locked { opacity: .74; }
.sample-flag {
  position: absolute; top: -11px; right: 12px; background: var(--indigo); color: #fff;
  font-size: 10.5px; font-weight: 750; letter-spacing: .07em; border-radius: 999px; padding: 3px 10px;
}

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* lesson list on home */
.lesson-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  border-top: 1px solid var(--line); cursor: pointer; transition: background .12s;
}
.lesson-row:first-child { border-top: 0; }
.lesson-row:hover { background: #fafbfd; }
.lesson-row .lnum {
  flex: 0 0 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--inset); color: var(--muted); font-size: 13px; font-weight: 700;
}
.lesson-row.done .lnum { background: var(--teal-tint); color: var(--teal); border: 1px solid var(--teal-line); }
.lesson-row .lt { font-size: 15px; font-weight: 650; }
.lesson-row .ld { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.lesson-row .lmeta { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--faint); white-space: nowrap; }

/* instructor */
.instructor { display: flex; gap: 18px; align-items: flex-start; }
.instructor .avatar {
  flex: 0 0 56px; height: 56px; border-radius: 50%; background: var(--indigo);
  color: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 750;
}
.receipts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.receipt {
  font-size: 12px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 11px; background: var(--surface);
}
.receipt b { color: var(--ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 650; border-radius: 10px; padding: 9px 16px;
  transition: all .12s;
}
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn.primary:hover { background: var(--indigo-deep); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- lesson page chrome ---------- */
.lesson-top { border-bottom: 1px solid var(--line); background: var(--surface); }
.lesson-top-in { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.crumb { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.crumb b { color: var(--ink); }
.stepper { margin-left: auto; display: flex; align-items: center; gap: 5px; }
.step-dot { width: 26px; height: 5px; border-radius: 3px; background: var(--inset); }
.step-dot.on { background: var(--indigo); }
.step-dot.done { background: var(--teal); }
.lesson-head { padding: 38px 0 8px; }
.lesson-head .lh-kicker { font-size: 12px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--indigo); margin-bottom: 8px; }
.lesson-head h1 { font-size: 31px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.lesson-head .lh-meta { display: flex; gap: 14px; margin-top: 12px; font-size: 13px; color: var(--faint); align-items: center; }
.lesson-nav {
  display: flex; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 0 56px;
}

/* ---------- LAB ---------- */
.lab-stage { max-width: 860px; margin: 0 auto; padding: 0 22px; }
.alert-card {
  background: var(--red-tint); border: 1px solid #f0b9b9; border-radius: 12px;
  padding: 14px 16px; margin: 0 0 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--red);
}
.alert-card .at { display: flex; align-items: center; gap: 8px; font-weight: 750; margin-bottom: 6px; font-family: inherit; }
.logpane {
  background: var(--code-bg); color: var(--code-ink); border-radius: 12px; padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.65;
  overflow-x: auto; white-space: pre; margin: 0 0 14px;
}
.logpane .dim { color: #64748b; } .logpane .err { color: #fca5a5; } .logpane .warn { color: #fcd34d; }

.chat { display: flex; flex-direction: column; gap: 12px; margin: 18px 0; }
.msg { display: flex; gap: 10px; max-width: 92%; }
.msg .who {
  flex: 0 0 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; margin-top: 2px;
}
.msg.ai .who { background: var(--indigo-tint); color: var(--indigo); border: 1px solid var(--indigo-line); }
.msg.you { align-self: flex-end; flex-direction: row-reverse; }
.msg.you .who { background: var(--inset); color: var(--muted); }
.msg .bubble {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 15px; font-size: 14px; line-height: 1.62; color: var(--body); box-shadow: var(--sh-1);
}
.msg.you .bubble { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.msg .bubble b { color: var(--ink); }
.msg.you .bubble b { color: #fff; }
.msg .bubble .cite {
  display: inline-block; font-size: 11px; font-weight: 700; color: var(--indigo-deep);
  background: var(--indigo-tint); border: 1px solid var(--indigo-line);
  border-radius: 5px; padding: 0 6px; margin: 0 2px; white-space: nowrap;
}
.msg .bubble ul { margin: 8px 0 2px; padding-left: 18px; }
.msg .bubble li { margin-bottom: 5px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.decision {
  border: 2px solid var(--indigo); border-radius: 14px; background: var(--surface);
  padding: 16px 18px; margin: 18px 0; box-shadow: var(--sh-2);
}
.decision .dt { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--indigo); margin-bottom: 10px; }
.decision .dq { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.choice {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left;
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px;
  padding: 11px 14px; margin-bottom: 8px; font-size: 14px; line-height: 1.5; color: var(--body);
  transition: all .12s;
}
.choice:hover { border-color: var(--indigo); background: var(--indigo-tint); }
.choice .ck { flex: 0 0 22px; height: 22px; border-radius: 6px; background: var(--inset); color: var(--muted); display: grid; place-items: center; font-size: 12px; font-weight: 700; }

.debrief { border: 1px solid var(--teal-line); background: var(--teal-tint); border-radius: 14px; padding: 20px; margin: 22px 0; }
.debrief h3 { display: flex; align-items: center; gap: 8px; color: var(--teal); font-size: 16px; margin-bottom: 12px; }
.debrief .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0; }
.debrief .dcol { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; }
.debrief .dcol h4 { font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.debrief .dcol ul { list-style: none; }
.debrief .dcol li { font-size: 13px; line-height: 1.55; padding-left: 20px; position: relative; margin-bottom: 6px; color: var(--body); }
.debrief .dcol li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.timebar { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 13px; }
.timebar .tb-label { flex: 0 0 150px; color: var(--muted); font-weight: 600; }
.timebar .tb-track { flex: 1; height: 12px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.timebar .tb-fill { height: 100%; border-radius: 6px; }
.timebar .tb-min { flex: 0 0 62px; text-align: right; font-weight: 700; }

.lab-controls { display: flex; gap: 10px; align-items: center; margin: 14px 0 40px; }

/* ---------- QUIZ ---------- */
.quiz-card { padding: 22px; margin-bottom: 14px; }
.quiz-card .qn { font-size: 12px; font-weight: 750; letter-spacing: .08em; color: var(--faint); margin-bottom: 8px; }
.quiz-card .qq { font-size: 16px; font-weight: 700; margin-bottom: 14px; line-height: 1.5; }
.opt {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left;
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px;
  padding: 11px 14px; margin-bottom: 8px; font-size: 14px; line-height: 1.5;
}
.opt:hover { border-color: var(--indigo); }
.opt.correct { border-color: var(--teal); background: var(--teal-tint); }
.opt.wrong { border-color: #ef9a9a; background: var(--red-tint); }
.opt:disabled { cursor: default; opacity: 1; }
.explain { font-size: 13.5px; line-height: 1.6; color: var(--muted); background: var(--inset); border-radius: 9px; padding: 11px 13px; margin-top: 6px; }
.score-panel { text-align: center; padding: 40px 22px; }
.score-ring { font-size: 46px; font-weight: 800; letter-spacing: -0.02em; }
.score-ring.pass { color: var(--teal); } .score-ring.fail { color: var(--amber); }

/* progress ring (home) */
.ring { position: relative; width: 74px; height: 74px; }
.ring svg { transform: rotate(-90deg); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; font-weight: 750; }

/* hero band */
.hero { background: var(--surface); border-bottom: 1px solid var(--line); padding: 52px 0 44px; }
.hero-flag {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700;
  color: var(--indigo-deep); background: var(--indigo-tint); border: 1px solid var(--indigo-line);
  border-radius: 999px; padding: 5px 13px; margin-bottom: 18px;
}
.hero-ctas { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.section { padding: 40px 0; }
.anatomy { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.ana-step { padding: 13px 14px; }
.ana-step .ai { color: var(--indigo); margin-bottom: 8px; }
.ana-step .at2 { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.ana-step .ad { font-size: 11.5px; color: var(--muted); line-height: 1.45; }

/* toast */
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; }
.toast {
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600;
  border-radius: 10px; padding: 10px 18px; box-shadow: var(--sh-2); margin-top: 8px;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .mod-grid { grid-template-columns: repeat(2, 1fr); }
  .anatomy { grid-template-columns: repeat(3, 1fr); }
  .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  h1.hero-t { font-size: 30px; }
  .hero { padding: 36px 0 32px; }
  .wrap, .wrap-read, .lab-stage { padding: 0 16px; }
  #topbar { padding: 0 14px; gap: 8px; }
  .sample-chip .hide-m { display: none; }
  .mod-grid { grid-template-columns: 1fr; }
  .anatomy { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .debrief .cols { grid-template-columns: 1fr; }
  .lesson-head h1 { font-size: 25px; }
  .stepper { display: none; }
  .msg { max-width: 100%; }
  .timebar .tb-label { flex-basis: 104px; font-size: 12px; }
  html, body { overflow-x: hidden; }
}
