/* EconLab design system
   One set of tokens; components below use only these. Body text is Inter, headings Source Serif 4,
   both self-hosted (fonts/, SIL OFL) so no third-party requests leave a student's browser. */

@font-face { font-family: "Inter"; src: url("fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2190-2199, U+2212, U+2215; }
@font-face { font-family: "Inter"; src: url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-latin-ext-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-display: swap; unicode-range: U+0100-024F, U+1E00-1EFF; }
@font-face { font-family: "Source Serif 4"; font-style: italic; src: url("fonts/source-serif-4-latin-wght-italic.woff2") format("woff2"); font-weight: 200 900; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --ink: #0f1a3d;          /* headings, brand */
  --text: #1d2639;
  --text-2: #475467;       /* secondary text */
  --muted: #5d6779;        /* tertiary text, >= 4.5:1 on --bg */
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --line: #e5e8ef;
  --line-strong: #d3d8e3;

  --brand: #1b2a6b;
  --primary: #3346d3;
  --primary-hover: #2836b0;
  --primary-soft: #eef0fd;
  --primary-line: #c9cff7;
  --success: #0e7a4d;
  --success-soft: #e8f7ef;
  --success-line: #b5e6cc;
  --danger: #b42318;
  --danger-soft: #fdf0ef;
  --danger-line: #f6cdc9;
  --warning: #9a4a07;
  --warning-soft: #fff5e6;
  --warning-line: #f8d9a8;
  --gold: #f5b83d;

  /* aliases kept for older markup */
  --panel: var(--surface);
  --primary-dark: var(--primary-hover);

  --r-sm: 8px; --r: 12px; --r-lg: 18px; --r-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(15, 26, 61, .05);
  --shadow-sm: 0 1px 2px rgba(15, 26, 61, .05), 0 2px 6px rgba(15, 26, 61, .04);
  --shadow-md: 0 4px 10px rgba(15, 26, 61, .06), 0 12px 28px rgba(15, 26, 61, .07);
  --ring: 0 0 0 3px rgba(51, 70, 211, .28);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --radius: var(--r);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-sans); font-size: 15.5px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; }
h1 { font-family: var(--font-serif); font-weight: 650; font-size: 34px; letter-spacing: -.015em; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 16.5px; font-weight: 650; }
a { color: var(--primary); }
p { margin: 0 0 10px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, textarea, select { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 9px 12px; color: var(--text); transition: border-color .15s, box-shadow .15s; max-width: 100%; }
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #8a93a5; }
input:hover, textarea:hover, select:hover { border-color: #b8bfce; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; padding: 0; }
:focus-visible { outline: none; box-shadow: var(--ring); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--primary); color: #fff; padding: 10px 14px; border-radius: var(--r-sm); font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 12px; }
main:focus { outline: none; }

/* ---------- Header ---------- */
.topbar { position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 28px; background: rgba(255, 255, 255, .86); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; cursor: pointer; border-radius: var(--r); padding: 4px; margin-left: -4px; }
.brand-mark { width: 34px; height: 34px; flex: 0 0 auto; display: block; }
.brand-title { font-family: var(--font-serif); font-weight: 700; font-size: 19px; color: var(--ink); letter-spacing: -.01em; line-height: 1.1; }
.brand-sub { font-size: 12px; color: var(--muted); font-weight: 500; }
nav { display: flex; align-items: center; gap: 2px; }
.nav-link { position: relative; background: none; border: 0; padding: 8px 12px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 600; font-size: 14.5px; cursor: pointer; transition: color .15s, background .15s; }
.nav-link:hover { color: var(--ink); background: #f0f2f7; }
.nav-link[aria-current="page"] { color: var(--primary); }
.nav-link[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -13px; height: 2px; border-radius: 2px; background: var(--primary); }
.account-menu .nav-link[aria-current]::after { display: none; }
.user-chip { display: none; }

/* Account menu */
.account-menu { position: relative; margin-left: 10px; }
.account-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 12px 4px 4px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.account-menu summary:hover { border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.account-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #3346d3, #1b2a6b); color: #fff; font-weight: 700; font-size: 12.5px; }
.account-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-md); padding: 8px; display: grid; gap: 2px; z-index: 30; animation: pop .16s var(--ease); }
.account-pop .small { padding: 6px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.account-pop .nav-link { text-align: left; width: 100%; }

/* ---------- Layout ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 36px 28px 72px; min-height: calc(100vh - 150px); }
main > * { animation: enter .28s var(--ease) both; }
footer { text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.7; padding: 28px 24px 36px; border-top: 1px solid var(--line); }
footer strong { color: var(--text-2); }
footer span { display: block; max-width: 760px; margin: 0 auto; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

.page-head, .course-head, .dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1, .course-head h1, .dash-head h1, .editor-head h1 { margin: 6px 0 6px; }
.page-head .meta, .course-head .meta, .dash-head .meta { margin: 0; max-width: 720px; }
.page-head .back-link { display: inline-flex; margin-bottom: 14px; }
.eyebrow, .course-head .badge, .dash-head .badge, .editor-head .badge { display: block; background: none; padding: 0; border-radius: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--primary); margin: 0; }
.section-title { font-size: 19px; margin: 34px 0 14px; }
.section-title .count { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.card-title { font-size: 16.5px; margin: 0 0 12px; }
.meta { color: var(--text-2); font-size: 14.5px; }
.small { font-size: 13px; color: var(--muted); }
.large { font-size: 32px; font-weight: 750; margin-top: 6px; color: var(--ink); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.nowrap { white-space: nowrap; flex-wrap: nowrap; }
.gap-top { margin-top: 22px; }
.center { text-align: center; margin-top: 8px; }
.center-row { justify-content: center; margin-top: 22px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.learning-grid, .editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: start; }
.editor-grid { margin-top: 4px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.home-grid .section-title:first-child { margin-top: 0; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 20px; align-items: start; }
.side-stack { display: grid; gap: 16px; align-content: start; position: sticky; top: 88px; }
.side-label { margin: 0 0 -6px; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px; box-shadow: var(--shadow-sm); }
.card h3 { margin: 0 0 8px; }
.card p { color: var(--text-2); }
.learning-section { margin-bottom: 18px; }
.learning-section h2, .practice-panel h2 { margin: 4px 0 12px; }
.learning-section h3.sub { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 22px 0 10px; }
.notice { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 20px; border-radius: var(--r); background: var(--primary-soft); border: 1px solid var(--primary-line); color: var(--ink); }
.empty-state { color: var(--muted); }
.empty-state.card { text-align: center; padding: 36px 24px; }
.muted-note { margin-top: 14px; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; font-weight: 650; font-size: 14.5px; line-height: 1.2; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s, transform .08s, color .15s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(15, 26, 61, .18), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: #b8bfce; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover:not(:disabled) { background: var(--primary-soft); }
.btn-wide { width: 100%; margin-top: 10px; }
.btn:focus-visible { box-shadow: var(--ring); }
.link-btn, .back-link { background: none; border: 0; padding: 0; color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: none; border-radius: 4px; }
.link-btn:hover, .back-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-btn.danger, .danger { color: var(--danger); }
.icon-btn { width: 32px; height: 32px; border: 0; border-radius: var(--r-sm); background: #f0f2f7; font-size: 18px; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: #e4e7ee; }
.file-btn { cursor: pointer; }
.file-btn:focus-within { box-shadow: var(--ring); }
.link-arrow { color: var(--primary); font-weight: 650; font-size: 14px; }

/* ---------- Pills, badges, status ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 650; background: var(--primary-soft); color: var(--primary); }
.badge-npr { background: #fff1e0; color: #8a4300; }
.badge-pd { background: #e9f6ef; color: #0f6a42; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--r-pill); background: #f0f2f7; color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--success-soft); color: var(--success); }
.pill.warn { background: var(--warning-soft); color: var(--warning); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.status { display: inline-block; padding: 2px 9px; border-radius: var(--r-pill); background: var(--success-soft); color: var(--success); font-size: 12px; font-weight: 650; }
.status.draft { background: #f0f2f7; color: var(--text-2); }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.score-chip { display: inline-block; min-width: 52px; text-align: center; padding: 2px 9px; border-radius: var(--r-pill); font-weight: 700; font-size: 13px; }
.score-chip.high { background: var(--success-soft); color: var(--success); }
.score-chip.mid { background: var(--warning-soft); color: var(--warning); }
.score-chip.low { background: var(--danger-soft); color: var(--danger); }

/* ---------- Tables ---------- */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
.card table, .table-wrap table { background: transparent; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--surface-2); font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fafbfe; }
tbody tr:last-child td { border-bottom: 0; }
.card > table { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.table-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.clipped { max-width: 520px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.bank-table td { vertical-align: top; }
.bank-table th:nth-child(2), .bank-table th:nth-child(3) { width: 1%; white-space: nowrap; }
.bank-table td:last-child .row { gap: 4px 12px; font-size: 14px; }
.module-table .row-link { display: inline-flex; gap: 14px; align-items: baseline; text-align: left; color: var(--ink); font-weight: 600; }
.module-table .row-link:hover { color: var(--primary); text-decoration: none; }
.module-table .num { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 1.4em; font-weight: 600; }
.module-table td:not(:first-child), .module-table th:not(:first-child) { width: 1%; white-space: nowrap; padding-left: 26px; }

/* ---------- Filters and tabs ---------- */
.filter-bar { display: flex; gap: 12px 20px; flex-wrap: wrap; align-items: center; padding: 14px 18px; margin-bottom: 20px; }
.filter-bar label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.filter-bar label.grow { flex: 1 1 240px; }
.filter-bar input[type=search] { flex: 1; min-width: 0; padding: 7px 12px; }
.filter-bar select { padding: 7px 10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tab { flex: none; white-space: nowrap; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font-weight: 650; color: var(--muted); cursor: pointer; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Forms ---------- */
.auth-form { display: grid; gap: 16px; margin-top: 20px; }
.auth-form label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; color: var(--ink); }
.auth-form input, .auth-form textarea, .auth-form select { width: 100%; }
.auth-form label.check, .check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.auth-form label.check input { width: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-top: 4px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid label { margin: 0; }
.field { margin-bottom: 20px; }
.field label, legend { display: block; font-weight: 650; margin-bottom: 8px; color: var(--ink); }
.field input, .field textarea, .field select { width: 100%; }
.field small { color: var(--muted); display: block; margin-top: 6px; }
fieldset { border: 0; padding: 0; margin: 0 0 20px; }
.option-row { display: grid; grid-template-columns: 24px 1fr 34px; gap: 8px; align-items: center; margin-bottom: 9px; }
.option, .variable-row input { width: 100%; }
.variable-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr 34px; gap: 8px; margin-bottom: 9px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.block-label { display: block; font-weight: 600; font-size: 14px; margin: 10px 0 6px; color: var(--ink); }
.hint-label { font-weight: 400; font-size: 14px; color: var(--text-2); }
select.compact { padding: 4px 8px; font-size: 13px; margin-top: 6px; }
label > select { margin-left: 6px; }
.auth-form label > select, .form-grid label > select, .settings-card select { margin-left: 0; }
.settings-card { max-width: 640px; }
.settings-card select { width: 100%; }
.tips { position: sticky; top: 88px; }
.new-item { margin-bottom: 20px; }
.new-item > summary { list-style: none; cursor: pointer; display: inline-block; }
.new-item > summary::-webkit-details-marker { display: none; }
.new-item[open] > summary { margin-bottom: 18px; }
details > summary { cursor: pointer; }
.side-stack details > summary.card-title { margin: 0; }
.side-stack details[open] > summary.card-title { margin-bottom: 14px; }
.post-form { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.post-form textarea { flex: 1; }
.resource-form, .learning-section form { display: grid; gap: 10px; margin: 16px 0; }
.resource-form input, .resource-form textarea, .resource-form select { width: 100%; }

/* ---------- Auth ---------- */
.auth-shell { max-width: 440px; margin: 40px auto; padding: 34px 32px; }
.auth-shell h1 { margin: 6px 0 8px; font-size: 30px; }

/* ---------- Dashboards ---------- */
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-tile { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; }
.stat-tile:hover { border-color: var(--primary-line); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-tile strong { font-family: var(--font-serif); font-size: 32px; font-weight: 650; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-tile strong small { font-family: var(--font-sans); font-size: 15px; color: var(--muted); font-weight: 600; }
.stat-tile span { color: var(--text-2); font-size: 13.5px; }
.stat-row { display: flex; gap: 14px; margin-bottom: 20px; }
.stat-card { flex: 1; text-align: center; padding: 18px; }
.stat-card strong { display: block; font-family: var(--font-serif); font-size: 30px; margin-top: 4px; color: var(--ink); }
.todo { margin-bottom: 8px; }
.todo ul { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.todo li:first-child { border-top: 0; padding-top: 0; }
.todo li span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-right: 10px; vertical-align: 2px; }
.task-list { display: grid; gap: 10px; }
.task { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.task:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.task h3 { margin: 0 0 6px; font-size: 16px; }
.task .small { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.task .btn { white-space: nowrap; }
.task.open { box-shadow: inset 4px 0 0 var(--primary), var(--shadow-sm); }
.task.overdue { box-shadow: inset 4px 0 0 var(--danger), var(--shadow-sm); }
.task.done { box-shadow: inset 4px 0 0 var(--success), var(--shadow-sm); }
.next-card { cursor: pointer; position: relative; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; }
.next-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, var(--primary-soft), transparent 70%); pointer-events: none; }
.next-card:hover { border-color: var(--primary-line); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.next-card h3 { margin: 6px 0 6px; font-family: var(--font-serif); font-size: 22px; font-weight: 650; }
.mini-progress { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.mini-progress li { display: grid; grid-template-columns: minmax(0, 1fr) 140px 44px; gap: 14px; align-items: center; }
.mini-progress .link-btn { text-align: left; color: var(--ink); }
.mini-progress .bar, .progress-track { height: 8px; border-radius: var(--r-pill); background: #e9ecf3; overflow: hidden; display: block; }
.mini-progress .bar span, .progress-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #6b7cf0); transition: width .4s var(--ease); }
.facts { margin: 0 0 16px; display: grid; gap: 12px; }
.facts dt { font-size: 13px; font-weight: 700; color: var(--ink); }
.facts dd { margin: 2px 0 0; font-size: 14px; color: var(--text-2); }
.hero { background: linear-gradient(135deg, #eef0fd 0%, #fff 65%); border: 1px solid var(--primary-line); border-radius: 22px; padding: 36px; display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; align-items: center; }
.hero h1 { font-size: 42px; line-height: 1.08; margin: 0 0 14px; }
.hero p { color: var(--text-2); font-size: 18px; margin: 0; }
.hero-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-md); }
.metric { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.metric:last-child { border-bottom: 0; }
.course-card, .module-mini .card, .shortcut { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.course-card:hover, .module-mini .card:hover, .shortcut:hover { border-color: var(--primary-line); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.module-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }

/* ---------- Modules ---------- */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.module-card { --hue: 230; cursor: pointer; display: flex; flex-direction: column; position: relative; overflow: hidden; padding-top: 26px; transition: border-color .18s, box-shadow .18s, transform .18s; }
.module-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: hsl(var(--hue) 62% 55%); }
.module-card:hover, .module-card:focus-visible { border-color: hsl(var(--hue) 55% 82%); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.module-card h3 { margin: 6px 0 8px; font-family: var(--font-serif); font-size: 20px; font-weight: 650; line-height: 1.25; }
.module-card p { margin: 0 0 16px; font-size: 14px; flex: 1; }
.module-num { font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: hsl(var(--hue) 55% 38%); }
.module-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); padding-top: 14px; border-top: 1px solid var(--line); }
.objectives { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.objectives li { position: relative; padding-left: 28px; }
.objectives li::before { content: ""; position: absolute; left: 0; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--primary-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%233346d3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; }
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.link-list a { color: var(--ink); font-weight: 600; text-decoration: none; }
.link-list a:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.practice-panel { overflow: hidden; position: relative; }
.practice-panel::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--primary), #6b7cf0); }
.practice-panel h2 { font-family: var(--font-serif); font-size: 22px; font-weight: 650; margin: 6px 0 6px; }
.practice-stat { margin: 12px 0 0; text-align: center; }
.assignment-card { box-shadow: inset 4px 0 0 var(--primary), var(--shadow-sm); }
.assignment-card h3 { font-size: 16.5px; }
.assignment-card .meta-row { margin: 10px 0 12px; }
.resource-list { list-style: none; margin: 0; padding: 0; }
.resource-item, .discussion-post { padding: 14px 0; border-top: 1px solid var(--line); }
.resource-item h3 { margin: 0 0 6px; font-size: 16px; }
.resource-item h3 a { color: var(--ink); text-decoration: none; }
.resource-item p, .discussion-post p { margin: 6px 0 0; color: var(--text-2); }
.discussion-post span { color: var(--muted); font-size: 12px; margin-left: 8px; }
.add-link { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.add-link summary { color: var(--primary); font-weight: 650; }
.video-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }

/* ---------- Readings and reflections ---------- */
.reading-list { display: grid; }
.reading { padding: 20px 0 6px; border-top: 1px solid var(--line); }
.reading:first-child { border-top: 0; padding-top: 2px; }
.reading h3 { font-family: var(--font-serif); font-size: 19px; font-weight: 650; margin: 8px 0 6px; line-height: 1.3; }
.reading h3 a, .book h3 a { color: var(--ink); text-decoration: none; }
.reading h3 a:hover, .book h3 a:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.reading h3 a::after, .book h3 a::after { content: " ↗"; color: var(--muted); font-size: .8em; font-family: var(--font-sans); }
.reading > p { color: var(--text-2); margin: 0 0 12px; }
.reading-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.excerpt { margin: 12px 0 14px; padding: 14px 20px; border-left: 3px solid var(--gold); background: #fffbf2; font-family: var(--font-serif); font-size: 16.5px; line-height: 1.65; color: #3a3324; border-radius: 0 var(--r) var(--r) 0; }
.reflect-prompt { background: var(--primary-soft); border: 1px solid var(--primary-line); border-radius: var(--r); padding: 14px 16px; margin-top: 10px; }
.reflect-prompt p { margin: 6px 0 0; color: var(--ink); }
.reflect, .key-points, .your-answer { margin-top: 14px; }
.reflect > summary, .key-points > summary, .your-answer > summary { font-weight: 650; color: var(--primary); }
.reflect-form textarea, .review-card textarea { width: 100%; margin-top: 10px; }
.reflect-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.reflect-status { margin-top: 14px; padding: 11px 14px; border-radius: var(--r); background: #f0f2f7; color: var(--ink); }
.reflect-status.ok { background: var(--success-soft); color: #075c39; }
.reflect-status.warn { background: var(--warning-soft); color: #7d3a05; }
.answer-text { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 10px 0; color: var(--text); }
.self-form h4, .review-card h4 { font-size: 14px; margin: 18px 0 10px; }
.key-check { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.key-check label { display: flex; gap: 10px; align-items: flex-start; }
.key-check input[type=checkbox] { flex: 0 0 auto; margin: 3px 0 0; }
.key-review { padding-left: 0; list-style: none; margin: 0; }
.key-review li { padding: 3px 0; }
.key-review li.no { color: var(--muted); }
.key-points ul { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text-2); }
.rubric-row { margin: 0 0 14px; }
.rubric-row legend { font-weight: 650; font-size: 14px; margin-bottom: 8px; }
.rubric-levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rubric-level { position: relative; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 10px; font-size: 12.5px; line-height: 1.35; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s, box-shadow .15s; }
.rubric-level:hover { border-color: var(--primary-line); }
.rubric-level input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rubric-level .lvl { font-family: var(--font-serif); font-weight: 700; font-size: 18px; color: var(--ink); }
.rubric-level:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.rubric-level:has(input:focus-visible) { box-shadow: var(--ring); }
.rubric-table { width: 100%; margin: 12px 0; }
.rubric-table th { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); background: transparent; font-weight: 600; width: 34%; }
.rubric-table td:nth-child(2) { white-space: nowrap; font-weight: 700; }
.instr-feedback { border-left: 3px solid var(--success); padding: 8px 14px; margin: 12px 0; background: var(--success-soft); border-radius: 0 var(--r) var(--r) 0; }
.instr-feedback p { margin: 4px 0 0; color: var(--ink); }
.review-card { margin-bottom: 16px; }
.review-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }

/* ---------- Library ---------- */
.lib-section { margin-bottom: 12px; }
.lib-section .meta { margin-top: -6px; margin-bottom: 14px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 16px; }
.book { display: flex; gap: 18px; align-items: flex-start; transition: box-shadow .18s, border-color .18s; }
.book:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.book-main { grid-column: 1 / -1; }
.book-spine { flex: 0 0 56px; height: 76px; border-radius: 3px 8px 8px 3px; background: linear-gradient(135deg, #3346d3, #1b2a6b); color: #fff; font-family: var(--font-serif); font-weight: 700; font-size: 26px; display: flex; align-items: center; justify-content: center; box-shadow: inset 5px 0 0 rgba(255, 255, 255, .16), 0 4px 10px rgba(15, 26, 61, .18); }
.book-main .book-spine { flex-basis: 70px; height: 96px; font-size: 32px; }
.book-classic .book-spine { background: linear-gradient(135deg, #9a6a35, #5c3a17); }
.book-find .book-spine { background: linear-gradient(135deg, #14915b, #0b5434); }
.book h3 { margin: 0 0 3px; font-family: var(--font-serif); font-size: 18px; font-weight: 650; line-height: 1.3; }
.book p { margin: 6px 0 10px; }

/* ---------- Quiz ---------- */
.quiz-shell { max-width: 800px; margin: 0 auto; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; padding: 14px 20px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); position: sticky; top: 76px; z-index: 5; }
.quiz-progress { margin-bottom: 18px; }
.quiz-clock { display: flex; align-items: center; gap: 10px; }
.quiz-clock span { color: var(--muted); font-size: 12px; }
.quiz-clock strong { font-variant-numeric: tabular-nums; min-width: 44px; font-size: 19px; padding: 4px 12px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.quiz-clock.warn strong { background: var(--warning-soft); color: var(--warning); }
.quiz-clock.low strong { background: var(--danger-soft); color: var(--danger); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.q-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.q-nav button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-weight: 650; font-size: 13.5px; cursor: pointer; transition: all .15s; }
.q-nav button:hover { border-color: var(--primary-line); }
.q-nav button.answered { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
.q-nav button.current { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(51, 70, 211, .35); }
/* Practice strip: same chips as the assignment navigator, read-only, coloured by result. */
.q-strip { list-style: none; padding: 0; }
.q-strip li { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-weight: 650; font-size: 13.5px; }
.q-strip li.right { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.q-strip li.wrong { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.q-strip li.current { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(51, 70, 211, .35); }
.intro-card { padding: 32px; }
.intro-card h1 { font-size: 28px; margin: 12px 0 4px; }
.intro-card .sub { margin-top: 22px; }
.rules { list-style: none; padding: 0; margin: 12px 0 24px; display: grid; gap: 10px; }
.rules li { padding: 12px 14px 12px 16px; border-left: 3px solid var(--primary-line); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--text-2); line-height: 1.5; }
.rules li strong { color: var(--ink); }
@media (max-width: 600px) { .intro-card { padding: 22px 18px; } .intro-card h1 { font-size: 24px; } }
.question-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 30px 32px; box-shadow: var(--shadow-sm); }
.question-card > .small:first-child { font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: .07em; font-size: 11.5px; }
.question-card h2 { margin: 8px 0 18px; font-family: var(--font-serif); font-size: 24px; font-weight: 600; line-height: 1.35; letter-spacing: -.005em; }
.choice { position: relative; display: flex; gap: 12px; align-items: flex-start; margin-top: 10px; padding: 14px 16px 14px 52px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; background: var(--surface); counter-increment: choice; transition: border-color .15s, background .15s, box-shadow .15s, transform .08s; }
.question-card { counter-reset: choice; }
.choice::before { content: counter(choice, upper-alpha); position: absolute; left: 14px; top: 12px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--text-2); background: #f0f2f7; transition: all .15s; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice:hover { border-color: var(--primary-line); background: #fbfbff; }
.choice:active { transform: scale(.995); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice:has(input:checked)::before { background: var(--primary); color: #fff; }
.choice:has(input:focus-visible) { box-shadow: var(--ring); }
.choice:has(input:disabled) { cursor: default; }
.number-input { width: 200px; margin-top: 10px; padding: 12px 14px; font-size: 17px; font-variant-numeric: tabular-nums; }
.answer-field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.answer-field .number-input { margin-top: 0; max-width: 100%; }
.unit-pre, .unit-post { font-size: 17px; font-weight: 600; color: var(--text-2); }
.feedback { margin-top: 18px; padding: 14px 16px 14px 46px; border-radius: 14px; line-height: 1.55; position: relative; border: 1px solid; animation: enter .25s var(--ease) both; }
.feedback::before { position: absolute; left: 14px; top: 13px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; }
.feedback.correct { background: var(--success-soft); color: #075c39; border-color: var(--success-line); }
.feedback.correct::before { content: "✓"; background: var(--success); animation: tick .45s var(--ease) both; }
.feedback.incorrect { background: var(--danger-soft); color: #8f1d14; border-color: var(--danger-line); }
.feedback.incorrect::before { content: "!"; background: var(--danger); }
.feedback.info { background: var(--warning-soft); color: #7d3a05; border-color: var(--warning-line); }
.feedback.info::before { content: "i"; background: #c26a12; font-style: italic; font-family: var(--font-serif); }
.feedback:not(.correct):not(.incorrect):not(.info) { padding-left: 16px; background: var(--surface-2); border-color: var(--line); }
@keyframes tick { 0% { transform: scale(0); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.quiz-actions { margin-top: 22px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.kbd-hint { font-size: 12px; color: var(--muted); }
.kbd-hint kbd { font: 600 11px var(--font-sans); padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--text-2); }
.score-box { text-align: center; padding: 40px 32px; }
.score-box h1 { font-size: 30px; }
.score-circle { --pct: 0; width: 148px; height: 148px; border-radius: 50%; display: grid; place-items: center; margin: 20px auto; font-family: var(--font-serif); font-size: 38px; font-weight: 700; color: var(--ink); background: radial-gradient(circle, #fff 58%, transparent 59%), conic-gradient(var(--primary) calc(var(--pct) * 1%), #e9ecf3 0); animation: enter .4s var(--ease) both; }
.attempt-summary { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 18px; display: grid; gap: 3px; }
.attempt-summary strong { font-size: 30px; }
.review-list { display: grid; gap: 14px; margin-top: 18px; }
.review-list .question-card { padding: 22px; box-shadow: inset 4px 0 0 var(--line-strong), var(--shadow-sm); }
.review-list .question-card.right { box-shadow: inset 4px 0 0 #12b76a, var(--shadow-sm); }
.review-list .question-card.wrong { box-shadow: inset 4px 0 0 #f04438, var(--shadow-sm); }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.topic-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.topic-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.topic-list li:last-child { border-bottom: 0; }
.steps { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 6px; color: var(--text-2); }
.canvas-sync { margin-bottom: 20px; }
.canvas-sync > summary { margin: 0; }
.canvas-sync[open] > summary { margin-bottom: 12px; }

/* ---------- Economics diagrams ---------- */
.graph-question { margin-top: 18px; }
.graph-question svg { width: 100%; max-height: 400px; background: #fbfcfe; border: 1px solid var(--line); border-radius: 16px; touch-action: manipulation; }
.graph-question .axis { stroke: #344054; stroke-width: 2; }
.graph-question marker path, .graph-question #axisArrow path { fill: #344054; }
.graph-question text { fill: #344054; font-size: 15px; font-weight: 700; font-family: var(--font-sans); }
.graph-question .curve { fill: none; stroke-width: 4; stroke-linecap: round; transition: d .3s var(--ease); }
.graph-question .demand { stroke: #3346d3; }
.graph-question .supply { stroke: #0e7a4d; }
.graph-question .ppf { stroke: #7f56d9; }
.graph-question .original { stroke: #8a93a3; stroke-width: 3; stroke-dasharray: 8 7; }
.graph-question .fixed { opacity: .78; }
.graph-question .student-point { fill: #b42318; stroke: #fff; stroke-width: 3; }
.graph-question .axis-label { font-size: 14px; font-weight: 700; fill: #475467; }
.graph-question .tick-label { font-size: 13px; font-weight: 700; fill: #344054; font-variant-numeric: tabular-nums; }
.graph-question .curve-label { font-size: 15px; font-weight: 800; }
.graph-question .curve-label.demand { fill: #3346d3; }
.graph-question .curve-label.supply { fill: #0e7a4d; }
.graph-question .curve-label.ppf { fill: #7f56d9; }
.graph-question .guide { stroke: #667085; stroke-width: 1.5; stroke-dasharray: 5 5; }
.graph-question .eq-point { fill: var(--ink); stroke: #fff; stroke-width: 2; }
.graph-question .eq-label { font-size: 14px; font-weight: 800; fill: var(--ink); }
.graph-question .shift-arrow { stroke: #b54708; stroke-width: 2.5; }
.graph-question #shiftArrow path { fill: #b54708; }
.graph-question .gridline { stroke: #eaecf0; stroke-width: 1; }
.graph-question .eq-label, .graph-question .curve-label, .graph-question .tick-label { paint-order: stroke; stroke: #fbfcfe; stroke-width: 5px; stroke-linejoin: round; }
/* WCAG contrast on #fbfcfe: text >= 4.5:1, lines and points >= 3:1 */
.graph-question .curve-label.muted, .graph-question .eq-label.muted, .graph-question .tick-label.muted, .graph-question .muted { fill: #6b7585; }
.graph-question .guide.muted { stroke: #8a93a3; stroke-dasharray: 2 5; }
.graph-question .eq-point.muted { fill: #8a93a3; }
.graph-controls { display: flex; justify-content: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.graph-controls .btn.active { background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 2px var(--primary); }
.point-graph { touch-action: manipulation; }
.coord-entry { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 12px; }
.coord-entry label { font-weight: 700; font-size: 14px; }
.coord-entry input { width: 88px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) { .lib-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .home-grid, .learning-grid, .editor-grid, .dash-grid { grid-template-columns: 1fr; }
  .side-stack, .tips { position: static; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .topbar { height: auto; flex-direction: column; align-items: stretch; padding: 10px 14px 0; gap: 4px; }
  .brand-sub { display: none; }
  .brand-mark { width: 30px; height: 30px; }
  nav { overflow-x: auto; white-space: nowrap; padding-bottom: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  nav::-webkit-scrollbar { display: none; }
  .nav-link { padding: 8px 10px; flex: 0 0 auto; }
  .nav-link[aria-current="page"]::after { bottom: -6px; }
  #authArea { display: contents; }
  .account-name { display: none; }
  .account-menu summary { padding: 3px; }
  .account-pop { position: fixed; top: 90px; right: 12px; }
  main { padding: 24px 16px 56px; }
  h1, .page-head h1 { font-size: 27px; }
  .hero, .grid, .two-col, .video-grid { grid-template-columns: 1fr; }
  .course-head, .editor-head { flex-direction: column; align-items: stretch; }
  .variable-row { grid-template-columns: 1fr 1fr; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); }
  .task { flex-direction: column; align-items: stretch; }
  .question-card { padding: 20px 18px; }
  .question-card h2 { font-size: 20px; }
  .quiz-top { position: static; flex-wrap: wrap; }
  .quiz-clock span { display: none; }
  .stat-row { flex-wrap: wrap; }
  .stat-card { min-width: 140px; }
  .post-form { flex-direction: column; align-items: stretch; }
  .module-grid { grid-template-columns: 1fr; }
  .kbd-hint { display: none; }
}
@media (max-width: 640px) {
  .rubric-levels { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .mini-progress li { grid-template-columns: minmax(0, 1fr) 70px 40px; }
  .module-table td:not(:first-child), .module-table th:not(:first-child) { padding-left: 10px; }
  .card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Student progress card */
.progress-body { display: flex; align-items: center; gap: 18px; }
.ring { width: 96px; height: 96px; flex: 0 0 auto; }
.ring-track { fill: none; stroke: #e9ecf3; stroke-width: 8; }
.ring-fill { fill: none; stroke: var(--primary); stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray .6s var(--ease); }
.ring-num { font-family: var(--font-serif); font-size: 24px; font-weight: 700; fill: var(--ink); text-anchor: middle; }
.ring-of { font-size: 10.5px; fill: var(--muted); text-anchor: middle; font-weight: 600; }
.mini-stats { margin: 0; display: grid; gap: 8px; }
.mini-stats div { display: flex; align-items: baseline; gap: 8px; }
.mini-stats dt { font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: var(--ink); min-width: 1.4em; text-align: right; font-variant-numeric: tabular-nums; }
.mini-stats dd { margin: 0; font-size: 13.5px; color: var(--text-2); }
.progress-note { margin: 14px 0 0; }

/* Module cover art (art/mNN.svg, decorative) */
.module-card { padding-top: 0; }
.module-card::before { display: none; }
.module-card .cover { display: block; width: calc(100% + 48px); max-width: none; height: auto; aspect-ratio: 5 / 2; margin: 0 -24px 16px; border-bottom: 1px solid var(--line); transition: transform .3s var(--ease); }
.module-card:hover .cover { transform: scale(1.02); }
.head-cover { width: 300px; height: auto; aspect-ratio: 5 / 2; border-radius: var(--r-lg); box-shadow: var(--shadow-md); align-self: center; }
.next-card { display: grid; grid-template-columns: minmax(0, 1fr) 240px; column-gap: 20px; align-items: center; }
.next-card > * { grid-column: 1; }
.next-card .next-cover { grid-column: 2; grid-row: 1 / span 4; width: 100%; height: auto; aspect-ratio: 5 / 2; border-radius: var(--r); }
.next-card::after { display: none; }
@media (max-width: 820px) {
  .head-cover { width: 100%; order: -1; }
  .next-card { grid-template-columns: 1fr; }
  .next-card .next-cover { grid-column: 1; grid-row: auto; order: -1; margin-bottom: 12px; }
}
.module-num { color: hsl(var(--hue) 75% 26%); }
.badge-paper { background: #eef0fd; color: #2836b0; }
.badge-report { background: #e8f7ef; color: #0f6a42; }
.badge-data { background: #fff5e6; color: #8a4300; }
.discussion-slot { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.best-of { margin-bottom: 18px; }
.best-of > summary { margin: 0; }
.best-of[open] > summary { margin-bottom: 12px; }
/* Module videos: link cards that open on the host's site. */
.video-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.video-link { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.video-link:hover { border-color: var(--primary-line); box-shadow: var(--shadow-sm); }
.video-link:focus-visible { outline: none; box-shadow: var(--ring); }
.video-link strong { display: block; color: var(--ink); line-height: 1.35; }
.video-link .small { display: block; margin-top: 2px; }
.video-play { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 12px; }
.video-note { display: block; margin-top: 4px; color: var(--text-2); font-size: 14px; line-height: 1.45; }
/* Scheduling */
.module-card.locked .cover { filter: grayscale(1); opacity: .55; }
.module-card.locked h3, .module-card.locked p { color: var(--muted); }
.locked-note h2 { margin-top: 0; }
.fill-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 14px 0 6px; }
.fill-row label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.inline-field input { width: 72px; }
.sched-input { width: 100%; min-width: 0; max-width: 240px; }
/* Per-module progress on cards */
.card-progress { display: grid; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.card-progress .bar { display: block; height: 6px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.card-progress .bar > span { display: block; height: 100%; background: var(--success); border-radius: inherit; }
