/* Study Companion — Nordic Calm: a cool grey ground, white rounded cards, fjord blue, Manrope for
   the interface and Source Serif 4 for the book, with a soft blue mark for highlights. */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/assets/vendor/fonts/manrope-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/assets/vendor/fonts/manrope-latin-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap; src: url("/assets/vendor/fonts/source-serif-4-latin-opsz-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap; src: url("/assets/vendor/fonts/source-serif-4-latin-ext-opsz-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 200 900; font-display: swap; src: url("/assets/vendor/fonts/source-serif-4-latin-opsz-italic.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  color-scheme: light;
  --ground: #EEF1F4;
  --surface: #FFFFFF;
  --subtle: #F7F9FB;
  --line: #E1E6EB;
  --line-soft: #E8EDF1;
  --line-strong: #C9D3DB;
  --ink: #18242E;
  --ink-2: #33424E;
  --muted: #5E6B76;
  --faint: #67737D;
  --accent: #2B6A88;
  --accent-strong: #1D4E66;
  --accent-soft: #E6EEF3;
  --accent-mid: #9DB9C8;
  --stuck: #8E4410;
  --stuck-soft: #FDEBDD;
  --stuck-bar: #D9822B;
  --neutral-soft: #EEF1F4;
  --good: #245A49;
  --good-soft: #E5F0EC;
  --mark: #CFE6F2;
  --answer: #2F6B3F;
  --mark-soft: #E3F1F8;
  --danger: #A33027;
  --danger-soft: #FBE5E1;
  --shadow: 0 12px 32px rgba(24, 36, 46, .14);
  --card-shadow: 0 1px 2px rgba(24, 36, 46, .04), 0 12px 32px rgba(24, 36, 46, .06);
  --raise: 0 1px 3px rgba(24, 36, 46, .08);
  --radius: 22px;
  --ui: "Manrope", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --read: "Source Serif 4", "Iowan Old Style", Cambria, Georgia, serif;
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--ground); }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }
:where(a, button, summary, select, input, textarea, [tabindex]):focus-visible { outline: 3px solid rgba(43, 106, 136, .45); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { display: inline-flex; flex: none; }
.skip-link { position: absolute; left: 8px; top: 8px; z-index: 100; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.muted { color: var(--muted); }
.serif { font-family: var(--read); }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #D9E6EE; color: var(--accent-strong); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
.btn-small { min-height: 38px; padding: 0 16px; font-size: 14px; }
.btn-stuck { background: var(--stuck-soft); color: var(--stuck); }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font-weight: 700; text-decoration: none; }
.link-btn:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
.chip-btn { min-height: 38px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--surface); box-shadow: var(--raise); color: var(--ink-2); font-weight: 700; }
.chip-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
.chip-btn .count { margin-left: 4px; color: var(--muted); font-weight: 600; }
.chip-btn[aria-pressed="true"] .count { color: #fff; }

/* Status pills */
.pill { display: inline-flex; align-items: center; justify-content: center; min-width: 92px; padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.pill-finished { background: var(--accent); color: #fff; }
.pill.pill-in_progress { background: var(--accent-soft); color: var(--accent-strong); }
.pill.pill-stuck { background: var(--stuck-soft); color: var(--stuck); }
.pill.pill-not_started, .pill.pill-revisit { background: var(--neutral-soft); color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field > label { font-size: 14px; font-weight: 600; }
.input, .field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 9px 14px; border: 1.5px solid #D5DDE3; border-radius: 14px; background: var(--surface); }
.field textarea { resize: vertical; line-height: 1.55; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* App shell: the sidebar (Home, subjects with their sections, account) beside the page. The reader
   and the practice desk fold it to a narrow rail of icons so the book or the paper gets the room. */
.shell { display: flex; align-items: stretch; min-height: 100vh; }
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sidebar { position: sticky; top: 0; flex: none; width: 256px; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 24px 16px 16px; background: var(--subtle); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; color: var(--ink); font-weight: 800; font-size: 17px; text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; }
.sidebar-toggle { display: none; }
.sidebar-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--ink-2); font-weight: 600; text-decoration: none; }
.side-link:hover { background: rgba(24, 36, 46, .04); color: var(--ink); }
.side-link[aria-current="page"] { background: var(--surface); box-shadow: var(--raise); color: var(--ink); font-weight: 700; }
.side-link[aria-current="page"] > .icon { color: var(--accent); }
.side-label { margin: 18px 12px 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.side-swatch { flex: none; width: 10px; height: 10px; border-radius: 4px; background: var(--swatch, var(--accent)); }
.side-link.open { color: var(--ink); font-weight: 800; }
.side-link .side-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-sub { list-style: none; display: flex; flex-direction: column; gap: 2px; margin: 0 0 6px 17px; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.side-sub .side-link { min-height: 38px; border-radius: 10px; font-size: 14px; }
.side-sub .side-link[aria-current="page"] { color: var(--accent-strong); }
.side-sub .side-sub { margin: 2px 0 4px 10px; padding-left: 0; border-left: 0; }
.side-sub .side-sub .side-link { min-height: 32px; font-size: 13px; font-weight: 600; justify-content: space-between; }
.side-sub .side-sub .side-link[aria-current="location"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.side-count { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); }
.side-new { color: var(--muted); border: 0; background: none; width: 100%; text-align: left; }
.side-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.side-foot .menu-anchor { width: 100%; }
.side-foot .menu { top: auto; bottom: calc(100% + 6px); left: 0; right: auto; }
.side-foot .account-btn { width: 100%; justify-content: flex-start; min-height: 44px; padding: 0 12px; background: transparent; color: var(--ink-2); }
.side-foot .account-btn:hover { background: rgba(24, 36, 46, .04); }
.side-foot .account-btn .account-name { flex: 1; text-align: left; }
.avatar { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #D7E4EC; color: var(--accent-strong); font-size: 13px; font-weight: 800; }
.side-tools { display: flex; align-items: center; gap: 6px; }
.ai-chip { display: inline-flex; align-items: center; gap: 8px; padding: 12px 12px; border-radius: 14px; font-size: 13px; font-weight: 600; cursor: help; }
.ai-chip[data-state="ready"] { background: var(--good-soft); color: var(--good); }
.ai-chip[data-state="ready"] .dot { color: #3B8A6E; }
.ai-chip[data-state="off"] { background: var(--stuck-soft); color: var(--stuck); }
.ai-chip[data-state="error"] { background: var(--danger-soft); color: var(--danger); }
/* The rail: the same links as icons and initials */
.sidebar.rail { width: 76px; align-items: center; padding: 24px 0 16px; }
.sidebar.rail .brand { padding: 0 0 14px; }
.sidebar.rail .brand-name, .sidebar.rail .side-label, .sidebar.rail .side-text, .sidebar.rail .side-sub, .sidebar.rail .side-new, .sidebar.rail .ai-chip, .sidebar.rail .account-name, .sidebar.rail .side-foot .icon:not(.avatar-icon) { display: none; }
.sidebar.rail .sidebar-body { align-items: center; }
.sidebar.rail .side-link { justify-content: center; width: 44px; padding: 0; }
.sidebar.rail .side-swatch { display: none; }
.sidebar.rail .side-initials { display: inline; }
.side-initials { display: none; font-weight: 800; }
.sidebar.rail .side-list { align-items: center; }
.sidebar.rail .side-foot .account-btn { width: 44px; padding: 0; justify-content: center; }
.sidebar.rail .side-tools { flex-direction: column; }

/* The bar over a page: Ask your books */
.top-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.ask-trigger { flex: 1 1 280px; max-width: 560px; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--surface); box-shadow: var(--raise); color: var(--muted); text-align: left; }
.ask-trigger span.label { flex: 1; }
kbd { padding: 2px 8px; border: 0; border-radius: 8px; background: var(--ground); font-family: inherit; font-size: 12px; font-weight: 700; }

/* Page layout */
.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 40px 72px; display: flex; flex-direction: column; gap: 28px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title { font-size: 38px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.crumbs { font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.row-wrap { display: flex; flex-wrap: wrap; gap: 24px; }
.main-col { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.side-col { flex: 1 1 290px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--surface); border: 0; border-radius: var(--radius); box-shadow: 0 1px 2px rgba(24, 36, 46, .04); }
.card-pad { padding: 22px 24px; }
.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.empty { padding: 18px 20px; border: 1.5px dashed #C9D3DB; border-radius: 18px; color: var(--muted); }
.notice { padding: 12px 16px; border-radius: 14px; background: var(--danger-soft); color: var(--danger); }
.notice.info { background: var(--accent-soft); color: var(--accent-strong); }
.notice.warn { background: var(--stuck-soft); color: var(--stuck); }
.progressbar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--accent-soft); }
.progressbar span { display: block; height: 100%; }
.bar-done { background: var(--accent); }
.bar-progress { background: var(--accent-mid); }
.bar-stuck { background: var(--stuck-bar); }
.thin-bar { height: 8px; border-radius: 999px; overflow: hidden; background: var(--accent-soft); }
.thin-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s; }
/* A progress ring: --p is the share done, 0–100 */
.ring { --size: 52px; --p: 0; position: relative; flex: none; width: var(--size); height: var(--size); display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--accent-soft) 0); font-weight: 800; }
.ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.ring > * { position: relative; }
.ring.big { --size: 140px; }
.ring.big::before { inset: 12px; }
.ring-label { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.ring-label strong { font-size: 28px; font-weight: 800; }
.ring-label small { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }

/* Popover menus */
.menu-anchor { position: relative; }
.menu { position: absolute; z-index: 50; top: calc(100% + 6px); right: 0; min-width: 240px; display: flex; flex-direction: column; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.menu.left { right: auto; left: 0; }
.menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; text-decoration: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--accent-soft); color: var(--ink); }
.menu-item strong { font-weight: 600; }
.menu-item small { color: var(--muted); font-size: 13px; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }

/* Dialogs */
dialog.sheet { width: min(640px, calc(100vw - 32px)); max-height: 90vh; padding: 0; border: 0; border-radius: 24px; background: var(--surface); box-shadow: 0 24px 64px rgba(24, 36, 46, .28); }
dialog.sheet.wide { width: min(1000px, calc(100vw - 32px)); }
dialog.sheet::backdrop { background: rgba(24, 36, 46, .38); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line-soft); }
.sheet-head h2 { font-size: 19px; font-weight: 800; }
.sheet-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; overflow: auto; max-height: calc(90vh - 140px); }
.sheet-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line-soft); }

/* Home */
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 28px; padding: 32px; box-shadow: var(--card-shadow); }
.hero-main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.hero-eyebrow { font-size: 13px; font-weight: 700; color: var(--accent); }
.continue-title { font-size: 36px; font-weight: 800; line-height: 1.12; letter-spacing: -.02em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.card-title { font-size: 16px; font-weight: 800; }
.preview-text { padding: 14px 16px; border-radius: 14px; background: var(--subtle); font-family: var(--read); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 14px; color: var(--muted); }
.chapter-bars { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 6px; }
.chapter-bars a { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; color: var(--ink-2); font-size: 12px; font-weight: 700; text-decoration: none; }
.chapter-bars .bar { height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--accent) var(--p), var(--line) var(--p)); }
.chapter-bars .bar[data-state="reading"] { background: linear-gradient(90deg, var(--accent) var(--p), #CFE0EA var(--p)); }
.chapter-bars .bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subject-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.subject-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 16px; background: var(--subtle); color: var(--ink); text-decoration: none; }
.subject-card:hover { background: var(--accent-soft); color: var(--ink); }
.subject-name { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; }
.subject-card .thin-bar { height: 6px; }
.list-card { display: flex; flex-direction: column; gap: 8px; }
.list-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 0; border-radius: 16px; background: var(--subtle); color: var(--ink); text-align: left; text-decoration: none; }
.list-row:hover { background: var(--accent-soft); color: var(--ink); }
.list-row.stuck { background: #FDF4EC; }
.list-row.stuck:hover { background: var(--stuck-soft); }
.list-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: #E6EBEF; color: var(--ink-2); }
.list-row.stuck .list-icon { background: var(--stuck-soft); color: var(--stuck); }
.list-row .pill { min-width: 0; }

/* Steps (question parts) */
.steps { display: flex; flex-wrap: wrap; gap: 6px; }
.step { min-width: 44px; height: 34px; padding: 0 10px; border: 0; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1.5px #D5DDE3; color: var(--ink-2); font-size: 13px; font-weight: 700; text-decoration: none; display: inline-grid; place-items: center; }
.step:hover { color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--accent-mid); }
.step[data-status="finished"] { background: var(--accent); box-shadow: none; color: #fff; }
.step[data-status="stuck"] { background: var(--stuck-soft); box-shadow: none; color: var(--stuck); }
.step[data-status="in_progress"] { background: var(--accent-soft); box-shadow: none; color: var(--accent-strong); }
.step[aria-current="step"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }

/* Subject */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { min-height: 46px; padding: 0 16px; margin-bottom: -1px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); font-weight: 700; }
.tab[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--ink); }
.tab .count { margin-left: 6px; color: var(--muted); font-weight: 500; }
.phase-chip { align-self: flex-start; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 13px; font-weight: 700; }
.phase-chip.exam { background: var(--stuck-soft); color: var(--stuck); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.collection { overflow: hidden; }
.collection-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line-soft); }
.collection-head h2 { font-size: 18px; font-weight: 800; }
.group-head { padding: 12px 24px 10px; background: var(--subtle); border-bottom: 1px solid var(--line-soft); }
.group-head h3 { font-size: 15px; font-weight: 700; }
.group-head p { font-size: 14px; color: var(--muted); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-row { display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 10px 22px; border-bottom: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; }
.q-row:last-child { border-bottom: 0; }
.q-row:hover { background: var(--subtle); color: var(--ink); }
.q-label { flex: none; min-width: 64px; font-weight: 700; color: var(--accent); }
.q-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.q-text > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-text small { font-size: 13px; color: var(--muted); }
.q-time { flex: none; width: 64px; text-align: right; font-size: 13px; color: var(--muted); }
.topic-row { display: flex; flex-direction: column; gap: 6px; }
.topic-row div:first-child { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.note-card { display: flex; flex-direction: column; gap: 8px; padding: 20px 22px; color: var(--ink); text-decoration: none; }
.note-card:hover { border-color: var(--line-strong); color: var(--ink); }
.note-card strong { font-family: var(--read); font-size: 20px; font-weight: 600; }
.dropzone { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; min-height: 96px; padding: 20px; border: 2px dashed var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--muted); text-align: center; }
.dropzone.dragging { border-color: var(--accent); border-style: solid; background: var(--accent-soft); }
.dropzone .icon { color: var(--accent); }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.material { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--subtle); }
.material-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.material-status { font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.material-status.warn { color: var(--stuck); }
.material-status.bad { color: var(--danger); }
.material select { min-height: 34px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font-size: 14px; }

/* Study session */
.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px 0 4px; border-radius: 10px; color: var(--ink); font-weight: 600; text-decoration: none; }
.session-context { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.session-context .where { color: var(--muted); font-size: 14px; }
.timer { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 2px 0 8px; color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.timer button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: var(--ground); }
.save-state[data-state="error"] { color: var(--danger); font-weight: 600; }
.status-panel { width: 320px; padding: 10px; gap: 4px; }
.status-panel .field { padding: 4px 6px; }
.status-option { display: flex; justify-content: space-between; align-items: center; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.status-option[aria-checked="true"] { background: var(--accent-soft); font-weight: 600; }
.status-option small { color: var(--muted); font-size: 12px; }
.panes { flex: 1; display: grid; grid-template-columns: minmax(420px, var(--right, 55fr)) 10px minmax(340px, var(--left, 45fr)); min-height: 0; }
.panes.solo { grid-template-columns: 1fr; }
.panes.solo .left-pane, .panes.solo .splitter { display: none; }
.left-pane { min-width: 0; display: flex; flex-direction: column; background: var(--subtle); border-left: 1px solid var(--line); max-height: calc(100vh - var(--session-bar, 61px)); position: sticky; top: var(--session-bar, 61px); }
.splitter { cursor: col-resize; background: transparent; border: 0; padding: 0; }
.splitter:hover, .splitter:focus-visible { background: var(--accent-soft); }
.pane-tabs { display: flex; gap: 2px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.pane-tabs .tab { min-height: 48px; padding: 0 12px; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; }
.pane-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.pane-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 14px; }
.pane-toolbar select { min-height: 38px; max-width: 100%; padding: 4px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.pager { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.pager button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 18px; line-height: 1; }
.paper { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 2px 10px rgba(28, 35, 33, .06); }
.paper-text { padding: 28px 32px; font-family: var(--read); font-size: 16px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.page-view { overflow: auto; }
.page-view img { display: block; width: calc(100% * var(--zoom, 1)); max-width: none; height: auto; }
.page-view iframe { display: block; width: 100%; height: calc(100vh - 230px); min-height: 480px; border: 0; }
.context-box { padding: 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.context-box summary { font-weight: 600; cursor: pointer; }
.context-box p { margin-top: 8px; white-space: pre-wrap; font-family: var(--read); font-size: 15px; }
.mark-banner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; background: var(--mark-soft); font-size: 14px; }
.right-pane { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 28px 40px; }
.doc { width: 100%; max-width: 820px; padding: 40px 56px 48px; background: var(--surface); border: 0; border-radius: 24px; box-shadow: var(--card-shadow); font-family: var(--read); font-size: 17px; line-height: 1.7; }
.doc-title { margin: 2px 0 6px; font-size: 26px; font-weight: 600; line-height: 1.3; }
.doc-statement { margin: 0 0 22px; color: var(--ink-2); white-space: pre-wrap; }
/* The exercise as the book prints it: heading, own text, every part with the current one marked. */
.doc-printed { display: flex; flex-direction: column; gap: 6px; margin-bottom: 26px; padding: 20px 22px; border-radius: 16px; background: var(--subtle); }
.doc-printed .doc-statement { margin: 0; color: var(--ink); white-space: normal; }
.doc-head { margin: 0; font-family: var(--ui); font-size: 17px; font-weight: 800; line-height: 1.5; }
.doc-part { margin-left: -12px; padding: 2px 12px; border-radius: 6px; }
.doc-part.sub { margin-left: 8px; }
.doc-part.on { background: var(--accent-soft); }
.doc-part.off, .doc-part.off a { color: var(--faint); }
.doc-part a { display: block; color: inherit; text-decoration: none; }
.doc-part a:hover { color: var(--ink-2); }
.doc-context { margin-bottom: 8px; color: var(--ink-2); font-size: 16px; }
.doc-context summary { cursor: pointer; font-family: var(--ui); font-size: 13px; font-weight: 600; color: var(--muted); }
.doc-source { align-self: flex-start; margin-top: 6px; padding: 0; border: 0; border-bottom: 1px dotted var(--accent-mid); background: none; font-family: var(--ui); font-size: 13px; color: var(--accent); cursor: pointer; }
.doc-source:hover { color: var(--accent-strong); }
/* Book tables and lists inside exercise text */
.math-table { overflow-x: auto; margin: 6px 0 10px; }
.math-table table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.math-table th, .math-table td { padding: 3px 14px; border: 1px solid var(--line-strong); text-align: center; font-weight: 400; }
.math-table thead th { font-weight: 600; background: var(--subtle); }
.math-table td:first-child { text-align: left; }
.math-list { margin: 0 0 6px; padding-left: 22px; }
.exam-banner { flex: none; margin: 0 12px 4px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }

/* The writing page: one continuous surface (ProseMirror) for answers and notes */
.ProseMirror { position: relative; word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; font-variant-ligatures: none; }
.ProseMirror-hideselection *::selection { background: transparent; }
.ProseMirror-hideselection { caret-color: transparent; }
.ProseMirror [draggable][contenteditable=false] { user-select: text; }
.ProseMirror-selectednode { outline: 2px solid var(--accent-mid); outline-offset: 2px; border-radius: 6px; }
.page-surface { min-height: 220px; outline: none; font-family: var(--read); font-size: 17px; line-height: 1.7; caret-color: var(--accent); }
.page-surface:focus-visible { outline: none; }
.page-surface > * { margin: 0 0 10px; }
.page-surface > .is-empty::before { content: attr(data-placeholder); float: left; height: 0; color: var(--faint); pointer-events: none; }
/* A part of the working marked as the answer: boxed twice, as on paper, with a small label beside it. */
.page-surface > .is-answer { position: relative; width: fit-content; max-width: calc(100% - 80px); margin: 12px 0 14px 4px; padding: 2px 12px; border: 1.5px solid var(--answer); border-radius: 3px; outline: 1.5px solid var(--answer); outline-offset: 2px; }
.page-surface > .page-equation.is-answer { margin-inline: auto; }
.page-surface > .is-answer:not(.page-quote)::after { content: "Answer"; position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%); font: 700 11px/1 var(--ui); letter-spacing: .06em; text-transform: uppercase; color: var(--answer); white-space: nowrap; pointer-events: none; user-select: none; }
@media (max-width: 760px) { .page-surface > .is-answer { max-width: 100%; } .page-surface > .is-answer:not(.page-quote)::after { display: none; } }
.page-heading { margin-top: 18px !important; font-size: 21px; font-weight: 600; line-height: 1.35; }
.page-bullet { position: relative; padding-left: 24px; margin-bottom: 4px !important; }
.page-bullet::before { content: ""; position: absolute; left: 8px; top: .75em; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-2); }
.page-check { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px !important; }
.page-check input { width: 17px; height: 17px; flex: none; accent-color: var(--accent); transform: translateY(2px); }
.page-check-text { flex: 1; min-width: 0; }
.page-check.done .page-check-text { color: var(--faint); text-decoration: line-through; }
.page-note { padding: 10px 14px; border-radius: 12px; background: #FFF4D6; }
.page-quote { padding: 10px 14px; border-radius: 12px; background: var(--mark-soft); font-size: 16px; }
.page-quote[data-source]::after { content: attr(data-source); display: block; margin-top: 4px; font-family: var(--ui); font-size: 12px; color: var(--muted); }
.page-math { padding: 0 2px; border-radius: 4px; cursor: pointer; }
.page-math:hover, .page-math.editing, .page-equation:hover, .page-equation.editing { background: var(--accent-soft); }
.page-math .katex { font-size: 1.05em; }
.page-equation { padding: 8px 4px; border-radius: 8px; text-align: center; font-size: 18px; cursor: pointer; overflow-x: auto; }
.page-equation[data-format="plain"] { font-family: var(--read); white-space: pre-wrap; }
.page-equation .muted, .page-figure .muted { font-family: var(--ui); font-size: 14px; }
.math-error { color: var(--danger); font-family: Consolas, "Cascadia Mono", monospace; font-size: 14px; }
.page-figure { position: relative; margin: 4px 0 14px !important; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.page-figure.diagram { cursor: pointer; }
.page-figure.diagram:hover { border-color: var(--accent-mid); }
.page-figure img, .page-figure svg { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; border-radius: 4px; }
.page-figure figcaption { margin-top: 6px; font-family: var(--ui); font-size: 13px; color: var(--muted); text-align: center; }
.figure-remove { position: absolute; top: 8px; right: 8px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-family: var(--ui); font-size: 12px; opacity: 0; }
.page-figure:hover .figure-remove, .figure-remove:focus-visible { opacity: 1; }
.diagram-view .diagram-line { stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.diagram-view .diagram-line.dash { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 6 6; }
.diagram-view .diagram-head { fill: var(--ink); }
.diagram-view .diagram-label { fill: var(--ink); font: 17px var(--ui); }
.page-line .page-surface { min-height: 0; font-size: 17px; }
.page-line .page-surface > * { margin: 0; }

/* The old Final answer line, still shown for earlier attempts that have one, and Your answer in the solution. */
.final-answer { display: flex; align-items: baseline; gap: 14px; margin-top: 12px; padding: 10px 14px; border: 1px solid #8DB596; border-radius: 8px; background: #E9F2EA; font-family: var(--read); }
.your-answer { display: flex; align-items: baseline; gap: 14px; margin: 0 0 16px; padding: 10px 14px; border: 1.5px solid var(--answer); border-radius: 8px; font-family: var(--read); }
.your-answer .math-lines { flex: 1; min-width: 0; }
.final-label { flex: none; font-family: var(--ui); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #1E4A2A; }
.history-page { padding: 20px 24px; }
.history-page .page-surface { min-height: 0; font-size: 15px; }

.float-panel { position: absolute; z-index: 90; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); font-family: var(--ui); }
.slash-pop { width: 280px; padding: 6px; display: flex; flex-direction: column; }
.slash-pop button { display: flex; align-items: baseline; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; font-size: 14px; }
.slash-pop button strong { font-weight: 600; }
.slash-pop button small { margin-left: auto; color: var(--muted); font-size: 12px; }
.slash-pop button[aria-selected="true"] { background: var(--accent-soft); }
.math-pop { width: min(460px, calc(100vw - 24px)); padding: 12px; display: grid; gap: 8px; }
.math-source { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--subtle); font: 14px/1.45 Consolas, "Cascadia Mono", monospace; resize: vertical; }
.math-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.math-tools button { min-width: 34px; min-height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: 13px; }
.math-tools button:hover { border-color: var(--accent); color: var(--accent); }
.math-preview { min-height: 40px; padding: 8px; border-top: 1px dashed var(--line); text-align: center; font-family: var(--read); font-size: 18px; overflow-x: auto; }
.math-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 12px; }
.math-row .muted { flex: 1; min-width: 180px; }
.seg { display: inline-flex; width: fit-content; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { padding: 4px 12px; border: 0; background: var(--surface); font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.link-btn.danger { color: var(--danger); font-size: 13px; }
.select-bubble { position: absolute; z-index: 85; display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--ink); box-shadow: var(--shadow); }
.select-bubble button { padding: 6px 12px; border: 0; border-radius: 999px; background: none; color: #fff; font-size: 13px; font-weight: 600; }
.select-bubble button:hover, .select-bubble button:focus-visible { background: rgba(255, 255, 255, .16); }
.toast-action { margin-left: 8px; padding: 0; border: 0; background: none; color: var(--accent-mid); font-weight: 600; text-decoration: underline; }

.diagram-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 96; width: min(720px, 100vw); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line-strong); box-shadow: var(--shadow); }
.diagram-drawer header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.diagram-drawer header h2 { font-size: 17px; }
.diagram-drawer header .muted { flex: 1; min-width: 200px; font-size: 13px; }
.drawer-body { flex: 1; overflow: auto; padding: 16px 20px; background: var(--subtle); }
.drawer-body .block-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; font-size: 13px; }
.drawer-body .block-tools select, .drawer-body .block-tools input { min-height: 32px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: 13px; }
.drawer-body .secondary-button { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: 13px; font-weight: 600; }
.drawer-body .secondary-button:hover { border-color: var(--accent); color: var(--accent); }
.drawer-body p.muted { margin: 6px 0; font-size: 13px; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--line); }
.drawer-foot .input { width: 100%; }
.diagram-canvas { display: block; width: 100%; max-width: 640px; aspect-ratio: 3 / 2; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; cursor: crosshair; }
.diagram-coordinates { display: flex; gap: 6px; margin: 4px 0; }
.diagram-coordinates input { width: 90px; min-height: 32px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }

.notes-pane { display: flex; flex-direction: column; gap: 10px; }
.notes-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.notes-head .save-note { margin-left: auto; font-size: 13px; }
.notes-sheet { padding: 22px 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 2px 10px rgba(28, 35, 33, .06); }
.notes-sheet .page-surface { min-height: 320px; font-size: 16px; }
.notes-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.msg.ai .add-note { margin-top: 6px; font-size: 13px; }
.recovery { flex: none; margin: 0 12px 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; border-radius: 12px; background: var(--stuck-soft); color: var(--stuck); }

/* Companion */
.companion { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: -16px -20px -24px; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 20px; border-bottom: 1px solid var(--line); font-size: 13px; }
.chip { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.chip.off { background: var(--neutral-soft); border-color: transparent; color: var(--muted); }
.chip.on { background: var(--accent-soft); border-color: #C7D2EA; color: var(--accent); }
.chip.warn { background: var(--stuck-soft); border-color: #F2CDA8; color: var(--stuck); }
.thread { flex: 1; min-height: 160px; overflow: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 88%; padding: 10px 14px; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; border-radius: 16px 16px 4px 16px; background: var(--accent); color: #fff; white-space: pre-wrap; }
.msg.me small { display: block; margin-top: 4px; opacity: .85; }
.msg.ai { align-self: flex-start; max-width: 94%; border-radius: 16px 16px 16px 4px; background: #F2F6F8; border: 0; display: flex; flex-direction: column; gap: 10px; }
.msg.ai .guidance { font-family: var(--read); font-size: 16px; line-height: 1.6; white-space: pre-wrap; }
.msg.ai h4 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.msg.ai details summary { font-size: 14px; font-weight: 600; cursor: pointer; }
.msg.ai details p { margin-top: 6px; font-size: 14px; }
.msg-notice { padding: 8px 10px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 14px; }
.msg-notice[data-kind="quota"], .msg-notice[data-kind="network"] { background: var(--stuck-soft); color: var(--stuck); }
.msg-notice strong { display: block; }
.evidence { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.evidence li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--subtle); font-size: 14px; }
.evidence a { font-weight: 600; }
.evidence p { margin-top: 4px; font-family: var(--read); font-size: 15px; }
.evidence img { display: block; max-width: 100%; max-height: 220px; margin-top: 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; object-fit: contain; }
.thread-empty { margin: auto 0; text-align: center; color: var(--muted); }
.composer { padding: 12px 20px 16px; border-top: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.composer textarea { width: 100%; min-height: 64px; padding: 10px 14px; border: 1.5px solid #D5DDE3; border-radius: 14px; resize: none; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer-row textarea { flex: 1; min-height: 48px; }
.composer-row .btn { min-height: 44px; }
.composer-more { width: 44px; padding: 0; font-size: 18px; letter-spacing: 1px; }
.composer-status { font-size: 13px; }
.composer-status:empty { display: none; }
.menu.up { top: auto; bottom: calc(100% + 6px); }
.shared-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 13px; font-weight: 600; }
.shared-head .link-btn { font-size: 13px; }
.companion-details { flex: none; border-bottom: 1px solid var(--line); font-size: 14px; max-height: 50%; overflow: auto; }
.companion-details > summary { display: flex; align-items: baseline; gap: 8px; padding: 8px 20px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.companion-details > summary small { font-weight: 400; }
.companion-details > summary::before { content: "▸"; }
.companion-details[open] > summary::before { content: "▾"; }
.companion-details[open] > summary { color: var(--ink); }
.companion-details > :not(summary) { margin: 0 20px 10px; }
.reply-details { margin-top: 8px; font-size: 13px; color: var(--muted); }
.reply-details > summary { cursor: pointer; }
.reply-details p { margin-top: 4px; }
.shared-writing { padding: 8px 10px; border-radius: 10px; background: var(--accent-soft); }
.shared-writing textarea { min-height: 56px; font-size: 14px; }
.quoted-text { max-height: 120px; overflow: auto; font-family: var(--read); font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.msg-quote { margin: 0 0 6px; padding-left: 8px; border-left: 2px solid rgba(255, 255, 255, .6); font-family: var(--read); font-size: 14px; max-height: 140px; overflow: hidden; }
.msg-quote small { display: block; margin-top: 2px; font-family: var(--ui); }

/* Ask overlay */
.ask-backdrop { position: fixed; inset: 0; z-index: 60; overflow: auto; padding: 56px 20px; background: rgba(24, 36, 46, .38); }
.ask { max-width: 860px; margin: 0 auto; background: var(--surface); border-radius: 28px; box-shadow: 0 24px 64px rgba(24, 36, 46, .28); overflow: hidden; }
.ask-input-row { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--line-soft); }
.ask-input-row .icon { color: var(--accent); }
.ask-input-row input { flex: 1; min-width: 0; min-height: 44px; border: 0; background: transparent; font-size: 20px; font-weight: 600; }
.ask-input-row input:focus-visible { outline: none; }
.ask-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 24px; background: var(--subtle); border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.ask-body { display: flex; flex-direction: column; gap: 22px; padding: 22px 24px 26px; max-height: calc(100vh - 260px); overflow: auto; }
.ask-answer { padding: 20px 22px; border-radius: 20px; background: #F2F7F9; font-family: var(--read); font-size: 18px; line-height: 1.65; white-space: pre-wrap; }
.cite { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 8px; border: 0; border-radius: 999px; background: var(--mark); color: var(--accent-strong); font-family: var(--ui); font-size: 12px; font-weight: 700; vertical-align: 2px; }
.passage { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border: 1.5px solid var(--line); border-radius: 16px; }
.passage-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; }
.passage-top .role { margin-left: auto; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.passage blockquote { margin: 0; font-family: var(--read); font-size: 16px; line-height: 1.6; }
.passage mark, mark.hl { padding: 1px 2px; border-radius: 2px; background: var(--mark-soft); color: inherit; }
.passage .context { font-family: var(--read); font-size: 15px; color: var(--ink-2); white-space: pre-wrap; }
.passage .actions { display: flex; flex-wrap: wrap; gap: 16px; font-size: 14px; }
.figure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.figure-card { display: flex; gap: 14px; align-items: center; padding: 12px; border: 0; border-radius: 16px; background: var(--subtle); color: var(--ink); text-decoration: none; }
.figure-card:hover { background: var(--accent-soft); color: var(--ink); }
.figure-card img { flex: none; width: 120px; height: 84px; object-fit: contain; border-radius: 8px; background: var(--subtle); }
.figure-card small { display: block; color: var(--muted); font-size: 13px; }
.jump { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 14px; background: var(--subtle); color: var(--ink); text-decoration: none; }
.jump:hover, .jump:focus-visible { background: var(--accent-soft); color: var(--ink); }
.jump strong { min-width: 70px; color: var(--accent); }
.jump span:last-child { margin-left: auto; font-size: 13px; color: var(--muted); }
.ask-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 12px 24px; border-top: 1px solid var(--line-soft); background: var(--subtle); font-size: 13px; color: var(--muted); }

/* Import */
.import-steps { display: flex; gap: 8px; margin: 0 0 0 auto; padding: 0; list-style: none; font-size: 14px; flex-wrap: wrap; }
.import-steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.import-steps li[aria-current="step"] { color: var(--ink); font-weight: 600; }
.import-steps .num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-strong); font-size: 12px; font-weight: 700; }
.import-steps li[aria-current="step"] .num { border: 2px solid var(--accent); color: var(--accent); }
.import-steps li.done .num { border-color: var(--accent); background: var(--accent); color: #fff; }
.import-row { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.import-row.child { margin-left: 28px; }
.import-row.selected { border-color: var(--accent); background: #F4F7FD; }
.import-row-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.import-row-top input { flex: 1 1 200px; min-height: 36px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; }
.import-row textarea { width: 100%; min-height: 64px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-family: var(--read); font-size: 15px; resize: vertical; }
.import-row select { min-height: 34px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; }
.import-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px)); padding: 12px 20px; border-radius: 16px; background: var(--ink); color: #fff; box-shadow: var(--shadow); }
.loading { padding: 48px; text-align: center; color: var(--muted); }

@media (max-width: 900px) {
  .panes { grid-template-columns: 1fr; }
  .splitter { display: none; }
  .left-pane { position: static; max-height: none; border-left: 0; border-top: 1px solid var(--line); }
  .doc { padding: 28px 22px; }
  .continue-side { padding-left: 0; border-left: 0; }
  .topbar, .page { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
/* Interpretation review stays scrollable alongside the conversation and composer. */
.problem-interpretation { flex-shrink: 0; max-height: 45vh; overflow: auto; overflow-wrap: anywhere; padding: 12px; }
.problem-interpretation label { display: block; margin-top: 10px; }
.problem-interpretation textarea { width: 100%; box-sizing: border-box; }
.rebuild-preparation { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 8px; }

/* Chapters of the course book: subject page rows, Home strip and status tiles */
.step[data-status="revisit"] { border: 1.5px dashed #8A6D00; background: var(--mark-soft); color: #4A3D00; }
.chapters-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.inline-details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
.inline-details[open] { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.head-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.chapter-row { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.chapter-row.current { box-shadow: 0 0 0 2px var(--accent), var(--card-shadow); }
.chapter-top { display: flex; align-items: center; gap: 14px; }
.chapter-row .ring { font-size: 16px; }
.chapter-row[data-state="read"] .ring::before { background: var(--accent); }
.chapter-row[data-state="read"] .ring > span { color: #fff; }
.chapter-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chapter-main h3 { font-size: 17px; font-weight: 800; line-height: 1.25; }
.chapter-meta { font-size: 13px; color: var(--muted); }
.chapter-tiles { min-width: 0; }
.chapter-tiles .step { min-width: 44px; height: 32px; }
.step-group { display: inline-flex; align-items: center; gap: 3px; padding: 3px; border-radius: 999px; background: var(--accent-soft); }
.step-group-label { padding: 0 6px 0 8px; font-size: 13px; font-weight: 800; color: var(--accent-strong); }
.step-group .step { min-width: 30px; height: 30px; padding: 0 6px; border-radius: 50%; font-size: 12px; }
.chapter-tiles .step-group .step { min-width: 30px; height: 30px; }
.chapter-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.unlinked { background: transparent; box-shadow: none; border: 1.5px dashed #C9D3DB; }
.unlinked .collection-head { border-bottom: 0; }
.unlinked-row { flex-wrap: wrap; }
.unlinked-row .q-text { flex: 1 1 220px; color: var(--ink); text-decoration: none; }
.chapter-strip { display: flex; gap: 4px; }
.chapter-strip span { width: 22px; height: 10px; border-radius: 3px; border: 1.5px solid var(--line-strong); background: var(--surface); }
.chapter-strip span[data-state="read"] { border-color: var(--accent); background: var(--accent); }
.chapter-strip span[data-state="reading"] { border-color: var(--accent); background: linear-gradient(90deg, var(--accent) 50%, var(--surface) 50%); }
@media (max-width: 700px) { .chapter-row { padding: 14px 16px; } .chapter-actions { width: 100%; } }

/* Reader: a chapter of the course book, one section at a time, with the AI and notes beside it */
.rail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rail-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left; font-size: 14px; }
.rail-item:hover { background: var(--subtle); }
.rail-item { border-radius: 10px; }
.rail-item[aria-current="page"], .rail-item[aria-current="location"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.rail-text { flex: 1; min-width: 0; }
.rail-mark { flex: none; width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; border: 2px solid var(--line-strong); }
.rail-item[data-read="true"] .rail-mark { border-color: var(--accent); background: var(--accent); }
.rail-count { flex: none; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--mark); color: var(--accent-strong); font-size: 12px; font-weight: 700; text-align: center; }
.rail-count.plain { background: var(--neutral-soft); color: var(--muted); }
.reader-page { width: 100%; max-width: 760px; display: flex; flex-direction: column; gap: 14px; }
.reader-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.reader-unit { font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; margin-right: auto; }
.reader-paper { padding: 30px 40px 34px; background: var(--surface); border: 0; border-radius: 20px; }
.reader-sheet + .reader-sheet { margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }
.page-label { display: flex; gap: 12px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.page-label a { font-weight: 600; }
/* Pages read by Claude: labels, formulas, tables, boxes and figure notes */
.reading-label { margin: 18px 0 8px; font-family: var(--ui); font-size: 15px; font-weight: 800; color: var(--accent); }
.reader-paper .page-equation { margin: 0 0 8px; padding: 2px 4px; cursor: auto; overflow-x: auto; }
.reader-paper .page-equation .katex-display { margin: .3em 0; }
.reading-table-wrap { margin: 4px 0 18px; overflow-x: auto; }
.reading-table { border-collapse: collapse; font-family: var(--read); font-size: 16px; }
.reading-table th, .reading-table td { padding: 6px 12px; border: 1px solid var(--line); text-align: center; }
.reading-table th { background: var(--subtle); font-weight: 600; }
.reading-box { margin: 6px 0 18px; padding: 14px 18px; border-radius: 14px; background: var(--good-soft); }
.reading-box p { margin: 0 0 6px; font-family: var(--read); font-size: 17px; line-height: 1.6; }
.reading-box p:last-child { margin-bottom: 0; }
.reading-figure { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0 16px; padding: 8px 12px; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); font-size: 14px; }
.reading-figure svg { flex: none; margin-top: 2px; }
.reading-p { margin: 0 0 14px; font-family: var(--read); font-size: 18px; line-height: 1.75; }
.reading-h { margin: 6px 0 10px; font-family: var(--read); font-size: 20px; font-weight: 600; }
.hl { background: var(--mark); color: inherit; padding: 0 1px; border-radius: 2px; }
.reader-foot { width: 100%; max-width: 760px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 20px; background: var(--surface); border: 0; border-radius: 20px; box-shadow: 0 1px 2px rgba(24, 36, 46, .04); }
.reader-foot > .muted { flex: 1 1 240px; font-size: 14px; }
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-sees { padding: 10px 18px; font-size: 13px; border-bottom: 1px solid var(--line-soft); }
.chat-thread { flex: 1; overflow: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-compose { padding: 12px 14px 14px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
.chat-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-row textarea { flex: 1; resize: none; }
.passage-chip { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-strong); font-family: var(--read); font-size: 14px; }
.passage-chip[hidden] { display: none; }
.passage-chip span { flex: 1; }
.msg-quote { display: block; margin-bottom: 6px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .16); font-family: var(--read); font-size: 14px; quotes: "“" "”"; }
.msg .serif { font-size: 16px; line-height: 1.6; white-space: pre-wrap; }
.msg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cite-chip { padding: 3px 10px; border: 0; border-radius: 999px; background: var(--mark); color: var(--accent-strong); font-size: 13px; font-weight: 700; }
.reader-notes { padding: 14px 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.reader-notes .notes-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.reader-notes .notes-head .link-btn { margin-left: auto; font-size: 13px; }
.reader-notes .notes-sheet { padding: 14px 16px; }
.reader-notes .notes-sheet .page-surface { min-height: 200px; }
.hl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hl-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 12px 14px; border-radius: 14px; background: var(--mark-soft); font-size: 13px; }
.hl-text { flex: 1 1 100%; padding: 0; border: 0; background: none; color: var(--ink); text-align: left; font-size: 15px; line-height: 1.5; text-decoration: none; }
a.hl-text:hover, button.hl-text:hover { color: var(--accent); }

/* Notebook: every chapter's highlights and notes */
.notebook-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.notebook-search { flex: 1 1 260px; max-width: 440px; min-height: 46px; padding: 0 18px; border: 0; border-radius: 999px; box-shadow: var(--raise); }
.filters-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; }
.filters-btn[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent-strong); }
.notebook-book { padding: 44px 56px 56px; background: var(--surface); border-radius: 24px; box-shadow: var(--card-shadow); }
.notebook-content { max-width: 780px; display: flex; flex-direction: column; gap: 34px; }
.book-eyebrow { font-size: 13px; font-weight: 700; color: var(--accent); }
.notebook-chapter { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 20px; }
.notebook-chapter-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.notebook-chapter-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.empty-chapter .notebook-chapter-head h2 { color: var(--muted); }
.notebook-links { margin-left: auto; display: flex; gap: 14px; font-size: 14px; font-weight: 700; }
.notebook-links a, .solved-links a, .material a, .hl-item a, .redo-title { text-decoration: none; }
.notebook-links a:hover, .solved-links a:hover, .material a:hover, .hl-item a:hover { text-decoration: underline; }
.notebook-sheet .page-surface { min-height: 0; font-size: 16px; }
.notebook-sheet .page-surface > * { margin-bottom: 6px; }
.notebook-sheet .page-equation { padding: 2px 4px; cursor: auto; }
.notebook-sheet .page-equation .katex-display { margin: .3em 0; }
/* The editor keeps an empty line after a formula for typing; read-only it is only a gap. */
.notebook-sheet .page-surface > p:last-child:has(> br.ProseMirror-trailingBreak:only-child) { display: none; }
.notebook-bar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.filter-label { flex: 0 0 64px; font-size: 13px; font-weight: 600; color: var(--muted); }
.filter-group .chip-btn { min-height: 32px; padding: 0 12px; font-size: 14px; }
.sort-label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.view-chip { display: inline-flex; align-items: center; }
.view-remove { margin-left: -4px; padding: 0 6px; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; }
.view-remove:hover { color: var(--ink); }
.star-btn { flex: 0 0 auto; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 18px; line-height: 1; }
.star-btn:hover { background: var(--neutral-soft); }
.star-btn[aria-pressed="true"] { color: #8A6100; }
.hl-item .star-btn { margin-left: auto; }
.fold-btn { width: 24px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 16px; }
.note-rows { display: flex; flex-direction: column; gap: 2px; }
.note-row { display: flex; align-items: flex-start; gap: 6px; }
.note-row > .page-editor { flex: 1 1 auto; min-width: 0; }
.note-row.compact { align-items: center; font-size: 15px; }
.note-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.solved-section { display: flex; flex-direction: column; gap: 8px; }
.solved-list, .solved-group { display: flex; flex-direction: column; gap: 8px; }
.solved-parent { padding: 4px 0 0 34px; font-size: 15px; }
.solved-parent .doc-statement { margin: 4px 0 0; }
.solved-row { display: flex; align-items: flex-start; gap: 6px; }
.solved-card { flex: 1 1 auto; min-width: 0; border-radius: 16px; background: var(--subtle); }
.solved-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 14px; cursor: pointer; }
.solved-title { font-size: 15px; }
.solved-body { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 14px; }
.solved-body .doc-statement { margin: 0; white-space: normal; }
.solved-note { padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; }
.solved-answer { font-size: 15px; }
.solved-fold summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--accent); }
.solved-fold .solution-view { margin-top: 8px; }
.solved-links { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.help-chip { padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--neutral-soft); color: var(--muted); font-size: 12px; font-weight: 600; }
.help-chip.own { border-color: #8DB596; background: #E9F2EA; color: #1E4A2A; }
.help-chip.hints { border-color: #D9B763; background: #FBF3DE; color: #6B4E0E; }
.help-chip.solution { border-color: #D79A8E; background: #FBE9E5; color: #7A2B1D; }
.redo-card { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.redo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.redo-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.redo-title { font-weight: 600; }
.redo-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.formula-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.formula-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; border-bottom: 1px solid var(--line-soft); }
.formula-row .page-equation { flex: 1 1 auto; cursor: auto; }
.formula-row .page-equation.plain { font-family: var(--read); text-align: left; }
.formula-row .muted { font-size: 13px; }
@media (max-width: 640px) {
  .filter-label { flex-basis: 100%; }
  .redo-actions { margin-left: 0; }
}
@media print {
  .sidebar, .notebook-tools, .notebook-bar, .star-btn, .fold-btn, .notebook-links, .redo-actions, .solved-links, #toast { display: none !important; }
  .notebook-book { padding: 0; box-shadow: none; }
  .notebook-page .card, .solved-card { box-shadow: none; border-color: #ccc; }
  .notebook-chapter { break-inside: auto; }
  .solved-card { break-inside: avoid; }
}

/* Practice desk: the question on the paper, links to its sources */
.return-chip { padding: 4px 12px; border: 1px solid var(--accent-mid); border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 13px; font-weight: 600; text-decoration: none; }
.return-chip::before { content: "A9  "; }

/* Exam prep: plan, past exams with the chapters each task needs, weak chapters */
.plan-card { display: flex; flex-direction: column; gap: 12px; }
.plan-weeks { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 13px; font-weight: 700; }
.card-icon-head { display: flex; align-items: center; gap: 10px; }
.card-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong); }
.solution-chip { padding: 3px 12px; border-radius: 999px; background: var(--good-soft); color: var(--good); font-size: 12px; font-weight: 700; }
.solution-chip.none { background: var(--neutral-soft); color: var(--muted); }
.exam-card { display: flex; flex-direction: column; gap: 14px; padding: 24px 26px; box-shadow: var(--card-shadow); }
.exam-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.exam-card-title { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.exam-card-title h2 { font-size: 19px; font-weight: 800; }
.exam-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; font-weight: 700; }
.exam-progress .thin-bar { flex: 0 1 200px; min-width: 100px; }
.exam-task { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-height: 56px; padding: 10px 14px; border-radius: 16px; background: var(--subtle); }
.task-state { flex: none; min-width: 96px; padding: 3px 10px; border-radius: 999px; text-align: center; font-size: 12px; font-weight: 700; }
.task-state.solved { background: var(--accent); color: #fff; }
.task-state.started { background: var(--accent-soft); color: var(--accent-strong); }
.task-state.stuck { background: var(--stuck-soft); color: var(--stuck); }
.task-state.todo { background: var(--surface); box-shadow: inset 0 0 0 1.5px #D5DDE3; color: var(--ink-2); }
.exam-task-main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.exam-task-main .serif { font-size: 15px; }
.exam-task-needs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; }
.task-go { margin-left: auto; font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.need-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.need-chip { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--neutral-soft); color: var(--muted); }
.need-chip[data-read="true"] { background: var(--good-soft); color: var(--good); }
.reach { font-weight: 700; color: var(--muted); }
.reach.ok { color: var(--good); }
.admin-only { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 16px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 14px; font-weight: 700; }
.material-list .material-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 16px 20px; }
.material-cover { flex: none; display: grid; place-items: center; width: 46px; height: 56px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); }
.material-cover.practice { background: #F3EEF9; color: #5E4590; }
.material-cover.solution { background: var(--neutral-soft); color: var(--ink-2); }
.material-text { flex: 1 1 220px; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 800; }
.needs-editor fieldset { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.weak-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.weak-list li { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.weak-list a { font-weight: 600; }

/* Source review keeps the selected original large and loads other scans on demand. */
.source-review-page { max-width: 1500px; }
.source-review-layout { display: grid; grid-template-columns: 285px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 20px; }
.source-review-sidebar { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.source-review-filters { display: grid; gap: 8px; margin-bottom: 12px; }
.source-review-list { display: grid; gap: 8px; }
.source-review-item { text-align: left; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; display: grid; gap: 6px; }
.source-review-item span { font-size: 12px; color: var(--muted); }
.source-review-item.selected { border: 2px solid var(--accent); padding: 12px; }
.source-review-detail { min-width: 0; }
.source-review-detail h2 { font-size: 22px; margin-bottom: 12px; }
.source-review-reason { margin-bottom: 8px; font-weight: 600; }
.source-review-scans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; margin: 22px 0; }
.source-review-scan { margin: 0; min-width: 0; display: grid; align-content: start; gap: 10px; }
.source-review-scan figcaption { font-weight: 600; }
.source-review-scan img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 5px; }
.source-review-scan pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; max-height: 350px; overflow: auto; padding: 10px; background: var(--surface); }
.source-review-form { display: grid; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.source-review-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
@media (max-width: 760px) {
  .source-review-layout { grid-template-columns: 1fr; gap: 16px; }
  .source-review-sidebar { position: static; max-height: 260px; }
}

/* GeoGebra diagrams */
.diagram-drawer.ggb-drawer { max-width: 100vw; border-left: 1px solid var(--line-strong); }
.ggb-drawer header .muted { min-width: 160px; }
.ggb-sizes { display: flex; gap: 4px; }
.ggb-resize { position: absolute; left: -5px; top: 0; bottom: 0; width: 10px; cursor: ew-resize; z-index: 2; touch-action: none; }
.ggb-resize::after { content: ""; position: absolute; left: 4px; top: 50%; width: 3px; height: 48px; margin-top: -24px; border-radius: 2px; background: var(--line-strong); }
.ggb-resize:hover::after, .ggb-resize:focus-visible::after, .ggb-drawer.resizing .ggb-resize::after { background: var(--accent); }
.ggb-drawer.resizing .ggb-host { pointer-events: none; }
.ggb-host { flex: 1; min-height: 360px; margin: 12px 20px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: grid; place-items: center; }
.ggb-host > div { place-self: stretch; }
.ggb-status { padding: 24px; text-align: center; max-width: 46ch; }
.page-figure .ggb-picture { display: block; max-width: 100%; height: auto; margin: 0 auto; }

/* Focus layout (reader and practice desk): the content fills the screen, tools are icons around it */
.focus { flex: 1; min-width: 0; height: 100vh; display: flex; flex-direction: column; background: var(--ground); }
.focus-progress { flex: none; height: 3px; background: var(--line-soft); }
.focus-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.focus-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-height: 56px; padding: 4px 12px; }
.focus-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; margin-left: 4px; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.focus-crumb { color: var(--muted); font-size: 14px; font-weight: 400; }
.focus-here { overflow: hidden; text-overflow: ellipsis; }
.focus-meta { color: var(--muted); font-size: 13px; font-weight: 400; }
.focus-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.focus-body { position: relative; flex: 1; min-height: 0; display: flex; align-items: flex-start; }
.focus-main { flex: 1; align-self: stretch; min-width: 0; overflow: auto; padding: 4px 24px 48px; outline: none; }
.focus.zen .focus-bar, .focus.zen .tool-rail, .focus.zen .side-panel, .focus.zen .reader-rail { display: none; }
.focus.zen .focus-main { padding-top: 24px; }
.tool-btn.zen-exit { display: none; position: fixed; top: 10px; right: 12px; z-index: 40; background: rgba(255, 255, 255, .9); border: 1px solid var(--line); }
.focus.zen .tool-btn.zen-exit { display: inline-grid; }

.tool-btn { position: relative; flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); text-decoration: none; }
.tool-btn:hover { background: var(--neutral-soft); color: var(--ink); }
.tool-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tool-btn[aria-pressed="true"], .tool-btn[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.tool-btn.primary { background: var(--accent); color: #fff; }
.tool-btn.primary:hover { background: var(--accent-strong); color: #fff; }
.tool-btn.good, .tool-btn.good[aria-pressed="true"] { background: var(--good); color: #fff; }
.tool-btn.warn { color: var(--stuck); }
.tool-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.tool-tip { position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%); z-index: 60; padding: 6px 9px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 500; line-height: 1.2; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; }
.tool-btn:hover .tool-tip, .tool-btn:focus-visible .tool-tip { opacity: 1; transition-delay: .2s; }
.tool-btn.tip-off .tool-tip { opacity: 0; transition-delay: 0s; }
[data-tip-side="right"] .tool-tip { right: auto; left: calc(100% + 10px); }
[data-tip-side="down"] .tool-tip { right: auto; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); }
[data-tip-side="down-end"] .tool-tip { right: 0; top: calc(100% + 8px); transform: none; }
.tool-badge { position: absolute; top: 2px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--stuck-bar); color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; }
.tool-sep { flex: none; height: 1px; margin: 4px 8px; background: var(--line); }
.tool-rail { position: sticky; top: 4px; z-index: 32; flex: none; display: flex; flex-direction: column; gap: 4px; margin: 4px 16px 12px 0; padding: 8px; background: var(--surface); border: 0; border-radius: 999px; box-shadow: var(--raise); }
.tool-rail.left { margin: 4px 0 12px 16px; }

.side-panel { position: absolute; top: 4px; bottom: 12px; right: 84px; z-index: 30; width: var(--side-w, 440px); max-width: calc(100% - 100px); display: flex; flex-direction: column; background: var(--surface); border: 0; border-radius: 22px; box-shadow: var(--shadow); }
.focus.pinned .side-panel { position: relative; top: auto; right: auto; bottom: auto; align-self: stretch; flex: none; margin: 4px 12px 12px 0; box-shadow: 0 1px 2px rgba(24, 36, 46, .04); }
.focus.resizing { cursor: ew-resize; user-select: none; }
.focus.resizing iframe { pointer-events: none; }
.side-head { flex: none; display: flex; align-items: center; gap: 2px; padding: 6px 6px 6px 18px; border-bottom: 1px solid var(--line-soft); }
.side-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; }
.side-body { flex: 1; min-height: 0; overflow: auto; padding: 14px 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.side-resize { position: absolute; left: -6px; top: 0; bottom: 0; width: 12px; cursor: ew-resize; z-index: 2; touch-action: none; }
.side-resize::after { content: ""; position: absolute; left: 4px; top: 50%; width: 4px; height: 44px; margin-top: -22px; border-radius: 2px; background: var(--line-strong); opacity: 0; transition: opacity .12s; }
.side-panel:hover .side-resize::after, .side-resize:focus-visible::after, .focus.resizing .side-resize::after { opacity: 1; }
.side-resize:focus-visible::after { background: var(--accent); }

/* Reader */
.reader-rail { position: sticky; top: 4px; flex: none; width: 260px; max-height: calc(100% - 16px); overflow: auto; margin: 4px 0 12px 16px; padding: 18px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 0; border-radius: 20px; box-shadow: 0 1px 2px rgba(24, 36, 46, .04); }
.reader-rail .eyebrow { padding: 0 8px; }
.rail-note { padding: 4px 8px 0; font-size: 12px; }
.reader-main { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.reader-page.reader-page { padding: 44px 56px 48px; background: var(--surface); border-radius: 24px; box-shadow: var(--card-shadow); gap: 0; }
.reader-section + .reader-section { margin-top: 40px; }
.reader-section .reader-head { margin-bottom: 14px; }
.reader-unit { scroll-margin-top: 12px; }
.reader-unit:focus { outline: none; }
.reader-page .reader-paper { padding: 0; background: none; border: 0; border-radius: 0; }
.reader .side-body { padding: 0; }
.reader .side-body > .chat { flex: 1; min-height: 0; }
.reader-notes { padding: 14px 18px 20px; display: flex; flex-direction: column; gap: 10px; }

/* Practice desk */
.session-context { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; margin-left: 4px; }
.session-main { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.session .side-body { padding: 14px 18px 20px; }
.save-state { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; font-size: 13px; color: #2F6B45; }
.save-state:not(:has(svg)) { color: var(--muted); padding: 0 6px; }
.status-btn .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--faint); background: var(--surface); }
.status-btn[data-status="in_progress"] .dot { border-color: var(--accent); background: var(--accent-mid); }
.status-btn[data-status="stuck"] .dot { border-color: var(--stuck); background: var(--stuck-bar); }
.status-btn[data-status="finished"] .dot { border-color: #2F6B45; background: #2F6B45; }

/* A drawer covers the right edge (diagram editor): the help tools and their panel move to the left,
   and the page narrows to the space that is left */
@media (min-width: 761px) {
  .right-covered .focus { padding-right: var(--right-cover, 0px); }
  .right-covered .focus-body > .tool-rail.left { order: -2; }
  .right-covered .focus-body > .tool-rail:not(.left) { order: -1; margin: 4px 0 12px 8px; }
  .right-covered .tool-rail:not(.left) .tool-tip { right: auto; left: calc(100% + 10px); }
  .right-covered .side-panel, .right-covered .focus.pinned .side-panel { position: absolute; top: 4px; bottom: 12px; left: 144px; right: auto; align-self: auto; margin: 0; box-shadow: var(--shadow); max-width: calc(100% - 152px); }
  .right-covered .side-resize { left: auto; right: -6px; }
}
@media (max-height: 640px) {
  .tool-btn { width: 38px; height: 38px; }
}
@media (max-width: 760px) {
  .focus { height: auto; min-height: 100vh; }
  .focus-body { flex-direction: column; align-items: stretch; }
  .focus-main { overflow: visible; padding: 4px 10px 96px; }
  .focus-crumb { display: none; }
  .tool-tip { display: none; }
  .tool-rail { position: fixed; top: auto; left: 8px; right: 8px; bottom: 8px; margin: 0; flex-direction: row; overflow-x: auto; z-index: 35; }
  .tool-rail .tool-sep { width: 1px; height: auto; margin: 6px 2px; }
  .tool-rail.left { position: sticky; top: 0; left: auto; right: auto; bottom: auto; margin: 0 10px 8px; align-self: flex-start; }
  .side-panel, .focus.pinned .side-panel { position: fixed; top: 8px; bottom: 76px; left: 8px; right: 8px; width: auto; max-width: none; margin: 0; z-index: 36; }
  .side-resize { display: none; }
  .reader-rail { position: static; width: auto; max-height: 260px; margin: 0 10px 8px; }
  .problem-strip { flex-wrap: wrap; border-radius: 20px; padding: 8px 10px; }
  .strip-steps { order: 10; flex: 1 1 100%; }
  .strip-more { margin-left: auto; }
  .reader-paper { padding: 20px 18px; }
  .doc { padding: 28px 20px; }
}

/* The set's problems as one button with arrows; the tiles open from it */
.stepper { display: flex; align-items: center; gap: 2px; }
.steps-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 600; white-space: nowrap; }
.steps-btn:hover, .steps-btn[aria-expanded="true"] { border-color: var(--accent-mid); background: var(--accent-soft); }
.steps-title { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.steps-done { padding: 1px 8px; border-radius: 999px; background: var(--neutral-soft); color: var(--muted); font-size: 12px; font-weight: 700; }
.steps-panel { width: min(520px, calc(100vw - 32px)); max-height: 60vh; overflow: auto; gap: 10px; padding: 14px; }
.steps-count { font-size: 13px; }

/* Reveal solution: the solution typeset, line by line. */
.solution-view { font-family: var(--read); line-height: 1.6; margin: 0 0 14px; }
.solution-view p { margin: 0 0 6px; }
.solution-view .page-equation { margin: 0 0 6px; padding: 2px 4px; cursor: auto; }
.math-lines p { margin: 0 0 6px; }
.math-lines p:last-child { margin-bottom: 0; }
.math-lines .page-equation, .solution-view .page-equation { cursor: auto; }
.page-math.display { display: block; text-align: center; margin: 4px 0; overflow-x: auto; }
.paper-text.math-lines { white-space: normal; }

/* Quick calculations: the offered result after "=", and the calculator beside the left tools */
.calc-ghost { margin-left: 4px; padding: 0 4px; border-radius: 4px; background: var(--neutral-soft); color: var(--muted); white-space: nowrap; user-select: none; }
.calc-ghost kbd { margin-left: 6px; padding: 0 5px; border: 1px solid var(--line-strong); border-radius: 4px; font: 11px var(--ui); vertical-align: 1px; }
.menu.calc-menu { top: 0; right: auto; left: calc(100% + 10px); width: 360px; padding: 0; }
.calc-panel { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.calc-head { display: flex; justify-content: space-between; align-items: center; }
.calc-head label { font-weight: 700; }
.calc-input { font-family: Consolas, "Cascadia Mono", monospace; font-size: 15px; }
.calc-foot { display: flex; align-items: center; gap: 10px; }
.calc-preview { flex: 1; min-width: 0; font-family: var(--read); font-size: 19px; overflow-wrap: anywhere; }
.calc-preview[data-state="error"] { font-family: var(--ui); font-size: 13px; color: var(--muted); }
.calc-history { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.calc-history li { display: flex; align-items: center; gap: 8px; }
.calc-row { flex: 1; min-width: 0; display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border: 0; border-radius: 8px; background: var(--neutral-soft); color: var(--ink); text-align: left; }
.calc-row:hover, .calc-row:focus-visible { background: var(--accent-soft); }
.calc-row-input { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; }
.calc-row-result { flex: none; font-family: var(--read); }
.calc-help { font-size: 12px; color: var(--muted); }

/* "From the question": curves found in the question, drawn in GeoGebra */
.ggb-assist { flex: none; margin: 12px 20px 0; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.ggb-assist > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 9px 14px; cursor: pointer; }
.ggb-assist > summary::before { content: "▸"; }
.ggb-assist[open] > summary::before { content: "▾"; }
.ggb-assist > summary small { color: var(--muted); font-size: 13px; }
.ggb-assist-body { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 12px; }
.ggb-curves, .ggb-shows { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ggb-check { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.ggb-check:has(input:disabled) { color: var(--muted); }
.ggb-curve { border-radius: 999px; font-family: var(--read); }
.ggb-curve:has(input:checked) { border-color: var(--accent-mid); background: var(--accent-soft); color: var(--accent); }
.ggb-add { display: flex; gap: 8px; }
.ggb-add .input { flex: 1; min-height: 36px; }
.ggb-tax { width: 72px; min-height: 30px; padding: 2px 6px; }
.ggb-assist-status { font-size: 13px; }
.ggb-assist-status:empty { display: none; }

/* An original page: the page image with its words laid invisibly on top (selectable), marks for
   highlights and citations, and box drawing where the text can't be placed reliably */
.op { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.page-view .op { width: calc(100% * var(--zoom, 1)); }
.op-sheet { position: relative; width: 100%; background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 6px rgba(28, 35, 33, .08); overflow: hidden; }
.page-view .op-image, .op-image { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: fill; user-select: none; }
.op-marks { position: absolute; inset: 0; pointer-events: none; }
.op-mark { position: absolute; background: rgba(120, 190, 226, .42); mix-blend-mode: multiply; border-radius: 2px; }
.op-mark.cited { background: rgba(46, 76, 140, .18); outline: 2px solid var(--accent); outline-offset: 1px; mix-blend-mode: normal; }
.op-mark.region { background: rgba(46, 76, 140, .1); outline: 2px dashed var(--accent); mix-blend-mode: normal; }
.op-text { position: absolute; inset: 0; font-size: 1px; line-height: 1; color: transparent; white-space: pre; }
.op-text span { position: absolute; white-space: pre; line-height: 1; transform-origin: 0 0; font-family: Arial, Helvetica, sans-serif; cursor: text; }
.op-text span::selection, .op-text::selection { background: rgba(46, 76, 140, .32); color: transparent; }
.op-draw { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
.op-note { font-size: 13px; color: var(--muted); }

/* Accounts: sign in, two-step verification, invites and password recovery */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; outline: none; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; padding: 28px 28px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 24px; }
.auth-card h2 { font-size: 19px; }
.auth-brand { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form .field { display: flex; flex-direction: column; gap: 4px; }
.auth-form .btn-primary { min-height: 44px; }
.auth-links { font-size: 14px; color: var(--muted); }
.auth-message:empty { display: none; }
.field-error { font-size: 13px; color: var(--stuck); }
.auth-steps { display: flex; flex-direction: column; gap: 10px; padding-left: 20px; }
.auth-qr { margin-top: 8px; }
.auth-qr img { width: 200px; height: 200px; image-rendering: pixelated; border: 1px solid var(--line); background: #fff; }
.auth-key { font-family: Consolas, "Cascadia Mono", monospace; font-size: 15px; letter-spacing: .04em; user-select: all; }
.auth-codes { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; padding: 12px 14px; background: var(--neutral-soft); border-radius: 10px; }
.auth-codes code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 15px; user-select: all; }
.auth-row { display: flex; gap: 8px; }
.auth-dialog { border: 0; padding: 0; background: transparent; }
.auth-dialog::backdrop { background: rgba(28, 35, 33, .45); }
.account-btn { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-who { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-who small { color: var(--muted); font-size: 13px; }

/* AI allowance: a percentage for the month, and saved answers */
.budget-meter { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--muted); }
.budget-bar { flex: 0 0 90px; height: 6px; border-radius: 3px; background: var(--neutral-soft); overflow: hidden; }
.budget-fill { display: block; height: 100%; background: var(--accent-mid); }
.budget-meter[data-state="warning"] .budget-fill { background: var(--stuck-bar); }
.budget-meter[data-state="warning"] .budget-note { color: var(--stuck); }
.budget-meter[data-state="exhausted"] .budget-fill, .budget-meter[data-state="paused"] .budget-fill { background: var(--faint); }
.budget-note:empty { display: none; }
.saved-answer { align-self: flex-start; font-size: 12px; }
.msg-notice[data-kind="budget"] { background: var(--neutral-soft); color: var(--ink-2); }
.ask-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ask-foot .budget-meter { margin-left: auto; }

/* The reader on original pages */
.reader-originals { display: flex; flex-direction: column; gap: 18px; }
.reader-sheet.original + .reader-sheet.original { margin-top: 0; padding-top: 0; border-top: 0; }
.reader-sheet.original .page-label { margin-bottom: 6px; }
/* Only the book's pages show: no sheet behind them, headings and page labels for screen readers only */
.reader-page.reader-page.originals { padding: 0; background: none; border-radius: 0; box-shadow: none; }
.originals .reader-section { position: relative; }
.originals .reader-section + .reader-section { margin-top: 18px; }
.originals .reader-head, .originals .page-label { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.originals .op-sheet { border-color: var(--line-strong); box-shadow: 0 2px 14px rgba(24, 36, 46, .10); }

/* Admin area and account */
.admin .tabs { margin-bottom: 8px; }
.admin .tabs .tab { display: inline-flex; align-items: center; text-decoration: none; }
.admin .tabs .tab[aria-current="page"] { border-bottom-color: var(--accent); color: var(--ink); }
.admin-panel, .admin-stack { display: flex; flex-direction: column; gap: 18px; }
.admin-card { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.admin-card h2 { font-size: 18px; }
.admin-card h3 { font-size: 15px; }
.admin-subject-title { font-size: 22px; margin: 0 0 4px; }
.time-progress { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.time-progress .bar-progress { transition: width .6s; }
.admin-limits > summary { display: flex; align-items: baseline; gap: 8px; cursor: pointer; }
.admin-limits > summary::before { content: "▸"; color: var(--muted); }
.admin-limits[open] > summary::before { content: "▾"; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.admin-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.admin-form > p { flex-basis: 100%; }
.admin-form .field { min-width: 200px; flex: 1 1 200px; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 10px; border-bottom: 1px solid var(--line-soft, var(--line)); vertical-align: top; }
.admin-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.inline-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.input-small { width: auto; min-height: 34px; padding: 4px 8px; max-width: 160px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; }
.pill.good { background: #E3F0E7; color: #2F6B45; }
.pill.warn { background: var(--stuck-soft); color: var(--stuck); }
.pill.muted { background: var(--neutral-soft); color: var(--muted); }
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.copy-text { font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; padding: 6px 8px; background: var(--neutral-soft); border-radius: 6px; overflow-wrap: anywhere; user-select: all; }
.photo-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.photo-tile { display: flex; flex-direction: column; gap: 6px; }
.photo-tile img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--neutral-soft); }
.photo-tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); }
.sheet-head .input { flex: 1; font-weight: 700; }
.invite-result { padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); display: flex; flex-direction: column; gap: 8px; }
.budget-states { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.budget-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.usage-totals { font-size: 15px; }
.btn-danger { border-color: var(--stuck); background: var(--surface); color: var(--stuck); }
.btn-danger:hover { background: var(--stuck-soft); }
.feedback-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.feedback-list li { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.feedback-message { white-space: pre-wrap; }
.small { font-size: 13px; }
.plain-list { display: flex; flex-direction: column; gap: 8px; padding-left: 20px; }
.material-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.material-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

/* Practice desk: every problem in the chapter in one strip across the top */
.session-context { flex: 1 1 560px; }
.problem-strip { flex: 1 1 480px; min-width: 0; display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 16px; border-radius: 999px; background: var(--surface); box-shadow: var(--raise); }
.strip-name { flex: none; margin-right: 4px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.strip-count { color: var(--muted); font-weight: 600; }
.strip-steps { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; padding: 5px 4px; scrollbar-width: thin; }
.strip-steps .step, .strip-steps .step-group { flex: none; }
.strip-steps .step { min-width: 40px; height: 32px; border-radius: 999px; }
.problem-strip .tool-btn { width: 34px; height: 34px; }
.strip-more { flex: none; }
.strip-all { min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--ground); color: var(--accent-strong); font-size: 13px; font-weight: 700; white-space: nowrap; }
.strip-all:hover, .strip-all[aria-expanded="true"] { background: var(--accent-soft); }
.steps-panel { width: min(440px, calc(100vw - 32px)); max-height: 60vh; overflow: auto; padding: 8px; }
.strip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.strip-row { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 10px; color: var(--ink); font-size: 14px; text-decoration: none; }
.strip-row:hover { background: var(--subtle); color: var(--ink); }
.strip-row[aria-current="step"] { background: var(--accent-soft); font-weight: 700; }
.strip-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-row .muted { font-size: 12px; }
.strip-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 2px #C9D3DB; }
.strip-dot[data-status="finished"] { background: var(--accent); box-shadow: none; }
.strip-dot[data-status="in_progress"] { background: var(--accent-mid); box-shadow: none; }
.strip-dot[data-status="stuck"] { background: var(--stuck-bar); box-shadow: none; }
.exam-banner { gap: 8px 14px; }
.exam-banner > span { flex: 1 1 280px; }
.exam-clock { font-variant-numeric: tabular-nums; }
.exam-banner.over { background: var(--danger-soft); color: var(--danger); }

/* Import steps sit over the page beside the sidebar */
.import-screen { display: flex; flex-direction: column; min-height: 100vh; }
.import-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 14px 40px; background: var(--surface); border-bottom: 1px solid var(--line); }

/* Phones and narrow windows: the sidebar becomes a bar at the top with a menu */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar-body { display: none; flex-basis: 100%; padding: 8px 0 4px; }
  .sidebar.open .sidebar-body { display: flex; }
  .side-foot { margin-top: 8px; }
  .sidebar.rail { display: none; }
  .page { padding: 20px 16px 56px; }
  .hero { padding: 24px 20px; }
  .ring.big { --size: 112px; }
  .reader-page.reader-page, .notebook-book { padding: 28px 20px 32px; }
  .import-bar { padding: 12px 16px; }
}
