/* Lecture Copilot — "v3 Light" design (Claude Design). Fonts are self-hosted: the CSP allows 'self' only. */
@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; font-display: swap; src: url("fonts/bvp-400-vi.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; font-display: swap; src: url("fonts/bvp-400-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; font-display: swap; src: url("fonts/bvp-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 500; font-display: swap; src: url("fonts/bvp-500-vi.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 500; font-display: swap; src: url("fonts/bvp-500-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 500; font-display: swap; src: url("fonts/bvp-500-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 600; font-display: swap; src: url("fonts/bvp-600-vi.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 600; font-display: swap; src: url("fonts/bvp-600-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 600; font-display: swap; src: url("fonts/bvp-600-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 700; font-display: swap; src: url("fonts/bvp-700-vi.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 700; font-display: swap; src: url("fonts/bvp-700-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 700; font-display: swap; src: url("fonts/bvp-700-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400 500; font-display: swap; src: url("fonts/jbm-vi.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400 500; font-display: swap; src: url("fonts/jbm-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400 500; font-display: swap; src: url("fonts/jbm-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: light;
  --bg: #faf6f8; --surface: #ffffff; --surface-2: #f5eff2; --surface-3: #f0e8ec; --hover: #ede4e9;
  --heading: #2a2230; --text: #3f3646; --prose: #4a4250; --muted: #7a7080; --faint: #958a99;
  --border: #ede4e9; --border-2: #e3d8de;
  --accent: #f7b6d2; --accent-hover: #fac9de; --accent-ink: #2a0f1f; --accent-text: #c2457d; --accent-soft: #fbdcea; --accent-line: #e27fab;
  --rec: #f28b98; --rec-hover: #f6a3ae; --rec-ink: #3a1420; --paused: #ffb547;
  --danger: #b3263f; --warn-bg: #fff1dc; --warn-ink: #7a4b00; --ok: #2f7d5b;
  --radius: 14px; --shadow-pop: 0 16px 40px rgb(60 30 50 / .10);
  --sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: var(--faint); }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px 32px; padding: 0 28px; min-height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; color: var(--heading); display: flex; gap: 10px; align-items: center; }
.brand:hover { text-decoration: none; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.logo::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-ink); }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 14px; border-radius: 8px; color: var(--muted); font-size: 14px; }
.nav a:hover { color: var(--text); background: #f8f0f4; text-decoration: none; }
.nav a.active { background: #f6e8ef; color: var(--heading); font-weight: 500; }
.top-right { margin-left: auto; position: relative; display: flex; align-items: center; gap: 10px; }
.bell { position: relative; width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--surface-2); cursor: pointer; display: grid; place-items: center; }
.bell:hover { background: var(--hover); }
.bell-ico { width: 12px; height: 12px; border: 2px solid var(--text); border-radius: 6px 6px 2px 2px; }
.bell-count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 600 11px var(--mono); display: grid; place-items: center; }
.bell-pop { position: absolute; top: 46px; right: 0; width: min(320px, calc(100vw - 32px)); max-height: 60vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.pop-h { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.pop-item { padding: 10px; border-radius: 8px; font-size: 13px; line-height: 1.55; color: var(--text); display: grid; gap: 3px; }
.pop-item:hover { background: var(--surface-2); }
.pop-meta { font: 500 11px var(--mono); color: var(--faint); }
.mock-tag { color: var(--warn-ink); background: var(--warn-bg); border-radius: 6px; padding: 0 6px; font-size: 11px; font-weight: 600; }

.banner { margin: 16px auto 0; max-width: 1384px; padding: 10px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); }
.banner.error { background: #fde7ec; color: var(--danger); }

main { max-width: 1440px; margin: 0 auto; padding: 28px 28px 64px; outline: none; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--heading); margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 600; color: var(--heading); margin: 0 0 12px; }
h3 { color: var(--heading); }
.sub { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spacer { flex: 1; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

/* Buttons */
.btn { height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-weight: 500; font-size: 13px; white-space: nowrap; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .08s ease, background .12s ease; }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:active:not(:disabled) { transform: none; } }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.rec { background: var(--rec); color: var(--rec-ink); border-color: transparent; font-weight: 600; }
.btn.rec:hover:not(:disabled) { background: var(--rec-hover); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.big { height: 42px; border-radius: 9px; font-size: 13.5px; width: 100%; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .tab:focus-visible, .flash:focus-visible, .toc button:focus-visible, .bell:focus-visible, .seek:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-text) 35%, transparent); outline-offset: 2px;
}
.ico-dot, .ico-stop { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.ico-stop { width: 10px; height: 10px; border-radius: 2px; }
a.btn { text-decoration: none; }

input[type=text], input[type=search], input:not([type]), textarea {
  width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--border-2); border-radius: 9px; background: #fcf9fb; color: var(--heading); outline: none;
}
input:focus, textarea:focus { border-color: var(--accent-text); }
textarea { height: auto; min-height: 120px; padding: 10px 14px; resize: vertical; }
select { height: 36px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: 8px; background: var(--surface); }

/* Saved lectures */
.lecture { cursor: pointer; display: flex; flex-direction: column; gap: 6px; text-align: left; font: inherit; color: inherit; }
.lecture:hover { border-color: var(--accent-text); }
.lecture h3 { margin: 0; font-size: 15px; font-weight: 600; }

/* ---------- main screen: contents | lecture | controls + chat ---------- */
.ws { display: grid; gap: 24px; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
.toc { display: none; }
@media (max-width: 899px) { .ws { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 1200px) {
  .ws.has-toc { grid-template-columns: 200px minmax(0, 1fr) minmax(320px, 380px); }
  .ws.has-toc .toc { display: flex; }
}
.toc { position: sticky; top: 88px; flex-direction: column; gap: 2px; }
.toc-h { font: 500 11px var(--mono); letter-spacing: .08em; color: var(--faint); padding: 0 12px 10px; }
.toc button { text-align: left; background: transparent; border: 0; border-radius: 8px; padding: 8px 12px; cursor: pointer; display: grid; grid-template-columns: 22px 1fr; gap: 6px; font: 500 13px/1.45 var(--sans); color: var(--muted); }
.toc button:hover { background: var(--surface); }
.toc button.on { background: var(--surface); color: var(--heading); }
.toc-n { font: 500 11px/1.9 var(--mono); color: var(--faint); }
.toc button.on .toc-n { color: var(--accent-text); }

.ws-left { padding: 0; overflow: hidden; }
.ws-head { padding: 26px 32px 0; display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-start; }
.ws-title { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ws-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.ws-title h1 { margin: 0; }
.pill { padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: #6a6070; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.pill.live { background: var(--accent-soft); color: var(--accent-text); }
.pill.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--rec); animation: pulse 1.4s infinite; }
.pill.paused { background: #fff1dc; color: var(--warn-ink); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pill.live::before, .rec-dot.on { animation: none !important; } }
.ws-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.subj { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.subj-k { color: var(--muted); }

.tabs { display: flex; flex-wrap: wrap; gap: 24px; border-bottom: 1px solid var(--border); margin: 16px 0; }
.tab { background: none; border: 0; padding: 0 0 12px; font: 500 14px var(--sans); cursor: pointer; color: var(--muted); }
.tab[aria-selected=true] { color: var(--heading); box-shadow: inset 0 -2px 0 var(--accent-line); }
.ws-tabs { padding: 0 32px; margin: 22px 0 0; }

/* Tab transitions: the underline glides to the clicked tab, content slides in from that side */
.tabs { position: relative; }
.tab-ink { position: absolute; top: 0; left: 0; height: 2px; border-radius: 2px; background: var(--accent-line); pointer-events: none; }
.tab-ink.move { transition: transform .3s cubic-bezier(.2, .7, .2, 1), width .3s cubic-bezier(.2, .7, .2, 1); }
.tabs.inking .tab[aria-selected=true] { box-shadow: none; }
.slide-r { animation: slide-r .32s cubic-bezier(.2, .7, .2, 1); }
.slide-l { animation: slide-l .32s cubic-bezier(.2, .7, .2, 1); }
@keyframes slide-r { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes slide-l { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .slide-r, .slide-l { animation: none; } .tab-ink.move { transition: none; } }
main { overflow-x: clip; }
.card.clip { overflow: hidden; }
.ws-panel { padding: 28px 32px 40px; }
.ws-panel > .md { max-width: 760px; }
.busy { margin: 0 0 16px; padding: 8px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-ink); }
.note { background: var(--surface-2); border-color: transparent; margin-bottom: 20px; }
.live-status { margin: 16px 0 0; }
.ws-more { margin: 28px 0 0; }

/* Lecture article */
.md { font-size: 15.5px; line-height: 1.75; color: var(--prose); text-wrap: pretty; }
.md > p:first-child { font-size: 17px; line-height: 1.7; color: #3a3140; margin: 0 0 28px; }
.md h2, .md h3, .md h4, .md h5 { color: var(--heading); font-weight: 600; font-size: 17px; line-height: 1.5; margin: 30px 0 10px; display: flex; align-items: baseline; gap: 10px; scroll-margin-top: 96px; }
.md h4, .md h5 { font-size: 15.5px; margin: 20px 0 8px; }
.md > :first-child { margin-top: 0; }
.sec-n { font: 500 12px var(--mono); color: var(--accent-text); }
.md p { margin: 0 0 14px; }
.md ul { margin: 0 0 14px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.md ul > li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; }
.md ul > li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); margin-top: 11px; }
.md ol { margin: 0 0 14px; padding-left: 22px; }
.md li { margin: 0; }
.md code { font-family: var(--mono); background: var(--surface-2); border-radius: 4px; padding: 0 4px; font-size: .88em; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* Lecturer notes (Ghi chú của GV) */
.gv-notes { list-style: none; margin: 0; padding: 0; max-width: 760px; display: flex; flex-direction: column; gap: 10px; }
.gv-notes li { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: baseline; padding: 14px 18px; border-radius: 12px; background: #fdf1f6; border: 1px solid #f6dbe7; font-size: 15px; line-height: 1.6; color: var(--heading); }
.gv-notes time { font-size: 12px; color: var(--accent-text); }

/* Flashcards */
.flash { text-align: left; min-height: 150px; padding: 20px; border-radius: 12px; border: 1px solid #e8dde3; background: var(--surface-2); color: #3a3140; font: 500 15px/1.55 var(--sans); cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.flash:hover { border-color: var(--accent-text); }
.flash[aria-pressed=true] { background: var(--accent-soft); }
.flash-tag { font: 500 11px var(--mono); color: var(--muted); letter-spacing: .06em; }

/* Right column */
.ws-right { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 900px) { .ws-right { position: sticky; top: 88px; height: calc(100vh - 116px); min-height: 560px; } }
.ctrl { display: flex; flex-direction: column; gap: 14px; }
.ctrl-top { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.rec-state { display: inline-flex; align-items: center; gap: 8px; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--paused); }
.rec-dot.on { background: var(--rec); animation: pulse 1.4s infinite; }
.clock { font: 500 20px var(--mono); color: var(--heading); }
.ctrl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ctrl .btn.rec.end { height: 38px; }
.meter { height: 4px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.meter > div { height: 100%; width: 0; background: var(--accent-line); transition: width .1s; }
.hint { font-size: 12px; color: var(--faint); margin: 0; }

.player { display: flex; align-items: center; gap: 12px; }
.play { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font: 600 14px var(--sans); cursor: pointer; }
.play:hover:not(:disabled) { background: var(--accent-hover); }
.play:disabled { opacity: .45; cursor: not-allowed; }
.track { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.seek { height: 6px; border-radius: 999px; background: var(--surface-3); cursor: pointer; }
.seek > div { height: 100%; width: 0; background: var(--accent); border-radius: 999px; }
.times { display: flex; justify-content: space-between; font: 400 11.5px var(--mono); color: var(--muted); }
.speed { height: 30px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font: 500 12px var(--mono); cursor: pointer; }

.chat-card { flex: 1; min-height: 0; padding: 0; display: flex; flex-direction: column; }
@media (max-width: 899px) { .chat-card { min-height: 420px; } }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-head strong { font-size: 14px; font-weight: 600; color: var(--heading); }
.chat-head span { font-size: 12px; color: var(--faint); }
.thread { flex: 1; min-height: 0; overflow: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.thread .empty-hint { margin: auto 0; text-align: center; color: var(--faint); font-size: 13px; line-height: 1.6; }
.msg-me { align-self: flex-end; max-width: 85%; padding: 10px 14px; border-radius: 14px 14px 4px 14px; background: var(--accent-soft); color: #5a1d3a; font-size: 13.5px; line-height: 1.6; margin: 0; white-space: pre-wrap; }
.msg-bot { align-self: flex-start; max-width: 90%; display: flex; flex-direction: column; gap: 4px; }
.msg-who { font: 500 11px var(--mono); color: var(--faint); }
.bubble { padding: 10px 14px; border-radius: 14px 14px 14px 4px; background: var(--surface-2); color: var(--text); font-size: 13.5px; line-height: 1.6; }
.msg-hint { padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--accent); background: #fdf1f6; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; line-height: 1.6; color: var(--heading); }
.msg-meta { font: 500 11px var(--mono); color: var(--accent-text); }
.bubble p, .msg-hint p { margin: 0; }
.bubble ul, .msg-hint ul { margin: 4px 0 0; padding-left: 18px; }
.ans-more { font-size: 12.5px; color: var(--muted); }
.msg-hint .ans-more { color: #5d5363; }
.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-line); animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: .7; } }
.chat { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.chat input { flex: 1; min-width: 0; }
.chat .btn { height: 40px; padding: 0 16px; border-radius: 9px; }
.chat .web-btn { padding: 0 12px; }
.web-tag { font: 500 11px var(--mono); color: var(--accent-text); margin-bottom: 4px !important; }
.cite.web { border-left-color: var(--accent-line); }
.cite.web a { color: var(--accent-text); font-weight: 500; }

@media (max-width: 899px) { main { padding: 20px 16px 48px; } .topbar { padding: 8px 16px; } .nav { order: 3; width: 100%; } .ws-head { padding: 20px 20px 0; } .ws-tabs { padding: 0 20px; } .ws-panel { padding: 22px 20px 32px; } }

/* Answers (saved lecture page) */
.answer { border-left: 3px solid var(--accent); padding: 12px 14px; margin-bottom: 10px; }
.answer .q { font-weight: 600; color: var(--heading); }
.answer p { margin: 4px 0; }
.answer ul { margin: 6px 0; padding-left: 20px; }
.answer.explain { border-left-color: var(--accent-line); }
.warn { color: var(--warn-ink); background: var(--warn-bg); padding: 4px 8px; border-radius: 6px; display: inline-block; }
.cite { font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--border-2); padding-left: 8px; margin-top: 6px; }
.cite.doc { border-left-color: var(--accent-text); }

/* Saved lecture page */
.seg { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); margin-bottom: 6px; }
.seg time { font-family: var(--mono); color: var(--muted); font-size: 12px; margin-right: 8px; }
.seg.clickable { cursor: pointer; }
.seg.clickable:hover { outline: 1px solid var(--accent-text); }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
audio { width: 100%; margin-bottom: 12px; }
.quiz-q { margin-bottom: 14px; }
.finding { margin: 10px 0; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

/* Privacy */
table.kv { border-collapse: collapse; width: 100%; }
table.kv td { padding: 10px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.kv td:first-child { font-weight: 600; color: var(--heading); width: 38%; }

/* Dialogs */
dialog { border: 1px solid var(--border-2); border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: rgb(42 34 48 / .35); }
dialog form { padding: 22px; display: grid; gap: 12px; }
dialog h2 { margin: 0; }
dialog label { display: grid; gap: 4px; font-weight: 500; }
dialog .check { display: flex; gap: 8px; align-items: flex-start; }
dialog .source { border: 1px solid var(--border-2); border-radius: 10px; display: grid; gap: 6px; }
dialog .source label { display: flex; gap: 8px; font-weight: 400; }
dialog details > summary { cursor: pointer; font-weight: 600; color: var(--accent-text); }
dialog details.adv > summary { color: var(--muted); font-weight: 500; font-size: 13px; }
dialog details[open] > summary { margin-bottom: 10px; }
.notice { background: var(--surface-2); border-radius: 10px; padding: 4px 14px; font-size: 13.5px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.req { color: var(--danger); }
.pick-list { display: grid; gap: 6px; max-height: 40vh; overflow-y: auto; }
.pick { display: flex; border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden; }
.pick.on { border-color: var(--accent-text); box-shadow: inset 3px 0 0 var(--accent-text); }
.pick-main { flex: 1; display: grid; text-align: left; gap: 2px; padding: 10px 12px; border: 0; background: none; cursor: pointer; }
.pick-main:hover { background: var(--surface-2); }
.pick-del, .pick-icon { border: 0; background: none; padding: 0 12px; cursor: pointer; color: var(--muted); }
.pick-del:hover { color: var(--danger); }
.pick-icon[aria-expanded=true] { background: var(--surface-2); }
.new-subj { display: grid; gap: 10px; }
.docs { border: 1px solid var(--border-2); border-top: 0; border-radius: 0 0 10px 10px; margin: -2px 0 0; padding: 8px 12px; display: grid; gap: 8px; }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.doc-list li { display: flex; gap: 8px; align-items: center; }
.doc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-btn { position: relative; justify-self: start; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.doc-status { white-space: pre-line; margin: 0; }
