@layer views {
  /* ── auth: sodalite-style ambient ground, one card ── */
  .auth {
    position: relative; isolation: isolate; min-height: 100dvh;
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; gap: 48px;
    padding: 48px clamp(16px, 6vw, 88px);
  }
  .auth::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background:
      radial-gradient(640px 380px at 86% 8%, var(--glow-a), transparent 70%),
      radial-gradient(680px 420px at 6% 96%, var(--glow-b), transparent 70%);
  }
  .auth-brand { display: grid; gap: 20px; align-content: center; justify-items: start; }
  .auth-brand h1 { font-size: clamp(40px, 6vw, 72px); letter-spacing: -0.055em; line-height: .98; max-width: 11ch; }
  .auth-brand p { font-size: var(--fs-lg); max-width: 44ch; color: var(--fg-2); }
  .auth-card { width: 100%; max-width: 420px; justify-self: center; display: grid; gap: 20px; }
  .auth-card h2 { font-size: var(--fs-xl); letter-spacing: -0.04em; }
  /* the links under a form: one quiet centred line */
  .auth-alt { font-size: var(--fs-sm); color: var(--muted); text-align: center; }
  .turnstile-slot:empty { display: none; }
  @media (max-width: 900px) {
    .auth { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-top: 32px; align-content: start; }
    .auth-brand h1 { font-size: clamp(36px, 10vw, 48px); }
  }
  /* a phone: the form above the fold */
  @media (max-width: 640px) {
    .auth-brand p { display: none; }
  }

  /* ── today ── */
  .today-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px; }
  .today-head .h-page { margin-top: 8px; max-width: 18ch; }
  /* sections, each a label over one list */
  .today-grid { margin-top: 32px; display: grid; gap: 28px; }
  .today-sec { display: grid; gap: 8px; }
  .steps3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .step { border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--pad-card); background: var(--surface); display: grid; gap: 8px; align-content: start; }
  .step h3 { font-size: var(--fs-lg); letter-spacing: -0.03em; }
  .step p { font-size: var(--fs-body-sm); color: var(--muted); }
  @media (max-width: 760px) { .steps3 { grid-template-columns: minmax(0, 1fr); } }

  .today-body { margin-top: 8px; }
  /* the classes: one list, like the assignments over it */
  .subj-list { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); overflow: hidden; }
  .subj-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
    padding: var(--pad-row); border-bottom: 1px solid var(--line);
    &:last-child { border-bottom: 0; }
  }
  .subj-main { min-width: 0; display: grid; gap: 1px; }
  .subj-title { color: var(--fg); font-weight: 700; font-size: var(--fs-row); text-decoration: none; overflow-wrap: anywhere; }
  .subj-title:hover { text-decoration: underline; }
  .subj-line { font-size: var(--fs-meta); color: var(--fg-2); }
  /* the class's topics, filling with solid ones: the colours of the map's legend */
  .subj-bar { display: flex; gap: 2px; height: 6px; margin-top: 8px; max-width: 420px; border-radius: 3px; overflow: hidden; }
  .subj-bar i { min-width: 3px; background: var(--track); }
  .subj-bar i[data-part="solid"] { background: var(--known); }
  .subj-bar i[data-part="due"] { background: var(--due); }
  .subj-bar i[data-part="learning"] { background: var(--learning); }

  /* ── settings: each section a heading, then one list of rows, each a label and its control ── */
  .settings { display: grid; gap: 32px; margin-top: 28px; }
  .settings section { display: grid; gap: 12px; }
  .settings section > .pill { justify-self: start; }
  .set-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 100%; }
  .set-ctl .input { width: min(220px, 100%); min-height: 40px; padding-block: 8px; }
  .set-ctl select.input { width: auto; min-width: 120px; }
  .set-ctl .input:disabled { opacity: .5; }
  .row-err { flex-basis: 100%; font-size: var(--fs-meta); font-weight: 600; color: var(--wrong); }
  .row > :is(.meter, .ai-result) { flex-basis: 100%; }
  .usage-amt { color: var(--muted); font-size: var(--fs-body-sm); font-variant-numeric: tabular-nums; }
  .usage-amt b { color: var(--fg); font-size: var(--fs-row); font-weight: 700; }
  .ai-result { font-family: var(--mono); font-size: var(--fs-meta); white-space: pre-wrap; }
  /* a just-made invite link, whole and selectable, in place of its row's title */
  .invite-link { width: 100%; min-height: 40px; padding-block: 8px; font-family: var(--mono); font-size: var(--fs-meta); }

  /* ── new class ── */
  .intake-note { margin-top: 18px; }
  .intake { max-width: 620px; gap: 22px; margin-top: 28px; }
  .intake-actions { display: flex; gap: 10px; flex-wrap: wrap; }

  /* ── subject ── */
  .subject-body { margin-top: 28px; display: grid; gap: 28px; }
  .build { display: grid; gap: 14px; max-width: 560px; }
  .build .hint { font-size: var(--fs-meta); color: var(--muted); }
  .steps { display: grid; gap: 10px; }
  .steps li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; font-size: var(--fs-body-sm); line-height: 1.45; color: var(--fg-2); }
  .steps li::before { content: ""; width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; border: 1.5px solid var(--line-2); }
  .steps li.ok::before { background: var(--success); border-color: var(--success); }
  .steps li.busy { color: var(--fg); font-weight: 600; }
  .steps li.busy::before { border-top-color: var(--fg); animation: spin .9s linear infinite; }
  @media (prefers-reduced-motion: reduce) { .steps li.busy::before { animation-duration: 2.4s; } }
  .steps li.bad { color: var(--wrong); font-weight: 600; }
  .steps li.bad::before { background: var(--wrong); border-color: var(--wrong); }

  /* the class's study call to action (the gradient's one moment here); a map still to build is a plain card */
  .cta-card, .draft-card {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px;
    & > div:not(.cta-actions) { display: grid; gap: 6px; flex: 1 1 320px; }
  }
  .cta-card {
    padding: var(--pad-card); border-radius: var(--r-card); border: 1px solid transparent;
    background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box;
  }

  /* the class map: a list per step, a hairline between topics */
  .map-list { display: grid; gap: 14px; }
  .legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--fs-meta); color: var(--muted); }
  .legend > span { display: inline-flex; align-items: center; gap: 7px; }
  .layer { display: grid; gap: 8px; margin-top: 4px; }
  .map-rows { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); overflow: hidden; }
  .concept-title { color: var(--fg); font-weight: 700; font-size: var(--fs-row); min-width: 0; overflow-wrap: anywhere; }
  .concept-kind { font-family: var(--mono); font-size: var(--fs-label); color: var(--muted); }
  .concept-meta { font-family: var(--mono); font-size: var(--fs-label); color: var(--fg-2); font-variant-numeric: tabular-nums; min-width: 88px; text-align: right; }
  @media (max-width: 560px) {
    .concept-kind { display: none; }
  }
  /* the heading takes the focus when the row that had it is redrawn away */
  .map-list > .h-sec:focus { outline: none; }
  /* topics taken out of the class: folded under their count at the end of the map, each to put back */
  .map-hidden { margin-top: 4px; }
  .map-hidden > summary { cursor: pointer; width: fit-content; padding: 4px 0; }
  .map-hidden > summary:hover { color: var(--fg); }
  .map-hidden[open] > summary { margin-bottom: 8px; }
  .map-hidden-row {
    display: flex; align-items: center; gap: 12px; padding: var(--pad-row); border-bottom: 1px solid var(--line);
    &:last-child { border-bottom: 0; }
    & .concept-title { flex: 1; color: var(--fg-2); }
  }
  @media (pointer: coarse) { .map-hidden > summary { padding-block: 12px; margin-block: -8px -4px; } }
  /* a long file list shows its first few; the rest wait behind "show n more" under it */
  .src-row:has(+ .src-row[hidden]) { border-bottom: 0; }
  .src-more { justify-self: start; font-size: var(--fs-sm); }

  /* ── session (focus layout) ── */
  .ss { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); }
  .ss-top {
    position: sticky; top: 0; z-index: 10;
    display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 20px;
    padding: calc(12px + env(safe-area-inset-top, 0px)) clamp(16px, 3vw, 28px) 12px;
    background: color-mix(in oklch, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .ss-exit { border: 0; background: none; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
  .ss-exit:hover { color: var(--fg); }
  .ss-prog { display: flex; gap: 4px; min-width: 0; }
  .ss-prog i { flex: 1; height: 6px; border-radius: 3px; background: var(--track); max-width: 48px; }
  .ss-prog i.r { background: var(--right); } .ss-prog i.w { background: var(--wrong); }
  .ss-prog i.p { background: var(--due); } .ss-prog i.c { background: var(--fg); }
  .ss-prog i.q { background: var(--fg-2); opacity: 0.55; }
  .ss-meta { font-size: var(--fs-meta); color: var(--muted); white-space: nowrap; }
  .ss-meta .mono { color: var(--fg-2); }
  /* the tools: borderless round icons (.ss-icon, progress.css), and on a phone the tutor's "ask" */
  .ss-tools { display: flex; align-items: center; gap: 8px; }
  .ss-ask {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: var(--r-pill);
    background: none; color: var(--fg-2); font-size: var(--fs-sm); font-weight: 600;
    &:hover { color: var(--fg); background: var(--surface-2); }
  }
  .ss-stage { width: 100%; max-width: 720px; margin: 0 auto; padding: clamp(24px, 5vh, 56px) clamp(16px, 4vw, 32px) 80px; }
  /* The whiteboard open beside (or under) the question: keep the question centred in the room left. */
  .ss.with-board .ss-stage {
    max-width: calc(720px + var(--board-w, 0px));
    padding-right: calc(clamp(16px, 4vw, 32px) + var(--board-w, 0px));
    padding-bottom: calc(80px + var(--board-h, 0px));
  }
  .ss.with-board .ss-stage:has(.deck) { max-width: calc(1000px + var(--board-w, 0px)); }
  /* The next question on its way (it can take a while): its shape, shimmering quietly. */
  .ss-skel { display: grid; gap: 10px; }
  .ss-skel i {
    display: block; height: 48px; border-radius: var(--r-tile);
    background: linear-gradient(90deg, var(--surface-2) 35%, color-mix(in oklch, var(--surface-2), var(--line) 70%) 50%, var(--surface-2) 65%) 0 0 / 300% 100%;
    animation: ss-shimmer 1.8s ease-in-out infinite;
  }
  .ss-skel .skel-q { height: calc(var(--fs-question) * 1.05); width: 92%; border-radius: var(--r-item); }
  .ss-skel .skel-short { width: 58%; margin-bottom: 18px; }
  @keyframes ss-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
  @media (prefers-reduced-motion: reduce) { .ss-skel i { animation: none; } }
  .ss-card { display: grid; gap: 20px; }
  .ss-q { font-size: var(--fs-question); font-weight: 700; letter-spacing: -0.02em; line-height: 1.35; color: var(--fg); }
  .ss-q p { text-wrap: pretty; }
  /* the answer's one row: check, then (pushed right) the ways out when stuck */
  .ss-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
  .ss-stuck { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-left: auto; }
  .ss-skip { color: var(--muted); font-weight: 600; font-size: var(--fs-sm); }
  @media (max-width: 640px) { .ss-stuck { margin-left: 0; width: 100%; } }
  /* A hint, and the whiteboard: an icon or key beside words underlined like any link. */
  .ss-hint, .ss-work { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
  :is(.ss-hint, .ss-work) > span { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
  :is(.ss-hint, .ss-work):hover > span { text-decoration-color: currentColor; }
  .ss-work { gap: 6px; }
  .ss-work svg { width: 14px; height: 14px; }
  .ss-work[aria-pressed="true"] { color: var(--fg); }
  /* Hints asked for, gentlest first. */
  .ss-hint-box { display: grid; gap: 8px; padding: var(--pad-row); border-radius: var(--r-tile); border: 1px solid var(--line); background: var(--surface-2); }
  .ss-hints { margin: 0; padding-left: 22px; display: grid; gap: 6px; font-size: var(--fs-body-sm); color: var(--fg-2); }
  .ss-hints li::marker { color: var(--muted); font-family: var(--mono); font-size: var(--fs-xs); }
  .ss-hints .rich > p { margin: 0; }
  .fb-hints { font-size: var(--fs-meta); color: var(--muted); }
  .fb-done { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-sm); font-weight: 600; color: var(--fg-2); }
  .fb-done svg { flex: none; width: 14px; height: 14px; align-self: center; color: var(--right); }

  .ex { container: exercise / inline-size; }
  .ex-mcq { display: grid; gap: 8px; }
  .opt {
    display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 12px; width: 100%; text-align: left;
    padding: 13px 16px; border-radius: var(--r-tile); border: 1px solid var(--line-2); background: var(--surface); color: var(--fg);
    font-size: var(--fs-md); transition: border-color var(--t-fast), background var(--t-fast);
    & kbd { margin-top: 2px; }
    &:hover:not(:disabled) { border-color: color-mix(in oklch, var(--fg) 35%, var(--line-2)); }
    &[aria-checked="true"] { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
    &:disabled { cursor: default; }
  }
  .opt-md > p { margin: 0; }
  .opt-why { grid-column: 2; font-size: var(--fs-meta); color: var(--fg-2); margin-top: 4px; }
  .ex-input { font-size: var(--fs-lg); min-height: 52px; }
  /* How an answer went, the same on an option and a field: its state's colour, as a border and a 1px inset. */
  :is(.opt, .ex-input)[data-state] { --state: var(--fg); border-color: var(--state); box-shadow: inset 0 0 0 1px var(--state); }
  :is(.opt, .ex-input)[data-state="correct"] { --state: var(--right); }
  :is(.opt, .ex-input)[data-state="partial"] { --state: var(--due); }
  :is(.opt, .ex-input)[data-state="wrong"] { --state: var(--wrong); }
  .ex-numeric-row { display: flex; align-items: center; gap: 12px; }
  .ex-numeric-row .ex-input { max-width: 280px; font-family: var(--mono); }
  .ex-unit { font-family: var(--mono); color: var(--fg-2); }
  .reads-as { margin-top: 8px; font-family: var(--mono); font-size: var(--fs-meta); color: var(--muted); min-height: 1.4em; }
  .reads-as[data-bad="1"] { color: var(--due); }
  .reads-as-math { font-family: var(--font); font-size: var(--fs-body-sm); color: var(--fg-2); & > p { display: inline; margin: 0; } }
  .ex-lead { flex: none; max-width: 100%; color: var(--fg-2); font-size: var(--fs-md); & > p { margin: 0; } }
  .ex-expression .ex-numeric-row { flex-wrap: wrap; }
  .ex-expression .ex-numeric-row .ex-input { min-width: 160px; flex: 1; }
  /* Steps put in order: one list, dragged (or arrowed) into place. The step held lifts and
     follows the pointer; the rest slide out of its way, then it snaps into its slot. */
  .ex-order { display: grid; gap: 12px; }
  .order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
  .order-item {
    position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px;
    padding: 8px 6px 8px 16px; border-radius: var(--r-tile); border: 1px solid var(--line-2); background: var(--surface); color: var(--fg);
    font-size: var(--fs-md); cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
    transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast), scale var(--t-fast) var(--ease-liquid);
    &:hover { border-color: color-mix(in oklch, var(--fg) 35%, var(--line-2)); }
    &:focus-visible {
      outline: none; border-color: color-mix(in oklch, var(--fg) 45%, transparent);
      box-shadow: 0 0 0 4px color-mix(in oklch, var(--focus) 20%, transparent);
    }
    &[data-state] { border-color: var(--state); box-shadow: inset 0 0 0 1px var(--state); }
    &[data-state="correct"] { --state: var(--right); }
    &[data-state="wrong"] { --state: var(--wrong); }
  }
  .order-md { flex: 1; min-width: 0; }
  /* The grip: a finger drags from here at once (anywhere else on a step, after a short hold). */
  .order-grip {
    flex: none; display: grid; place-items: center; width: 36px; height: 36px; margin-block: -4px;
    color: var(--muted); touch-action: none;
    & svg { width: 16px; height: 16px; }
  }
  .order-item:hover .order-grip { color: var(--fg); }
  /* Mid-drag: the others slide out of the way; the one held follows the pointer exactly. */
  .order-list.sorting .order-item:not(.dragging) { transition: translate var(--t-fast) var(--ease-liquid); }
  .order-item.dragging {
    z-index: 2; cursor: grabbing; scale: 1.02; border-color: var(--fg); background: var(--surface-2);
    box-shadow: 0 14px 32px -12px color-mix(in oklch, black 55%, transparent);
  }
  .order-item.dropping { transition: translate 150ms var(--ease-liquid), scale 150ms var(--ease-liquid); scale: 1; }
  :root:has(.order-item.dragging) { cursor: grabbing; }
  .ex-order[data-locked] .order-item { cursor: default; }
  .ex-order[data-locked] .order-grip { visibility: hidden; }
  .order-item .order-n { flex: none; font-family: var(--mono); font-size: var(--fs-meta); color: var(--muted); min-width: 1.2em; }
  .order-md > p { margin: 0; }
  /* The right order, after a miss or in a quiz's results: a numbered list beside "answer:". An
     explanation's key points, looking back, are a list there too. */
  :is(.fb-answer, .quiz-ans) .rich > :is(ol, ul) { margin: 0; padding-left: 1.4em; display: grid; gap: 2px; }
  /* Explain it back: a few sentences, then its key points, a dot each for how it went. */
  .ex-explain { display: grid; gap: 14px; }
  .ex-explain .ex-input { font-size: var(--fs-md); line-height: 1.5; min-height: 8.5em; resize: vertical; }
  .explain-points { display: grid; gap: 8px; }
  .explain-points ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
  .explain-points li {
    display: flex; align-items: start; gap: 10px; font-size: var(--fs-body-sm); line-height: 1.5; color: var(--fg-2);
    & .dot { margin-top: 7px; }
    & .rich { flex: 1; min-width: 0; }
    & .rich > p { margin: 0; }
    & .label { flex: none; margin-top: 2px; }
    &[data-met="there"] .dot { background: var(--right); }
    &[data-met="partly"] .dot { background: var(--due); }
    &[data-met="missing"] .dot { background: var(--wrong); }
  }

  .ss-feedback { display: grid; gap: 14px; padding: var(--pad-card); border-radius: var(--r-card); border: 1px solid var(--line); background: var(--surface); animation: pop var(--t) var(--ease-liquid); }
  .fb-head { font-size: var(--fs-row); color: var(--fg-2); }
  .fb-head b { color: var(--fg); font-weight: 800; }
  .fb-head .dot { display: inline-block; margin-right: 8px; translate: 0 -1px; }
  .fb-head[data-tone="right"] .dot { background: var(--right); }
  .fb-head[data-tone="partial"] .dot { background: var(--due); }
  .fb-head[data-tone="wrong"] .dot { background: var(--wrong); }
  /* the answer, wherever it's given: under feedback, in a quiz's look back */
  :is(.fb-answer, .quiz-ans) { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-weight: 600; color: var(--fg); }
  :is(.fb-answer, .quiz-ans) .rich > p { margin: 0; }
  /* A miss's quiet follow-ups: "why?" after its verdict, "i was right" after the answer it was marked against. */
  .fb-why, .fb-appeal { margin-left: 8px; }
  .fb-solution { font-size: var(--fs-body-sm); color: var(--fg-2); }
  .fb-concept { display: grid; gap: 8px; font-size: var(--fs-meta); color: var(--fg-2); }
  .fb-concept .concept-link { font-weight: 700; color: var(--fg); }
  /* Nothing in the feedback is boxed again: the source, the topic and your note each sit under a
     hairline. The topic is named once, by its own link, so the note's "everything on" isn't needed. */
  .ss-feedback :is(.fb-concept, .concept-foot-note) { padding-top: 14px; border-top: 1px solid var(--line); }
  .ss-feedback .concept-foot-note { padding-inline: 0; padding-bottom: 0; border-width: 1px 0 0; border-radius: 0; background: none; }
  .ss-feedback .concept-foot-link { display: none; }
  /* The part of your own materials the answer comes from. */
  .src-card { border: 1px solid var(--line); border-radius: var(--r-tile); background: var(--bg-raise); min-width: 0; }
  .src-card > summary {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 14px; cursor: pointer; list-style: none; font-size: var(--fs-meta);
    &::-webkit-details-marker { display: none; }
  }
  .src-card[open] > summary { border-bottom: 1px solid var(--line); }
  /* …and inside a card already (feedback, a looked-back question): under a hairline, unboxed */
  :is(.ss-feedback, .quiz-q-body) .src-card {
    border-width: 1px 0 0; border-radius: 0; background: none;
    & > summary { padding: 14px 0 0; }
    &[open] > summary { border-bottom: 0; }
    & .src-body { padding: 10px 0 0; }
  }
  .src-label { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: var(--fs-label); letter-spacing: var(--track-label); color: var(--muted); }
  .src-label svg { width: 13px; height: 13px; }
  .src-title { font-weight: 700; font-size: var(--fs-body-sm); color: var(--fg); overflow-wrap: anywhere; }
  .src-where { color: var(--muted); font-size: var(--fs-meta); }
  .src-body { padding: 12px 14px 14px; font-size: var(--fs-body-sm); color: var(--fg-2); overflow-x: auto; }
  .src-body table { border-collapse: collapse; font-size: var(--fs-meta); }
  /* A passage cut to six lines until "show more" (parts/source.js) */
  .rich[data-clamp="1"] { max-height: 9.6em; max-height: 6lh; overflow-y: hidden; }
  .rich[data-clamp="1"][data-over="1"] { mask-image: linear-gradient(to bottom, #000 60%, transparent); }
  .src-more { justify-self: start; font-size: var(--fs-sm); }
  .src-body > .src-more { margin-top: 6px; }
  /* …and the way to the original ("open page 3"), beside "show more" when that's there */
  .src-open { display: inline-block; justify-self: start; font-size: var(--fs-sm); }
  .src-body > .src-open { margin-top: 6px; }
  .src-body > .src-more:not([hidden]) + .src-open { margin-left: 16px; }
  .src-body :is(th, td) { padding: 6px 12px; border-bottom: 1px solid var(--line); text-align: left; }
  .src-body th { color: var(--fg); font-weight: 700; }
  .src-body td strong { color: var(--fg); }
  .src-body tr:has(strong) td { background: color-mix(in oklch, var(--known) 10%, transparent); }
  /* The end of a session or a quiz: the score, what it earned, what next, then the topics and a look back. */
  .ss-summary { display: grid; gap: 24px; }
  .ss-summary-head { display: grid; gap: 8px; }

  /* ── placeholder & not found ── */
  .empty { display: grid; gap: 14px; justify-items: start; padding: 56px 0; }
  .empty-actions { display: flex; flex-wrap: wrap; gap: 10px; }
}

@layer views {
  /* ── class: assignments ── */
  .study-area { display: grid; gap: 28px; }
  .sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 16px; }
  .sec-actions, .head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .work { display: grid; gap: 14px; }
  .asg-groups { display: grid; gap: 18px; }
  .asg-group { display: grid; gap: 7px; }
  .asg-list { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); overflow: hidden; }
  .asg-row {
    display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 12px;
    padding: var(--pad-row); border-bottom: 1px solid var(--line);
  }
  .asg-row:last-child { border-bottom: 0; }
  .asg-main { display: grid; gap: 1px; min-width: 0; }
  .asg-title { color: var(--fg); font-weight: 700; font-size: var(--fs-row); text-decoration: none; overflow-wrap: anywhere; }
  .asg-title:hover { text-decoration: underline; }
  .asg-sub { font-size: var(--fs-meta); color: var(--muted); }
  .asg-row[data-status="done"] .asg-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
  /* 20px to look at; a 28px circle takes the click */
  .asg-check {
    position: relative;
    width: 20px; height: 20px; padding: 0; border-radius: 50%; display: grid; place-items: center;
    border: 1.5px solid var(--line-strong); background: transparent;
    transition: border-color var(--t-fast), background var(--t-fast);
    &:hover { border-color: var(--fg); }
    &[aria-pressed="true"] { background: var(--success); border-color: var(--success); }
    &::before { content: ''; position: absolute; inset: -5px; border-radius: 50%; }
    &[aria-pressed="true"]::after { content: ""; width: 8px; height: 4px; border: 2px solid var(--bg); border-top: 0; border-right: 0; rotate: -45deg; translate: 0 -1px; }
  }
  .asg-row[data-status="doing"] .asg-check { border-color: var(--learning); background: conic-gradient(var(--learning) 0 50%, transparent 0); }
  .due { white-space: nowrap; }
  .due[data-tone="late"] { color: var(--wrong); font-weight: 600; }
  .due[data-tone="soon"] { color: var(--due); font-weight: 600; }
  .due[data-tone="week"] { color: var(--fg-2); }
  .asg-done > summary { cursor: pointer; padding: 4px 0 8px; width: fit-content; }
  .asg-done > summary:hover { color: var(--fg); }
  .asg-late { justify-self: start; margin-top: -8px; font-size: var(--fs-sm); color: var(--fg-2); font-weight: 500; }
  .empty-card {
    display: grid; gap: 12px; justify-items: start; padding: 20px 22px;
    border: 1px dashed var(--line-2); border-radius: var(--r-card); color: var(--muted); font-size: var(--fs-body-sm);
  }

  /* ── assignment page ── */
  .crumb { color: inherit; text-decoration: none; }
  .crumb:hover { color: var(--fg); text-decoration: underline; }
  .due-line { margin-top: 10px; font-size: var(--fs-md); font-weight: 600; color: var(--fg-2); }
  .due-line[data-tone="late"] { color: var(--wrong); }
  .due-line[data-tone="soon"] { color: var(--due); }
  /* what it asks, under the due line: the summary as a lede, then your notes on it */
  .asg-desc { display: grid; gap: 10px; max-width: 64ch; margin-top: 14px; }
  .asg-desc .rich { font-size: var(--fs-md); color: var(--fg-2); }

  /* ── dialogs with forms ── */
  dialog.modal.wide { width: min(560px, calc(100vw - 32px)); }
  dialog.modal .modal-form { display: contents; }
  dialog.modal .spacer { flex: 1; }
  dialog.modal .form { gap: 14px; margin-top: 6px; }
  .field-pair { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 12px; align-items: start; }
  select.input { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
  textarea.input { resize: vertical; line-height: 1.5; font-family: var(--font); }
  .chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
  .chips-row .chip { background: transparent; cursor: pointer; }
  .chips-row .chip:hover { color: var(--fg); border-color: var(--fg-2); }
  .cat-list { display: grid; gap: 8px; margin-top: 4px; }
  .cat-row, .cat-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
  .cat-row .input, .cat-add .input { min-height: 38px; padding: 7px 12px; font-size: var(--fs-body-sm); }
  @media (max-width: 480px) { .field-pair { grid-template-columns: minmax(0, 1fr); } }
}

@layer views {
  /* ── materials (class and assignment files) ── */
  .materials { display: grid; gap: 14px; }
  /* the one "add" button and its small menu of ways (upload, scan, paste) */
  .mat-add { position: relative; }
  .mat-menu {
    position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; min-width: 196px;
    display: grid; gap: 2px; padding: 6px; border: 1px solid var(--line-2); border-radius: var(--r-tile);
    background: var(--surface); box-shadow: var(--shadow-float);
    & button {
      display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 7px 10px;
      border: 0; border-radius: var(--r-item); background: none; text-align: left; white-space: nowrap;
      color: var(--fg-2); font-size: var(--fs-body-sm); font-weight: 600;
      &:hover, &:focus-visible { background: var(--surface-2); color: var(--fg); }
      &:focus-visible { outline-offset: -2px; }
      & svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
    }
  }
  @media (pointer: coarse) { .mat-menu button { min-height: 44px; } }
  .upload-status { font-size: var(--fs-meta); color: var(--muted); min-height: 0; }
  .upload-status:empty { display: none; }
  .src-list { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); overflow: hidden; }
  .src-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: var(--pad-row); border-bottom: 1px solid var(--line); }
  .src-row:last-child { border-bottom: 0; }
  .src-icon { width: 30px; height: 30px; border-radius: var(--r-item); display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
  .src-icon svg { width: 15px; height: 15px; }
  .src-main { display: grid; gap: 1px; min-width: 0; }
  .src-row-title { color: var(--fg); font-weight: 700; font-size: var(--fs-row); text-decoration: none; overflow-wrap: anywhere; }
  a.src-row-title:hover, button.src-row-title:hover { text-decoration: underline; }
  button.src-row-title { justify-self: start; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
  .src-state { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-meta); color: var(--muted); }
  .src-state.busy { color: var(--fg-2); }
  .src-state.bad { color: var(--wrong); }
  .src-row[data-status="failed"] .src-icon { color: var(--wrong); }
  .sync-banner { color: var(--fg-2); }
  .page[data-drag="1"] { outline-offset: 8px; border-radius: var(--r-card); }

  /* ── what to study (assignment page) ── */
  .study-card { display: grid; gap: 16px; }
  .study-top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
  .study-score { display: grid; justify-items: center; min-width: 74px; }
  .study-score b { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.05em; line-height: 1; color: var(--fg); font-variant-numeric: tabular-nums; }
  .study-score span { font-size: var(--fs-xs); color: var(--muted); }
  .study-score[data-level="low"] b { color: var(--due); }
  .study-score[data-level="high"] b { color: var(--success); }
  .study-lede { flex: 1 1 160px; display: grid; gap: 4px; }
  .study-card .meter[data-level="low"] > i { background: var(--due); }
  .study-card .meter[data-level="high"] > i { background: var(--success); }
  .study-wait { display: flex; align-items: center; gap: 10px; color: var(--fg-2); font-size: var(--fs-body-sm); }
  .study-steps { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
  .study-steps > li { display: grid; gap: 4px; padding-left: 14px; border-left: 2px solid var(--line-2); }
  .study-steps > li[data-kind="prereq"], .study-steps > li[data-kind="practice"] { border-left-color: var(--due); }
  .study-steps > li[data-kind="learn"] { border-left-color: var(--learning); }
  .study-steps > li[data-kind="review"] { border-left-color: var(--known); }
  .study-steps > li[data-kind="set"] { border-left-color: var(--success); }
  .step-label { font-size: var(--fs-sm); font-weight: 700; color: var(--fg); }
  .step-concepts { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: var(--fs-body-sm); color: var(--fg-2); }
  .study-foot { font-size: var(--fs-meta); }
  .topic-list { display: grid; gap: 2px; max-height: min(50vh, 420px); overflow-y: auto; margin-top: 4px; }
  .topic-opt { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-item); font-size: var(--fs-body-sm); color: var(--fg-2); cursor: pointer; }
  .topic-opt:hover { background: var(--surface-2); color: var(--fg); }
  .topic-opt input { width: 16px; height: 16px; accent-color: var(--fg); }

  /* ── the exam (class page): a study card, with the pace under it ── */
  .exam-pace { font-size: var(--fs-body-sm); color: var(--fg-2); }
  .exam-pace b { color: var(--fg); }
  .exam-pace[data-tone="behind"] b { color: var(--due); }
  /* the other tests, folded under the first two cards */
  .exam-more > summary { cursor: pointer; width: fit-content; padding: 4px 0; }
  .exam-more > summary:hover { color: var(--fg); }
  .exam-more[open] > summary { margin-bottom: 12px; }
  @media (pointer: coarse) { .exam-more > summary { padding-block: 12px; margin-block: -8px -4px; } }

  /* ── tests: the switch that makes an assignment one, and the label under its name ── */
  .switch-opt { display: inline-flex; align-items: center; gap: 8px; width: fit-content; font-size: var(--fs-body-sm); color: var(--fg-2); cursor: pointer; }
  .switch-opt input { width: 16px; height: 16px; margin: 0; accent-color: var(--fg); }
  @media (pointer: coarse) { .switch-opt { min-height: 40px; } }
  .asg-tag { line-height: 1; }

  /* ── a syllabus's dates: a quiet action on its row, then a list to tick ── */
  .src-state:has(> .src-act) { flex-wrap: wrap; row-gap: 2px; }
  .src-act { font-size: inherit; }
  .found-list {
    max-height: min(56vh, 460px); overflow-y: auto;
    border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface);
  }
  .found-row {
    display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 12px;
    padding: var(--pad-row); border-bottom: 1px solid var(--line);
    &:last-child { border-bottom: 0; }
    &[data-on="false"] .found-fields { opacity: .5; }
  }
  .found-tick { width: 16px; height: 16px; margin: 12px 0 0; accent-color: var(--fg); }
  .found-fields { display: grid; gap: 8px; min-width: 0; }
  .found-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .found-meta > .input { flex: 1 1 140px; min-width: 0; width: auto; }

  /* ── readiness on assignment rows ── */
  .asg-side { display: flex; align-items: center; gap: 12px; justify-content: flex-end; }
  /* how ready you are; a button (with a play mark) when pressing it starts a session on it */
  .ready-pill {
    display: inline-flex; align-items: center; gap: 5px;
    font-family: var(--mono); font-size: var(--fs-label); font-weight: 600; line-height: 1.4; letter-spacing: var(--track-label);
    padding: 3px 9px; border: 0; border-radius: var(--r-pill); white-space: nowrap;
    --tone: var(--fg-2); color: var(--tone); background: color-mix(in oklch, var(--tone) 10%, transparent);
    &[data-level="low"] { --tone: var(--due); }
    &[data-level="high"] { --tone: var(--success); }
    & svg { width: 9px; height: 9px; fill: currentColor; stroke-width: 1; }
  }
  button.ready-pill {
    transition: background var(--t-fast);
    &:hover { background: color-mix(in oklch, var(--tone) 20%, transparent); }
  }
  /* phones: what's due and how ready stack at the right, so a row is two lines, not three */
  @media (max-width: 560px) {
    .asg-side { flex-direction: column; align-items: flex-end; gap: 4px; }
  }
}

@layer views {
  /* ── reporting a broken question: one small word under it ── */
  .ss-report { justify-self: start; color: var(--muted); font-size: var(--fs-meta); font-weight: 500; text-decoration-color: transparent; }
  .ss-report:hover { color: var(--fg-2); text-decoration-color: currentColor; }
  .ss-prog i.x { background: var(--line-2); opacity: .45; }
}
