/* Components: the shell, page structure, the "ed" tile, Skill progress,
   states, dialogs, toasts, the term grid and the tech tag.
   docs/ui.md describes each. Tokens only. */

/* ---- top bar ----------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-6);
  padding: 0 max(var(--gutter), calc((100% - var(--content-max)) / 2 + var(--gutter)));
  background: var(--band); color: var(--on-band);
  border-bottom: 1px solid rgba(211, 255, 233, .08);
}
.topbar .brand { display: flex; align-items: center; border-radius: var(--r-sm); }
.topbar .brand img { display: block; height: 26px; width: auto; }
.mainnav { display: flex; align-items: center; gap: var(--s-1); margin-left: var(--s-4); }
.mainnav > a, .nav-switch {
  display: inline-flex; align-items: center; gap: var(--s-2); height: 40px; padding: 0 var(--s-3);
  border-radius: var(--r-md); border: 0; background: none; color: var(--on-band-muted);
  font: var(--t-body); font-weight: var(--w-medium); text-decoration: none; white-space: nowrap;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.mainnav > a:hover, .nav-switch:hover { color: var(--on-band); background: rgba(211, 255, 233, .08); }
.mainnav > a[aria-current="page"], .nav-switch[aria-current="page"], .switcher.open .nav-switch {
  color: var(--white); background: rgba(211, 255, 233, .12);
}
.mainnav .badge { margin-left: var(--s-1); }
.topbar .who { display: flex; align-items: center; gap: var(--s-3); font-weight: var(--w-medium); color: var(--on-band); }
.view-chip {
  display: inline-flex; align-items: center; gap: var(--s-2); height: 36px; padding: 0 var(--s-2) 0 var(--s-4);
  border-radius: var(--r-full); background: var(--green-400); color: var(--green-950);
  font: var(--t-label); text-decoration: none; transition: background var(--dur-1) var(--ease);
}
.view-chip:hover { background: var(--green-100); }
.view-chip .vc-sep { width: 1px; height: 18px; background: rgba(1, 18, 9, .25); margin: 0 var(--s-1); }
.view-chip .vc-exit { display: inline-flex; align-items: center; gap: var(--s-1); padding: 0 var(--s-3); height: 28px; border-radius: var(--r-full); background: rgba(1, 18, 9, .1); }

/* ---- focus on dark surfaces ----------------------------------------------
   base.css draws every focus ring from --focus-shadow. A dark surface sets the
   band ring here (screens on their own stylesheets included); a light panel
   inside one sets --focus-ring back. */
.topbar, .hero, .toast, .teach-bar, .stage-edge, .mk-photo { --focus-shadow: var(--focus-ring-band); }
.teach-panel { --focus-shadow: var(--focus-ring); }

/* ---- student switcher --------------------------------------------------- */
.switcher { position: relative; }
.sw-panel {
  position: absolute; top: calc(100% + var(--s-2)); left: 0; z-index: 60; width: 420px;
  background: var(--surface); color: var(--ink); border-radius: var(--r-lg); box-shadow: var(--e4);
  padding: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2);
  animation: rise var(--dur-2) var(--ease);
}
.sw-panel { --focus-shadow: var(--focus-ring); }
.sw-label { padding: var(--s-2) var(--s-3) 0; }
.sw-list { display: flex; flex-direction: column; max-height: min(420px, calc(100vh - 220px)); overflow: auto; }
.sw-row > a, .sw-row { display: flex; align-items: center; gap: var(--s-3); border-radius: var(--r-md); }
.sw-row > a { flex: 1; min-width: 0; padding: var(--s-2) var(--s-3); color: var(--ink); text-decoration: none; }
.sw-row > a:hover { background: var(--surface-quiet); }
.sw-row.selected > a { background: var(--surface-mint); }
.sw-row .sw-edit { flex: none; color: var(--muted); }
.sw-row .sw-who { display: flex; align-items: center; gap: var(--s-3); flex: 1; padding: var(--s-2) var(--s-3); }
.sw-name, .sw-who > span:not(.avatar) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.sw-name b, .sw-who b { font-weight: var(--w-semibold); }
.sw-name span, .sw-who span span { font: var(--t-caption); color: var(--muted); }
.sw-empty { padding: var(--s-4) var(--s-3); }
.sw-foot { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-1) 0; border-top: 1px solid var(--line); }
.sw-foot .count-pill { margin-left: var(--s-1); }

/* ---- page structure ----------------------------------------------------- */
.page-main { min-height: calc(100vh - var(--topbar-h)); display: flex; flex-direction: column; }
.page-body {
  width: 100%; max-width: var(--content-max); margin: 0 auto;
  padding: var(--s-8) var(--gutter) var(--s-16); display: flex; flex-direction: column; gap: var(--s-6);
}
.page-body.narrow { max-width: 960px; }

/* the dark band under the top bar */
.hero { position: relative; overflow: hidden; background: var(--band); color: var(--on-band); }
.hero::after {   /* a large faint "ed" tile, the warmth of the brand */
  content: ''; position: absolute; right: 6%; top: -150px; width: 360px; height: 373px; pointer-events: none;
  background: rgba(211, 255, 233, .045);
  clip-path: polygon(4.3% 20.6%, 83.5% 0%, 92.1% 5.4%, 100% 82.1%, 96% 87%, 27.5% 99.8%, 22.2% 95.7%, 0% 28.1%);
}
.hero-in { position: relative; z-index: 1; max-width: var(--content-max); margin: 0 auto; padding: var(--s-5) var(--gutter) var(--s-8); }
.hero.size-sm .hero-in { padding-bottom: var(--s-6); }
.hero.size-sm h1 { font: var(--t-h2); font-weight: var(--w-semibold); }
.hero.size-lg .hero-in { padding: var(--s-6) var(--gutter) var(--s-10); }
.hero.size-lg h1 { font: var(--t-display); letter-spacing: -.015em; }   /* Display 40/48 Light, on the scale */
.hero-row { display: flex; align-items: center; gap: var(--s-5); }
.hero-lead { flex-shrink: 0; }
.hero-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--s-1); }
.hero h1 { color: var(--green-50); }
.hero-eyebrow { font: var(--t-label); letter-spacing: .06em; text-transform: uppercase; color: var(--green-400); }
.hero-sub { font: var(--t-body-lg); color: var(--on-band-muted); max-width: 72ch; }
.hero-actions { display: flex; align-items: center; gap: var(--s-3); flex-shrink: 0; }
.hero-link { color: var(--green-100); text-decoration-color: rgba(211, 255, 233, .4); }
.hero-link:hover { color: var(--white); }
.hero .btn { background: transparent; color: var(--on-band); border-color: rgba(211, 255, 233, .35); }
.hero .btn:hover:not(:disabled) { background: rgba(211, 255, 233, .1); border-color: var(--on-band); }
.hero .btn-primary { background: var(--green-100); color: var(--green-800); border-color: var(--green-100); }
.hero .btn-primary:hover:not(:disabled) { background: var(--white); border-color: var(--white); }
.hero .icon-btn { background: transparent; color: var(--on-band); border-color: rgba(211, 255, 233, .35); }
.hero .icon-btn:hover:not(:disabled) { background: rgba(211, 255, 233, .1); color: var(--white); }
.hero-skeleton .hero-in { display: flex; flex-direction: column; gap: var(--s-4); padding-bottom: var(--s-10); }

.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: 0 0 var(--s-4); padding: 0; font: var(--t-label); }
.crumbs li { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--on-band-muted); }
.crumbs li + li::before { content: '/'; color: rgba(168, 203, 185, .5); }
.crumbs a { color: var(--on-band-muted); text-decoration: none; border-radius: var(--r-sm); }
.crumbs a:hover { color: var(--white); text-decoration: underline; }
.crumbs [aria-current] { color: var(--green-100); }

/* ---- the "ed" tile ------------------------------------------------------ */
.ed-tile {
  --fill: var(--primary); --ink-c: var(--white); --edge: var(--fill); --edge-w: 40;
  position: relative; display: inline-grid; place-items: center; flex-shrink: 0;
  width: var(--tile); height: calc(var(--tile) * 1.036);
}
.ed-tile > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ed-tile polygon { fill: var(--fill); stroke: var(--edge); stroke-width: var(--edge-w); stroke-linejoin: round; paint-order: stroke fill;
  transition: fill var(--dur-2) var(--ease), stroke var(--dur-2) var(--ease); }
.ed-tile-in {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-weight: var(--w-semibold); font-size: calc(var(--tile) * .42); line-height: 1;
  color: var(--ink-c); font-variant-numeric: tabular-nums; transform: translate(1%, 3%);
}
.ed-tile.tone-primary { --fill: var(--primary); --ink-c: var(--white); }
.ed-tile.tone-band { --fill: var(--band); --ink-c: var(--green-100); }
.ed-tile.tone-mint { --fill: var(--surface-mint); --ink-c: var(--green-800); }
.ed-tile.tone-outline { --fill: var(--surface); --edge: var(--control-line); --edge-w: 26; --ink-c: var(--muted); }
.ed-tile.is-current { --edge: var(--green-400); --edge-w: 110; }
/* on the dark band the same states read in light */
.on-band .ed-tile.tone-primary { --fill: var(--green-100); --ink-c: var(--green-800); }
.on-band .ed-tile.tone-band { --fill: var(--green-400); --ink-c: var(--green-950); --edge: var(--green-400); }
.on-band .ed-tile.tone-band.is-current { --edge: rgba(91, 210, 154, .35); }
.on-band .ed-tile.tone-mint { --fill: rgba(211, 255, 233, .14); --edge: rgba(211, 255, 233, .14); --ink-c: var(--green-100); }
.on-band .ed-tile.tone-outline { --fill: transparent; --edge: rgba(211, 255, 233, .28); --ink-c: var(--on-band-muted); }

.lesson-tile { position: relative; display: inline-flex; padding: 0; border: 0; background: none; text-decoration: none; border-radius: var(--r-md);
  transition: transform var(--dur-2) var(--ease-spring); }
a.lesson-tile:hover, button.lesson-tile:hover { transform: translateY(-2px) rotate(-2deg); }
.lt-mark {
  position: absolute; top: -5px; right: -7px; display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: var(--r-full);
}
.lt-mark.done { background: var(--surface); color: var(--primary); box-shadow: 0 0 0 1.5px var(--primary); }
.lt-mark.notyet { width: 11px; height: 11px; top: -2px; right: -3px; background: var(--amber); box-shadow: 0 0 0 2px var(--surface); }
.lt-mark.static { position: static; }
.on-band .lt-mark.done { background: var(--green-400); color: var(--green-950); box-shadow: none; }
.on-band .lt-mark.notyet { box-shadow: 0 0 0 2px var(--band); }

/* ---- Skill progress ----------------------------------------------------- */
.skill-progress { display: inline-flex; align-items: center; gap: var(--s-3); min-width: 0; }
.sp-bar { position: relative; width: 168px; height: 8px; border-radius: var(--r-full); background: var(--track); flex-shrink: 0; }
.skill-progress.size-sm .sp-bar { width: 104px; height: 6px; }
.skill-progress.size-lg .sp-bar { width: 240px; height: 10px; }
/* Not mastered yet: a light, striped "in progress" fill, even at 100%
   (mastery also needs every card answered fully right once). Mastered: the
   solid primary bar and the badge, the most complete state. */
.sp-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--r-full); background-color: var(--green-400);
  background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .28) 0 4px, transparent 4px 8px);
  transition: width var(--dur-4) var(--ease); }
.is-mastered .sp-fill { background: var(--primary); }
.is-ready .pip:not(.done) { border-color: var(--amber); background: var(--amber-bg); }
.sp-target { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--green-800); opacity: .45; }
.sp-value { font: var(--t-label); min-width: 38px; text-align: right; color: var(--ink); }
.is-blank .sp-value { color: var(--muted); }
.skill-progress.size-sm .sp-value { min-width: 34px; font-size: 12px; }
.sp-cards { display: inline-flex; gap: 4px; }
.pip { width: 8px; height: 8px; border-radius: var(--r-full); border: 1.5px solid var(--control-line); background: var(--surface); }
.pip.done { background: var(--primary); border-color: var(--primary); }
.mastered-badge {
  display: inline-flex; align-items: center; gap: var(--s-2); height: 26px; padding: 0 var(--s-3) 0 var(--s-1);
  border-radius: var(--r-full); background: var(--surface-mint); color: var(--green-800); font: var(--t-label); white-space: nowrap;
}
.mastered-badge.small { height: 22px; font-size: 12px; gap: 6px; }
.mastered-badge .ed-tile-in { font-size: inherit; }
.on-band .sp-bar { background: rgba(211, 255, 233, .16); }
.on-band .sp-fill { background-color: rgba(91, 210, 154, .55); }
.on-band .is-mastered .sp-fill, .on-band.is-mastered .sp-fill { background: var(--green-400); }
.on-band .sp-target { background: var(--green-100); opacity: .7; }
.on-band .sp-value { color: var(--green-50); }
.on-band .pip { border-color: rgba(211, 255, 233, .4); background: transparent; }
.on-band .pip.done { background: var(--green-400); border-color: var(--green-400); }
.on-band .mastered-badge { background: var(--green-400); color: var(--green-950); }

/* ---- technology tag (the printed paper and projector use the same spec) - */
.tech-tag {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 var(--s-3) 0 var(--s-2);
  border-radius: var(--r-sm); font: var(--t-caption); font-weight: var(--w-semibold); white-space: nowrap;
  color: var(--primary); border: 1.5px solid var(--primary); background: var(--surface);
}
.tech-tag.free { background: var(--surface-mint); border-color: var(--surface-mint); color: var(--green-800); }

/* ---- maths ---------------------------------------------------------------- */
.frag { opacity: 0; transition: opacity var(--dur-2) var(--ease); }
.frag.ready { opacity: 1; }
.q-part { display: flex; gap: var(--s-3); align-items: flex-start; }
.q-part > b { font-weight: var(--w-semibold); min-width: 2em; padding-top: 2px; }
.q-part-in { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.step-heading { font: var(--t-label); color: var(--primary); letter-spacing: .01em; padding: var(--s-3) 0 var(--s-1) 2px; }
.step-heading:first-child { padding-top: 0; }

/* ---- states ------------------------------------------------------------- */
.skeleton { display: block; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--track) 0%, var(--green-50) 50%, var(--track) 100%); background-size: 200% 100%;
  animation: shimmer-x 1.4s linear infinite; }
.skeleton.line { height: 12px; }
.skeleton.title { height: 36px; width: 36%; }
.skeleton.block { width: 100%; height: 160px; border-radius: var(--r-lg); }
.skeleton.w20 { width: 20%; } .skeleton.w40 { width: 40%; height: 18px; } .skeleton.w60 { width: 60%; } .skeleton.w90 { width: 90%; }
.skeleton.on-dark { background: linear-gradient(90deg, rgba(211, 255, 233, .08) 0%, rgba(211, 255, 233, .16) 50%, rgba(211, 255, 233, .08) 100%); background-size: 200% 100%; }
.skeleton-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-4); }
@keyframes shimmer-x { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-3); padding: var(--s-12) var(--s-6); }
.empty-state.compact { padding: var(--s-6); }
.es-art { position: relative; width: 120px; height: 96px; display: grid; place-items: center; margin-bottom: var(--s-2); }
.es-art .ed-tile, .es-logo { transform: rotate(-4deg); animation: rise var(--dur-3) var(--ease); }
.es-dot { position: absolute; width: 14px; height: 14px; background: var(--green-400);
  clip-path: polygon(4.3% 20.6%, 83.5% 0%, 92.1% 5.4%, 100% 82.1%, 96% 87%, 27.5% 99.8%, 22.2% 95.7%, 0% 28.1%); }
.es-dot.a { left: 8px; top: 18px; transform: rotate(12deg); }
.es-dot.b { right: 6px; top: 6px; width: 10px; height: 10px; background: var(--green-200); }
.es-dot.c { right: 14px; bottom: 6px; width: 18px; height: 18px; background: var(--surface-mint); }
.es-title { font: var(--t-h3); }
.es-body { color: var(--muted); max-width: 52ch; }
.es-action { margin-top: var(--s-3); }

.error-card { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5);
  background: var(--error-bg); border: 1px solid rgba(196, 78, 56, .28); border-radius: var(--r-md); color: var(--error-text); }
.error-card b { display: block; font-weight: var(--w-semibold); }
.error-card p { font: var(--t-body); }
.ec-icon { color: var(--error); flex-shrink: 0; display: inline-flex; }
.form-error { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  background: var(--error-bg); color: var(--error-text); font: var(--t-body); }
.note-attention { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  background: var(--amber-bg); color: var(--amber-text); }
.status-chip { display: inline-flex; align-items: center; gap: var(--s-2); height: 26px; padding: 0 var(--s-3); border-radius: var(--r-full); font: var(--t-caption); font-weight: var(--w-semibold); }
.status-chip::before { content: ''; width: 7px; height: 7px; border-radius: var(--r-full); background: currentColor; opacity: .7; }
.status-chip.draft { background: var(--surface-quiet); color: var(--muted); border: 1px solid var(--line); }
.status-chip.waiting { background: var(--amber-bg); color: var(--amber-text); }
.status-chip.done { background: var(--surface-mint); color: var(--green-800); }

/* ---- dialogs ------------------------------------------------------------ */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: var(--scrim);
  display: flex; align-items: center; justify-content: center; padding: var(--s-8);
  animation: fade var(--dur-2) var(--ease); backdrop-filter: blur(2px);
}
.dialog {
  background: var(--surface); border-radius: var(--r-xl); padding: var(--s-8); width: 560px; max-width: 100%;
  max-height: calc(100vh - 64px); overflow: auto; box-shadow: var(--e4);
  display: flex; flex-direction: column; gap: var(--s-5); animation: pop var(--dur-3) var(--ease);
}
.dialog:focus { box-shadow: var(--e4); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.confirm-dialog { width: 480px; gap: var(--s-3); }
.cd-icon { width: 44px; height: 44px; border-radius: var(--r-full); display: grid; place-items: center; background: var(--surface-mint); color: var(--primary); }
.cd-icon.danger { background: var(--error-bg); color: var(--error); }
.cd-body { color: var(--muted); }
.cd-foot { display: flex; justify-content: flex-end; gap: var(--s-3); margin-top: var(--s-4); }
/* a phone: the two answers full width, one above the other, so long words fit */
@media (max-width: 720px) { .cd-foot { flex-direction: column-reverse; } .cd-foot .btn { width: 100%; } }

/* ---- toasts ------------------------------------------------------------- */
.toasts { position: fixed; left: 50%; bottom: var(--s-6); transform: translateX(-50%); z-index: 300;
  display: flex; flex-direction: column; gap: var(--s-2); align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s-3); min-width: 320px; max-width: 560px;
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--band); color: var(--green-50);
  box-shadow: var(--e4); font: var(--t-body); animation: rise var(--dur-3) var(--ease); }
.toast > svg { color: var(--green-400); flex-shrink: 0; }
.toast.error > svg { color: var(--amber); }
.toast-action { border: 0; background: rgba(211, 255, 233, .14); color: var(--green-100); font: var(--t-label); height: 30px; padding: 0 var(--s-3); border-radius: var(--r-sm); }
.toast-action:hover { background: rgba(211, 255, 233, .24); }
.toast-x { border: 0; background: none; color: var(--on-band-muted); width: 28px; height: 28px; border-radius: var(--r-sm); display: grid; place-items: center; }
.toast-x:hover { color: var(--white); }

/* ---- term grid ---------------------------------------------------------- */
.term { position: relative; display: grid; grid-template-columns: 116px repeat(10, minmax(0, 1fr));
  grid-template-rows: 60px 40px 40px; gap: var(--s-2) var(--s-3); align-items: center; }
.term > .rowlabel { font: var(--t-label); color: var(--muted); }
.term .tcell { position: relative; display: flex; justify-content: center; align-items: center; }
/* the current lesson's tile opens the lesson chooser: a drop-down chip under it says so */
.term .tchange { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); width: 18px; height: 18px; border-radius: var(--r-full);
  display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line-strong); color: var(--primary);
  box-shadow: var(--e1); pointer-events: none; transition: background var(--dur-1) var(--ease); }
.term .tcell:hover .tchange { background: var(--surface-mint); }
.term .tcell button.lesson-tile { cursor: pointer; }
/* a quiz sits between the lesson it follows and the lesson it starts (Term.js) */
.term .qslot { display: grid; transform: translateX(calc(-50% - var(--s-3) / 2)); }
.term.compact .qslot { transform: translateX(calc(-50% - 3px)); }
.cell {
  height: 40px; border-radius: var(--r-md); background: var(--track); border: 0; padding: 0;
  display: flex; align-items: center; justify-content: center; gap: var(--s-1);
  font: var(--t-label); color: var(--muted); text-decoration: none;
}
.cell.good { background: var(--surface-mint); color: var(--green-800); }
.cell.low { background: var(--amber-bg); color: var(--amber-text); }
.cell.started { background: var(--surface); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); font: var(--t-caption); text-align: center; line-height: 14px; padding: 0 var(--s-1); }
.cell.tomark { background: var(--amber-bg); color: var(--amber-text); box-shadow: inset 0 0 0 1.5px var(--amber); }
.cell.draft { background: var(--surface); color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line-strong); font-weight: var(--w-medium); }
.cell.link { transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.cell.link:hover { transform: translateY(-1px); box-shadow: var(--e2); }
.cell.tomark.link:hover { box-shadow: inset 0 0 0 1.5px var(--amber), var(--e2); }
.term.compact { grid-template-columns: 64px repeat(10, minmax(0, 1fr)); grid-template-rows: 36px 28px 28px; gap: 6px; }
.term.compact > .rowlabel { font: var(--t-caption); font-weight: var(--w-semibold); }
.term.compact .cell { height: 28px; border-radius: var(--r-sm); font-size: 12px; letter-spacing: -.01em; }
.term.compact .lt-mark.done { width: 14px; height: 14px; top: -4px; right: -6px; }
.term.compact .lt-mark.done svg { width: 8px; height: 8px; }
.term.compact .lt-mark.notyet { width: 8px; height: 8px; }
.lesson-chooser {
  position: absolute; z-index: 20; top: 66px; left: calc(116px + var(--at) * (100% - 116px) / 10 - 60px);
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--e3); border: 1px solid var(--line);
  padding: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); animation: rise var(--dur-2) var(--ease);
}
.lc-grid { display: grid; grid-template-columns: repeat(5, 40px); gap: var(--s-2); }
.lc-grid button { height: 40px; border-radius: var(--r-md); border: 1px solid var(--control-line); background: var(--surface); font: var(--t-label); font-size: 15px; }
.lc-grid button:hover { border-color: var(--primary); background: var(--surface-quiet); }
.lc-grid button[aria-pressed="true"] { background: var(--band); color: var(--green-100); border-color: var(--band); }
.term-legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--line); font: var(--t-caption); color: var(--muted); }
.term-legend > span { display: inline-flex; align-items: center; gap: var(--s-2); }
.term-legend .ed-tile.is-current { --edge-w: 70; }
.swatch { width: 16px; height: 12px; border-radius: 3px; }
.swatch.good { background: var(--surface-mint); box-shadow: inset 0 0 0 1px var(--green-200); }
.swatch.started { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.swatch.low { background: var(--amber-bg); box-shadow: inset 0 0 0 1px rgba(226, 168, 60, .5); }

/* step rows (marking and the marked working) are in screens-marking.css */

/* ---- task list rows (inbox, practice to mark) --------------------------- */
.task-list { list-style: none; margin: 0; padding: 0; }
.task-list > li { display: flex; align-items: center; border-top: 1px solid var(--line); padding-right: var(--s-3); }
.task-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s-4); padding: var(--s-3) var(--s-6); color: var(--ink); text-decoration: none;
  transition: background var(--dur-1) var(--ease); }
.task-row:hover { background: var(--surface-quiet); }
.task-row:hover .tr-go { color: var(--primary); transform: translateX(2px); }
.tr-icon { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--surface-quiet); color: var(--primary); display: grid; place-items: center; flex-shrink: 0; }
.tr-icon.quiz { background: var(--amber-bg); color: var(--amber-text); }
.tr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tr-main b { font-weight: var(--w-semibold); }
.tr-main > span { font: var(--t-caption); color: var(--muted); }
.tr-go { display: inline-flex; align-items: center; gap: var(--s-1); font: var(--t-label); color: var(--muted); transition: transform var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.card-head.pad { padding: var(--s-5) var(--s-6) 0; }
.pad { padding: var(--s-5) var(--s-6); }
.card-more { display: flex; align-items: center; gap: var(--s-1); padding: var(--s-3) var(--s-6); border-top: 1px solid var(--line); font: var(--t-label); text-decoration: none; }
.card-foot { display: flex; gap: var(--s-2); padding-top: var(--s-4); margin-top: var(--s-4); border-top: 1px solid var(--line); }

/* ---- files ---------------------------------------------------------------- */
.bk-files { display: flex; flex-direction: column; }
.file-row { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) 0; border-top: 1px solid var(--line); }
.file-row:first-child { border-top: 0; }
.fr-icon { width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--surface-quiet); color: var(--primary); display: grid; place-items: center; flex-shrink: 0; }
.fr-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fr-name b { font-weight: var(--w-medium); }
.fr-name span { font: var(--t-caption); color: var(--muted); }

/* ---- the student form (dialog) ------------------------------------------ */
.student-dialog { width: 720px; padding: var(--s-6) var(--s-8) var(--s-8); }
.sform { display: flex; flex-direction: column; gap: var(--s-5); }
.sform-head { display: flex; align-items: center; gap: var(--s-4); }
.sform-head h2 { font: var(--t-h2); }
.sform-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4) var(--s-5); }
.sform-sub { margin-bottom: calc(-1 * var(--s-2)); }
.parents { display: grid; grid-template-columns: 1fr 1.6fr 40px; gap: var(--s-3) var(--s-4); align-items: start; }
.parent-remove { align-items: center; }
.sform-same { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s-3); min-height: 44px; padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md); background: var(--amber-bg); color: var(--ink); text-decoration: none; font: var(--t-body); }
.sform-same:hover { box-shadow: inset 0 0 0 1px var(--amber); }
.sform-same > svg { color: var(--primary); flex-shrink: 0; }
.parent-remove .icon-btn { margin-top: 2px; }
.add-row {
  grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s-2); height: 44px; padding: 0 var(--s-4);
  border: 1.5px dashed var(--control-line); border-radius: var(--r-md); background: none; color: var(--primary); font: var(--t-body); font-weight: var(--w-semibold); text-align: left;
}
.add-row:hover { border-color: var(--primary); background: var(--surface-quiet); }
.sform-foot { display: flex; align-items: center; gap: var(--s-2); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.confirm-inline { display: inline-flex; align-items: center; gap: var(--s-3); color: var(--error-text); font-weight: var(--w-semibold); flex-wrap: wrap; }

/* ---- index.html load error -------------------------------------------- */
.load-error { max-width: 640px; margin: 80px auto; padding: var(--s-6) var(--s-8); border-radius: var(--r-lg); background: var(--surface);
  border: 1px solid var(--line-strong); box-shadow: var(--e2); font: var(--t-body); color: var(--ink); display: flex; flex-direction: column; gap: var(--s-2); }
.load-error[hidden] { display: none; }
.load-error pre { white-space: pre-wrap; color: var(--error-text); font-size: 13px; margin: var(--s-3) 0 0; }

/* ---- mastery celebration -------------------------------------------------- */
.celebrate { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--scrim); overflow: hidden; animation: fade var(--dur-2) var(--ease); }
.cel-card { position: relative; z-index: 1; width: min(460px, calc(100vw - 48px)); background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--e4);
  padding: var(--s-10) var(--s-8) var(--s-8); display: flex; flex-direction: column; align-items: center; gap: var(--s-3); text-align: center;
  animation: pop var(--dur-3) var(--ease-spring); }
.cel-card h2 { font: var(--t-h2); }
.cel-card .btn { margin-top: var(--s-3); }
.cel-tile { animation: tile-in var(--dur-4) var(--ease-spring) both; margin-bottom: var(--s-2); }
.cel-tile .ed-tile-in { color: var(--green-400); }
@keyframes tile-in { from { transform: rotate(-30deg) scale(.4); opacity: 0; } to { transform: rotate(-4deg) scale(1); opacity: 1; } }
.cel-bits { position: absolute; inset: 0; pointer-events: none; }
.cel-bit { position: absolute; left: var(--x); bottom: -40px; width: var(--s); height: calc(var(--s) * 1.04); background: var(--green-400);
  clip-path: polygon(4.3% 20.6%, 83.5% 0%, 92.1% 5.4%, 100% 82.1%, 96% 87%, 27.5% 99.8%, 22.2% 95.7%, 0% 28.1%);
  opacity: 0; animation: float-up 2.6s var(--ease) var(--d) forwards; }
.cel-bit:nth-child(3n) { background: var(--green-100); }
.cel-bit:nth-child(3n+1) { background: var(--green-200); }
@keyframes float-up { 0% { opacity: 0; transform: translateY(0) rotate(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-80vh) rotate(var(--r)); } }
@media (prefers-reduced-motion: reduce) {
  .cel-bits { display: none; }
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
/* the bar lines up row to row whatever follows it */
.sk-row .skill-progress .sp-cards, .sk-row .skill-progress .mastered-badge,
.earlier-row .skill-progress .sp-cards, .earlier-row .skill-progress .mastered-badge { min-width: 92px; }
/* eight pips to a line: a skill with more cards wraps rather than pushing its bar left */
.sk-row .skill-progress .sp-cards, .earlier-row .skill-progress .sp-cards { width: 92px; row-gap: 4px; }
.skill-progress .sp-cards { flex-wrap: wrap; }

/* ---- the server is older than the pages (app.js StaleBanner) ------------ */
.stale-banner { position: relative; z-index: 60; display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3);
  align-items: baseline; padding: var(--s-3) var(--gutter); background: var(--amber-bg); color: var(--amber-text);
  font: var(--t-body); border-bottom: 1px solid var(--amber); }
.stale-banner b { font-weight: var(--w-semibold); }
