/* M4M app layout and components. Colours, type, radii and shadows come from tokens.css only. */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Room for the fixed tab bar and a little air above, so a focused item is never scrolled under it */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); scroll-padding-bottom: calc(var(--tabbar-h) + 24px); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-text);
  font-optical-sizing: auto;
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--ink);
  background-color: var(--page-bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font-family: var(--font); color: inherit; }
a { color: var(--cobalt); }
.katex { font-size: 1.1em; }
/* \htmlClass{tx-eps}{…} and \htmlClass{tx-n0}{…} in lesson maths (content/katex-options.js) */
.katex .tx-eps { color: var(--eps-ink); }
.katex .tx-n0 { color: var(--n0-ink); }
:focus-visible { outline: var(--focus-ring); outline-offset: 3px; }
/* On the dark surfaces the ring is sun yellow (6.0:1 on cobalt, 10.5:1 on ink) */
.world, .scope { --focus-color: var(--sun); --focus-ring: 3px solid var(--sun); }
.view:focus { outline: none; }

.skip {
  position: fixed; left: var(--gutter); top: -60px; z-index: 50; /* fixed: it shows on screen from any scroll position */
  background: var(--white); color: var(--cobalt); font-weight: var(--fw-bold);
  padding: 10px 16px; border-radius: var(--r-md); box-shadow: var(--shadow-card);
}
.skip:focus { top: 10px; }

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%; min-height: var(--tap); border: 0; border-radius: var(--r-lg);
  padding: 14px 20px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); text-align: center;
  text-decoration: none; cursor: pointer; color: var(--white); background: var(--cobalt);
  box-shadow: var(--shadow-btn);
  transition: transform var(--ease-press), box-shadow var(--ease-press);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(var(--lip-lg)); box-shadow: 0 0 0 var(--cobalt-deep); }
.btn.small {
  display: inline-flex; align-items: center; justify-content: center; width: auto;
  min-height: 44px; font-size: var(--fs-md); padding: 8px 18px; border-radius: var(--r-md);
  box-shadow: 0 var(--lip-md) 0 var(--cobalt-deep);
}
.btn.small:active { transform: translateY(var(--lip-md)); box-shadow: 0 0 0 var(--cobalt-deep); }
.btn.outline {
  background: var(--white); color: var(--cobalt);
  box-shadow: inset 0 0 0 2.5px var(--sky-deep), 0 var(--lip-lg) 0 var(--sky-deep);
}
.btn.outline:active { box-shadow: inset 0 0 0 2.5px var(--sky-deep), 0 0 0 var(--sky-deep); }
.btn.small.outline { box-shadow: inset 0 0 0 2.5px var(--sky-deep), 0 var(--lip-md) 0 var(--sky-deep); }
.icon-btn {
  border: 0; cursor: pointer; display: inline-grid; place-items: center; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.x-btn {
  width: 44px; height: 44px; flex: none; border-radius: var(--r-md); background: var(--white);
  color: var(--mute); box-shadow: inset 0 0 0 2px var(--sky);
}

/* ---------- shell ---------- */
.app { max-width: var(--column); margin: 0 auto; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 10; height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px; padding: 0 var(--gutter);
  background: var(--paper); border-bottom: 2px solid var(--sky);
}
.brand { text-decoration: none; flex: none; border-radius: var(--r-md); }
/* The logo is the name alone, no blob (Adam, 21 Nov): MinutesForMaths (as in minutesformaths.cz) where
   the bar has room, M4M below that. */
.logo { display: flex; align-items: center; height: 40px; color: var(--cobalt); }
.logo b { font-weight: var(--fw-heavy); font-size: 17px; line-height: 1; letter-spacing: -0.02em; white-space: nowrap; }
.logo-long { display: none; }
@media (min-width: 960px) {
  .logo-short { display: none; }
  .logo-long { display: inline; }
}
.status { margin-left: auto; display: flex; align-items: center; gap: 8px; }
/* The top bar's controls share one height and one flat look: two status pills, then Přihlásit and the account button. */
.streak, .goal-ring {
  display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px 0 6px; border-radius: var(--r-pill);
  font-weight: var(--fw-heavy); font-size: var(--fs-md); white-space: nowrap; font-variant-numeric: tabular-nums; flex: none;
}
.streak { background: var(--sun-tint); }
.streak .ic {
  width: 28px; height: 28px; border-radius: 50%; background: var(--sun); color: var(--ink);
  display: grid; place-items: center;
}
.goal-ring { background: var(--sky-2); }
.goal-ring svg { display: block; width: 28px; height: 28px; flex: none; }
.goal-track { stroke: var(--sky-deep); }
.goal-arc { stroke: var(--blue-light); transition: stroke-dasharray 0.6s var(--ease-pop); }
.goal-ring.met .goal-arc { stroke: var(--sun-deep); }
.goal-ring.zero .goal-arc { visibility: hidden; }
.goal-ring b { display: flex; align-items: baseline; gap: 3px; line-height: 1; }
.goal-ring b small { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--mute); }
.status #login-link {
  min-height: 40px; height: 40px; padding: 0 16px; border-radius: var(--r-pill); font-size: var(--fs-md);
  background: var(--cobalt); color: var(--white); box-shadow: none;
}
.status #login-link:hover { background: var(--cobalt-deep); }
.status #login-link:active { transform: none; }

.view { display: block; padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 8px 12px env(safe-area-inset-bottom);
  display: flex; justify-content: space-around; align-items: center;
  background: var(--white); border-top: 2px solid var(--sky);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 72px; min-height: var(--tap); border-radius: var(--r-md);
  font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--mute); text-decoration: none;
}
.tabbar a.on { color: var(--cobalt); }

/* ---------- path screen ---------- */
.path-screen { padding: 14px 0 0; }
.world {
  position: relative; overflow: hidden; margin: 0 var(--gutter) 8px;
  background: var(--cobalt); color: var(--white); border-radius: var(--r-2xl);
  padding: 16px 16px 18px 20px; box-shadow: 0 var(--lip-xl) 0 var(--cobalt-deep);
  display: flex; gap: 14px; align-items: flex-start;
}
.world .glyph {
  position: absolute; right: 16px; bottom: -48px; font-size: 150px; font-weight: var(--fw-heavy);
  line-height: 1; color: var(--white); opacity: 0.08; pointer-events: none;
}
.world-body { flex: 1; min-width: 0; position: relative; }
.world .k { font-size: var(--fs-md); font-weight: var(--fw-semi); opacity: 0.9; margin: 0 0 3px; }
.world h2 {
  font-size: var(--fs-xl); line-height: var(--lh-tight); font-weight: var(--fw-heavy);
  letter-spacing: var(--track-tight); margin: 0 0 12px;
}
.world .meter { display: flex; align-items: center; gap: 9px; font-size: var(--fs-sm); font-weight: var(--fw-semi); }
.world .meter + .meter { margin-top: 6px; }
.world .meter-k { min-width: 4.6em; }
.world .week-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; min-height: 24px; }
.world .week-link:hover, .world .week-link:focus-visible { text-decoration: underline; }
.world .week-link:focus-visible { outline: var(--focus-ring); outline-offset: 2px; border-radius: 2px; }
.world .meter-exercises .cbar i { background: var(--teal); }
.world .cbar { width: 92px; height: 8px; border-radius: 8px; background: var(--white); background: color-mix(in srgb, var(--white) 25%, transparent); overflow: hidden; }
.world .cbar i { display: block; height: 100%; width: var(--p, 0%); background: var(--sun); border-radius: 8px; }
.unitcard-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 12px; border: 0; cursor: pointer;
  border-radius: var(--r-md); font: inherit; font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--white);
  background: color-mix(in srgb, var(--white) 10%, transparent); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--white) 35%, transparent);
  -webkit-tap-highlight-color: transparent;
}
.unitcard-btn svg { display: block; width: 20px; height: 20px; }
.unitcard-btn:hover { background: color-mix(in srgb, var(--white) 18%, transparent); }
/* The practice set link looks like its button neighbours. */
a.unitcard-btn { text-decoration: none; }

/* The road. --y (px from path.js) times --ys places every stop, wide screens get a wider path and
   more air between stops (Adam, 22 Nov, "too tight"). --x (percent from path.js) is spread from the
   middle by --xs into --cx, so on a big screen the road swings across most of the column. The path
   is a container, so the symbols size from its real width. */
.path {
  --pmax: 420px; --lw: 200px; --ys: 1; --xs: 1;
  position: relative; height: calc(var(--h) * var(--ys)); margin: 0 auto;
  width: calc(100% - 2 * var(--gutter)); max-width: var(--pmax); container-type: inline-size;
}
@media (min-width: 700px) { .path { --pmax: 560px; --lw: 230px; --ys: 1.15; } }
@media (min-width: 960px) { .path { --pmax: 640px; --lw: 250px; --ys: 1.35; } }
/* A computer with room (Adam, 22 Nov, "on web it could be wider"): the column grows up to 900 px, the
   road swings wider and the labels get longer lines, so the stops need less height, not more. */
@media (min-width: 1200px) { .path { --pmax: 900px; --lw: 300px; --ys: 1.1; --xs: 1.3; } }
.path-list > li > * { --cx: calc(50% + (var(--x) - 50%) * var(--xs)); }
.path .trail { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.trail path { fill: none; stroke-linecap: round; }
.trail .road-edge { stroke: var(--road-edge); stroke-width: 30; }
.trail .road { stroke: var(--road); stroke-width: 24; }
.trail .road-marks { stroke: var(--road-marks); stroke-width: 12; stroke-dasharray: 2.5 24; stroke-linecap: butt; }
/* The part already walked, "tady už jsem byla": the stretch fills with the done blue, the marks go white. */
.trail .road-edge.done { stroke: var(--blue-light-deep); }
.trail .road.done { stroke: var(--blue-light); }
.trail .road-marks.done { stroke: var(--white); stroke-opacity: 0.8; }
/* A side path to an optional stop: narrower, with the dashed edge of the optional ring, a detour. */
.trail .road-edge.spur { stroke: var(--dash); stroke-width: 22; stroke-dasharray: 9 7; stroke-linecap: butt; }
.trail .road.spur { stroke: var(--road); stroke-width: 16; }
.trail .road-marks.spur { stroke-width: 8; stroke-dasharray: 2 14; }
.trail .road-edge.spur.done { stroke: var(--blue-light-deep); stroke-dasharray: none; }
.trail .road.spur.done { stroke: var(--blue-light); }
/* Each lesson's maths sign beside its stop, on the outer side, the label is on the other one.
   --room is the space from the node (its ring for the current one) to the path edge plus most of
   the gutter, the text is sized from it and the widest line (--em, from path.js). Quiet and still,
   never a tap target. */
.sym {
  --gap: 9px; --ring: 0px;
  --pw: 100cqw;
  --oxs: calc(50 - (50 - var(--ox)) * var(--xs));
  --room: calc(var(--pw) * var(--oxs) / 100 + var(--gutter) - 4px - var(--r) - var(--ring) - var(--gap));
  position: absolute; top: calc(var(--y) * var(--ys, 1)); transform: translateY(-50%); z-index: 1;
  font-size: clamp(14px, calc(var(--room) * 0.85 / var(--em)), 42px);
  font-weight: var(--fw-heavy); line-height: 1; white-space: pre; color: var(--cobalt); opacity: 0.13;
  pointer-events: none; user-select: none; -webkit-user-select: none;
}
.sym.out-left { right: calc(100% - var(--cx) + var(--r) + var(--ring) + var(--gap)); text-align: right; }
.sym.out-right { left: calc(var(--cx) + var(--r) + var(--ring) + var(--gap)); text-align: left; }
.sym.current { --ring: 17px; opacity: 0.16; }
.sym.done { opacity: 0.19; }
.sym.misty { opacity: 0.15; filter: blur(1.2px); }
/* A misty lesson (review items due): one of the room's mist clouds, about as wide as the stop, over
   its upper outer part and the start of its sign. The label sits on the other side (or under a side
   path stop), so the cloud stays clear of it. It drifts a little around there and can be dragged aside
   (map-mist.js sets --dx and --dy). Only the cloud takes the touch, the rest of the map scrolls as
   before. A tap on it opens the stop, the node keeps the link and its name. */
.pmist {
  position: absolute; top: calc(var(--y) * var(--ys, 1) - var(--r) * 0.62); z-index: 3;
  width: calc(var(--r) * 2.4); transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px)));
  filter: drop-shadow(0 2px 3px color-mix(in srgb, var(--fog-ink) 22%, transparent));
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.pmist.is-held { cursor: grabbing; }
.pmist.out-right { left: calc(var(--cx) + var(--r) * 0.95); }
.pmist.out-left { left: calc(var(--cx) - var(--r) * 0.95); transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scaleX(-1); }
.pmist svg { display: block; width: 100%; height: auto; overflow: visible; pointer-events: none; }
.path-list { list-style: none; margin: 0; padding: 0; }

.node {
  position: absolute; left: var(--cx); top: calc(var(--y) * var(--ys, 1)); transform: translate(-50%, -50%); z-index: 2;
  width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center;
  font-size: var(--fs-2xl); font-weight: var(--fw-heavy); text-decoration: none; line-height: 1;
  --d: var(--lip-xl); --lip: var(--sky-deep);
  background: var(--sky); color: var(--mute);
  box-shadow: 0 var(--d) 0 var(--lip);
  transition: transform var(--ease-press), box-shadow var(--ease-press);
  -webkit-tap-highlight-color: transparent;
}
a.node { cursor: pointer; }
a.node:active { --d: 1px; transform: translate(-50%, calc(-50% + 5px)); }
.node.open { background: var(--white); color: var(--cobalt); box-shadow: inset 0 0 0 4px var(--cobalt), 0 var(--d) 0 var(--cobalt-deep); }
.node.done { background: var(--blue-light); color: var(--white); --lip: var(--blue-light-deep); }
.node.current {
  width: 86px; height: 86px; font-size: 34px; background: var(--white); color: var(--cobalt);
  --lip: var(--cobalt-deep); box-shadow: inset 0 0 0 6px var(--cobalt), 0 var(--d) 0 var(--lip);
}
.node.current::before {
  content: ""; position: absolute; inset: -13px; border-radius: 50%; border: 4px solid var(--sun);
}
/* the ring around the current lesson stays still, like the waiting object in the room (Adam, 21 Nov) */
/* The stop with the call to action (path.js buildCta) keeps that ring, a review stop or the test too. */
.node.cta:not(.current)::before {
  content: ""; position: absolute; inset: -11px; border-radius: 50%; border: 4px solid var(--sun);
}
.node.test.cta::before { inset: 2px; }
/* Its button hangs under the stop, big enough for a thumb, the short line under it. The map is the only
   way into a lesson (Adam, 23 Nov), so this is the one loud button on the map. */
.stop-cta {
  position: absolute; left: var(--cx); top: calc(var(--y) * var(--ys, 1) + var(--r) + 20px); transform: translateX(-50%);
  z-index: 4; display: flex; flex-direction: column; align-items: center; width: max-content; max-width: 220px; text-align: center;
}
.stop-cta.review { top: calc(var(--y) * var(--ys, 1) + var(--r) + 18px); }
/* the test has its name and "bez nápověd" under it, the button comes after them */
.stop-cta.test { top: calc(var(--y) * var(--ys, 1) + var(--r) + 64px); }
/* a side stop (the challenge, when it is the last stop left) has its label under it, the button after it */
.stop-cta.side { top: calc(var(--y) * var(--ys, 1) + var(--r) + 8px + var(--lh)); }
.stop-cta .stop-go {
  display: inline-flex; align-items: center; justify-content: center; width: auto; min-width: 156px; min-height: 52px;
  padding: 10px 26px; border-radius: var(--r-pill); font-size: var(--fs-lg); box-shadow: 0 var(--lip-lg) 0 var(--cobalt-deep);
}
.stop-cta .stop-go:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
.stop-cta .why {
  margin: 8px 0 0; font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--ink-soft); line-height: 1.25;
  text-shadow: 0 0 3px var(--paper), 0 0 6px var(--paper);
}
.node.coming { background: var(--sky); color: var(--mute); }
.node.opt { background: var(--paper); color: var(--mute); border: 3px dashed var(--dash); box-shadow: none; }
.node.opt.open { color: var(--cobalt); border-color: var(--cobalt); }
.node.opt.done { background: var(--blue-light); color: var(--white); border-color: var(--blue-light-deep); }
.node.review { width: 48px; height: 48px; --d: var(--lip-lg); }
.node.review.open { background: var(--sun); color: var(--ink); --lip: var(--sun-deep); box-shadow: 0 var(--d) 0 var(--lip); }
.node.test { width: 96px; height: 96px; border-radius: 0; background: none; box-shadow: none; }
.node.test svg { display: block; overflow: visible; }
.node.test .hex-lip { fill: var(--violet-darker); stroke: var(--violet-darker); }
.node.test .hex-face { fill: var(--violet-deep); stroke: var(--violet-deep); }
.node.test .hex-inner { stroke: var(--violet); }
.node.test .hex-ring { stroke: var(--white); }
.node.test .hex-eps { stroke: var(--sun); }
.node.test .hex-dot { fill: var(--sun); }
.node.test.coming svg, .node.test.locked svg { opacity: 0.45; filter: saturate(0.5); }

.plabel {
  position: absolute; top: calc(var(--y) * var(--ys, 1)); transform: translateY(-50%); z-index: 3;
  text-shadow: 0 0 3px var(--paper), 0 0 6px var(--paper);
}
.plabel.right { left: calc(var(--cx) + var(--r) + 14px); max-width: min(var(--lw), calc(100% - var(--cx) - var(--r) - 18px)); }
.plabel.left { right: calc(100% - var(--cx) + var(--r) + 14px); max-width: min(var(--lw), calc(var(--cx) - var(--r) - 18px)); text-align: right; }
.plabel.below { left: var(--cx); top: calc(var(--y) * var(--ys, 1) + var(--r) + 10px); transform: translateX(-50%); width: 240px; text-align: center; }
/* An optional stop's label hangs under its node on the side path, kept clear of the road at --lane. */
.plabel.under { --lx: calc(50% + (var(--lane) - 50%) * var(--xs)); top: calc(var(--y) * var(--ys, 1) + var(--r) + 8px); transform: none; }
.plabel.under-r { right: calc(100% - var(--cx) - var(--r)); max-width: min(var(--lw), calc(var(--cx) + var(--r) - var(--lx) - 34px)); text-align: right; }
.plabel.under-l { left: calc(var(--cx) - var(--r)); max-width: min(var(--lw), calc(var(--lx) - var(--cx) + var(--r) - 34px)); }
.plabel.under-r .row { justify-content: flex-end; }
.plabel .t { font-weight: var(--fw-bold); font-size: var(--fs-base); line-height: 1.2; }
.plabel .s { font-size: var(--fs-sm); color: var(--mute); margin-top: 2px; }
.plabel.coming .t, .plabel.locked .t { color: var(--ink-dim); font-weight: var(--fw-semi); }
.plabel.current .t { font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.plabel .pill { text-shadow: none; }
.plabel.below .t { font-size: var(--fs-lg); font-weight: var(--fw-heavy); color: var(--violet-deep); }
.plabel .row { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.plabel.left .row { justify-content: flex-end; }
.plabel .row .s { margin: 0; }
.pill {
  display: inline-block; font-size: var(--fs-xs); font-weight: var(--fw-bold); padding: 3px 9px;
  border-radius: var(--r-pill); background: var(--white); color: var(--cobalt);
  box-shadow: inset 0 0 0 2px var(--sky-deep);
}

.fogland { position: relative; margin: 8px var(--gutter) 0; padding: 12px 0 8px; }
.fog-card {
  display: flex; gap: 14px; align-items: center; background: var(--fog); border-radius: var(--r-2xl);
  padding: 18px 20px; color: var(--fog-ink); box-shadow: 0 var(--lip-md) 0 var(--fog-deep);
}
.fog-card .k { margin: 0; font-size: var(--fs-sm); font-weight: var(--fw-semi); }
.fog-card h2 { margin: 0; font-size: var(--fs-lg); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.fog-card .s { margin: 2px 0 0; font-size: var(--fs-sm); }
/* with the wide road the next chapter keeps its 640 px under the road's end, its room would only add height */
@media (min-width: 1200px) { .fogland { width: calc(100% - 2 * var(--gutter)); max-width: 640px; margin-left: auto; margin-right: auto; } }

/* ---------- the week's room under the chapter card (spec 8.4b, js/ui/scene.js) ---------- */
.ward {
  position: relative; margin: 4px var(--gutter) 18px; padding: 8px 8px 10px; background: var(--white);
  border-radius: var(--r-xl); box-shadow: var(--shadow-card);
}
/* The one visually hidden class (same rules as Athena's .sr). .ward-sr is the older name for it. */
.sr, .ward-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ward-art { display: block; width: 100%; height: auto; border-radius: var(--r-lg); user-select: none; -webkit-user-select: none; }
.ward-art text { font-family: var(--font); }
.ward-art .ward-wall { fill: var(--sky-2); }
.ward-art .ward-floor { fill: var(--sky); }
.ward-art .ward-skirting { stroke: var(--sky-deep); }
.ward-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 6px 0; }
.ward-cap b { font-size: var(--fs-md); font-weight: var(--fw-heavy); }
.ward-cap span { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--mute); text-align: right; }
.ward-note {
  margin: 8px 2px 0; padding: 7px 12px; border-radius: var(--r-md); background: var(--sky-2);
  font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--ink-soft);
}
.ward-note.plan { color: var(--mute); }
.ward-art .ward-hit { fill: transparent; stroke: none; pointer-events: all; cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* symbol colours, tokens only */
.ward-art .k-ink { fill: var(--ink); }
.ward-art .k-inksoft { fill: var(--ink-soft); }
.ward-art .k-mute { fill: var(--mute); }
.ward-art .k-white { fill: var(--white); }
.ward-art .k-sky { fill: var(--sky); }
.ward-art .k-sky2 { fill: var(--sky-2); }
.ward-art .k-skydeep { fill: var(--sky-deep); }
.ward-art .k-dash { fill: var(--dash); }
.ward-art .k-cobalt { fill: var(--cobalt); }
.ward-art .k-cobaltdeep { fill: var(--cobalt-deep); }
.ward-art .k-blue { fill: var(--blue-light); }
.ward-art .k-bluedeep { fill: var(--blue-light-deep); }
.ward-art .k-eps { fill: var(--eps-ink); }
.ward-art .k-sun { fill: var(--sun); }
.ward-art .k-sundeep { fill: var(--sun-deep); }
.ward-art .k-coral { fill: var(--coral); }
.ward-art .k-teal { fill: var(--teal); }
.ward-art .k-tealdeep { fill: var(--teal-deep); }
.ward-art .k-violet { fill: var(--violet); }
.ward-art .k-violettint { fill: var(--violet-tint); }
.ward-art .s-ink { stroke: var(--ink); }
.ward-art .s-mute { stroke: var(--mute); }
.ward-art .s-white { stroke: var(--white); }
.ward-art .s-skydeep { stroke: var(--sky-deep); }
.ward-art .s-dash { stroke: var(--dash); }
.ward-art .s-cobalt { stroke: var(--cobalt); }
.ward-art .s-sundeep { stroke: var(--sun-deep); }
.ward-art .s-teal { stroke: var(--teal); }
.ward-art .s-violet { stroke: var(--violet); }
.ward-art .s-violetdeep { stroke: var(--violet-deep); }
/* not yet done: a faint outline, never a padlock */
.ward-art .is-plan * { fill: none; stroke: var(--sky-deep); stroke-width: 1.3px; stroke-dasharray: none; opacity: 1; }
.ward-art .is-plan text { fill: var(--sky-deep); stroke: none; }
.ward-art .is-plan.is-ornament * { stroke: var(--violet-lip); }
.ward-art .is-plan.is-ornament text { fill: var(--violet-lip); }
/* lit: the chapter test is done */
.ward-art .lit { display: none; }
.ward.lit .ward-art .lit { display: inline; }
.ward.lit .ward-art .ward-wall { fill: var(--sun-tint); }
.ward-art .cone { fill: var(--sun); opacity: 0.2; }
.ward-art .glow { fill: var(--sun); opacity: 0.28; }
.ward.lighting .ward-art .ward-wall { animation: ward-warm 1.8s ease both; }
.ward.lighting .ward-art .lit { animation: ward-fade 1.4s ease 0.5s both; }
.ward-art .ward-grow { transform-box: fill-box; transform-origin: 50% 100%; animation: ward-grow 0.7s var(--ease-pop) both; }
@keyframes ward-warm { from { fill: var(--sky-2); } to { fill: var(--sun-tint); } }
@keyframes ward-fade { from { opacity: 0; } }
@keyframes ward-grow { from { opacity: 0; transform: translateY(10px) scale(0.85); } to { opacity: 1; transform: none; } }

/* the next chapter's room under mist */
.room-next { margin-top: 12px; padding: 8px 8px 10px; background: var(--fog); border-radius: var(--r-xl); box-shadow: 0 var(--lip-md) 0 var(--fog-deep); }
.room-next-art { position: relative; border-radius: var(--r-lg); overflow: hidden; }
.room-next-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent, var(--paper)); opacity: 0.75; }
.room-next .ward-art { filter: blur(1.4px); }
.room-next .ward-art .ward-wall { fill: var(--fog); }
.room-next .ward-art .ward-floor { fill: var(--fog-deep); }
.room-next .ward-art .ward-skirting { stroke: var(--fog-deep); }
.room-next:not(.iso-next-room) .ward-art g * { fill: var(--fog-deep); stroke: var(--fog-deep); }
.room-next:not(.iso-next-room) .ward-art g [fill="none"] { fill: none; }
.room-next .ward-cap b { color: var(--fog-ink); font-weight: var(--fw-bold); }
.room-next .ward-cap span { color: var(--fog-ink); }

/* the room in 3D (spec 8.4d, js/ui/iso-room.js): the you-figure, the next object, mist */
.iso-room { padding-top: 4px; }
.iso-art { background: var(--white); cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* standing still it breathes: a slow stretch from the feet up, the feet stay on the floor */
.iso-art .iso-idle { transform-box: fill-box; transform-origin: 50% 100%; animation: iso-idle 2.4s ease-in-out infinite alternate; }
.iso-art .iso-arrive { animation: iso-arrive 0.7s ease 0.15s both; }
.iso-art .iso-cheer .iso-act { animation: iso-cheer 0.6s ease-out 1.1s 2; }
/* the figure's own moves (blob-life.js figureAct): the arms turn at the shoulder, the head looks round */
.iso-arm-l, .iso-arm-r { transform-box: fill-box; transform-origin: 50% 8%; }
.iso-head { transform-box: fill-box; transform-origin: 50% 90%; }
.iso-wave .iso-arm-r { animation: fig-wave 1.1s ease-in-out; }
.iso-look .iso-head { animation: fig-look 1.8s ease-in-out; }
.iso-scratch .iso-arm-l { animation: fig-scratch 1.5s ease-in-out; }
.iso-scratch .iso-head { animation: fig-tilt 1.5s ease-in-out; }
.iso-hop .iso-act { animation: iso-cheer 0.7s ease-out; }
.iso-laugh .iso-act { animation: fig-bob 0.26s ease-in-out 5; }
.iso-laugh .iso-arm-l { animation: fig-up-l 1.3s ease-in-out; }
.iso-laugh .iso-arm-r { animation: fig-up-r 1.3s ease-in-out; }
@keyframes fig-wave { 25% { transform: rotate(-140deg); } 45% { transform: rotate(-118deg); } 65% { transform: rotate(-140deg); } }
@keyframes fig-look { 20%, 40% { transform: translateX(-1.6px) rotate(-6deg); } 60%, 80% { transform: translateX(1.6px) rotate(6deg); } }
@keyframes fig-scratch { 20%, 80% { transform: rotate(165deg); } 35%, 65% { transform: rotate(150deg); } 50% { transform: rotate(168deg); } }
@keyframes fig-tilt { 20%, 80% { transform: rotate(-8deg); } }
@keyframes fig-up-l { 20%, 75% { transform: rotate(140deg); } }
@keyframes fig-up-r { 20%, 75% { transform: rotate(-140deg); } }
/* what it does at an object it walked to (iso-walk.js): points, reads, checks the screen, waters */
.iso-point .iso-arm-r { animation: fig-point 2.2s ease-in-out; }
.iso-read .iso-head { animation: fig-read 2.6s ease-in-out; }
.iso-read .iso-arm-l { animation: fig-hold 2.6s ease-in-out; }
.iso-check .iso-arm-r { animation: fig-tap 2.2s ease-in-out; }
.iso-check .iso-head { animation: fig-tilt 2.2s ease-in-out; }
.iso-water .iso-arm-r { animation: fig-pour 2.4s ease-in-out; }
@keyframes fig-point { 20%, 80% { transform: rotate(-125deg); } }
@keyframes fig-read { 15% { transform: rotate(-5deg); } 35% { transform: translateY(0.6px) rotate(-3deg); } 55% { transform: translateY(1px) rotate(-5deg); } 75% { transform: translateY(0.6px) rotate(-3deg); } }
@keyframes fig-hold { 15%, 85% { transform: rotate(-70deg); } }
@keyframes fig-tap { 20%, 80% { transform: rotate(-110deg); } 40%, 60% { transform: rotate(-100deg); } 50% { transform: rotate(-112deg); } }
@keyframes fig-pour { 20% { transform: rotate(-80deg); } 40% { transform: rotate(-60deg); } 60% { transform: rotate(-80deg); } 80% { transform: rotate(-60deg); } }
/* the walk: the figure faces the viewer, so a step lifts one foot (the leg shortens from the hip) while
   the other stays down, the arms swing a little against the legs and the body bobs once per step.
   The walk itself moves .iso-walk and turns .iso-face with their transform attribute, never with CSS. */
.iso-leg-l, .iso-leg-r { transform-box: fill-box; transform-origin: 50% 0; }
.iso-art .iso-walking .iso-leg-l { animation: fig-step 0.52s ease-in-out infinite; }
.iso-art .iso-walking .iso-leg-r { animation: fig-step 0.52s ease-in-out -0.26s infinite; }
.iso-art .iso-walking .iso-arm-l { animation: fig-swing 0.52s ease-in-out -0.26s infinite; }
.iso-art .iso-walking .iso-arm-r { animation: fig-swing 0.52s ease-in-out infinite; }
.iso-art .iso-walking .iso-act { animation: fig-bob 0.26s ease-in-out infinite; }
.iso-art .iso-walking .iso-idle { animation: none; transform-box: fill-box; transform-origin: 50% 100%; transform: rotate(2deg); }
@keyframes fig-step { 0%, 50%, 100% { transform: none; } 25% { transform: translateY(-0.8px) scaleY(0.78); } }
/* walking away up the screen it shows its back: no collar or badge, hair over the back of the head */
.iso-hair-back { display: none; }
.iso-back .iso-hair-back { display: inline; }
.iso-back .iso-front { display: none; }
@keyframes fig-swing { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes fig-bob { 0%, 100% { transform: none; } 50% { transform: translateY(-0.9px); } }
/* the elevator door: a button over the drawing, its panels slide apart and the figure steps in */
.iso-stage { position: relative; }
.iso-door-btn { position: absolute; padding: 0; border: 0; border-radius: 6px; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.iso-door-l, .iso-door-r { transform-box: fill-box; transition: transform 0.5s ease; }
.iso-door-l { transform-origin: 0 50%; }
.iso-door-r { transform-origin: 100% 50%; }
.iso-door-open .iso-door-l, .iso-door-open .iso-door-r { transform: scaleX(0.12); }
.iso-door-shake { animation: door-shake 0.5s ease-in-out; }
.iso-art .iso-you.iso-enter { transform-box: fill-box; transform-origin: 50% 100%; animation: fig-enter 0.7s ease-in both; }
@keyframes door-shake { 20%, 60% { transform: translateX(-1.2px); } 40%, 80% { transform: translateX(1.2px); } }
@keyframes fig-enter { to { opacity: 0; transform: translate(-7px, -4px) scale(0.9); } }
/* the waiting object stays still, no soft fade in and out (Adam, 21 Nov). The mist stays still too:
   it shows what waits for review, it does not need to bob. It only moves when it clears. */
.iso-art .iso-mist.iso-clearing { animation: iso-clear 1.6s ease-in 0.9s both; }
@keyframes iso-clear { from { opacity: 1; transform: none; } to { opacity: 0; transform: translate(14px, -22px) scale(1.4); } }
.iso-art .iso-chip { animation: iso-fade 0.5s ease 0.8s both; }
.iso-room.lighting .iso-wall-b, .iso-room.lighting .iso-wall-l { animation: ward-fade 1.6s ease both; }
@keyframes iso-idle { to { transform: scaleY(1.018); } }
@keyframes iso-arrive { from { opacity: 0; transform: translate(-12px, -6px); } }
@keyframes iso-cheer { 40% { transform: translateY(-9px); } }
@keyframes iso-fade { from { opacity: 0; } }
/* the lesson end screen: what the lesson just added grows in and shines once */
.lesson-end .iso-reward { margin: 0 0 18px; text-align: left; }
.iso-reward .iso-art { cursor: default; }
.iso-reward .ward-art .ward-grow { animation: ward-grow 0.9s var(--ease-pop) both, iso-shine 2s ease both; }
.iso-reward-cap { display: grid; gap: 2px; padding: 10px 4px 2px; }
.iso-reward-cap b { font-weight: var(--fw-heavy); }
.iso-reward-cap span { color: var(--ink-soft); }
@keyframes iso-shine { 0%, 35% { filter: drop-shadow(0 0 0 transparent); } 60% { filter: drop-shadow(0 0 5px var(--sun)); } 100% { filter: drop-shadow(0 0 0 transparent); } }
/* the blob (spec 8.4f, js/ui/blob.js): squish, blink, freckles, hop, arrival, its bubble */
.blob-body { transform-box: fill-box; transform-origin: 50% 100%; animation: blob-squish 2.2s ease-in-out infinite alternate; }
.blob-eyes { transform-box: fill-box; transform-origin: center; animation: blob-blink 5.2s linear infinite; }
.blob-freckle { animation: blob-twinkle 2.4s ease-in-out infinite alternate; }
.blob-freckle:nth-of-type(2n) { animation-delay: -1.2s; }
.blob-bob { transform-box: fill-box; transform-origin: 50% 100%; }
/* alive (js/ui/blob-life.js): a slow sway, the lean towards the pointer, pupils that follow it */
.blob-sway { transform-box: fill-box; transform-origin: 50% 100%; animation: blob-sway 3.4s ease-in-out infinite alternate; transition: rotate 0.5s ease-out; }
.blob-pupil { transition: translate 0.16s ease-out; }
@keyframes blob-sway { from { transform: rotate(-1.8deg) translateX(-0.6px); } to { transform: rotate(1.8deg) translateX(0.6px); } }
.blob.is-happy .blob-bob { animation: blob-hop 0.6s ease-out 1.9s 3; }
.blob.is-wow .blob-bob { animation: blob-hop 0.5s ease-out 2; }
.blob-meet { animation: blob-arrive 1.2s var(--ease-pop) 1s both; }
.blob-poke .blob-body { animation: blob-jiggle 0.6s ease; }
/* its own little moves every few seconds (blob-life.js nextFidget), bigger in the room where it is small */
.blob-hop .blob-bob { animation: blob-hop 0.65s ease-out; }
.blob-stretch .blob-body { animation: blob-stretch 1.2s ease-in-out; }
.blob-turn .blob-bob { animation: blob-turn 1.5s ease-in-out; }
.iso-blob .blob-sway { animation-name: blob-sway-big; }
.iso-blob .blob-body { animation-name: blob-squish-big; }
@keyframes blob-stretch { 35% { transform: scale(0.92, 1.14); } 65% { transform: scale(1.07, 0.94); } 85% { transform: scale(0.98, 1.02); } }
@keyframes blob-turn { 25% { transform: rotate(-8deg); } 60% { transform: rotate(7deg); } }
@keyframes blob-sway-big { from { transform: rotate(-4deg) translateX(-1.5px); } to { transform: rotate(4deg) translateX(1.5px); } }
@keyframes blob-squish-big { from { transform: scale(1.07, 0.93); } to { transform: scale(0.96, 1.05); } }
/* a few taps and it licks the pointer (blob-life.js tapBlob): the smile opens a little, one quick lap out and back in, like a kitten at its milk, 0.32 s (Adam, 21 Nov) */
.blob-lick-g { display: none; }
.blob-lick .blob-lick-g { display: inline; }
.blob-lick .blob-mouth { opacity: 0; }
/* the animation is set only while it licks: on the tongue itself it ran once, hidden, at page load and
   then sat on its last frame (scaleY .1), so every later lick showed a stub (Adam, 21 Nov: "so tiny") */
.blob-tongue { transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(var(--len, 1)); }
.blob-lick .blob-tongue { animation: blob-lick 0.32s ease-in-out both; }
@keyframes blob-lick {
  0% { transform: scaleY(0.1); }
  40%, 55% { transform: scaleY(var(--len, 1)); }
  100% { transform: scaleY(0.1); }
}
.blob-bubble, .iso-say { transform-box: fill-box; transform-origin: 50% 100%; }
.iso-say { animation: bubble-pop 0.45s var(--ease-pop) 2.1s both; }
.iso-say-tap { animation: bubble-pop 0.35s var(--ease-pop) both; }
.iso-say-idle { animation: bubble-pop 0.35s var(--ease-pop) both; }
/* a bubble fades by itself after a few seconds */
.iso-say-live { transition: opacity 0.5s ease; }
.iso-say-live.iso-say-fade { opacity: 0; }
.iso-art:has(.iso-say-live) .iso-chip { opacity: 0; transition: opacity 0.2s; }
/* a phrase you cannot read yet: pale scribbles behind a little mist */
.blob-bubble.is-mist text { fill: #8A9BD0; letter-spacing: 1px; filter: blur(0.5px); }
.blob-bubble.is-mist path { fill: #F1F4FC; stroke-dasharray: 3 2.5; }
/* after the chapter test the blob's body opens onto the galaxy */
.space-star { animation: blob-twinkle 1.6s ease-in-out infinite alternate; }
.space-star:nth-of-type(2n) { animation-delay: -0.8s; }
.blob-reveal .blob-space { animation: space-open 2.4s ease 2.6s both; }
@keyframes space-open { from { opacity: 0; } 60% { opacity: 1; } to { opacity: 1; } }
.iso-twinkle { transform-box: fill-box; transform-origin: center; animation: iso-twinkle 1.6s ease-in-out infinite alternate; }
.iso-reward-blob { color: var(--ink); font-weight: var(--fw-bold); }
@keyframes blob-squish { from { transform: scale(1.035, 0.965); } to { transform: scale(0.98, 1.025); } }
@keyframes blob-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.12); } }
@keyframes blob-twinkle { from { opacity: 0.5; } to { opacity: 1; } }
@keyframes blob-hop { 45% { transform: translateY(-18px) scale(0.96, 1.05); } 80% { transform: translateY(0) scale(1.06, 0.94); } }
@keyframes blob-arrive { from { opacity: 0; transform: translateY(-90px); } 55% { opacity: 1; transform: translateY(3px); } 75% { transform: translateY(-4px); } to { transform: none; } }
@keyframes blob-jiggle { 25% { transform: scale(1.14, 0.86); } 50% { transform: scale(0.92, 1.1); } 75% { transform: scale(1.04, 0.97); } }
@keyframes bubble-pop { from { opacity: 0; transform: scale(0.3); } to { opacity: 1; transform: none; } }
@keyframes iso-twinkle { from { opacity: 0.35; transform: scale(0.7) rotate(0deg); } to { opacity: 1; transform: scale(1.1) rotate(25deg); } }
/* object tricks (spec 8.4e crazy images, iso-room.js TRICKS): each object does its maths once when it
   grows in and again on a tap, then the trick fades and the room is calm again */
.iso-trick { display: none; pointer-events: none; }
/* a planned piece is only dashed lines, its faces still take a tap (paintedAt in iso-room.js) */
.iso-art .iso-plan :is(rect, polygon, path, ellipse, circle) { pointer-events: visible; }
.trick-play .iso-trick { display: inline; animation: trick-life 3.6s ease var(--td, 0s) both; }
.trick-play .tk-pop { transform-box: fill-box; transform-origin: 50% 100%; animation: tk-pop 0.45s var(--ease-pop) calc(var(--td, 0s) + 0.25s + var(--k) * 0.3s) both; }
.trick-play .tk-hop { animation: tk-hop 0.9s var(--ease-pop) calc(var(--td, 0s) + 0.2s + var(--k) * 0.45s) both; }
.trick-play .tk-flip { animation: tk-flip 0.42s linear calc(var(--td, 0s) + 0.2s + var(--k) * 0.42s) both; }
.trick-play .tk-drop { animation: tk-drop 0.8s ease-in calc(var(--td, 0s) + var(--k) * 0.55s) both; }
.trick-play .tk-spin { animation: tk-spin 2.2s ease-in-out calc(var(--td, 0s) + 0.3s) both; }
.trick-play .tb-bead { animation: tb-rise 2.6s ease-out calc(var(--td, 0s) + 0.15s) both; }
.trick-play .tb-lid { animation: tb-flash 0.3s ease calc(var(--td, 0s) + 0.95s) 3 alternate; }
@keyframes trick-life { 0% { opacity: 0; } 6%, 82% { opacity: 1; } 100% { opacity: 0; } }
@keyframes tk-pop { from { opacity: 0; transform: translateY(4px) scale(0.2); } to { opacity: 1; transform: none; } }
@keyframes tk-hop { from { opacity: 0; transform: translate(0, 4px) scale(0.3); } 55% { opacity: 1; transform: translate(var(--dx), -16px) scale(1); } to { opacity: 1; transform: translate(var(--dx), -12px); } }
@keyframes tk-flip { 0% { opacity: 0; } 15%, 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes tk-drop { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(16px); } }
@keyframes tk-spin { 0% { transform: rotate(0deg); } 35%, 55% { transform: rotate(-90deg); } 90%, 100% { transform: rotate(-180deg); } }
@keyframes tb-rise { 0% { transform: none; } 32% { transform: translateY(-21.5px); } 40% { transform: translateY(-16px); } 50% { transform: translateY(-21.5px); } 58% { transform: translateY(-18px); } 66%, 100% { transform: translateY(-21.5px); } }
@keyframes tb-flash { to { stroke: #fff; stroke-width: 2.6; } }
.iso-next-room .ward-art { filter: none; }
.iso-next-room .room-next-art::after { opacity: 0.45; }
.iso-next-room .ward-art .iso-art, .iso-next-room .iso-art { background: transparent; }

/* ---------- placeholder screens ---------- */
.placeholder {
  margin: 20px var(--gutter); background: var(--white); border-radius: var(--r-xl);
  padding: 22px 20px; box-shadow: var(--shadow-card);
}
.placeholder h1 { margin: 0 0 6px; font-size: var(--fs-xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); line-height: var(--lh-tight); }
.placeholder p { margin: 0 0 18px; color: var(--ink-soft); }

/* ---------- unit card sheet ---------- */
.unitcard {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: var(--column);
  max-height: min(86vh, 720px); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  background: var(--paper); color: var(--ink); box-shadow: 0 -3px 0 var(--sky-deep);
  overflow: hidden; flex-direction: column;
}
.unitcard[open] { display: flex; animation: sheet-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
.unitcard::backdrop { background: var(--overlay); }
.unitcard-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px 12px; border-bottom: 2px solid var(--sky);
}
.unitcard-head h2 { margin: 0; font-size: var(--fs-xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); }
.unitcard-body { overflow-y: auto; padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); }
.unitcard-sec { background: var(--white); border-radius: var(--r-lg); padding: 4px 16px 12px; margin-top: 12px; box-shadow: var(--shadow-card); }
.unitcard-sec h3 { margin: 12px 0 4px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); color: var(--cobalt); }
.unitcard-sec p { margin: 8px 0 0; }
.unitcard-status { color: var(--mute); }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- lesson player ---------- */
body.lesson-mode .topbar, body.lesson-mode .tabbar { display: none; }
body.lesson-mode .view { padding-bottom: 0; }
/* section.lesson, not .lesson: path nodes carry the class "lesson" as their type */
section.lesson { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; padding-bottom: var(--m4m-kb, 0px); }
.lesson-head {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 12px var(--gutter); background: var(--paper); border-bottom: 2px solid var(--sky);
}
.lesson-close { text-decoration: none; }
.lesson-skip {
  flex: none; min-height: 36px; padding: 6px 12px; border: 2px dashed var(--coral, #E5484D); border-radius: var(--r-pill);
  background: transparent; color: inherit; font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-heavy); cursor: pointer;
}
.is-expedition .lesson-skip { color: #fff; }
.lesson-bar { flex: 1; height: 14px; border-radius: var(--r-pill); background: var(--sky); overflow: hidden; }
.lesson-bar i {
  display: block; height: 100%; width: var(--p, 0%); min-width: 14px; border-radius: var(--r-pill);
  background: var(--blue-light); transition: width 0.4s var(--ease-pop);
}
.lesson-body { flex: 1; padding: 18px var(--gutter) 24px; }
.lesson-body:focus { outline: none; }
.lesson-text p { margin: 0 0 12px; font-size: var(--fs-lg); line-height: var(--lh-body); }
.md-display { margin: 4px 0 14px; overflow-x: auto; overflow-y: hidden; }
.lesson-again { display: inline-flex; margin: 0 0 12px; background: var(--sun-tint); color: var(--ink); box-shadow: 0 var(--lip-sm) 0 var(--sun-lip); }
.lesson-resume { display: inline-flex; margin: 0 8px 12px 0; background: var(--violet-tint); color: var(--ink); box-shadow: 0 var(--lip-sm) 0 var(--violet-lip); }
.lesson-applet { margin: 8px 0 16px; }
.lesson-question { margin: 8px 0 0; }
.lesson-status, .lesson-error { color: var(--mute); }
/* "Načítám lekci…" while the lesson player itself loads (ui/player-load.js), placed like the lesson text */
.view-wait { margin: 0; padding: 18px var(--gutter); }
.lesson-foot {
  position: sticky; bottom: var(--m4m-kb, 0px); z-index: 10; padding: 12px var(--gutter) calc(14px + env(safe-area-inset-bottom));
  background: var(--paper); border-top: 2px solid var(--sky);
}
.lesson-actions { display: flex; gap: 10px; }
.lesson-actions .btn { flex: 1; }
/* Short screens (landscape phone, 200% zoom): header and footer scroll with the page so the content keeps the room */
@media (max-height: 520px) {
  .lesson-head, .lesson-foot { position: static; }
}
.btn:disabled { background: var(--sky-deep); color: var(--white); box-shadow: none; cursor: default; transform: none; }
.btn.outline:disabled { background: var(--white); color: var(--mute); box-shadow: inset 0 0 0 2.5px var(--sky); }
.lesson-panel { border-radius: var(--r-lg); padding: 12px 14px; margin: 0 0 12px; max-height: 45vh; overflow-y: auto; }
.lesson-panel p { margin: 0 0 6px; }
.lesson-panel-title { font-weight: var(--fw-heavy); font-size: var(--fs-lg); }
.lesson-panel.good { background: var(--teal-tint); color: var(--ink); }
.lesson-panel.good .lesson-panel-title { color: var(--teal-deep); }
.lesson-panel.hint, .lesson-panel.note { background: var(--sun-tint); }
.lesson-panel.note p:last-child { margin: 0; }
.lesson-panel.reveal, .lesson-panel.self { background: var(--sky-2); }
.lesson-panel.reveal .lesson-panel-title, .lesson-panel.self .lesson-panel-title { color: var(--cobalt); }
.lesson-panel-note { color: var(--ink-dim); font-size: var(--fs-md); }
/* Habit questions. A locked guess gets a neutral panel (never right or wrong), "can't tell" a calm one.
   The checked invent answer is drawn inside the panel, a form note sits under the field. */
.lesson-panel.predict { background: var(--violet-tint); }
.lesson-panel.predict .lesson-panel-title { color: var(--violet-deep); }
/* "Proč?" after a locked guess: teal-deep is too light on the violet tint (4.37:1), the panel's own violet reads. */
.lesson-panel.predict .lesson-why-btn { color: var(--violet-deep); }
.lesson-panel.unsure { background: var(--sky-2); }
.lesson-panel.unsure .lesson-panel-title { color: var(--cobalt); }
.lesson-panel .lesson-plot { margin: 8px 0 4px; background: var(--white); border-radius: var(--r-md); padding: 4px; }
.lesson-panel .lesson-plot .m4m-applet { margin: 0; }
.lesson-habit-note { font-size: var(--fs-md); }
.lesson-form-note { margin: 10px 0 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--sun-tint); font-size: var(--fs-md); }
.lesson-form-note p { margin: 0; }
.lesson-gallery { margin: 16px 0 0; }
.habit-gallery-count { margin: 0 0 6px; font-weight: var(--fw-heavy); }
/* the applet a prediction waits for: drawn, but not live yet */
.lesson-applet.is-held { cursor: default; }
/* reduced motion: the applet shown after the guess comes in without the drop-in or any other move */
.lesson-applet.is-still *, .lesson-applet.is-still *::before, .lesson-applet.is-still *::after { animation: none !important; transition: none !important; }
.lesson-why-btn {
  border: 0; background: none; padding: 6px 0; min-height: 44px; cursor: pointer;
  font-weight: var(--fw-bold); font-size: var(--fs-md); color: var(--teal-deep); text-decoration: underline;
}
.lesson-why { padding: 4px 0 0; }
.lesson-model { background: var(--white); border-radius: var(--r-md); padding: 8px 12px; margin: 0 0 8px; }
.lesson-end { padding: 28px 0 0; text-align: center; }
.lesson-end h1 { margin: 0 0 4px; font-size: var(--fs-2xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); }
.lesson-end-title { margin: 0 0 20px; color: var(--ink-dim); }
.lesson-stats { display: flex; gap: 12px; margin: 0 0 18px; }
.stat {
  flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; border-radius: var(--r-lg);
  background: var(--white); box-shadow: var(--shadow-card);
}
.stat span { font-size: var(--fs-sm); color: var(--mute); font-weight: var(--fw-semi); }
.stat b { font-size: var(--fs-xl); font-weight: var(--fw-heavy); font-variant-numeric: tabular-nums; }
.lesson-end-note, .lesson-sync { color: var(--ink-soft); margin: 0 0 14px; }
.lesson-end .btn { margin: 0 0 14px; }
.lesson-revisit-title { margin: 0 0 10px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.lesson-revisit { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; text-align: left; }
.lesson-revisit a {
  display: flex; align-items: center; min-height: var(--tap); padding: 10px 14px; border-radius: var(--r-lg);
  background: var(--white); box-shadow: var(--shadow-card); color: var(--cobalt); font-weight: var(--fw-bold);
}

/* ---------- question inputs ---------- */
.q-options { display: grid; gap: 10px; }
.q-option, .q-tile, .q-slot {
  font: inherit; font-size: var(--fs-lg); font-weight: var(--fw-semi); color: var(--ink); cursor: pointer;
  min-height: var(--tap); padding: 10px 14px; border: 0; border-radius: var(--r-lg); background: var(--white);
  box-shadow: inset 0 0 0 2.5px var(--sky-deep), 0 var(--lip-md) 0 var(--sky-deep); text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.q-option.sel, .q-tile.sel { background: var(--sky-2); box-shadow: inset 0 0 0 3px var(--cobalt), 0 var(--lip-md) 0 var(--cobalt); }
.q-option.good, .q-tile.good, .q-slot.good { background: var(--teal-tint); box-shadow: inset 0 0 0 3px var(--teal), 0 var(--lip-md) 0 var(--teal-deep); }
.q-option.bad, .q-tile.bad, .q-slot.bad { background: var(--coral-tint); box-shadow: inset 0 0 0 3px var(--coral), 0 var(--lip-md) 0 var(--coral-deep); }
.q-option.answer { outline: 3px dashed var(--teal-deep); outline-offset: -3px; }
.q-option:disabled, .q-tile:disabled, .q-slot:disabled { cursor: default; }
/* A revealed verdict is never colour alone: a small mark in the corner (aria-hidden, the words are in .sr). */
.q-option, .q-tile, .q-slot, .q-typed { position: relative; }
.vmark {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: var(--fw-heavy); line-height: 1;
  color: var(--white); box-shadow: 0 0 0 2px var(--white); pointer-events: none;
}
.vmark.ok { background: var(--teal-deep); }
.vmark.no { background: var(--coral-deep); }
.q-match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.q-col { display: grid; gap: 10px; align-content: start; }
.q-match .q-tile { position: relative; font-size: var(--fs-md); padding-right: 30px; }
.q-match .q-tile[data-pair]:not([data-pair=""])::after {
  content: attr(data-pair) / ""; position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; background: var(--cobalt); color: var(--white);
  font-size: var(--fs-xs); font-weight: var(--fw-heavy); display: grid; place-items: center;
}
.q-build { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 64px; padding: 10px; border-radius: var(--r-lg); background: var(--sky-2); margin: 0 0 14px; }
.q-template { font-size: var(--fs-lg); }
/* First miss: "not quite" for the whole answer, no item marked (spec 8.3). */
.q-build.miss { background: var(--sun-tint); box-shadow: inset 0 0 0 2px var(--sun); }
.q-match.miss { border-radius: var(--r-lg); box-shadow: 0 0 0 6px var(--sun-tint), 0 0 0 8px var(--sun); }
.q-slot { min-width: 64px; background: var(--paper); box-shadow: inset 0 0 0 2.5px var(--dash); }
.q-slot.full { background: var(--white); box-shadow: inset 0 0 0 2.5px var(--sky-deep), 0 var(--lip-sm) 0 var(--sky-deep); }
.q-tray { display: flex; flex-wrap: wrap; gap: 10px; }
.q-typed {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-lg);
  background: var(--white); box-shadow: inset 0 0 0 2.5px var(--sky-deep);
}
.q-typed.good { box-shadow: inset 0 0 0 3px var(--teal); }
.q-typed.bad { box-shadow: inset 0 0 0 3px var(--coral); }
.q-prefix, .q-suffix { flex: none; font-size: var(--fs-lg); }
.q-field { flex: 1; min-width: 0; }
.q-math { display: block; width: 100%; font-size: var(--fs-xl); border: 0; background: transparent; }
/* the switch between the maths keyboard and the phone's own, inside the field where MathLive's
   own keyboard button was (touch screens only, js/ui/questions.js) */
.q-field { position: relative; }
.q-field:has(.q-kb-switch:not([hidden])) .q-math, .q-field:has(.q-kb-switch:not([hidden])) .q-input { padding-right: 52px; }
.q-math::part(virtual-keyboard-toggle) { display: none; }
.q-kb-switch { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--r-md); background: transparent; color: var(--cobalt); opacity: 0.8; cursor: pointer; }
.q-kb-switch.is-own { opacity: 1; }
.q-kb-switch:disabled { opacity: 0.4; cursor: default; }
.q-math::part(menu-toggle) { display: none; }
.q-input, .q-sentence {
  width: 100%; font: inherit; font-size: var(--fs-lg); color: var(--ink); border: 0; background: transparent; padding: 6px 0;
}
.q-sentence { min-height: 96px; padding: 10px 12px; border-radius: var(--r-lg); background: var(--white); box-shadow: inset 0 0 0 2.5px var(--sky-deep); resize: vertical; }

/* ---------- "Správa" (ui/admin.js): calm, large, every control a full tap target, fine at 200 % zoom ---------- */
.admin { margin: 20px var(--gutter); max-width: var(--column); }
.admin h1 { margin: 0 0 8px; font-size: var(--fs-2xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); line-height: var(--lh-tight); }
.admin h2 { margin: 0 0 10px; font-size: var(--fs-xl); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.admin h3 { margin: 20px 0 10px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.admin-intro { margin: 0 0 18px; font-size: var(--fs-base); color: var(--ink-soft); }
.admin-card { background: var(--white); border-radius: var(--r-xl); padding: 20px 18px 22px; margin: 0 0 18px; box-shadow: var(--shadow-card); }
.admin .field { margin: 0 0 16px; }
.admin .field label { font-size: var(--fs-base); }
.admin .field textarea, .admin .field select {
  display: block; width: 100%; min-height: var(--tap); padding: 12px 14px; font: inherit; font-size: var(--fs-lg);
  color: var(--ink); background: var(--white); border: 0; border-radius: var(--r-md); box-shadow: inset 0 0 0 2.5px var(--sky-deep);
}
.admin .field textarea { min-height: 9em; line-height: 1.45; resize: vertical; }
.admin .field input { font-size: var(--fs-lg); }
.admin .field textarea:focus, .admin .field select:focus { outline: none; box-shadow: inset 0 0 0 3px var(--cobalt); }
.admin .field-help { font-size: var(--fs-md); color: var(--ink-dim); }
.admin-count { margin: 6px 0 0; font-size: var(--fs-md); font-weight: var(--fw-semi); color: var(--ink-soft); }
.admin-main { min-height: 60px; }
.admin-results h3 { margin-top: 22px; }
.admin-result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.admin-result-list li {
  padding: 12px 14px; border-radius: var(--r-md); font-size: var(--fs-base); line-height: 1.4; overflow-wrap: anywhere;
  background: var(--teal-tint); box-shadow: inset 5px 0 0 var(--teal-deep);
}
.admin-result-list li.warn { background: var(--sun-tint); box-shadow: inset 5px 0 0 var(--sun-deep); }
.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 0; border-top: 2px solid var(--sky); }
.admin-list li:first-child { border-top: 0; padding-top: 4px; }
.admin-who { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.admin-email, .admin-who strong { font-size: var(--fs-base); overflow-wrap: anywhere; }
.admin-sub { font-size: var(--fs-md); color: var(--ink-soft); }
.admin-code { font-size: var(--fs-md); }
.admin-code b { font-family: var(--font); font-size: var(--fs-lg); letter-spacing: 0.08em; color: var(--cobalt); }
.admin-tag { display: inline-block; padding: 3px 10px; border-radius: var(--r-pill); background: var(--sky); font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--ink-soft); }
.admin-tag.power { background: var(--sun-tint); color: var(--ink); box-shadow: inset 0 0 0 2px var(--sun-deep); }
.admin-row-act { display: flex; flex-wrap: wrap; gap: 10px; flex: 0 1 auto; max-width: 100%; }
.admin-row-act .btn.small { min-height: var(--tap); }
.admin-row-act .teacher-ask { margin: 0; flex: 1 1 100%; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 12px; flex: 1 1 100%; }
.admin-actions .btn { width: auto; flex: 1 1 160px; }
.admin-new-class, .admin-invite { margin: 20px 0 0; padding: 4px 0 0; border-top: 2px dashed var(--dash); }
.admin-check { display: flex; align-items: flex-start; gap: 12px; min-height: var(--tap); padding: 8px 0; margin: 0 0 14px; font-size: var(--fs-base); font-weight: var(--fw-semi); cursor: pointer; }
.admin-check input { flex: none; width: 28px; height: 28px; margin: 0; accent-color: var(--cobalt); }
.admin-msg { margin: 12px 0 0; font-size: var(--fs-base); font-weight: var(--fw-semi); overflow-wrap: anywhere; }
.admin-msg:empty { margin: 0; }
.admin-msg.bad, .admin-mismatch { color: var(--coral-deep); }
.admin-mismatch { margin: 6px 0 0; font-size: var(--fs-md); font-weight: var(--fw-semi); }
.admin-mismatch:empty { margin: 0; }
.admin-empty { margin: 0; color: var(--ink-soft); }
/* The admins: apart from the rest, with a yellow frame and a plain warning, never only by colour */
.admin-power { box-shadow: inset 0 0 0 3px var(--sun-deep), var(--shadow-card); }
.admin-warn { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--sun-tint); color: var(--ink); font-weight: var(--fw-semi); }
.admin-power-btn { min-height: 60px; }
.admin-log summary {
  display: flex; align-items: center; min-height: 60px; padding: 4px 0; cursor: pointer;
  font-family: var(--font); font-size: var(--fs-lg); font-weight: var(--fw-heavy); color: var(--ink);
}
.admin-log-list { list-style: none; margin: 8px 0 0; padding: 0; }
.admin-log-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 2px solid var(--sky); overflow-wrap: anywhere; }

/* ---------- login ---------- */
.auth { padding: 20px var(--gutter) 0; }
.auth h1 { margin: 0 0 12px; font-size: var(--fs-xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); }
.auth > p { margin: 0 0 16px; color: var(--ink-soft); }
.auth > .btn { margin: 0 0 14px; }
.auth-tabs { display: flex; gap: 6px; padding: 5px; border-radius: var(--r-lg); background: var(--sky); margin: 0 0 18px; }
.seg {
  flex: 1; min-height: 44px; border: 0; border-radius: var(--r-md); background: transparent; cursor: pointer;
  font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--ink-dim);
}
.seg[aria-pressed="true"] { background: var(--white); color: var(--cobalt); box-shadow: 0 var(--lip-sm) 0 var(--sky-deep); }
.auth-form .field { margin: 0 0 14px; }
.field label { display: block; font-weight: var(--fw-bold); font-size: var(--fs-md); margin: 0 0 6px; }
.field input {
  display: block; width: 100%; min-height: var(--tap); padding: 10px 14px; font: inherit; font-size: var(--fs-base);
  color: var(--ink); background: var(--white); border: 0; border-radius: var(--r-md); box-shadow: inset 0 0 0 2.5px var(--sky-deep);
}
.field input:focus { outline: none; box-shadow: inset 0 0 0 3px var(--cobalt); }
.field-help { margin: 5px 0 0; font-size: var(--fs-sm); color: var(--mute); }
.auth-error { color: var(--coral-deep); font-weight: var(--fw-semi); min-height: 1em; margin: 0 0 12px; }
.auth-error:empty { margin: 0; }
.auth-privacy, .auth-note { font-size: var(--fs-sm); color: var(--mute); margin: 14px 0 0; }
.auth-note { margin: 0 0 14px; }
.auth-settings { display: inline-block; margin: 4px 0 0; color: var(--cobalt); font-weight: var(--fw-bold); }
/* "Zapomenuté heslo?" and "Zpět na přihlášení": quiet text buttons under the form, still a full tap target */
.auth-link {
  display: block; min-height: var(--tap); margin: 6px 0 0; padding: 8px 0; border: 0; background: transparent;
  color: var(--cobalt); font: inherit; font-size: var(--fs-md); font-weight: var(--fw-bold); cursor: pointer;
}
.auth-link:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.auth-status { margin: 0 0 14px; font-weight: var(--fw-semi); }
.auth-status:empty { margin: 0; }
/* the account screen while the e-mail is not confirmed */
.verify-box { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--r-md); background: var(--sky); font-size: var(--fs-sm); }
.verify-box p { margin: 0 0 8px; }
.verify-box .auth-status { margin: 8px 0 0; }

/* ---------- language: the quiet choice, the settings screen, the Czech-for-now notice ---------- */
.lang-choice { display: inline-flex; gap: 4px; padding: 3px; border-radius: var(--r-pill); background: var(--sky); }
.lang-opt {
  min-width: 44px; min-height: 36px; padding: 4px 10px; border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: transparent; color: var(--mute); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-heavy);
  letter-spacing: 0.04em; -webkit-tap-highlight-color: transparent;
}
.lang-opt[aria-pressed="true"] { background: var(--white); color: var(--cobalt); box-shadow: 0 var(--lip-sm) 0 var(--sky-deep); }
.lang-opt:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.lang-choice.is-quiet { float: right; margin: 0 0 8px 12px; }
.lang-choice.is-settings .lang-opt { min-height: var(--tap); min-width: 64px; font-size: var(--fs-md); }
.lang-note {
  margin: 8px var(--gutter) 0; padding: 8px 12px; border-radius: var(--r-md);
  background: var(--sun-tint); font-size: var(--fs-sm); font-weight: var(--fw-semi);
}
.lang-note[hidden] { display: none; }
/* the quiet reminder above the map while the e-mail is not confirmed */
.verify-note { margin: 8px var(--gutter) 0; font-size: var(--fs-sm); color: var(--mute); }
.verify-note[hidden] { display: none; }
.verify-note a { color: var(--cobalt); font-weight: var(--fw-bold); }
.pair .lang-note, .teacher-live .lang-note, .unitcard-body .lang-note { margin: 0 0 12px; }
.settings { padding: 20px var(--gutter) 0; }
.settings h1 { margin: 0 0 6px; font-size: var(--fs-xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); }
.settings-intro { margin: 0 0 16px; color: var(--ink-soft); }
.settings-list { display: grid; gap: 12px; margin: 0 0 20px; }
.setting { background: var(--white); border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow-card); }
.setting-label { margin: 0 0 10px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.setting-help { margin: 8px 0 0; font-size: var(--fs-sm); color: var(--mute); }
.setting-help[hidden] { display: none; }
.voice-switch {
  display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 4px 16px 4px 6px;
  border: 0; border-radius: var(--r-pill); background: var(--sky); color: var(--mute); cursor: pointer;
  font: inherit; font-size: var(--fs-md); font-weight: var(--fw-heavy); -webkit-tap-highlight-color: transparent;
}
.voice-switch::before {
  content: ''; width: 36px; height: 36px; border-radius: 50%; background: var(--white);
  box-shadow: 0 var(--lip-sm) 0 var(--sky-deep); transition: transform 0.15s ease;
}
.voice-switch[aria-checked="true"] { background: var(--cobalt); color: var(--white); flex-direction: row-reverse; padding: 4px 6px 4px 16px; }
.voice-switch:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }

/* ---------- read aloud: the small play button next to a definition or a blob line ---------- */
.speak-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; margin: 0 2px 0 6px; padding: 0; vertical-align: -7px;
  border: 0; border-radius: 50%; background: var(--sky); color: var(--cobalt); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.speak-btn[hidden] { display: none; }
/* 44 px to tap, 30 px to see: the hit area reaches past the circle */
.speak-btn::before { content: ''; position: absolute; inset: -7px; border-radius: 50%; }
.speak-btn .speak-ico { width: 18px; height: 18px; }
.speak-btn .speak-stop { display: none; }
.speak-btn:hover { background: var(--sky-deep); }
.speak-btn:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.speak-btn.is-playing { background: var(--cobalt); color: var(--white); box-shadow: 0 0 0 3px var(--sky-deep); }
.speak-btn.is-playing .speak-play { display: none; }
.speak-btn.is-playing .speak-stop { display: inline; }
.speak-btn.is-playing::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--cobalt);
  animation: speak-ring 1.4s ease-out infinite; pointer-events: none;
}
@keyframes speak-ring { from { transform: scale(1); opacity: 0.7; } to { transform: scale(1.5); opacity: 0; } }
.speak-btn.is-night { background: rgba(255, 255, 255, 0.14); color: var(--white); }
.speak-btn.is-night:hover { background: rgba(255, 255, 255, 0.26); }
.speak-btn.is-night.is-playing { background: var(--sun); color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35); }
.speak-btn.is-night.is-playing::after { border-color: var(--sun); }
.speak-btn.is-night:focus-visible { outline-color: var(--sun); }
.kw-card .word .speak-btn { margin-left: 2px; }

/* ---------- wide screens: the tab bar becomes a side rail ---------- */
@media (min-width: 960px) {
  .app { padding-left: var(--rail-w); max-width: calc(var(--column) + var(--rail-w)); }
  .tabbar {
    top: 0; right: auto; width: var(--rail-w); height: auto; flex-direction: column;
    justify-content: flex-start; align-items: stretch; gap: 6px; padding: calc(var(--topbar-h) + 16px) 16px 16px;
    border-top: 0; border-right: 2px solid var(--sky);
  }
  .tabbar a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 8px 14px; font-size: var(--fs-md); }
  .tabbar a.on { background: var(--sky-2); }
  .view { padding-bottom: 48px; }
  .unitcard { margin: auto; border-radius: var(--r-sheet); box-shadow: var(--shadow-float); }
  body.lesson-mode .app { padding-left: 0; max-width: var(--column); }
}

/* Reduced motion stops only the big movements (Adam, 21 Nov): the launch flight into a lesson, sheets
   sliding up, the comet crossing the screen, smooth scrolling. The blob, the figure, the room, the
   applets and the small feedback keep moving. It is the device setting unless the student picked
   Full or Reduced in the settings (motion.js sets html[data-motion]). JS: expedition.js skips the
   flight, hospital.js the zoom. */
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) { scroll-behavior: auto !important; }
  html:not([data-motion="full"]) :is(.expo, .expo *, .unitcard[open], .deco-sheet, .kw-sheet, .home-comet, .node.current::before) { animation: none !important; }
}
html[data-motion="reduced"] { scroll-behavior: auto !important; }
html[data-motion="reduced"] :is(.expo, .expo *, .unitcard[open], .deco-sheet, .kw-sheet, .home-comet, .node.current::before) { animation: none !important; }

/* ---------- live pair question and teacher view ---------- */
.pair, .teacher { margin: 20px var(--gutter); max-width: var(--column); }
.pair h1, .teacher h1 { margin: 0 0 8px; font-size: var(--fs-2xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); line-height: var(--lh-tight); }
.pair-phase { color: var(--cobalt); }
.pair-note, .pair-wait { margin: 0 0 14px; color: var(--ink-soft); }
.pair-question { margin: 0 0 14px; font-size: var(--fs-lg); font-weight: var(--fw-semi); }
.pair-question p { margin: 0 0 8px; }
.pair .q-options { margin-bottom: 14px; }
.pair-verdict { margin: 0 0 10px; padding: 10px 14px; border-radius: var(--r-md); font-weight: var(--fw-bold); }
.pair-verdict.good { background: var(--teal-tint); color: var(--teal-deep); }
.pair-verdict.bad { background: var(--coral-tint); color: var(--coral-deep); }
.pair-msg { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--r-md); background: var(--coral-tint); color: var(--coral-deep); font-weight: var(--fw-semi); }
.teacher-live { background: var(--white); border-radius: var(--r-xl); padding: 20px 18px 22px; margin: 0 0 18px; box-shadow: var(--shadow-card); }
.teacher h2 { margin: 0 0 6px; font-size: var(--fs-xl); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.teacher h3 { margin: 0 0 8px; font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--ink-soft); }
.teacher-where { margin: 0 0 14px; font-size: var(--fs-base); color: var(--ink-soft); }
/* The four steps, big and plain: the current one is filled and says "Teď" in words, not by colour alone */
.teacher-steps { list-style: none; counter-reset: step; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.teacher-steps li {
  counter-increment: step; display: flex; align-items: center; gap: 12px; min-height: var(--tap);
  padding: 8px 14px; border-radius: var(--r-md); background: var(--sky-2); color: var(--ink-soft);
  font-size: var(--fs-base); font-weight: var(--fw-semi); line-height: 1.3;
}
.teacher-steps li::before {
  content: counter(step); flex: none; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: var(--r-pill); background: var(--white); color: var(--cobalt); font-family: var(--font);
  font-weight: var(--fw-heavy); font-size: var(--fs-lg); box-shadow: inset 0 0 0 2px var(--sky-deep);
}
.teacher-steps li.done { color: var(--mute); }
.teacher-steps li.done::before { content: "\2713"; color: var(--teal-deep); }
.teacher-steps li.now { background: var(--cobalt); color: var(--white); font-weight: var(--fw-heavy); }
.teacher-steps li.now::before { color: var(--cobalt); box-shadow: none; }
.step-text { flex: 1 1 auto; }
.step-now {
  flex: none; padding: 4px 12px; border-radius: var(--r-pill); background: var(--sun); color: var(--ink);
  font-family: var(--font); font-weight: var(--fw-heavy); font-size: var(--fs-base);
}
.teacher-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 18px; }
.teacher-actions .btn { width: auto; flex: 1 1 220px; min-height: 60px; }
/* Starting over sits apart, under the bars, behind a question */
.teacher-restart { margin: 26px 0 0; padding: 18px 0 0; border-top: 2px solid var(--sky); }
.teacher-restart > .btn { width: auto; min-width: 220px; }
.teacher-ask { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--sun-tint); color: var(--ink); font-weight: var(--fw-semi); }
.teacher-restart .teacher-actions { margin: 0; }
/* "Co přibude": closed by default, dashed like a plan, words only */
.teacher-soon { margin: 0 0 18px; border: 3px dashed var(--dash); border-radius: var(--r-xl); background: var(--sky-2); color: var(--ink-soft); }
.teacher-soon summary {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 12px 18px; cursor: pointer;
  font-family: var(--font); font-size: var(--fs-lg); font-weight: var(--fw-heavy); color: var(--ink); list-style: none;
}
.teacher-soon summary::-webkit-details-marker { display: none; }
.teacher-soon summary::before { content: "+"; display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: var(--r-pill); background: var(--white); color: var(--cobalt); box-shadow: inset 0 0 0 2px var(--sky-deep); font-size: var(--fs-xl); line-height: 1; }
.teacher-soon[open] summary::before { content: "\2212"; }
.teacher-soon p, .teacher-soon ul { margin: 0 18px 14px; font-size: var(--fs-base); }
.teacher-soon ul { padding-left: 22px; display: grid; gap: 8px; }
/* Help one tap away, the hint under the big button, what to tell the class, where the bars will be */
.teacher-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 14px; }
.teacher .teacher-head h1 { margin: 0; }
.teacher-help { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.teacher-help .btn { width: auto; min-height: var(--tap); }
.teacher-navod { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 4px; color: var(--cobalt); font-weight: var(--fw-bold); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.teacher-go { margin: 0 0 18px; }
.teacher-go .teacher-actions { margin: 0 0 8px; }
.teacher-hint { margin: 0; font-size: var(--fs-base); color: var(--ink-soft); }
.teacher-tell { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--r-md); background: var(--sun-tint); color: var(--ink); font-size: var(--fs-base); font-weight: var(--fw-semi); }
.teacher-bars.is-empty { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 3px dashed var(--dash); border-radius: var(--r-lg); background: var(--sky-2); color: var(--ink-soft); }
.teacher-bars.is-empty p { margin: 0; font-size: var(--fs-base); }
.teacher-bars-ic { flex: none; display: grid; color: var(--blue-light); }
.bars-wrap { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.bar-row { display: grid; grid-template-columns: minmax(80px, 1fr) 2fr 2ch; align-items: center; gap: 10px; margin: 0 0 8px; font-weight: var(--fw-semi); }
.bar-track { display: block; height: 22px; border-radius: var(--r-pill); background: var(--sky); overflow: hidden; }
.bar-fill { display: block; height: 100%; min-width: 0; border-radius: var(--r-pill); background: var(--blue-light); transition: width 0.3s ease; }
.bar-row.right .bar-fill { background: var(--teal); }
.bar-row.right .bar-label { color: var(--teal-deep); font-weight: var(--fw-heavy); }
.bar-n { font-variant-numeric: tabular-nums; text-align: right; font-weight: var(--fw-heavy); }
.bar-total { margin: 4px 0 0; font-size: var(--fs-base); color: var(--ink-soft); }
.pair-why { margin: 0 0 14px; color: var(--ink-soft); }
.seminar { margin: 20px var(--gutter); max-width: var(--column); }
.seminar h1 { margin: 0 0 8px; font-size: var(--fs-2xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); line-height: var(--lh-tight); }
.seminar .pair { margin: 0; max-width: none; }
.seminar .pair h2 { margin: 0 0 8px; font-size: var(--fs-xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); line-height: var(--lh-tight); }
.seminar-card { margin-top: 20px; padding: 16px; border-radius: var(--r-lg); background: var(--white); box-shadow: var(--shadow-card); }
.seminar-card h2 { margin: 0 0 8px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.seminar-topic, .seminar-locked { margin: 0 0 14px; color: var(--ink-soft); }
.seminar-card > :last-child { margin-bottom: 0; }

/* ---------- the class minitest (js/ui/minitest-banner.js, minitest.js, teacher-minitest.js) ---------- */
/* The banner sits in the flow above the view, never over the map's controls or clouds. The outer element is
   the live region and stays in the page, empty and without height while there is nothing to say. */
.mt-banner { margin: 0; }
.mt-banner-box {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  margin: 10px var(--gutter) 0; padding: 12px 16px; border-radius: var(--r-lg);
  background: var(--sun-tint); color: var(--ink); box-shadow: inset 0 0 0 2px var(--sun);
}
.mt-banner-box.is-open { background: var(--teal-tint); box-shadow: inset 0 0 0 2px var(--teal); }
.mt-banner-text { margin: 0; font-size: var(--fs-lg); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.mt-banner-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mt-banner-go { width: auto; min-width: 120px; min-height: var(--tap); }
/* the quiet mark on the Seminář tab while a minitest is planned or open */
.tabbar a { position: relative; }
.tab-dot {
  position: absolute; top: 4px; left: calc(50% + 8px); width: 11px; height: 11px; border-radius: 50%;
  background: var(--coral); box-shadow: 0 0 0 2px var(--white);
}
@media (min-width: 960px) {
  .mt-banner-box { margin: 10px auto 0 calc(max(0px, (100% - var(--box) - var(--rail-w)) / 2) + var(--rail-w) + var(--gutter)); max-width: calc(672px - 2 * var(--gutter)); }
  body.map-wide .mt-banner-box { max-width: calc(var(--box) - 2 * var(--gutter)); }
  .tab-dot { position: static; order: 3; margin-left: auto; flex: none; }
}

/* the student's test: large type, one question per screen */
.minitest { margin: 20px var(--gutter) 32px; max-width: var(--column); }
.minitest h1 { margin: 0 0 10px; font-size: var(--fs-2xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); line-height: var(--lh-tight); }
.minitest h1:focus { outline: none; }
.minitest h1.minitest-step { font-size: var(--fs-xl); }
.minitest-kicker { margin: 0 0 10px; color: var(--ink-soft); font-weight: var(--fw-bold); }
.minitest-bar { height: 12px; margin: 0 0 18px; border-radius: var(--r-pill); background: var(--sky); overflow: hidden; }
.minitest-bar i { display: block; height: 100%; width: var(--p, 0%); border-radius: var(--r-pill); background: var(--blue-light); }
.minitest-note, .minitest-size { margin: 0 0 14px; font-size: var(--fs-lg); color: var(--ink-soft); line-height: var(--lh-body); }
.minitest-count { margin: 0 0 14px; font-size: var(--fs-2xl); font-weight: var(--fw-heavy); font-variant-numeric: tabular-nums; }
.minitest-rules { margin: 0 0 22px; padding-left: 22px; display: grid; gap: 8px; font-size: var(--fs-lg); line-height: var(--lh-body); }
.minitest-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 0; }
.minitest-actions .btn { width: auto; flex: 1 1 180px; min-height: 60px; }
.minitest-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.minitest-item {
  display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; min-height: var(--tap);
  padding: 10px 14px; border: 0; border-radius: var(--r-md); background: var(--white); box-shadow: inset 0 0 0 2px var(--sky-deep);
  font: inherit; font-size: var(--fs-base); color: var(--ink); text-align: left; cursor: pointer;
}
.minitest-item-n { font-weight: var(--fw-bold); }
.minitest-item.is-done .minitest-item-state { color: var(--teal-deep); font-weight: var(--fw-bold); }
.minitest-item.is-empty .minitest-item-state { color: var(--ink-soft); }
.minitest-handin { margin: 18px 0 0; }
.minitest-done { margin: 24px 0; padding: 28px 20px; border-radius: var(--r-xl); background: var(--teal-tint); text-align: center; }
.minitest-done h1 { margin: 10px 0 10px; }
.minitest-done .btn { width: auto; min-width: 220px; }
.minitest-done-mark {
  display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: var(--white); color: var(--teal-deep); font-size: 36px; font-weight: var(--fw-heavy);
}
.minitest-score { margin: 0 0 8px; font-size: var(--fs-2xl); font-weight: var(--fw-heavy); }
.minitest-problems { margin: 0 0 20px; padding-left: 22px; font-size: var(--fs-lg); display: grid; gap: 4px; }
.minitest-solved { margin: 0 0 18px; padding: 16px; border-radius: var(--r-lg); background: var(--white); box-shadow: var(--shadow-card); }
.minitest-solved h2 { margin: 0 0 10px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.minitest-solved .lesson-panel { max-height: none; margin: 12px 0 0; }
.minitest-verdict { margin: 10px 0 0; font-weight: var(--fw-bold); }
.minitest-verdict.ok { color: var(--teal-deep); }
.minitest-verdict.no { color: var(--coral-deep); }

/* the teacher's section, in the card of the pair question */
.mt-now { margin: 0 0 16px; padding: 16px; border-radius: var(--r-lg); background: var(--sky-2); }
.mt-now.is-open { background: var(--teal-tint); }
.mt-now-title { margin: 0 0 4px; font-size: var(--fs-xl); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.mt-clock { margin: 0 0 8px; font-size: 3rem; font-weight: var(--fw-heavy); font-variant-numeric: tabular-nums; line-height: 1.1; }
.mt-elapsed { margin: 4px 0; font-size: var(--fs-lg); }
.mt-handed { margin: 4px 0 0; font-size: var(--fs-xl); font-weight: var(--fw-heavy); }
.mt-now .teacher-restart { margin-top: 16px; }
.mt-now .teacher-actions { margin: 12px 0 0; }
.mt-close { min-height: 64px; font-size: var(--fs-lg); }
.mt-results { margin: 0 0 22px; }
.mt-results h3:focus { outline: none; }
.mt-results-when, .mt-average { margin: 0 0 8px; font-size: var(--fs-base); color: var(--ink-soft); }
.mt-average { color: var(--ink); font-weight: var(--fw-bold); }
.mt-bars { display: grid; gap: 12px; margin: 12px 0 14px; }
.mt-bar .bar-row { grid-template-columns: minmax(90px, 1fr) 2fr 5ch; margin: 0 0 2px; }
.mt-bar-note, .mt-bar-topics { margin: 0; font-size: var(--fs-sm); color: var(--ink-soft); }
.mt-next { margin: 0; }
.mt-next-q { margin: 6px 0 0; }

/* The student's minitest: the warning before the start, the notice after a return, the question text that
   cannot be selected (answer fields and the maths keyboard keep theirs, screen readers read it all). */
.mt-warn { margin: 0 0 22px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--sun-tint); box-shadow: inset 4px 0 0 var(--sun-deep); }
.mt-warn p { margin: 0 0 6px; font-size: var(--fs-base); line-height: var(--lh-body); }
.mt-warn .mt-warn-main { font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.mt-warn .mt-warn-privacy { margin: 0; font-size: var(--fs-sm); color: var(--ink-soft); }
.mt-left-notice { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--r-md); background: var(--sky); color: var(--ink); font-size: var(--fs-base); font-weight: var(--fw-semi); }
.minitest-guard .lesson-text, .minitest-guard .minitest-kicker, .minitest-guard h1, .minitest-guard .lesson-question label,
.minitest-guard .lesson-question .choice, .minitest-guard .lesson-question p { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.minitest-guard input, .minitest-guard textarea, .minitest-guard math-field, .minitest-guard [contenteditable] { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.minitest-class-avg { margin: 0 0 12px; font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--ink-soft); }
.seminar-avg { color: var(--ink-soft); }

/* The teacher's live alarm while the round runs: large text, newest first. */
.mt-alarm { margin: 16px 0 0; padding: 14px 16px; border-radius: var(--r-lg); background: var(--white); box-shadow: inset 0 0 0 2px var(--coral-tint); }
.mt-alarm-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 0 8px; }
.mt-alarm-head h3 { margin: 0; font-size: var(--fs-xl); }
.mt-sound { width: auto; }
.mt-sound[aria-pressed="true"] { background: var(--cobalt); color: var(--white); box-shadow: none; }
.mt-alarm-none { margin: 0; font-size: var(--fs-lg); color: var(--ink-soft); }
.mt-alarm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mt-alarm-item { padding: 10px 12px; border-radius: var(--r-md); background: var(--coral-tint); font-size: var(--fs-xl); line-height: 1.3; }
.mt-alarm-item.is-out { box-shadow: inset 4px 0 0 var(--coral-deep); }
.mt-alarm-item.is-copy, .mt-alarm-item.is-foreign { background: var(--sun-tint); }
.mt-alarm-name { font-weight: var(--fw-heavy); }
.mt-alarm-sub { margin: 14px 0 6px; font-size: var(--fs-lg); }
.mt-alarm-students { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: var(--fs-lg); }
.mt-alarm-students .is-out strong { color: var(--coral-deep); }

/* The class summary of a closed round. */
.mt-summary { margin: 0 0 16px; }
.mt-summary-avg { margin: 0 0 4px; font-size: var(--fs-xl); font-weight: var(--fw-heavy); }
.mt-summary-spread { margin: 0 0 10px; font-size: var(--fs-base); color: var(--ink-soft); }
.mt-bands-title { margin: 0 0 6px; font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--ink-soft); }
.mt-bands-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 420px; }
.mt-band { display: grid; justify-items: center; gap: 2px; }
.mt-band-col { display: flex; align-items: flex-end; width: 100%; height: 56px; border-radius: var(--r-sm); background: var(--sky); overflow: hidden; }
.mt-band-col i { display: block; width: 100%; min-height: 3px; background: var(--blue-light); }
.mt-band-n { font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.mt-band-label { font-size: var(--fs-xs); color: var(--ink-soft); text-align: center; }
.mt-questions { margin: 18px 0 0; }
.mt-questions h4, .mt-leaves h4 { margin: 0 0 8px; font-size: var(--fs-lg); }
.mt-q-list, .mt-q-sub { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mt-q-sub { margin: 8px 0 0 12px; gap: 8px; }
.mt-q-head { margin: 0 0 4px; font-weight: var(--fw-heavy); }
.mt-q-title { margin: 0 0 4px; font-size: var(--fs-base); }
.mt-q-counts { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--ink-soft); }
.mt-q.is-weakest { padding: 8px 10px; border-radius: var(--r-md); background: var(--coral-tint); }
.mt-common { margin: 6px 0 0; }
.mt-common-title { margin: 0 0 2px; font-size: var(--fs-sm); font-weight: var(--fw-bold); }
.mt-common-list { margin: 0; padding-left: 1.4em; display: grid; gap: 2px; }
.mt-common-list li { overflow-wrap: anywhere; }
.mt-common-n, .mt-common-none, .mt-common-other { font-size: var(--fs-sm); color: var(--ink-soft); }
.mt-common-none, .mt-common-other { margin: 2px 0 0; }
.mt-next-common { margin: 6px 0 0; overflow-wrap: anywhere; }
.mt-live-answers { margin: 16px 0 0; padding: 10px 16px; border-radius: var(--r-lg); background: var(--white); }
.mt-live-answers > summary { cursor: pointer; font-weight: var(--fw-bold); min-height: 44px; display: flex; align-items: center; }
.mt-live-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.mt-q-tag { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: var(--r-pill); background: var(--coral-deep); color: var(--white); font-size: var(--fs-xs); font-weight: var(--fw-bold); vertical-align: 2px; }
.mt-stack { display: flex; height: 14px; max-width: 420px; border-radius: var(--r-pill); background: var(--sky); overflow: hidden; }
.mt-stack i { display: block; height: 100%; }
.mt-stack .is-full { background: var(--teal); }
.mt-stack .is-partly { background: var(--sun); }
.mt-stack .is-zero { background: var(--coral); }
.mt-stack .is-empty { background: var(--fog-deep); }
.mt-leaves { margin: 18px 0 0; }
.mt-leaves-none { margin: 0; color: var(--ink-soft); }
.mt-leaves-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mt-leaver { padding: 10px 12px; border-radius: var(--r-md); box-shadow: inset 0 0 0 2px var(--sky); }
.mt-leaver-head { margin: 0 0 4px; font-size: var(--fs-base); }
.mt-leaver-ext { margin: 0 0 4px; font-size: var(--fs-sm); color: var(--ink-soft); }
.mt-leaver-items { margin: 4px 0 0; padding-left: 20px; font-size: var(--fs-sm); display: grid; gap: 2px; }
.mt-sets h3 { margin: 0 0 10px; }
.mt-delay { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; }
.mt-delay-label { font-weight: var(--fw-bold); }
.segs { display: flex; gap: 6px; padding: 5px; border-radius: var(--r-lg); background: var(--sky); }
.segs .seg { flex: none; min-width: 72px; padding: 0 12px; }
.mt-set-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mt-set { padding: 14px; border-radius: var(--r-lg); box-shadow: inset 0 0 0 2px var(--sky); }
.mt-set-name { margin: 0 0 2px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.mt-set-topics, .mt-set-used { margin: 0 0 4px; font-size: var(--fs-sm); color: var(--ink-soft); }
.mt-set .teacher-actions { margin: 10px 0 0; }
.mt-set .teacher-actions .btn { flex: 1 1 160px; min-height: 52px; }
.mt-rounds { margin: 18px 0 0; }
.mt-rounds summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: var(--fw-bold); color: var(--cobalt); }
.mt-rounds ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.mt-round { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; font-size: var(--fs-base); }
.mt-round .btn { width: auto; }
.mt-plan { margin: 12px 0 0; padding: 14px; border-radius: var(--r-lg); background: var(--sky-2); }
.mt-plan-title { margin: 0 0 4px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.mt-plan-row { display: flex; flex-wrap: wrap; gap: 12px 16px; margin: 12px 0; }
.mt-field { flex: 1 1 180px; }
.mt-field-label { display: block; font-weight: var(--fw-bold); font-size: var(--fs-md); margin: 0 0 6px; }
.mt-input {
  width: 100%; min-height: 52px; padding: 8px 12px; font: inherit; font-size: var(--fs-lg);
  border: 0; border-radius: var(--r-md); background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 2.5px var(--sky-deep);
}
.mt-input:focus { outline: none; box-shadow: inset 0 0 0 3px var(--cobalt); }
.mt-field-hint { display: block; margin: 6px 0 0; font-size: var(--fs-md); color: var(--ink-soft); }
.mt-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.mt-steps .mt-step { flex: 1 1 6.5em; min-width: 0; min-height: 48px; }
.mt-plan-read { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--white); font-weight: var(--fw-bold); font-size: var(--fs-base); }
.mt-plan-end { margin: 0; padding: 0; border: 0; }
.mt-plan-end legend { padding: 0; font-weight: var(--fw-heavy); font-size: var(--fs-md); }
.mt-plan .pair-msg:focus { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.mt-plan .teacher-actions { margin: 12px 0 0; }
.mt-planned { margin: 0 0 22px; }
.mt-planned h3:focus { outline: none; }
.mt-planned-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.mt-planned-item { padding: 14px; border-radius: var(--r-lg); box-shadow: inset 0 0 0 2px var(--sky); }
.mt-planned-text { margin: 0 0 2px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.mt-planned-end { margin: 0; font-size: var(--fs-base); color: var(--ink-soft); }
.mt-planned-item .teacher-actions { margin: 10px 0 0; }
.mt-planned-item .teacher-actions .btn { flex: 1 1 160px; min-height: 52px; }

/* ---------- the expedition (spec 8.4f, js/ui/expedition.js) ---------- */
/* the launch: a short flight to the lesson's planet. Light to play (Adam, 21 Nov: it lagged): only
   transform and opacity move, each on a whole layer of its own (two star halves, glyphs, the planet,
   the tool's orbit, the moons, the ship), never inside an svg, so the compositor plays it all. More fun
   (Adam, 22 Nov: it can be longer, it must not lag): the header's ship streaks in, the tool drops from
   its orbit onto the planet, the blob hops, then the sky closes into the header and the ship flies to
   its place on the progress bar. --launch is LAUNCH_MS, set by expedition.js, the landing is timed to
   it (2.05 s to 2.7 s of 3.4 s). The ship and the dock are Web Animations in expedition.js. */
.expo { position: fixed; inset: 0; z-index: 100; overflow: hidden; cursor: pointer; color: #fff; container-type: size; animation: expo-in 0.3s ease both; }
.expo.is-out { animation: expo-out 0.38s ease forwards; pointer-events: none; }
/* reduced motion: the still sky, it only fades away (expedition.js calmLaunch) */
.expo.is-calm { pointer-events: none; }
.expo.is-calm, .expo.is-calm * { animation: none !important; }
.expo.is-calm .expo-orbit { display: none; }
.expo-clip, .expo-scene { position: absolute; inset: 0; transform-origin: 0 0; }
.expo-clip { overflow: hidden; }
.expo-scene {
  background:
    radial-gradient(circle at 18% 22%, rgba(106, 76, 245, 0.45), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(22, 179, 163, 0.35), transparent 45%),
    radial-gradient(ellipse at 50% 55%, #1B2A78 0%, #0B1440 55%, #050A24 100%);
}
.expo-sky { position: absolute; inset: 0; width: 100%; height: 100%; }
.expo-stars { position: absolute; inset: 0; transform-origin: 50% 52%; animation: expo-warp var(--launch, 3.4s) cubic-bezier(0.5, 0, 0.75, 0) both; }
.expo-twinkle { animation: sky-twinkle 1.1s ease-in-out infinite alternate; }
.expo-twinkle + .expo-twinkle { animation-delay: -1.1s; }
/* the end of the drift is the resting style, so it can fill backwards only and the dock's fade has the layer to itself */
.expo-glyphs { opacity: 0.28; transform: scale(1.08); transform-origin: 50% 52%; animation: expo-drift var(--launch, 3.4s) ease-in backwards; }
@keyframes expo-drift { from { opacity: 0; transform: scale(0.94); } 30% { opacity: 0.28; } to { opacity: 0.28; transform: scale(1.08); } }
/* The planet's world: the sky svg scales its 1200 by 640 view by u to cover the screen (slice), the
   planet sits at (187.5, 330) in it, 10 units below the middle, and its world is 280 units wide. One
   planet unit is u px everywhere inside it. */
.expo-world {
  --u: max(calc(100cqw / 1200), calc(100cqh / 640));
  position: absolute; left: 50%; top: calc(50% + 10 * var(--u));
  width: calc(280 * var(--u)); height: calc(280 * var(--u)); margin: calc(-140 * var(--u)) 0 0 calc(-140 * var(--u));
  animation: expo-zoom var(--launch, 3.4s) cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.expo-planet { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; animation: expo-appear 0.85s ease both; }
.expo-tool { position: absolute; left: calc(-14 * var(--u)); top: calc(-14 * var(--u)); width: calc(28 * var(--u)); height: calc(28 * var(--u)); overflow: visible; }
/* The orbit: 108 by 34 units. The outer layer squashes a circle into that ellipse, the arm turns, the
   ride turns back and stretches back, so the tool goes round upright. It leaves the orbit at 2 s. */
.expo-orbit { position: absolute; left: 50%; top: 50%; transform: scaleY(0.3148); }
.expo-near { position: absolute; left: -10%; right: -10%; top: 50%; height: 40%; overflow: hidden; }
.expo-near .expo-orbit { top: 0; }
.expo-arm, .expo-ride { position: absolute; left: 0; top: 0; }
.expo-arm { animation: expo-arm 3.2s linear infinite; }
/* the ride is as wide as the orbit's radius, so translateX(100%) takes it out there without var() in keyframes */
.expo-ride { width: calc(108 * var(--u)); height: 0; transform-origin: 0 0; animation: expo-ride 3.2s linear infinite, expo-leave 0.3s ease 2s forwards; }
/* one opacity animation per layer, else neither runs on the compositor: the tool glows, its carrier leaves */
.expo-ride .expo-tool { animation: tool-glow 0.9s ease-in-out infinite alternate; }
.expo-moon { position: absolute; left: 50%; top: 50%; animation: moon-orbit 5.2s linear infinite, expo-appear 0.85s ease both; }
.expo-moon.m1 { animation-delay: -2.6s, 0s; }
.expo-moon i {
  position: absolute; left: calc((var(--mx) - var(--mr)) * var(--u)); top: calc((var(--my) - var(--mr)) * var(--u));
  width: calc(2 * var(--mr) * var(--u)); height: calc(2 * var(--mr) * var(--u)); border-radius: 50%; background: #E7EBF6;
}
/* The landing: the tool drops onto the top of the planet, squashes, a ring and five sparks go off. */
.expo-land { position: absolute; left: 50%; top: calc(50% - 74 * var(--u)); }
/* the landing tool is 28 units square, so the drop of 90 units is translateY(-320%) */
.expo-landing { position: absolute; left: calc(-14 * var(--u)); top: calc(-14 * var(--u)); width: calc(28 * var(--u)); height: calc(28 * var(--u)); transform-origin: 50% 86%; animation: expo-drop 0.62s 2.05s both; }
.expo-landing .expo-tool { left: 0; top: 0; width: 100%; height: 100%; animation: tool-glow 0.9s ease-in-out 2.7s infinite alternate; }
.expo-ring {
  position: absolute; left: calc(-34 * var(--u)); top: calc(2 * var(--u)); width: calc(68 * var(--u)); height: calc(16 * var(--u));
  border: calc(2.2 * var(--u)) solid #FFE27A; border-radius: 50%; opacity: 0; animation: expo-ring 0.7s ease-out 2.45s;
}
.expo-sparks { position: absolute; left: 0; top: calc(6 * var(--u)); }
/* each spark's direction is a still turn of its wrapper, the spark itself only flies out along x */
.expo-sparks > i { position: absolute; left: 0; top: 0; }
.expo-sparks b {
  position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; background: #FFE27A; opacity: 0;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: expo-spark 0.7s ease-out 2.48s;
}
.expo-sparks > i:nth-child(even) b { background: #fff; }
.expo-text { position: absolute; top: max(12vh, 64px); left: 0; right: 0; padding: 0 24px; text-align: center; animation: rise-in 0.6s ease 0.35s both; }
.expo-kicker { margin: 0 0 6px; color: #FFE27A; font-size: var(--fs-sm); font-weight: var(--fw-heavy); letter-spacing: 0.16em; text-transform: uppercase; }
.expo-title { margin: 0; font-size: var(--fs-2xl); font-weight: var(--fw-heavy); line-height: var(--lh-tight); letter-spacing: var(--track-tight); text-wrap: balance; }
.expo-hint { position: absolute; left: 0; right: 0; bottom: max(17vh, 120px); margin: 0; padding: 0 24px; text-align: center; color: rgba(255, 255, 255, 0.86); font-size: var(--fs-md); font-weight: var(--fw-semi); animation: rise-in 0.6s ease 1s backwards; }
.expo-blob { position: absolute; left: 50%; bottom: max(4vh, 20px); width: 84px; margin-left: -42px; animation: expo-peek 0.8s var(--ease-pop) 0.8s both; }
.expo-hop { transform-origin: 50% 100%; animation: expo-hop 0.6s ease-out 2.55s both; }
.expo-blob svg { display: block; width: 100%; }
/* the blob rides as one picture in the flight, its own little moves wait for the lesson */
.expo-blob .blob-svg * { animation: none !important; }
/* The ship: a Web Animation brings it in (expedition.js shipFlight), it hovers, then docks. */
/* off screen until its Web Animation holds it at the start of the streak */
.expo-ship { position: absolute; left: 0; top: 0; width: 52px; height: 33px; margin: -16.5px 0 0 -26px; transform: translate(-200px, -200px); pointer-events: none; }
.expo-ship-in { position: absolute; inset: 0; animation: expo-bob 0.9s ease-in-out 1.95s infinite alternate; }
.expo-ship-in svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.expo-trail {
  position: absolute; right: 88%; top: 50%; width: 190px; height: 4px; margin-top: -2px; border-radius: 2px; opacity: 0;
  background: linear-gradient(90deg, rgba(255, 226, 122, 0), rgba(255, 226, 122, 0.95)); transform-origin: 100% 50%;
}
.is-docking .expo-ship-in { animation: none; }
/* the lesson under the sky holds its own animations until the dock (expedition.js playLaunch) */
.is-flying .lesson-head *, .is-flying .lesson-body * { animation-play-state: paused !important; }
.expo.expo-warm { visibility: hidden; pointer-events: none; animation: none; }
@keyframes expo-in { from { opacity: 0; } }
@keyframes expo-out { to { opacity: 0; transform: scale(1.08); } }
@keyframes expo-warp { from { transform: scale(1); } to { transform: scale(1.9); } }
@keyframes expo-zoom { from { transform: scale(0.16); } to { transform: scale(1.06); } }
@keyframes expo-appear { from { opacity: 0; } }
@keyframes sky-twinkle { from { opacity: 0.5; } to { opacity: 1; } }
@keyframes moon-orbit { to { transform: rotate(360deg); } }
@keyframes tool-glow { from { opacity: 0.75; } to { opacity: 1; } }
@keyframes expo-arm { from { transform: rotate(180deg); } to { transform: rotate(-180deg); } }
@keyframes expo-ride { from { transform: translateX(100%) rotate(-180deg) scaleY(3.1765); } to { transform: translateX(100%) rotate(180deg) scaleY(3.1765); } }
@keyframes expo-leave { to { opacity: 0; } }
@keyframes expo-drop {
  0% { opacity: 0; transform: translateY(-320%) scale(0.5); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.6); }
  20% { opacity: 1; }
  68% { transform: translateY(0) scale(1.3, 0.7); animation-timing-function: ease-out; }
  84% { transform: translateY(-18%) scale(0.92, 1.1); animation-timing-function: ease-in; }
  100% { opacity: 1; transform: none; }
}
@keyframes expo-ring { from { opacity: 0.9; transform: scale(0.2); } to { opacity: 0; transform: scale(1.7); } }
@keyframes expo-spark { from { opacity: 1; transform: translateX(4px) scale(1); } to { opacity: 0; transform: translateX(46px) scale(0.3); } }
@keyframes expo-peek { from { transform: translateY(130px); } }
@keyframes expo-hop { 0%, 100% { transform: none; } 30% { transform: translateY(-18px) scale(0.96, 1.05); } 55% { transform: translateY(0) scale(1.08, 0.92); } 75% { transform: scale(0.98, 1.02); } }
@keyframes expo-bob { from { transform: translateY(-2.5px); } to { transform: translateY(2.5px); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } }

/* in the lesson: the header is a strip of night sky, the progress bar the flight path */
.is-expedition .lesson-head {
  border-bottom: 0;
  --focus-color: var(--sun); --focus-ring: 3px solid var(--sun);
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.75) 0 1px, transparent 1.6px) 0 0 / 43px 31px,
    radial-gradient(circle at 70% 65%, rgba(255, 255, 255, 0.5) 0 0.8px, transparent 1.4px) 0 0 / 29px 23px,
    linear-gradient(180deg, #0B1440, #16205A);
}
.is-expedition .lesson-close { background: rgba(255, 255, 255, 0.12); color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.22); }
.lesson-track { position: relative; flex: 1; display: flex; align-items: center; min-width: 0; }
.is-expedition .lesson-track { padding: 0 24px 0 14px; height: 34px; }
.is-expedition .lesson-bar { height: 10px; background: rgba(255, 255, 255, 0.14); }
.is-expedition .lesson-bar i { min-width: 10px; background: linear-gradient(90deg, #5ED6C8, #FFC82E); box-shadow: 0 0 10px rgba(255, 200, 46, 0.55); }
.lesson-ship, .lesson-half, .lesson-goal { position: absolute; top: 50%; pointer-events: none; }
.lesson-ship { left: calc(14px + (100% - 38px) * var(--pn, 0)); width: 30px; height: 19px; margin: -10px 0 0 -16px; transition: left 0.45s var(--ease-pop); }
/* During the exercise the header stays calm (Adam, 21 Nov): the ship only drifts a little, the flame
   does not flicker and the goal planet does not pulse. */
.lesson-ship svg { display: block; width: 100%; height: 100%; animation: ship-bob 2.6s ease-in-out infinite alternate; }
.lesson-half { left: calc(14px + (100% - 38px) * 0.5); width: 14px; height: 14px; margin: -7px 0 0 -7px; color: rgba(255, 255, 255, 0.3); }
.lesson-half svg { display: block; width: 100%; height: 100%; }
.lesson-half.is-lit { color: #FFC82E; filter: drop-shadow(0 0 4px #FFC82E); animation: half-burst 0.8s var(--ease-pop); }
.lesson-goal { right: 0; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--goal, #7FA6FF), var(--goal-dark, #0038B8)); box-shadow: 0 0 10px var(--goal, #7FA6FF); }
.lesson-goal.is-orb { background: radial-gradient(circle, #FFF6C9 0 30%, #FFC82E 55%, rgba(255, 200, 46, 0) 72%); box-shadow: none; }
.lesson-copilot { flex: none; width: 42px; height: 36px; margin: -4px -4px -4px 0; }
.lesson-copilot svg { display: block; width: 100%; height: 100%; }
.lesson-copilot .blob.is-happy .blob-bob { animation: blob-hop 0.55s ease-out 0s 2; }
.lesson-copilot .blob.is-wow .blob-bob { animation: blob-hop 0.5s ease-out 0s 3; }
.lesson-copilot .blob.is-curious .blob-body, .lesson-copilot .blob.is-thoughtful .blob-body { animation: blob-tilt 1.6s ease-in-out infinite alternate; }
/* The blob's QED moment (js/ui/qed.js): after the last step of a proof, the lesson's final check and a
   passed chapter test it holds up a little card, stamps it once and settles, all in 1.4 s. Only
   transform and opacity move. With reduced motion (.is-calm) the card only fades, the blob stays put. */
.lesson-copilot { position: relative; }
.lesson-copilot.is-calm .blob-bob { animation: none !important; }
.qed-pop { position: absolute; right: 62%; bottom: 46%; pointer-events: none; }
.qed-card {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px 2px 7px; border: 1.5px solid #0F1C4D; border-radius: 6px;
  background: #FFE27A; color: #0F1C4D; font-family: var(--font); font-size: 11px; font-weight: var(--fw-heavy); line-height: 1.25;
  letter-spacing: 0.06em; white-space: nowrap; box-shadow: 0 2px 0 #0F1C4D;
}
.qed-card b { font-weight: inherit; }
.qed-card i { font-style: normal; font-size: 0.9em; }
.qed-pop .qed-card { transform-origin: 80% 100%; animation: qed-hold 1.4s ease-out both; }
.qed-pop.is-calm .qed-card { animation: qed-fade 1.4s ease both; }
.lesson-qed { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; color: var(--ink); font-weight: var(--fw-heavy); }
.lesson-qed-mark { display: inline-block; font-size: 1.15em; line-height: 1; animation: qed-stamp 0.45s var(--ease-pop) 0.15s both; }
.lesson-qed.is-calm .lesson-qed-mark { animation: qed-in 0.4s ease both; }
.lesson-qed .speak-btn { margin-left: auto; }
.lesson-end > .lesson-qed { justify-content: center; margin: 4px 0 14px; }
.home-qed { position: absolute; right: 18px; bottom: 2px; width: 60px; height: 50px; animation: qed-rise 0.45s var(--ease-pop) both; }
.home-qed svg { display: block; width: 100%; height: 100%; animation: qed-hop 0.4s ease-out 0.85s both; }
.home-qed .qed-card { position: absolute; left: -16px; top: -26px; transform-origin: 70% 100%; animation: qed-show 0.75s var(--ease-pop) 0.4s both; }
.home-qed.is-calm, .home-qed.is-calm svg, .home-qed.is-calm .qed-card { animation: qed-in 0.5s ease both; }
.home-qed.is-calm .blob-bob { animation: none !important; }
@keyframes qed-hold {
  0% { opacity: 0; transform: translate(6px, 10px) scale(0.5) rotate(-14deg); }
  18% { opacity: 1; transform: translate(0, -2px) scale(1.12) rotate(-6deg); }
  30% { transform: translate(0, 0) scale(0.94) rotate(-4deg); }
  38%, 80% { opacity: 1; transform: translate(0, 0) scale(1) rotate(-4deg); }
  100% { opacity: 0; transform: translate(4px, 6px) scale(0.8) rotate(-4deg); }
}
@keyframes qed-show {
  0% { opacity: 0; transform: translateY(14px) scale(0.5) rotate(-14deg); }
  45% { opacity: 1; transform: translateY(-2px) scale(1.14) rotate(-6deg); }
  70% { transform: scale(0.94) rotate(-5deg); }
  100% { opacity: 1; transform: scale(1) rotate(-5deg); }
}
@keyframes qed-fade { 0% { opacity: 0; } 20%, 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes qed-in { from { opacity: 0; } }
@keyframes qed-stamp { 0% { opacity: 0; transform: scale(1.9); } 60% { opacity: 1; transform: scale(0.88); } 100% { transform: none; } }
@keyframes qed-rise { from { opacity: 0; transform: translateY(40px); } }
@keyframes qed-hop { 0%, 100% { transform: none; } 45% { transform: translateY(-7px) scale(0.97, 1.04); } 75% { transform: translateY(0) scale(1.05, 0.95); } }
@keyframes ship-bob { from { transform: translateY(-0.8px); } to { transform: translateY(0.8px); } }
@keyframes half-burst { 0% { transform: scale(1); } 45% { transform: scale(2) rotate(40deg); } 100% { transform: scale(1); } }
@keyframes blob-tilt { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }

/* feedback: a right answer pops with sparks, a comeback shines gold, a hint only tilts */
.lesson-panel.pop { position: relative; overflow: visible; max-height: none; animation: panel-pop 0.45s var(--ease-pop); }
.lesson-panel.gold { background: var(--sun-tint); }
.lesson-panel.gold .lesson-panel-title { color: var(--ink); }
.lesson-panel.tilt { animation: panel-tilt 0.5s ease; }
.lesson-panel-title { position: relative; }
.lesson-sparks { position: absolute; left: 0.6em; top: 50%; width: 0; height: 0; pointer-events: none; }
.lesson-sparks i {
  position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; background: #16B3A3;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: spark 0.75s ease-out both;
}
.lesson-sparks i:nth-child(odd) { background: #FFC82E; }
.gold .lesson-sparks i { background: #FFC82E; width: 10px; height: 10px; }
@keyframes panel-pop { 0% { transform: scale(0.94); } 60% { transform: scale(1.02); } 100% { transform: none; } }
@keyframes panel-tilt { 30% { transform: rotate(-0.8deg); } 65% { transform: rotate(0.6deg); } 100% { transform: none; } }
@keyframes spark { from { opacity: 1; transform: rotate(var(--a)) translateX(4px) scale(1); } to { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)) scale(0.3); } }

/* the breather: three slow breaths with the blob */
.breather {
  display: grid; justify-items: center; gap: 8px; margin-top: 4px; padding: 26px 20px 24px; text-align: center;
  border-radius: var(--r-xl); color: #fff;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.6px) 0 0 / 47px 37px,
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.45) 0 0.8px, transparent 1.4px) 0 0 / 31px 27px,
    linear-gradient(180deg, #0B1440, #1B2A78);
}
.breather h1 { margin: 6px 0 0; font-size: var(--fs-xl); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.breather h1:focus { outline: none; }
.breather-say { margin: 0; color: rgba(255, 255, 255, 0.86); font-size: var(--fs-lg); font-weight: var(--fw-semi); min-height: 1.5em; }
.breather-art { width: 170px; height: 140px; display: grid; place-items: center; }
.breather-art svg { display: block; width: 100%; height: 100%; }
.breather-orb { width: 80px; height: 80px; border-radius: 50%; background: radial-gradient(circle, #FFF6C9 0 30%, #FFC82E 55%, rgba(255, 200, 46, 0) 72%); }
.breather.is-breathing .breather-art { animation: breathe 8s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(0.92); } 50% { transform: scale(1.22); } }

/* the homecoming: the end screen opens with a strip of the night sky you came back from */
.homecoming { padding-top: 12px; }
.home-band {
  position: relative; height: 84px; margin: 0 0 18px; overflow: hidden; border-radius: var(--r-xl);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 12px;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.75) 0 1px, transparent 1.6px) 0 0 / 43px 31px,
    radial-gradient(circle at 70% 65%, rgba(255, 255, 255, 0.5) 0 0.8px, transparent 1.4px) 0 0 / 29px 23px,
    linear-gradient(180deg, #0B1440, #1B2A78);
}
.home-kicker { margin: 0; color: #FFE27A; font-size: var(--fs-sm); font-weight: var(--fw-heavy); letter-spacing: 0.16em; text-transform: uppercase; }
.home-comet { position: absolute; top: 14px; left: -40%; width: 110px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, rgba(255, 226, 122, 0), #FFE27A); transform: rotate(14deg); animation: comet 1.3s ease-in 0.25s both; }
.home-comet::after { content: ""; position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: #FFF6C9; box-shadow: 0 0 10px #FFC82E; }
@keyframes comet { from { left: -40%; top: 6px; } to { left: 110%; top: 52px; } }

/* ---------- your room: placing objects and the sticker kit (spec 8.4e, js/ui/iso-room.js, room-edit.js) ---------- */
.ward-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 2px 0; }
.ward-things { margin: 10px 2px 0; }
.ward-things > summary {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; border-radius: var(--r-sm); cursor: pointer;
  color: var(--cobalt); font-weight: var(--fw-bold); text-decoration: underline; text-underline-offset: 3px;
}
.ward-things-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ward-thing {
  min-height: 44px; padding: 8px 14px; border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: var(--white); color: var(--ink); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semi);
  box-shadow: inset 0 0 0 2px var(--sky-deep);
}
.ward-thing:hover { background: var(--sky-2); }
.ward-tools[hidden] { display: none; }
/* The room note: one main button to the object's lesson, Move and Decorate as small text buttons under it. */
.ward-tools > .ward-go { flex: 1 1 100%; font-size: var(--fs-md); padding: 11px 16px; min-height: 48px; }
.ward-small { flex: 1 1 100%; display: flex; justify-content: center; gap: 4px; }
.ward-small > .ward-tool {
  min-height: 40px; padding: 6px 12px; border: 0; border-radius: var(--r-md); background: none;
  font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--cobalt); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--sky-deep);
}
.ward-small > .ward-tool:hover { background: var(--sky-2); }
.ward-tools > .ward-tool {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; width: auto;
  min-height: 44px; padding: 8px 14px; font-size: var(--fs-md); border-radius: var(--r-md);
  box-shadow: inset 0 0 0 2.5px var(--sky-deep), 0 var(--lip-md) 0 var(--sky-deep);
}
.ward-caption { display: block; margin-top: 4px; font-style: italic; color: var(--ink); }
.ward-caption::before { content: '„'; }
.ward-caption::after { content: '“'; }
.iso-pick-n {
  width: 48px; height: 48px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--cobalt); color: var(--white); font: inherit; font-size: 20px; font-weight: var(--fw-heavy);
  box-shadow: 0 var(--lip-md) 0 var(--cobalt-deep);
}
.iso-pick-n:active { transform: translateY(var(--lip-md)); box-shadow: none; }
.iso-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 100%; }
.iso-pick > .iso-pick-keep {
  display: inline-flex; align-items: center; justify-content: center; width: auto; flex: 1 1 auto;
  min-height: 48px; padding: 8px 14px; font-size: var(--fs-md); border-radius: var(--r-md);
  box-shadow: inset 0 0 0 2.5px var(--sky-deep), 0 var(--lip-md) 0 var(--sky-deep);
}
.iso-art .iso-slot { cursor: pointer; }
.iso-art .iso-slot-art { opacity: 0.42; }
.iso-art .iso-slot-badge { transform-box: fill-box; transform-origin: 50% 50%; animation: slot-pulse 1.6s ease-in-out infinite; }
.iso-art .iso-slot:nth-of-type(2n) .iso-slot-badge { animation-delay: 0.4s; }
@keyframes slot-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
/* The next lesson's object waits by the elevator, still (Adam, 21 Nov: it looked like it floated). */
.iso-art .iso-waiting { opacity: 0.85; }
.iso-art .iso-stickers.is-fresh .iso-sticker { animation: iso-fade 0.4s ease 1.2s both; }

body.deco-open { overflow: hidden; }
.deco-shade { position: fixed; inset: 0; z-index: 60; background: var(--overlay); }
.deco-sheet {
  position: fixed; z-index: 61; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(560px, 100%); max-height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
  scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); /* the sticky foot never covers the focused control */
  display: flex; flex-direction: column; gap: 10px; padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  border-radius: var(--r-sheet) var(--r-sheet) 0 0; background: var(--paper); color: var(--ink);
  box-shadow: 0 -8px 30px rgba(11, 20, 64, 0.25); animation: deco-up 0.32s var(--ease-pop) both;
}
.deco-sheet > * { flex-shrink: 0; }
@keyframes deco-up { from { transform: translate(-50%, 40px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.deco-title { margin: 0; font-size: var(--fs-xl); font-weight: var(--fw-heavy); }
.deco-title:focus { outline: none; }
.deco-sub { margin: -6px 0 0; font-size: var(--fs-sm); color: var(--mute); }
.deco-zoom { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: var(--r-lg); background: var(--white); box-shadow: inset 0 0 0 2px var(--sky-2); }
.deco-on { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; }
.deco-on:empty { display: none; }
.deco-chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px 0 8px;
  border: 0; border-radius: var(--r-pill); background: var(--sky-2); color: var(--ink); font: inherit; font-weight: var(--fw-heavy); cursor: pointer;
}
.deco-chip svg { width: 28px; height: 28px; }
.deco-count { margin: 0; font-size: var(--fs-sm); color: var(--ink-soft); }
.deco-tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; }
.deco-pick {
  aspect-ratio: 1; min-height: 48px; padding: 6px; border: 0; border-radius: var(--r-md); cursor: pointer;
  background: var(--white); box-shadow: inset 0 0 0 2px var(--sky-2), 0 var(--lip-sm) 0 var(--sky-2);
}
.deco-pick svg { display: block; width: 100%; height: 100%; }
.deco-pick:active { transform: translateY(var(--lip-sm)); }
.deco-pick:disabled { opacity: 0.35; cursor: default; transform: none; }
.deco-cap-label { font-size: var(--fs-sm); font-weight: var(--fw-heavy); }
.deco-cap {
  width: 100%; min-height: 48px; padding: 0 14px; border: 0; border-radius: var(--r-md); font: inherit; font-size: 16px;
  background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 2px var(--sky-deep);
}
.deco-ideas { display: grid; gap: 6px; }
.deco-ideas-title { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--mute); }
.deco-idea {
  min-height: 44px; padding: 8px 12px; border: 0; border-radius: var(--r-md); cursor: pointer; text-align: left;
  background: var(--violet-tint); color: var(--ink); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semi);
}
.deco-foot { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; padding: 10px 0 calc(12px + env(safe-area-inset-bottom, 0px)); margin-bottom: calc(-16px - env(safe-area-inset-bottom, 0px)); background: var(--paper); box-shadow: 0 -12px 12px -12px var(--overlay); }
.deco-foot .btn { flex: 1; }

/* ---------- the whole hospital, zoomed out from the room (spec 8.4b, 8.4d, js/ui/hospital.js) ---------- */
.ward-house {
  position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 6px 12px 6px 9px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--white); color: var(--ink); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-heavy);
  box-shadow: inset 0 0 0 2px var(--sky-deep), 0 var(--lip-sm) 0 var(--sky-deep);
}
.ward-house svg { width: 20px; height: 20px; color: var(--cobalt); }
.ward-house:active { transform: translateY(var(--lip-sm)); box-shadow: inset 0 0 0 2px var(--sky-deep); }
body.house-open { overflow: hidden; }
.house-sheet {
  position: fixed; inset: 0; z-index: 61; display: flex; flex-direction: column; gap: 8px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, var(--sky-2), var(--paper)); color: var(--ink);
  animation: iso-fade 0.25s ease both;
}
.house-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; width: min(560px, 100%); margin: 0 auto; }
.house-title { margin: 0; font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.house-title:focus { outline: none; }
.house-back { width: auto; min-height: 44px; padding: 8px 16px; }
.house-art { flex: 1 1 0; min-height: 0; width: 100%; background: transparent; border-radius: 0; touch-action: none; }
.house-art .house-room { cursor: pointer; }
.house-note { width: min(560px, 100%); margin: 0 auto; flex-shrink: 0; }

/* ---------- search on the map (mockup B as a search bar) ---------- */
.map-search { margin: 0 var(--gutter) 12px; }
.search {
  display: flex; align-items: center; gap: 10px; min-height: 52px; background: var(--white); border-radius: var(--r-md);
  box-shadow: inset 0 0 0 2px var(--dash); padding: 0 4px 0 14px; color: var(--ink-dim);
}
.search:focus-within { outline: var(--focus-ring); outline-offset: 3px; box-shadow: inset 0 0 0 2.5px var(--cobalt); }
.search-ic svg { display: block; width: 22px; height: 22px; }
.search input { flex: 1; min-width: 0; height: 48px; border: 0; background: transparent; font: inherit; font-size: var(--fs-base); color: var(--ink); outline: none; padding: 0; }
.search input::placeholder { color: var(--mute); opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.search .clear { width: 44px; height: 44px; border-radius: var(--r-sm); background: transparent; color: var(--mute); }
.search .clear svg { width: 18px; height: 18px; }
.search-count { margin: 8px 2px 0; font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--mute); }
.search-count:empty { display: none; }
.search-empty, .search-partial { margin: 12px 0; padding: 16px; border-radius: var(--r-lg); background: var(--white); color: var(--mute); text-align: center; box-shadow: 0 var(--lip-sm) 0 var(--sky-deep); }
.search-partial { padding: 8px 12px; text-align: left; font-size: var(--fs-sm); }
.search-side { display: none; }
.path-screen.is-searching > :not(.map-search):not(.map-h1) { display: none; }
.path-screen.is-searching .map-search { margin-bottom: 24px; }

.grp { margin: 14px 0 0; }
.grp-h { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 2px 8px; font-size: var(--fs-md); font-weight: var(--fw-heavy); color: var(--ink); }
.grp-n { font-size: var(--fs-xs); font-weight: var(--fw-heavy); color: var(--mute); background: var(--sky); border-radius: var(--r-pill); padding: 1px 8px; }
.grp-more { margin: 8px 2px 0; font-size: var(--fs-sm); color: var(--mute); }
.klist { list-style: none; margin: 0; padding: 0; background: var(--white); border-radius: var(--r-lg); box-shadow: 0 var(--lip-sm) 0 var(--sky-deep); overflow: hidden; }
.klist > li + li { border-top: 1.5px solid var(--sky); }
.krow {
  display: flex; align-items: flex-start; gap: 10px; min-height: 54px; padding: 10px 12px 10px 14px;
  color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.krow:hover { background: var(--sky-2); }
.krow:focus-visible { outline-offset: -3px; }
.krow .kt { flex: 1; min-width: 0; line-height: 1.3; }
.krow .kt-t { display: block; font-size: var(--fs-base); font-weight: var(--fw-bold); }
.krow .kt-t.snip { font-size: var(--fs-md); font-weight: var(--fw-regular); }
.krow .kt small { display: block; margin-top: 3px; font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--mute); }
.krow .kt small .katex { font-size: 1em; }
.krow .kmeta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding-top: 2px; }
.krow .kl { font-size: var(--fs-xs); font-weight: var(--fw-heavy); color: var(--cobalt); background: var(--cobalt-tint); border-radius: 8px; padding: 2px 7px; white-space: nowrap; }
.krow .knote { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--fog-ink); background: var(--fog); border-radius: var(--r-pill); padding: 1px 8px; white-space: nowrap; }
.krow .kmist { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--fog-ink); background: var(--fog-deep); border-radius: var(--r-pill); padding: 1px 8px 1px 5px; white-space: nowrap; }
.krow .kmist svg { width: 15px; height: 15px; }
.krow .li-ic { width: 36px; height: 36px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--coral-tint); color: var(--coral-deep); }
.krow .li-ic svg { width: 22px; height: 22px; }
mark.hit { background: var(--sun-tint); color: inherit; border-radius: 4px; padding: 0 1px; box-shadow: inset 0 -2px 0 var(--sun-deep); }

/* ---------- the quick look ---------- */
body.peek-mode .topbar, body.peek-mode .tabbar { display: none; }
body.peek-mode .view { padding-bottom: 0; }
.peek-side { display: none; }
.lesson.is-peek .lesson-head { gap: 10px; }
.peek-label { flex: 1; min-width: 0; margin: 0; display: flex; align-items: center; gap: 8px; }
.peek-pill { flex: none; background: var(--sun-tint); color: var(--ink); box-shadow: inset 0 0 0 2px var(--sun-lip); }
.peek-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--fw-heavy); font-size: var(--fs-md); }
.peek-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.lesson-actions:empty + .peek-links { margin-top: 0; }
.peek-links .btn { flex: 1 1 140px; width: auto; min-height: 44px; padding: 10px 14px; font-size: var(--fs-md); }
.lesson-panel:focus { outline: none; }
/* a panel that scrolls (a short screen, a plot in it) is keyboard focusable and shows it */
.lesson-panel:not([tabindex]):focus-visible { outline: var(--focus-ring); outline-offset: -3px; }

/* ---------- live card: a seminar question is open (path.js setLive) ---------- */
.live-card {
  margin: 0 var(--gutter) 12px; padding: 14px 16px 16px; background: var(--white); border-radius: var(--r-xl);
  box-shadow: inset 0 0 0 2.5px var(--violet), 0 var(--lip-md) 0 var(--violet-deep);
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}
.live-card h2 { margin: 0 0 4px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.live-card .why { margin: 0 0 12px; font-size: var(--fs-sm); color: var(--ink-soft); }
.live-card .btn { background: var(--violet); box-shadow: 0 var(--lip-lg) 0 var(--violet-deep); }

/* ---------- keywords on the chapter card (mockup C) ---------- */
.world.has-extra { flex-wrap: wrap; }
.world-tools { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2px; }
/* Chapter keywords in the same outline as Karta kapitoly, so Pokračovat is the one loud button (Adam, 21 Nov). */
.kw-open {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 14px; border: 0; cursor: pointer;
  border-radius: var(--r-md); color: var(--white); font: inherit; font-size: var(--fs-md); font-weight: var(--fw-bold);
  background: color-mix(in srgb, var(--white) 10%, transparent); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--white) 35%, transparent);
  -webkit-tap-highlight-color: transparent;
}
.kw-open:hover, .kw-open[aria-expanded="true"] { background: color-mix(in srgb, var(--white) 18%, transparent); }
.kw-open-ic svg { display: block; width: 20px; height: 20px; transition: transform 0.2s ease; }
.kw-open[aria-expanded="true"] .kw-open-ic svg { transform: rotate(180deg); }
.galaxy-host { flex-basis: 100%; min-width: 0; position: relative; }
.galaxy { position: relative; list-style: none; margin: 12px -4px 0 -8px; padding: 4px 0 2px; }
.galaxy::before { content: ""; position: absolute; left: 30px; top: 30px; bottom: 30px; border-left: 3px dotted rgba(255, 255, 255, 0.28); }
.planet { position: relative; display: grid; grid-template-columns: 52px 1fr; gap: 4px 12px; padding: 12px 10px 14px 6px; border-radius: var(--r-lg); }
.planet + .planet { margin-top: 2px; }
.planet.current { background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 2px var(--sun); }
.pl-art { width: 52px; height: 52px; position: relative; z-index: 1; display: block; }
.pl-art svg { display: block; width: 100%; height: 100%; overflow: visible; }
.pl-h { min-width: 0; align-self: center; }
.pl-h small { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: var(--fw-heavy); color: #FFE27A; letter-spacing: 0.02em; }
.pl-h b { display: block; font-size: var(--fs-base); font-weight: var(--fw-heavy); line-height: 1.2; margin-top: 1px; }
.pl-tag { font-size: var(--fs-xs); font-weight: var(--fw-bold); padding: 1px 8px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.16); color: var(--white); letter-spacing: 0; }
.pl-tag.misty { background: var(--fog); color: var(--fog-ink); }
.pl-tag.current { background: var(--sun); color: var(--ink); }
.pl-tag.done { background: var(--blue-light-deep); color: var(--white); }
.pl-body { grid-column: 2; min-width: 0; }
.kws { display: flex; flex-wrap: wrap; gap: 8px 6px; margin: 0; padding: 0; list-style: none; }
.world .kw {
  display: inline-flex; align-items: center; min-height: 38px; padding: 5px 12px; border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: rgba(255, 255, 255, 0.12); color: var(--white); font: inherit; font-size: var(--fs-md); font-weight: var(--fw-bold); line-height: 1.2; text-align: left;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.34); -webkit-tap-highlight-color: transparent;
}
.world .kw::before { content: ""; width: 7px; height: 7px; margin-right: 7px; flex: none; border-radius: 50%; background: #FFE27A; box-shadow: 0 0 6px #FFE27A; }
.world .kw:active { transform: translateY(2px); }
.planet.misty .kw { background: rgba(231, 235, 246, 0.22); box-shadow: inset 0 0 0 1.5px rgba(231, 235, 246, 0.45); }
.planet.misty .kw::before { background: var(--fog-deep); box-shadow: none; }
.planet.misty .pl-art { filter: saturate(0.4); opacity: 0.85; }
.planet.coming .pl-art { opacity: 0.5; }
.mist { margin: 8px 0 0; font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--sky); display: flex; align-items: center; gap: 6px; }
.mist svg { width: 18px; height: 18px; flex: none; }
.finds-k { margin: 12px 0 0; font-size: var(--fs-xs); font-weight: var(--fw-heavy); letter-spacing: 0.05em; text-transform: uppercase; color: var(--sky-deep); }
.finds { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.finds a {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 5px 10px 5px 5px; border-radius: var(--r-md);
  background: rgba(0, 20, 80, 0.32); color: var(--white); text-decoration: none; font-size: var(--fs-sm); font-weight: var(--fw-semi); line-height: 1.3;
}
.finds .li-ic { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--sun); color: var(--ink); }
.finds .li-ic svg { width: 20px; height: 20px; }
.finds .li-t { flex: 1; min-width: 0; }
.finds .chev svg { display: block; width: 18px; height: 18px; opacity: 0.7; }
.pl-empty { margin: 6px 0 0; font-size: var(--fs-sm); color: var(--sky); }

/* the keyword card: a night sheet */
.kw-scrim { position: fixed; inset: 0; z-index: 45; background: var(--overlay); animation: iso-fade 0.2s ease; }
.kw-card {
  --focus-color: var(--sun); --focus-ring: 3px solid var(--sun);
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-width: var(--column); margin: 0 auto; max-height: 88vh; overflow-y: auto;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom)); color: var(--white);
  background: radial-gradient(120% 80% at 85% 0%, #1D2E7A 0%, var(--ink) 60%); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--shadow-float); animation: kw-sheet-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes kw-sheet-in { from { transform: translateY(100%); } }
.pcard-top { display: flex; gap: 14px; align-items: center; }
.pcard-top .pl-art { width: 64px; height: 64px; flex: none; }
.pc-t { flex: 1; min-width: 0; }
.kw-card .k { margin: 0; font-size: var(--fs-sm); font-weight: var(--fw-heavy); color: #FFE27A; letter-spacing: 0.08em; text-transform: uppercase; }
.kw-card h2 { margin: 2px 0 0; font-size: var(--fs-2xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); line-height: var(--lh-tight); }
.kw-card .x-btn { background: rgba(255, 255, 255, 0.14); color: var(--white); box-shadow: none; }
.kw-card .lt { margin: 10px 0 0; font-size: var(--fs-sm); color: var(--sky-deep); font-weight: var(--fw-semi); }
.kw-card .d { margin: 12px 0; font-size: var(--fs-base); }
.kw-card .n { margin: -8px 0 14px; font-size: var(--fs-sm); color: var(--sky-deep); }
.kw-card .word { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 6px 12px; border-radius: var(--r-md); background: rgba(255, 255, 255, 0.1); font-weight: var(--fw-bold); font-size: var(--fs-md); }
.kw-card .word small { color: var(--sky-deep); font-weight: var(--fw-semi); font-size: var(--fs-sm); }
.kw-card .word.is-mist .word-t { color: var(--sky-deep); letter-spacing: 0.08em; filter: blur(0.4px); }
.kw-card .mist { margin: 0 0 12px; }
.pcard-acts { display: grid; gap: 12px; }
.kw-card .btn { background: var(--sun); color: var(--ink); box-shadow: 0 var(--lip-lg) 0 var(--sun-deep); }
.kw-card .btn.outline-night { background: rgba(255, 255, 255, 0.1); color: var(--white); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35); }

/* ---------- laptop: results in a left column, the quick look on the right ---------- */
@media (min-width: 960px) {
  body.search-wide .app, body.peek-mode .app, body.map-wide .app { max-width: calc(1040px + var(--rail-w)); }
  body.peek-mode .topbar, body.peek-mode .tabbar { display: flex; }
  body.peek-mode .view { padding-bottom: 48px; }
  .path-screen.is-searching .map-search { display: grid; grid-template-columns: 400px 1fr; gap: 28px; align-items: start; }
  .path-screen.is-searching .search-side {
    display: block; position: sticky; top: calc(var(--topbar-h) + 16px); background: var(--white); border-radius: var(--r-2xl);
    box-shadow: var(--shadow-card); padding: 26px 28px;
  }
  .search-pick { margin: 40px 0; color: var(--mute); font-size: var(--fs-lg); text-align: center; }
  .peek-screen { display: grid; grid-template-columns: 400px 1fr; gap: 28px; align-items: start; padding: 14px var(--gutter) 0; }
  .peek-screen.no-side { grid-template-columns: minmax(0, var(--column)); justify-content: center; }
  .peek-side { display: block; position: sticky; top: calc(var(--topbar-h) + 14px); max-height: calc(100vh - var(--topbar-h) - 28px); overflow-y: auto; padding: 0 6px 24px 2px; }
  .peek-side .search-wrap { margin: 0; }
  .peek-main { min-width: 0; background: var(--paper); border-radius: var(--r-2xl); box-shadow: var(--shadow-card); overflow: clip; }
  .peek-main section.lesson { min-height: calc(100vh - var(--topbar-h) - 48px); }
  .peek-main .lesson-head { top: var(--topbar-h); }
  .kw-card { bottom: auto; top: 50%; transform: translateY(-50%); border-radius: var(--r-sheet); animation: iso-fade 0.2s ease; }
}
/* ---------- computer map: the road on the left, the room and the week checklist on the right ---------- */
.week-list { display: none; }
@media (min-width: 960px) {
  .path-screen { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
  .path-screen.is-searching { display: block; }
  .path-screen > * { grid-column: 1; }
  .path-screen > .path-side {
    grid-column: 2; grid-row: 1 / span 6; margin-right: var(--gutter);
  }
  .path-side .ward { margin: 0 0 16px; }
  .week-list { display: block; background: var(--white); border-radius: var(--r-2xl); box-shadow: var(--shadow-card); padding: 18px 8px 8px; }
  .week-list h2 { margin: 0 12px 6px; font-size: var(--fs-md); font-weight: var(--fw-heavy); }
  .week-list ul { list-style: none; margin: 0; padding: 0; }
  .week-list a {
    display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 44px; padding: 8px 12px;
    border-radius: var(--r-md); color: var(--ink); text-decoration: none;
  }
  .week-list a:hover { background: var(--sky-2); }
  .week-list a:focus-visible { outline: var(--focus-ring); outline-offset: -2px; }
  .week-list strong { font-weight: var(--fw-bold); }
  .week-list .sub {
    font-size: var(--fs-sm); color: var(--mute); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
  }
}
/* The column sticks only when the screen is tall enough to hold it, else it scrolls with the page. */
@media (min-width: 960px) and (min-height: 800px) {
  .path-screen > .path-side {
    position: sticky; top: calc(var(--topbar-h) + 26px); max-height: calc(100vh - var(--topbar-h) - 52px); overflow-y: auto;
  }
}
/* ---------- about page (#/o-nas, js/ui/about.js) ---------- */
.auth-about a { display: inline-block; padding: 12px 8px; min-height: var(--tap); }
.auth-about { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 12px; margin: 10px 0 0; text-align: center; font-size: var(--fs-md); font-weight: var(--fw-semi); }
.about { padding: 20px var(--gutter) 0; }
.about-head { margin: 0 0 16px; }
.about-k { margin: 0 0 4px; font-size: var(--fs-md); font-weight: var(--fw-semi); color: var(--cobalt); }
.about h1 { margin: 0; font-size: var(--fs-2xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); line-height: var(--lh-tight); }
.about-sec { background: var(--white); border-radius: var(--r-xl); padding: 16px 18px 18px; margin: 0 0 16px; box-shadow: var(--shadow-card); }
.about-sec h2 { margin: 0 0 8px; font-size: var(--fs-xl); font-weight: var(--fw-heavy); line-height: var(--lh-tight); }
.about-sec p { margin: 0 0 8px; color: var(--ink-soft); }
.about-sec p:last-child { margin-bottom: 0; }
.about-sec p.about-paper { margin-top: 12px; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.about-paper a { color: var(--cobalt); text-underline-offset: 3px; }
.about-steps, ul.about-who { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.about-steps { counter-reset: step; }
.about-steps li { counter-increment: step; position: relative; padding-left: 42px; min-height: 30px; }
.about-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--cobalt-tint); color: var(--cobalt);
  font-size: var(--fs-md); font-weight: var(--fw-heavy);
}
.about-steps b, ul.about-who b { display: block; font-weight: var(--fw-bold); }
.about-steps span, ul.about-who span { display: block; color: var(--ink-soft); font-size: var(--fs-md); }
.team { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.person { border-radius: var(--r-lg); background: var(--sky-2); }
.person-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--tap); padding: 10px 12px;
  border: 0; border-radius: var(--r-lg); background: none; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.avatar {
  position: relative; flex: none; width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: var(--sky); box-shadow: inset 0 0 0 2px var(--sky-deep);
}
.avatar-ini { font-size: var(--fs-lg); font-weight: var(--fw-heavy); color: var(--cobalt); letter-spacing: 0.02em; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.25s ease; }
.avatar.has-photo img { opacity: 1; }
.person.invited .avatar { box-shadow: inset 0 0 0 2px var(--dash); background: var(--paper); }
.person-who { flex: 1; min-width: 0; display: grid; gap: 1px; justify-items: start; }
.person-name { font-size: var(--fs-base); font-weight: var(--fw-bold); line-height: 1.25; }
.person-role { font-size: var(--fs-sm); color: var(--mute); }
.person-chip { margin-top: 4px; background: var(--sun-tint); color: var(--ink); font-weight: var(--fw-heavy); font-size: var(--fs-xs); padding: 2px 10px; border-radius: var(--r-pill); box-shadow: inset 0 0 0 2px var(--sun); }
.person-chev { flex: none; width: 10px; height: 10px; margin-right: 4px; border-right: 2.5px solid var(--mute); border-bottom: 2.5px solid var(--mute); transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.2s ease; }
.person.open .person-chev { transform: rotate(-135deg) translate(-2px, -2px); }
.person-more { padding: 0 14px 14px 80px; }
.person-more p { margin: 0; font-size: var(--fs-md); }
.about-actions { display: grid; gap: 14px; margin: 4px 0 0; }
@media (max-width: 360px) {
  .person-more { padding-left: 14px; }
}

/* ---------- course syllabus (#/sylabus, js/ui/syllabus.js) ---------- */
.about-sec p.about-link { margin: 18px 0 0; padding-top: 14px; border-top: 2px solid var(--sky-2); font-weight: var(--fw-bold); }
.about-link a { color: var(--cobalt); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.syllabus { padding: 20px var(--gutter) 0; }
.syllabus h1 { margin: 0; font-size: var(--fs-2xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); line-height: var(--lh-tight); }
.syl-note { background: var(--sun-tint); border-radius: var(--r-lg); padding: 12px 16px; margin: 0 0 16px; box-shadow: inset 0 0 0 2px var(--sun-lip); }
.syl-note p { margin: 0 0 6px; color: var(--ink-soft); font-size: var(--fs-md); }
.syl-note p:last-child { margin: 0; }
.syl-weeks { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.syl-week { background: var(--white); border-radius: var(--r-xl); padding: 14px 16px 16px; box-shadow: var(--shadow-card); }
.syl-week.has-chapter { box-shadow: inset 0 0 0 3px var(--blue-light), 0 var(--lip-md) 0 var(--blue-light-deep); }
.syl-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 6px; }
.syl-week h2 { margin: 0; font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.syl-chip { flex: none; font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--mute); background: var(--sky-2); padding: 3px 10px; border-radius: var(--r-pill); }
.syl-chip.on { color: var(--white); background: var(--blue-light-deep); }
.syl-week dl { margin: 0; }
.syl-week dt { margin: 8px 0 0; font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--mute); text-transform: uppercase; letter-spacing: 0.04em; }
.syl-week dd { margin: 2px 0 0; font-size: var(--fs-md); color: var(--ink-soft); }
.syl-week .btn.small { margin-top: 12px; }
.syl-back { margin: 18px 0 0; }
.person-btn.is-static { cursor: default; }

/* ---------- computer and tablet: the bars float as rounded cards (phones keep the edge-to-edge strips) ---------- */
@media (min-width: 720px) {
  .topbar {
    top: 12px; margin: 12px var(--gutter) 0; border: 2px solid var(--sky); border-radius: var(--r-xl);
    box-shadow: var(--shadow-card);
  }
  .tabbar {
    left: 50%; right: auto; bottom: 12px; transform: translateX(-50%);
    width: min(calc(var(--column) - 2 * var(--gutter)), calc(100% - 32px)); height: var(--tabbar-h); padding: 8px 12px;
    border: 2px solid var(--sky); border-radius: var(--r-xl); box-shadow: var(--shadow-card);
  }
  .view { padding-bottom: calc(var(--tabbar-h) + 36px); }
  .lesson-head {
    top: 12px; margin: 12px var(--gutter) 0; border: 2px solid var(--sky); border-radius: var(--r-xl);
    box-shadow: var(--shadow-card);
  }
  .is-expedition .lesson-head { border: 0; box-shadow: 0 var(--lip-md) 0 #060C2A; }
  .lesson-foot {
    bottom: calc(var(--m4m-kb, 0px) + 12px); margin: 0 var(--gutter) 12px; padding-bottom: 14px;
    border: 2px solid var(--sky); border-radius: var(--r-xl); box-shadow: var(--shadow-card);
  }
}
@media (min-width: 960px) {
  /* the side rail is a card that holds just its links, level with the first card of the screen */
  .tabbar {
    top: calc(var(--topbar-h) + 24px); left: 16px; bottom: auto; transform: none;
    width: calc(var(--rail-w) - 32px); height: auto; padding: 10px;
  }
  .view { padding-bottom: 48px; }
  .path-screen.is-searching .search-side { top: calc(var(--topbar-h) + 28px); }
  .peek-side { top: calc(var(--topbar-h) + 26px); max-height: calc(100vh - var(--topbar-h) - 40px); }
  /* inside the rounded quick-look card the lesson header stays a plain strip under the top bar */
  .peek-main .lesson-head {
    top: calc(var(--topbar-h) + 12px); margin: 0; border: 0; border-bottom: 2px solid var(--sky);
    border-radius: 0; box-shadow: none;
  }
  .peek-main .is-expedition .lesson-head { border-bottom: 0; }
  .peek-main .lesson-foot {
    bottom: var(--m4m-kb, 0px); margin: 0; border: 0; border-top: 2px solid var(--sky); border-radius: 0; box-shadow: none;
  }
}

/* ---------- the round menu button in the top bar and its panel of links ---------- */
.more-btn {
  flex: none; width: 40px; height: 40px; margin: 0; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center;
  color: var(--cobalt); background: var(--sky-2); cursor: pointer;
}
.more-btn:hover { background: var(--sky); }
.more-btn[aria-expanded="true"] { background: var(--cobalt); color: var(--white); }
.more-menu {
  position: absolute; top: calc(100% + 8px); right: var(--gutter); z-index: 30; min-width: 220px; padding: 8px;
  display: grid; gap: 2px; background: var(--white); border: 2px solid var(--sky); border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
}
.more-menu[hidden] { display: none; }
.more-menu a {
  display: flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: var(--r-md);
  color: var(--ink); font-weight: var(--fw-bold); text-decoration: none;
}
.more-menu a:hover { background: var(--sky-2); }
.tabbar a.tab-wide { display: none; }
@media (max-width: 420px) {
  .topbar { gap: 6px; padding: 0 12px; }
  .status { gap: 6px; }
  .status #login-link { padding-left: 12px; padding-right: 12px; }
  .streak, .goal-ring { padding-right: 10px; gap: 6px; }
  .goal-ring b small { display: none; }
}
/* At 320 px the top bar needed 363 px and pushed the page sideways (audit m7). Tighter spacing and
   smaller icons make it fit, every control keeps its size for a finger. */
@media (max-width: 360px) {
  .topbar { gap: 4px; padding: 0 8px; }
  .logo b { font-size: 15px; }
  .status { gap: 4px; }
  .streak, .goal-ring { padding: 0 8px 0 4px; gap: 4px; font-size: var(--fs-sm); }
  .streak .ic, .goal-ring svg { width: 24px; height: 24px; }
  .status #login-link { padding-left: 10px; padding-right: 10px; font-size: var(--fs-sm); }
}
@media (min-width: 960px) {
  .tabbar a.tab-wide { display: flex; }
}
/* the team: the faculty people, then AiAtHand with its logo */
.about-org { margin: 14px 0 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.about-sec p.about-org { margin: 14px 0 0; }
.about-org-k { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--mute); }
.about-org { gap: 6px; }
.about-sec .about-org-k { color: var(--ink-soft); }
/* AiAtHand reads as a plain link in the line, the same weight as the faculty name above it */
.about-org-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap); padding: 0 4px;
  border-radius: var(--r-md); color: var(--cobalt); font-size: var(--fs-sm); font-weight: var(--fw-heavy);
  text-decoration: none;
}
.about-org-link:hover span, .about-org-link:focus-visible span { text-decoration: underline; text-underline-offset: 3px; }
.about-org-logo { width: 26px; height: 26px; flex: none; }
.team { margin-top: 8px; }

/* ---------- computer: one top bar for every section, flush across the whole window, the content on the
   map's main column so switching sections never moves it (spec docs/superpowers/specs/2026-11-21-m4m-ui-cleanup-design.md) ---------- */
@media (min-width: 960px) {
  .app, body.search-wide .app, body.peek-mode .app, body.map-wide .app { max-width: none; padding-left: 0; }
  .topbar {
    top: 0; margin: 0; padding: 0 16px; border: 0; border-bottom: 2px solid var(--sky); border-radius: 0;
    box-shadow: 0 2px 10px color-mix(in srgb, var(--ink) 6%, transparent);
  }
  /* the menu card starts right under the bar, its left edge on the logo's */
  .tabbar { top: calc(var(--topbar-h) + 14px); }
  /* the box the map uses: the rail on the left, then the main column and the side column. --box grew
     from 1040 px to 1300 px (Adam, 22 Nov) so the map's road has up to 900 px on a big screen. */
  :root { --box: 1300px; }
  .view { max-width: calc(var(--box) + var(--rail-w)); margin: 0 auto; padding-left: var(--rail-w); }
  .lang-note, .verify-note { margin: 8px auto 0 calc(max(0px, (100% - var(--box) - var(--rail-w)) / 2) + var(--rail-w) + var(--gutter)); max-width: calc(672px - 2 * var(--gutter)); }
  /* the other sections keep the main column's readable width and leave the side column empty, the
     quick look keeps its 1040 px, both start where the map starts */
  body:not(.map-wide):not(.peek-mode) .view { padding-right: max(0px, min(100%, var(--box) + var(--rail-w)) - var(--rail-w) - 672px); }
  body.peek-mode .view { padding-right: max(0px, min(100%, var(--box) + var(--rail-w)) - var(--rail-w) - 1040px); }
  /* a lesson keeps its own single column, no bar and no rail */
  body.lesson-mode .app { max-width: var(--column); margin: 0 auto; }
  body.lesson-mode .view { max-width: none; padding-left: 0; padding-right: 0; }
  body.lesson-mode .lang-note { margin: 8px var(--gutter) 0; max-width: none; }
}

/* ---------- two fonts (Adam, 21 Nov) ----------
   Running text reads in Atkinson Hyperlegible Next (body, tokens --font-text). Headings, buttons,
   labels, chips and numbers keep Bricolage Grotesque (--font), the app's own look. At the end of the
   file so it wins over the controls that reset their font with `font: inherit`. Answer options,
   text fields and idea cards keep the reading font: they are text to read. */
h1, h2, h3, h4, h5, h6, .btn, .logo, .status, .tabbar, .node, .plabel .t, .world .k, .world .meter,
.unitcard-btn, .lesson-skip, .lang-opt, .voice-switch, .ward-tool, .iso-pick-n, .deco-chip, .kw-open, .world .kw,
.lesson-panel-title, .lesson-why-btn, .stat, .lesson-revisit-title, .setting-label, .step-now,
.bar-label, .bar-n, .expo, .home-kicker, .deco-title, .deco-cap-label, .house-title, .grp-h, .grp-n,
.krow .kl, .peek-title, .pl-h, .finds-k, .kw-card .k, .avatar-ini, .person-chip, .syl-chip,
.syl-week dt, .ward-cap, .iso-reward-cap, .fog-card .k {
  font-family: var(--font);
}

/* ---------- the lesson reads on a clean white page (Adam, 21 Nov: "this strange paper thing") ----------
   Phones: the whole screen is white, no grid. Wider screens: the grid stays outside, the lesson itself
   is a white sheet between the floating header and footer. */
@media (max-width: 719.98px) {
  body.lesson-mode { background-color: var(--white); background-image: none; }
  body.lesson-mode .lesson-foot { background: var(--white); }
}
@media (min-width: 720px) {
  body.lesson-mode .lesson-body {
    margin: 12px var(--gutter); padding: 26px 30px 30px;
    background: var(--white); border-radius: var(--r-xl); box-shadow: var(--shadow-card);
  }
}

/* ---------- the walk-through (js/ui/tour.js) ----------
   A dim with a lit hole round the real target and a sun ring, and one card: a bottom sheet on a phone,
   moved above or below a target in the tab bar or the top bar, at the bottom right on a computer. The app
   behind is inert. Only the card's entrance moves, and not under reduced motion. */
.tour-dim { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 70; pointer-events: none; }
.tour-shade { fill: var(--overlay); }
.tour-ring { fill: none; stroke: var(--sun); stroke-width: 4; }
.tour {
  position: fixed; z-index: 71; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  margin: 0 auto; max-width: 520px; max-height: min(74vh, 600px); overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 18px 16px; border-radius: var(--r-xl); background: var(--white); color: var(--ink);
  box-shadow: 0 var(--lip-md) 0 var(--sky-deep), var(--shadow-float);
}
.tour.is-below { bottom: auto; }
.tour.is-left, .tour.is-right { width: auto; margin: 0; }
.tour.is-in { animation: tour-in 0.32s var(--ease-pop); }
@keyframes tour-in { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.tour-head { display: flex; align-items: center; gap: 12px; }
.tour-blob { flex: none; width: 66px; }
.tour-blob svg { display: block; width: 66px; height: auto; overflow: visible; }
.tour-say { min-width: 0; }
.tour-count { margin: 0; font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--mute); }
.tour-title { margin: 2px 0 0; font-size: var(--fs-xl); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); line-height: var(--lh-tight); }
.tour-text { margin: 12px 0 0; font-family: var(--font-text); font-size: var(--fs-lg); line-height: var(--lh-body); }
.tour-more { margin: 10px 0 0; }
.tour-more a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--cobalt); font-weight: var(--fw-bold); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.tour-dots { display: flex; gap: 6px; margin: 12px 0 0; }
.tour-dots span { width: 9px; height: 9px; border-radius: var(--r-pill); background: var(--sky-deep); }
.tour-dots span.on { background: var(--cobalt); }
.tour-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 0; }
.tour-actions .btn { width: auto; flex: 1 1 96px; min-height: var(--tap); padding-left: 14px; padding-right: 14px; }
.tour-skip {
  margin-right: auto; min-height: var(--tap); padding: 0 8px; border: 0; border-radius: var(--r-sm); background: none;
  color: var(--cobalt); font: inherit; font-family: var(--font); font-weight: var(--fw-bold); text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer;
}
html.tour-open .view { padding-bottom: calc(var(--tour-h, 0px) + 48px + env(safe-area-inset-bottom)); }
@media (min-width: 960px) {
  .tour { left: auto; right: 24px; bottom: 24px; width: 420px; margin: 0; }
}
/* A short screen, for example 200 % zoom on a laptop: a smaller blob and no dots, the text keeps its size,
   so more of the lit target stays in view above the card. */
@media (max-height: 520px) {
  .tour { padding: 10px 14px; max-height: 70vh; }
  .tour-head { gap: 10px; }
  .tour-blob, .tour-blob svg { width: 40px; }
  .tour-text { margin-top: 4px; }
  .tour-dots { display: none; }
  .tour-actions { margin-top: 6px; }
  /* the app is inert under the walk-through, so its top bar may scroll away and leave the room to the target */
  html.tour-open .topbar { position: relative; top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) :is(.tour.is-in, .tour .blob-bob) { animation: none !important; }
}
html[data-motion="reduced"] :is(.tour.is-in, .tour .blob-bob) { animation: none !important; }

/* ---------- projector (ui/projector.js): the class screen ----------
   Full screen, dark and bright, sizes from the screen (vmin) so the back row reads it. No names ever. */
.projector {
  position: fixed; inset: 0; z-index: 400; overflow: auto;
  display: flex; flex-direction: column; gap: clamp(8px, 2vmin, 24px);
  padding: clamp(12px, 3vmin, 40px);
  background: var(--ink); color: var(--white);
  font-family: var(--font); line-height: var(--lh-tight);
}
.projector .pj-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.projector .pj-brand { margin: 0; font-weight: var(--fw-heavy); font-size: clamp(16px, 2.6vmin, 30px); color: var(--sun); }
.projector .pj-close {
  flex: none; width: auto; margin-left: auto; min-height: 56px; min-width: 56px; padding: 0 clamp(16px, 3vmin, 32px);
  font-size: clamp(17px, 2.6vmin, 28px); background: var(--white); color: var(--ink); border-color: var(--white);
}
.projector .pj-close:focus-visible { outline: 4px solid var(--sun); outline-offset: 4px; }
.pj-stage { flex: 1; display: flex; flex-direction: column; gap: clamp(10px, 2.4vmin, 32px); min-width: 0; }
.pj-head { display: flex; flex-direction: column; gap: 6px; }
.pj-title { margin: 0; font-size: clamp(26px, 6.5vmin, 84px); font-weight: var(--fw-heavy); letter-spacing: var(--track-tight); overflow-wrap: anywhere; }
.pj-note { margin: 0; font-family: var(--font-text); font-size: clamp(18px, 3.4vmin, 40px); color: var(--sky); }
.pj-wait { font-size: clamp(20px, 4vmin, 44px); }
.pj-question { font-family: var(--font-text); font-size: clamp(20px, 4.2vmin, 54px); line-height: 1.3; overflow-wrap: anywhere; }
.pj-question p { margin: 0 0 0.4em; }
.pj-options { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(8px, 1.8vmin, 24px); grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.pj-option {
  display: flex; flex-direction: column; gap: 10px; padding: clamp(12px, 2.2vmin, 28px);
  border-radius: var(--r-lg); color: var(--white); border: 4px solid transparent;
}
.pj-option.c0 { background: var(--coral-deep); }
.pj-option.c1 { background: var(--cobalt); }
.pj-option.c2 { background: var(--teal-deep); }
.pj-option.c3 { background: var(--violet-deep); }
.pj-option.c4 { background: var(--blue-light-deep); }
.pj-option.c5 { background: var(--violet-darker); }
.pj-option.is-right { border-color: var(--sun); box-shadow: 0 0 0 4px var(--sun); }
.pj-option.is-dim { background: #2E3A6B; color: var(--sky); }
.pj-option-top { display: flex; align-items: center; gap: clamp(8px, 1.6vmin, 18px); flex-wrap: wrap; font-size: clamp(20px, 4vmin, 50px); font-family: var(--font-text); }
.pj-shape svg { width: 1.2em; height: 1.2em; display: block; }
.pj-letter { font-family: var(--font); font-weight: var(--fw-heavy); }
.pj-option-text { flex: 1 1 8em; min-width: 0; overflow-wrap: anywhere; }
.pj-right { font-weight: var(--fw-heavy); background: var(--sun); color: var(--ink); border-radius: 999px; padding: 0.15em 0.6em; font-family: var(--font); }
.pj-right::before { content: '\2713\00a0'; }
.pj-bars { display: grid; gap: 6px; }
.pj-bar { display: grid; grid-template-columns: minmax(6em, auto) 1fr 4.2em; align-items: center; gap: 10px; font-size: clamp(15px, 2.4vmin, 28px); font-family: var(--font-text); }
.pj-bar-track { height: 0.9em; border-radius: 999px; background: rgba(15, 28, 77, 0.45); overflow: hidden; }
.pj-bar-fill { display: block; height: 100%; background: var(--white); border-radius: 999px; }
.pj-bar-n { text-align: right; font-weight: var(--fw-bold); }
.pj-count { margin: 0; font-size: clamp(20px, 4vmin, 48px); font-family: var(--font-text); background: var(--ink); }
.pj-count strong { font-family: var(--font); font-size: 1.8em; color: var(--sun); }
.pj-clock { margin: auto 0; font-size: clamp(64px, 24vmin, 320px); font-weight: var(--fw-heavy); color: var(--sun); font-variant-numeric: tabular-nums; }
.pj-average { display: flex; flex-direction: column; gap: 8px; }
.pj-average p { margin: 0; }
.pj-average-label { font-size: clamp(18px, 3.4vmin, 40px); color: var(--sky); }
.pj-average-n { font-size: clamp(20px, 4vmin, 48px); font-family: var(--font-text); }
.pj-average-n strong { font-family: var(--font); font-size: 2.6em; color: var(--sun); font-weight: var(--fw-heavy); }
.pj-average-sub { font-size: clamp(16px, 2.8vmin, 32px); color: var(--sky); font-family: var(--font-text); }
.pj-meter { display: block; height: clamp(10px, 1.8vmin, 22px); border-radius: 999px; background: #34427A; overflow: hidden; }
.pj-meter i { display: block; height: 100%; background: var(--sun); border-radius: 999px; }
.pj-qs { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(8px, 1.6vmin, 20px); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.pj-q { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; padding: clamp(10px, 2vmin, 24px); border-radius: var(--r-lg); background: #1E2C63; border: 3px solid transparent; }
.pj-q .pj-meter { flex-basis: 100%; }
.pj-q-label { font-weight: var(--fw-heavy); font-size: clamp(20px, 3.6vmin, 44px); }
.pj-q-n { font-weight: var(--fw-heavy); font-size: clamp(24px, 4.6vmin, 56px); color: var(--sun); }
.pj-q-word { font-family: var(--font-text); font-size: clamp(15px, 2.4vmin, 28px); }
.pj-q-text { flex-basis: 100%; font-family: var(--font-text); font-size: clamp(14px, 2.1vmin, 24px); color: var(--sky); overflow-wrap: anywhere; }
.pj-q.is-weakest { border-color: var(--coral); background: #4A1E3A; }
.pj-common { flex-basis: 100%; font-family: var(--font-text); }
.pj-common-title { margin: 0; font-size: clamp(13px, 1.9vmin, 22px); color: var(--sky); }
.pj-common-list { margin: 2px 0 0; padding-left: 1.3em; display: grid; gap: 2px; font-size: clamp(16px, 2.6vmin, 32px); }
.pj-common-list li { overflow-wrap: anywhere; }
.pj-common-n { color: var(--sun); font-weight: var(--fw-bold); }
.pj-q-tag { font-weight: var(--fw-heavy); background: var(--coral-deep); color: var(--white); border-radius: 999px; padding: 0.15em 0.6em; font-size: clamp(14px, 2.2vmin, 26px); }
.projector .md-math, .projector .katex { color: inherit; }
/* Lively only when motion is welcome: the tiles pop in and the bars grow. */
.projector.is-lively .is-fresh :is(.pj-option, .pj-q) { animation: pj-pop 420ms cubic-bezier(.2, 1.4, .4, 1) both; }
.projector.is-lively .is-fresh :is(.pj-option, .pj-q):nth-child(2) { animation-delay: 80ms; }
.projector.is-lively .is-fresh :is(.pj-option, .pj-q):nth-child(3) { animation-delay: 160ms; }
.projector.is-lively .is-fresh :is(.pj-option, .pj-q):nth-child(4) { animation-delay: 240ms; }
.projector.is-lively .is-fresh :is(.pj-bar-fill, .pj-meter i) { animation: pj-grow 900ms ease-out both; transform-origin: left; }
@keyframes pj-pop { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pj-grow { from { transform: scaleX(0); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) .projector * { animation: none !important; }
}
html[data-motion="reduced"] .projector * { animation: none !important; }

/* ---------- the teacher's pages at 200 and 300 % zoom (todo C6) ----------
   1280 by 900 at 300 % leaves 427 by 300 css px: a sticky top bar and a fixed tab bar would cover half of it.
   On a short screen the teacher view and Správa let both bars scroll with the page (the tab bar sits under
   the top bar), so the whole height is for the class. */
@media (max-height: 520px) and (max-width: 959px) {
  body:has(.view > :is(.teacher, .admin)) .topbar { position: static; }
  body:has(.view > :is(.teacher, .admin)) .tabbar {
    position: static; transform: none; width: auto; height: auto; min-height: var(--tabbar-h);
    margin: 8px var(--gutter) 0; padding: 4px 8px; border: 2px solid var(--sky); border-radius: var(--r-xl); box-shadow: none;
  }
  body:has(.view > :is(.teacher, .admin)) .view { padding-bottom: 24px; }
  html:has(.view > :is(.teacher, .admin)) { scroll-padding-top: 16px; scroll-padding-bottom: 16px; }
}
