/* Prantara — one stylesheet, no build step. */

/* Prantara's colours: a clear, bright blue (the main colour) and a warm amber (the
   accent: highlights, the AI-free stripe), on neutral backgrounds: white and soft grey
   in light mode, graphite (#212121 page, #262626 and #2f2f2f panels) in dark mode,
   the same neutrals as the group's other tools (the STATES explorer). Chart colours
   (--viz-*) step in lightness as well as hue (dark blue, amber, light teal), so the
   series stay apart for colour-vision deficiency and in greyscale. The token names
   (--maroon, --orange) date from the first course's VT colours; read them as
   "primary" and "accent". */
:root {
  --maroon: #2563eb;
  --maroon-2: #1d4ed8;
  --maroon-ink: #1d4ed8;
  --brand-fill: #2563eb;          /* filled controls with white text */
  --brand-fill-hover: #1d4ed8;
  --orange: #f5a524;              /* accent fills: dark text on top, never white */
  --orange-ink: #b45309;
  --accent-on: #2a1a00;
  --stone: #64748b;
  --bg: #f9f9f9;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #e9e9ec;
  --ink: #0d0d0d;
  --ink-2: #3a3a40;
  --muted: #5d5d63;
  --line: #e5e5e7;
  --focus: #0e7490;
  --ok: #1d7a4a;
  --ok-bg: #e5f3ea;
  --bad: #b42318;
  --bad-bg: #fcebe9;
  --warn: #8f5200;
  --warn-bg: #fdf1e2;
  --info-bg: #eef4fc;
  --hand: #1d4ed8;
  --concept: #0f766e;
  --supervision: #b45309;
  --header-bg: rgba(255, 255, 255, .92);   /* a light bar: dark text, blue and amber accents */
  --header-ink: #0d0d0d;
  --header-ink-2: #5d5d63;
  --header-hover: #f0f0f2;
  --header-on: rgba(37, 99, 235, .09);
  --header-on-ink: #1d4ed8;
  --hero-from: #e4eeff;                    /* the dashboard banner: a soft morning sky */
  --hero-to: #fff2d9;
  --hero-ink: #0d0d0d;
  --hero-ink-2: #5d5d63;
  --glass: rgba(255, 255, 255, .72);       /* chips and cards laid over the banner */
  --soft-accent: linear-gradient(135deg, #dbe7ff, #fde9c4);   /* avatar initials, numbered badges */
  --soft-accent-ink: #1d4ed8;
  --avatar-bg: #dfe8fb;
  --avatar-ink: #1d4ed8;
  --lv0: transparent;
  --lv1: #c7d7fe;
  --lv2: #8aaef8;
  --lv3: #4a7be8;
  --lv4: #1e3a8a;
  --viz-s1: #1d4ed8;
  --viz-s2: #e8890c;
  --viz-s3: #14a3a0;
  --viz-ref: #1f2937;
  --viz-muted: #8a94a6;
  --viz-grid: #ececee;
  --viz-axis: #c4c4ca;
  --viz-surface: #ffffff;
  --code-bg: #f6f7f9;
  --hue-blue: #2563eb; --hue-violet: #7c3aed; --hue-teal: #0f8a86; --hue-amber: #c26a06; --hue-green: #1d8a4f;
  --hue-rose: #d12c4a; --hue-slate: #5b6b82;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 10px rgba(0, 0, 0, .04);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

/* dark: OS preference unless the viewer picked light; or an explicit dark choice */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --maroon: #7aa2ff; --brand-fill: #3b6ef0; --brand-fill-hover: #2f5fd8; --maroon-2: #9bb8ff; --maroon-ink: #8fb0ff; --orange: #f0b649; --orange-ink: #f0b649;
    --bg: #212121; --surface: #262626; --surface-2: #2f2f2f; --surface-3: #363636;
    --ink: #ececf1; --ink-2: #c8c8cf; --muted: #a8a8b0; --line: #363636;
    --ok: #6fc191; --ok-bg: rgba(111, 193, 145, .13); --bad: #ee6f5b; --bad-bg: rgba(238, 111, 91, .13); --warn: #f0b649; --warn-bg: rgba(240, 182, 73, .13); --info-bg: rgba(122, 162, 255, .12);
    --hand: #8fb0ff; --concept: #5eead4; --supervision: #f0b649;
    --header-bg: rgba(24, 24, 24, .94); --header-ink: #ececf1; --header-ink-2: #a8a8b0;
    --header-hover: #2f2f2f; --header-on: rgba(122, 162, 255, .14); --header-on-ink: #9bb8ff;
    --hero-from: #262b34; --hero-to: #2f2b23; --hero-ink: #ececf1; --hero-ink-2: #a8a8b0; --glass: rgba(255, 255, 255, .06);
    --soft-accent: linear-gradient(135deg, #2f3542, #3b3527); --soft-accent-ink: #b9ccff;
    --avatar-bg: #2f3747; --avatar-ink: #b9ccff;
    --lv1: #2a3b5e; --lv2: #3360c4; --lv3: #6b93f0; --lv4: #b8cdfc;
    --viz-s1: #6f9bff; --viz-s2: #f0a03a; --viz-s3: #2cc4b8; --viz-ref: #ececf1; --viz-muted: #7a7a82;
    --viz-grid: #2f2f2f; --viz-axis: #4a4a4a; --viz-surface: #262626;
    --code-bg: #1b1b1b; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --hue-blue: #84a9ff; --hue-violet: #b79cff; --hue-teal: #4fd1c5; --hue-amber: #f3b54f; --hue-green: #5cc98f;
    --hue-rose: #ff8297; --hue-slate: #a9b6c9;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --maroon: #7aa2ff; --brand-fill: #3b6ef0; --brand-fill-hover: #2f5fd8; --maroon-2: #9bb8ff; --maroon-ink: #8fb0ff; --orange: #f0b649; --orange-ink: #f0b649;
  --bg: #212121; --surface: #262626; --surface-2: #2f2f2f; --surface-3: #363636;
  --ink: #ececf1; --ink-2: #c8c8cf; --muted: #a8a8b0; --line: #363636;
  --ok: #6fc191; --ok-bg: rgba(111, 193, 145, .13); --bad: #ee6f5b; --bad-bg: rgba(238, 111, 91, .13); --warn: #f0b649; --warn-bg: rgba(240, 182, 73, .13); --info-bg: rgba(122, 162, 255, .12);
  --hand: #8fb0ff; --concept: #5eead4; --supervision: #f0b649;
  --header-bg: rgba(24, 24, 24, .94); --header-ink: #ececf1; --header-ink-2: #a8a8b0;
  --header-hover: #2f2f2f; --header-on: rgba(122, 162, 255, .14); --header-on-ink: #9bb8ff;
  --hero-from: #262b34; --hero-to: #2f2b23; --hero-ink: #ececf1; --hero-ink-2: #a8a8b0; --glass: rgba(255, 255, 255, .06);
  --soft-accent: linear-gradient(135deg, #2f3542, #3b3527); --soft-accent-ink: #b9ccff;
  --avatar-bg: #2f3747; --avatar-ink: #b9ccff;
  --lv1: #2a3b5e; --lv2: #3360c4; --lv3: #6b93f0; --lv4: #b8cdfc;
  --viz-s1: #6f9bff; --viz-s2: #f0a03a; --viz-s3: #2cc4b8; --viz-ref: #ececf1; --viz-muted: #7a7a82;
  --viz-grid: #2f2f2f; --viz-axis: #4a4a4a; --viz-surface: #262626;
  --code-bg: #1b1b1b; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --hue-blue: #84a9ff; --hue-violet: #b79cff; --hue-teal: #4fd1c5; --hue-amber: #f3b54f; --hue-green: #5cc98f;
  --hue-rose: #ff8297; --hue-slate: #a9b6c9;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font);
}
a { color: var(--maroon); text-decoration: none; }
:is(p, li, td, .footer, .small, .tiny, .notice, .md) a:not(.btn):not(.pill):not(.chip):not(.sg-tile):not(.rowlink) {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 1.2em 0 .5em; scroll-margin-top: 84px; }
.viz, .keyideas, .diagram { scroll-margin-top: 84px; }
h1 { font-size: 1.7rem; margin-top: .4em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: .6em 0; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .08em .3em; border-radius: 4px; }
pre { font-family: var(--mono); font-size: .86rem; line-height: 1.45; overflow-x: auto; }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
table { border-collapse: collapse; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------------ chrome (VT)
   Phone first: most students open the site on a phone, so the base styles are the
   phone layout — a compact sticky top bar (brand, current course) and a bottom
   tab bar with a "Me" sheet. From 800px up (iPads held upright) the top bar carries the tabs and
   the account menu, and the tab bar goes away. */
:root { --tabbar-h: 58px; --topbar-h: 53px; --safe-b: env(safe-area-inset-bottom, 0px); }
@media (min-width: 800px) { :root { --topbar-h: 60px; } }
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--header-bg); color: var(--header-ink); box-shadow: 0 1px 0 var(--line);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  max-width: 1360px; margin: 0 auto; display: flex; align-items: center; gap: .6rem;
  padding: .4rem max(.75rem, env(safe-area-inset-right)) .4rem max(.75rem, env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: .5rem; color: var(--header-ink); white-space: nowrap; margin-right: auto; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; display: block; flex: none; }
.brand-text b { display: block; font-size: .98rem; letter-spacing: .01em; }
.brand-text small, .brand-product { display: none; }
.nav { display: none; }
.usermenu { position: relative; display: none; }
.usermenu summary { list-style: none; cursor: pointer; display: block; border-radius: 50%; position: relative; }
/* a small chevron on the circle says "this opens a menu" */
.avatar-caret { position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); color: var(--header-ink-2); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, .12); }
.avatar-caret svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.usermenu[open] .avatar-caret { color: var(--maroon-ink); }
.usermenu[open] .avatar-caret svg { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .avatar-caret svg { transition: none; } }
.usermenu summary .avatar { width: 36px; height: 36px; font-size: .85rem; box-shadow: 0 0 0 1px var(--line); }
.usermenu summary:hover .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--line); }
.usermenu[open] summary .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--maroon); }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu .menu {
  position: absolute; right: 0; top: 44px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12); min-width: 260px; padding: .4rem; z-index: 40;
}
.menu-label { padding: .55rem .6rem .2rem; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sheet-menu .menu-label { padding-top: .9rem; border-bottom: 1px solid var(--line); }
.usermenu .menu a, .usermenu .menu form button, .sheet-menu a, .sheet-menu form button {
  display: block; width: 100%; text-align: left; padding: .45rem .6rem; border-radius: 6px; color: var(--ink);
  background: none; border: 0; font: inherit; cursor: pointer;
}
.usermenu .menu a:hover, .usermenu .menu form button:hover, .sheet-menu a:hover { background: var(--surface-2); text-decoration: none; }
.usermenu .menu a.who, .sheet-menu a.who { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem .7rem; border-bottom: 1px solid var(--line); margin-bottom: .1rem; border-radius: 8px 8px 0 0; }
.who b { display: block; font-size: .95rem; }
.who .tiny { color: var(--muted); }
.themepick { display: flex; align-items: center; gap: .25rem; padding: .45rem .6rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: .3rem 0; }
.themepick span { margin-right: auto; }
.themepick button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: .15rem .55rem; font: 600 .76rem var(--font); cursor: pointer; }
.themepick button.on { background: var(--brand-fill); border-color: var(--brand-fill); color: #fff; }
.linkbtn { background: none; border: 0; color: inherit; text-decoration: underline; font: inherit; font-weight: 650; cursor: pointer; padding: 0 .2rem; }

/* bottom tab bar (phones and small tablets) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding: 0 env(safe-area-inset-right) var(--safe-b) env(safe-area-inset-left);
  background: color-mix(in srgb, var(--surface) 94%, transparent); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
}
.tabbar a, .tabbar button {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font: 600 .68rem/1.1 var(--font); background: none; border: 0; cursor: pointer; padding: 0; position: relative;
}
.tabbar a:hover { text-decoration: none; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar .on svg { stroke-width: 2.2; }
.tabbar .on { color: var(--maroon-ink); }
.tabbar .on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--orange); }

/* "More" bottom sheet */
.sheet {
  width: 100%; max-width: 560px; max-height: 88dvh; margin: auto auto 0; padding: 0 0 calc(.8rem + var(--safe-b));
  border: 0; border-radius: 18px 18px 0 0; background: var(--surface); color: var(--ink); overflow: auto; overscroll-behavior: contain;
  box-shadow: 0 -8px 30px rgba(20, 40, 90, .18);
}
.sheet::backdrop { background: rgba(15, 25, 50, .35); }
.sheet[open] { animation: sheet-up .2s ease-out; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: none; } }
.sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: .5rem auto .2rem; }
.sheet-body { padding: .4rem 1rem 0; }
.sheet-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-bottom: .8rem; }
.sheet-tiles a {
  display: flex; flex-direction: column; gap: .2rem; padding: .7rem .8rem; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink); font-weight: 650; font-size: .92rem;
}
.sheet-tiles a span { font-size: 1.3rem; }
.sheet-tiles a.on { border-color: var(--maroon); box-shadow: inset 0 0 0 1px var(--maroon); }
.sheet-tiles a:hover { text-decoration: none; }
.sheet-menu a, .sheet-menu form button { padding: .7rem .6rem; border-bottom: 1px solid var(--line); border-radius: 0; }
.sheet-menu .themepick { border-top: 0; margin: 0; padding: .6rem; }
.sheet-menu .themepick button { padding: .35rem .8rem; font-size: .85rem; }
.sheet > form { padding: .6rem 1rem 0; }

.wrap {
  max-width: 1200px; margin: 0 auto;
  padding: 1rem max(1rem, env(safe-area-inset-right)) 4rem max(1rem, env(safe-area-inset-left));
}
.wrap.wide { max-width: 1440px; }
.banner { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--line); font-size: .88rem; }
.banner .wrap { padding: .45rem 1rem; }
.footer { color: var(--muted); font-size: .78rem; text-align: center; padding: 1.4rem 1rem 1.6rem; border-top: 1px solid var(--line); margin-top: 1rem; }
.footer-logo { height: 24px; display: block; margin: 0 auto .5rem; }
:root[data-theme="dark"] .footer-logo { filter: brightness(0) invert(.85); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .footer-logo { filter: brightness(0) invert(.85); } }
/* room for the tab bar under the page */
body:has(.tabbar) { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }
.pagehead h1 { font-size: 1.4rem; }

@media (min-width: 800px) {
  .topbar-inner { gap: .9rem; padding: .55rem 1.25rem; min-height: 64px; }
  .brand { margin-right: 0; gap: .6rem; }
  .brand-mark { width: 40px; height: 40px; border-radius: 10px; }
  .brand-product { display: inline; font-weight: 500; opacity: .85; }
  .nav { display: flex; gap: .15rem; flex: 1; justify-content: center; align-items: center; }
  .navtop { color: var(--header-ink-2); padding: .45rem .7rem; border-radius: 10px; font-size: .94rem; font-weight: 600; white-space: nowrap;
    gap: .4rem; display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; list-style: none; }
  .navtop::-webkit-details-marker { display: none; }
  .navtop .ri { width: 19px; height: 19px; stroke-width: 2; }
  .navtop .chev { width: 14px; height: 14px; margin-left: -.1rem; transition: transform .15s ease; }
  .navtop:hover { background: var(--header-hover); color: var(--header-ink); text-decoration: none; }
  .navtop.on { color: var(--header-on-ink); background: var(--header-on); }
  .navdd { position: relative; }
  .navdd[open] > .navtop { background: var(--header-hover); color: var(--header-ink); }
  .navdd[open] > .navtop .chev { transform: rotate(180deg); }
  /* a section's pages: title and a one-line note each */
  .navmenu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 45; min-width: 290px; padding: .35rem;
    background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .12); }
  .navdd:last-of-type .navmenu, .navdd[data-nav="teach"] .navmenu { left: auto; right: 0; }
  .navmenu a { display: flex; flex-direction: column; gap: .05rem; padding: .5rem .65rem; border-radius: 8px; color: var(--ink); }
  .navmenu a b { font-size: .92rem; font-weight: 650; }
  .navmenu a span { font-size: .78rem; color: var(--muted); }
  .navmenu a:hover { background: var(--surface-2); text-decoration: none; }
  .navmenu a.on { background: var(--header-on); }
  .navmenu a.on b { color: var(--header-on-ink); }
  .brand-text { display: none; }
  .usermenu { display: block; flex: none; }
  .usermenu .menu { top: calc(100% + 8px); }
  .tabbar, .sheet { display: none; }
  body:has(.tabbar) { padding-bottom: 0; }
  .wrap { padding: 1.3rem 1rem 4rem; }
  .footer { font-size: .82rem; padding: 2rem 1rem 3rem; margin-top: 2rem; }
  .footer-logo { height: 30px; margin-bottom: .6rem; }
  .pagehead h1 { font-size: 1.7rem; }
}
@media (min-width: 1100px) { .brand-text { display: block; } }
@media (min-width: 1240px) { .brand-text small { display: block; font-size: .72rem; color: var(--header-ink-2); margin-top: -1px; } }

/* touch screens: inputs at 16px so iOS doesn't zoom in on focus, and fingertip-sized targets */
@media (pointer: coarse) {
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], select, textarea { font-size: 16px; }
  .btn { min-height: 44px; }
  .btn.small { min-height: 38px; padding: .4rem .75rem; }
  .chip { min-height: 36px; padding: .4rem .8rem; }
  .linkbtn { padding: .4rem .3rem; }
}
a, button, summary, label { -webkit-tap-highlight-color: color-mix(in srgb, var(--maroon) 15%, transparent); }

/* ------------------------------------------------------------------ building blocks */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: .75rem; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.tiny { font-size: .76rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; font-weight: 700; color: var(--muted); }
.lead { font-size: 1.05rem; color: var(--ink-2); }
.pagehead { margin-bottom: 1.2rem; }
.pagehead h1 { margin-bottom: .2rem; }
.crumbs { font-size: .86rem; color: var(--muted); }
.crumbs a { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border-radius: 8px; padding: .5rem .95rem;
  font: 600 .92rem/1.2 var(--font); cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand-fill); border-color: var(--brand-fill); color: #fff; }
.btn.primary:hover { background: var(--brand-fill-hover); border-color: var(--brand-fill-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: .32rem .6rem; font-size: .82rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
/* a button never runs past its box: long labels wrap (always on phones; the Continue button everywhere) */
.btn { max-width: 100%; }
.btn > .ri { flex: none; }
@media (max-width: 640px) { .btn { white-space: normal; } }
.upnext-go .btn { white-space: normal; text-align: left; justify-content: flex-start; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--ink); font: inherit;
}
textarea { resize: vertical; min-height: 5rem; line-height: 1.45; }
label { font-weight: 600; font-size: .9rem; }
.field { margin: .8rem 0; }
.field label { display: block; margin-bottom: .3rem; }
.help { font-size: .82rem; color: var(--muted); margin-top: .25rem; }

.pill {
  display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .1rem .55rem; font-size: .75rem;
  font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap;
}
.pill.hand { color: var(--hand); border-color: color-mix(in srgb, var(--hand) 35%, transparent); }
.pill.concept { color: var(--concept); border-color: color-mix(in srgb, var(--concept) 35%, transparent); }
.pill.supervision { color: var(--supervision); border-color: color-mix(in srgb, var(--supervision) 35%, transparent); }
.pill.current { background: var(--brand-fill); color: #fff; border-color: var(--brand-fill); }
.pill.due { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.dot { width: .62rem; height: .62rem; border-radius: 50%; display: inline-block; flex: none; }
.lv0 { --lv: var(--lv0); } .lv1 { --lv: var(--lv1); } .lv2 { --lv: var(--lv2); } .lv3 { --lv: var(--lv3); } .lv4 { --lv: var(--lv4); }
.dot.lv0, .dot.lv1, .dot.lv2, .dot.lv3, .dot.lv4 { background: var(--lv); }

.bar { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--maroon); border-radius: 6px; }
.bar.read > span { background: var(--muted); }

.notice { border-radius: 8px; padding: .65rem .85rem; font-size: .92rem; }
.notice.info { background: var(--info-bg); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); transform: translateX(-50%); z-index: 100;
  box-shadow: var(--shadow); width: max-content; max-width: calc(100vw - 2rem);
}
@media (min-width: 800px) { .toast { bottom: 24px; } }

.empty { color: var(--muted); text-align: center; padding: 1.5rem; }
.list { list-style: none; padding: 0; margin: 0; }
.list > li { padding: .6rem 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }

/* ------------------------------------------------------------------ today */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }
/* icon tiles: a line icon on a soft tint of its hue (Home's next steps, numbers and card headings) */
.ico-tile { --hue: var(--hue-blue); width: 44px; height: 44px; border-radius: 12px; flex: none; display: inline-grid; place-items: center;
  color: var(--hue); background: color-mix(in srgb, var(--hue) 12%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hue) 14%, transparent); }
.ico-tile .ri { width: 24px; height: 24px; stroke-width: 1.9; }
.ico-tile .ai-ico { width: 18px; height: 18px; margin: 0; }
.ico-tile.sm { width: 36px; height: 36px; border-radius: 10px; }
.ico-tile.sm .ri { width: 20px; height: 20px; }
.ico-tile.xs { width: 28px; height: 28px; border-radius: 8px; }
.ico-tile.xs .ri { width: 17px; height: 17px; stroke-width: 2; }
.hue-blue { --hue: var(--hue-blue); } .hue-violet { --hue: var(--hue-violet); } .hue-teal { --hue: var(--hue-teal); }
.hue-amber { --hue: var(--hue-amber); } .hue-green { --hue: var(--hue-green); } .hue-rose { --hue: var(--hue-rose); }
.hue-slate { --hue: var(--hue-slate); }
.h-ico { display: flex; align-items: center; gap: .55rem; }
/* "Your next steps": icon, title and why, chevron; the whole row is the link */
.rec { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .85rem; align-items: center; padding: .8rem .5rem;
  margin: 0 -.5rem; border-top: 1px solid var(--line); color: inherit; border-radius: 12px; }
.rec:first-of-type { border-top: 0; }
.rec:hover { text-decoration: none; background: var(--surface-2); }
.rec:hover + .rec { border-top-color: transparent; }
.rec-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.rec-title { font-weight: 650; color: var(--ink); line-height: 1.3; }
.rec-why { font-size: .86rem; color: var(--muted); line-height: 1.45; }
.rec-go { width: 18px; height: 18px; color: var(--muted); transition: transform .15s ease; }
.rec:hover .rec-go { transform: translateX(2px); color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .rec-go { transition: none; } }
.stat { font-size: 1.6rem; font-weight: 750; line-height: 1.1; }
.statlabel { font-size: .8rem; color: var(--muted); }
.topicrow { display: grid; grid-template-columns: 2.2rem 1fr 7rem; gap: .7rem; align-items: center; padding: .45rem 0; }
.topicnum {
  width: 2.2rem; height: 2.2rem; border-radius: 8px; display: grid; place-items: center; font-weight: 750;
  background: var(--surface-2); color: var(--ink-2);
}
.topicnum.current { background: var(--brand-fill); color: #fff; }

/* ------------------------------------------------------------------ learn */
.topiccards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
.topiccard { display: flex; flex-direction: column; gap: .5rem; color: var(--ink); }
.topiccard:hover { text-decoration: none; border-color: var(--maroon); }
.topiccard h3 { margin: 0; }
.sectionlist { list-style: none; padding: 0; margin: 0; }
.sectionlist li { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.sectionlist li:first-child { border-top: 0; }
.readcheck { width: 1.2rem; height: 1.2rem; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: .7rem; }
.readcheck.on { background: var(--ok); border-color: var(--ok); color: #fff; }

/* lesson reader */
.reader { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.4rem; align-items: start; max-width: 1180px; margin: 0 auto; }
@media (max-width: 1050px) { .reader { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } }
.toc { position: sticky; top: 76px; font-size: .86rem; max-height: calc(100vh - 96px); overflow: auto; }
.toc .toc-topic { display: flex; gap: .55rem; align-items: center; font-weight: 700; color: var(--ink); padding: .2rem .4rem .6rem; }
.toc .toc-topic .topicnum { width: 1.9rem; height: 1.9rem; font-size: .9rem; flex: none; }
.toc a { display: block; color: var(--ink-2); padding: .3rem .55rem; border-radius: 7px; border-left: 3px solid transparent; }
.toc a.on { background: var(--surface); color: var(--ink); font-weight: 650; border-left-color: var(--maroon); box-shadow: var(--shadow); }
.toc a.sub { padding-left: 1.2rem; color: var(--muted); font-size: .82rem; }
.lesson { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 1.7rem 1.6rem; min-width: 0; box-shadow: var(--shadow); overflow: hidden; }
.lesson-hero { margin: 0 -1.7rem 0; padding: 1.2rem 1.7rem 1rem; background: linear-gradient(135deg, color-mix(in srgb, var(--maroon) 10%, var(--surface)) 0%, var(--surface) 70%); border-bottom: 1px solid var(--line); }
.lesson-hero h1 { margin: .3rem 0 .5rem; }
.progress-strip { display: flex; gap: 3px; margin-top: .8rem; }
.progress-strip span { flex: 1; height: 4px; border-radius: 3px; background: var(--surface-3); }
.progress-strip span.on { background: var(--maroon); }
.lesson .md h2 { padding-top: .6rem; border-top: 1px solid var(--line); margin-top: 1.6rem; }
.lesson .md h3 { color: var(--maroon-ink); }
.lesson .md .math.display { background: var(--surface-2); border-radius: 10px; padding: .5rem .8rem; }
/* phones: the lesson runs edge to edge instead of a card inside the page margin */
@media (max-width: 640px) {
  .lesson { padding: 0 1rem 1rem; margin: -1rem -1rem 0; border-width: 0 0 1px; border-radius: 0; box-shadow: none; }
  .lesson-hero { margin: 0 -1rem; padding: 1rem; }
  .lesson .viz, .lesson .keyideas, .lesson .diagram, .lesson .cell { margin-left: -.5rem; margin-right: -.5rem; }
}
.lesson h1 { font-size: 1.55rem; }
.lesson .md { overflow-x: auto; }
.lesson .md table { margin: .8rem 0; font-size: .9rem; }
.lesson .md th, .lesson .md td { border: 1px solid var(--line); padding: .35rem .6rem; }
.lesson .md img { display: block; margin: .6rem auto; }
.math.display { display: block; overflow-x: auto; overflow-y: hidden; margin: .6rem 0; }
.callout { border-radius: 10px; padding: .8rem 1rem; margin: 1rem 0; border: 1px solid var(--line); border-left-width: 4px; }
.callout.note2026 { border-left-color: var(--warn); background: var(--warn-bg); }
.callout.agent { border-left-color: var(--supervision); background: color-mix(in srgb, var(--supervision) 7%, var(--surface)); }
.callout.flaw { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 6%, var(--surface)); }
.callout.agentfree { border-left-color: var(--ok); background: var(--ok-bg); }
.callout.practice { border-left-color: var(--concept); background: var(--info-bg); }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.pagefoot { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }

/* code cells */
.cell { margin: .9rem 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--code-bg); }
.cell-bar { display: flex; align-items: center; gap: .4rem; padding: .3rem .45rem; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: .78rem; color: var(--muted); }
.cell-bar .grow { flex: 1; }
.cell .CodeMirror { height: auto; font-family: var(--mono); font-size: .85rem; background: var(--code-bg); color: var(--ink); }
.cell .CodeMirror-scroll { max-height: 520px; }
.cell .CodeMirror-gutters { background: var(--code-bg); border-right: 1px solid var(--line); }
.cell pre.static { margin: 0; padding: .7rem .9rem; }
.cell-out { border-top: 1px dashed var(--line); padding: .5rem .8rem; background: var(--surface); }
.cell-out pre { margin: 0; white-space: pre-wrap; font-size: .82rem; }
.cell-out img { display: block; max-width: 100%; margin: .3rem auto; background: #fff; border-radius: 4px; }
.cell-out .err { color: var(--bad); }
.cell-out .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cell.practice { border-color: color-mix(in srgb, var(--concept) 45%, var(--line)); }
.predict { padding: .55rem .8rem; border-top: 1px solid var(--line); background: var(--info-bg); font-size: .88rem; }
.predict textarea { min-height: 2.6rem; margin-top: .3rem; }

/* CodeMirror in dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cm-s-default .cm-keyword { color: #f08aa7; }
  :root:not([data-theme="light"]) .cm-s-default .cm-def { color: #8fc7ff; }
  :root:not([data-theme="light"]) .cm-s-default .cm-variable-2 { color: #a5d6ff; }
  :root:not([data-theme="light"]) .cm-s-default .cm-string { color: #a6e3a1; }
  :root:not([data-theme="light"]) .cm-s-default .cm-number { color: #fab387; }
  :root:not([data-theme="light"]) .cm-s-default .cm-comment { color: #8a847b; }
  :root:not([data-theme="light"]) .cm-s-default .cm-builtin { color: #cba6f7; }
  :root:not([data-theme="light"]) .cm-s-default .cm-operator { color: #e2ddd5; }
  :root:not([data-theme="light"]) .cm-s-default .cm-variable { color: var(--ink); }
  :root:not([data-theme="light"]) .cm-s-default .cm-property { color: #94e2d5; }
  :root:not([data-theme="light"]) .CodeMirror-cursor { border-left-color: var(--ink) !important; }
  :root:not([data-theme="light"]) .CodeMirror-selected { background: #3a3733 !important; }
}
:root[data-theme="dark"] .cm-s-default .cm-keyword { color: #f08aa7; }
:root[data-theme="dark"] .cm-s-default .cm-def { color: #8fc7ff; }
:root[data-theme="dark"] .cm-s-default .cm-variable-2 { color: #a5d6ff; }
:root[data-theme="dark"] .cm-s-default .cm-string { color: #a6e3a1; }
:root[data-theme="dark"] .cm-s-default .cm-number { color: #fab387; }
:root[data-theme="dark"] .cm-s-default .cm-comment { color: #8a847b; }
:root[data-theme="dark"] .cm-s-default .cm-builtin { color: #cba6f7; }
:root[data-theme="dark"] .cm-s-default .cm-operator { color: #e2ddd5; }
:root[data-theme="dark"] .cm-s-default .cm-variable { color: var(--ink); }
:root[data-theme="dark"] .cm-s-default .cm-property { color: #94e2d5; }
:root[data-theme="dark"] .CodeMirror-cursor { border-left-color: var(--ink) !important; }
:root[data-theme="dark"] .CodeMirror-selected { background: #3a3733 !important; }

/* ------------------------------------------------------------------ tutor (global drawer) */
.tutor-log { flex: 1; overflow-y: auto; padding: .8rem .9rem; display: flex; flex-direction: column; gap: .7rem; min-height: 0; }
.msg { max-width: 100%; font-size: .93rem; }
.msg.user { align-self: flex-end; background: color-mix(in srgb, var(--maroon) 9%, var(--surface)); border-radius: 14px 14px 3px 14px; padding: .5rem .75rem; max-width: 88%; white-space: pre-wrap; }
.msg.assistant { align-self: stretch; }
.msg.assistant .body > :first-child { margin-top: 0; }
.msg.assistant .body > :last-child { margin-bottom: 0; }
.msg.assistant pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 7px; padding: .55rem .7rem; }
.msg.assistant table { font-size: .86rem; margin: .5rem 0; }
.msg.assistant th, .msg.assistant td { border: 1px solid var(--line); padding: .25rem .5rem; }
.msg .tools { display: flex; gap: .2rem; margin-top: .25rem; opacity: .75; }
.msg .tools button { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: .8rem; padding: .1rem .3rem; border-radius: 5px; }
.msg .tools button.on, .msg .tools button:hover { color: var(--ink); background: var(--surface-2); }
.msg.error { color: var(--bad); font-size: .88rem; }
.typing { display: inline-flex; gap: 3px; padding: .3rem 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.tutor-quick { display: flex; gap: .35rem; flex-wrap: wrap; padding: .5rem .9rem 0; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: .25rem .65rem; font-size: .8rem; cursor: pointer; font-weight: 500; }
.chip:hover { border-color: var(--maroon); color: var(--maroon-ink); text-decoration: none; }
.tutor-input { padding: .6rem .9rem .5rem; }
.tutor-input form { display: flex; gap: .4rem; align-items: flex-end; }
.tutor-input textarea { min-height: 2.6rem; max-height: 10rem; font-size: .93rem; }
.tutor-input .btn { min-width: 44px; }
.tutor-note { font-size: .72rem; color: var(--muted); padding: 0 .9rem .6rem; }
.tutor-blocked { padding: .8rem 1rem; color: var(--warn); background: var(--warn-bg); border-radius: 8px; margin: .2rem 0; font-size: .9rem; }

/* the tutor button: floating at the bottom right of every page that allows AI. AI gets its own light
   gradient (blue, violet, teal) so it reads as AI at a glance; the tutor opens full screen on phones */
:root { --ai-1: #4f7dff; --ai-2: #9b5cff; --ai-3: #14b8a6; --ai-ink: #3b38c9; }
:root[data-theme="dark"] { --ai-ink: #c9c6ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ai-ink: #c9c6ff; } }
.tutor-launch {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; flex: none; height: 38px; min-width: 38px; padding: 0 .8rem 0 .7rem;
  border: 1.5px solid transparent; border-radius: 999px; color: var(--ai-ink); font: 650 .88rem var(--font); cursor: pointer;
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--ai-1) 9%, var(--surface)), color-mix(in srgb, var(--ai-2) 9%, var(--surface)) 55%, color-mix(in srgb, var(--ai-3) 9%, var(--surface))) padding-box,
    linear-gradient(115deg, color-mix(in srgb, var(--ai-1) 55%, transparent), color-mix(in srgb, var(--ai-2) 55%, transparent), color-mix(in srgb, var(--ai-3) 55%, transparent)) border-box;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--ai-2) 14%, transparent);
  transition: box-shadow .2s ease, transform .2s ease;
}
.tutor-launch:hover { box-shadow: 0 3px 16px color-mix(in srgb, var(--ai-2) 26%, transparent); transform: translateY(-1px); }
.tutor-launch[aria-expanded="true"] {
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--ai-1) 18%, var(--surface)), color-mix(in srgb, var(--ai-2) 18%, var(--surface)) 55%, color-mix(in srgb, var(--ai-3) 18%, var(--surface))) padding-box,
    linear-gradient(115deg, var(--ai-1), var(--ai-2), var(--ai-3)) border-box;
}
.tutor-launch .tl-icon { width: 18px; height: 18px; flex: none; fill: url(#ai-grad); }
@media (prefers-reduced-motion: reduce) { .tutor-launch { transition: none; } .tutor-launch:hover { transform: none; } }
.tutor-fab { position: fixed; z-index: 40; right: max(16px, env(safe-area-inset-right)); bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
  height: 48px; padding: 0 1.1rem 0 .95rem; font-size: .92rem;
  box-shadow: 0 6px 22px color-mix(in srgb, var(--ai-2) 24%, transparent), 0 2px 6px rgba(20, 30, 60, .10); }
.tutor-fab .tl-icon { width: 20px; height: 20px; }
.tutor-fab:hover { box-shadow: 0 8px 28px color-mix(in srgb, var(--ai-2) 32%, transparent), 0 2px 6px rgba(20, 30, 60, .12); }
body.tutor-open .tutor-fab { display: none; }        /* the open tutor has its own close button */
.tutor-fab .tl-long { display: none; }
@media (max-width: 799px) { .tutor-fab { height: 46px; padding: 0 1rem 0 .85rem; } }
@media (min-width: 800px) { .tutor-fab .tl-long { display: inline; } .tutor-fab .tl-short { display: none; } }
@media (min-width: 800px) { .tutor-fab { bottom: max(22px, env(safe-area-inset-bottom)); right: 24px; } }
@media print { .tutor-fab { display: none; } }
/* the same treatment, smaller, for buttons that hand something to the tutor */
.btn.ai-btn { display: inline-flex; align-items: center; gap: .35rem; color: var(--ai-ink); border: 1px solid transparent;
  background: linear-gradient(115deg, color-mix(in srgb, var(--ai-1) 8%, var(--surface)), color-mix(in srgb, var(--ai-2) 8%, var(--surface)), color-mix(in srgb, var(--ai-3) 8%, var(--surface))) padding-box,
              linear-gradient(115deg, color-mix(in srgb, var(--ai-1) 45%, transparent), color-mix(in srgb, var(--ai-2) 45%, transparent), color-mix(in srgb, var(--ai-3) 45%, transparent)) border-box; }
.btn.ai-btn .ai-ico { width: 14px; height: 14px; fill: url(#ai-grad); }
.tutor-drawer {
  position: fixed; inset: 0; height: 100dvh; z-index: 60; background: var(--surface);
  display: flex; flex-direction: column; overscroll-behavior: contain;
}
.tutor-drawer[hidden] { display: none; }
.td-head { display: flex; align-items: center; gap: .3rem; padding: calc(.6rem + env(safe-area-inset-top, 0px)) .8rem .6rem; background: linear-gradient(120deg, var(--hero-from), var(--hero-to)); color: var(--hero-ink); border-bottom: 3px solid var(--orange); }
.td-title { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.td-title .tiny { color: var(--hero-ink-2); }
.td-icon { background: var(--glass); border: 1px solid var(--line); color: var(--hero-ink); width: 40px; height: 40px; border-radius: 8px; cursor: pointer; font-size: .95rem; }
.td-icon:hover { background: var(--surface); }
.td-scope { display: flex; gap: .4rem; padding: .6rem .8rem; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.td-scope button {
  flex: 1; min-width: 0; text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px; padding: .35rem .6rem;
  cursor: pointer; color: var(--ink); font: inherit; display: flex; flex-direction: column; line-height: 1.25;
}
.td-scope button .tiny { color: var(--muted); }
.td-scope button b { font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-scope button[aria-selected="true"] { border-color: var(--maroon); box-shadow: inset 0 0 0 1px var(--maroon); }
.td-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.td-history { flex: 1; overflow-y: auto; padding: .4rem 0; }
.td-history a { display: block; padding: .55rem .9rem; border-bottom: 1px solid var(--line); color: var(--ink); font-size: .88rem; }
.td-history a:hover { background: var(--surface-2); text-decoration: none; }
@media (max-width: 640px) { body.tutor-open { overflow: hidden; } }
@media (min-width: 641px) {
  .tutor-drawer { inset: 0 0 0 auto; height: auto; width: min(var(--tutor-w), 100vw); border-left: 1px solid var(--line); box-shadow: -8px 0 28px rgba(20, 40, 90, .12); }
  .td-icon { width: 34px; height: 34px; }
}
@media (min-width: 1280px) {
  body.tutor-open { padding-right: var(--tutor-w); }
  body.tutor-open .topbar-inner, body.tutor-open .wrap { max-width: 100%; }
  /* the page is 440px narrower while the tutor is open: the bar goes back to one compact row */
  body.tutor-open .nav-sep { display: none; }
}

.tutorpage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.tutor-top { margin-bottom: .6rem; }
.tutor-side .tutor-new { display: none; }
@media (min-width: 800px) {
  .tutorpage { grid-template-columns: 300px minmax(0, 1fr); }
  .tutor-side { grid-column: 1; grid-row: 1; }
  .tutor-side .tutor-new { display: flex; }
  .tutor-top { display: none; }
}
.convlist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 160px); }
.convlist a { display: block; padding: .55rem .8rem; border-top: 1px solid var(--line); color: var(--ink); font-size: .88rem; }
.convlist a:first-child { border-top: 0; }
.convlist a.on { background: var(--surface-2); font-weight: 650; }
.convlist a:hover { text-decoration: none; background: var(--surface-2); }
.chatpanel { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 0; }
.chatpanel.tall { height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - var(--safe-b) - 5.2rem); min-height: 380px; }
@media (min-width: 800px) { .chatpanel.tall { height: calc(100vh - 170px); min-height: 480px; } }
.chatpanel .tutor-head { padding: .7rem .9rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .5rem; }
.chatpanel .tutor-head .title { font-weight: 700; flex: 1; }

/* ------------------------------------------------------------------ practice */
.session { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.2rem; align-items: start; }
.session-one { max-width: 860px; }
@media (max-width: 960px) { .session { grid-template-columns: minmax(0, 1fr); } }
.progressdots { display: flex; gap: .3rem; }
.progressdots span { width: 26px; height: 6px; border-radius: 4px; background: var(--line); }
.progressdots span.cur { background: var(--maroon); }
.progressdots span.ok { background: var(--ok); }
.progressdots span.bad { background: var(--bad); }
.progressdots span.part { background: var(--lv2); }
.problem .prompt { font-size: 1.02rem; }
.problem pre.code { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; }
.answer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(130px, 220px) 1.5rem; gap: .5rem .8rem; align-items: center; padding: .45rem 0; border-top: 1px solid var(--line); }
.answer:first-of-type { border-top: 0; }
.answer.choice, .answer.text, .answer.code { grid-template-columns: 1fr; }
.answer .mark { font-weight: 800; font-size: 1.05rem; }
.answer .mark.ok { color: var(--ok); }
.answer .mark.bad { color: var(--bad); }
.answer input.ok { border-color: var(--ok); background: var(--ok-bg); }
.answer input.bad { border-color: var(--bad); background: var(--bad-bg); }
.options { display: grid; gap: .4rem; }
.option { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; cursor: pointer; font-weight: 400; background: var(--surface); }
.option:hover { border-color: var(--ink-2); }
.option input { margin-top: .3rem; }
.option.ok { border-color: var(--ok); background: var(--ok-bg); }
.option.bad { border-color: var(--bad); background: var(--bad-bg); }
.confidence { display: flex; gap: .4rem; flex-wrap: wrap; }
.confidence label { font-weight: 500; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem; cursor: pointer; font-size: .85rem; background: var(--surface); }
.confidence input { display: none; }
.confidence input:checked + span { color: var(--maroon); font-weight: 700; }
.confidence label:has(input:checked) { border-color: var(--maroon); }
.hintbox { border-left: 3px solid var(--concept); background: var(--info-bg); padding: .55rem .8rem; border-radius: 0 8px 8px 0; margin: .5rem 0; font-size: .93rem; }
.solution { border-top: 2px solid var(--line); margin-top: 1rem; padding-top: .8rem; }
.result-banner { border-radius: 8px; padding: .6rem .85rem; font-weight: 650; margin: .8rem 0; }
.result-banner.ok { background: var(--ok-bg); color: var(--ok); }
.result-banner.bad { background: var(--bad-bg); color: var(--bad); }
.result-banner.part { background: var(--warn-bg); color: var(--warn); }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; }
.quizbar { position: sticky; top: var(--topbar-h); background: var(--bg); z-index: 5; padding: .5rem 0; flex-wrap: nowrap; }
@media (max-width: 640px) {
  .quizbar { margin: 0 -1rem; padding: .4rem 1rem; border-bottom: 1px solid var(--line); }
  .quizbar h1 { font-size: 1.1rem; }
  .quizbar-note { display: none; }
}
.timer.low { color: var(--bad); }
.skilllist .skill {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "info info" "level actions";
  gap: .4rem .8rem; align-items: center; padding: .75rem 0; border-top: 1px solid var(--line);
}
.skilllist .skill:first-child { border-top: 0; }
.skill-info { grid-area: info; display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.skill-level { grid-area: level; }
.skill-actions { grid-area: actions; display: flex; gap: .3rem; justify-content: flex-end; }
@media (min-width: 641px) {
  .skilllist .skill { grid-template-columns: minmax(0, 1fr) 130px auto; grid-template-areas: "info level actions"; gap: .8rem; padding: .6rem 0; }
}

/* collapsible card sections (practice topics, textbook chapters) */
.fold { padding: 0; }
.fold > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; min-height: 56px;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after {
  content: ""; flex: none; margin-left: auto; width: .55rem; height: .55rem; border: solid var(--muted); border-width: 0 2px 2px 0;
  transform: rotate(45deg); transition: transform .15s; margin-right: .2rem;
}
.fold[open] > summary::after { transform: rotate(-135deg); }
.fold > summary .topicnum { flex: none; }
.fold-title { display: flex; flex-direction: column; gap: .25rem; min-width: 0; line-height: 1.3; }
.fold-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-size: .82rem; color: var(--muted); }
.fold-body { padding: 0 1rem 1rem; }
.fold[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: .8rem; }
.fold-note > summary { cursor: pointer; }
.fold-note[open] > summary { margin-bottom: .3rem; }
@media (min-width: 641px) { .fold > summary { padding: .9rem 1.2rem; } .fold-body { padding: 0 1.2rem 1.1rem; } }
.pagehead.row.between { align-items: flex-end; }
@media (max-width: 640px) {
  .pagehead-actions { width: 100%; }
  .pagehead-actions .btn { flex: 1; }
}

/* ------------------------------------------------------------------ lab */
.lab { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
@media (max-width: 1000px) { .lab { grid-template-columns: minmax(0, 1fr); } }
.claims { border-left: 3px solid var(--supervision); padding-left: .9rem; }
.score { font-size: 2rem; font-weight: 800; }

/* ------------------------------------------------------------------ instructor */
.heat { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.heat table { font-size: .78rem; }
.heat th, .heat td { padding: 0; border-bottom: 1px solid var(--line); }
.heat thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; height: 150px; vertical-align: bottom; }
.heat thead th div { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; padding: .4rem .1rem; font-weight: 500; color: var(--ink-2); }
.heat tbody th { position: sticky; left: 0; background: var(--surface); text-align: left; padding: .25rem .6rem; white-space: nowrap; font-weight: 500; z-index: 1; }
.heat td.c { width: 18px; min-width: 18px; height: 22px; }
.heat .tsep { border-left: 2px solid var(--ink-2); }
.legend { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); align-items: center; }
.datatable { width: 100%; font-size: .88rem; }
.datatable th { text-align: left; font-weight: 650; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: .4rem .4rem; border-bottom: 1px solid var(--line); }
.datatable td { padding: .45rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
/* phones: a wide table scrolls inside its card instead of widening the page */
@media (max-width: 640px) { table.datatable { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; } }
.hbar { display: inline-block; height: 8px; border-radius: 4px; background: var(--maroon); vertical-align: middle; }

/* auth */
.authbox { max-width: 440px; margin: 6vh auto; }
.authbox .card { padding: 1.6rem; }
.divider { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .8rem; margin: 1rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.gbtn { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
.gbtn:hover { background: #f8f9fa; }


/* ------------------------------------------------------------------ visuals in lessons */
.viz, .keyideas, .diagram {
  margin: 1.3rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  overflow: hidden; box-shadow: var(--shadow);
}
.viz > figcaption, .diagram > figcaption {
  display: flex; align-items: baseline; gap: .6rem; padding: .65rem 1rem; border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, color-mix(in srgb, var(--maroon) 7%, var(--surface)), var(--surface));
}
.viz > figcaption .kind, .diagram > figcaption .kind {
  font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--maroon-ink); white-space: nowrap;
}
.viz > figcaption .t, .diagram > figcaption .t { font-weight: 700; }
.viz-body { padding: .7rem 1rem 1rem; }
.viz-cap { padding: 0 1rem .9rem; font-size: .86rem; color: var(--ink-2); }
.viz-plot { position: relative; width: 100%; }
.viz-svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font); }
.viz-svg .grid line { stroke: var(--viz-grid); stroke-width: 1; }
.viz-svg .axes .axis { stroke: var(--viz-axis); stroke-width: 1; }
.viz-svg .axes .zero { stroke: var(--viz-axis); stroke-width: 1; }
.viz-svg .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-svg .axlabel { fill: var(--ink-2); font-size: 12px; font-weight: 600; }
.viz-svg .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-svg .seg { stroke-width: 1.5; }
.viz-svg .wash { stroke: none; opacity: .14; }
.viz-svg .box { stroke-width: 1.5; fill-opacity: .12; }
.viz-svg .dot { stroke: var(--viz-surface); stroke-width: 2; }
.viz-svg .lbl { fill: var(--ink-2); font-size: 12px; paint-order: stroke; stroke: var(--viz-surface); stroke-width: 3px; stroke-linejoin: round; }
.viz-svg .lbl.strong { font-weight: 700; fill: var(--ink); }
.viz-svg .cross { stroke: var(--viz-axis); stroke-width: 1; }
.viz-svg .hit { fill: transparent; }
.viz-svg .s1 { stroke: var(--viz-s1); fill: var(--viz-s1); }
.viz-svg .s2 { stroke: var(--viz-s2); fill: var(--viz-s2); }
.viz-svg .s3 { stroke: var(--viz-s3); fill: var(--viz-s3); }
.viz-svg .ref { stroke: var(--viz-ref); fill: var(--viz-ref); }
.viz-svg .muted { stroke: var(--viz-muted); fill: var(--viz-muted); }
.viz-svg .hl { stroke: var(--viz-s2); fill: none; stroke-width: 2.5; }
.viz-svg .ln.ref, .viz-svg .ln.muted, .viz-svg .seg.s1, .viz-svg .seg.s2, .viz-svg .seg.s3, .viz-svg .seg.ref, .viz-svg .seg.muted { fill: none; }
.viz-svg .box.muted { fill: var(--viz-muted); }
.viz-svg .arrowhead { stroke: none; }
.viz-tip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: .35rem .55rem; font-size: .78rem; line-height: 1.35; box-shadow: var(--shadow); white-space: nowrap;
}
.viz-tip .muted { color: var(--muted); }
.key { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.key.s1 { background: var(--viz-s1); } .key.s2 { background: var(--viz-s2); } .key.s3 { background: var(--viz-s3); }
.key.ref { background: var(--viz-ref); } .key.muted { background: var(--viz-muted); }
.viz-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--ink-2); margin: .2rem 0 .4rem; }
.viz-controls { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; align-items: center; margin: .3rem 0 .6rem; }
.viz-ctl { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; font-size: .84rem; }
.viz-ctl-label { color: var(--ink-2); font-weight: 600; }
.viz-ctl input[type=range] { width: 150px; accent-color: var(--maroon); }
.viz-ctl output { font-variant-numeric: tabular-nums; min-width: 3.2em; font-weight: 700; color: var(--ink); }
.viz-ctl select { width: auto; padding: .25rem .5rem; font-size: .84rem; }
.viz-toggle input { accent-color: var(--maroon); }
.viz-readout { font-size: .84rem; color: var(--ink-2); }
.viz-readout .v { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.viz-note { font-size: .86rem; color: var(--ink-2); margin: .4rem 0; }
.viz-table { overflow-x: auto; margin-top: .5rem; }
.viz-table table { font-size: .8rem; font-variant-numeric: tabular-nums; }
.viz-table th, .viz-table td { padding: .25rem .6rem; border-bottom: 1px solid var(--line); text-align: right; }
.viz-table th { color: var(--muted); font-weight: 600; }
@media (max-width: 640px) { .viz-ctl input[type=range] { width: 110px; } .viz-body { padding: .6rem .6rem .8rem; } }

/* key ideas card */
.keyideas { border-top: 4px solid var(--maroon); }
.keyideas-head { display: flex; align-items: center; gap: .5rem; padding: .7rem 1rem .2rem; }
.keyideas-head .kind { white-space: nowrap; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--maroon-ink); }
.keyideas-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: .2rem 1.4rem; padding: .3rem 1rem 1rem; }
@media (max-width: 760px) { .keyideas-body { grid-template-columns: 1fr; } }
.keyideas .formula { grid-column: 1 / -1; background: var(--surface-2); border-radius: 10px; padding: .4rem .8rem; margin: .3rem 0 .4rem; overflow-x: auto; }
.keyideas ul { margin: .2rem 0; padding-left: 1.1rem; }
.keyideas li { margin: .25rem 0; }
.keyideas h4 { margin: .5rem 0 .2rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.keyideas .fails h4 { color: var(--bad); }
.keyideas .check h4 { color: var(--ok); }
.keyideas .check { border-left: 3px solid var(--ok); padding-left: .7rem; }
.diagram .mermaid { display: flex; justify-content: center; padding: .8rem; overflow-x: auto; }
.diagram svg.static { display: block; max-width: 100%; height: auto; margin: 0 auto; }

/* collapsible code */
.cell.collapsed .CodeMirror, .cell.collapsed pre.static { display: none; }
.cell .codefold { display: none; width: 100%; text-align: left; background: var(--surface-2); border: 0; border-bottom: 1px solid var(--line); padding: .4rem .8rem; font: 600 .8rem var(--font); color: var(--ink-2); cursor: pointer; }
.cell.collapsed .codefold, .cell.long .codefold { display: block; }
.cell.long:not(.expanded) .CodeMirror { max-height: 300px; overflow: hidden; }
.cell.figure .cell-out { border-top: 0; text-align: center; }
.viz-svg .ln, .viz-svg .seg { fill: none !important; }
.viz-readout .viz-ctl-label { margin-right: .4rem; }

/* ------------------------------------------------------------------ student dashboard */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .8rem; margin: 1.1rem 0; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; box-shadow: var(--shadow); color: var(--ink); border-top: 3px solid var(--maroon); }
.kpi.link:hover { text-decoration: none; border-color: var(--maroon); }
.kpi-v { font-size: 1.7rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-v small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.kpi-l { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1rem; margin-top: 1rem; align-items: start; }
.dash-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .dash-grid, .dash-grid.three { grid-template-columns: 1fr; } }
.dash-grid h2, .dash-grid h3 { margin: 0 0 .3rem; }
.chart { width: 100%; }
.chart .gridline { stroke: var(--viz-grid); stroke-width: 1; }
.chart .bar { stroke: none; }
.chart .bar.s1 { fill: var(--viz-s1); } .chart .bar.s2 { fill: var(--viz-s2); } .chart .bar.s3 { fill: var(--viz-s3); }
.chart .hitrow, .chart .hit { fill: transparent; }
.chart .hitrow:hover { fill: color-mix(in srgb, var(--maroon) 5%, transparent); }
.tableview summary { cursor: pointer; font-size: .8rem; color: var(--muted); margin-top: .4rem; }
/* Home: a main column and a side rail from 1080px; below that one column, ordered by .o-* */
.home-notice { margin: 0 0 1rem; }
.home { display: flex; flex-direction: column; gap: 1rem; }
.home-main, .home-side { display: contents; }
.home .card { margin: 0; }
.home h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.home h3 { margin: 0 0 .4rem; }
.o-upnext { order: 1; } .o-due { order: 2; } .o-week { order: 3; } .o-steps { order: 4; } .o-plan { order: 5; }
.o-progress { order: 6; } .o-skills { order: 7; } .o-habits { order: 8; } .o-more { order: 9; } .o-follow { order: 10; }
.o-week:empty { display: none; }
@media (min-width: 1080px) {
  /* both columns run to the same bottom edge: the shorter one shares the difference among its panels */
  .home { display: grid; grid-template-columns: minmax(0, 1fr) var(--side-w, 360px); align-items: stretch; }
  .home-side { position: relative; }
  .home-side > .resize-handle { display: block; left: calc(-.5rem - 6px); }
  .home-main, .home-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
  .home-main > *, .home-side > * { flex: 1 0 auto; }
  .home-side > .o-week, .home-side > .o-plan { display: flex; flex-direction: column; }
  .home-side > .o-week > .card, .home-side > .o-plan > .card { flex: 1 0 auto; }
  .home-side .weekcard { grid-template-columns: minmax(0, 1fr); }
}
.home-pair { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .home-pair { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.card-sub { margin: -.2rem 0 .5rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }
.week-go { margin: .3rem 0 .6rem; }
.slips > li { display: flex; align-items: baseline; gap: .5rem; }
.slips .pill { flex: none; }
.slips .slip-t { flex: 1; min-width: 0; }
.slips .slip-go { flex: none; font-weight: 650; font-size: .8rem; }
@media (min-width: 760px) { .home-pair.o-follow { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } }
.ink { color: var(--ink); }
.sub-h { font-size: .95rem; margin: 1.1rem 0 .3rem !important; }

/* the topic this week and the one thing to do next */
.upnext { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; padding: 1.3rem 1.4rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--maroon) 6%, var(--surface)), var(--surface)); }
.upnext-art { display: none; }
@media (min-width: 640px) {
  .upnext { grid-template-columns: 148px minmax(0, 1fr); gap: 1.4rem; align-items: center; }
  .upnext-art { display: grid; place-items: center; height: 148px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
  .upnext-art .topic-icon { width: 120px; height: auto; }
}
.upnext h2 { font-size: 1.55rem; margin: .2rem 0 .8rem; letter-spacing: -.01em; }
.upnext h2 a { color: var(--ink); }
.upnext-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .6rem 1.4rem; max-width: 520px; }
.meter-head { display: flex; justify-content: space-between; gap: .5rem; font-size: .82rem; color: var(--muted); margin-bottom: .3rem; }
.meter-head b { color: var(--ink); font-weight: 650; }
.meter-track { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter-track span { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--maroon); }
.upnext-go { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.upnext-go .btn.primary { display: inline-flex; align-items: center; gap: .3rem; padding: .6rem 1rem; font-weight: 650; }
.upnext-go .btn .ri { width: 17px; height: 17px; stroke-width: 2.2; }
.upnext-why { margin: .6rem 0 0; }
@media (max-width: 639px) {
  .upnext { padding: 1.1rem 1.1rem 1rem; }
  .upnext h2 { font-size: 1.35rem; }
  .upnext-go .btn.primary { flex: 1; justify-content: center; }
  .upnext-go .btn.ghost { display: none; }   /* the Learn tab is right below */
}

/* side rail: the course calendar (calendar.js) and the next few deadlines */
.calcard h2 { margin: 0; }
.cal { margin-top: .6rem; }
.cal-head { display: flex; align-items: center; gap: .3rem; margin-bottom: .4rem; }
.cal-month { flex: 1; font-size: .95rem; }
.cal-nav, .cal-today { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 8px; cursor: pointer; }
.cal-nav { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; order: 2; }
.cal-nav:first-child .ri { transform: rotate(180deg); }
.cal-nav:hover:not(:disabled), .cal-today:hover { background: var(--surface-2); }
.cal-nav:disabled { opacity: .35; cursor: default; }
.cal-nav .ri { width: 16px; height: 16px; stroke-width: 2.2; }
.cal-month { order: 0; }
.cal-today { order: 1; height: 32px; padding: 0 .6rem; font: 600 .78rem var(--font); }
.cal-nav.next { order: 3; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-wd { text-align: center; font-size: .7rem; font-weight: 700; color: var(--muted); padding: .2rem 0 .3rem; }
.cd { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; height: 44px;
  padding: 4px 0 0; border: 0; border-radius: 9px; background: none; color: var(--ink); font: 600 .85rem var(--font); cursor: pointer; }
.cd.blank { cursor: default; }
.cd:hover { background: var(--surface-2); }
.cd.past { color: var(--muted); font-weight: 500; }
.cd.cur { background: color-mix(in srgb, var(--maroon) 8%, var(--surface)); }
.cd.off .cd-n { text-decoration: line-through; text-decoration-color: var(--viz-axis); color: var(--muted); }
.cd.outside { opacity: .45; }
.cd-n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; line-height: 1; }
.cd.today .cd-n { background: var(--brand-fill); color: #fff; font-weight: 750; }
.cd.sel { box-shadow: inset 0 0 0 2px var(--maroon); }
.cd:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.cd-dots { display: flex; gap: 3px; height: 6px; }
.cd-dots i, .cal-legend i { display: block; width: 6px; height: 6px; border-radius: 50%; }
.dot-exam { background: var(--hue-amber); } .dot-hw { background: var(--hue-blue); } .dot-topic { background: var(--hue-violet); }
.dot-review { background: var(--hue-teal); } .dot-plan { box-shadow: inset 0 0 0 1.5px var(--hue-slate); }
.cal-legend { display: flex; flex-wrap: wrap; gap: .25rem .75rem; margin: .5rem 0 0; font-size: .72rem; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.cal-day { margin-top: .7rem; padding: .7rem .75rem; border-radius: 12px; background: var(--surface-2); }
.cal-day:empty { display: none; }
.cal-day-h { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .35rem; font-size: .92rem; }
.cdl { display: flex; gap: .55rem; align-items: flex-start; padding: .35rem 0; color: var(--ink); font-size: .88rem; line-height: 1.35; }
.cdl + .cdl { border-top: 1px solid var(--line); }
a.cdl:hover { text-decoration: none; }
a.cdl:hover b { text-decoration: underline; }
.cdl > span { display: flex; flex-direction: column; min-width: 0; }
.cdl .ri { width: 17px; height: 17px; margin-top: 1px; color: var(--maroon-ink); flex: none; }
.cdl.k-exam .ri { color: var(--hue-amber); } .cdl.k-review .ri { color: var(--hue-teal); } .cdl.k-break .ri, .cdl.k-office .ri { color: var(--hue-slate); }
.cal-none { margin: .2rem 0; }
.cal-soon-h { font-size: .95rem; margin: 1rem 0 .3rem !important; }
.soon { list-style: none; margin: 0; padding: 0; }
.soon > li > a, .soon > li > div { display: flex; align-items: center; gap: .6rem; padding: .5rem .4rem; margin: 0 -.4rem; border-radius: 10px; color: var(--ink); }
.soon > li + li { border-top: 1px solid var(--line); }
.soon > li > a:hover { background: var(--surface-2); text-decoration: none; }
.soon-body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.soon-body b { font-size: .88rem; font-weight: 650; }
.soon-when { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.soon-when b { font-size: .8rem; font-weight: 700; }
.soon-when span { font-size: .72rem; color: var(--muted); }
.soon-when.now b { color: var(--hue-teal); }

/* /team: the people who teach the course, and the AI tutor */
.team { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.team-card { display: flex; gap: 1rem; align-items: flex-start; margin: 0 !important; }
.team-photo { flex: none; width: 76px; height: 76px; border-radius: 50%; object-fit: cover; display: grid; place-items: center;
  background: var(--avatar-bg); color: var(--avatar-ink); font-weight: 700; font-size: 1.5rem; }
.team-photo.icon .ri { width: 32px; height: 32px; }
.team-photo.icon.ai { background: color-mix(in srgb, var(--hue-blue) 12%, var(--surface)); color: var(--maroon-ink); }
.team-photo.icon.ai .ai-ico { width: 30px; height: 30px; margin: 0; }
.lead-card .team-photo { width: 96px; height: 96px; }
.team-body { min-width: 0; }
.team-body h2 { margin: .1rem 0 .5rem; font-size: 1.2rem; }
.team-body p { margin: 0 0 .5rem; color: var(--ink-2); }
.team-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .25rem .8rem; margin: 0; font-size: .88rem; }
.team-facts dt { color: var(--muted); }
.team-facts dd { margin: 0; overflow-wrap: anywhere; }
.team-help { margin-top: 1rem; }
.team-help h2 { margin: 0 0 .6rem; font-size: 1.15rem; }
.help-steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: .7rem; }
.help-steps li { counter-increment: step; display: grid; grid-template-columns: 1.9rem minmax(0, 1fr); column-gap: .6rem; }
.help-steps li::before { content: counter(step); grid-row: span 2; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2); font: 700 .8rem var(--font); }
.help-steps span { color: var(--ink-2); font-size: .9rem; }

/* /schedule: the term, week by week */
.sched-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; margin: 0 0 1.2rem; }
.sched-facts > div { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem .85rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: .88rem; }
.sched-facts > div > span { display: flex; flex-direction: column; color: var(--ink-2); }
.sched-facts b { color: var(--ink); }
.sched-facts .ri { color: var(--maroon-ink); margin-top: 1px; }
.sched { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.sched-week { display: grid; grid-template-columns: minmax(0, 1fr); gap: .4rem; padding: .85rem 1rem; scroll-margin-top: 90px; }
@media (min-width: 640px) { .sched-week { grid-template-columns: 9rem minmax(0, 1fr); gap: 1rem; } }
.sched-week + .sched-week { border-top: 1px solid var(--line); }
.sched-week.past { color: var(--muted); }
.sched-week.past .sched-topic { color: var(--ink-2); }
.sched-week.now { background: color-mix(in srgb, var(--maroon) 6%, var(--surface)); box-shadow: inset 3px 0 0 var(--maroon); }
.sched-when { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .35rem; font-size: .9rem; }
.sched-when span { color: var(--muted); }
.sched-when .pill { font-size: .7rem; color: #fff; }
.sched-what { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.sched-topic { display: flex; align-items: center; gap: .5rem; font-weight: 650; color: var(--ink); }
.sched-topic .topicnum { width: 1.6rem; height: 1.6rem; font-size: .78rem; border-radius: 6px; flex: none; }
.sched-events { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; font-size: .86rem; }
.sched-events li { display: flex; gap: .45rem; align-items: flex-start; }
.sched-events .ri { width: 16px; height: 16px; margin-top: 2px; color: var(--hue-blue); }
.sched-events .k-exam .ri { color: var(--hue-amber); } .sched-events .k-break .ri { color: var(--hue-slate); }
.sched-events .k-exam b + * , .sched-events .k-exam { font-weight: 650; }

/* Home's numbers: icon, value, label */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; margin: .5rem 0 .2rem; }
/* icon and value on one line, the label under both */
.stat { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; padding: .75rem .8rem; border-radius: 12px; background: var(--surface-2); color: var(--ink); }
a.stat:hover { background: var(--surface-3); text-decoration: none; }
.stat > span:last-child { display: contents; }
.stat b { font-size: 1.35rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat b small { font-size: .82rem; color: var(--muted); font-weight: 600; }
.stat b + span { flex-basis: 100%; font-size: .8rem; color: var(--muted); line-height: 1.3; }
.stat .ico-tile.sm { width: 30px; height: 30px; border-radius: 9px; }
.stat .ico-tile.sm .ri { width: 17px; height: 17px; }
.stat .ico-tile { background: color-mix(in srgb, var(--hue) 14%, var(--surface)); }
.icolist { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .35rem; }
.icolist a { display: flex; align-items: center; gap: .6rem; color: var(--ink); padding: .3rem .35rem; margin: 0 -.35rem; border-radius: 10px; min-height: 44px; }
.icolist a:hover { background: var(--surface-2); text-decoration: none; }
.skillgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem 1.2rem; margin-top: .6rem; }
@media (max-width: 900px) { .skillgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sg-topic { padding: .55rem .6rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.sg-topic.current { border-color: var(--maroon); box-shadow: inset 0 0 0 1px var(--maroon); }
.sg-head { display: flex; align-items: center; gap: .5rem; font-weight: 650; font-size: .86rem; color: var(--ink); margin-bottom: .45rem; }
.sg-head .topicnum { width: 1.6rem; height: 1.6rem; font-size: .78rem; border-radius: 6px; }
.sg-tiles { display: flex; flex-wrap: wrap; gap: 4px; }
.sg-tile { width: 22px; height: 22px; border-radius: 5px; background: var(--lv); display: block; }
.sg-tile.lv0 { background: transparent; box-shadow: inset 0 0 0 1.5px var(--viz-axis); }
.sg-tile:hover { outline: 2px solid var(--orange); outline-offset: 1px; }
.dot.lv0 { background: transparent; box-shadow: inset 0 0 0 1.5px var(--viz-axis); }
.pill.free { background: var(--orange); color: var(--accent-on); border-color: var(--orange); }

/* ------------------------------------------------------------------ textbook problems */
.chapter { margin-top: 1rem; }
.chapter.current { border-color: var(--maroon); box-shadow: 0 0 0 1px var(--maroon), var(--shadow); }
.pset { margin-top: .9rem; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.75rem, 1fr)); gap: .4rem; margin-top: .45rem; }
@media (min-width: 641px) { .pgrid { display: flex; flex-wrap: wrap; } }
.pstat-legend { gap: .3rem 1rem; }
.pstat-legend .pstat { margin-left: 0; }
.problems-total { min-width: 150px; }
@media (max-width: 640px) { .problems-total { display: flex; align-items: baseline; gap: .5rem; min-width: 0; width: 100%; padding: .5rem .8rem; } }
.pchip {
  position: relative; min-width: 2.4rem; height: 2.6rem; padding: 0 .5rem; display: inline-grid; place-items: center; border-radius: 8px;
  font-weight: 700; font-size: .88rem; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line);
}
.pchip:hover { border-color: var(--maroon); text-decoration: none; }
.pchip.code::after { content: ""; position: absolute; left: 7px; right: 7px; bottom: 3px; height: 2.5px; border-radius: 2px; background: var(--viz-s3); }
.pstat.code { border: 0; height: 3px; width: 1rem; border-radius: 2px; background: var(--viz-s3); vertical-align: 3px; }
.pchip.attempted { border-color: var(--viz-s2); background: color-mix(in srgb, var(--viz-s2) 10%, var(--surface)); }
.pchip.revealed { border-color: var(--lv2); background: color-mix(in srgb, var(--lv2) 16%, var(--surface)); }
.pchip.solved { border-color: var(--lv4); background: var(--lv3); color: #fff; }
.pchip.solved.code::after { background: #fff; }
.pstat { display: inline-block; width: .9rem; height: .9rem; border-radius: 4px; border: 1.5px solid var(--line); vertical-align: -2px; margin: 0 .25rem 0 .7rem; }
.pstat.attempted { border-color: var(--viz-s2); background: color-mix(in srgb, var(--viz-s2) 10%, var(--surface)); }
.pstat.revealed { border-color: var(--lv2); background: color-mix(in srgb, var(--lv2) 16%, var(--surface)); }
.pstat.solved { border-color: var(--lv4); background: var(--lv3); }
.problem-layout { max-width: 900px; }
.pimgs { display: flex; flex-direction: column; gap: .2rem; margin-top: .5rem; }
.pimgs img { width: 100%; max-width: 820px; height: auto; background: #fff; border-radius: 6px; padding: .3rem; }
:root[data-theme="dark"] .pimgs img { filter: invert(.92) hue-rotate(180deg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pimgs img { filter: invert(.92) hue-rotate(180deg); } }

.topic-art { height: 64px; border-radius: 10px; background: linear-gradient(135deg, color-mix(in srgb, var(--maroon) 8%, var(--surface)), var(--surface-2)); display: grid; place-items: center; }
.topic-art .topic-icon { height: 54px; width: auto; }
.topic-head { display: flex; gap: 1rem; align-items: center; }
.topic-head-art { flex: none; width: 120px; height: 76px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, color-mix(in srgb, var(--maroon) 10%, var(--surface)), var(--surface)); border: 1px solid var(--line); }
.topic-head-art .topic-icon { width: 104px; height: auto; }
@media (max-width: 640px) { .topic-head-art { display: none; } }
/* cards side by side in a grid don't get the stacked-card top margin */
.grid > .card + .card, .topiccards > .card + .card, .dash-grid > .card + .card, .kpis > .kpi + .kpi,
.lab > .card + .card, .skillgrid > * + * { margin-top: 0; }

/* accessibility: CodeMirror gutter numbers at readable contrast */
.CodeMirror-linenumber { color: var(--muted) !important; }
.CodeMirror.cm-s-default .cm-error { color: var(--bad); }
/* CodeMirror's default token colours that fall below 4.5:1 on the code background */
.CodeMirror.cm-s-default .cm-string-2 { color: #b33c00; }
.CodeMirror.cm-s-default .cm-variable-3, .CodeMirror.cm-s-default .cm-type { color: #006b45; }
.CodeMirror.cm-s-default .cm-bracket { color: var(--muted); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cm-s-default .cm-string-2 { color: #fab387; }
  :root:not([data-theme="light"]) .cm-s-default .cm-variable-3,
  :root:not([data-theme="light"]) .cm-s-default .cm-type { color: #94e2d5; }
}
:root[data-theme="dark"] .cm-s-default .cm-string-2 { color: #fab387; }
:root[data-theme="dark"] .cm-s-default .cm-variable-3, :root[data-theme="dark"] .cm-s-default .cm-type { color: #94e2d5; }


/* outside a course there is no tab bar, so the account menu shows on phones too */
.usermenu.always { display: block; }

.footer-brand { display: inline-flex; align-items: center; gap: .45rem; font-weight: 650; color: var(--ink-2); margin-bottom: .35rem; }
.footer-brand img { width: 22px; height: 22px; border-radius: 6px; }
.footer-course { display: block; margin-top: .2rem; }

/* course list */
.courselist { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.coursecard { display: flex; flex-direction: column; gap: .7rem; border-top: 4px solid var(--orange); }
.coursecard-head { display: flex; gap: .9rem; align-items: center; }
.coursecard-head img { width: 56px; height: 56px; border-radius: 12px; flex: none; }
.coursecard-head h2 { margin: 0; font-size: 1.2rem; }
.coursecard-head .tiny { color: var(--muted); }
.coursecard dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: 0; font-size: .88rem; }
.coursecard dt { color: var(--muted); }
.coursecard dd { margin: 0; }
.coursecard form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin-top: auto; }
.coursecard form .field { margin: 0; flex: 1 1 160px; }
.coursecard .enrolled { color: var(--ok); font-weight: 600; font-size: .9rem; }

/* sign-in and sign-up: one centred column on a soft, bright wash */
body:has(.auth) {
  background:
    radial-gradient(900px 460px at 50% -10%, color-mix(in srgb, var(--maroon) 14%, transparent), transparent 70%),
    radial-gradient(700px 420px at 90% 105%, color-mix(in srgb, var(--orange) 16%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
.auth { min-height: calc(100vh - 5rem); display: grid; place-items: center; padding: 1rem 0 2rem; }
.auth-inner { width: 100%; max-width: 400px; text-align: center; }
.auth-logo { width: 108px; height: 108px; display: block; margin: 0 auto .4rem; }
.auth-say { margin: .1rem 0 0; color: var(--muted); font-size: .95rem; letter-spacing: .02em; }
.ipa { font-family: "Charis SIL", "Doulos SIL", "Gentium Plus", "Noto Serif", Georgia, serif; font-style: normal; white-space: nowrap; }
.auth-name { font-size: 2.3rem; font-weight: 750; letter-spacing: -.015em; margin: 0; color: var(--ink); }
.auth-tagline { color: var(--ink-2); font-size: 1.22rem; line-height: 1.45; letter-spacing: .005em; margin: .45rem auto 1.8rem; }
.auth .card { text-align: left; padding: 1.5rem; }
.auth .card h2 { margin: 0 0 1rem; font-size: 1.15rem; }
.auth-switch { margin: 1.1rem 0 0; color: var(--ink-2); }

/* ------------------------------------------------------------------ people, search, console, philosophy */
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--avatar-bg); color: var(--avatar-ink); font-weight: 700; letter-spacing: .02em; }
.avatar.md { width: 42px; height: 42px; font-size: 1.05rem; }
.avatar.xl { width: 112px; height: 112px; font-size: 2.6rem; }

.spacer { flex: 1; }
.brand-text.always { display: block; }
.console-badge { display: inline-block; margin-left: .45rem; padding: .05rem .5rem; border-radius: 999px; background: var(--orange); color: var(--accent-on); font-size: .7rem; font-weight: 750; letter-spacing: .02em; vertical-align: 2px; }
.hdr-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--header-ink-2); flex: none; }
.hdr-icon:hover { background: var(--header-hover); color: var(--header-ink); }
.hdr-icon svg, .coursesearch svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hdr-btn { flex: none; }
/* developer mode: view the site as each role */
.devbar { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; padding: .3rem max(.75rem, env(safe-area-inset-left)); margin: 0;
  background: repeating-linear-gradient(135deg, #1f2937 0 12px, #273244 12px 24px); color: #e5e7eb; font: 600 .74rem var(--font); }
.devbar-k { padding: .1rem .45rem; border-radius: 6px; background: #facc15; color: #1f2937; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; font-size: .66rem; }
.devbar-l { color: #9ca3af; margin: 0 .15rem 0 .3rem; }
.devbar button { border: 1px solid #4b5563; background: transparent; color: #e5e7eb; border-radius: 999px; padding: .12rem .6rem; font: inherit; cursor: pointer; }
.devbar button:hover { border-color: #9ca3af; }
.devbar button[aria-pressed="true"] { background: #facc15; border-color: #facc15; color: #1f2937; }
.devbar-who { margin-left: auto; color: #9ca3af; font-weight: 500; }
.devbar-course { color: #e5e7eb; border: 1px dashed #4b5563; border-radius: 999px; padding: .1rem .55rem; }
.devbar-course:hover { border-color: #9ca3af; text-decoration: none; }
.devbar-course.on { border-style: solid; border-color: #facc15; color: #facc15; }
@media print { .devbar { display: none; } }
/* the far end of the bar: tutor, course, account together */
/* the course sits centred in the space between the last tab (or the brand, on phones) and the account */
.hdr-end { display: flex; align-items: center; gap: .6rem; flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
.hdr-end > .coursesw { margin-inline: auto; }
@media (max-width: 799px) { .coursechip { height: 36px; } }
@media (min-width: 800px) {
  .nav { flex: 0 1 auto; justify-content: flex-start; margin-left: .6rem; }   /* the sections start right beside the brand */
  .hdr-end { gap: .75rem; }
}
/* Team and Values sit after the four study tabs, past a hairline */
.nav-sep { display: none; }
@media (min-width: 800px) { .nav-sep { display: block; flex: none; width: 1px; height: 22px; margin: 0 .35rem; align-self: center; background: var(--line); } }

/* Practice: four ways in */
.subtabs { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; margin: 0 0 1.1rem; padding: .25rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; width: max-content; max-width: 100%; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .85rem; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: .92rem; white-space: nowrap; }
.subtabs a:hover { background: var(--surface); text-decoration: none; }
.subtabs a.on { background: var(--surface); color: var(--maroon-ink); box-shadow: var(--shadow); }

/* the teaching console: a back end with a sidebar */
.wrap.console { max-width: 1440px; }
.console-nav { display: flex; gap: .3rem; overflow-x: auto; scrollbar-width: none; margin: 0 0 1rem; }
.console-nav::-webkit-scrollbar { display: none; }
.console-nav a { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .7rem; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: .9rem; white-space: nowrap; background: var(--surface); border: 1px solid var(--line); }
.console-nav a:hover { text-decoration: none; background: var(--surface-2); }
.console-nav a.on { background: var(--header-on); color: var(--header-on-ink); border-color: transparent; }
.console-group { display: none; }
@media (min-width: 800px) {
  .wrap.console { display: grid; grid-template-columns: 228px minmax(0, 1fr); gap: 1.6rem; align-items: start; }
  .console-side { position: sticky; top: calc(var(--topbar-h) + 1rem); }
  .console-nav { flex-direction: column; overflow: visible; margin: 0; gap: .1rem; }
  .console-nav a { background: none; border: 0; padding: .5rem .65rem; }
  .console-group { display: block; margin: .9rem .65rem .3rem; font-size: .72rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .console-group:first-child { margin-top: 0; }
}

/* course list and search */
.sectionhead { font-size: 1.15rem; margin: 1.6rem 0 .8rem; }
.coursesearch { display: flex; align-items: center; gap: .6rem; max-width: 640px; margin: 0 0 1rem; padding: .25rem .4rem .25rem .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); color: var(--muted); }
.coursesearch:focus-within { border-color: var(--maroon); box-shadow: 0 0 0 4px color-mix(in srgb, var(--maroon) 15%, transparent); }
.coursesearch input { flex: 1; border: 0; background: none; font: inherit; font-size: 1rem; padding: .6rem .2rem; color: var(--ink); outline: none; min-width: 0; }
.coursecard-head h3 { margin: 0; font-size: 1.15rem; }
.coursecard-topics { display: flex; flex-wrap: wrap; gap: .3rem; }
.coursecard-topics span { font-size: .78rem; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.courseslot { display: contents; }
.courseslot[hidden] { display: none; }
.emptystate { text-align: center; padding: 2rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }

/* profile */
.profile-wrap { max-width: 760px; }
.profile-card { display: flex; gap: 1.4rem; align-items: center; flex-wrap: wrap; padding: 1.4rem;
  background: linear-gradient(120deg, var(--hero-from), color-mix(in srgb, var(--hero-from) 50%, var(--hero-to)) 60%, var(--hero-to)); }
.profile-id { flex: 1; min-width: 220px; }
.profile-id h1 { margin: 0; font-size: 1.6rem; }
.profile-meta { display: flex; flex-wrap: wrap; gap: .35rem; margin: .6rem 0; }
.profile-meta .pill { background: var(--glass); }
.profile-photo-actions { gap: .4rem; }
.profile-photo-actions form { margin: 0; }
.photo-pick { position: relative; display: block; cursor: pointer; border-radius: 50%; }
.photo-pick .avatar { box-shadow: 0 0 0 4px var(--surface), 0 6px 20px rgba(20, 40, 90, .15); }
.photo-edit { position: absolute; right: 2px; bottom: 2px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); font-size: 1rem; }
.photo-pick:hover .avatar { filter: brightness(.95); }
.dash-avatar { width: 52px; height: 52px; vertical-align: middle; margin-right: .5rem; box-shadow: 0 0 0 3px var(--surface); }

/* philosophy */
.philo { max-width: 780px; margin: 0 auto; }
.philo-hero { text-align: center; padding: 2rem 0 1rem; }
.philo-logo { width: 96px; height: 96px; display: block; margin: 0 auto .6rem; }
.philo-hero h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); letter-spacing: -.015em; margin: .3rem 0 .8rem; }
.philo-hero .lead { max-width: 60ch; margin: 0 auto; font-size: 1.12rem; }
.philo h2 { font-size: 1.35rem; }
.philo-why p, .philo-name p, .philo-close p { font-size: 1.04rem; line-height: 1.7; color: var(--ink-2); }
.philo-h { margin-top: 2.2rem; }
.principles { list-style: none; counter-reset: p; padding: 0; margin: 0; display: grid; gap: .9rem; }
.principles li { counter-increment: p; position: relative; padding: 1.3rem 1.4rem 1.2rem 4.4rem; }
.principles li::before { content: counter(p); position: absolute; left: 1.3rem; top: 1.15rem; width: 2.2rem; height: 2.2rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--soft-accent); color: var(--soft-accent-ink); font-weight: 800; }
.principles h3 { margin: 0 0 .4rem; font-size: 1.15rem; }
.principles p { margin: .35rem 0; line-height: 1.6; }
.principles .onp { color: var(--ink-2); }
.principles .onp b { color: var(--maroon-ink); }
.principles .evid { color: var(--muted); font-size: .93rem; }
.philo sup a { text-decoration: none !important; font-weight: 700; padding: 0 .1rem; }
.philo-name { display: flex; gap: 1.4rem; align-items: center; margin: 2.4rem 0 1rem; padding: 1.4rem; border-radius: var(--radius);
  background: linear-gradient(120deg, var(--hero-from), var(--hero-to)); }
.philo-name img { width: 88px; height: 88px; flex: none; }
.philo-name h2 { margin-top: 0; }
@media (max-width: 600px) { .philo-name { flex-direction: column; text-align: center; } .principles li { padding-left: 1.3rem; padding-top: 3.8rem; } }
.philo-close { text-align: center; margin: 2rem 0; }
.philo-close p { max-width: 58ch; margin: 0 auto 1rem; }
.philo-refs { border-top: 1px solid var(--line); margin-top: 2.4rem; padding-top: .6rem; }
.philo-refs h2 { font-size: 1rem; }
.philo-refs ol { padding-left: 1.3rem; color: var(--ink-2); font-size: .9rem; line-height: 1.55; }
.philo-refs li { margin: .35rem 0; }
.philo-refs li:target { background: var(--info-bg); border-radius: 6px; }

/* a little life: things rise into place, and cards lift under the pointer */
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise .4s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(min(var(--i, 0), 6) * 45ms); }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } }
  .coursecard, .principles li, .recs a, .topiccard { transition: transform .18s ease, box-shadow .18s ease; }
  .coursecard:hover, .principles li:hover, .topiccard:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(20, 40, 90, .10); }
  .auth-inner { animation: rise .6s cubic-bezier(.2, .7, .2, 1) both; }
}

/* ------------------------------------------------------------------ header: brand, course, tabs (research: reports/) */
html { scroll-padding-top: calc(var(--topbar-h) + 12px); scroll-padding-bottom: calc(var(--tabbar-h) + 24px); }
.skiplink { position: absolute; left: 12px; top: -60px; z-index: 100; padding: .6rem .9rem; border-radius: 10px; background: var(--brand-fill); color: #fff; font-weight: 700; }
.skiplink:focus { top: 10px; text-decoration: none; }
main.wrap:focus { outline: none; }
.brand { margin-right: 0; flex: none; }
.wordmark { font-weight: 750; font-size: 1.08rem; letter-spacing: -.005em; color: var(--header-ink); }
.hdr-divider { width: 1px; height: 24px; background: var(--line); flex: none; display: none; }
/* the current course: on the right of the top bar below 800px; after a divider beside the brand above it */
.coursesw { position: relative; min-width: 0; }
.coursechip { display: inline-flex; max-width: 100%; align-items: center; gap: .45rem; height: 40px; padding: 0 .55rem 0 .7rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--header-ink); font: 650 .9rem var(--font); cursor: pointer; white-space: nowrap; flex: none; }
.coursechip:hover { background: var(--header-hover); }
.coursechip[aria-expanded="true"] { border-color: var(--maroon); }
.coursechip.static { cursor: default; background: none; display: none; }
.coursechip .chip-term { display: none; font-weight: 500; color: var(--header-ink-2); }
.coursedot { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 2px color-mix(in srgb, var(--orange) 25%, transparent); flex: none; }
.chev { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.coursemenu { position: fixed; z-index: 70; min-width: 280px; max-width: min(360px, calc(100vw - 24px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .12); padding: .4rem; }
.coursemenu a { display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .7rem; border-radius: 8px; color: var(--ink); }
.coursemenu a:hover { background: var(--surface-2); text-decoration: none; }
.coursemenu-head { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem .7rem .7rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.coursemenu-head .coursedot { margin-top: .4rem; }
.coursemenu-head b { display: block; font-size: .95rem; }
.coursemenu-head span { display: block; color: var(--muted); font-size: .82rem; margin-top: .15rem; }
.coursemenu.as-sheet { position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); max-width: none; }
.td-title .ai-ico, .pill .ai-ico, h3 .ai-ico, strong .ai-ico { width: 15px; height: 15px; vertical-align: -2px; margin-right: .3rem; }
.ai-ico, .tl-icon { fill: currentColor; }
.tab-me .avatar.tab { width: 26px; height: 26px; font-size: .78rem; box-shadow: 0 0 0 1.5px var(--line); }
.tabbar .on.tab-me .avatar.tab { box-shadow: 0 0 0 2px var(--maroon); }
.subtabs a > span[aria-hidden] { display: none; }
@media (min-width: 600px) {
  .coursechip.static { display: inline-flex; }
  .subtabs a > span[aria-hidden] { display: inline; }
}
@media (min-width: 600px) and (max-width: 799px) {   /* iPad mini portrait, split view: icon beside label */
  .tabbar { justify-content: center; gap: .3rem; }
  .tabbar a, .tabbar button { flex: 0 1 132px; flex-direction: row; gap: .45rem; font-size: .8rem; }
}
@media (min-width: 800px) {
  .wordmark { font-size: 1.15rem; }
  .hdr-divider { display: inline-flex; }
}
@media (min-width: 400px) and (max-width: 799px), (min-width: 1024px) { .coursechip .chip-term { display: inline; } }
@media (max-width: 380px) { .wordmark { font-size: 1rem; } }
.console-badge { margin-left: 0; }

/* ------------------------------------------------------------------ recognition (app/recognition.py) */
.ri { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.recog-host { position: fixed; z-index: 55; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
@media (min-width: 800px) { .recog-host { left: 20px; right: auto; bottom: 20px; width: min(420px, calc(100vw - 260px)); } }
.recog { pointer-events: auto; display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .8rem; border-radius: 12px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); font-size: .93rem; line-height: 1.45; }
.recog .ri { color: var(--ok); margin-top: 1px; }
.recog-body { flex: 1; min-width: 0; }
.recog-body strong { display: block; font-size: 1rem; margin-bottom: .1rem; }
.recog-why { margin-left: .3rem; font-size: .85rem; white-space: nowrap; }
.recog-close { width: 44px; height: 44px; margin: -.6rem -.6rem -.6rem 0; border: 0; background: none; color: var(--muted); font-size: 1rem; cursor: pointer; border-radius: 10px; }
.recog-close:hover { background: var(--surface-2); }
.recog.t1, .recog.t2 { border-left: 4px solid var(--orange); }
.recog.t1 .ri, .recog.t2 .ri { color: var(--orange-ink); width: 26px; height: 26px; }
.recog.t2 { background: linear-gradient(120deg, var(--hero-from), var(--hero-to)); }
.recog.out { opacity: 0; transition: opacity .25s ease; }
/* inline lines next to the work (practice results) */
.recog.inline { box-shadow: none; margin-top: .5rem; background: var(--ok-bg); border-color: transparent; }
@media (prefers-reduced-motion: no-preference) {
  body:not(.motion-off) .recog.t0 { animation: recog-in .25s ease-out both; }
  body:not(.motion-off) .recog.t1 { animation: recog-pop .45s cubic-bezier(.2, .8, .2, 1.2) both; }
  body:not(.motion-off) .recog.t2 { animation: recog-pop .6s cubic-bezier(.2, .8, .2, 1.2) both; }
  body:not(.motion-off) .recog.t2 .ri { animation: recog-glow 1.6s ease-out 1; }
  @keyframes recog-in { from { opacity: 0; transform: translateY(6px); } }
  @keyframes recog-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } }
  @keyframes recog-glow { 30% { transform: scale(1.25); } }
}
body.motion-off .rise, body.motion-off .auth-inner { animation: none !important; }

/* Home: this week */
.weekcard { display: grid; gap: .6rem 1.6rem; grid-template-columns: minmax(0, 1fr); align-content: start; margin: 1rem 0; }
@media (min-width: 900px) { .weekcard { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.weekcard h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.week-status { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .45rem; margin: .2rem 0 .7rem; font-weight: 600; }
.week-status .muted { font-weight: 400; flex-basis: 100%; font-size: .9rem; }
.week-status .ri.ok { color: var(--ok); }
.weekdots { display: flex; gap: .4rem; margin: .2rem 0 .5rem; }
.wd { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.wd.on { background: var(--maroon); border-color: var(--maroon); }
.wd.pass { border-color: var(--maroon); background: color-mix(in srgb, var(--maroon) 25%, var(--surface)); }
.wd.break { border-style: dashed; }
.wd.now { border-color: var(--orange); border-width: 3px; }
.week-sub { margin: 0; }
.recog-line { display: flex; gap: .5rem; align-items: flex-start; margin: .7rem 0 0; color: var(--ink-2); }
.recog-line .ri { color: var(--maroon-ink); margin-top: 2px; }
.week-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.week-counts a { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding: .65rem .7rem; border-radius: 12px; background: var(--surface-2); color: var(--ink); min-height: 44px; }
.week-counts .ico-tile { margin-bottom: .4rem; background: color-mix(in srgb, var(--hue) 12%, var(--surface)); }
.week-counts a:hover { text-decoration: none; background: var(--surface-3); }
.week-counts b { font-size: 1.35rem; line-height: 1.1; }
.week-counts b + span { font-size: .8rem; color: var(--muted); }
.week-h3 { font-size: .95rem; margin: .9rem 0 .4rem; }
.milestones { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.milestones li { display: flex; gap: .6rem; align-items: flex-start; }
.milestones .ri { color: var(--orange-ink); margin-top: 2px; }
.milestones b { display: block; font-size: .93rem; }
.milestones span { display: block; font-size: .86rem; color: var(--ink-2); }

/* rules page */
.rules .card { margin-bottom: 1rem; }
.rulelist { display: grid; grid-template-columns: minmax(0, 1fr); gap: .25rem 1.2rem; margin: 0; }
@media (min-width: 700px) { .rulelist { grid-template-columns: 210px minmax(0, 1fr); } }
.rulelist dt { font-weight: 650; padding-top: .55rem; }
.rulelist dd { margin: 0; padding: .55rem 0; border-bottom: 1px solid var(--line); color: var(--ink-2); }
@media (min-width: 700px) { .rulelist dt { border-bottom: 1px solid var(--line); padding: .55rem 0; } }
.rulelist dt:target, .rulelist dt:target + dd { background: var(--info-bg); }

/* tutor: what it sees, and the first-open note */
.td-title strong { display: inline-flex; align-items: center; }
.td-notice { margin: .6rem .8rem 0; padding: .7rem .8rem; border-radius: 10px; background: var(--info-bg); font-size: .9rem; display: flex; gap: .6rem; align-items: flex-start; }
.td-notice p { margin: 0; flex: 1; }

/* the top bar sheds detail as it narrows, in this order: tab icons, the term, the tutor's long label,
   the wordmark. */
@media (min-width: 800px) and (max-width: 1179px) {
  .navtop { padding: .45rem .5rem; }
}
@media (min-width: 800px) and (max-width: 1023px) { .wordmark { display: none; } }

/* unread counts (Team tab, chat channels) */
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: .35rem; border-radius: 999px;
  background: var(--bad); color: #fff; font: 700 .68rem/1 var(--font); }

/* ------------------------------------------------------------------ Team: course chat (team.js) */
.team-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .3rem 1rem; margin-bottom: .8rem; }
.team-head h1 { margin: 0; }
.team-head p { margin: 0; }
.ai-link { color: var(--ai-ink); font-weight: 650; padding: 0; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--ai-2) 50%, transparent); }
.chat { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.chat-side, .chat-main, .chat-people { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.chat-side { padding: .6rem; }
.chat-side-h { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .5rem .5rem .25rem; }
.chat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.chat-list button { display: flex; align-items: center; gap: .4rem; width: 100%; text-align: left; border: 0; background: none; border-radius: 8px;
  padding: .42rem .55rem; color: var(--ink-2); font: 550 .88rem var(--font); cursor: pointer; }
.chat-list button:hover { background: var(--surface-2); }
.chat-list button.on { background: var(--header-on); color: var(--header-on-ink); font-weight: 700; }
.chat-list button.later { color: var(--muted); }
.chat-list .cl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list .cl-tag { flex: none; font-size: .64rem; font-weight: 700; padding: .05rem .35rem; border-radius: 999px; background: var(--orange); color: var(--accent-on); }
.chat-list .nav-badge { margin-left: 0; }
.cl-empty { padding: .3rem .55rem; }
.chat-main { display: flex; flex-direction: column; min-height: 420px; height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - var(--safe-b) - 9rem); }
.chat-head { padding: .8rem 1rem .6rem; border-bottom: 1px solid var(--line); }
.chat-head h2 { margin: 0; font-size: 1.05rem; }
.chat-head p { margin: .1rem 0 0; }
.chat-log { flex: 1; overflow-y: auto; padding: .6rem 1rem; display: flex; flex-direction: column; gap: .15rem; overscroll-behavior: contain; }
.chat-empty { margin: auto; text-align: center; max-width: 34ch; }
.msg { display: flex; gap: .65rem; padding: .35rem .4rem; border-radius: 10px; position: relative; }
.msg:not(.cont) { margin-top: .45rem; }
.msg:hover { background: var(--surface-2); }
.msg-face { flex: none; width: 34px; height: 34px; border-radius: 50%; object-fit: cover; display: grid; place-items: center;
  background: var(--avatar-bg); color: var(--avatar-ink); font: 700 .78rem var(--font); }
.msg-face.anon { background: var(--surface-3); color: var(--muted); }
.msg-face.gap { height: 0; background: none; }
.msg-body { flex: 1; min-width: 0; }
.msg-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .45rem; font-size: .9rem; }
.msg-badge { font-size: .64rem; font-weight: 750; padding: .05rem .4rem; border-radius: 999px; background: var(--orange); color: var(--accent-on); }
.msg-text { font-size: .93rem; line-height: 1.5; overflow-wrap: anywhere; }
.msg-text p { margin: .1rem 0; }
.msg-del { position: absolute; top: .3rem; right: .4rem; display: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 6px; padding: .05rem .4rem; cursor: pointer; }
.msg:hover .msg-del, .msg-del:focus-visible { display: block; }
@media (pointer: coarse) { .msg-del { display: none !important; } .msg.mine .msg-del { display: block !important; position: static; margin-top: .2rem; } }
.chat-compose { border-top: 1px solid var(--line); padding: .6rem .8rem .7rem; }
.chat-compose textarea { width: 100%; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; font: inherit;
  background: var(--surface); color: var(--ink); max-height: 180px; }
.chat-compose textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.chat-compose-row { display: flex; align-items: center; gap: .5rem; margin-top: .45rem; flex-wrap: wrap; }
.chat-anon { display: inline-flex; align-items: center; gap: .35rem; }
.chat-hint { margin-left: auto; }
@media (pointer: coarse) { .chat-hint { display: none; } .chat-compose-row .btn { margin-left: auto; } }
.chat-people { padding: .6rem .8rem .8rem; }
.chat-people p { margin: .2rem .5rem; }
.person { display: flex; gap: .6rem; align-items: flex-start; padding: .45rem .5rem; }
.person > div { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.person b { font-size: .9rem; }
.person .btn { align-self: flex-start; margin-top: .3rem; }
.team-photo.sm { width: 40px; height: 40px; font-size: .85rem; }
.team-photo.sm.icon .ri { width: 20px; height: 20px; }
.team-photo.sm.icon.ai .ai-ico { width: 18px; height: 18px; fill: url(#ai-grad); }
/* phones: channels as a scrolling row above the conversation, people below */
@media (max-width: 899px) {
  .chat-side { padding: .4rem; overflow-x: auto; display: flex; align-items: center; gap: .3rem; scrollbar-width: none; }
  .chat-side::-webkit-scrollbar { display: none; }
  .chat-side .chat-side-h { display: none; }
  .chat-list { display: flex; gap: .3rem; }
  .chat-list button { white-space: nowrap; border: 1px solid var(--line); }
  .chat-list .cl-name { overflow: visible; }
  .cl-empty { display: none; }
}
@media (min-width: 900px) { .chat { grid-template-columns: 230px minmax(0, 1fr); align-items: start; } .chat-people { grid-column: 1 / -1; } }
@media (min-width: 1180px) {
  .chat { grid-template-columns: 240px minmax(0, 1fr) 270px; }
  .chat-people { grid-column: auto; }
  .chat-side, .chat-people { max-height: calc(100dvh - var(--topbar-h) - 9rem); overflow-y: auto; }
  .chat-main { height: calc(100dvh - var(--topbar-h) - 9rem); }
}
@media (max-width: 899px) { .chat-list[data-list="private"] { order: -1; } }   /* the private thread first on phones */

/* sign-in: the password label with "Forgot password?" on the same line */
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.label-row a { font-weight: 500; }
/* developer outbox */
.outbox-msg { margin-bottom: .8rem; }
.outbox-body { white-space: pre-wrap; font: .9rem/1.5 var(--font); background: var(--surface-2); border-radius: 8px; padding: .7rem .8rem; margin: .5rem 0 0; }
.auth-name + .card { margin-top: 1.4rem; }
@media (prefers-reduced-motion: reduce) { .navtop .chev { transition: none; } }
/* the top bar: one compact row as wide as the page content (.wrap), text-only sections, the course code
   (its term is in the course menu) and the account */
@media (min-width: 800px) {
  .topbar-inner { max-width: 1200px; padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
  .navtop .ri, .coursechip .chip-term { display: none; }
  .coursesw { flex: none; }
  .navtop { padding: .45rem .7rem; font-weight: 600; }
}
@media (min-width: 800px) and (max-width: 1179px) {    /* narrow laptops and tablets: the bar's essentials only */
  .navtop { padding: .4rem .42rem; font-size: .86rem; }
  .navtop .chev { display: none; }
  .topbar-inner { gap: .5rem; }
  .coursechip { padding: 0 .45rem; }
}
@media (min-width: 800px) and (max-width: 1179px) {     /* staff carry Teach as well: Values moves to the account menu */
  .nav:has([data-nav="teach"]) > a.navtop[href="/values"] { display: none; }
}
/* starting a course (/teach/new) and the course status on Settings */
.teachnew { display: grid; gap: 1rem; max-width: 860px; }
.clonelist { display: grid; gap: .5rem; margin-top: .6rem; }
.cloneopt { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .8rem; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }
.cloneopt:has(input:checked) { border-color: var(--maroon); box-shadow: inset 0 0 0 1px var(--maroon); }
.cloneopt input { margin-top: .25rem; }
.cloneopt > span { display: flex; flex-direction: column; gap: .15rem; }
.coursestatus { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
/* generating a course from a syllabus (/teach/…) */
.syllabus-start { border: 1.5px solid color-mix(in srgb, var(--ai-2) 35%, var(--line)); margin-bottom: 1.2rem;
  background: linear-gradient(115deg, color-mix(in srgb, var(--ai-1) 5%, var(--surface)), color-mix(in srgb, var(--ai-3) 5%, var(--surface))); }
.jobsteps { list-style: none; padding: 0; margin: 0 0 .8rem; display: grid; gap: .55rem; }
.jobsteps li { display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap; }
.js-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 2px solid var(--line); align-self: center; }
.js-running .js-dot { border-color: var(--ai-2); border-right-color: transparent; animation: jsspin 1s linear infinite; }
.js-done .js-dot { background: var(--ok, #16a34a); border-color: var(--ok, #16a34a); }
.js-failed .js-dot { background: var(--bad); border-color: var(--bad); }
.js-skipped .js-dot { border-style: dashed; }
.js-waiting b { color: var(--muted); font-weight: 600; }
@keyframes jsspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .js-running .js-dot { animation: none; } }
.confirm { display: grid; gap: 1rem; }
.field.unsure input, .field.unsure textarea { border-color: var(--orange); box-shadow: 0 0 0 2px color-mix(in srgb, var(--orange) 20%, transparent); }
.daypick { border: 0; padding: 0; display: flex; gap: .8rem; flex-wrap: wrap; }
.daypick legend { font-weight: 600; margin-bottom: .3rem; }
.topicrows { display: grid; gap: .6rem; }
.topicrow { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem; border: 1px solid var(--line); border-radius: 10px; }
.tr-num { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; flex: none; }
.tr-main { flex: 1; min-width: 0; display: grid; gap: .4rem; }
.tr-title { font-weight: 600; width: 100%; }
.tr-src select { max-width: min(420px, 70vw); }
.warnline { color: var(--orange); }
.confirm input[type="date"], .confirm select { font: inherit; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); min-height: 36px; }
.confirm .field input[type="date"] { width: 100%; max-width: 260px; }
/* widgets of an instructor's course, in sandboxed frames (app/routes/frames.py) */
.viz.framed { padding-bottom: .4rem; }
.viz-frame { display: block; width: 100%; height: 360px; border: 0; background: transparent; }
.svg-frame { display: block; width: 100%; min-height: 220px; border: 0; background: transparent; }
.topicpick { display: grid; gap: .3rem; margin: .4rem 0 .8rem; max-height: 260px; overflow: auto; }
.staged { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.startways { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.startway { display: flex; flex-direction: column; gap: .5rem; }
.startway h2 { margin: 0; }
.startway p { margin: 0 0 .4rem; }
.startway .btn { align-self: flex-start; margin-top: auto; }
.sw-step { font-size: 1.6rem; }
.filepick { display: flex; flex-direction: column; gap: .15rem; padding: .9rem; border: 1.5px dashed var(--line); border-radius: 10px; cursor: pointer; }
.filepick:hover { border-color: var(--ai-2); }
.filepick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.filepick span:first-of-type { font-weight: 600; }
.readybadge { font-size: .74rem; font-weight: 650; padding: .12rem .5rem; border-radius: 999px; white-space: nowrap; }
.readybadge.ready { background: color-mix(in srgb, var(--ok, #16a34a) 14%, var(--surface)); color: var(--ok, #16a34a); }
.readybadge.new { background: color-mix(in srgb, var(--ai-2) 14%, var(--surface)); color: var(--ai-ink); }
/* wide maths and tables scroll inside themselves on a phone, never the whole page */
.katex-display { overflow-x: auto; overflow-y: hidden; max-width: 100%; padding: .1rem 0; }
.md table, .prompt table, .practice table, .item table { display: block; max-width: 100%; overflow-x: auto; }
.prompt, .item-prompt, .practice .md { overflow-wrap: anywhere; min-width: 0; }
/* KaTeX's hidden MathML is positioned absolutely: keep it inside the scrolling box, or the page scrolls sideways */
.md table, .keyideas .formula, .katex-display { position: relative; }
/* two-step sign-in */
.mfa-steps { padding-left: 1.2rem; margin: .4rem 0; }
.mfa-qr { display: grid; place-items: center; margin: .6rem 0 .8rem; }
.mfa-qr svg { display: block; width: 232px; height: 232px; background: #fff; border-radius: 6px; }
.mfa-onphone { margin: .2rem 0 .6rem; text-align: center; }
.mfa-open { margin-top: .4rem; }
.mfa-manual { margin-bottom: .8rem; }
.mfa-key { word-break: break-all; font-size: .95rem; letter-spacing: .05em; }
.mfa-codes { columns: 2; list-style: none; padding: 0; margin: .6rem 0 1rem; }
.mfa-codes li { padding: .2rem 0; font-size: 1rem; }

/* draggable borders (common.js): the AI tutor's width, Home's side column */
:root { --tutor-w: 440px; }
.resize-handle { display: none; position: absolute; top: 0; bottom: 0; width: 12px; z-index: 6; cursor: col-resize; touch-action: none; }
.resize-handle::after { content: ""; position: absolute; top: 0; bottom: 0; left: 5px; width: 2px; border-radius: 2px;
  background: transparent; transition: background .15s ease; }
.resize-handle:hover::after, .resize-handle:focus-visible::after, .resize-handle.dragging::after { background: var(--ai-2); }
.resize-handle:focus-visible { outline: none; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing iframe { pointer-events: none; }            /* a sandboxed widget mustn't swallow the drag */
@media (min-width: 641px) { .tutor-drawer > .resize-handle { display: block; left: -6px; } }
@media (prefers-reduced-motion: reduce) { .resize-handle::after { transition: none; } }

/* a single short form (change password) */
.narrow-page { max-width: 460px; margin: 0 auto; }
.narrow-page h1 { margin: .2rem 0 1rem; }

/* View as (course staff): the switch in the account menu, and the bar while previewing */
.viewas { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; padding: .45rem .75rem; border-bottom: 1px solid var(--line); margin: 0 0 .2rem; }
.viewas .muted { margin-right: .2rem; }
.viewas button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: .15rem .6rem;
  font: 600 .8rem var(--font); cursor: pointer; }
.viewas button[aria-pressed="true"] { background: var(--maroon); border-color: var(--maroon); color: #fff; }
.viewas-bar { display: flex; align-items: center; justify-content: center; gap: .4rem .9rem; flex-wrap: wrap; margin: 0; padding: .45rem 1rem;
  background: #fef3c7; color: #78350f; border-bottom: 1px solid #fcd34d; font-size: .9rem; text-align: center; }
.viewas-note { opacity: .8; }
.viewas-bar .btn { background: #fff; border-color: #f59e0b; color: #78350f; }
@media (max-width: 640px) { .viewas-note { display: none; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .viewas-bar { background: #422006; color: #fde68a; border-color: #92400e; } }
:root[data-theme="dark"] .viewas-bar { background: #422006; color: #fde68a; border-color: #92400e; }
