/* ================= Lectures (theory) ================= */
.lec-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.lec-card .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--dept-soft); color: var(--dept); }
.lec-card .txt { flex: 1; display: grid; gap: 4px; min-width: 0; }
.lec-card .txt b { font: 600 18px/1.2 var(--serif); }
.lec-card .pc { font-weight: 800; font-size: 13px; color: var(--dept); }
.bar.thin { height: 4px; margin-top: 4px; }
.tag.sm { font-size: 10.5px; padding: 2px 7px; vertical-align: middle; font-family: var(--sans); }

/* reader */
.lec-page { --lec-fs: 17.5px; }
@media (min-width: 900px) { main.lec-page { max-width: 1180px; } }
.lec-bar { position: sticky; top: 0; z-index: 8; display: flex; align-items: center; gap: 10px; margin: -20px -18px 0; padding: 10px 18px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.lec-bar .t { flex: 1; min-width: 0; display: grid; }
.lec-bar .t .eyebrow { font-size: 10px; }
.lec-bar .t b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lec-bar .aa { font: 700 15px var(--serif); }
.lec-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.lec-progress i { display: block; height: 100%; width: 0; background: var(--dept); transition: width .1s linear; }
@media (min-width: 900px) { .lec-bar { margin: -40px -48px 0; padding: 12px 48px; } .mobile-toc { display: none !important; } }

.lec-hero { padding: 28px 0 6px; }
.lec-hero .crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--dept); }
.lec-hero h1 { font-size: clamp(34px, 6vw, 48px); margin: 12px 0 10px; }
.lec-hero .sub { color: var(--muted); font-size: 16px; max-width: 640px; line-height: 1.5; }
.lec-hero .facts { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 16px; font-size: 13px; color: var(--muted); }
.lec-hero .facts span { display: inline-flex; align-items: center; gap: 6px; }
.lec-tabs { top: 61px; }
.lec-tabs .tab { white-space: nowrap; padding-left: 2px; padding-right: 2px; }
@media (max-width: 420px) { .lec-tabs .tab { font-size: 13px; } }

.lec-grid { display: block; }
.lec-toc { display: none; }
@media (min-width: 1100px) {
  .lec-grid { display: grid; grid-template-columns: minmax(0, 720px) 250px; gap: 56px; align-items: start; }
  .lec-toc { display: block; position: sticky; top: 130px; }
}
.lec-toc ol { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 2px; }
.lec-toc button { width: 100%; text-align: left; display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--muted); line-height: 1.35; }
.lec-toc button .n { flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.lec-toc button .n svg.i { width: 12px; height: 12px; }
.lec-toc button.on { background: var(--dept-soft); color: var(--text); }
.lec-toc button.on .n { background: var(--dept); color: #fff; }
.lec-toc button.done .n { background: var(--ok); color: #fff; }
.lec-toc .toc-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.lec-toc.in-sheet { display: block; }

/* reading typography */
#lpane { font-size: var(--lec-fs); line-height: 1.7; }
.lec-sec { padding: 26px 0 8px; scroll-margin-top: 120px; }
.lec-sec + .lec-sec { border-top: 1px solid var(--line); margin-top: 18px; }
.lec-sec .sec-n { font-size: 11.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--dept); }
.lec-sec h2 { font-size: 1.6em; margin: 6px 0 16px; line-height: 1.2; }
.lec-sec h4, .lb-list h4 { font: 700 .8em var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.lb-p { margin: 0 0 1em; }
#lpane mark { background: color-mix(in srgb, var(--dept) 16%, transparent); color: inherit; padding: 0 3px; border-radius: 3px; }
#lpane .listing li { font-size: .94em; }
.lb-list { margin: 0 0 1.2em; }

.lb { border-radius: 12px; padding: 14px 16px; margin: 0 0 1.2em; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-2); }
.lb p { margin: 6px 0 0; font-size: .95em; }
.lb-h { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.lb-h svg.i { width: 15px; height: 15px; }
.lb-key { background: var(--dept-soft); border-color: transparent; border-left-color: var(--dept); }
.lb-key .lb-h { color: var(--dept); }
.lb-pearl { border-left-color: var(--ok); } .lb-pearl .lb-h { color: var(--ok); }
.lb-exam { border-left-color: var(--warn); } .lb-exam .lb-h { color: var(--warn); }
.lb-warn { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 5%, var(--surface)); } .lb-warn .lb-h { color: var(--bad); }
.lb-obj { margin-top: 10px; } .lb-obj .lb-h { color: var(--dept); }
.lb-obj ul { margin: 8px 0 0; padding-left: 20px; font-size: .92em; }
.lb-obj li { margin: 3px 0; }

figure { margin: 0 0 1.4em; }
figure figcaption { font: 700 11.5px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.lb-table .table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: auto; background: var(--surface); }
.lb-table table.signs { font-size: .82em; }
.lb-table table.signs td { line-height: 1.5; }

.lb-flow ol { list-style: none; margin: 0; padding: 0; position: relative; }
.lb-flow li { position: relative; display: flex; gap: 14px; padding: 0 0 14px; }
.lb-flow li:not(:last-child)::before { content: ''; position: absolute; left: 14px; top: 30px; bottom: 2px; width: 2px; background: var(--line-2); }
.lb-flow .n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--dept); color: #fff; font-size: 13px; font-weight: 800; position: relative; z-index: 1; }
.lb-flow li.loop .n { background: var(--bad); }
.lb-flow li > div { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: grid; gap: 2px; }
.lb-flow li b { font-size: .95em; font-weight: 600; line-height: 1.4; }
.lb-flow li span { font-size: .84em; color: var(--muted); line-height: 1.45; }

.lb-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 1.4em; }
.lb-compare > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; border-top: 3px solid var(--dept); }
.lb-compare > div + div { border-top-color: var(--warn); }
.lb-compare ul { margin: 8px 0 0; padding-left: 18px; font-size: .86em; line-height: 1.55; }
@media (max-width: 520px) { .lb-compare { grid-template-columns: 1fr; } }

.lb-pillars .cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.lb-pillars .pil { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 12px; display: grid; gap: 6px; align-content: start; border-bottom: 4px solid var(--dept); }
.lb-pillars .pil .n { font: 700 26px/1 var(--serif); color: var(--dept); }
.lb-pillars .pil b { font-size: .86em; line-height: 1.3; }
.lb-pillars .pil span { font-size: .76em; color: var(--muted); line-height: 1.4; }
@media (max-width: 620px) { .lb-pillars .cols { grid-template-columns: 1fr 1fr; } }

.lb-mnemo { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 0 0 1.2em; }
.lb-mnemo .lb-h { color: var(--dept); }
.lb-mnemo .rows { display: grid; gap: 6px; margin-top: 10px; }
.lb-mnemo .rows div { display: flex; align-items: baseline; gap: 12px; font-size: .9em; }
.lb-mnemo .rows b { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--dept-soft); color: var(--dept); font: 700 17px var(--serif); }

.lb-details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 0 0 1.2em; }
.lb-details summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 600; font-size: .9em; }
.lb-details summary::-webkit-details-marker { display: none; }
.lb-details summary svg.i { transition: transform .2s; color: var(--dept); }
.lb-details[open] summary svg.i { transform: rotate(45deg); }
.lb-details p { margin: 0; padding: 0 14px 14px; font-size: .9em; color: var(--muted); }
.lb-figure { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.lb-figure img, .lb-figure svg { width: 100%; height: auto; display: block; border-radius: 8px; }
.lb-figure figcaption { margin: 10px 0 0; text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 13px; }

.lec-check { margin: 1.4em 0 1em; padding: 16px; border-radius: 14px; background: var(--surface-2); }
.lec-check .lb-h { color: var(--muted); }
.lec-check .q { font: 500 1.02em/1.45 var(--serif); margin: 8px 0 12px; }
.lec-check .a { margin: 0; padding: 12px 14px; background: var(--surface); border-radius: 10px; font-size: .92em; border-left: 3px solid var(--ok); }
.sec-done { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; border: 1.5px solid var(--line-2); font-size: 13px; font-weight: 700; color: var(--muted); margin: 4px 0 8px; }
.sec-done.on { background: var(--ok); border-color: var(--ok); color: #fff; }

.lec-notes { counter-reset: n; list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.lec-notes li { counter-increment: n; position: relative; padding: 12px 14px 12px 48px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: .92em; line-height: 1.5; }
.lec-notes li::before { content: counter(n); position: absolute; left: 14px; top: 12px; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--dept-soft); color: var(--dept); font-size: 12px; font-weight: 800; }
.lec-linked { margin-top: 28px; display: grid; gap: 10px; }

.lec-cards { display: grid; gap: 14px; max-width: 560px; }
.lec-cards .flip-in { min-height: 230px; }
.lec-quiz { max-width: 620px; }
.lec-quiz h3 { font: 600 21px/1.35 var(--serif); margin: 10px 0 16px; }

/* ---------- blueprint map ---------- */
.bp-head { display: flex; gap: 18px; align-items: center; padding: 18px; border-radius: 18px; background: var(--dept-soft); }
.ring { --p: 0; flex: none; width: 92px; height: 92px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--dept-soft) 76%, transparent 77% 100%), conic-gradient(var(--dept) calc(var(--p) * 1%), color-mix(in srgb, var(--dept) 16%, transparent) 0); }
.ring b { font: 700 24px/1 var(--serif); color: var(--dept); }
.ring span { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.bp-sys { margin-top: 22px; }
.bp-sys-h { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.bp-sys-h .ico { width: 38px; height: 38px; border-radius: 11px; background: var(--dept-soft); color: var(--dept); }
.bp-sys-h .t { flex: 1; display: grid; gap: 2px; }
.bp-sys-h .t b { font: 600 19px/1.2 var(--serif); }
.bp-sys-h .pc { font-weight: 800; font-size: 13px; color: var(--dept); }
.bp-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.bp-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); }
.bp-row:first-child { border-top: 0; }
.bp-row .n { flex: none; width: 28px; font-size: 12px; font-weight: 800; color: var(--muted); text-align: right; }
.bp-row .txt { flex: 1; display: grid; gap: 3px; min-width: 0; }
.bp-row .txt b { font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--muted); }
.bp-row.on .txt b { color: var(--text); font-weight: 600; }
.bp-row.on .n { color: var(--dept); }
.bp-row.on:hover { background: var(--surface-2); }
.bp-row .q { flex: none; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.bp-row .q.hi { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.bp-row .chev { color: var(--muted); }
.bp-badge { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 6px 12px; border-radius: 999px; background: var(--dept-soft); color: var(--dept); font-size: 12.5px; font-weight: 600; }
.bp-badge b { color: var(--text); font-weight: 700; }

/* ---------- frequently asked, cases, in-section exam question ---------- */
.lb-often { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.lb-often .lb-h { color: var(--warn); }
.lb-case { margin: 0 0 1.2em; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--dept); }
.lb-case .lb-h { color: var(--dept); }
.lb-case .stem { font: 500 1em/1.55 var(--serif); margin: 8px 0 12px; }
.lb-case .a { margin: 0; padding: 12px 14px; background: var(--dept-soft); border-radius: 10px; font-size: .92em; }
.lec-imcq { margin: 1.4em 0 1em; padding: 16px; border-radius: 14px; border: 1.5px dashed var(--line-2); }
.lec-imcq .lb-h { color: var(--dept); }
.lec-imcq .q { font: 500 1.02em/1.45 var(--serif); margin: 8px 0 12px; }
.lec-imcq .opt { font-size: .9em; }
.bp-head.plain { padding: 0; background: none; } .bp-head.plain .ring { background: radial-gradient(closest-side, var(--surface) 76%, transparent 77% 100%), conic-gradient(var(--dept) calc(var(--p) * 1%), color-mix(in srgb, var(--dept) 16%, transparent) 0); }

/* ================= soft palette + gentle motion ================= */
:root {
  --hl-y: #FBEFB0; --hl-g: #D5F0D9; --hl-b: #D6E8FA; --hl-p: #F9DCE6;
  --st-y: #FFF6CC; --st-g: #E3F5E6; --st-b: #E4EFFB; --st-p: #FCE6EE;
  --ease: cubic-bezier(.22, .8, .24, 1);
}
:root[data-theme='dark'] {
  --hl-y: #5A4E1E; --hl-g: #23452C; --hl-b: #1F3A55; --hl-p: #55293A;
  --st-y: #3A3420; --st-g: #22352A; --st-b: #1F2E3F; --st-p: #3C2530;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(6px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .5s var(--ease) both; animation-delay: var(--d, 0ms); }
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .55s var(--ease), transform .55s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.pop-in { animation: popIn .35s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { .rise, .pop-in { animation: none; } .reveal { opacity: 1; transform: none; transition: none; } }

/* softer, livelier callouts */
.lb { border-radius: 14px; box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.lb-pearl { background: color-mix(in srgb, var(--ok) 6%, var(--surface)); }
.lb-exam { background: color-mix(in srgb, var(--warn) 6%, var(--surface)); }
.lec-tabs .tab { transition: color .2s, border-color .25s var(--ease); }
.btn, .opt, .q-chip, .fin, .sec-done, .sec-note { transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s; }
.btn:active, .opt:active, .q-chip:active, .fin:active { transform: scale(.98); }

/* ----- student highlights ----- */
#lpane mark.uh { padding: 1px 0; border-radius: 3px; cursor: pointer; transition: background .2s; }
#lpane mark.uh.c-y { background: var(--hl-y); } #lpane mark.uh.c-g { background: var(--hl-g); }
#lpane mark.uh.c-b { background: var(--hl-b); } #lpane mark.uh.c-p { background: var(--hl-p); }
.sel-bar { position: fixed; z-index: 40; display: flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(20,24,28,.16); animation: popIn .2s var(--ease); }
.sel-bar[hidden] { display: none; }
.sel-bar .sep, .pen-bar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }
.dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); }
.dot.c-y { background: #F5D96B; } .dot.c-g { background: #8FD19E; } .dot.c-b { background: #8DBCEB; } .dot.c-p { background: #F0A7BF; }
.sel-bar .mini { border-radius: 999px; }

/* ----- sticky notes ----- */
.sticky { position: relative; margin: 4px 0 1.2em; padding: 10px 12px 12px; border-radius: 4px 14px 14px 14px; box-shadow: 0 6px 16px rgba(30, 30, 20, .08); transform: rotate(-.4deg); }
.sticky.c-y { background: var(--st-y); } .sticky.c-g { background: var(--st-g); } .sticky.c-b { background: var(--st-b); } .sticky.c-p { background: var(--st-p); }
.sticky-h { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sticky-h .sp { flex: 1; }
.sticky-h .dot { width: 16px; height: 16px; }
.sticky-h .mini { padding: 4px 6px; background: transparent; border: 0; }
.sticky textarea { width: 100%; border: 0; background: transparent; resize: none; font: 500 15px/1.5 var(--sans); color: var(--text); margin-top: 6px; outline: none; }
.sec-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sec-note { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted); background: var(--surface-2); }
.sec-note:hover { color: var(--text); }

/* ----- pen layer ----- */
.lec-paper { position: relative; }
canvas.ink { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; z-index: 3; }
.inking canvas.ink { pointer-events: auto; touch-action: none; cursor: crosshair; }
.inking #lpane { user-select: none; -webkit-user-select: none; }
.lec-bar .icon-btn.on { background: var(--dept); color: #fff; border-color: var(--dept); }
.pen-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b)); z-index: 40; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 12px 34px rgba(20,24,28,.18); animation: popIn .25s var(--ease); }
.pen-bar[hidden] { display: none; }
.pen-bar .sw { width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); }
.pen-bar .sw.on { box-shadow: 0 0 0 2px var(--c); }
.pen-bar .mini { border-radius: 999px; }
.pen-bar .mini.on { background: var(--dept-soft); color: var(--dept); border-color: var(--dept); }
@media (min-width: 900px) { .pen-bar { bottom: 24px; } }

/* ----- question chip + popup ----- */
.q-chip { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin: 1.2em 0 1em; padding: 12px 14px; border-radius: 14px; background: var(--dept-soft); border: 1px solid transparent; }
.q-chip .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--surface); color: var(--dept); }
.q-chip .txt { flex: 1; display: grid; gap: 1px; }
.q-chip .txt b { font-size: 14.5px; }
.q-chip .txt span { font-size: 12.5px; color: var(--muted); }
.q-chip .chev { color: var(--dept); }
.q-chip.ok { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); } .q-chip.ok .ico { color: var(--ok); }
.q-chip.bad { background: color-mix(in srgb, var(--bad) 8%, var(--surface)); } .q-chip.bad .ico { color: var(--bad); }
.qpop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px; background: rgba(16, 20, 24, 0); pointer-events: none; transition: background .22s; }
.qpop.show { background: rgba(16, 20, 24, .38); pointer-events: auto; }
.qpop:empty { display: none; }
.qpop-card { width: 100%; max-width: 460px; max-height: 86vh; overflow: auto; background: var(--surface); border-radius: 20px; padding: 18px; box-shadow: 0 24px 60px rgba(10, 14, 18, .25); opacity: 0; transform: scale(.94) translateY(10px); transition: opacity .22s var(--ease), transform .28s var(--ease); }
.qpop.show .qpop-card { opacity: 1; transform: none; }
.qpop-card .lb-h { color: var(--dept); }
.qpop-card .q { font: 600 18px/1.4 var(--serif); margin: 10px 0 14px; }
.qpop-card .opt { font-size: 14.5px; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.opt .t { display: grid; gap: 4px; text-align: left; }
.opt .ex { font-size: 13px; font-weight: 400; color: var(--muted); line-height: 1.45; }
.opt:disabled { cursor: default; color: inherit; opacity: 1; }

/* ----- short version, finish panel, cards ----- */
.short-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-top: 12px; }
.short-sec h3 { display: flex; align-items: center; gap: 10px; font: 600 1.08em var(--serif); }
.short-sec h3 .n { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--dept-soft); color: var(--dept); font: 800 12.5px var(--sans); }
.short-sec .listing li { font-size: .9em; }
.finish { text-align: center; padding: 26px 18px; border-radius: 20px; background: linear-gradient(180deg, var(--dept-soft), transparent); }
.finish .ico.lg { margin: 0 auto 10px; color: var(--dept); }
.finish h2 { margin: 0 0 4px !important; }
.finish-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; text-align: left; }
.fin { display: grid; gap: 6px; align-content: start; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.fin:hover { border-color: var(--dept); box-shadow: 0 6px 18px color-mix(in srgb, var(--dept) 14%, transparent); }
.fin .ico { width: 36px; height: 36px; border-radius: 11px; background: var(--dept-soft); color: var(--dept); }
.fin b { font-size: 14.5px; }
.fin span:last-child { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
@media (max-width: 560px) { .finish-grid { grid-template-columns: 1fr; } .fin { grid-template-columns: auto 1fr; column-gap: 12px; } .fin .ico { grid-row: span 2; } }
.cards-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.cards-dots i { height: 4px; flex: 1; min-width: 8px; border-radius: 4px; background: var(--line); transition: background .3s; }
.cards-dots i.past { background: color-mix(in srgb, var(--dept) 40%, transparent); }
.cards-dots i.on { background: var(--dept); }

/* ----- video ----- */
.lb-video .yt { position: relative; display: block; width: 100%; aspect-ratio: 16/9; border-radius: 14px; background: #111 center/cover; overflow: hidden; }
.lb-video .yt .play { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.92); color: var(--dept); box-shadow: 0 8px 24px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.lb-video .yt:hover .play { transform: scale(1.06); }
.yt-frame { aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; background: #000; }
.yt-frame iframe { width: 100%; height: 100%; border: 0; }
.lb-video figcaption { margin-top: 8px; }
.lb-video-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 0 1.2em; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.lb-video-link .ico { width: 38px; height: 38px; border-radius: 11px; background: color-mix(in srgb, var(--bad) 10%, var(--surface)); color: var(--bad); }
.lb-video-link .txt { flex: 1; display: grid; }
.lb-video-link .txt b { font-size: 14.5px; }
.lb-pillars .cols { grid-template-columns: repeat(var(--n, 4), 1fr); }
@media (max-width: 620px) { .lb-pillars .cols { grid-template-columns: 1fr 1fr; } }
.lec-tabs .tab { font-size: 14px; }
@media (max-width: 420px) { .lec-tabs .tab { font-size: 12.5px; } }
.fin { text-align: left; }

/* ================= lecture as pages (not an article) ================= */
/* no app menu inside a lecture: the page has the whole screen */
body.in-lecture .rail { display: none !important; }
body.in-lecture { background: color-mix(in srgb, var(--bg) 90%, var(--text) 4%); }
body.in-lecture main.lec-page { padding-bottom: calc(90px + var(--safe-b)); }
@media (min-width: 900px) {
  body.in-lecture .shell { grid-template-columns: 1fr; }
  body.in-lecture main.lec-page { max-width: 880px; margin: 0 auto; }
  .lec-grid { display: block; }
}
.lec-toc:not(.in-sheet) { display: none !important; }
.lec-bar { gap: 8px; }
@media (max-width: 420px) { .lec-bar .icon-btn { width: 36px; height: 36px; } .lec-bar { gap: 6px; } }

/* pages */
.page { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px 30px 18px; margin: 22px 0; box-shadow: 0 1px 2px rgba(20, 20, 10, .03), 0 12px 32px rgba(20, 20, 10, .05); }
.lec-sec.page + .lec-sec.page { border-top: 1px solid var(--line); margin-top: 22px; }
.page-obj { padding: 18px; }
.page-obj .lb { margin: 0; }
.page-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 10px; margin-bottom: 16px; border-bottom: 1px dashed var(--line-2); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.page-head span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-head span:last-child { flex: none; color: var(--dept); }
.lec-sec .sec-n .num { display: inline-grid; place-items: center; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 14px; background: var(--dept-soft); color: var(--dept); font: 600 22px var(--serif); letter-spacing: 0; }
.lec-sec.page h2 { margin-top: 12px; }
.page-foot { text-align: center; margin-top: 18px; font: 600 12px var(--sans); color: var(--muted); letter-spacing: .1em; }
.page-foot::before, .page-foot::after { content: ''; display: inline-block; width: 26px; height: 1px; background: var(--line-2); vertical-align: middle; margin: 0 10px; }
#sec-summary.lec-sec { border: 0; }
@media (max-width: 620px) { .page { padding: 20px 18px 14px; margin: 14px -6px; border-radius: 16px; } }

/* contents as a small shortcut */
.page-chip { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--safe-b)); z-index: 30; display: flex; align-items: center; gap: 8px; max-width: min(82vw, 420px); padding: 8px 15px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(20, 20, 10, .1); font-size: 12.5px; transition: transform .3s var(--ease), opacity .3s; }
.page-chip .pn { font-weight: 800; color: var(--dept); flex: none; }
.page-chip .pt { color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-chip[hidden], .page-dots[hidden] { display: none; }
.inking .page-chip, .placing .page-chip { opacity: 0; pointer-events: none; }
.page-dots { display: none; }
@media (min-width: 1140px) {
  .page-dots { position: fixed; right: 22px; top: 50%; transform: translateY(-50%); z-index: 20; display: grid; gap: 6px; }
  .page-dots button { position: relative; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--muted); background: var(--surface); border: 1px solid var(--line); transition: background .2s, color .2s, transform .2s var(--ease); }
  .page-dots button svg.i { width: 13px; height: 13px; }
  .page-dots button.done { color: var(--ok); }
  .page-dots button.on { background: var(--dept); color: #fff; border-color: var(--dept); transform: scale(1.08); }
  .page-dots em { position: absolute; right: 40px; top: 50%; transform: translateY(-50%) translateX(6px); white-space: nowrap; font: 600 12.5px var(--sans); color: var(--text); background: var(--surface); border: 1px solid var(--line); padding: 5px 10px; border-radius: 8px; box-shadow: 0 6px 16px rgba(0,0,0,.08); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); }
  .page-dots button:hover em { opacity: 1; transform: translateY(-50%); }
}

/* ================= focus mode: just the pages, like a notes app ================= */
body.lec-focus { background: color-mix(in srgb, var(--bg) 82%, var(--text) 9%); }
body.lec-focus .lec-hero, body.lec-focus .lec-tabs, body.lec-focus .lec-linked, body.lec-focus .lec-progress, body.lec-focus .lec-bar .t { display: none; }
body.lec-focus main.lec-page { max-width: 900px; padding-top: 74px; }
body.lec-focus .lec-bar { position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); margin: 0; padding: 6px 8px; width: auto; border-radius: 999px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: 0 10px 28px rgba(20, 20, 10, .12); z-index: 35; transition: transform .35s var(--ease), opacity .3s; }
body.lec-focus .lec-bar .icon-btn { border-color: transparent; background: transparent; }
body.lec-focus .lec-bar .icon-btn.on { background: var(--dept); color: #fff; }
body.lec-focus .lec-page.bar-hide .lec-bar { transform: translate(-50%, -90px); opacity: 0; }
body.lec-focus .lec-page.bar-hide .page-chip { transform: translate(-50%, 90px); opacity: 0; }
body.lec-focus .page { border: 0; border-radius: 6px; padding: 46px 56px 26px; margin: 26px 0; background-color: var(--surface); background-image: radial-gradient(color-mix(in srgb, var(--text) 14%, transparent) 1px, transparent 1.3px); background-size: 24px 24px; background-position: 12px 12px; box-shadow: 0 2px 5px rgba(20, 20, 10, .05), 0 22px 50px rgba(20, 20, 10, .09); }
body.lec-focus .page-obj { padding: 30px 40px; }
@media (max-width: 620px) { body.lec-focus main.lec-page { padding-top: 68px; } body.lec-focus .page { padding: 28px 20px 16px; margin: 14px -10px; } }

/* ================= pen toolbar ================= */
.pen-bar { left: 50%; right: auto; bottom: auto; top: calc(10px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 45; display: grid; gap: 6px; justify-items: center; padding: 0; border: 0; background: none; box-shadow: none; border-radius: 0; }
.pen-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 12px 34px rgba(20, 24, 28, .16); max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; }
.pen-row::-webkit-scrollbar { display: none; }
.pen-bar .tool { display: grid; justify-items: center; gap: 2px; min-width: 52px; padding: 6px 6px 4px; border-radius: 12px; font-size: 10.5px; font-weight: 700; color: var(--muted); flex: none; }
.pen-bar .tool svg.i { width: 19px; height: 19px; }
.pen-bar .tool.on { background: var(--dept-soft); color: var(--dept); }
.pen-bar .sws, .pen-bar .lws { display: flex; gap: 6px; align-items: center; flex: none; }
.pen-bar .lw { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.pen-bar .lw i { width: 16px; height: var(--s); border-radius: 9px; background: var(--text); }
.pen-bar .lw.on { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.pen-bar .btn { flex: none; }
.pen-hint { font-size: 12px; font-weight: 600; color: var(--muted); background: color-mix(in srgb, var(--surface) 92%, transparent); padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); }
.inking .lec-bar { visibility: hidden; }
.inking .page { box-shadow: 0 0 0 2px color-mix(in srgb, var(--dept) 30%, transparent), 0 12px 32px rgba(20, 20, 10, .05); }
@media (max-width: 560px) { .pen-bar .tool { min-width: 44px; } .pen-bar .tool span { font-size: 9.5px; } }

/* ================= sticky notes anywhere ================= */
.note-layer { position: absolute; left: 0; top: 0; width: 100%; height: 0; z-index: 5; }
.note-layer[hidden] { display: none; }
.fnote { position: absolute; width: min(230px, 64vw); border-radius: 4px 4px 14px 4px; box-shadow: 0 10px 24px rgba(30, 30, 20, .14), 0 1px 2px rgba(0,0,0,.06); transition: box-shadow .2s, transform .2s var(--ease); }
.fnote.c-y { background: var(--st-y); } .fnote.c-g { background: var(--st-g); } .fnote.c-b { background: var(--st-b); } .fnote.c-p { background: var(--st-p); }
.fnote-h { display: flex; align-items: center; gap: 4px; padding: 6px 6px 4px 8px; cursor: grab; touch-action: none; }
.fnote-h .grip { width: 14px; height: 10px; margin-right: 4px; background: radial-gradient(circle, var(--muted) 1.1px, transparent 1.4px) 0 0 / 5px 5px; opacity: .6; }
.fnote-h .sp { flex: 1; }
.fnote-h .dot { width: 14px; height: 14px; border-width: 1.5px; }
.fnote-h .mini { padding: 3px 4px; background: transparent; border: 0; color: var(--muted); }
.fnote textarea { display: block; width: 100%; border: 0; background: transparent; resize: none; padding: 2px 12px 12px; font: 500 14.5px/1.45 var(--sans); color: var(--text); outline: none; min-height: 64px; }
.fnote-tab { display: none; }
.fnote.min { width: 38px; height: 38px; border-radius: 4px 4px 12px 4px; }
.fnote.min .fnote-h, .fnote.min textarea { display: none; }
.fnote.min .fnote-tab { display: grid; place-items: center; width: 100%; height: 100%; color: color-mix(in srgb, var(--text) 70%, transparent); cursor: grab; touch-action: none; }
.fnote.dragging { transform: rotate(-1.5deg) scale(1.03); box-shadow: 0 22px 44px rgba(30, 30, 20, .22); z-index: 2; cursor: grabbing; }
.placing .lec-paper { cursor: copy; }
.placing .page { box-shadow: 0 0 0 2px color-mix(in srgb, var(--warn) 40%, transparent); }
.pen-bar { animation: none; }
.pen-row { animation: popIn .25s var(--ease); }
.opt.picked:not(.right) { border-color: var(--bad); }
.opt.right .ex { color: color-mix(in srgb, var(--ok) 70%, var(--text)); }

/* exam: one calm column. Parts on top, a row of small question dots, the question card, then the mode and actions */
.rd-other:has(.exam) { max-width: 860px; padding: 24px 24px 60px; }
.exam { display: grid; gap: 18px; }
.ex-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ex-parts { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--surface-2); }
.ex-parts button { display: inline-flex; align-items: baseline; gap: 8px; padding: 9px 14px; border-radius: 10px; color: var(--muted); transition: background .2s, color .2s; }
.ex-parts button b { font: 650 14px/1 var(--sans); }
.ex-parts button span { font: 600 12px/1 var(--sans); font-variant-numeric: tabular-nums; opacity: .75; }
.ex-parts button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(20, 30, 40, .08), 0 2px 8px rgba(20, 30, 40, .05); }
.ex-stat { display: flex; align-items: baseline; gap: 8px; }
.ex-stat b { font: 700 24px/1 var(--sans); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ex-stat span { font-size: 13px; color: var(--muted); }
.ex-rail { display: grid; gap: 12px; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.ex-prog { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.ex-prog i { display: block; height: 100%; border-radius: inherit; background: var(--dept); transition: width .35s ease; }
.ex-dots { display: flex; flex-wrap: wrap; gap: 8px; }
.ex-dots button { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); font: 600 13px/1 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; transition: transform .15s, border-color .15s, background .15s; }
.ex-dots button.ans { background: var(--dept-soft); border-color: transparent; color: var(--dept); }
.ex-dots button.ok { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); border-color: transparent; color: color-mix(in srgb, var(--ok) 80%, var(--text)); }
.ex-dots button.no { background: color-mix(in srgb, var(--bad) 13%, var(--surface)); border-color: transparent; color: color-mix(in srgb, var(--bad) 80%, var(--text)); }
.ex-dots button.cur { border-color: var(--dept); color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dept) 16%, transparent); }
.ex-dots button.fl::after { content: ''; position: absolute; top: -1px; right: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); border: 2px solid var(--surface); }
.ex-dots button:active { transform: scale(.92); }
.ex-show { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.ex-show button { padding: 6px 11px; border-radius: 999px; font: 600 12.5px/1 var(--sans); color: var(--muted); }
.ex-show button.on { color: var(--dept); background: var(--dept-soft); }
.ex-card { padding: 26px 28px 22px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(20, 30, 40, .04), 0 12px 32px -18px rgba(20, 30, 40, .18); }
.ex-top { display: flex; align-items: center; justify-content: space-between; }
.ex-n { font: 650 12.5px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--dept); }
.ex-n i { font-style: normal; color: var(--muted); margin-left: 4px; letter-spacing: .04em; }
.ex-flag { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; font: 600 12.5px/1 var(--sans); color: var(--muted); transition: background .2s, color .2s; }
.ex-flag:hover { background: var(--surface-2); }
.ex-flag.on { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.ex-card h3 { font: 600 20px/1.5 var(--sans); letter-spacing: -.01em; margin: 16px 0 20px; color: var(--text); }
.ex-opts { display: grid; gap: 10px; }
.ex-opts .opt { margin: 0; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); align-items: flex-start; }
.ex-opts .opt:not(:disabled):hover { border-color: color-mix(in srgb, var(--dept) 45%, var(--line)); background: color-mix(in srgb, var(--dept-soft) 40%, var(--surface)); }
.ex-opts .opt .k { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font: 700 12.5px/1 var(--sans); }
.ex-opts .opt .t { padding-top: 3px; font-size: 15.5px; line-height: 1.45; }
.ex-opts .opt.right .k { background: var(--ok); color: #fff; }
.ex-opts .opt.wrong .k { background: var(--bad); color: #fff; }
.ex-opts .opt.chosen .k { background: var(--dept); color: #fff; }
.ex-why { margin-top: 16px; padding: 16px 18px; border-radius: 14px; background: var(--surface-2); border-left: 3px solid var(--muted); }
.ex-why.good { border-left-color: var(--ok); }
.ex-why.bad { border-left-color: var(--bad); }
.ex-why b { font: 650 14px/1 var(--sans); }
.ex-why p { margin: 8px 0 0; font-size: 14.5px; line-height: 1.55; }
.ex-move { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.ex-move .btn[disabled] { opacity: .35; pointer-events: none; }
.ex-foot { display: grid; justify-items: center; gap: 10px; padding-top: 6px; text-align: center; }
.ex-foot .ex-mode { display: inline-grid; grid-template-columns: 1fr 1fr; min-width: 220px; }
.ex-foot p { margin: 0; font-size: 13px; color: var(--muted); }
.ex-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.opt.chosen { border-color: var(--dept); background: var(--dept-soft); }
@media (max-width: 640px) { .ex-card { padding: 20px 18px; } .ex-parts button { padding: 8px 10px; } }

/* the picture under an answer's explanation */
.why-fig { margin: 14px 0 2px; padding: 12px 12px 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.why-fig img, .why-fig svg { display: block; width: 100%; max-width: 520px; max-height: 360px; height: auto; object-fit: contain; margin: 0 auto; border-radius: 8px; }
.why-fig figcaption { margin-top: 8px; font-size: 13px; line-height: 1.45; color: var(--muted); text-align: center; }
.why-fig figcaption b { color: var(--text); }
.fin-tag { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; font-weight: 650; color: var(--ok); }
.fin-tag svg.i { width: 13px; height: 13px; }

/* a topic taught in several lectures, and lectures the blueprint does not list */
.bp-row.head { padding-bottom: 6px; }
.bp-row.sub { border-top: 0; padding-top: 7px; padding-bottom: 7px; }
.bp-row.sub .txt b { font-size: 13.5px; font-weight: 500; }
.bp-row.extra .txt b { font-weight: 500; }
.nb-tag { justify-self: start; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
