/* Notes v2 — reader styles. Two looks share one structure:
   data-look="latex"  : Computer Modern text, LaTeX-book typography, ruled theorem boxes
   data-look="modern" : system sans text, soft cards, coloured pills
   Densities: data-density = compact | normal | expanded (see notes.js for the fold markers). */

:root {
  --bg: #fffdf8; --bg2: #f7f3ea; --bg3: #efe9dc; --card: #fffefb;
  --ink: #1d1d1f; --ink2: #4a4a4f; --muted: #85837d; --line: #e4ddcf; --line2: #d3cab8;
  --accent: #1d4e89; --accent2: #2f6fb5;
  --c1: #2563c9; --c2: #c62f2f; --c3: #1f8a4c; --c4: #d17a00; --c5: #7a3fb5; --c6: #0f8a8a;
  --def: #2563c9; --eq: #b3780e; --res: #1f8a4c; --warn: #c2410c; --extra: #7a3fb5; --cram: #e5b400;
  --def-bg: #f1f5fc; --eq-bg: #fdf7e8; --res-bg: #eff8f2; --warn-bg: #fdf1ea; --extra-bg: #f6f1fc; --cram-bg: #fff8d6;
  --hl: #fff0a3;
  --guess: rgba(176, 116, 18, .6); --chk: #1f8a4c; --chk-bg: rgba(31, 138, 76, .1);
  --text: KaTeX_Main, "Latin Modern Roman", "CMU Serif", Georgia, serif;
  --head: KaTeX_Main, "Latin Modern Roman", "CMU Serif", Georgia, serif;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs: 18.5px; --lh: 1.58;
  --r: 3px; --content: 44rem; --margin: 17rem; --gap: 2.4rem;
  color-scheme: light;
}
:root[data-look="modern"] {
  --bg: #ffffff; --bg2: #f6f7f9; --bg3: #eceef2; --card: #ffffff;
  --ink: #16181d; --ink2: #434750; --muted: #7c818c; --line: #e5e7eb; --line2: #d1d5db;
  --accent: #2b59c3; --accent2: #3b6fe0;
  --def-bg: #eef4ff; --eq-bg: #fff7e6; --res-bg: #ecfaf1; --warn-bg: #fff1ea; --extra-bg: #f5f0ff; --cram-bg: #fffbe0;
  --text: var(--ui); --head: var(--ui);
  --fs: 16.5px; --lh: 1.62; --r: 10px;
}
:root[data-theme="dark"] {
  --bg: #16171a; --bg2: #1d1f23; --bg3: #26282d; --card: #1b1d21;
  --ink: #e8e6e1; --ink2: #c1bfba; --muted: #8b8d93; --line: #2e3137; --line2: #3c4048;
  --accent: #8fb3ff; --accent2: #a9c4ff;
  --c1: #6ea0ff; --c2: #ff7676; --c3: #5fd38f; --c4: #ffb347; --c5: #c39bff; --c6: #4fd6d6;
  --def: #6ea0ff; --eq: #e0b04a; --res: #5fd38f; --warn: #ff8a5c; --extra: #c39bff; --cram: #e5c84a;
  --def-bg: #1a2233; --eq-bg: #29241a; --res-bg: #17271e; --warn-bg: #2b1d17; --extra-bg: #231d30; --cram-bg: #2a2714;
  --hl: #4a4220;
  --guess: rgba(228, 178, 88, .55); --chk: #5fd38f; --chk-bg: rgba(95, 211, 143, .13);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--text); font-size: var(--fs); line-height: var(--lh); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
kbd { font-family: var(--ui); font-size: .72rem; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3em; color: var(--muted); }
.katex { font-size: 1.06em; }
:root[data-look="modern"] .katex { font-size: 1.12em; }
.ui, .top, .nav, .badge, .blk-k, .lmark, .fold, figcaption, .crumbs, .kicker, .topic-meta, .pager, .dash, .pop, .modal { font-family: var(--ui); }

/* ------------------------------------------------------------------ top bar */
.top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 1rem; height: 52px; padding: 0 1rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); font-size: .9rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 650; color: var(--ink); font-size: 1rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--bg); font-family: KaTeX_Main, serif; font-size: 17px; }
.tabs { display: flex; gap: .15rem; }
.tab { padding: .35rem .7rem; border-radius: 7px; color: var(--ink2); }
.tab:hover { background: var(--bg2); text-decoration: none; }
.tab.on { color: var(--ink); background: var(--bg3); font-weight: 600; }
.tab .n { display: inline-block; min-width: 1.3em; margin-left: .3em; padding: 0 .35em; border-radius: 9px; background: var(--warn); color: #fff; font-size: .72rem; text-align: center; font-weight: 700; }
.tools { margin-left: auto; display: flex; align-items: center; gap: .45rem; }
.tbtn { border: 1px solid var(--line); background: var(--card); border-radius: 7px; height: 32px; padding: 0 .65rem; cursor: pointer; color: var(--ink2); display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; }
.tbtn:hover { border-color: var(--line2); color: var(--ink); text-decoration: none; }
.tbtn.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.searchbtn { min-width: 12rem; justify-content: space-between; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); height: 32px; }
.seg button { border: 0; background: none; padding: 0 .7rem; cursor: pointer; color: var(--ink2); font-size: .85rem; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: var(--bg); }
.seg button .s { display: none; }
.navbtn { display: none; border: 0; background: none; font-size: 1.3rem; cursor: pointer; padding: .2rem .4rem; }

/* ------------------------------------------------------------------ layout */
.layout { display: grid; grid-template-columns: 17rem minmax(0, 1fr); min-height: calc(100vh - 52px); }
.layout.wide { grid-template-columns: minmax(0, 1fr); }
.nav { position: sticky; top: 52px; align-self: start; height: calc(100vh - 52px); overflow: auto; padding: 1.2rem .6rem 3rem 1rem; border-right: 1px solid var(--line); font-size: .86rem; background: var(--bg); }
.main { min-width: 0; padding: 2.2rem var(--gap) 5rem; }
.main.topic { padding-right: calc(var(--margin) + var(--gap) * 1.5); max-width: calc(var(--content) + var(--margin) + var(--gap) * 3.5); }

/* nav tree */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: .85rem; }
.tn > ul { display: none; }
.tn.open > ul { display: block; }
.tn-row { display: flex; align-items: flex-start; gap: .1rem; border-radius: 6px; }
.tn-row:hover { background: var(--bg2); }
.tn-t { flex: none; width: 1.3rem; height: 1.6rem; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; }
.tn-t::before { content: "▸"; display: inline-block; transition: transform .12s; font-size: .7rem; }
.tn.open > .tn-row .tn-t::before { transform: rotate(90deg); }
.tn.leaf > .tn-row .tn-t { visibility: hidden; }
.tn-row a { flex: 1; padding: .22rem .3rem .22rem 0; color: var(--ink2); line-height: 1.3; }
.tn-row a:hover { text-decoration: none; color: var(--ink); }
.tn.cur > .tn-row { background: var(--bg3); }
.tn.cur > .tn-row a { color: var(--ink); font-weight: 600; }
.tn-year > .tn-row a { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: var(--muted); font-weight: 700; }
.tn .num { color: var(--muted); margin-right: .3em; font-variant-numeric: tabular-nums; }
.tn .cov { margin-left: .3em; color: var(--muted); font-size: .75rem; }
.tn-h > .tn-row a { font-size: .8rem; }
.tn-h3 > .tn-row a { font-size: .76rem; color: var(--muted); }

/* ------------------------------------------------------------------ topic head */
.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: .6rem; }
.crumbs a { color: var(--muted); }
.kicker { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.topic-head h1 { font-family: var(--head); font-size: 2.35rem; line-height: 1.15; margin: .3rem 0 .6rem; font-weight: 700; letter-spacing: -.01em; }
:root[data-look="modern"] .topic-head h1 { font-size: 2.1rem; letter-spacing: -.025em; font-weight: 720; }
.topic-meta { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; font-size: .84rem; color: var(--ink2); padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); margin-bottom: 1.6rem; max-width: var(--content); }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 99px; background: var(--bg2); border: 1px solid var(--line); font-size: .78rem; color: var(--ink2); }
.pill.ok { background: var(--res-bg); border-color: transparent; color: var(--res); }
.pill.part { background: var(--eq-bg); border-color: transparent; color: var(--eq); }

/* ------------------------------------------------------------------ content */
.content { max-width: var(--content); position: relative; counter-reset: h2; }
.content p { margin: .55em 0 .75em; }
.content ul, .content ol { margin: .4em 0 .8em; padding-left: 1.4em; }
.content li { margin: .2em 0; }
.content li::marker { color: var(--muted); }
.content h2 { font-family: var(--head); font-size: 1.45rem; line-height: 1.25; margin: 2.2rem 0 .6rem; font-weight: 700; counter-increment: h2; counter-reset: h3; scroll-margin-top: 70px; }
.content h3 { font-family: var(--head); font-size: 1.15rem; margin: 1.6rem 0 .4rem; font-weight: 700; counter-increment: h3; scroll-margin-top: 70px; }
.content h2::before { content: var(--tn, "") counter(h2) "\2003"; color: var(--muted); font-weight: 600; }
.content h3::before { content: var(--tn, "") counter(h2) "." counter(h3) "\2002"; color: var(--muted); font-weight: 600; }
:root[data-look="modern"] .content h2 { font-size: 1.35rem; letter-spacing: -.015em; font-weight: 680; }
:root[data-look="modern"] .content h3 { font-size: 1.08rem; font-weight: 660; }
:root[data-look="modern"] .content h2::before, :root[data-look="modern"] .content h3::before { font-weight: 500; }
.content strong { font-weight: 700; }
.content mark { background: linear-gradient(transparent 12%, var(--hl) 12%, var(--hl) 88%, transparent 88%); color: inherit; padding: 0 .08em; border-radius: 1px; }
.content table { border-collapse: collapse; margin: .8em 0; font-size: .95em; }
/* anything wider than the column scrolls sideways by itself (phone), never off the edge */
.content table, .pop table { display: block; max-width: 100%; width: max-content; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.content pre, .pop pre { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: .8em 0; padding: .7em .9em; border-radius: 8px;
  background: var(--card); border: 1px solid var(--line); font-size: .84em; line-height: 1.45; tab-size: 4; }
.content pre code, .pop pre code { font-size: inherit; background: none; padding: 0; white-space: pre; }
.content img, .content iframe { max-width: 100%; }
.katex.kwide { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; padding: .15em 0; -webkit-overflow-scrolling: touch; }
.content th, .content td { border-bottom: 1px solid var(--line); padding: .35em .8em; text-align: left; }
.content th { border-bottom: 1.5px solid var(--ink2); font-weight: 700; }
.eqn { margin: .7em 0; overflow-x: auto; overflow-y: hidden; padding: .1em 0; }
.srcl { font-family: var(--ui); font-size: .68rem; font-weight: 500; color: var(--muted); margin-left: .5rem; vertical-align: .15em; border: 1px solid var(--line); border-radius: 4px; padding: 0 .3em; cursor: zoom-in; white-space: nowrap; }
.srcl:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.content .c1, .katex .c1 { color: var(--c1); } .content .c2, .katex .c2 { color: var(--c2); } .content .c3, .katex .c3 { color: var(--c3); }
.content .c4, .katex .c4 { color: var(--c4); } .content .c5, .katex .c5 { color: var(--c5); } .content .c6, .katex .c6 { color: var(--c6); }
.katex .hl { background: var(--hl); }

/* lecture markers */
.part + .part { margin-top: 2.6rem; }
.lmark { display: flex; align-items: center; gap: .8rem; margin: 0 0 .4rem; color: var(--muted); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 650; }
.lmark::before, .lmark::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.lmark::before { flex: 0 0 1.2rem; }

/* ------------------------------------------------------------------ blocks */
.blk { margin: 1.1em 0; position: relative; }
.blk-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; margin-bottom: .2rem; }
.blk-k { flex: none; white-space: nowrap; font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; font-weight: 750; }
.blk-n { font-weight: 700; font-family: var(--head); font-size: .98em; }
.blk-tools { margin-left: auto; display: inline-flex; gap: .3rem; }
.blk-b > :first-child { margin-top: 0; }
.blk-b > :last-child { margin-bottom: 0; }

.blk-def, .blk-eq, .blk-result, .blk-pitfall { padding: .75rem 1rem .8rem; border-left: 3px solid; border-radius: 0 var(--r) var(--r) 0; }
.blk-def { border-color: var(--def); background: var(--def-bg); } .blk-def .blk-k { color: var(--def); }
.blk-eq { border-color: var(--eq); background: var(--eq-bg); } .blk-eq .blk-k { color: var(--eq); }
.blk-result { border-color: var(--res); background: var(--res-bg); } .blk-result .blk-k { color: var(--res); }
.blk-pitfall { border-color: var(--warn); background: var(--warn-bg); } .blk-pitfall .blk-k { color: var(--warn); }
:root[data-look="latex"] .blk-def, :root[data-look="latex"] .blk-eq, :root[data-look="latex"] .blk-result, :root[data-look="latex"] .blk-pitfall { border-left-width: 2px; background: transparent; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
:root[data-look="latex"] .blk-eq { background: var(--eq-bg); }
:root[data-look="modern"] .blk-def, :root[data-look="modern"] .blk-eq, :root[data-look="modern"] .blk-result, :root[data-look="modern"] .blk-pitfall { border-left: 0; border-radius: var(--r); box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 0%, var(--line)); }
:root[data-look="modern"] .blk-k { display: inline-block; padding: .05rem .45rem; border-radius: 99px; background: color-mix(in srgb, currentColor 13%, transparent); letter-spacing: .05em; }

details.blk { border-radius: var(--r); }
details.blk > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: .5rem; padding: .35rem 0; user-select: none; }
details.blk > summary::-webkit-details-marker { display: none; }
details.blk > summary::before { content: "▸"; font-family: var(--ui); font-size: .75rem; color: var(--muted); transition: transform .15s; display: inline-block; width: .8rem; }
details.blk[open] > summary::before { transform: rotate(90deg); }
.blk-derivation, .blk-example { border-left: 1px solid var(--line2); padding-left: 1rem; }
/* a formula's own derivation: closed inside its box until clicked */
.blk .deriv { margin: .55rem 0 0; border-left: 0 !important; background: none !important; padding: 0 !important; }
.blk .deriv > summary { display: inline-flex; padding: .12rem .6rem; border: 1px solid var(--line2); border-radius: 99px; font-family: var(--ui); font-size: .74rem; color: var(--ink2); background: var(--card); }
.blk .deriv > summary:hover { border-color: var(--accent); color: var(--accent); }
.blk .deriv > summary::before { width: .6rem; font-size: .65rem; }
.blk .deriv > summary .blk-k { color: inherit !important; font-weight: 600; letter-spacing: 0; text-transform: none; font-size: .74rem; }
.blk .deriv > summary .blk-n:empty { display: none; }
.blk .deriv[open] > summary { border-color: var(--accent); color: var(--accent); }
.blk .deriv > .blk-b { margin-top: .5rem; padding: .55rem .8rem .3rem !important; border-left: 2px solid var(--line2); background: var(--bg2); border-radius: 0 8px 8px 0; }
.blk .deriv-basis > .blk-b::after, .blk .deriv-check > .blk-b::after { content: none; }
.deriv-beyond { font-family: var(--ui); font-size: .66rem; font-weight: 600; color: var(--muted); border: 1px dashed var(--line2); border-radius: 99px; padding: 0 .4rem; margin-left: .2rem; }

.blk-derivation > summary .blk-k, .blk-example > summary .blk-k { color: var(--ink2); }
.blk-derivation > .blk-b, .blk-example > .blk-b { padding-bottom: .3rem; }
.blk-example > .blk-b::after, .blk-derivation > .blk-b::after { content: "∎"; display: block; text-align: right; color: var(--muted); font-size: .9em; margin-top: -.3em; }
:root[data-look="modern"] .blk-derivation, :root[data-look="modern"] .blk-example { border-left: 0; background: var(--bg2); padding: .1rem 1rem .2rem; }

/* Claude's own explanations */
.blk-extra { background: var(--extra-bg); padding: 0 1rem; border-radius: var(--r); border: 1px dashed color-mix(in srgb, var(--extra) 45%, transparent); }
.blk-extra > summary .blk-k { color: var(--extra); }
.blk-extra > summary .blk-k::before { content: "✦ "; }
.blk-extra > summary .blk-n { font-weight: 600; color: var(--ink2); }
.blk-extra > .blk-b { padding: 0 0 .8rem; }
.blk-extra > .blk-b::before { content: "Claude's explanation — not from the handout"; display: block; font-family: var(--ui); font-size: .68rem; color: var(--extra); opacity: .8; margin: -.15rem 0 .4rem; letter-spacing: .02em; }

/* cram (compact only) */
.blk-cram { background: var(--cram-bg); border-radius: var(--r); padding: .55rem 1rem .6rem 1rem; border-left: 3px solid var(--cram); }
.blk-cram::before { content: "Key points"; display: block; font-family: var(--ui); font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; font-weight: 750; color: color-mix(in srgb, var(--cram) 70%, var(--ink)); margin-bottom: .1rem; }
.blk-cram ul { margin: .2em 0; padding-left: 1.1em; }
.blk-cram li { margin: .12em 0; }

/* try now */
.blk-try { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; padding: .45rem .75rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); font-family: var(--ui); font-size: .85rem; }
.blk-try > .blk-k { color: var(--accent); }
.blk-try > .blk-b { display: contents; }
.blk-try p { margin: 0; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.qref { display: inline-flex; align-items: center; gap: .25rem; padding: .08rem .5rem; border-radius: 99px; background: var(--def-bg); color: var(--accent); font-family: var(--ui); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.qref:hover { text-decoration: none; background: var(--accent); color: var(--bg); }
.qref::before { content: "✎"; font-size: .75em; }
.qref.done { background: var(--res-bg); color: var(--res); }
.qref.done::before { content: "✓"; }
.qref.stuck { background: var(--warn-bg); color: var(--warn); }
.qref.stuck::before { content: "?"; }
.qref.missing { background: var(--bg2); color: var(--muted); }

/* asides: margin notes */
.blk-aside { float: right; clear: right; width: var(--margin); margin: .2rem calc(-1 * (var(--margin) + var(--gap))) .8rem 0; font-size: .82em; line-height: 1.45; color: var(--ink2); padding-left: .8rem; border-left: 2px solid var(--line2); }
:root[data-look="modern"] .blk-aside { font-size: .8rem; }

/* badges */
.badge { font-size: .66rem; font-weight: 700; letter-spacing: .04em; padding: .05rem .4rem; border-radius: 4px; text-transform: uppercase; white-space: nowrap; }
.badge.db { color: var(--res); border: 1px solid color-mix(in srgb, var(--res) 45%, transparent); }
.badge.mem { color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }

/* refs */
a.ref { color: inherit; border-bottom: 1px dotted var(--accent); }
a.ref:hover { text-decoration: none; color: var(--accent); }
.ref-missing { border-bottom: 1px dotted var(--muted); }
.nfix { border-bottom: 2px solid var(--res); cursor: help; }
/* written from a gapped handout (guesses) and, after the filled one's check, what it corrected */
.guess { border-bottom: 1.5px dotted var(--guess); padding-bottom: 1px; cursor: help; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.guessed .eqn .katex-display > .katex, .blk-guess .eqn .katex-display > .katex { border-bottom: 1.5px dotted var(--guess); padding-bottom: 3px; width: fit-content; max-width: 100%; margin-inline: auto; }
.blk-guess, .blk-checked { position: relative; }
.blk-guess > .blk-b > p, .blk-guess > .blk-b > ul, .blk-guess > .blk-b > ol { text-decoration: underline dotted var(--guess); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.gmark { font-family: var(--ui); font-size: .78rem; font-weight: 650; color: var(--guess); cursor: help; margin-left: auto; padding: 0 .1rem; line-height: 1; }
.blk-h .gmark { margin-left: .5rem; }
.blk-guess > .gmark, .blk-checked > .gmark, figure > .gmark, aside > .gmark { position: absolute; left: -1.1rem; top: .35rem; }
summary .gmark { margin-left: .4rem; }
.gchk, .gchk-b > .blk-b, .blk-checked.gchk-b { background: var(--chk-bg); border-radius: 3px; cursor: help; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.gchk-m { color: var(--chk); }
.lm-g { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--guess); cursor: help; }
.pop-tip { max-width: 18rem; }
.pop-tip .pop-b { font-family: var(--ui); font-size: .82rem; line-height: 1.45; padding: .55rem .7rem; }
@media (max-width: 700px) { .blk-guess > .gmark, .blk-checked > .gmark, figure > .gmark, aside > .gmark { left: auto; right: .2rem; top: .2rem; } }
.backlinks { font-family: var(--ui); font-size: .72rem; color: var(--muted); margin-top: .4rem; }

/* ------------------------------------------------------------------ figures */
figure.blk { margin: 1.4em 0; text-align: center; }
figure.blk > .blk-b { display: flex; justify-content: center; }
figure.blk svg { max-width: 100%; height: auto; overflow: visible; }
figure.size-l svg { width: 100% !important; }
figure.size-s { float: right; clear: right; width: var(--margin); margin: .3rem calc(-1 * (var(--margin) + var(--gap))) .8rem 0; }
figure.size-s svg { width: 100% !important; }
figcaption { font-size: .8rem; color: var(--ink2); margin-top: .45rem; line-height: 1.45; text-align: center; }
figcaption .blk-k { color: var(--muted); margin-right: .35rem; }
figure .blk-b > p { font-family: var(--ui); font-size: .8rem; color: var(--ink2); margin: .3rem 0 0; }
figure.blk > .blk-b { flex-direction: column; align-items: center; }
img.crop { max-width: 100%; border-radius: var(--r); border: 1px solid var(--line); background: #fff; }
:root[data-theme="dark"] img.crop { filter: invert(.88) hue-rotate(180deg); }
.fig-error { color: var(--muted); font-family: var(--ui); font-size: .8rem; padding: 1rem; border: 1px dashed var(--line2); border-radius: var(--r); }

/* SVG drawing classes (the model's figures) */
figure svg { font-family: KaTeX_Main, "Latin Modern Roman", Georgia, serif; }
:root[data-look="modern"] figure svg { font-family: KaTeX_Main, Georgia, serif; }
figure svg text { fill: var(--ink); stroke: none; font-size: 14px; }
figure svg tspan { fill: inherit; }
figure svg text.m { font-family: KaTeX_Math, KaTeX_Main, serif; font-style: italic; }
figure svg text.v { font-family: KaTeX_Main, serif; font-weight: 700; font-style: normal; }
figure svg .sub { font-size: 75%; baseline-shift: sub; }
figure svg .sup { font-size: 75%; baseline-shift: super; }
figure svg line, figure svg path, figure svg polyline, figure svg circle, figure svg ellipse, figure svg rect, figure svg polygon { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
figure svg .ink { stroke: var(--ink); } figure svg text.ink { fill: var(--ink); }
figure svg .muted { stroke: var(--muted); } figure svg text.muted { fill: var(--muted); }
figure svg .dash { stroke-dasharray: 5 4; }
figure svg .c1 { stroke: var(--c1); } figure svg .c2 { stroke: var(--c2); } figure svg .c3 { stroke: var(--c3); }
figure svg .c4 { stroke: var(--c4); } figure svg .c5 { stroke: var(--c5); } figure svg .c6 { stroke: var(--c6); }
figure svg text.c1 { fill: var(--c1); } figure svg text.c2 { fill: var(--c2); } figure svg text.c3 { fill: var(--c3); }
figure svg text.c4 { fill: var(--c4); } figure svg text.c5 { fill: var(--c5); } figure svg text.c6 { fill: var(--c6); }
figure svg text { stroke: none !important; paint-order: stroke; }
figure svg .fill-c1 { fill: var(--c1); fill-opacity: .14; } figure svg .fill-c2 { fill: var(--c2); fill-opacity: .14; }
figure svg .fill-c3 { fill: var(--c3); fill-opacity: .14; } figure svg .fill-c4 { fill: var(--c4); fill-opacity: .16; }
figure svg .fill-c5 { fill: var(--c5); fill-opacity: .14; } figure svg .fill-c6 { fill: var(--c6); fill-opacity: .14; }
figure svg .fill-ink { fill: var(--ink); } figure svg .fill-bg { fill: var(--bg); }
figure svg .mk { stroke: none; fill: var(--ink); }
figure svg .mk-c1 { fill: var(--c1); } figure svg .mk-c2 { fill: var(--c2); } figure svg .mk-c3 { fill: var(--c3); }
figure svg .mk-c4 { fill: var(--c4); } figure svg .mk-c5 { fill: var(--c5); } figure svg .mk-c6 { fill: var(--c6); }
.defs { position: absolute; width: 0; height: 0; }

/* widgets */
.widget { width: 100%; position: relative; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); overflow: hidden; }
.widget iframe { border: 0; width: 100%; height: 100%; display: block; }
.widget-ph { display: grid; place-items: center; height: 100%; color: var(--muted); font-family: var(--ui); font-size: .8rem; }
.widget-badge { position: absolute; right: .5rem; top: .4rem; font-family: var(--ui); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--accent); background: var(--bg); padding: 0 .3rem; border-radius: 3px; z-index: 1; pointer-events: none; }

/* ------------------------------------------------------------------ densities */
/* Compact: headings + cram + core + try; the rest is replaced by fold markers (notes.js) */
html[data-density="compact"] .content .dz-hide { display: none; }
html[data-density="compact"] .content .dz-hide.dz-open { display: revert; }
html[data-density="compact"] .content details.blk.dz-open { display: block; }
html[data-density="compact"] .content figure.dz-open { display: block; }
.content .dz-open { animation: dzin .18s ease-out; }
@keyframes dzin { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
html:not([data-density="compact"]) .blk-cram { display: none; }
html:not([data-density="compact"]) .fold { display: none; }
html[data-density="compact"] .content h2 { margin-top: 1.6rem; }
html[data-density="compact"] .blk-def, html[data-density="compact"] .blk-eq, html[data-density="compact"] .blk-result { margin: .6em 0; }
html[data-density="compact"] .content p.dz-open, html[data-density="compact"] .content .dz-open { box-shadow: -1rem 0 0 -0.85rem var(--line2); }
.fold { display: flex; align-items: center; gap: .45rem; margin: .25rem 0; padding: .1rem .55rem; border: 1px dashed var(--line2); border-radius: 99px; width: fit-content; max-width: 100%; color: var(--muted); font-size: .74rem; cursor: pointer; background: none; font-family: var(--ui); }
.fold:hover { color: var(--accent); border-color: var(--accent); }
.fold::before { content: "▸"; font-size: .7rem; }
.fold.open::before { content: "▾"; }
.fold .what { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-expand { font-family: var(--ui); font-size: .68rem; font-weight: 500; margin-left: .6rem; color: var(--muted); border: 0; background: none; cursor: pointer; vertical-align: .2em; padding: 0; }
.h-expand:hover { color: var(--accent); }
html:not([data-density="compact"]) .h-expand { display: none; }
/* Normal: extras closed (one-line marker); Expanded: open */

/* recall mode */
html[data-recall="1"] .content .blk-def > .blk-b, html[data-recall="1"] .content .blk-eq > .blk-b, html[data-recall="1"] .content .blk-result > .blk-b { filter: blur(7px); cursor: pointer; transition: filter .15s; user-select: none; }
html[data-recall="1"] .content .blk.revealed > .blk-b { filter: none; user-select: auto; }

/* ------------------------------------------------------------------ pager */
.pager { display: flex; justify-content: space-between; gap: 1rem; max-width: var(--content); margin-top: 4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font-size: .85rem; }
.pager a { display: flex; flex-direction: column; gap: .1rem; max-width: 48%; }
.pager a span { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.pager .next { text-align: right; margin-left: auto; }

/* ------------------------------------------------------------------ popovers & modals */
.pop { position: absolute; z-index: 60; width: min(30rem, calc(100vw - 2rem)); max-height: 70vh; overflow: auto; background: var(--card); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.06); padding: .8rem 1rem; font-size: .88rem; }
.pop .pop-h { display: flex; justify-content: space-between; gap: .6rem; font-size: .78rem; color: var(--muted); margin-bottom: .4rem; }
.pop .pop-b { font-family: var(--text); font-size: 1rem; }
:root[data-look="modern"] .pop .pop-b { font-size: .92rem; }
.pop img { max-width: 100%; display: block; border-radius: 6px; background: #fff; }
:root[data-theme="dark"] .pop img.paper { filter: invert(.88) hue-rotate(180deg); }
.modal-back { position: fixed; inset: 0; z-index: 70; background: rgba(15, 16, 20, .45); display: grid; place-items: center; padding: 1rem; animation: fadein .15s; }
@keyframes fadein { from { opacity: 0; } }
.modal { background: var(--bg); border-radius: 14px; width: min(46rem, 100%); max-height: calc(100vh - 2rem); overflow: auto; box-shadow: 0 24px 80px rgba(0,0,0,.3); }
.modal.big { width: min(64rem, 100%); height: calc(100vh - 2rem); display: flex; flex-direction: column; overflow: hidden; }
.modal-h { display: flex; align-items: center; gap: .6rem; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); font-size: .9rem; }
.modal-h .x { margin-left: auto; border: 0; background: none; font-size: 1.3rem; cursor: pointer; color: var(--muted); }
.modal-b { padding: 1rem 1.2rem; }
.modal.big iframe { border: 0; flex: 1; width: 100%; }

/* search */
.search-box { padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.search-box input { width: 100%; font: inherit; font-family: var(--ui); font-size: 1.05rem; border: 0; outline: none; background: none; color: var(--ink); }
.search-res { max-height: 60vh; overflow: auto; padding: .3rem 0; font-family: var(--ui); }
.search-res a { display: flex; gap: .7rem; align-items: baseline; padding: .45rem 1.1rem; color: var(--ink); font-size: .9rem; }
.search-res a.on, .search-res a:hover { background: var(--bg2); text-decoration: none; }
.search-res .k { flex: none; width: 4.5rem; font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.search-res .c { margin-left: auto; color: var(--muted); font-size: .76rem; white-space: nowrap; }

/* ------------------------------------------------------------------ embed (notes inside a pop-up) */
html.embed .top, html.embed .nav, html.embed .pager { display: none; }
html.embed .layout { grid-template-columns: minmax(0, 1fr); }
html.embed .main.topic { padding: 1.2rem 1.4rem 3rem; max-width: none; padding-right: calc(var(--margin) + var(--gap) * 1.2); }
.flash { animation: flash 2.2s ease-out; }
@keyframes flash { 0%, 30% { background: color-mix(in srgb, var(--hl) 80%, transparent); } }

/* ------------------------------------------------------------------ phone & narrow */
@media (max-width: 1180px) {
  .main.topic { padding-right: var(--gap); max-width: calc(var(--content) + var(--gap) * 2); }
  .blk-aside, figure.size-s { float: none; width: auto; margin: 1rem 0; }
  figure.size-s svg { width: min(100%, 20rem); }
  .searchbtn { min-width: 0; }
  .searchbtn .lbl { display: none; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .nav { position: fixed; z-index: 50; top: 52px; left: 0; width: min(20rem, 85vw); transform: translateX(-102%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  body.nav-open .nav { transform: none; }
  .navbtn { display: block; }
  .tabs { display: none; }
  .main, .main.topic { padding: 1.3rem 1rem 4rem; }
  .topic-head h1 { font-size: 1.85rem; }
  :root { --fs: 17px; }
  :root[data-look="modern"] { --fs: 16px; }
  .seg button { padding: 0 .55rem; }
  .seg button .l { display: none; }
  .seg button .s { display: inline; }
  .tools { gap: .3rem; }
  .tbtn { padding: 0 .5rem; }
  .tbtn .lbl { display: none; }
  .top { gap: .5rem; padding: 0 .6rem; }
  .brand .bt { display: none; }
  html.embed .main.topic { padding: 1rem; }
}
.mobile-tabs { display: none; }
@media (max-width: 860px) {
  .mobile-tabs { display: flex; position: fixed; z-index: 45; bottom: 0; left: 0; right: 0; background: var(--bg); border-top: 1px solid var(--line); padding: .3rem .4rem calc(.3rem + env(safe-area-inset-bottom)); justify-content: space-around; font-family: var(--ui); font-size: .72rem; }
  .mobile-tabs a { display: flex; flex-direction: column; align-items: center; gap: .1rem; color: var(--muted); padding: .2rem .6rem; }
  .mobile-tabs a.on { color: var(--accent); font-weight: 650; }
  .mobile-tabs .i { font-size: 1.1rem; line-height: 1; }
  body { padding-bottom: 3.6rem; }
}

/* ------------------------------------------------------------------ index pages */
.page-h { font-family: var(--head); font-size: 2.1rem; margin: .2rem 0 .3rem; letter-spacing: -.01em; }
.page-sub { color: var(--ink2); margin: 0 0 2rem; font-size: .95rem; font-family: var(--ui); }
.muted { color: var(--muted); }
.paper-card { margin: 0 0 2.2rem; max-width: 70rem; }
.paper-card h2 { font-family: var(--head); font-size: 1.25rem; margin: 0 0 .7rem; }
.paper-card .code { color: var(--accent); font-family: var(--ui); font-weight: 750; margin-right: .3rem; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .8rem; }
.course-card { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font-family: var(--ui); font-size: .9rem; transition: border-color .15s, transform .15s; }
.course-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.course-card b { font-size: 1rem; }
.mini-topics { margin: .4rem 0 0; padding-left: 1.2rem; color: var(--ink2); font-size: .8rem; }
.course-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 2.5rem; max-width: 72rem; font-family: var(--ui); }
.sec-h { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 1.2rem 0 .5rem; }
.topic-list { list-style: none; padding: 0; margin: 0; }
.topic-list li { display: flex; align-items: baseline; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.topic-list li.later { color: var(--muted); }
.topic-list .num { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: .3rem; }
.topic-list .lecs { margin-left: auto; display: flex; gap: .25rem; }
.set-list, .lec-list { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.set-list li, .lec-list li { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.lec-list .num { display: inline-block; width: 2.4rem; color: var(--muted); }
.lec-list .st-scheduled { color: var(--muted); }
.mat-nav { display: flex; gap: .5rem; margin: .6rem 0 1rem; }
.mat-page { max-width: min(100%, 900px); border: 1px solid var(--line); border-radius: 8px; background: #fff; }
:root[data-theme="dark"] .mat-page { filter: invert(.88) hue-rotate(180deg); }
@media (max-width: 860px) { .course-cols { grid-template-columns: 1fr; gap: 0; } .page-h { font-size: 1.7rem; } }

.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mobile-tabs .ic { width: 20px; height: 20px; }

.main { overflow-x: clip; }
@media (max-width: 860px) {
  .tools [data-act=recall] { display: none; }
  .tools .seg[aria-label=Look] button { padding: 0 .4rem; font-size: .75rem; }
  .searchbtn { border: 0; background: none; padding: 0 .3rem; }
}
@media (max-width: 400px) {
  .tools [data-act=theme] { display: none; }
}

/* ------------------------------------------------------------------ buttons, cards, alerts */
.btn { font-family: var(--ui); font-size: .85rem; border: 1px solid var(--line2); background: var(--card); color: var(--ink); border-radius: 8px; padding: .4rem .85rem; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; }
.btn:hover { border-color: var(--ink2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #10131a; }
.btn.small { font-size: .78rem; padding: .25rem .6rem; }
.btn.tiny { font-size: .7rem; padding: .1rem .45rem; border-radius: 6px; }
.btn.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn:disabled { opacity: .55; cursor: default; }
.small { font-size: .82rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.15rem 1.1rem; margin: 0 0 1rem; font-family: var(--ui); font-size: .9rem; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; font-size: .95rem; }
.alert { font-family: var(--ui); font-size: .88rem; padding: .65rem .9rem; border-radius: 10px; margin: 0 0 1rem; max-width: 72rem; }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-info { background: var(--def-bg); color: var(--accent); }
.alert-ask { background: var(--eq-bg); color: var(--eq); }
.toast { position: fixed; z-index: 90; left: 50%; bottom: 1.4rem; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-family: var(--ui); font-size: .88rem; padding: .7rem 1.1rem; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); transition: opacity .5s; max-width: calc(100vw - 2rem); }
.toast.out { opacity: 0; }
@media (max-width: 860px) { .toast { bottom: 4.6rem; } }

/* ------------------------------------------------------------------ today */
.dash { max-width: 76rem; }
.dash-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.dash-date { color: var(--muted); font-family: var(--ui); }
.card.ask { border-color: color-mix(in srgb, var(--eq) 45%, var(--line)); background: var(--eq-bg); }
.ask-list { margin: 0 0 .8rem; padding-left: 1.1rem; }
.prog { padding: .55rem 0; border-top: 1px solid var(--line); }
.prog:first-child { border-top: 0; }
.prog-t { font-size: .88rem; margin-bottom: .35rem; }
.bar { height: 7px; border-radius: 9px; background: var(--bg3); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 9px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .6s ease; position: relative; }
.prog.st-writing .bar span::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); animation: shimmer 1.6s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.prog.st-waiting .bar span, .prog.st-queued .bar span { background: var(--line2); }
.prog.st-error .bar span { background: var(--warn); width: 100% !important; }
.prog-s { display: flex; justify-content: space-between; color: var(--muted); font-size: .76rem; margin-top: .25rem; }
.day-h { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: .8rem 0 .3rem; }
.day-h:first-of-type { margin-top: 0; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { padding: .3rem 0; border-top: 1px solid var(--line); }
.recent li:first-child { border-top: 0; }
.paper-row { display: grid; grid-template-columns: 1fr 7rem; grid-template-rows: auto auto; gap: .15rem .8rem; padding: .5rem 0; border-top: 1px solid var(--line); color: var(--ink); }
.paper-row:first-of-type { border-top: 0; }
.paper-row:hover { text-decoration: none; }
.paper-row .small { grid-column: 1 / -1; }
.meter { display: flex; height: 7px; border-radius: 9px; background: var(--bg3); overflow: hidden; align-self: center; width: 100%; }
.meter .m-done { background: var(--res); } .meter .m-can { background: color-mix(in srgb, var(--res) 35%, var(--bg3)); }
.stuckc { color: var(--warn); }
.worker { margin-top: .4rem; }

/* ------------------------------------------------------------------ examples list */
.ex-card .meter { margin: .45rem 0 .2rem; }

/* ------------------------------------------------------------------ paper viewer */
.paper-view { max-width: 88rem; }
.paper-meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .3rem 0 1.2rem; font-family: var(--ui); }
.pill.filt { cursor: pointer; }
.pill.filt input { margin: 0 .25rem 0 0; }
/* rows in reading order: a question's piece of the paper, its card beside it (phone: below it) */
.paper-rows { display: flex; flex-direction: column; gap: .9rem; }
.prow { display: grid; grid-template-columns: minmax(0, 50rem) minmax(20rem, 26rem); gap: 1.4rem; align-items: start; scroll-margin-top: 4.5rem; }
.prow-paper { background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.05); padding: .35rem 0; transition: border-color .15s, box-shadow .15s, opacity .2s; }
.prow.other .prow-paper { background: #fff; border-style: dashed; box-shadow: none; }
.prow.hl .prow-paper { border-color: var(--accent); box-shadow: 0 6px 22px rgba(0,0,0,.08); }
.prow.dim .prow-paper { opacity: .3; }
.prow-side { position: sticky; top: 4.2rem; }
.crop { position: relative; overflow: hidden; width: 100%; }
.crop img { position: absolute; left: 0; top: 0; display: block; max-width: none; }
.crop.side { margin: 0 auto; }
.crop.side img { position: static; width: 100%; }
.pbreak { display: flex; align-items: center; gap: .5rem; margin: .25rem .8rem; font-family: var(--ui); font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: #9aa0a6; }
.pbreak::before, .pbreak::after { content: ""; flex: 1; border-top: 1px dashed #d5d8dc; }
:root[data-theme="dark"] .prow-paper { filter: invert(.88) hue-rotate(180deg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .prow-paper { filter: invert(.88) hue-rotate(180deg); } }
.qcard { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .85rem .75rem; font-family: var(--ui); font-size: .85rem; transition: box-shadow .2s, border-color .2s, opacity .2s; }
.qcard.hl, .qcard:hover { border-color: var(--accent); box-shadow: 0 6px 22px rgba(0,0,0,.07); }
.qcard.is-done { border-color: color-mix(in srgb, var(--res) 45%, var(--line)); }
.qcard.dim { opacity: .35; }
.qcard.flash { animation: flash 2s ease-out; }
.qc-h { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .3rem; }
.qc-h b { font-size: 1rem; }
.lvl { font-size: .7rem; color: var(--muted); }
.mark { margin-left: auto; font-size: .74rem; font-weight: 650; }
.mark.m-solved, .mark.m-done { color: var(--res); } .mark.m-revealed { color: var(--eq); } .mark.m-stuck { color: var(--warn); }
.qst { font-size: .78rem; font-weight: 600; margin: .1rem 0 .3rem; }
.qst.can { color: var(--res); } .qst.later { color: var(--eq); }
.qtag { font-size: .74rem; color: var(--accent); margin-bottom: .3rem; }
.qlinks { display: flex; flex-wrap: wrap; gap: .2rem .55rem; font-size: .8rem; margin: .2rem 0 .5rem; }
.answers { border-top: 1px solid var(--line); padding-top: .5rem; margin-top: .4rem; display: flex; flex-direction: column; gap: .55rem; }
.arow { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; }
.apart { font-weight: 650; color: var(--ink2); min-width: 1.6rem; }
.ainner { display: flex; flex-wrap: wrap; gap: .35rem .6rem; }
.abtns { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.ares { font-size: .78rem; font-weight: 650; }
.ares.ok { color: var(--res); } .ares.bad { color: var(--warn); } .ares.hint { color: var(--muted); font-weight: 500; }
.printed { flex-basis: 100%; font-size: .84rem; color: var(--ink2); background: var(--bg2); border-radius: 6px; padding: .3rem .55rem; }
.ansbox { position: relative; display: inline-flex; align-items: center; gap: .2rem; padding: .2rem .35rem; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg); cursor: text; }
.ansbox.focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.ansbox.ok { border-color: var(--res); background: var(--res-bg); }
.ansbox.bad { border-color: var(--warn); }
.ansbox.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.ansbox .hid { position: absolute; inset: 0; opacity: 0; width: 100%; border: 0; font-size: 16px; cursor: text; }
.ansbox .albl { margin-right: .2rem; }
.ansbox .sg { position: relative; z-index: 1; border: 0; background: var(--bg3); border-radius: 5px; font-size: .72rem; padding: .05rem .3rem; cursor: pointer; color: var(--ink2); }
.ansbox .sgn { min-width: .5rem; text-align: center; font-weight: 700; }
.cells { display: inline-flex; align-items: flex-end; gap: 2px; }
.cell { width: 1.05rem; height: 1.5rem; border-bottom: 2px solid var(--line2); display: inline-grid; place-items: center; font-family: KaTeX_Main, Georgia, serif; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.cell.cur { border-bottom-color: var(--accent); }
.ansbox.shown .cell { color: var(--eq); }
.dot { font-weight: 700; padding: 0 1px; font-size: 1.1rem; line-height: 1; }
.exp, .unit { margin-left: .2rem; font-family: KaTeX_Main, Georgia, serif; }
.unit .katex { font-size: 1em; }
.qmarks { display: flex; gap: .3rem; margin-top: .55rem; }
.qmarks .btn.on { background: var(--ink); color: var(--bg); }
.noans { margin-top: .3rem; }
@media (max-width: 980px) {
  .prow { grid-template-columns: 1fr; gap: .5rem; }
  .prow.q { padding-bottom: .5rem; }
  .prow-side { position: static; }
}

/* ------------------------------------------------------------------ coverage sheet */
.cov-sheet { width: min(44rem, 100%); display: flex; flex-direction: column; max-height: calc(100vh - 2rem); }
.cov-sheet .modal-h { align-items: flex-start; }
.cov-k { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.cov-n { margin-left: auto; font-size: .78rem; color: var(--muted); white-space: nowrap; padding-top: .2rem; }
.cov-sheet .x { margin-left: .6rem; }
.cov-sheet .modal-b { overflow: auto; flex: 1; padding-top: .6rem; font-family: var(--ui); }
.cov-q { margin: 0 0 .7rem; font-size: .9rem; }
.cov-list { display: flex; flex-direction: column; gap: 2px; }
.cov-topic { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: .7rem 0 .2rem; }
.cov-u { display: grid; grid-template-columns: 3.6rem 1fr auto; align-items: center; gap: .7rem; text-align: left; border: 1px solid transparent; background: none; border-radius: 9px; padding: .3rem .45rem; cursor: pointer; font-size: .88rem; color: var(--ink); }
.cov-u:hover { background: var(--bg2); }
.cov-u img { width: 3.6rem; border: 1px solid var(--line); border-radius: 4px; background: #fff; display: block; }
.cov-u .nothumb, .cov-u .thumb-sp { width: 3.6rem; font-size: .7rem; color: var(--muted); text-align: center; }
.cov-u .num { color: var(--muted); }
.cov-u .cov-r { font-size: .7rem; color: var(--muted); text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.cov-u.done { opacity: .45; cursor: default; }
.cov-u.skip .cov-t { color: var(--muted); }
.cov-u.guess .cov-r { color: var(--eq); font-weight: 650; }
.cov-u.inrange { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.cov-u.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.cov-u.sel .cov-t { font-weight: 650; }
.cov-rem { display: block; margin-top: 1rem; font-size: .84rem; }
.cov-rem textarea, .modal textarea { display: block; width: 100%; margin-top: .3rem; font: inherit; font-size: .9rem; border: 1px solid var(--line2); border-radius: 8px; padding: .5rem .6rem; background: var(--bg); color: var(--ink); resize: vertical; }
.modal-f { display: flex; align-items: center; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--line); font-family: var(--ui); }
.modal-f .sp { flex: 1; }
.fb-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .85rem; padding: 0 .2rem; opacity: 0; transition: opacity .15s; font-family: var(--ui); }
.blk:hover .fb-btn, h2:hover .fb-btn, h3:hover .fb-btn { opacity: 1; }
@media (hover: none) { .fb-btn { opacity: .6; } }
.fb-ex { margin: 0 0 .6rem; padding: .4rem .7rem; border-left: 3px solid var(--line2); color: var(--ink2); font-size: .85rem; max-height: 6rem; overflow: hidden; }
@media (max-width: 860px) {
  .modal-back.cov { padding: 0; align-items: end; }
  .cov-sheet { border-radius: 16px 16px 0 0; max-height: 92vh; width: 100%; }
  .cov-u { grid-template-columns: 2.8rem 1fr auto; }
  .cov-u img, .cov-u .nothumb, .cov-u .thumb-sp { width: 2.8rem; }
  .modal-f { flex-wrap: wrap; }
}

/* ------------------------------------------------------------------ timetable */

/* ------------------------------------------------------------------ formulas */
.formulas { max-width: 80rem; }
.f-tools { display: flex; gap: .6rem; align-items: center; margin: .4rem 0 1.2rem; font-family: var(--ui); }
.f-course { font-family: var(--head); font-size: 1.4rem; margin: 2rem 0 .4rem; }
.f-topic { font-family: var(--ui); font-size: .95rem; margin: 1.2rem 0 .5rem; }
.f-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); gap: .7rem; max-width: none; }
.f-grid .f-item { margin: 0; font-size: .92em; }
.f-grid .f-item .blk-h { justify-content: space-between; }
@media print { .top, .nav, .f-tools, .mobile-tabs { display: none !important; } .layout { display: block; } .f-grid { grid-template-columns: 1fr 1fr; } }

/* ------------------------------------------------------------------ admin */
.admin { max-width: 76rem; }
.tbl { width: 100%; border-collapse: collapse; font-family: var(--ui); }
.tbl th, .tbl td { text-align: left; padding: .35rem .45rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tbl .acts { white-space: nowrap; }
.tbl .acts form { display: inline; }
.tbl tr.unfilled td:nth-child(2) { color: var(--muted); }
.tbl tr.st-skipped, .tbl tr.st-duplicate { opacity: .5; }
.mini { display: flex; gap: .25rem; flex-wrap: wrap; }
.mini select, .row-form input, .row-form select { font: inherit; font-size: .8rem; padding: .2rem .3rem; border: 1px solid var(--line2); border-radius: 6px; background: var(--bg); color: var(--ink); }
.row-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.row-form input[type=password] { min-width: 18rem; }
.issues li { margin: .3rem 0; }
.audit-run { margin: .35rem 0; }
.audit-run summary { cursor: pointer; }
.audit-run ul { margin: .35rem 0 .6rem; padding-left: 1.1rem; }
.audit-run li { margin: .3rem 0; overflow-wrap: anywhere; }
.audit-run .pill { font-size: .7rem; padding: .02rem .45rem; }
.login-box { max-width: 24rem; margin: 12vh auto; font-family: var(--ui); padding: 0 1rem; }
.login-box label { display: block; margin: .8rem 0; font-size: .85rem; }
.login-box input { display: block; width: 100%; margin-top: .25rem; font: inherit; padding: .5rem .6rem; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg); color: var(--ink); }
.err { color: var(--warn); }
.acct .card { max-width: 34rem; }
/* the settings page (templates/settings.html; the plan's cards drawn by static/plan.js) */
.settings .card { max-width: 40rem; }
.settings .page-sub { margin-bottom: 1rem; }
.set-toc { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 1.2rem; max-width: 40rem; font-family: var(--ui); font-size: .8rem; }
.set-toc a { padding: .2rem .6rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink2); text-decoration: none; background: var(--card); }
.set-toc a:hover { border-color: var(--line2); color: var(--ink); }
.set-card, #account { scroll-margin-top: 4.5rem; }
.set-card .card-h { flex-wrap: wrap; justify-content: flex-start; gap: .2rem .7rem; }
.set-card .card-h .muted { font-size: .8rem; }
.set-save { display: flex; justify-content: flex-end; }
.set-warn { color: var(--warn); }
.set-ntr { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.set-ntr input[type=time] { flex: 0 0 auto; }
.set-ntf label.chk, .set-dens label.chk { align-items: flex-start; color: var(--ink); }
.set-ntf label.chk input, .set-dens label.chk input { flex: 0 0 auto; width: auto; margin-top: .2rem; }
.settings .card-h { flex-wrap: wrap; justify-content: flex-start; gap: .2rem .7rem; }
.set-h2 { font-size: 1.05rem; margin: 2rem 0 .8rem; font-family: var(--ui); }
.pl-wk-h span { font-size: .72rem; }
.stack-form label { display: block; margin: .6rem 0; font-size: .85rem; font-family: var(--ui); }
.stack-form input { display: block; width: 100%; max-width: 22rem; margin-top: .25rem; font: inherit; padding: .45rem .6rem; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg); color: var(--ink); }
.btn.danger { color: var(--warn); border-color: var(--warn); }
.card.danger { border-color: var(--warn-bg); }
.members .acts { white-space: nowrap; }
.members .linkout { font-family: var(--mono, monospace); font-size: .75rem; word-break: break-all; user-select: all; background: var(--eq-bg); padding: .35rem .5rem; border-radius: 6px; margin: .4rem 0; }
.ansbox:not(.focus) .cell.cur { border-bottom-color: var(--line2); }

.float-prog { position: fixed; z-index: 55; right: 1rem; bottom: 1rem; width: 17rem; background: var(--card); border: 1px solid var(--line2); border-radius: 12px; padding: .55rem .75rem .6rem; box-shadow: 0 8px 28px rgba(0,0,0,.12); font-family: var(--ui); font-size: .8rem; color: var(--ink); display: flex; flex-direction: column; gap: .3rem; }
.float-prog:hover { text-decoration: none; border-color: var(--accent); }
.float-prog .fp-s { color: var(--muted); font-size: .72rem; }
@media (max-width: 860px) { .float-prog { bottom: 4.4rem; right: .6rem; left: .6rem; width: auto; } }

/* ------------------------------------------------------------------ tree: lectures, headings, papers */
.tn-lec > .tn-row a { font-size: .8rem; color: var(--ink2); }
.tn-lec > .tn-row a .d { color: var(--muted); font-size: .72rem; margin-left: .25em; }
.tn-h > .tn-row a { font-size: .78rem; color: var(--muted); }
.tn-h > .tn-row a .katex { font-size: 1em; }
.tn.tn-on > .tn-row { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.tn.tn-on > .tn-row a { color: var(--accent); }
.tn-group > .tn-row a.grp, .tn-fs > .tn-row a.grp { font-size: .78rem; color: var(--muted); font-weight: 600; }
.tn-set > .tn-row a { font-size: .8rem; }
.tn-fs { margin-top: .15rem; }

/* ------------------------------------------------------------------ side panel */
.sheet-back { position: fixed; inset: 0; z-index: 64; background: rgba(15, 16, 20, .32); opacity: 0; pointer-events: none; transition: opacity .18s; }
.sheet-back.on { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; z-index: 65; top: 0; right: 0; bottom: 0; width: min(48rem, 94vw); display: flex; flex-direction: column; background: var(--bg);
  box-shadow: -18px 0 60px rgba(0,0,0,.18); transform: translateX(104%); transition: transform .22s cubic-bezier(.2,.8,.3,1); visibility: hidden; }
.sheet.on { transform: none; visibility: visible; }
body.sheet-on { overflow: hidden; }
.sheet-h { display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem .7rem 1rem; border-bottom: 1px solid var(--line); font-family: var(--ui); }
.sh-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sh-t b { font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-k { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.sh-x, .sh-back { flex: none; width: 2.2rem; height: 2.2rem; border: 0; border-radius: 8px; background: var(--bg2); font-size: 1.35rem; line-height: 1; cursor: pointer; color: var(--ink2); }
.sh-x:hover, .sh-back:hover { background: var(--bg3); color: var(--ink); }
.sh-open { flex: none; white-space: nowrap; }
.sheet-b { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 1.1rem 1.6rem 3rem; }
.sheet-load { display: grid; place-items: center; padding: 4rem 0; }
.sheet .content { max-width: none; }
.sheet .content .blk-aside, .sheet .content figure.size-s { float: none; width: auto; margin: 1rem 0; }
.sheet .content figure.size-s svg { width: min(100%, 20rem) !important; }
.sheet .content h2:first-child, .sheet .content .part > h2:first-of-type { margin-top: .6rem; }
.peek-more { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); font-family: var(--ui); }
.peek-q img { display: block; max-width: 100%; margin: 0 auto .6rem; border-radius: 6px; background: #fff; border: 1px solid var(--line); }
:root[data-theme="dark"] .peek-q img { filter: invert(.88) hue-rotate(180deg); }
.qcard.static { position: static; margin-top: .8rem; }
.pop { z-index: 90; }
.modal-back { z-index: 95; }
.spin { display: inline-block; width: 1.1rem; height: 1.1rem; border: 2px solid var(--line2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -.2em; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 860px) {
  .sheet { top: auto; left: 0; width: auto; height: 90vh; height: 90dvh; border-radius: 16px 16px 0 0; transform: translateY(104%); box-shadow: 0 -12px 50px rgba(0,0,0,.22); }
  .sheet-h { padding: .55rem .6rem .55rem .8rem; }
  .sheet-h::before { content: ""; position: absolute; top: 5px; left: 50%; width: 2.4rem; height: 4px; margin-left: -1.2rem; border-radius: 4px; background: var(--line2); }
  .sh-open { display: none; }
  .sheet-b { padding: 1rem 1rem 3rem; }
}

/* ------------------------------------------------------------------ continuous reading */
.chunk + .chunk { margin-top: 4.5rem; padding-top: 2.4rem; border-top: 3px double var(--line2); max-width: var(--content); }
.chunk + .chunk > .content { max-width: var(--content); }
.chunk-head h1 a { color: inherit; }
.chunk-more { max-width: var(--content); margin: 3rem 0 0; color: var(--muted); font-family: var(--ui); font-size: .85rem; }
.cont-t { display: flex; align-items: center; gap: .4rem; max-width: var(--content); margin-top: .8rem; font-family: var(--ui); font-size: .78rem; color: var(--muted); cursor: pointer; }
.course-end { max-width: var(--content); margin-top: 1.4rem; padding: .9rem 1.1rem; border-radius: 10px; background: var(--bg2); font-family: var(--ui); font-size: .86rem; display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.topic-meta a.pill:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.viewonly { background: var(--bg3); color: var(--muted); }

/* ---------------------------------------------------------------- planner (Today, owner only) */
.planner { max-width: 76rem; font-family: var(--ui); }
.pl-status.st-amber { border-color: color-mix(in srgb, var(--eq) 50%, var(--line)); }
.pl-status.st-red { border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); background: var(--warn-bg); }
.pl-warn { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .86rem; }
.pl-warn .w-red { color: var(--warn); font-weight: 600; }
.pl-warn .w-amber { color: var(--eq); }
.pl-info ul { margin: .2rem 0 0; padding-left: 1.1rem; font-size: .82rem; color: var(--muted); }
.pl-sugg { margin-top: .6rem; padding-top: .5rem; border-top: 1px solid var(--line); }
.pl-sg { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .3rem 0; font-size: .86rem; }
.pl-acts { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .7rem; }
.ev-m { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .3rem; }
.pl-tr { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: .4rem; align-items: start; padding: .3rem 0; border-bottom: 1px dashed var(--line); font-size: .86rem; }
.pl-tr .tx { min-width: 0; overflow-wrap: anywhere; }
.pl-tr .tx a { color: inherit; font-weight: 600; }
.pl-tr.is-late { background: var(--warn-bg); }
.pl-tr .lt { color: var(--warn); }
.pl-tr.is-done .tx a, .pl-tr.is-done .tx > div:first-child { color: var(--muted); text-decoration: line-through; }
.pl-tr input[type=checkbox] { width: 1.05rem; height: 1.05rem; margin-top: .15rem; }
.pill.new { background: var(--def-bg); color: var(--accent); border-color: transparent; }
.pl-more { margin-top: .6rem; }
.pl-more summary { cursor: pointer; font-size: .85rem; font-weight: 600; }
.pl-cmr { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .25rem 0; font-size: .86rem; }
.pl-cmb { display: flex; gap: .3rem; flex-shrink: 0; }
.pl-occ-ch { display: block; margin-top: .1rem; }
.pl-occ-ch .lnk { border: 0; background: none; padding: 0; font: inherit; text-align: left; color: var(--accent, #2563eb); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.pl-occ { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.pl-form .pl-occ label { flex-direction: row; align-items: center; gap: .35rem; color: var(--ink); }
.pl-inl { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .85rem; }
.pl-inl input { flex: 1 1 14rem; min-width: 0; font: inherit; padding: .35rem .5rem; border: 1px solid var(--line2); border-radius: 8px; background: var(--card); color: var(--ink); }
.pl-inl label input { flex: 0 1 auto; width: auto; }
.pl-form { display: flex; flex-direction: column; gap: .6rem; font-family: var(--ui); font-size: .86rem; }
.pl-form label { display: flex; flex-direction: column; gap: .2rem; color: var(--ink2); }
.pl-form label.chk { flex-direction: row; align-items: center; gap: .4rem; }
.pl-form input, .pl-form select, .pl-form textarea { font: inherit; padding: .4rem .5rem; border: 1px solid var(--line2); border-radius: 8px; background: var(--card); color: var(--ink); min-width: 0; }
.pl-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.pl-ci { display: flex; flex-direction: column; gap: .5rem; font-family: var(--ui); font-size: .88rem; }
.pl-cir { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; }
.pl-cir input { width: 6rem; font: inherit; padding: .3rem; border: 1px solid var(--line2); border-radius: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--card); color: var(--ink2); font: inherit; font-size: .8rem; padding: .3rem .6rem; cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; }
@media (max-width: 640px) {
  .pl-form .two { grid-template-columns: 1fr; }
}
.pl-col.today .pl-ch { color: var(--warn); }
.pl-tr .pl-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-tr .pl-sub:hover { white-space: normal; }
.pl-qk { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
/* Study Mountain inside Notes (owner) */
.study-pane { position: fixed; inset: 0; z-index: 95; background: #000; display: flex; flex-direction: column; }
.study-pane iframe { flex: 1; width: 100%; border: 0; background: #1b2430; }
.sp-bar { display: flex; align-items: center; gap: .6rem; padding: .35rem .7rem; padding-top: calc(.35rem + env(safe-area-inset-top)); background: var(--card); font-family: var(--ui); font-size: .85rem; border-bottom: 1px solid var(--line); }
.sp-bar .muted { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.study-open { overflow: hidden; }
.study-pane.closing { display: none; }
/* the Study Mountain bar (static/studybar.js): a walk is on */
.studybar { position: fixed; z-index: 44; left: 50%; transform: translateX(-50%); bottom: 14px; display: flex; align-items: center; gap: .55rem;
  width: max-content; max-width: min(560px, calc(100vw - 24px)); padding: .3rem .35rem .3rem .75rem; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); box-shadow: 0 4px 18px rgba(0, 0, 0, .16); font-family: var(--ui); font-size: .8rem; line-height: 1.25; cursor: pointer; }
.studybar[hidden] { display: none; }
.studybar .sb-dot { flex: none; width: .55rem; height: .55rem; border-radius: 50%; background: #3f9a5c; box-shadow: 0 0 0 0 rgba(63, 154, 92, .5); animation: sb-pulse 2.4s infinite; }
.studybar.brk .sb-dot { background: #d08a2c; animation: none; }
.studybar .sb-main { display: flex; flex-direction: column; min-width: 0; }
.studybar .sb-t, .studybar .sb-s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studybar .sb-s { color: var(--muted); font-size: .74rem; font-variant-numeric: tabular-nums; }
.studybar .sb-go { flex: none; border: 0; border-radius: 999px; padding: .4rem .7rem; background: var(--accent); color: #fff; font: 600 .76rem var(--ui); cursor: pointer; }
.studybar .sb-short { display: none; }
@media (max-width: 480px) { .studybar .sb-long { display: none; } .studybar .sb-short { display: inline; } }
.studybar.flash { animation: sb-flash 1.2s ease-out 3; }
@keyframes sb-pulse { 0% { box-shadow: 0 0 0 0 rgba(63, 154, 92, .45); } 70% { box-shadow: 0 0 0 .45rem rgba(63, 154, 92, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 154, 92, 0); } }
@keyframes sb-flash { 0% { background: var(--accent); color: #fff; } 100% { background: var(--card); } }
.studybar .sb-acts { display: contents; }
.studybar .sb-b { flex: none; border: 1px solid var(--line2); border-radius: 999px; padding: .36rem .6rem; background: var(--bg2); color: var(--ink); font: 600 .74rem var(--ui); cursor: pointer; white-space: nowrap; }
.studybar .sb-b.sb-yes { background: #3f9a5c; border-color: #3f9a5c; color: #fff; }
.studybar .sb-b[hidden] { display: none; }
/* "Did you finish it?" and the next task over the whole screen (owner, a walk on the plan) */
.sb-ask { position: fixed; inset: 0; z-index: 96; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(10, 14, 20, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); font-family: var(--ui); }
.sb-ask[hidden], .sb-ann[hidden] { display: none; }
.sb-ask .sb-card { width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--card); color: var(--ink);
  border-radius: 18px; padding: 1.3rem 1.2rem 1rem; box-shadow: 0 16px 50px rgba(0, 0, 0, .35); text-align: center; }
.sb-ask .sb-k { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.sb-ask .sb-q { font-size: 1.35rem; font-weight: 700; line-height: 1.25; margin: .45rem 0 .2rem; overflow-wrap: anywhere; }
.sb-ask .sb-p { margin: .2rem 0 1rem; color: var(--ink2); }
.sb-ask .sb-btns { display: flex; flex-direction: column; gap: .5rem; }
.sb-ask .sb-btns button { border: 1px solid var(--line2); border-radius: 12px; padding: .75rem .9rem; background: var(--bg2); color: var(--ink); font: 600 .95rem var(--ui); cursor: pointer; }
.sb-ask .sb-btns .sb-yes { background: #3f9a5c; border-color: #3f9a5c; color: #fff; }
.sb-ask .sb-n { margin: .8rem 0 0; font-size: .74rem; color: var(--muted); }
body.sb-asking { overflow: hidden; }
.sb-ann { position: fixed; inset: 0; z-index: 97; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 24px 16px; color: #fff; cursor: pointer; font-family: var(--ui); animation: sb-ann-in .8s ease-out both;
  background: radial-gradient(circle at 50% 45%, rgba(255, 196, 92, .97), rgba(214, 104, 52, .96) 55%, rgba(60, 30, 40, .97)); }
.sb-ann.free { background: radial-gradient(circle at 50% 45%, rgba(120, 170, 220, .97), rgba(40, 70, 110, .97)); }
.sb-ann .sb-ak { font-size: .85rem; letter-spacing: .25em; text-transform: uppercase; opacity: .9; }
.sb-ann .sb-at { font-size: clamp(2rem, 8vw, 4.2rem); font-weight: 800; line-height: 1.1; margin: .6rem 0 .5rem; max-width: 92vw; overflow-wrap: anywhere; }
.sb-ann .sb-as { font-size: 1.05rem; opacity: .92; }
.sb-ann .sb-ab { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 1.6rem; }
.sb-ann .sb-ab button { border: 0; border-radius: 14px; padding: .7rem 1.1rem; font: 600 .95rem var(--ui); background: rgba(255, 255, 255, .93); color: #243; cursor: pointer; }
.sb-ann .sb-ab [data-a=camp] { background: rgba(255, 255, 255, .25); color: #fff; }
.sb-ann .sb-aq { margin-top: 1.6rem; max-width: min(440px, 92vw); padding: .9rem 1rem; border-radius: 16px; background: rgba(0, 0, 0, .22); font-size: .95rem; line-height: 1.35; cursor: default; }
.sb-ann .sb-aq[hidden] { display: none; }
.sb-ann .sb-aq .sb-ab { margin-top: .8rem; }
.sb-ann .sb-aq .sb-2 { background: rgba(255, 255, 255, .25); color: #fff; }
.sb-ann .sb-aqn { font-size: .75rem; opacity: .8; margin-top: .6rem; }
.sb-ann .sb-ah { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); font-size: .8rem; opacity: .75; }
@keyframes sb-ann-in { 0% { opacity: 0; transform: scale(1.04); } 30% { opacity: 1; } 100% { transform: none; } }
body.has-studybar { padding-bottom: 60px; }
body.study-open .studybar { display: none; }
@media (max-width: 860px) {
  .studybar { bottom: calc(62px + env(safe-area-inset-bottom)); }
  body.has-studybar { padding-bottom: 122px; }
}
/* a member's set-up sheet: days off / lighter days, time pairs */
.pl-wks { display: grid; gap: .3rem; }
.pl-wk { display: grid; grid-template-columns: 2.4rem 1fr 1fr 1fr 4.2rem; gap: .3rem; align-items: center; font-size: .8rem; }
.pl-wk input, .pl-wk select { min-width: 0; font: inherit; font-size: .78rem; }
.pl-pair { display: flex; gap: .3rem; } .pl-pair input { min-width: 0; flex: 1; }
.sb-who { font-size: .72rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qmarks .ns.on { background: var(--eq-bg); }

/* What's new (changelog.py) and the tour (tour.js) */
.news { position: fixed; z-index: 60; right: 16px; top: 64px; width: min(24rem, calc(100vw - 32px)); background: var(--card); color: var(--ink);
  border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .14); padding: .75rem .9rem .8rem; font-family: var(--ui); font-size: .92rem; }
.news-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: .35rem; }
.news-h .x { border: 0; background: none; font-size: 1.3rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 .2rem; }
.news ul { margin: 0 0 .6rem; padding-left: 1.1rem; max-height: 50vh; overflow-y: auto; }
.news li { margin: .25rem 0; line-height: 1.4; }
.login-box .hint { margin: -.4rem 0 .6rem; }
.tour-hole { position: fixed; z-index: 90; border-radius: 10px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(10, 12, 18, .5), 0 0 0 3px var(--accent2);
  transition: left .25s, top .25s, width .25s, height .25s; }
.tour-tip { position: fixed; z-index: 91; background: var(--card); color: var(--ink); border: 1px solid var(--line2); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .22); padding: .75rem .9rem; font-family: var(--ui); font-size: .93rem; line-height: 1.45; }
.tour-tip p { margin: .3rem 0 .6rem; }
.tour-k { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tour-btns { display: flex; gap: .4rem; align-items: center; }
.tour-btns .sp { flex: 1; }
.tour-offer { right: 16px; bottom: 16px; width: min(22rem, calc(100vw - 32px)); }
body.has-studybar .tour-offer { bottom: 76px; }
@media (max-width: 860px) {
  .news { top: auto; bottom: calc(70px + env(safe-area-inset-bottom)); }
  body.has-studybar .news, body.has-studybar .tour-offer { bottom: calc(126px + env(safe-area-inset-bottom)); }
  .tour-offer { bottom: calc(70px + env(safe-area-inset-bottom)); }
}

/* ---------------------------------------------------------------- Today's calendar (static/cal.js) */
:root { --c-lec: #4338ca; --c-lec-ink: #fff; --c-lab: #0f766e; --c-lab-ink: #fff; --c-sup: #d97706; --c-sup-bg: #fffbeb; --c-now: #e11d48;
  --c-ok: #16a34a; --c-can: #f59e0b; --c-ask: #e11d48; }
:root[data-theme="dark"] { --c-lec: #5b54e8; --c-lab: #13948a; --c-sup: #f59e0b; --c-sup-bg: #2a2112; --c-now: #fb7185; --c-ok: #22c55e; --c-ask: #fb7185; }
.cal { padding: .75rem .75rem .8rem; max-width: 76rem; }
.cal-loading { margin: .5rem; }
.cal-h { position: relative; display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .45rem; }
.cal-nav, .cal-tools { display: flex; align-items: center; gap: .3rem; }
.cal-m { margin-left: .45rem; font-size: .95rem; white-space: nowrap; }
.cal-set .ic { width: 16px; height: 16px; }
.cal-wrap { display: flex; position: relative; }
.cal-g { flex: 0 0 1.9rem; padding-top: calc(2.4rem + var(--adh, 0px)); }
.cal-hrs { position: relative; }
.cal-hr { position: absolute; right: .3rem; font-size: .64rem; color: var(--muted); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.cal-hr:first-child { transform: none; }
.cal-x { flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.cal-tr { display: flex; }
.cal-col { flex: 0 0 calc(100% / var(--cols, 7)); min-width: 0; scroll-snap-align: start; border-left: 1px solid var(--line); }
.cal-col.mon { border-left: 2px solid var(--line2); }
.cal-dh { height: 2.4rem; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .8rem; line-height: 1.2; white-space: nowrap; overflow: hidden; }
.cal-dh span { font-size: .64rem; color: var(--muted); }
.cal-col.today .cal-dh b { color: #fff; background: var(--accent); border-radius: 99px; padding: 0 .5rem; }
.cal-col.pastday .cal-dh b { color: var(--muted); }
.cal-ad { height: var(--adh, 0px); display: flex; flex-direction: column; gap: 2px; padding: 0 2px; overflow: hidden; }
.cal-chip { display: block; width: 100%; height: 20px; border: 0; border-radius: 5px; padding: 0 .35rem; background: var(--bg3); color: var(--ink2); font: inherit; font-size: .66rem; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-chip.due { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.cal-cb { position: relative; background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--ph, 46px)); }
.cal-col.wkend .cal-cb { background-color: color-mix(in srgb, var(--bg2) 70%, transparent); }
.cal-col.today .cal-cb { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.cal-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--c-now); z-index: 5; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-now); }
.cal-now span { position: absolute; right: 2px; top: -.85rem; font-size: .6rem; font-weight: 700; color: var(--c-now); background: var(--card); border-radius: 3px; padding: 0 2px; }
.cal-b { position: absolute; box-sizing: border-box; border-radius: 6px; padding: 2px 4px; font-size: .7rem; line-height: 1.2; overflow: hidden; cursor: pointer; z-index: 2; outline: none; }
.cal-b:hover, .cal-b.sel, .cal-b:focus-visible { z-index: 4; box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.cb-t { overflow: hidden; overflow-wrap: anywhere; }
.cal-b.tiny .cb-t { white-space: nowrap; text-overflow: ellipsis; line-height: 1.05; }
.cb-s { font-size: .63rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-b.past { opacity: .5; }
.cal-b.k-lec { background: var(--c-lec); color: var(--c-lec-ink); padding-right: 20px; box-shadow: inset 0 -1px 0 rgba(0,0,0,.15); }
.cal-b.k-lec.past { opacity: .78; }
.cal-b.k-lec.st-writing { padding-right: 42px; }
.cal-b.k-lec.st-cancelled .cb-t, .cal-b.skipped .cb-t { text-decoration: line-through; }
.cal-b.k-lec.skipped { opacity: .5; }
.cal-b.k-tt { background: color-mix(in srgb, var(--c-lec) 16%, var(--card)); color: var(--c-lec); border: 1px dashed color-mix(in srgb, var(--c-lec) 45%, transparent); }
:root[data-theme="dark"] .cal-b.k-tt { color: #c7c4ff; }
.cal-b.k-lab { background: var(--c-lab); color: var(--c-lab-ink); }
/* a lab session around their own slot (free for work), and a lab whose time isn't confirmed */
.cal-sess { position: absolute; left: 1px; right: 2px; box-sizing: border-box; border: 1.5px dashed color-mix(in srgb, var(--c-lab) 45%, transparent); border-radius: 6px; background: color-mix(in srgb, var(--c-lab) 5%, transparent); z-index: 0; pointer-events: none; }
.cal-b.k-lab.chk { padding-right: 18px; }
.cb-chk { position: absolute; top: 3px; right: 3px; width: 13px; height: 13px; border-radius: 50%; background: #fff; color: var(--c-lab); font-size: .58rem; font-weight: 800; line-height: 13px; text-align: center; }
.cal-b.tiny .cb-chk { top: 1px; }
.cp-slot { margin-top: .35rem; font-size: .85rem; line-height: 1.4; }
.cal-b.k-sup { background: var(--c-sup-bg); color: var(--ink); border: 1.5px solid var(--c-sup); }
.cal-b.k-ev { background: var(--bg3); color: var(--ink2); }
.cal-b.k-work { background: color-mix(in srgb, var(--accent) 13%, var(--card)); color: var(--ink); border-left: 3px solid var(--accent); font-weight: 600; }
.cal-b.k-work .cb-s { font-weight: 400; }
.cal-b.k-work.done .cb-t { text-decoration: line-through; color: var(--muted); }
.cal-b.k-work.late { background: var(--warn-bg); border-left-color: var(--warn); color: var(--warn); }
.cal-b.k-work.soft { border-left-color: var(--c-can); }
.cal-b.k-meal { background: repeating-linear-gradient(45deg, var(--bg3), var(--bg3) 3px, transparent 3px, transparent 7px); color: var(--muted); font-size: .62rem; z-index: 1; }
.cal-b.opt { opacity: .7; border-style: dashed; }
.cal-b.skipped:not(.k-lec) { opacity: .4; }
.cal-b.now:not(.k-meal) { box-shadow: 0 0 0 2px var(--c-now); }
.cb-late { position: absolute; right: 3px; top: 2px; font-size: .56rem; font-weight: 800; text-transform: uppercase; color: #fff; background: var(--warn); border-radius: 3px; padding: 0 3px; }
.cal-b.k-work.late { padding-right: 30px; }
/* a lecture's notes: the badge in its corner */
.cb-badge { position: absolute; top: 3px; right: 3px; display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; font-size: .62rem; line-height: 1; font-style: normal; box-sizing: border-box; }
.cb-badge svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cb-badge b { font-weight: 800; }
.cb-badge.st-written { background: var(--c-ok); color: #fff; }
.cb-badge.st-guessed { background: var(--c-ok); color: #fff; opacity: .78; }
.cb-badge.st-guessed b { font-size: .8em; }
.cb-badge.st-waiting { background: var(--c-can); color: #fff; }
.cb-badge.st-waiting svg { stroke-width: 1.8; }
.cb-badge.st-ask { background: #fff; color: var(--c-ask); box-shadow: 0 0 0 1.5px var(--c-ask); }
.cb-badge.st-ask.mine { cursor: pointer; animation: cal-pulse 1.6s ease-in-out infinite; }
@keyframes cal-pulse { 0%, 100% { box-shadow: 0 0 0 1.5px var(--c-ask), 0 0 0 0 color-mix(in srgb, var(--c-ask) 60%, transparent); } 50% { box-shadow: 0 0 0 1.5px var(--c-ask), 0 0 0 5px transparent; } }
@media (prefers-reduced-motion: reduce) { .cb-badge.st-ask.mine { animation: none; } }
.cb-badge.st-error { background: var(--warn); color: #fff; }
.cb-badge.st-nothing, .cb-badge.st-cancelled { background: rgba(255,255,255,.3); color: #fff; }
.cb-badge.st-writing { width: auto; height: 15px; border-radius: 99px; padding: 0 5px 0 15px; background: #fff; color: var(--c-lec); font-size: .58rem; font-weight: 800; position: absolute; }
.cb-badge.st-writing::before { content: ""; position: absolute; left: 3px; top: 3px; width: 9px; height: 9px; border-radius: 50%; background: conic-gradient(var(--c-ok) calc(var(--p, 0) * 1%), color-mix(in srgb, var(--c-lec) 25%, #fff) 0); }
.cb-badge.st-writing span::after { content: "%"; }
.cal-b.tiny .cb-badge { top: 1px; }
/* the examples paper(s) a lecture makes doable: done · doable · not yet */
.cb-ex { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 4px; display: flex; border-radius: 3px; overflow: hidden; background: rgba(255,255,255,.28); }
.cb-ex i { display: block; height: 100%; }
.cb-ex .d { background: var(--c-ok); } .cb-ex .c { background: var(--c-can); } .cb-ex .l { background: transparent; }
.cal-b.tiny .cb-ex { display: none; }
.cb-ex.big { position: static; display: flex; height: 8px; margin: .3rem 0 .15rem; background: var(--bg3); }
.cal-key .cb-ex.big { display: inline-flex; width: 2.4rem; height: 6px; margin: 0 .3rem 0 0; vertical-align: middle; }
.cal-key { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin-top: .55rem; font-size: .7rem; color: var(--muted); }
.cal-key span { display: inline-flex; align-items: center; }
.cal-key .kk { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-right: .3rem; }
.kk.k-lec { background: var(--c-lec); } .kk.k-lab { background: var(--c-lab); } .kk.k-sup { background: var(--c-sup-bg); border: 1.5px solid var(--c-sup); box-sizing: border-box; }
.kk.k-work { background: color-mix(in srgb, var(--accent) 13%, var(--card)); border-left: 3px solid var(--accent); box-sizing: border-box; } .kk.k-ev { background: var(--bg3); }
.cal-key .cb-badge { position: relative; top: 0; right: 0; margin-right: .3rem; }
.cal-key .cb-badge.st-writing { width: 15px; padding: 0; background: transparent; }
.cal-key .cb-badge.st-writing::before { left: 2px; top: 2px; width: 11px; height: 11px; }
/* hover tips and the cards blocks open */
.cal-tip { position: fixed; z-index: 70; max-width: 300px; background: var(--ink); color: var(--bg); font: .74rem/1.35 var(--ui); padding: .35rem .55rem; border-radius: 6px; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.cal-pop { position: absolute; z-index: 60; width: 21rem; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto; box-sizing: border-box; background: var(--card); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 12px 34px rgba(0,0,0,.16); padding: .75rem .9rem .85rem; font-family: var(--ui); font-size: .86rem; }
.cal-pop.sheetish { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; max-height: 78vh; border-radius: 16px 16px 0 0; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
.cal-pop-back { position: fixed; inset: 0; z-index: 59; background: rgba(0,0,0,.28); }
.cal-pop > .x { position: absolute; top: .4rem; right: .45rem; border: 0; background: none; font-size: 1.3rem; line-height: 1; color: var(--muted); cursor: pointer; padding: .2rem .35rem; }
.cp-k { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; padding-right: 1.6rem; }
.cp-h { display: flex; align-items: center; gap: .4rem; font-size: 1.02rem; margin: .1rem 1.6rem .1rem 0; }
.cp-h b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cp-w, .cp-sm { color: var(--ink2); font-size: .8rem; }
.cp-sm { margin-top: .15rem; }
.cp-note { margin-top: .35rem; font-size: .8rem; color: var(--warn); }
.cp-st { display: flex; gap: .5rem; align-items: flex-start; margin: .6rem 0 .3rem; font-size: .84rem; }
.cp-st .cb-badge { position: relative; top: 1px; right: 0; flex: 0 0 auto; }
.cp-st .cb-badge.st-writing { background: var(--bg3); }
.cp-st .cb-badge.st-ask { animation: none; }
.cp-st.st-upcoming .cb-badge { display: none; }
.cp-bar { height: 6px; border-radius: 9px; background: var(--bg3); overflow: hidden; margin: 0 0 .4rem; }
.cp-bar span { display: block; height: 100%; background: var(--c-ok); }
.cp-sec { margin: .75rem 0 .25rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cp-ex { margin-bottom: .45rem; }
.cp-links { display: flex; flex-direction: column; gap: .2rem; }
.cp-l { font-weight: 600; }
.cp-tasks { display: flex; flex-direction: column; gap: .15rem; margin-top: .45rem; }
.cp-task { display: flex; align-items: flex-start; gap: .45rem; font-size: .84rem; cursor: pointer; }
.cp-task input { width: 1.05rem; height: 1.05rem; margin-top: .1rem; flex: 0 0 auto; }
.cp-task.is-done span { color: var(--muted); text-decoration: line-through; }
.cp-task .lt { color: var(--warn); font-size: .72rem; }
.cp-acts { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .7rem; }
.cp-menu { position: relative; flex: 0 0 auto; }
.cp-dots { border: 1px solid var(--line2); background: var(--card); border-radius: 7px; width: 2rem; height: 1.6rem; cursor: pointer; color: var(--ink2); font-size: 1rem; line-height: 1; }
.cp-opts { display: flex; flex-direction: column; gap: .25rem; margin-top: .35rem; position: absolute; right: 0; top: 100%; z-index: 2; background: var(--card); border: 1px solid var(--line2); border-radius: 9px; padding: .35rem; box-shadow: 0 8px 22px rgba(0,0,0,.14); min-width: 13rem; }
.cp-opts .btn { justify-content: flex-start; }
/* the slim plan bar above the calendar */
.pl-bar { padding: .55rem .85rem; margin-bottom: .7rem; }
.pl-bar-r { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; }
.pl-st { display: inline-flex; align-items: baseline; gap: .45rem; white-space: nowrap; }
.pl-st .dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--c-ok); align-self: center; }
.pl-status.st-amber .pl-st .dot { background: var(--c-can); }
.pl-status.st-red .pl-st .dot { background: var(--warn); }
.pl-nx { flex: 1 1 18rem; min-width: 0; overflow-wrap: anywhere; }
.pl-nx a { font-weight: 650; }
.pl-bar .pl-acts { margin-top: 0; gap: .35rem; }
.pl-late { margin-top: .45rem; padding-top: .4rem; border-top: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line)); color: var(--warn); font-size: .85rem; display: flex; flex-wrap: wrap; gap: .2rem .9rem; }
.pl-late a { color: var(--warn); font-weight: 650; }
/* the ⚙ panel */
@media (max-width: 640px) {
  .cal { padding: .6rem .45rem .7rem; border-radius: 12px; }
  .cal-g { flex-basis: 1.55rem; }
  .cal-b { font-size: .66rem; padding: 1px 3px; }
  .cal-b.k-lec { padding-right: 18px; }
  .cal-b.k-lec.st-writing { padding-right: 3px; padding-top: 18px; }
  .cal-m { font-size: .85rem; margin-left: .2rem; }
  .pl-bar .pl-acts { width: 100%; }
}
.pl-tg { margin: .5rem 0 .8rem; }
.pl-tgh { font-size: .8rem; font-weight: 650; color: var(--ink2); border-bottom: 1px solid var(--line); padding-bottom: .15rem; margin-bottom: .2rem; }
.pl-todo > summary { font-size: .95rem; }
.cal-b.k-lec .cb-t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-b.k-lec.tiny .cb-t { -webkit-line-clamp: 1; }

.news-b { display: flex; gap: .4rem; }
.studybar .sb-t.lnk { cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 2px; }
.cp-opts[hidden] { display: none; }
.cal-b.k-lec .cb-t { overflow-wrap: normal; word-break: normal; }
.cal-b.k-lec.st-upcoming { padding-right: 4px; }

/* coursework sheets (a task's PDF from Moodle): full page and side panel; a task's other sheets / files / Moodle link */
.doc-pages { display: flex; flex-direction: column; align-items: center; gap: .9rem; }
.doc-pages .mat-page { width: 100%; height: auto; }
.tlinks { font-size: .78rem; overflow-wrap: anywhere; }
.tlinks a { color: var(--muted); text-decoration: none; border-bottom: 1px dotted currentColor; margin-left: .5rem; }
.tlinks a:hover { color: var(--accent, inherit); }
.cp-task.is-done .tlinks a { text-decoration: none; }
.pop-h .gapped, .cov-r .gapped { font-style: normal; color: var(--guess); margin-left: .3rem; }
