/* 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: var(--font-sans);  /* Oct 2026: one sans family throughout (Source Serif 4 kept on disk, unused) */

  --ink: #1d1d1f;          /* headings, brand */
  --text: #1d1d1f;
  --text-2: #424245;       /* secondary text */
  --muted: #6e6e73;        /* tertiary text, >= 4.5:1 on --bg */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --line: #e8e8ed;
  --line-strong: #d2d2d7;

  --brand: #1d1d1f;
  --primary: #0066cc;
  --primary-hover: #0057ad;
  --primary-soft: #eaf3fe;
  --primary-line: #b9d8fa;
  --success: #1a7f37;
  --success-soft: #e8f7ef;
  --success-line: #b5e6cc;
  --danger: #d70015;
  --danger-soft: #fdf0ef;
  --danger-line: #f6cdc9;
  --warning: #a14700;
  --warning-soft: #fff5e6;
  --warning-line: #f8d9a8;
  --gold: #f5b83d;

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

  --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-sm: 0 1px 1px rgba(0, 0, 0, .02), 0 4px 16px rgba(0, 0, 0, .05);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .04), 0 16px 40px rgba(0, 0, 0, .09);
  --ring: 0 0 0 4px rgba(0, 113, 227, .3);
  --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", "ss03"; letter-spacing: -.011em; }
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; }
.menu-toggle { display: none; align-items: center; gap: 6px; margin-left: auto; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14.5px; cursor: pointer; }
.menu-toggle[hidden] { display: none !important; }
.menu-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.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, #2b8cff, #0058b9); 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) backwards; }  /* backwards, not both: a leftover transform would trap position: fixed children (the phone glossary sheet) */
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(0, 0, 0, .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), #47a1ff); 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, .module-card .module-card-title { 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), #47a1ff); }
.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, #2b8cff, #0058b9); 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(0, 0, 0, .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(0, 113, 227, .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.part { background: var(--warning-soft); border-color: var(--warning-line); color: var(--warning); }
.q-strip li.current { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(0, 113, 227, .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: #0071e3; }
.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: #0071e3; }
.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) {
  /* Phones: a Menu button opens the links as a list instead of a row that scrolls sideways. */
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .menu-toggle { display: inline-flex; }
  .brand-sub { display: none; }
  .brand-mark { width: 30px; height: 30px; }
  nav { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px 0 4px; border-top: 1px solid var(--line); }
  .topbar.menu-open nav { display: flex; }
  .nav-link { padding: 11px 12px; text-align: left; font-size: 15.5px; }
  .nav-link[aria-current="page"] { background: var(--primary-soft); }
  .nav-link[aria-current="page"]::after { display: none; }
  .account-menu { margin: 6px 0 0; }
  .account-pop { position: static; margin-top: 6px; box-shadow: none; }
  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; }
/* Module tabs, overview checklist, assignment categories */
.module-tabs { margin-top: 4px; }
.module-tabs .count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: var(--r-pill); background: var(--primary-soft); color: var(--primary); font-size: 11.5px; }
.module-panel > * + * { margin-top: 16px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.overview-grid > * + * { margin-top: 0; }
@media (max-width: 860px) { .overview-grid { grid-template-columns: 1fr; } }
.checklist-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.checklist-head h2 { margin: 0; }
.checklist { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 4px; }
.checklist li { display: grid; grid-template-columns: 24px 1fr; column-gap: 10px; align-items: start; padding: 10px 8px; border-radius: var(--r-sm); }
.checklist li:hover { background: var(--surface-2); }
.checklist li .small { grid-column: 2; margin-top: 2px; }
.checklist li .link-btn { text-align: left; font-weight: 600; justify-self: start; }
.checklist .check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; }
.checklist li.done .check { background: var(--success); border-color: var(--success); }
.checklist li.done .link-btn { color: var(--text-2); }
.assignment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.pill.cat-participation { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-line); }
.pill.cat-practice { background: var(--surface-2); color: var(--text-2); }
/* Check-ins, polls, attendance */
.prompt-list { display: grid; gap: 16px; }
.prompt-card h3 { margin: 8px 0 12px; }
.prompt-card.done { border-color: var(--success-line); }
.prompt-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.done-note { color: var(--success); font-weight: 650; }
.poll-q { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.poll-q legend, .poll-legend { display: block; font-weight: 650; color: var(--ink); margin-bottom: 8px; padding: 0; }
.poll-q textarea { width: 100%; }
.scale-row { display: flex; gap: 8px; flex-wrap: wrap; }
.scale-pt { position: relative; }
.scale-pt input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.scale-pt span { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-weight: 650; background: var(--surface); }
.scale-pt input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.scale-pt input:focus-visible + span { box-shadow: var(--ring); }
.scale-ends { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; max-width: 300px; }
.bars { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(80px, 2fr) 44px; gap: 10px; align-items: center; }
.bars .bar-track { height: 12px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.bars .bar-track > span { display: block; height: 100%; background: var(--primary); }
.bars li.correct .bar-track > span { background: var(--success); }
.bars .bar-n { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--text-2); }
@media (max-width: 600px) { .bars li { grid-template-columns: 1fr 44px; } .bars .bar-label { grid-column: 1 / -1; } }
.text-answers { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.text-answers li { padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-sm); }
.text-answers li p { margin: 0 0 4px; }
.code-input { width: 120px; font-size: 22px; letter-spacing: .2em; text-align: center; font-variant-numeric: tabular-nums; }
.live-banner { display: grid; gap: 12px; margin-bottom: 20px; padding: 16px; border: 2px solid var(--primary-line); border-radius: var(--r-lg); background: var(--primary-soft); }
.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); margin-right: 8px; animation: livepulse 1.6s infinite; }
@keyframes livepulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.q-edit { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 0 0 12px; }
.row.between { justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.link-btn.danger { color: var(--danger); }
.feature-list { display: grid; gap: 10px; margin-top: 10px; }
.feature-row { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.feature-row .small { display: block; margin-top: 2px; }
.alerts-card .count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); background: var(--warning-soft); color: var(--warning); font-size: 13px; }
.alert-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.alert-list li { padding: 10px 12px; border-left: 3px solid var(--warning-line); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; display: grid; gap: 2px; }
/* Projector view */
.present { max-width: 1000px; margin: 0 auto; text-align: center; }
.present-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.present-count { font-size: 18px; color: var(--text-2); }
.present-count strong { font-size: 28px; color: var(--ink); }
.present h1 { font-size: clamp(28px, 4vw, 44px); margin: 18px 0; }
.present-label { font-size: 20px; color: var(--text-2); }
.present-code { font-size: clamp(72px, 16vw, 168px); font-weight: 800; letter-spacing: .12em; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; margin: 10px 0; }
.present-q { text-align: left; margin: 20px auto; max-width: 820px; }
.present-q h2 { font-size: clamp(22px, 2.6vw, 30px); }
.present-options { font-size: 22px; line-height: 1.7; }
.present .bars li { font-size: 20px; }
.present .bars .bar-track { height: 22px; }
.present-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
/* Sort, rank and multi-part questions */
.sort-q { display: grid; gap: 10px; margin-top: 12px; }
.sort-item { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin: 0; min-width: 0; }
.sort-item legend { font-weight: 600; color: var(--ink); padding: 0 4px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-block; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); font-size: 14px; background: var(--surface); }
.seg input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.seg input:focus-visible + span { box-shadow: var(--ring); }
.rank-list { list-style: decimal; padding-left: 22px; margin: 10px 0; display: grid; gap: 8px; }
.rank-list li { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.rank-list li::marker { font-weight: 700; color: var(--primary); }
.rank-list li { display: list-item; }
.rank-list .rank-text { display: inline; }
.rank-btns { float: right; display: inline-flex; gap: 4px; margin-left: 8px; }
.rank-btns .btn { padding: 2px 10px; min-height: 32px; }
.parts { padding-left: 22px; display: grid; gap: 14px; margin-top: 12px; }
.parts li p { margin: 0 0 4px; }
/* Explorers */
.explorer h3 { margin-top: 0; }
.ex-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 20px; align-items: start; margin-top: 10px; }
@media (max-width: 760px) { .ex-grid { grid-template-columns: 1fr; } }
.ex-controls { display: grid; gap: 14px; }
.ex-slider { display: grid; gap: 4px; font-size: 14px; color: var(--text-2); }
.ex-slider input { width: 100%; accent-color: var(--primary); }
.ex-svg { width: 100%; height: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); }
.ex-axis { stroke: var(--text-2); stroke-width: 1.5; }
.ex-label { fill: var(--text-2); font-size: 12px; }
.ex-tag { fill: var(--ink); font-size: 12px; font-weight: 600; }
.ex-line { fill: none; stroke: var(--primary); stroke-width: 3; }
.ex-chord { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.ex-guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; }
.ex-gap { stroke: var(--warning); stroke-width: 3; }
.ex-mc { stroke: var(--danger); stroke-width: 2.5; }
.ex-dwl { fill: var(--warning); fill-opacity: .35; stroke: var(--warning); }
.ex-pt { fill: var(--primary); stroke: #fff; stroke-width: 2; }
.ex-pt2 { fill: var(--success); stroke: #fff; stroke-width: 2; }
.ex-bad { fill: var(--danger); stroke: #fff; stroke-width: 2; }
.ex-in { fill: var(--primary); }
.ex-out { fill: var(--line-strong); }
.ex-readout { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: 15px; }
/* Exams and bulk setup */
.quick-actions { flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.module-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 6px 14px; margin-top: 6px; }
.module-checks .check { font-weight: 500; font-size: 14px; }
.exam-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.exam-list li { display: grid; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.exam-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.exam-list .link-btn { justify-self: start; }
.task.exam { border-left: 4px solid var(--primary); }
.ex-cs { fill: var(--primary); fill-opacity: .18; }
.ex-ps { fill: var(--success); fill-opacity: .2; }
.ex-bad-line { stroke: var(--danger); stroke-width: 2.5; stroke-dasharray: 7 4; }
.start-code { display: grid; gap: 6px; margin: 0 0 16px; font-weight: 650; color: var(--ink); }

/* ---------- Study home, flashcards, mastery, badges (Oct 2026) ---------- */
.bar-base, .week-progress .bar, .flash-known .bar, .mastery-list .bar, .result-topics .bar { display: block; height: 8px; border-radius: var(--r-pill); background: #e9ecf3; overflow: hidden; }
.week-progress .bar > span, .flash-known .bar > span, .result-topics .bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #47a1ff); transition: width .5s var(--ease); }

.week-hero { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; padding: 0; overflow: hidden; margin-bottom: 18px; border-color: var(--primary-line); background: linear-gradient(135deg, #fff 55%, var(--primary-soft)); }
.week-cover { width: 100%; height: 100%; object-fit: cover; min-height: 220px; background: var(--surface-2); }
.week-body { padding: 22px 24px 22px 0; display: grid; gap: 10px; align-content: start; }
.week-body h2 { margin: 0; font-family: var(--font-serif); font-size: 26px; font-weight: 650; letter-spacing: -.01em; }
.week-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.week-todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.week-todo li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.week-todo li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--primary); flex: none; transform: translateY(-1px); }
.week-body .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

.journey { margin: 0 0 26px; overflow-x: auto; padding: 4px 2px 6px; }
.journey ol { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; min-width: max-content; }
.journey li { display: flex; align-items: center; }
.journey li + li::before { content: ""; width: 18px; height: 3px; background: var(--line-strong); border-radius: 2px; }
.journey li.done + li::before, .journey li.done + li.done::before { background: var(--success); }
.journey button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); color: var(--text-2); font-weight: 700; font-size: 13px; cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s; }
.journey button:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.journey .started button { border-color: var(--primary); color: var(--primary); }
.journey .current button { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-soft); }
.journey .done button { background: var(--success); border-color: var(--success); color: #fff; }
.journey .locked button { background: var(--surface-2); border-style: dashed; color: var(--muted); }

.task { justify-content: flex-start; }
.task-main { flex: 1; min-width: 0; }
.task-date { flex: none; width: 52px; text-align: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); padding: 6px 0; line-height: 1.1; }
.task-date span { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.task-date strong { display: block; font-size: 20px; font-family: var(--font-serif); }
.task-date.none { background: var(--surface-2); color: var(--muted); }
.task.overdue .task-date { background: var(--danger-soft); color: var(--danger); }
.more-tasks { display: grid; gap: 10px; }
.more-tasks > summary { cursor: pointer; color: var(--primary); font-weight: 650; padding: 6px 2px; }
.more-tasks[open] > summary { margin-bottom: 4px; }
.more-tasks .task { margin-top: 10px; }

/* Quiz */
.quiz-bar { height: 6px; border-radius: var(--r-pill); background: #e9ecf3; overflow: hidden; margin: -4px 0 14px; }
.quiz-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #47a1ff); border-radius: inherit; transition: width .4s var(--ease); }
.q-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.q-topic { font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .07em; font-size: 11.5px; background: var(--primary-soft); padding: 3px 9px; border-radius: var(--r-pill); }
.question-card h2.q-prompt { font-family: var(--font-sans); font-size: 19px; font-weight: 600; line-height: 1.5; letter-spacing: -.005em; margin: 14px 0 20px; }
.result-topics { list-style: none; padding: 0; margin: 18px auto; max-width: 520px; display: grid; gap: 10px; text-align: left; }
.result-topics li { display: grid; grid-template-columns: minmax(0, 1fr) 120px 56px; gap: 12px; align-items: center; font-size: 14.5px; }
.result-topics .small { text-align: right; }

/* Flashcards */
.flash-panel { margin-top: 18px; }
.flash-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.flash-head h2 { margin: 2px 0 0; }
.flash-known { display: grid; grid-template-columns: 140px auto; gap: 10px; align-items: center; }
.flash-stage { perspective: 1400px; }
.flashcard { position: relative; display: grid; width: 100%; min-height: 230px; border: 0; padding: 0; background: none; cursor: pointer; transform-style: preserve-3d; transition: transform .55s var(--ease); border-radius: 18px; text-align: center; }
.flashcard.flipped { transform: rotateY(180deg); }
.flash-face { grid-area: 1 / 1; display: grid; place-content: center; gap: 12px; padding: 28px 32px; border-radius: 18px; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-md); }
.flash-front { background: linear-gradient(140deg, var(--brand), var(--primary)); color: #fff; }
.flash-front strong { font-family: var(--font-serif); font-size: 30px; font-weight: 650; line-height: 1.2; }
.flash-front .small { color: rgba(255, 255, 255, .78); }
.flash-back { background: var(--surface); transform: rotateY(180deg); text-align: left; place-content: center stretch; }
.flash-tag { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; opacity: .85; }
.flash-back .flash-tag { color: var(--primary); }
.flash-def { font-size: 17px; line-height: 1.55; color: var(--text); }
.flash-ex { font-size: 14.5px; color: var(--text-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.flash-controls { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.flash-controls .btn-ghost { min-width: 48px; font-size: 18px; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #0b6640; }
.flash-foot { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; }
.check-inline { display: inline-flex; gap: 8px; align-items: center; color: var(--text-2); }

/* Mastery */
.mastery-card { margin-top: 18px; }
.mastery-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.mastery-head h2 { margin: 0 0 10px; }
.mastery-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.mastery-list li { display: grid; grid-template-columns: minmax(0, 1fr) 160px 104px; gap: 14px; align-items: center; font-size: 14.5px; }
.mastery-list .bar > span { display: block; height: 100%; border-radius: inherit; }
.m-label { font-size: 12.5px; font-weight: 650; text-align: right; }
.m-mastered .bar > span { background: var(--success); } .m-mastered .m-label { color: var(--success); }
.m-close .bar > span { background: #47a1ff; } .m-close .m-label { color: var(--primary); }
.m-work .bar > span { background: #f0a43a; } .m-work .m-label { color: var(--warning); }
.m-new .m-label { color: var(--muted); font-weight: 500; }

/* Badges */
.badge-medal { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; font-weight: 800; font-size: 17px; color: #5b3b00; background: radial-gradient(circle at 35% 30%, #ffe7a6, var(--gold) 60%, #d8962a); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12), 0 2px 6px rgba(216, 150, 42, .35); }
.badge-medal.locked { color: var(--muted); background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--line-strong); }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.badge-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.badge-chip .badge-medal { width: 28px; height: 28px; font-size: 13px; }
.badges-section { margin-bottom: 20px; }
.badge-grid { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.badge-grid li { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); }
.badge-grid li.earned { background: #fffaf0; border-color: #f3dca8; }
.badge-grid li:not(.earned) strong { color: var(--text-2); }
.badge-grid strong { display: block; font-size: 14.5px; }

/* Toasts and confetti */
.toast-host { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow-md); animation: toastin .35s var(--ease); }
.toast strong { display: block; }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .35s; }
@keyframes toastin { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 150; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: confall linear forwards; }
@keyframes confall { to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); opacity: .9; } }

@media (max-width: 820px) {
  .week-hero { grid-template-columns: 1fr; }
  .week-cover { min-height: 0; aspect-ratio: 5 / 2; height: auto; }
  .week-body { padding: 0 18px 20px; }
  .week-body h2 { font-size: 22px; }
  .task { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .task .btn { width: 100%; }
  .mastery-list li { grid-template-columns: minmax(0, 1fr) 90px; }
  .mastery-list .m-label { grid-column: 2; grid-row: 1; }
  .mastery-list .bar { grid-column: 1 / -1; }
  .result-topics li { grid-template-columns: minmax(0, 1fr) 56px; }
  .result-topics .bar { grid-column: 1 / -1; grid-row: 2; }
  .flash-front strong { font-size: 24px; }
  .flash-face { padding: 22px 18px; }
  .question-card h2.q-prompt { font-size: 17.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .flashcard { transition: none; }
  .toast { animation: none; }
  .journey button { transition: none; }
}

/* Points, levels and weekly rings */
.level-card { background: linear-gradient(160deg, #1d1d1f, #2c2c2e); color: #f5f5f7; }
.level-card .card-title { color: #fff; margin: 0; font-size: 19px; }
.level-card .small { color: #a1a1a6; }
.level-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; margin-bottom: 14px; }
.level-badge { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; font-weight: 800; font-size: 19px; color: #1d1d1f; background: linear-gradient(145deg, #ffd66b, #f5a623); box-shadow: 0 4px 14px rgba(245, 166, 35, .35); }
.level-badge.sm { width: 36px; height: 36px; font-size: 16px; border-radius: 11px; flex: none; }
.xp-total { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: #fff; white-space: nowrap; }
.xp-total span { font-size: 13px; font-weight: 500; color: #a1a1a6; }
.xp-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .14); overflow: hidden; margin-bottom: 6px; }
.xp-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffd66b, #f5a623); transition: width .6s var(--ease); }
.rings-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; margin: 16px 0 6px; }
.rings { display: block; }
.act-ring { animation: ringdraw 1.1s var(--ease) both; }
@keyframes ringdraw { from { stroke-dashoffset: var(--len); } }
.ring-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ring-legend li { display: flex; gap: 8px; align-items: flex-start; }
.ring-legend .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; }
.ring-legend strong { color: #fff; font-size: 14px; }
.ring-legend .small { display: block; }
.ring-num { color: #f5f5f7; font-size: 13px; font-variant-numeric: tabular-nums; }
.ring-note { margin: 4px 0 8px; }
.xp-rules summary { cursor: pointer; color: #64b5ff; font-weight: 600; font-size: 14px; }
.xp-rules ul { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; font-size: 13.5px; }
.xp-rules li { display: flex; justify-content: space-between; gap: 10px; color: #e5e5ea; }
.xp-rules li span:last-child { color: #a1a1a6; text-align: right; }
.level-card :focus-visible { box-shadow: 0 0 0 3px rgba(100, 181, 255, .6); }
.xp-plus { display: grid; place-items: center; min-width: 44px; height: 36px; padding: 0 8px; border-radius: 11px; font-weight: 800; color: #1d1d1f; background: linear-gradient(145deg, #ffd66b, #f5a623); flex: none; }
@media (prefers-reduced-motion: reduce) { .act-ring { animation: none; } }
@media (max-width: 380px) { .rings-row { grid-template-columns: 1fr; justify-items: center; } }

/* ---------- Apple-style refinement layer (Oct 2026) ----------
   Overrides earlier component rules: quieter chrome, bolder sans headlines, pill buttons, segmented tabs,
   borderless soft cards. Keep new component styles above this block in their own section; tune the look here. */
body { font-size: 16px; line-height: 1.5; }
h1 { font-family: var(--font-sans); font-weight: 700; font-size: 40px; letter-spacing: -.028em; line-height: 1.1; }
h2 { font-weight: 700; letter-spacing: -.02em; }
h3 { letter-spacing: -.012em; }
.brand-title { font-family: var(--font-sans); font-weight: 700; letter-spacing: -.02em; }

.topbar { height: 56px; background: rgba(251, 251, 253, .78); backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px); border-bottom: 1px solid rgba(0, 0, 0, .07); }
.nav-link { font-size: 14px; font-weight: 500; color: var(--text-2); padding: 7px 12px; border-radius: var(--r-pill); }
.nav-link:hover { background: rgba(0, 0, 0, .05); color: var(--ink); }
.nav-link[aria-current="page"] { color: var(--ink); font-weight: 600; background: rgba(0, 0, 0, .06); }
.nav-link[aria-current="page"]::after { display: none; }
.account-menu summary { border-color: transparent; background: rgba(0, 0, 0, .05); }

main { padding-top: 44px; }
.eyebrow, .course-head .badge, .dash-head .badge, .editor-head .badge { font-size: 13px; letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--primary); }
.page-head .meta { font-size: 17px; color: var(--muted); }
.section-title { font-size: 22px; letter-spacing: -.02em; margin: 40px 0 16px; }

.card { border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 24px 26px; }
.card:where(.module-card, .next-card, .task):hover { box-shadow: var(--shadow-md); }
.task { border: 0; border-radius: 18px; box-shadow: var(--shadow-sm); }
.task.open, .task.overdue, .task.done { box-shadow: var(--shadow-sm); }
.task.overdue .task-main h3 { color: var(--danger); }
.task.exam { border-left: 0; }
.notice { border: 0; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); }

.btn { border-radius: var(--r-pill); padding: 10px 20px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; transition: background .2s, transform .12s var(--ease), box-shadow .2s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-primary { background: var(--primary); box-shadow: none; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: #e8e8ed; border-color: transparent; color: var(--ink); box-shadow: none; }
.btn-secondary:hover:not(:disabled) { background: #dcdce1; }
.btn-ghost { color: var(--primary); }
.btn-ghost:hover:not(:disabled) { background: rgba(0, 113, 227, .08); }
.btn-success { background: var(--success); }
.pill { background: rgba(0, 0, 0, .05); font-weight: 500; }
.badge { background: rgba(0, 113, 227, .1); font-weight: 600; }

/* Segmented control tabs */
.tabs { display: inline-flex; gap: 2px; padding: 3px; border: 0; border-radius: 12px; background: rgba(118, 118, 128, .12); margin-bottom: 26px; max-width: 100%; }
.tab { border: 0; border-radius: 9px; padding: 7px 16px; margin: 0; color: var(--ink); font-weight: 500; font-size: 14px; transition: background .2s, box-shadow .2s; }
.tab:hover { color: var(--ink); background: rgba(255, 255, 255, .5); }
.tab.active { color: var(--ink); background: var(--surface); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 3px 8px rgba(0, 0, 0, .06); }
.tab .count { background: rgba(0, 0, 0, .08); color: var(--text-2); }

/* Module cards and covers */
.module-card { border-radius: 22px; }
.module-card:hover, .module-card:focus-visible { transform: translateY(-3px); }
.module-card .cover { border-bottom: 0; }
.module-card h3, .module-card .module-card-title { font-family: var(--font-sans); font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.module-num { color: var(--muted); font-weight: 600; font-size: 13px; letter-spacing: 0; text-transform: none; }
.head-cover { border-radius: 22px; box-shadow: var(--shadow-sm); }

/* Home */
.week-hero { border: 0; background: var(--surface); box-shadow: var(--shadow-md); border-radius: 24px; }
.week-body h2 { font-family: var(--font-sans); font-weight: 700; font-size: 28px; letter-spacing: -.025em; }
.task-date { border-radius: 14px; background: rgba(0, 113, 227, .08); }
.task-date strong { font-family: var(--font-sans); font-weight: 700; }
.journey li + li::before { background: #d2d2d7; }
.journey button { border-width: 1.5px; }
.journey .current button { box-shadow: 0 0 0 4px rgba(0, 113, 227, .18); }

/* Quiz */
.question-card { border: 0; border-radius: 24px; box-shadow: var(--shadow-sm); padding: 34px 36px; }
.question-card h2.q-prompt { font-size: 20px; letter-spacing: -.018em; }
.choice { border: 1.5px solid #e3e3e8; border-radius: 16px; }
.choice::before { border-radius: 50%; }
.choice:hover { background: #fafafc; border-color: #c7c7cc; }
.choice:has(input:checked) { background: rgba(0, 113, 227, .06); }
.feedback { border: 0; border-radius: 16px; }
.score-circle, .stat-card strong { font-family: var(--font-sans); letter-spacing: -.03em; }
.flash-front { background: linear-gradient(145deg, #1d1d1f, #3a3a3c); }
.flash-front strong { font-family: var(--font-sans); font-weight: 700; letter-spacing: -.025em; }
.flash-face { border: 0; }

/* Tables (instructor) */
table th { font-size: 12px; letter-spacing: .02em; text-transform: none; color: var(--muted); font-weight: 600; }
.card > table { border: 0; }
input, textarea, select { border-radius: 12px; border-color: #d2d2d7; }

@media (max-width: 820px) {
  h1 { font-size: 32px; }
  .tabs { display: flex; }
  .week-body h2 { font-size: 23px; }
  .question-card { padding: 22px 18px; }
}
.week-hero { grid-template-columns: 300px minmax(0, 1fr); padding: 20px; gap: 26px; align-items: center; }
.week-cover { min-height: 0; height: auto; aspect-ratio: 5 / 2; border-radius: 16px; align-self: center; }
.week-body { padding: 0; }
@media (max-width: 820px) { .week-hero { grid-template-columns: 1fr; padding: 16px; gap: 16px; } }
/* Phones and tablets: the bar grows to hold the open menu, which gets a solid background so page text never shows through. */
@media (max-width: 820px) {
  .topbar { height: auto; min-height: 56px; }
  .topbar.menu-open { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 12px 32px rgba(0, 0, 0, .14); max-height: 100vh; max-height: 100dvh; overflow-y: auto; }
  .topbar.menu-open nav { padding-bottom: 10px; }
  .nav-link { border-radius: 12px; }
  .nav-link[aria-current="page"] { background: rgba(0, 0, 0, .06); }
}
.filter-bar label { max-width: 100%; min-width: 0; }
.filter-bar select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
@media (max-width: 820px) { .filter-bar label { flex: 1 1 100%; } .filter-bar select, .filter-bar input[type=search] { flex: 1; } }
.lib-grid { grid-template-columns: repeat(auto-fill, minmax(min(460px, 100%), 1fr)); }
.book { min-width: 0; } .book > div { min-width: 0; overflow-wrap: anywhere; }
.card:has(> table) { overflow-x: auto; }
@media (max-width: 420px) { .book { gap: 12px; } .book-spine { flex-basis: 44px; height: 62px; } }
@media (max-width: 820px) { .pill { white-space: normal; max-width: 100%; } }
/* Tablets and small laptops (up to 1149 px; ECON 4800 instructor links need about 1100 px): the full nav row does not fit, so use the Menu button there too. */
@media (max-width: 1149px) {
  .topbar { height: auto; min-height: 56px; flex-wrap: wrap; padding: 10px 18px; gap: 8px; }
  .menu-toggle { display: inline-flex; }
  nav { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px 0 10px; border-top: 1px solid var(--line); }
  .topbar.menu-open nav { display: flex; }
  .topbar.menu-open { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 12px 32px rgba(0, 0, 0, .14); max-height: 100vh; max-height: 100dvh; overflow-y: auto; }
  .nav-link { padding: 11px 12px; text-align: left; font-size: 15.5px; border-radius: 12px; }
  .account-menu { margin: 6px 0 0; }
  .account-pop { position: static; margin-top: 6px; box-shadow: none; }
}
@media (max-width: 1100px) { .week-hero { grid-template-columns: 1fr; padding: 18px; gap: 16px; } .week-cover { max-height: 200px; width: 100%; } }
@media (min-width: 601px) and (max-width: 820px) { .task .btn { width: auto; } .task { flex-wrap: nowrap; } }
/* Spaced review */
.q-from { font-weight: 700; font-size: 11.5px; letter-spacing: .04em; color: #8a4b00; background: #fff4e0; padding: 3px 9px; border-radius: var(--r-pill); }
.review-card .btn { margin-top: 4px; }
.exam-list .link-btn { display: block; margin-top: 4px; font-size: 14px; }
/* Gradebook grid and analytics (Oct 2026) */
.gb-card { padding: 18px 0 8px; }
.gb-tools { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 0 22px 14px; }
.gb-tools input { flex: 0 1 260px; min-width: 0; }
.gb-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.gb-grid { border-collapse: separate; border-spacing: 0; min-width: 100%; font-variant-numeric: tabular-nums; }
.gb-grid th, .gb-grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; font-size: 14px; }
.gb-grid thead th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: var(--surface); position: sticky; top: 0; }
.gb-grid thead th .small { display: block; font-weight: 500; }
.gb-grid .gb-name { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; min-width: 190px; box-shadow: 1px 0 0 var(--line); }
.gb-grid tbody .gb-name span { display: block; }
.gb-grid tbody .gb-name span:first-child { font-weight: 600; color: var(--ink); }
.gb-grid tbody tr:hover td, .gb-grid tbody tr:hover .gb-name { background: #fafafc; }
.gb-grid tfoot th, .gb-grid tfoot td { font-weight: 700; color: var(--ink); border-bottom: 0; background: var(--surface-2); }
.gb-grid .score-chip { min-width: 40px; display: inline-block; }
.gb-flag { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 4px; border-radius: 50%; font-size: 10px; font-weight: 800; color: var(--warning); background: var(--warning-soft); vertical-align: middle; }
.gb-missing { display: inline-block; padding: 2px 8px; border-radius: var(--r-pill); background: var(--danger-soft); color: var(--danger); font-size: 12px; font-weight: 600; }
.gb-dim { color: var(--muted); }
.gb-miss-n { display: block; color: var(--danger); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { text-align: left; padding: 18px 20px; }
.stat-card strong { font-size: 30px; font-weight: 700; }
.stat-of { font-size: 16px; color: var(--muted); font-weight: 500; }
.an-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.an-wide { grid-column: 1 / -1; }
.an-grid .card h2 { margin-bottom: 12px; }
.an-table th, .an-table td { vertical-align: middle; }
.an-table th[scope=row] { text-align: left; font-weight: 500; }
.an-bar { display: inline-block; width: 90px; height: 6px; border-radius: 999px; background: #e9ecf3; overflow: hidden; margin-right: 8px; vertical-align: middle; }
.an-bar > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.dist { display: inline-flex; align-items: flex-end; gap: 3px; height: 36px; }
.dist span { width: 12px; border-radius: 3px 3px 0 0; }
.dist .d0 { background: #f0a43a; } .dist .d1 { background: #f5c26b; } .dist .d2 { background: #9cc9f5; } .dist .d3 { background: #4f9ae8; } .dist .d4 { background: var(--success); }
.spark { width: 100%; height: auto; display: block; margin: 4px 0 8px; }
.an-hard { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 10px; }
.an-hard li { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.an-hard strong { display: block; font-size: 14.5px; }
.an-mods li { grid-template-columns: minmax(0, 1fr) 120px 92px; }
@media (max-width: 900px) { .an-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .gb-grid .gb-name { min-width: 140px; } .gb-tools { padding: 0 16px 12px; } .an-mods li { grid-template-columns: minmax(0, 1fr) 90px; } }
.an-grid > * { min-width: 0; } .an-grid .table-wrap { overflow-x: auto; }
@media (max-width: 600px) { .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .stat-card { padding: 14px 16px; } .stat-card strong { font-size: 24px; } }
.nav-link, .account-menu summary { white-space: nowrap; }
.row-hidden td { opacity: .55; }
.row-hidden td:last-child { opacity: 1; }
.vis-toggle { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.auth-alt { text-align: center; margin: 18px 0 0; font-size: 14.5px; }
/* Privacy notice */
.privacy { max-width: 760px; margin: 0 auto; padding: 34px 38px; }
.privacy h1 { margin: 6px 0 10px; }
.privacy h2 { font-size: 19px; margin: 26px 0 8px; }
.privacy ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.privacy li, .privacy p { color: var(--text); line-height: 1.6; }
.privacy-ack { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.footer-link { margin-top: 8px; font-size: 12.5px; }
@media (max-width: 600px) { .privacy { padding: 22px 18px; } }

/* ---------- Course notes reader (Oct 2026) ---------- */
.notes-tools { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 14px; }
.notes-card { padding: 40px 48px; }
.note-chapter { max-width: 70ch; margin: 0 auto; font-size: 17px; line-height: 1.7; color: var(--text); }
.note-head h2 { font-size: 32px; letter-spacing: -.025em; line-height: 1.15; margin: 6px 0 14px; }
.note-intro { font-size: 18.5px; color: var(--text-2); line-height: 1.6; }
.note-toc { margin: 20px 0 8px; padding: 14px 18px; border-radius: 14px; background: var(--surface-2); }
.note-toc ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 15px; }
.note-toc a { color: var(--primary); text-decoration: none; }
.note-toc a:hover { text-decoration: underline; }
.note-section { scroll-margin-top: 80px; }
.note-section h3 { font-size: 23px; letter-spacing: -.02em; margin: 40px 0 12px; }
.note-chapter p { margin: 0 0 16px; color: var(--text); }
.note-chapter ul { margin: 0 0 16px; padding-left: 22px; display: grid; gap: 6px; }
.note-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.note-key { margin: 22px 0; padding: 16px 20px; border-radius: 14px; background: var(--primary-soft); border-left: 4px solid var(--primary); }
.note-key .note-label { color: var(--primary); }
.note-key p { margin: 0; font-weight: 500; }
.note-example { margin: 24px 0; padding: 18px 22px; border-radius: 14px; background: #fbf8f1; border: 1px solid #efe4cc; }
.note-example .note-label { color: #8a5a00; }
.note-example h4 { margin: 0 0 10px; font-size: 17px; }
.note-example p:last-child { margin-bottom: 0; }
.note-eq { margin: 18px 0; text-align: center; }
.note-eq div { display: inline-block; padding: 10px 18px; border-radius: 10px; background: var(--surface-2); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 16px; }
.note-eq figcaption, .note-eq .figcap, .note-table figcaption, .note-table .figcap { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.note-table { margin: 20px 0; }
.note-table table { font-size: 15px; }
.note-check { margin: 24px 0; padding: 16px 20px; border-radius: 14px; border: 1.5px dashed var(--line-strong); }
.note-check .note-label { color: var(--success); }
.note-check details summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: 15px; }
.note-check details p { margin: 10px 0 0; }
.note-summary { margin-top: 40px; padding: 20px 24px; border-radius: 16px; background: var(--surface-2); }
.note-summary h3 { margin: 0 0 10px; font-size: 19px; }
.note-summary ul { margin: 0; }
.note-graph { margin: 24px 0; }
.note-graph svg { display: block; width: 100%; max-width: 600px; height: auto; margin: 0 auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); }
.note-graph figcaption, .note-graph .figcap { max-width: 600px; margin: 8px auto 0; font-size: 14px; color: var(--text-2); }
.g-axis { stroke: var(--text-2); stroke-width: 1.5; } .g-axis-label, .g-tick { fill: var(--text-2); font-size: 12px; }
.g-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; } .g-dash { stroke-dasharray: 7 6; }
.g-line.g-blue { stroke: var(--primary); } .g-line.g-red { stroke: var(--danger); } .g-line.g-green { stroke: var(--success); } .g-line.g-gold { stroke: var(--warning); }
.g-line-label { font-size: 13px; font-weight: 600; } .g-line-label.g-blue { fill: var(--primary); } .g-line-label.g-red { fill: var(--danger); } .g-line-label.g-green { fill: var(--success); } .g-line-label.g-gold { fill: var(--warning); }
.g-area { stroke: none; opacity: .28; } .g-area.g-blue { fill: var(--primary); } .g-area.g-red { fill: var(--danger); } .g-area.g-green { fill: var(--success); } .g-area.g-gold { fill: var(--gold); }
.g-area-label { fill: var(--text); font-size: 12px; font-weight: 600; }
.g-guide { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; } .g-point { fill: var(--text); } .g-point-label { fill: var(--text); font-size: 13px; font-weight: 600; }
@media (max-width: 600px) { .note-graph .g-tick, .note-graph .g-axis-label { font-size: 18px; } .note-graph .g-line-label, .note-graph .g-point-label { font-size: 20px; } .note-graph .g-area-label { font-size: 17px; } }
.note-source { margin: 28px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.term-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; border-bottom: 1.5px dotted var(--primary); }
.term-link[aria-expanded="true"] { color: var(--primary); }
.term-pop { display: block; margin: 8px 0 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-size: 15px; line-height: 1.5; }
.term-pop[hidden] { display: none; }
.notes-end { display: flex; gap: 12px; align-items: center; justify-content: flex-end; flex-wrap: wrap; max-width: 70ch; margin: 30px auto 0; padding-top: 20px; border-top: 1px solid var(--line); }
@media (max-width: 700px) { .notes-card { padding: 22px 18px; } .note-chapter { font-size: 16.5px; } .note-head h2 { font-size: 26px; } .note-intro { font-size: 17px; } .notes-tools { justify-content: stretch; } .notes-tools .btn { flex: 1; } }

/* Print / Save as PDF: only the notes print */
#printRoot { display: none; }
@media print {
  body.print-notes > *:not(#printRoot) { display: none !important; }
  body.print-notes #printRoot { display: block; }
  body.print-notes { background: #fff; }
  #printRoot .note-chapter { max-width: none; font-size: 11pt; line-height: 1.55; break-before: page; }
  #printRoot .print-cover + .note-chapter, #printRoot > .note-chapter:first-child { break-before: auto; }
  #printRoot .print-cover { break-after: page; padding-top: 30%; text-align: center; }
  #printRoot .print-cover h1 { font-size: 28pt; } #printRoot .print-cover ol { text-align: left; display: inline-block; margin-top: 24pt; }
  #printRoot .note-head h2 { font-size: 20pt; } #printRoot .note-section h3 { font-size: 14pt; margin-top: 18pt; break-after: avoid; }
  #printRoot .note-key, #printRoot .note-example, #printRoot .note-check, #printRoot .note-discuss, #printRoot .note-image, #printRoot .note-summary, #printRoot figure { break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #printRoot .note-answers { break-before: avoid; margin-top: 18pt; } #printRoot .print-foot { font-size: 9pt; color: #666; margin-top: 24pt; }
  @page { margin: 18mm 16mm; }
}
.term-wrap { position: relative; }
.term-pop { position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; width: min(340px, calc(100vw - 32px)); margin: 0; font-size: 14.5px; font-weight: 400; color: var(--text); box-shadow: var(--shadow-md); }

/* ---------- Discussion questions (discuss.js) and images in the notes, Oct 2026 ---------- */
.disc-section { margin-bottom: 28px; }
.disc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.disc-card { padding: 0; overflow: hidden; }
.disc-card.featured { grid-column: 1 / -1; }
.disc-card.featured .disc-img img { aspect-ratio: 21 / 8; }
.disc-img { margin: 0; position: relative; }
.disc-img img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.disc-img .img-credit { position: absolute; right: 8px; bottom: 6px; margin: 0; padding: 2px 8px; border-radius: var(--r-pill); background: rgba(0, 0, 0, .62); color: #fff; font-size: 11px; }
.disc-img .img-credit a { color: #fff; }
.disc-body { padding: 20px 22px 22px; }
.disc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.disc-kind { display: inline-block; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; letter-spacing: .02em; background: var(--primary-soft); color: var(--primary-hover); }
.disc-kind.kind-debate { background: var(--danger-soft); color: #a3000f; }
.disc-kind.kind-local { background: var(--warning-soft); color: var(--warning); }
.disc-kind.kind-numbers { background: var(--success-soft); color: var(--success); }
.disc-card h3 { margin: 0 0 8px; font-size: 21px; line-height: 1.25; }
.disc-card.featured h3 { font-size: 26px; }
.disc-hook { margin: 0 0 10px; color: var(--text-2); }
.disc-question { margin: 0 0 12px; font-weight: 600; font-size: 17px; }
.disc-concepts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.disc-concepts .chip { padding: 2px 10px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); color: var(--text-2); background: var(--surface); }
.split { margin: 0 0 16px; }
.split-bar { display: flex; height: 10px; border-radius: var(--r-pill); overflow: hidden; background: var(--line); }
.split-a { background: var(--primary); } .split-b { background: var(--danger); }
.split-legend { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 13px; color: var(--text-2); }
.split-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.dot-a { background: var(--primary); } .dot-b { background: var(--danger); }
.disc-form { display: grid; gap: 8px; margin: 0 0 8px; }
.disc-form textarea { width: 100%; }
.disc-form .btn { justify-self: start; }
.disc-label { font-weight: 600; font-size: 14px; }
.side-pick { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.side-pick legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.side-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer; background: var(--surface); }
.side-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.side-option input { margin-top: 3px; }
.disc-locked { margin: 12px 0 0; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); color: var(--text-2); font-size: 14px; }
.discussion-post header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.discussion-post .when { color: var(--muted); font-size: 12px; }
.discussion-post .avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--primary-soft); color: var(--primary-hover); font-weight: 700; font-size: 13px; text-transform: uppercase; }
.discussion-post.is-hidden { opacity: .55; }
.side-chip { padding: 1px 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; }
.side-chip.side-0 { background: var(--primary-soft); color: var(--primary-hover); } .side-chip.side-1 { background: var(--danger-soft); color: #a3000f; }
.replies { margin: 10px 0 0 34px; border-left: 2px solid var(--line); padding-left: 14px; }
.reply-post { padding: 10px 0; border-top: 0; }
details.reply { margin: 8px 0 0 34px; } details.reply summary { cursor: pointer; color: var(--primary); font-size: 14px; font-weight: 500; }
.reply-form { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; } .reply-form textarea { flex: 1; }
.btn-sm { padding: 6px 14px; font-size: 14px; }
.note-image { margin: 26px 0; }
.note-image .note-img { margin: 0; }
.note-image img { display: block; width: 100%; max-width: 680px; height: auto; margin: 0 auto; border-radius: var(--r); background: var(--surface-2); }
.note-image figcaption, .note-image .figcap { max-width: 680px; margin: 8px auto 0; font-size: 14px; color: var(--text-2); }
.img-credit { max-width: 680px; margin: 4px auto 0; font-size: 12px; color: var(--muted); }
.img-credit a { color: inherit; }
.note-discuss { margin: 26px 0; padding: 18px 20px; border-radius: 16px; border: 1px solid var(--danger-line); background: linear-gradient(135deg, var(--danger-soft), var(--surface) 70%); }
.note-discuss h4 { margin: 6px 0 6px; font-size: 18px; }
.note-discuss p { margin: 0 0 12px; }
@media (max-width: 760px) {
  .disc-grid { grid-template-columns: minmax(0, 1fr); }
  .disc-card.featured .disc-img img { aspect-ratio: 16 / 9; }
  .disc-card.featured h3 { font-size: 22px; }
  .replies, details.reply { margin-left: 12px; }
  .reply-form { flex-direction: column; align-items: stretch; }
}
.note-discuss .note-label { color: #a3000f; }
.rubric-box { margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.rubric-box summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--primary); }
.rubric-box .table-wrap { overflow-x: auto; padding: 0 14px; }
.rubric-guide { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 13px; }
.rubric-guide th, .rubric-guide td { padding: 8px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.rubric-guide thead th { color: var(--muted); font-weight: 600; }
.rubric-guide tbody th { font-weight: 600; width: 22%; }
.rubric-guide td:last-child { background: var(--success-soft); }
.rubric-box > .small { margin: 8px 14px 12px; }
.fixai-intro { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); color: var(--text-2); font-size: 15px; }
.ai-badge { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #5e5ce6, #0066cc); color: #fff; font-weight: 700; font-size: 12px; }
.fixai-steps { border: 0; padding: 0; margin: 14px 0; display: grid; gap: 8px; }
.fixai-steps legend { font-weight: 600; margin-bottom: 8px; }
.fixai-step { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; line-height: 1.5; }
.fixai-step strong { font-family: var(--font-sans); }
.fixai-step:has(input:checked) { border-color: var(--danger); background: var(--danger-soft); }
.fixai-step input { margin-top: 4px; }
.bad-step { color: var(--danger); font-weight: 600; }
.first-take { margin: 0 0 14px; padding: 16px 18px; border-radius: var(--r); border: 1px dashed var(--primary-line); background: var(--primary-soft); }
.first-take.done { border-style: solid; border-color: var(--line); background: var(--surface-2); }
.first-take .ft-ask { font-weight: 600; margin: 6px 0; }
.first-take textarea { width: 100%; margin: 8px 0; }
.ft-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ft-clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; color: var(--primary); }
.ft-clock.over { color: var(--warning); font-size: 14px; }
.disc-form input, .reflect-form input { width: 100%; }
.process-notes { margin: 8px 0; font-size: 14px; } .process-notes summary { cursor: pointer; color: var(--primary); font-weight: 500; }
.process-notes p { margin: 6px 0; color: var(--text-2); }
.gb-extra { background: var(--surface-2); } th.gb-extra { white-space: normal; min-width: 96px; } th.gb-extra .small { display: block; font-weight: 400; }
.note-eq .figcap { margin: 6px 0 0; }
/* Module cards: the title is the real (keyboard and screen reader) link; the whole card stays clickable with the mouse. */
.module-card { position: relative; cursor: pointer; }
.card-link { all: unset; cursor: pointer; color: inherit; font: inherit; }
.card-link:focus-visible { outline: none; }
.module-card:has(.card-link:focus-visible) { box-shadow: var(--ring); }
.assignment-card .assignment-title { font-size: 16.5px; margin: 0 0 6px; }
.quiz-h1 { margin: 0; font-weight: 400; letter-spacing: 0; }
.review-name { display: inline; font-size: 16px; margin: 0; }
.review-sub { font-size: 15px; margin: 14px 0 6px; }
.note-table td.na { color: var(--muted); font-size: .9em; }
.instr-note { margin: 8px 0 0; padding: 10px 14px; border-radius: var(--r); background: var(--warning-soft); color: var(--text-2); font-size: 14px; }

/* Phones and tablets: iPhone Safari zooms the page into any text box whose text is under 16px and leaves it zoomed and
   shifted sideways, so touch screens get 16px form text (larger sizes such as the answer and start-code boxes stay). */
@media (pointer: coarse) {
  input, textarea, select, select.compact { font-size: max(16px, 1em); }
}
/* The phone app (opened from the home screen) has no browser bar: keep the install hint away. */
@media (display-mode: standalone) { .install-hint { display: none; } }

/* iPhone layout (Oct 2026, from the "EconLab iOS App" design): on phones the main sections move to a bottom tab bar
   (students: Home, Modules, Library, Progress; instructors: Home, Modules, Assignments, Gradebook, More, which opens the
   full menu), Apple devices use the system font, the page uses the iOS grouped background, the Check answer button stays
   at the bottom of the screen, and glossary definitions slide up as a sheet. Desktop and tablet are unchanged. */
.tabbar { display: none; }
.term-close { display: none; }
@media (max-width: 760px) {
  :root { --font-sans: -apple-system, BlinkMacSystemFont, "Inter", ui-sans-serif, system-ui, "Segoe UI", sans-serif; --bg: #f2f2f7; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  h1, .page-head h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
  .card, .question-card { border-radius: 18px; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 5px max(6px, env(safe-area-inset-left, 0px)) calc(5px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-right, 0px));
    background: rgba(249, 249, 251, .94); -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px); border-top: 1px solid #d1d1d6; }
  .tabbar:not(:has(.tab-item:not([hidden]))) { display: none; }
  .tabbar .tab-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; padding: 4px 0; border: 0; border-radius: 10px; background: none;
    color: #636366; font: inherit; font-size: 10.5px; font-weight: 600; text-align: center; cursor: pointer; }
  .tabbar .tab-item svg { width: 26px; height: 26px; }
  .tabbar .tab-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tabbar .tab-item[hidden] { display: none; }
  .tabbar .tab-item:hover { background: none; color: var(--ink); }
  .tabbar .tab-item[aria-current="page"] { color: var(--primary); background: none; }
  .tabbar .tab-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
  /* While answering questions, the tab bar steps aside so a stray tap cannot leave the set; the answer buttons stay in reach. */
  body:has(.question-card .quiz-actions) .tabbar { display: none; }
  body:has(.question-card .quiz-actions) { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .question-card .quiz-actions { position: sticky; bottom: 0; z-index: 5; margin: 18px -18px -22px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 18px 18px; }
  .question-card .quiz-actions .btn-primary { flex: 1; min-height: 50px; font-size: 17px; }
  .choice { min-height: 56px; padding-top: 15px; padding-bottom: 15px; font-size: 16px; }
  .term-pop { position: fixed; left: 0 !important; right: 0; top: auto; bottom: 0; z-index: 60; width: auto; margin: 0; padding: 26px 22px calc(22px + env(safe-area-inset-bottom, 0px));
    border: 0; border-radius: 22px 22px 0 0; font-size: 16.5px; line-height: 1.5; box-shadow: 0 -8px 30px rgba(0, 0, 0, .18); }
  .term-pop::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: #c7c7cc; }
  .term-pop strong { display: block; font-size: 21px; margin-bottom: 6px; }
  .term-close { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 46px; margin-top: 16px; border: 1px solid var(--line-strong); border-radius: var(--r-pill);
    background: var(--surface); color: var(--primary); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
}
/* Install on your phone page */
.install-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.install-step { padding: 20px 22px; }
.install-step h2 { margin: 0 0 8px; font-size: 20px; }
.install-step ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; line-height: 1.5; }
@media (max-width: 760px) { .install-grid { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 1150px) { #mainNav .nav-install { display: none; } }   /* computers: the footer link is enough */
/* Sign-in page: how accounts work (there is no sign-up) */
.auth-help { margin: 22px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); }
.auth-help h2 { margin: 0 0 4px; font-size: 16px; }
.auth-help p { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--text-2); }
.footer-link[hidden] { display: none; }
.menu-toggle[hidden] { display: none !important; }   /* signed out: nothing to show in the menu */
/* iPhone "random zoom": quick double taps (two answer choices, Next twice) zoomed the page, and Safari may inflate text when
   the phone rotates. touch-action: manipulation turns off double-tap zoom but keeps pinch-to-zoom (WCAG 1.4.4 needs it; never
   add maximum-scale or user-scalable=no to the viewport tag). */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.join-code { margin: 10px 0; font-size: 28px; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; color: var(--ink); }
.auth-help .btn { margin-top: 10px; }
.auth-help .small { margin-top: 10px; }
.inactive-list { margin-top: 16px; } .inactive-list summary { cursor: pointer; font-weight: 600; }
.roster-off { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; margin: 10px 0; display: grid; gap: 6px; }
.roster-off legend { font-weight: 600; padding: 0 4px; } .roster-off .btn { justify-self: start; margin-top: 6px; }
#rosterPaste { width: 100%; margin: 6px 0 10px; }
