/* Giao diện LMS. Chỉ dùng biến ở tokens.css, không viết mã màu trực tiếp. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-text); font-size: 15px; line-height: 1.6;
  overflow-wrap: break-word;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ink); text-decoration-color: var(--faint); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
img, svg { max-width: 100%; }
code { font-family: var(--font-mono); font-size: .92em; background: var(--box); padding: 1px 5px; border-radius: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); }

.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--panel); padding: 8px 12px; border: 1px solid var(--line); border-radius: 4px; }
.skip:focus { top: 8px; }

/* ---------- khung chung ---------- */
.topbar {
  background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 10px 18px;
}
.brandlink { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brandlink .dot { width: 12px; height: 12px; border-radius: 3px; background: var(--accent); flex: none; }
.brandlink small { font-family: var(--font-mono); font-weight: 400; font-size: 10.5px; color: var(--faint); letter-spacing: .08em; text-transform: uppercase; }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 6px 10px; border-radius: 4px; text-decoration: none; font-size: 13.5px; }
.topnav a:hover { background: var(--box); }
.topnav a[aria-current="page"] { background: var(--box-2); font-weight: 600; }
.topbar .grow { flex: 1 1 auto; }
.who { font-size: 12.5px; color: var(--muted); }
.themebtn { border: 1px solid var(--line); background: transparent; border-radius: 4px; padding: 5px 11px; font-size: 12.5px; min-height: 32px; }
.themebtn:hover { background: var(--box); }

#view:focus { outline: none; }
.foot { padding: 22px 18px 34px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: baseline; }
.demo-tools summary { cursor: pointer; font-size: 11.5px; }
.demo-tools .row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tiny { border: 1px solid var(--line); background: transparent; border-radius: 4px; padding: 3px 9px; font-size: 11.5px; color: var(--muted); }
.tiny:hover { background: var(--box); }
.tiny.warn { border-color: var(--danger); color: var(--danger); }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 6px; font-size: 13.5px; box-shadow: var(--shadow);
  max-width: calc(100vw - 32px);
}

/* ---------- thành phần dùng chung ---------- */
.page { max-width: 1040px; margin: 0 auto; padding: 26px 18px 60px; display: flex; flex-direction: column; gap: 22px; }
.crumb { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); letter-spacing: .04em; }
.crumb a { color: var(--muted); }
.kicker { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.h1 { font-size: clamp(24px, 4.4vw, 34px); font-weight: 700; letter-spacing: -.02em; line-height: 1.2; text-wrap: balance; }
.h2 { font-size: 17px; font-weight: 600; letter-spacing: -.005em; }
.lead { color: var(--muted); max-width: 64ch; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.card.soft { background: var(--box); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row .grow { flex: 1 1 auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel); font-size: 14px; font-weight: 500; text-decoration: none; color: var(--ink);
}
.btn:hover { background: var(--box); }
.btn.primary { background: var(--accent); border-color: var(--accent-edge); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(.96); background: var(--accent); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn.small { min-height: 32px; padding: 4px 11px; font-size: 12.5px; }

.chip { font-family: var(--font-mono); font-size: 10.5px; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); background: var(--panel); white-space: nowrap; }
.chip.on { background: var(--accent-soft); border-color: var(--accent-edge); color: var(--ink); }

.kind { display: inline-block; font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .07em; text-transform: uppercase; padding: 3px 8px; border-radius: 3px; text-align: center; white-space: nowrap; }
.kind.prompt { background: var(--prompt-soft); color: var(--prompt); }
.kind.skill { background: var(--skill-soft); color: var(--skill); }
.kind.tai_lieu { background: var(--doc-soft); color: var(--doc); }

.bar { height: 6px; border-radius: 99px; background: var(--box-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s; }

.notice { border: 1px solid var(--line); border-left-width: 4px; border-radius: 6px; padding: 11px 14px; background: var(--panel); font-size: 14px; }
.notice.err { border-color: var(--danger); background: var(--danger-soft); }
.notice.warn { border-color: var(--warn); background: var(--warn-soft); }
.notice.ok { border-color: var(--accent-edge); background: var(--accent-soft); }
.notice b { font-weight: 600; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }

.dot-st { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--faint); flex: none; display: inline-grid; place-items: center; font-size: 10px; line-height: 1; color: var(--on-accent); }
.dot-st.dang { border-color: var(--accent-edge); background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); }
.dot-st.xong { background: var(--accent); border-color: var(--accent-edge); }

/* ---------- bản đồ khoá ---------- */
.hero { display: flex; flex-direction: column; gap: 14px; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 8px; }
.phases { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; min-width: 0; }
.pcard.open { border-color: var(--accent-edge); box-shadow: var(--shadow); grid-column: 1 / -1; }
.pcard-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 8px; }
.pcard.open .pcard-head { cursor: default; }
.pcard-head .t { flex: 1 1 auto; min-width: 0; }
.pcard-head .t b { display: block; font-size: 16px; font-weight: 600; }
.pcard-head .caret { font-size: 11px; color: var(--faint); transition: transform .15s; }
.pcard-head[aria-expanded="true"] .caret { transform: rotate(90deg); }
.pcard-body { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.pcard .badge { font-family: var(--font-mono); font-size: 10.5px; padding: 3px 9px; border-radius: 99px; background: var(--box-2); color: var(--muted); white-space: nowrap; }
.pcard.open .badge { background: var(--accent); color: var(--on-accent); font-weight: 500; }
.mini-lessons { display: grid; gap: 4px 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.mini-lessons a { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 5px; text-decoration: none; font-size: 14px; min-width: 0; }
.mini-lessons a:hover { background: var(--box); }
.mini-lessons .n { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); width: 30px; flex: none; }
.mini-lessons .l { min-width: 0; flex: 1 1 auto; }

/* ---------- trang phần ---------- */
.lesson-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.lrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); text-decoration: none; }
.lrow:last-child { border-bottom: 0; }
.lrow:hover { background: var(--box); }
.lrow .n { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.lrow .t b { font-weight: 600; display: block; }
.lrow .t span { color: var(--muted); font-size: 13.5px; }
.lrow .tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) { .lrow { grid-template-columns: 38px minmax(0, 1fr); } .lrow .tags { grid-column: 2; justify-content: flex-start; } }

/* ---------- màn học ---------- */
.shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
@media (max-width: 880px) { .shell { grid-template-columns: minmax(0, 1fr); } }
.side {
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 20px 14px 24px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; max-height: 100vh; overflow-y: auto; align-self: start;
}
/* Màn hẹp: mục lục xuống cuối để vào bài là thấy slide ngay. */
@media (max-width: 880px) { .side { order: 2; position: static; max-height: none; border-right: 0; border-top: 1px solid var(--line); } }
.side .brand { display: flex; flex-direction: column; gap: 7px; }
.side .nm { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.side .prog-t { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.sect { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--bg); }
.sect + .sect { margin-top: 8px; }
.sect-btn { width: 100%; text-align: left; background: transparent; border: 0; padding: 11px 12px; display: flex; align-items: center; gap: 9px; }
.sect-btn:hover { background: var(--box); }
.sect-btn .caret { font-size: 10px; color: var(--faint); width: 10px; flex: none; transition: transform .15s; }
.sect-btn[aria-expanded="true"] .caret { transform: rotate(90deg); }
.sect-btn .t { flex: 1 1 auto; min-width: 0; }
.sect-btn .t b { display: block; font-size: 13.5px; font-weight: 600; }
.sect-btn .t span { display: block; font-family: var(--font-mono); font-size: 10px; color: var(--faint); letter-spacing: .08em; text-transform: uppercase; }
.sect-btn .cnt { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); flex: none; }
.lessons { border-top: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 2px; background: var(--panel); }
.les { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 4px; text-decoration: none; min-width: 0; }
.les:hover { background: var(--box); }
.les[aria-current="page"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent-edge); font-weight: 600; }
.les .n { font-family: var(--font-mono); font-size: 11px; color: var(--muted); width: 28px; flex: none; }
.les .l { flex: 1 1 auto; min-width: 0; font-size: 13.5px; }
.soon { padding: 10px 12px; color: var(--muted); font-size: 13px; }
.side-links { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 14px; }
.side-links a, .side-links span { display: block; padding: 7px 9px; border-radius: 4px; text-decoration: none; font-size: 13.5px; }
.side-links a:hover { background: var(--box); }
.side-links span { color: var(--faint); }

.main { padding: 22px 22px 60px; display: flex; flex-direction: column; gap: 22px; max-width: 920px; min-width: 0; }
@media (max-width: 480px) { .main { padding-inline: 14px; } }

.steps { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.steps .hd { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; align-items: baseline; }
.steps .hd b { font-size: 13.5px; }
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 640px) { .flow { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.step { display: flex; flex-direction: column; gap: 6px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); min-width: 0; position: relative; }
.step .lamp { width: 10px; height: 10px; border-radius: 50%; background: var(--box-2); border: 1px solid var(--line); }
.step .k { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.step .v { font-size: 13px; font-weight: 500; color: var(--muted); }
.step.now { background: var(--accent-soft); border-color: var(--accent-edge); }
.step.now .lamp { background: var(--accent); border-color: var(--accent-edge); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 10px var(--accent); }
.step.now .v { color: var(--ink); font-weight: 600; }
.step.now .k { color: var(--ink); }

.les-hd { display: flex; flex-direction: column; gap: 8px; }
.les-hd .meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }

.media { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 11px 16px; font-size: 13.5px; font-weight: 500; color: var(--muted); border-bottom: 3px solid transparent; min-height: 42px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.stage { aspect-ratio: 16 / 9; background: var(--stage-bg); color: var(--stage-ink); display: grid; place-content: center; gap: 8px; text-align: center; padding: 18px; }
.stage .big { font-family: var(--font-mono); font-size: 13px; color: var(--stage-muted); }
.stage .cap { font-size: 14px; max-width: 46ch; }
.stage .play { width: 54px; height: 54px; border-radius: 50%; border: 2px solid var(--stage-line); display: grid; place-items: center; margin: 0 auto 4px; font-size: 18px; color: var(--stage-muted); }
.stage iframe { width: 100%; height: 100%; border: 0; }
.media .ctrl { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }

.content { display: flex; flex-direction: column; gap: 12px; }
.md { display: flex; flex-direction: column; gap: 10px; max-width: 70ch; }
.md p { margin: 0; }
.md h2, .md h3, .md h4 { margin: 8px 0 0; font-size: 16px; }
.md ul, .md ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.md pre { margin: 0; padding: 12px; background: var(--box); border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; white-space: pre-wrap; font-family: var(--font-mono); font-size: 12.5px; }
.md blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.draft-note { font-size: 12.5px; color: var(--faint); border-top: 1px dashed var(--line); padding-top: 8px; }

.dtable { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--panel); }
.dwrap { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.dtable th { text-align: left; font-family: var(--font-mono); font-weight: 500; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); background: var(--box); padding: 8px 12px; }
.dtable td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
@media (max-width: 640px) {
  .dtable thead { display: none; }
  .dtable, .dtable tbody, .dtable tr, .dtable td { display: block; width: 100%; }
  .dtable tr { border-top: 1px solid var(--line); padding: 8px 0; }
  .dtable tr:first-child { border-top: 0; }
  .dtable td { border: 0; padding: 3px 12px; }
  .dtable td::before { content: attr(data-label) ": "; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
}
.numlist { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 5px; }
.note { font-size: 13px; color: var(--muted); }

.res-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.rcard { text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rcard:hover { border-color: var(--faint); }
.rcard[aria-expanded="true"] { border-color: var(--accent-edge); background: var(--accent-soft); box-shadow: inset 0 -3px 0 var(--accent); }
.rcard .t { font-size: 14px; font-weight: 600; }
.rcard .d { font-size: 13px; color: var(--muted); }
.rcard .code { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.rdetail { border: 1px solid var(--accent-edge); border-radius: 8px; background: var(--panel); padding: 18px; display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 14px; }
.rdetail .hd { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.rdetail h3 { font-size: 17px; font-weight: 600; }
.dsec { display: flex; flex-direction: column; gap: 4px; }
.dsec .k { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.dsec .k b { color: var(--ink); font-weight: 500; margin-right: 6px; }
.dsec.attach { gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.attach-title { font-size: 15px; font-weight: 600; margin: 0; }
.dsec.attach > p { margin: 0; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.attach-view { max-height: 420px; overflow: auto; }
.codebox { background: var(--box); border: 1px solid var(--line); border-radius: 6px; padding: 12px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }

.formrow { display: flex; flex-direction: column; gap: 6px; }
.formrow label, .lbl { font-weight: 600; font-size: 13.5px; }
.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 6px; padding: 9px 11px; min-height: 40px; }
textarea.input { min-height: 84px; resize: vertical; }
.input:focus-visible { outline-offset: 0; }
.fileline { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-size: 13px; min-width: 0; }
.fileline .nm { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.fileline .sz { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.quickbox { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.quickbox .prompt-q { background: var(--box); border-radius: 6px; padding: 10px 12px; font-size: 14px; }
.unlockbox { border: 1px solid var(--accent-edge); background: var(--accent-soft); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding-top: 6px; border-top: 1px solid var(--line); }
.actions .grp { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- kho ---------- */
.kho-bar { position: sticky; top: 0; z-index: 9; background: var(--panel); border-bottom: 1px solid var(--line); padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.kho-bar .top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.search { position: relative; max-width: 460px; width: 100%; }
.search input { width: 100%; min-height: 42px; padding: 0 12px 0 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.search span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.filters { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: flex-end; }
.fg { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fg > .lbl { font-family: var(--font-mono); font-weight: 400; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip { border: 1px solid var(--line); background: var(--bg); border-radius: 99px; padding: 5px 12px; font-size: 13px; min-height: 32px; }
.fchip:hover { background: var(--box); }
.fchip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.fchip[aria-pressed="true"].prompt { background: var(--prompt); border-color: var(--prompt); color: var(--panel); }
.fchip[aria-pressed="true"].skill { background: var(--skill); border-color: var(--skill); color: var(--panel); }
.fchip[aria-pressed="true"].tai_lieu { background: var(--doc); border-color: var(--doc); color: var(--panel); }
.sel { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.kho-wrap { padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; max-width: 1280px; margin: 0 auto; }
@media (max-width: 940px) { .kho-wrap { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .kho-wrap, .kho-bar { padding-inline: 14px; } }
.kho-count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-bottom: 9px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; min-height: 24px; }
.linkbtn { border: 0; background: transparent; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-size: 12.5px; }
.klist { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.krow { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; width: 100%; }
.krow:last-child { border-bottom: 0; }
.krow:hover { background: var(--box); }
.krow[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent-edge); }
.krow .mid { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.krow .nm { font-size: 14.5px; font-weight: 600; }
.krow .ds { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; justify-content: flex-end; }
.tag { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; white-space: nowrap; }
@media (max-width: 640px) {
  .krow { grid-template-columns: 76px minmax(0, 1fr); }
  .krow .tags { grid-column: 1 / -1; justify-content: flex-start; }
  .krow .ds { white-space: normal; }
}
.empty { padding: 36px 18px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.empty b { color: var(--ink); font-size: 15px; }
.kdetail { position: sticky; top: 168px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 18px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 190px); overflow-y: auto; }
@media (max-width: 940px) { .kdetail { position: static; max-height: none; } }
.kdetail h2 { font-size: 17px; font-weight: 600; }
.kdetail .hd { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ---------- nộp bài ---------- */
.two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 820px) { .two { grid-template-columns: minmax(0, 1fr); } }
.drop { border: 2px dashed var(--faint); border-radius: 8px; background: var(--bg); padding: 22px 14px; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; width: 100%; }
.drop:hover, .drop.over { border-color: var(--accent-edge); background: var(--accent-soft); }
.drop b { font-size: 14.5px; }
.drop span { color: var(--muted); font-size: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent-edge); flex: none; }
.check label { font-size: 14px; cursor: pointer; flex: 1 1 auto; }
.check:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-edge); }
.hist { display: flex; flex-direction: column; gap: 8px; }
.hist li { list-style: none; border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; background: var(--bg); font-size: 13.5px; }
.hist { margin: 0; padding: 0; }
.hist .cur { border-color: var(--accent-edge); background: var(--accent-soft); }
.slots { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 8px; }
.slot { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: var(--bg); }
.slot input { accent-color: var(--accent-edge); width: 18px; height: 18px; flex: none; }
.slot label { flex: 1 1 auto; font-size: 13.5px; cursor: pointer; }
.slot:has(input:checked) { border-color: var(--accent-edge); background: var(--accent-soft); }
.slot:has(input:disabled) { opacity: .55; }
.slot:has(input:disabled) label { cursor: not-allowed; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.fact { display: flex; flex-direction: column; }
.fact b { font-size: 18px; font-weight: 600; }
.fact span { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

.notfound { max-width: 560px; margin: 0 auto; padding: 64px 18px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.loading { padding: 40px 18px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- phần đang khoá (đợt 1: khoá nội dung theo phần) ---------- */
.locked-row { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 5px; font-size: 14px; min-width: 0; color: var(--muted); cursor: default; }
.locked-row .n { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); width: 30px; flex: none; }
.locked-row .l { min-width: 0; flex: 1 1 auto; }
.lrow.locked-row { display: grid; padding: 13px 16px; border-radius: 0; }
.lrow.locked-row:hover { background: transparent; }
.pre { white-space: pre-wrap; margin: 4px 0 0; }

/* ---------- slide markdown (tab Slide) + ô copy bản chữ ---------- */
.stage.deck { display: block; place-content: initial; text-align: left; padding: 0; container-type: inline-size; overflow: hidden; }
.stage.deck:focus-visible { outline-offset: -3px; }
.stage.deck:fullscreen { display: grid; place-items: center; }
.slide { height: 100%; box-sizing: border-box; padding: 4.5cqw 6.5cqw; display: flex; flex-direction: column; justify-content: center; overflow: auto; font-size: clamp(11px, 2.05cqw, 24px); line-height: 1.5; }
.slide .md > * { margin: 0 0 .7em; max-width: 52ch; }
.slide .md h3 { font-size: 1.9em; line-height: 1.2; color: var(--stage-ink); font-weight: 700; margin-bottom: .55em; padding-left: .6em; border-left: .22em solid var(--accent); }
.slide .md p, .slide .md li { color: var(--stage-ink); }
.slide .md strong { color: var(--stage-ink); font-weight: 700; }
.slide .md ul, .slide .md ol { padding-left: 1.3em; }
.slide .md li { margin: .22em 0; }
.slide .md li::marker { color: var(--accent); }
.slide .md p:has(+ ul), .slide .md p:last-child { color: var(--stage-muted); }
.slide-n { min-width: 4.5em; text-align: center; color: var(--ink); }
/* Slide lưới thẻ: mọi cỡ theo cqw để khung 16:9 nào cũng vừa. */
.cards-slide { justify-content: center; padding: 3.6cqw 4.2cqw; font-size: 1.5cqw; background-color: var(--stage-bg);
  background-image: radial-gradient(ellipse at 85% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%),
    linear-gradient(color-mix(in srgb, var(--stage-line) 45%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--stage-line) 45%, transparent) 1px, transparent 1px);
  background-size: auto, 6cqw 6cqw, 6cqw 6cqw; }
.cs-kick { display: flex; align-items: center; gap: .9em; font-family: var(--font-mono); font-size: 1.25cqw; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.cs-badge { background: var(--accent); color: var(--on-accent); font-weight: 600; letter-spacing: .04em; padding: .2em .55em; border-radius: .35em; }
.cs-title { margin: .45em 0 0; font-size: 3.7cqw; line-height: 1.12; font-weight: 800; letter-spacing: -.01em; color: var(--stage-ink); }
.cs-lead { margin: .9em 0 0; font-size: 1.45cqw; line-height: 1.5; color: var(--stage-muted); max-width: 70ch; }
.cs-grid { list-style: none; margin: 2.2cqw 0 0; padding: 0; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 1.3cqw; }
.cs-card { display: flex; flex-direction: column; gap: .45em; padding: 1.5cqw 1.6cqw 1.7cqw; border: 1px solid color-mix(in srgb, var(--stage-ink) 13%, transparent); border-radius: .9cqw;
  background: color-mix(in srgb, var(--stage-ink) 5%, var(--stage-bg)); }
.cs-n { font-family: var(--font-mono); font-size: 1.3cqw; color: var(--accent); }
.cs-top { display: flex; align-items: center; justify-content: space-between; gap: .6em; }
.cs-vai { font-family: var(--font-mono); font-size: 1.12cqw; letter-spacing: .04em; padding: .22em .65em; border-radius: 99em; white-space: nowrap; border: 1px solid; }
.cs-card.vai-nguoi { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 9%, var(--stage-bg)); }
.cs-card.vai-nguoi .cs-vai { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.cs-card.vai-ai .cs-vai { color: var(--stage-ink); border-color: color-mix(in srgb, var(--stage-ink) 35%, transparent); }
.cs-card.vai-ca-hai .cs-vai { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 60%, transparent); border-style: dashed; }
.cs-t { font-size: 1.75cqw; line-height: 1.25; font-weight: 700; color: var(--stage-ink); }
.cs-d { font-size: 1.32cqw; line-height: 1.45; color: var(--stage-muted); }
.media .ctrl .tiny:disabled { opacity: .45; cursor: default; }
.media .ctrl .grow { flex: 1; }

.mdbox { display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.mdbox > .row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.mdbox .grp { display: flex; flex-wrap: wrap; gap: 8px; }
.mdsrc { margin: 0; max-height: 280px; overflow: auto; background: var(--box); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
@media (max-width: 480px) { .mdbox .grp, .mdbox .grp .btn { width: 100%; } }
/* Màn hẹp: khung 16:9 quá thấp cho chữ đọc được, nên cho slide cao theo nội dung (tối thiểu 16:9). */
@media (max-width: 640px) {
  .stage.deck { aspect-ratio: auto; }
  .slide { height: auto; min-height: max(56.25cqw, 340px); font-size: 14px; padding: 18px 18px 20px; justify-content: flex-start; }
  .slide .md h3 { font-size: 1.45em; }
  .cards-slide { padding: 20px 16px 22px; background-size: auto, 32px 32px, 32px 32px; }
  .cs-kick { font-size: 11px; }
  .cs-title { font-size: 23px; }
  .cs-lead { font-size: 14px; }
  .cs-grid { margin-top: 16px; gap: 8px; grid-template-columns: 1fr; }
  .cs-card { padding: 12px 14px; border-radius: 8px; gap: 4px; }
  .cs-n { font-size: 12px; }
  .cs-vai { font-size: 11px; }
  .cs-t { font-size: 15.5px; }
  .cs-d { font-size: 13.5px; }
}

/* Tab tài liệu/prompt/skill trong khung học liệu: chữ md đọc và copy tại chỗ, nút ở thanh dưới. */
.tabs { overflow-x: auto; scrollbar-width: thin; }
.tabs button { white-space: nowrap; flex: none; }
.stage.doc { aspect-ratio: auto; display: flex; flex-direction: column; gap: 8px; place-content: initial; text-align: left; background: var(--panel); color: var(--ink); padding: 16px; }
.stage.doc > .row { display: flex; align-items: center; gap: 8px; }
.stage.doc .code { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.stage.doc h3 { margin: 0; font-size: 16.5px; font-weight: 700; }
.stage.doc .note { margin: 0; }
.stage.doc .mdsrc { max-height: 460px; margin-top: 4px; }
.chip.link { cursor: pointer; font: inherit; font-family: var(--font-mono); font-size: 10.5px; }
.chip.link:hover { border-color: var(--accent-edge); color: var(--ink); }
.chip.link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.media { scroll-margin-top: 12px; }
/* Đầu bài: đường dẫn bên trái, nút học xong và bài kế bên phải. */
.les-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.les-top .crumb { margin: 0; }
.les-top .grp { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- slide sơ đồ động (khối so-do, js/diagram-slide.js) ---------- */
.dg-slide { justify-content: center; padding-top: 2.8cqw; padding-bottom: 2.6cqw; }
.dg-slide .cs-title { font-size: 3.2cqw; }
.dg-slide .cs-lead { margin-top: .5em; }
.dg-wrap { margin-top: 1.4cqw; }
.dg-svg { display: block; width: 100%; height: auto; max-height: 29cqw; margin: 0 auto; overflow: visible; font-family: var(--font-text); }
.dg-slide .t-xanh { --c: var(--accent); }
.dg-slide .t-cam { --c: var(--stage-amber); }
.dg-slide .t-teal { --c: var(--stage-teal); }
.dg-slide .t-xam { --c: var(--stage-muted); }
.dg-box { fill: color-mix(in srgb, var(--c) 7%, var(--stage-bg)); stroke: var(--c); stroke-width: 2; }
.k-chip .dg-box, .k-bang .dg-box, .k-tru .dg-box, .k-xo .dg-box { stroke: color-mix(in srgb, var(--c) 70%, transparent); }
.dg-fill { fill: var(--stage-ink); }
.dg-t { fill: var(--stage-ink); font-weight: 700; font-size: 22px; }
.dg-s { fill: var(--stage-muted); font-size: 17px; }
.dg-row { fill: var(--stage-muted); font-family: var(--font-mono); font-size: 14px; }
.dg-rule { stroke: color-mix(in srgb, var(--c) 45%, transparent); stroke-width: 1.5; }
.dg-strike { stroke: var(--danger); stroke-width: 3; stroke-linecap: round; }
.dg-ring { fill: none; stroke: var(--c); stroke-width: 2.5; stroke-dasharray: 9 7; stroke-linecap: round; animation: dg-ring-spin 9s linear infinite; }
@keyframes dg-ring-spin { to { stroke-dashoffset: -64; } }
.dg-node.gach > :not(.dg-strike) { opacity: .45; }
.dg-line { fill: none; stroke: color-mix(in srgb, var(--c) 75%, transparent); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; }
.dg-edge.dut .dg-line { stroke-dasharray: .012 .012; stroke-dashoffset: 0; }
.dg-dot { fill: var(--c); }
.dg-run { fill: var(--stage-amber); filter: drop-shadow(0 0 4px var(--stage-amber)); }
.dg-tag { fill: var(--stage-amber); }
.dg-tagt { fill: var(--stage-on-amber); font-family: var(--font-mono); font-size: 14px; font-weight: 600; }
.dg-cards { list-style: none; margin: 1.6cqw 0 0; padding: 0; display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 1.1cqw; }
.dg-card { --c: var(--accent); display: flex; flex-direction: column; gap: .3em; padding: 1.1cqw 1.3cqw; border-radius: .8cqw;
  border: 1px solid color-mix(in srgb, var(--stage-ink) 13%, transparent); background: color-mix(in srgb, var(--stage-ink) 5%, var(--stage-bg)); }
.dg-card.t-cam { --c: var(--stage-amber); } .dg-card.t-teal { --c: var(--stage-teal); } .dg-card.t-xam { --c: var(--stage-muted); }
.dg-ck { font-family: var(--font-mono); font-size: 1.15cqw; color: var(--c); }
.dg-cv { font-size: 1.45cqw; line-height: 1.35; color: var(--stage-ink); }

/* Cây thư mục kiểu Explorer: icon, mũi tên, thụt lề theo cấp, dòng đang mở tô sáng. */
.file-tree { list-style: none; margin: 1.3cqw 0 0; padding: .5cqw; border-radius: .8cqw; display: flex; flex-direction: column; gap: 1px;
  border: 1px solid color-mix(in srgb, var(--stage-ink) 13%, transparent); background: color-mix(in srgb, var(--stage-ink) 4%, var(--stage-bg)); }
.ft-row { display: flex; align-items: center; gap: .55em; padding: .32em .7em; padding-left: calc(.7em + var(--cap, 0) * 1.5em); border-radius: .4em;
  font-size: 1.1cqw; color: var(--stage-muted); animation: dg-in .4s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * .055s); }
.ft-row.hien { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--stage-ink); font-weight: 600; }
.ft-row.nhat { opacity: .5; font-style: italic; }
.ft-chevron { width: 1em; flex: none; text-align: center; font-size: .8em; color: var(--stage-muted); transition: transform .15s; }
.ft-chevron.mo { transform: rotate(90deg); }
.ft-chevron.rong { visibility: hidden; }
.ft-icon { flex: none; font-size: 1em; line-height: 1; }
.ft-ten { font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Chuyển động: khối hiện dần theo --d, đường tự vẽ ra, thẻ dưới trượt lên. */
@keyframes dg-in { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes dg-draw { to { stroke-dashoffset: 0; } }
@keyframes dg-fade { from { opacity: 0; } to { opacity: 1; } }
.dg-node { transform-box: fill-box; transform-origin: center; animation: dg-in .55s cubic-bezier(.2,.8,.2,1) both; animation-delay: var(--d); }
.dg-edge .dg-line { animation: dg-draw .7s ease-out forwards; animation-delay: calc(var(--d) + .15s); }
.dg-edge.dut .dg-line { animation: none; }
.dg-edge { animation: dg-fade .5s ease-out both; animation-delay: var(--d); }
.dg-edge .dg-tag, .dg-edge .dg-tagt { animation: dg-fade .4s ease-out both; animation-delay: calc(var(--d) + .55s); }
.dg-card { animation: dg-in .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: var(--d); }
@media (prefers-reduced-motion: reduce) {
  .dg-node, .dg-edge, .dg-card, .dg-edge .dg-tag, .dg-edge .dg-tagt, .dg-ring, .ft-row { animation: none !important; }
  .dg-edge .dg-line { animation: none !important; stroke-dashoffset: 0; }
  .dg-run { display: none; }
}
@media (max-width: 640px) {
  .dg-wrap { margin-top: 14px; overflow-x: auto; }
  .dg-svg { min-width: 560px; max-height: none; }
  .dg-cards { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
  .dg-card { padding: 10px 12px; border-radius: 8px; }
  .dg-ck { font-size: 11px; } .dg-cv { font-size: 13.5px; }
  .ft-row { font-size: 13.5px; padding: 8px 10px; padding-left: calc(10px + var(--cap, 0) * 16px); }
  .file-tree { margin-top: 14px; }
}

/* Nhóm "Bài tập" tách khỏi danh sách bài học (sidebar, bản đồ khoá) */
.les-sub { display: block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); padding: 10px 9px 4px; margin-top: 4px; border-top: 1px dashed var(--line); }
.pcard-body .les-sub { padding-left: 8px; }

/* Tab tài liệu, skill: nội dung đọc như văn bản (không phải khung code). Prompt vẫn dùng .mdsrc để chép. */
.stage.doc .doc-text { max-height: 520px; overflow: auto; margin-top: 4px; padding: 4px 2px 8px; border-top: 1px solid var(--line); }
.stage.doc .doc-text .md { max-width: 72ch; font-size: 15px; line-height: 1.65; padding-top: 10px; }
.stage.doc .doc-text .md h2 { font-size: 16px; margin-top: 12px; }
.stage.doc .doc-text .md h3 { font-size: 15px; }
.md .md-table { overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--box); font-weight: 600; }
/* Nội dung prompt và file đính kèm .md: hộp văn bản thường (không phải code), vẫn chép được. */
.textbox { background: var(--box); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.textbox .md { white-space: normal; max-width: 72ch; }

/* Slide thẻ: tiêu đề, đoạn dẫn và từng thẻ hiện dần (--i là thứ tự thẻ). */
.cards-slide .cs-kick, .cards-slide .cs-title, .cards-slide .cs-lead { animation: dg-in .5s cubic-bezier(.2,.8,.2,1) both; }
.cards-slide .cs-title { animation-delay: .08s; }
.cards-slide .cs-lead { animation-delay: .18s; }
.cs-card { animation: dg-in .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(.32s + var(--i, 0) * .14s); }

/* Slide bảng so sánh: dòng trượt vào lần lượt, cột 1 xanh (lựa chọn A), cột 2 cam (lựa chọn B). */
.tb-wrap { margin-top: 1.8cqw; border-radius: .9cqw; overflow: hidden; border: 1px solid color-mix(in srgb, var(--stage-ink) 13%, transparent); }
.tb { width: 100%; border-collapse: collapse; font-size: 1.42cqw; line-height: 1.35; }
.tb th, .tb td { text-align: left; padding: .75cqw 1.2cqw; vertical-align: top; border-top: 1px solid color-mix(in srgb, var(--stage-ink) 10%, transparent); }
.tb thead th { border-top: 0; font-family: var(--font-mono); font-size: 1.12cqw; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--stage-muted); background: color-mix(in srgb, var(--stage-ink) 6%, var(--stage-bg)); }
.tb thead th.c1 { color: var(--accent); } .tb thead th.c2 { color: var(--stage-amber); } .tb thead th.c3 { color: var(--stage-teal); }
.tb tbody th { color: var(--stage-ink); font-weight: 700; width: 26%; }
.tb tbody td { color: var(--stage-ink); }
.tb tbody td.c1 { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.tb tbody td.c2 { background: color-mix(in srgb, var(--stage-amber) 7%, transparent); }
.tb tbody tr { animation: tb-in .45s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(.35s + var(--i, 0) * .16s); }
.tb-foot { animation-delay: calc(.5s + var(--i, 0) * .16s) !important; }
@keyframes tb-in { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .cards-slide .cs-kick, .cards-slide .cs-title, .cards-slide .cs-lead, .cs-card, .tb tbody tr { animation: none !important; }
}
@media (max-width: 640px) {
  .tb-wrap { margin-top: 14px; border-radius: 8px; border: 0; overflow: visible; }
  .tb, .tb tbody, .tb tr, .tb th, .tb td { display: block; width: 100%; }
  .tb thead { display: none; }
  .tb { font-size: 14px; }
  .tb tbody tr { border: 1px solid color-mix(in srgb, var(--stage-ink) 13%, transparent); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
  .tb tbody th { width: 100%; padding: 9px 12px 4px; border-top: 0; }
  .tb tbody td { padding: 6px 12px; border-top: 0; }
  .tb tbody td::before { content: attr(data-label) ": "; font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--stage-muted); }
  .tb tbody td.c1::before { color: var(--accent); } .tb tbody td.c2::before { color: var(--stage-amber); }
}
.stage.doc .doc-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }

/* Slide game hỏi đáp (khối hoi-dap): câu hỏi, 4 lựa chọn, đúng xanh, sai cam, giải thích, màn kết quả. */
.qz-slide { justify-content: flex-start; }
.qz-body { margin-top: 1.4cqw; display: flex; flex-direction: column; gap: 1.1cqw; }
.qz-top { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 1.2cqw; color: var(--stage-muted); }
.qz-score { color: var(--accent); }
.qz-bar { height: 4px; border-radius: 99px; background: color-mix(in srgb, var(--stage-ink) 12%, transparent); overflow: hidden; }
.qz-bar > i { display: block; height: 100%; background: var(--accent); transition: width .4s ease; }
.qz-q { margin: .4em 0 0; font-size: 2cqw; line-height: 1.3; font-weight: 700; color: var(--stage-ink); animation: dg-in .45s cubic-bezier(.2,.8,.2,1) both; }
.qz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: .9cqw; }
.qz-opt { display: flex; align-items: center; gap: .8em; text-align: left; padding: 1cqw 1.2cqw; border-radius: .8cqw; font-size: 1.5cqw; line-height: 1.35;
  color: var(--stage-ink); background: color-mix(in srgb, var(--stage-ink) 5%, var(--stage-bg)); border: 1px solid color-mix(in srgb, var(--stage-ink) 16%, transparent);
  animation: dg-in .45s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(.12s + var(--i, 0) * .08s); transition: border-color .15s, background .15s; }
.qz-opt:not(:disabled):hover { border-color: var(--accent); }
.qz-opt:disabled { cursor: default; opacity: .7; }
.qz-opt.dung { opacity: 1; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--stage-bg)); }
.qz-opt.sai { opacity: 1; border-color: var(--stage-amber); background: color-mix(in srgb, var(--stage-amber) 14%, var(--stage-bg)); }
.qz-k { flex: none; display: inline-grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 50%; font-family: var(--font-mono); font-size: .85em;
  border: 1px solid color-mix(in srgb, var(--stage-ink) 30%, transparent); color: var(--stage-muted); }
.qz-opt.dung .qz-k { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.qz-opt.sai .qz-k { background: var(--stage-amber); border-color: var(--stage-amber); color: var(--stage-on-amber); }
.qz-note { font-size: 1.4cqw; line-height: 1.45; color: var(--stage-ink); padding: .9cqw 1.2cqw; border-radius: .8cqw; border-left: 4px solid var(--stage-muted);
  background: color-mix(in srgb, var(--stage-ink) 6%, var(--stage-bg)); animation: dg-in .35s ease-out both; }
.qz-note.ok { border-left-color: var(--accent); } .qz-note.no { border-left-color: var(--stage-amber); }
.qz-act { display: flex; justify-content: flex-end; }
.qz-result { display: flex; align-items: center; gap: 2cqw; animation: dg-in .5s cubic-bezier(.2,.8,.2,1) both; color: var(--stage-ink); }
.qz-result p { margin: .3em 0 0; color: var(--stage-muted); font-size: 1.5cqw; }
.qz-result b { font-size: 2.2cqw; }
.qz-big { font-size: 6cqw; font-weight: 800; color: var(--accent); line-height: 1; }
.qz-review { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qz-k2 { font-family: var(--font-mono); font-size: 1.1cqw; letter-spacing: .08em; text-transform: uppercase; color: var(--stage-muted); }
@media (prefers-reduced-motion: reduce) { .qz-q, .qz-opt, .qz-note, .qz-result { animation: none !important; } }
@media (max-width: 640px) {
  .qz-body { gap: 10px; margin-top: 12px; }
  .qz-top { font-size: 12px; }
  .qz-q { font-size: 17px; }
  .qz-opts { grid-template-columns: 1fr; gap: 8px; }
  .qz-opt { font-size: 14.5px; padding: 10px 12px; border-radius: 8px; }
  .qz-note { font-size: 14px; padding: 10px 12px; border-radius: 8px; }
  .qz-result b { font-size: 18px; } .qz-result p { font-size: 14px; } .qz-big { font-size: 44px; } .qz-k2 { font-size: 11px; }
}
.qz-review .chip { background: transparent; color: var(--stage-ink); border-color: var(--accent); text-decoration: none; font-size: 12px; padding: 4px 11px; }
.qz-review .chip:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* Khối lệnh trong nội dung: nút Chép ở góc phải trên. */
.md .code-wrap { position: relative; }
.md .code-wrap pre { padding-right: 72px; }
.code-copy { position: absolute; top: 6px; right: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 5px; cursor: pointer;
  border: 1px solid var(--accent-edge); background: var(--accent); color: var(--on-accent); }
.code-copy:hover { filter: brightness(.95); }

/* Khối đặt meeting cuối bài tập (phần không cần nộp bài): tách khỏi nội dung bài bằng đường kẻ và khoảng trống. */
.checklist .ck-bar { display: flex; align-items: center; gap: 10px; }
.checklist .ck-bar > :first-child { flex: 1; }
.ck-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ck-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); }
.ck-list li:first-child { border-top: 0; }
.ck-list a { flex: 1; min-width: 0; color: var(--ink); text-decoration: none; }
.ck-list a:hover { text-decoration: underline; }
.ck-list a b { margin-right: 4px; }
.ck-dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.ck-list li.ok .ck-dot { background: var(--accent); border-color: var(--accent-edge); color: var(--on-accent); }
.ck-list li.ok a { color: var(--muted); }
.ck-st { flex: none; font-size: 13px; color: var(--muted); }
.ck-list li:not(.ok) .ck-st { color: var(--ink); font-weight: 600; }
