/* Lesson session look, direction D (mockups/d). Loaded after tools.css on lesson.html and immersive.html; uses the site.css tokens.
   One section per part. Values follow mockups/d/style.css. */

/* ---------- Beat lanes (js/beat-lanes.js) ----------
   One lane of 16 steps per drum under a 1 e & a axis. A hit is an off-white stem: loud full, normal 2/3, soft 1/3 of the lane,
   so the level reads without colour. Orange in the grid means the playhead only. Beats 1 and 3 sit on a lighter band than 2 and 4.
   The lanes run edge to edge inside the tool box (negative margin = the box padding) so 16 columns stay at least 22 px at 390 px. */
.lanes, .bm-lanes { --band-a: #181b1f; --band-b: #121417; --mband-a: #23262b; --mband-b: #191c20; }
.lanes { position: relative; margin-inline: -1.25rem; padding-top: 24px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.imm .lanes { margin-inline: calc(-1 * clamp(1rem, 3vw, 1.9rem)); }

.lane-axis { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); height: 32px; border-bottom: 1px solid var(--line-strong); }
.lane-ax { position: relative; display: flex; justify-content: center; align-items: flex-start; padding-top: 3px; font: 400 12px/1 var(--mono); color: var(--faint); }
.lane-ax.b { font: 600 14px/1 var(--mono); color: var(--text); }
.lane-ax::after { content: ""; position: absolute; bottom: 0; left: 50%; width: 1px; height: 5px; background: var(--line-strong); }
.lane-ax.b::after { height: 9px; background: var(--muted); }

.lane-name { height: 24px; display: flex; align-items: flex-end; padding: 0 12px 5px; font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.lane-name.m { height: 36px; color: var(--text); }
.lane-name em { font-style: normal; color: var(--muted); margin-left: 8px; }

/* manipulation = pan + pinch-zoom, no double-tap zoom: quick repeat taps on keys and cells must not zoom the page. Set on the root
   scroller too (touch-action is not inherited, but the effective value intersects up the tree); the lanes' pan-y pinch-zoom still applies. */
:root:has(body.session), body.session { touch-action: manipulation; }

/* The rule under each lane is a control edge (where a row of tap targets ends on the sheet): --control-border, 3.48:1.
   touch-action: pan-y lets an up/down finger scroll the page and pinch-zoom lets a pinch zoom it (the browser then cancels the
   stroke: pointercancel, nothing painted); a sideways finger stays with the lane and paints. */
.lane { --area: 34px; --head: 10px; --sw: 3px; --ink: var(--text);
  display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); height: 48px; border-bottom: 1px solid var(--control-border); touch-action: pan-y pinch-zoom; }
.lane.m { --area: 58px; height: 72px; }
.lane-cell { --f: 0; position: relative; min-width: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--band-a); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.lane-cell:nth-child(8n+5), .lane-cell:nth-child(8n+6), .lane-cell:nth-child(8n+7), .lane-cell:nth-child(8n+8) { background: var(--band-b); }
.lane.m .lane-cell { background: var(--mband-a); }
.lane.m .lane-cell:nth-child(8n+5), .lane.m .lane-cell:nth-child(8n+6), .lane.m .lane-cell:nth-child(8n+7), .lane.m .lane-cell:nth-child(8n+8) { background: var(--mband-b); }
.lane-cell:nth-child(4n+1):not(:first-child) { box-shadow: inset 1px 0 0 var(--line); }
.lane-cell[data-v="loud"], .bm-cell[data-v="loud"] { --f: 1; }
.lane-cell[data-v="normal"], .bm-cell[data-v="normal"] { --f: .667; }
.lane-cell[data-v="soft"], .bm-cell[data-v="soft"] { --f: .333; }
@media (hover: hover) { .lane-cell:hover { background-image: linear-gradient(rgb(236 238 240 / .06), rgb(236 238 240 / .06)); } }
.lane-cell:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; border-radius: 4px; }

/* Stem = a 3 px line (::before) plus a round head (::after), height --area x --f. Shared by the loupe's magnified stem. */
.lane-cell::before, .lane-loupe-stem::before, .bm-cell::before { content: ""; position: absolute; left: 50%; bottom: 0; width: var(--sw); margin-left: calc(var(--sw) / -2); height: calc(var(--area) * var(--f)); background: var(--ink); }
.lane-cell::after, .lane-loupe-stem::after, .bm-cell::after { content: ""; position: absolute; left: 50%; bottom: calc(var(--area) * var(--f) - var(--head) / 2); width: var(--head); height: var(--head); margin-left: calc(var(--head) / -2); border-radius: 50%; background: var(--ink); }
.lane-cell::before, .lane-cell::after { transition: height var(--fast) var(--ease-out), bottom var(--fast) var(--ease-out); }
/* An empty step is a small dot near the floor: --faint is 4.1:1 or more on every band. */
.lane-cell[data-v="off"]::after, .bm-cell[data-v="off"]::after { --head: 4px; bottom: 5px; background: var(--faint); }

/* Playhead: a 2 px accent line over a faint wash, with the count in a pill. The pill slides from left-aligned (step 1)
   to right-aligned (step 16), so it never leaves the box. */
.lane-ph { position: absolute; top: 0; bottom: 0; left: calc(var(--ph) * 100% / 16); width: calc(100% / 16); pointer-events: none; z-index: 3; }
.lane-ph::before { content: ""; position: absolute; top: 24px; bottom: 0; left: 0; right: 0; background: rgb(255 106 43 / .11); }
.lane-ph::after { content: ""; position: absolute; top: 22px; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--accent); }
.lane-flag { position: absolute; top: 0; left: 50%; translate: calc(var(--ph) / -15 * 100%) 0; height: 20px; padding: 0 8px; border-radius: 5px; background: var(--accent); color: var(--on-accent); font: 600 12px/20px var(--mono); letter-spacing: .04em; white-space: nowrap; }

/* Touch: the column under the finger lights up and a light loupe shows the step above it. */
.lane-col { position: absolute; top: 24px; bottom: 0; left: calc(var(--col) * 100% / 16); width: calc(100% / 16); background: rgb(236 238 240 / .11); box-shadow: inset 1px 0 0 rgb(236 238 240 / .4), inset -1px 0 0 rgb(236 238 240 / .4); pointer-events: none; z-index: 2; }
.lane-loupe { --tip: calc(14px + var(--col) / 15 * (100% - 28px));
  position: absolute; z-index: 8; top: var(--top); left: calc((var(--col) + .5) * 100% / 16); width: max-content; height: 62px;
  translate: calc(-1 * var(--tip)) calc(-100% - 10px); display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 14px;
  background: var(--text); color: var(--bg); box-shadow: 0 4px 0 #8a9099, 0 10px 24px rgb(0 0 0 / .5); pointer-events: none;
  transform-origin: var(--tip) 100%; animation: lane-loupe-in var(--fast) var(--ease-out); }
.lane-loupe[hidden] { display: none; }
.lane-loupe::after { content: ""; position: absolute; left: var(--tip); bottom: -7px; width: 16px; height: 16px; margin-left: -8px; rotate: 45deg; border-radius: 3px; background: var(--text); box-shadow: 3px 3px 0 #8a9099; }
.lane-loupe-stem { --area: 36px; --head: 16px; --sw: 5px; --ink: var(--bg); --f: 0; position: relative; flex: none; width: 30px; height: 46px; border-bottom: 2px solid var(--line-strong); }
.lane-loupe-stem.off::after { --head: 6px; bottom: 4px; background: #4a4f56; }
.lane-loupe b { display: block; font: 600 12px/1.2 var(--mono); letter-spacing: .04em; white-space: nowrap; }
.lane-loupe-text span { display: block; margin-top: 2px; font: 500 12px/1.3 var(--mono); color: #4a4f56; white-space: nowrap; }
@keyframes lane-loupe-in { from { opacity: 0; scale: .9; } }

@media (prefers-reduced-motion: reduce) {
  .lane-loupe { animation: none; }
  .lane-cell::before, .lane-cell::after, .pad-fill { transition: none; }
}

/* ---------- Beat pads (js/beat-pads.js) ----------
   Touch screens only. The lanes are the overview: a tap picks a lane (an off-white outline, never an orange fill) and the pads
   below edit it, one row per beat, 1 e & a across. A hit is an off-white fill (loud full, normal 2/3, soft 1/3) plus 1-3 dots,
   so the level reads without colour. Pads are keys with a lip like the brush keys. Orange is the playhead only: a ring on its
   pad and its lit beat number. 26 px numbers + 4 x 8 px gaps leave each pad 65 px wide in a 318 px box (390 px phone). */
/* The ring is an overlay: the cells (position: relative) would paint over the lane's own outline. */
.lane.sel { position: relative; }
.lane.sel::after { content: ""; position: absolute; inset: 0; z-index: 1; border: 2px solid var(--text); pointer-events: none; }
.lane-name.sel { color: var(--text); }
.pads-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.pads-name { font: 600 16px/1.3 var(--font); color: var(--text); }
.pads-name em { margin-left: 8px; font: 500 12px/1 var(--mono); font-style: normal; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pads-pick { font-size: 13px; color: var(--muted); }
.pads { display: grid; grid-template-columns: 26px repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.pads-ch { text-align: center; font: 600 13px/1 var(--mono); color: var(--muted); }
.pads-rl { align-self: center; justify-self: center; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 9px; background: var(--surface-3); font: 600 15px/1 var(--font); color: var(--muted); }
.pads-rl.lit { background: var(--accent); color: var(--on-accent); }
.pad { --f: 0; position: relative; height: 52px; min-width: 0; margin: 0 0 3px; padding: 0; overflow: hidden; border: 1px solid var(--control-border); border-radius: 12px;
  background: var(--surface-3); box-shadow: 0 3px 0 var(--key-lip); cursor: pointer; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
.pad-fill { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--f) * 100%); background: var(--text); transition: height var(--fast) var(--ease-out); }
.pad-dots { position: absolute; top: 7px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; }
.pad-dots b { width: 7px; height: 7px; border-radius: 50%; background: var(--text); }
.pad[data-v="loud"] .pad-dots b { background: var(--bg); }
.pad:active { transform: translateY(3px); box-shadow: none; }
.pad:focus-visible, .pad.cue { outline: 2px solid var(--text); outline-offset: 2px; } /* .cue: the pad of a tapped lane step */
.pad.now { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Heavier Geist + tactile tokens ----------
   Geist 700/800 (OFL, from @fontsource/geist) for lesson headings and buttons. Tokens are global; the pressable look is scoped
   to body.session. Orange stays for the one action, the current selection and the playhead. */
@font-face { font-family: "Geist"; font-weight: 700; font-display: swap; src: url("../fonts/geist-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-weight: 800; font-display: swap; src: url("../fonts/geist-latin-800-normal.woff2") format("woff2"); }

:root { --good: #3ccf7e; --good-lip: #1c8a50; --good-wash: rgba(60,207,126,.12); --accent-lip: #a83a0a; --key-lip: #0b0c0e; }

/* Primary: the one action. A 4 px lip that the press pushes flat. */
body.session .btn { font-weight: 600; }
body.session .btn.primary { border-color: transparent; box-shadow: 0 4px 0 var(--accent-lip); margin-bottom: 4px; }
body.session .btn.primary:active:not(:disabled) { transform: translateY(4px); box-shadow: none; }
body.session .btn.primary:disabled { box-shadow: none; }
/* Secondary: a raised surface with a dark lip; the 1 px edge stays for the 3:1 control edge. */
body.session .btn:not(.primary) { background: var(--surface-3); border-color: var(--control-border); box-shadow: 0 3px 0 var(--key-lip); margin-bottom: 3px; }
body.session .btn:not(.primary):active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
body.session .btn:disabled { box-shadow: none; }
/* The secondary rule above out-specifies site.css .btn:disabled and hover; restate both so a disabled key looks flat and off. */
body.session .btn:not(.primary):disabled { background: transparent; border-color: var(--line); }
@media (hover: hover) and (pointer: fine) { body.session .btn:not(.primary):not(:disabled):hover { border-color: var(--muted); } }
/* The raised key also out-specifies site.css .btn[aria-pressed="true"] and .playb.now, so both states are restated after the
   hover rule (equal or higher weight wins): the chosen preset (beat, arrange) gets the accent ring of the current selection,
   like a brush key, and a playing Listen key the playing ring. Pressed, either one drops its lip and keeps the ring. */
body.session .btn:not(.primary):not(:disabled)[aria-pressed="true"] { background: #25201d; border-color: var(--accent); box-shadow: 0 3px 0 var(--key-lip), inset 0 0 0 1px var(--accent); }
body.session .btn.playb.now:not(.primary):not(:disabled) { border-color: var(--accent); color: var(--accent); box-shadow: 0 3px 0 var(--key-lip), inset 0 0 0 1px var(--accent); }
body.session .btn:not(.primary):not(:disabled)[aria-pressed="true"]:active, body.session .btn.playb.now:not(.primary):not(:disabled):active { box-shadow: inset 0 0 0 1px var(--accent); }

/* Brush keys: a key with a lip; the chosen one gets an accent ring and its stem icon lit. */
body.session .beat-brush .dseg label { border-radius: 12px; border: 0; background: var(--surface-3); color: var(--text); font-weight: 600;
  box-shadow: 0 3px 0 var(--key-lip), inset 0 0 0 1px var(--control-border); margin-bottom: 3px; }
body.session .beat-brush .dseg label::before { background: linear-gradient(to top, var(--muted) var(--fill), var(--surface) var(--fill)); }
body.session .beat-brush .dseg label:active { transform: translateY(3px); box-shadow: inset 0 0 0 1px var(--control-border); }
body.session .beat-brush .dseg input:checked + label { background: #25201d; box-shadow: 0 3px 0 var(--key-lip), inset 0 0 0 2px var(--accent); }
body.session .beat-brush .dseg input:checked + label::before { background: linear-gradient(to top, var(--accent) var(--fill), var(--surface-3) var(--fill)); }

/* Points chip in the header: a key (it links to the tiers), so it keeps the 3:1 control edge like the other keys. */
body.session .pchip { padding: 0 var(--s-3); border-radius: 22px; background: var(--surface-3); color: var(--text); font-weight: 600; box-shadow: 0 3px 0 var(--key-lip), inset 0 0 0 1px var(--control-border); }

@media (prefers-reduced-motion: reduce) {
  body.session .btn.primary:active:not(:disabled), body.session .btn:not(.primary):active:not(:disabled), body.session .beat-brush .dseg label:active, .pad:active { transform: none; }
}

/* ---------- Session frame (lesson.html; js/player.js with session: true) ----------
   Inside a lesson the site chrome steps aside. The player's own top bar (close, one thick green progress track, the points
   chip) sticks under the safe area, and the step nav becomes a bottom dock with the big Next. Progress is green; orange stays
   for the one action. A locked lesson has no player, so no .sbar: it keeps the site header (Log in, Pricing, the points chip),
   the footer (legal links) and the page's back link. Until lesson.js draws (#lesson still empty) the chrome waits too, so an
   unlocked lesson never flashes it; a locked page shows it together with the preview and the gate. */
body.session:has(.player > .sbar) .announce, body.session:has(.player > .sbar) .nav, body.session:has(.player > .sbar) .foot,
body.session:has(#lesson:empty) .announce, body.session:has(#lesson:empty) .nav, body.session:has(#lesson:empty) .foot { display: none; }
/* Where the header shows (a locked lesson), it stays above the preview's sticky sheet slot (z-index 10) as that scrolls up. */
body.session .nav { z-index: 21; }
@media (max-width: 720px) {
  body.session[data-page="lesson"].has-tabbar:not(:has(.paywall)) { padding-bottom: 0; }
  body.session[data-page="lesson"]:not(:has(.paywall)) .pm-tabbar { display: none; }
}
/* Bar and dock heights (dock = 1 px line + 12 + 56 button + 4 lip + 12). Page rules ask for `.player > .sbar`, never a bare
   .sbar: the stem cards build one too. */
:root { --sbar-h: 52px; --dock-h: 85px; }
/* Focus is never hidden under the sticky bar or the dock (WCAG 2.2 focus not obscured): scrolling to a focused control
   leaves room for both, plus a little air. */
:root:has(body.session .player > .sbar) { scroll-padding: calc(var(--sbar-h) + var(--s-2) + env(safe-area-inset-top, 0px)) 0 calc(var(--dock-h) + var(--s-2) + env(safe-area-inset-bottom, 0px)); }
body.session .lesson-page:has(.player > .sbar) { padding-block: 0; }
body.session .player + .gate { margin-bottom: var(--s-6); } /* the free-sample note under the player keeps its bottom space */
body.session .lesson-page:has(.player > .sbar) #lesson { margin-top: 0 !important; } /* beats the inline margin in lesson.html, like site.css */
body.session .lesson-page:has(.player > .sbar) .back { display: none; }
/* The player fills the screen, so the dock sits on the bottom edge even when a step is short. Its negative scroll margin
   cancels the top scroll padding, so Next still brings the bar to the very top. player.js adds the two (alignedTop) to
   find that spot and pulls the player back whenever its top is above it. */
body.session .player { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; scroll-margin-top: calc(-1 * (var(--sbar-h) + var(--s-2))); }
body.session .player > .pstage { flex: 1 0 auto; }

/* `.player > .sbar`: site.css already has a stem-card .sbar (an 8 px meter); the child combinator keeps the two apart,
   and the resets below undo what that rule leaks in (height, radius, absolute <i>). */
body.session .player > .sbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: var(--s-3);
  height: auto; min-height: var(--sbar-h); margin-bottom: var(--s-2); border-radius: 0; background: var(--bg); }
/* The x glyph lines up with the content edge; its 44 px hit area reaches into the gutter. */
body.session .sclose { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin-left: -12px; border-radius: 12px; color: var(--muted); }
@media (hover: hover) { body.session .sclose:hover { color: var(--text); } }
body.session .sbar .pchip { flex: none; margin-left: 0; }
body.session .sbar .pchip i { position: static; }

/* One 16 px track: the step segments sit edge to edge, done and current fill green, a 4 px highlight stripe runs along
   the fill, inset 8 px at both ends. A lit (mission done) segment stays green: no orange in the progress. */
body.session .sbar .pbar { flex: 1; min-width: 0; height: 16px; gap: 0; margin: 0; border-radius: 8px; overflow: hidden;
  background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--control-border); } /* the track's edge shows how much is left: 3:1 */
body.session .sbar .pbar i { position: relative; height: 100%; border-radius: 0; background: transparent; box-shadow: none; }
body.session .sbar .pbar i.done, body.session .sbar .pbar i.now { background: var(--good); }
body.session .sbar .pbar i.now { border-radius: 0 8px 8px 0; }
body.session .sbar .pbar i.done::after, body.session .sbar .pbar i.now::after { content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 4px; background: rgb(255 255 255 / .38); }
body.session .sbar .pbar i:first-child::after { left: 8px; border-top-left-radius: 2px; border-bottom-left-radius: 2px; }
body.session .sbar .pbar i.now::after { right: 8px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; }

/* Bottom dock: sticky on every step (also over a practice tool) and clear of the home indicator. */
body.session .pnav, body.session .player:has(.step:not([hidden]) :is(.demo, .wid)) .pnav { position: sticky; bottom: 0; z-index: 20; }
body.session .pnav { min-height: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px)); margin-top: var(--s-5); padding: var(--s-3) 0 calc(var(--s-3) + env(safe-area-inset-bottom, 0px)); }
body.session .pnav .btn { min-height: 56px; font-size: var(--fs-base); }
/* A busy step (js/step-busy.js: it holds an unfinished task, such as an open quiz question) owns the one orange action, so the
   dock's Next steps down to the quiet secondary key. Only the emphasis changes: Next stays shown and clickable. */
body.session .player:has(> .pstage > .step.busy:not([hidden])) .pnav .btn.primary { background: var(--surface-3); border-color: var(--control-border); color: var(--text); box-shadow: 0 3px 0 var(--key-lip); margin-bottom: 3px; }
@media (hover: hover) and (pointer: fine) { body.session .player:has(> .pstage > .step.busy:not([hidden])) .pnav .btn.primary:not(:disabled):hover { background: var(--surface-3); border-color: var(--muted); } }
/* While a feedback sheet (mission success, quiz verdict) is up in the shown step, its action is the one way forward: the dock's
   primary (Next or Finish) steps aside and Back stays. ArrowRight still moves on (player.js reads the hidden attribute, not CSS).
   On step 1 there is no Back, so the empty dock goes too and the sheet takes the bottom edge. */
body.session .player:has(> .pstage > .step:not([hidden]) .fsheet) .pnav .btn.primary { display: none; }
body.session .player:has(> .pstage > .step:not([hidden]) .fsheet):has(> .pnav > .btn:not(.primary)[hidden]) > .pnav { display: none; }
body.session .player:has(> .pstage > .step:not([hidden]) .fsheet):has(> .pnav > .btn:not(.primary)[hidden]) .tact { bottom: env(safe-area-inset-bottom, 0px); }
/* Phones: the dock runs edge to edge, the primary fills the row (all of it on step 1), and the step count leaves the screen
   (the bar shows it) but stays for screen readers. */
@media (max-width: 560px) {
  body.session .pnav { gap: var(--s-3); margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  body.session .pnav .btn.primary { flex: 1; margin-left: 0; }
  body.session .pnav .pcount { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- Keycap quiz and feedback sheet (js/school.js tutor + guess card, js/feedback-sheet.js) ----------
   Options are numbered keycaps (the number is also the keyboard key). Orange = the current pick and the one action (Check);
   green = right. A miss is never red: the pick goes muted and dashed, and the hint sheet is a calm neutral surface.
   .tkeys scopes the look to the school quiz and the guess card; other .topt (practice tools) keep theirs. */
:root { --good-ink: #06210d; }
body.session .tkeys { gap: 10px; }
body.session .tkeys .topt { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; margin-bottom: 4px; padding: 10px 16px 10px 10px;
  border: 2px solid var(--control-border); border-radius: 14px; background: var(--surface-3); box-shadow: 0 4px 0 var(--key-lip);
  color: var(--text); font: 600 1.0625rem/1.3 var(--font); text-align: left; -webkit-tap-highlight-color: transparent; }
body.session .tkeys .topt::before { content: none; } /* site.css draws a radio ring on lesson-page quiz rows */
body.session .tkeys .topt .key { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  box-shadow: inset 0 0 0 2px var(--control-border), 0 2px 0 var(--key-lip); font: 500 14px/1 var(--mono); color: var(--muted); }
body.session .tkeys .topt .otext { min-width: 0; overflow-wrap: anywhere; }
@media (hover: hover) and (pointer: fine) { body.session .tkeys .topt:not(:disabled):not([aria-pressed="true"]):hover { border-color: var(--muted); background: var(--surface-3); } }
body.session .tkeys .topt:active:not(:disabled) { transform: none; }
body.session .tkeys .topt:disabled { cursor: default; }
body.session .tkeys .topt:disabled:not(.right) { opacity: .5; }
/* The pick: orange ring, warm fill, orange lip and key. */
body.session .tkeys .topt[aria-pressed="true"] { border-color: var(--accent); background: #2a1a12; box-shadow: 0 4px 0 var(--accent-lip); }
body.session .tkeys .topt[aria-pressed="true"] .key { background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 0 var(--accent-lip); }
/* Right: green ring, fill, lip and key, and a drawn check at the end. */
body.session .tkeys .topt.right { border-color: color-mix(in oklab, var(--good) 45%, transparent); background: color-mix(in oklab, var(--good) 13%, var(--surface-2)); border-radius: 18px; box-shadow: none; }
body.session .tkeys .topt.right .key { background: var(--good); color: var(--good-ink); box-shadow: 0 2px 0 var(--good-lip); }
body.session .tkeys .topt.right::after { content: ""; flex: none; width: 22px; height: 22px; margin-left: auto; background: var(--good);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 11.5l4.5 4.5L18 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 11.5l4.5 4.5L18 6'/%3E%3C/svg%3E") center / contain no-repeat; }
/* After a miss the right option is only outlined in green (calm), and the miss is muted and dashed, never red. */
body.session .tkeys .topt.right.answer { background: var(--surface-3); box-shadow: 0 4px 0 var(--key-lip); }
body.session .tkeys .topt.right.answer .key { background: none; color: var(--good); box-shadow: inset 0 0 0 2px var(--good); }
body.session .tkeys .topt.miss { border-style: dashed; border-color: var(--line-strong); background: var(--surface-2); box-shadow: none; }
body.session .tkeys .topt.miss .key { background: none; color: var(--muted); box-shadow: inset 0 0 0 2px var(--line-strong); }

/* The Check slot: in flow after the options; in a session it sticks just above the dock and the sheet takes its place.
   The mission success sheet (js/mission-runner.js) uses the same slot at the end of the action step; a locked preview has no
   player and no dock, so there it sits on the bottom edge. */
.tutor .tact, .action-step .tact, .success .tact { margin-top: var(--s-5); }
.tutor .tq:focus { outline: none; } /* focused after Continue so the next question is read; it is not a control */
body.session .tutor .tact, body.session .action-step .tact, body.session .success .tact { position: sticky; bottom: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px)); z-index: 10; margin-top: var(--s-4); padding-top: var(--s-3); background: var(--bg); }
body.session .step.preview .action-step .tact { bottom: env(safe-area-inset-bottom, 0px); }
body.session .tutor .tcheck { width: 100%; min-height: 56px; font-size: var(--fs-base); }
@media (min-width: 561px) { body.session .tutor .tact, body.session .action-step .tact, body.session .success .tact { padding-bottom: var(--s-3); } } /* desktop: the sheet keeps a little air above the dock line */
/* Wide screens: the mission sheet sits in flow at the end of the action step (js/mission-runner.js brings it into view), so it
   never covers the result or a focused lane cell. Phones keep it stuck over the end of the step; while it shows, the band it
   covers (--sheet-cover: its height plus its offset from the bottom edge, measured by the runner) becomes the page's bottom
   scroll padding, so a control focused under it scrolls clear (WCAG 2.2 focus not obscured). */
@media (min-width: 561px) { body.session .action-step .tact { position: static; } }
@media (max-width: 560px) { :root:has(body.session .step:not([hidden]) .action-step .fsheet) { scroll-padding-bottom: calc(var(--sheet-cover, 0px) + var(--s-2)); } }

/* Feedback sheet (soft, 2026-10-27, Larry: "too square, no human smell"): a big-radius sheet with a gentle tinted fill, a round seal with a hand-drawn mark
   that draws in, three tiny sparkles on "right", a warm line as the title. Try-again is the same shape on a calm neutral tint: no red, no hard edge. */
.fsheet { display: grid; gap: var(--s-3); padding: 20px 20px 18px; border-radius: 28px; }
.fsheet .fsheet-title { display: flex; align-items: center; gap: 14px; margin: 0; font: 600 1.5rem/1.2 var(--font); letter-spacing: -.02em; color: inherit; word-break: keep-all; }
.fsheet-seal { position: relative; flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: color-mix(in oklab, var(--good) 24%, var(--surface-2)); color: var(--good); }
.fsheet-seal path { stroke-dasharray: 1; stroke-dashoffset: 0; }
.fsheet-spark { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--good); opacity: 0; }
.fsheet-spark.s1 { top: -3px; right: 2px; } .fsheet-spark.s2 { top: 6px; right: -6px; width: 4px; height: 4px; } .fsheet-spark.s3 { bottom: -2px; left: -4px; width: 4px; height: 4px; }
.fsheet .fsheet-body p { margin: 0; font: 500 1rem/1.5 var(--font); color: inherit; }
.fsheet .fsheet-body p.muted { margin-top: var(--s-3); color: var(--muted); }
.fsheet .teasy { padding: 0; border: 0; background: none; box-shadow: none; color: inherit; }
.fsheet .teasy b { margin-bottom: var(--s-1); font: 500 var(--fs-xs)/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fsheet .fsheet-go { width: 100%; min-height: 56px; margin-top: var(--s-1); font-size: var(--fs-base); border-radius: 999px; }
.fsheet.good { background: color-mix(in oklab, var(--good) 14%, var(--surface-2)); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--good) 26%, transparent), var(--d-shadow-1); }
/* The action is one dark pill on both tones (orange stays for Check). */
.fsheet .fsheet-go, body.session .fsheet .fsheet-go { border-color: var(--muted); background: var(--bg); color: var(--text); box-shadow: none; margin-bottom: 4px; }
.fsheet.good :focus-visible { outline-color: var(--text); }
.fsheet.hint { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--text) 14%, transparent), var(--d-shadow-1); }
.fsheet.hint .fsheet-seal { background: var(--surface-3); color: var(--muted); }
@keyframes fsheet-in { from { transform: translateY(32px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fsheet-draw { to { stroke-dashoffset: 0; } }
@keyframes fsheet-spark { 0% { opacity: 0; transform: scale(.2); } 40% { opacity: 1; transform: scale(1.4); } 100% { opacity: 0; transform: translateY(-4px) scale(.6); } }
/* Phones: the sheet runs edge to edge and meets the dock, like a sheet rising out of it. The cap keeps a long hint scrollable. */
@media (max-width: 560px) {
  body.session .tutor .fsheet, body.session .action-step .fsheet, body.session .success .fsheet { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); border-radius: 28px 28px 0 0; }
  body.session .tutor .fsheet.hint { box-shadow: inset 0 1px 0 color-mix(in oklab, var(--text) 14%, transparent); }
}
body.session .tutor .fsheet, body.session .action-step .fsheet, body.session .success .fsheet { max-height: calc(100dvh - var(--sbar-h) - var(--dock-h) - var(--s-5) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); overflow-y: auto; overscroll-behavior: contain; }

/* ---------- Mission success (js/mission-runner.js, js/mission-sheet.js; popChip in js/points-ui.js) ----------
   The good sheet says "Mission complete" and the nice line; a tier-up (or, with no chip to pop, the points) is one mono line
   under it. "+n P" pops under the points chip for 1.2 s: a small green key, tilted like a sticker. */
.fsheet .fsheet-body p.fsheet-meta { margin-top: var(--s-2); font: 600 var(--fs-xs)/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
body.session .gate[tabindex="-1"]:focus { outline: none; } /* focused by the preview's sheet so the gate is read; it is not a control */
body.session .gate { scroll-margin-top: calc(var(--header-h) + var(--s-4)); } /* the preview's Next brings it in below the sticky site header */
.pchip { position: relative; }
.pchip-pop { position: absolute; top: calc(100% + 8px); right: 0; z-index: 5; padding: 5px 9px; border-radius: 10px; background: var(--good); color: var(--good-ink);
  box-shadow: 0 3px 0 var(--good-lip); font: 600 14px/1 var(--font); letter-spacing: 0; text-transform: none; white-space: nowrap; rotate: -3deg; pointer-events: none; }
@keyframes pchip-pop { 0% { opacity: 0; translate: 0 6px; } 15%, 75% { opacity: 1; translate: 0 0; } 100% { opacity: 0; translate: 0 -6px; } }

/* Motion is opt-in: the sheet slides up, a keycap presses into its lip and the points pop rises and fades only when reduced
   motion is not asked for (with it, the pop just shows for its 1.2 s). */
@media (prefers-reduced-motion: no-preference) {
  .fsheet { animation: fsheet-in 380ms var(--ease-pop) both; }
  .fsheet-seal path { stroke-dashoffset: 1; animation: fsheet-draw 460ms var(--ease-out) 140ms forwards; }
  .fsheet-spark { animation: fsheet-spark 700ms var(--ease-out) 380ms both; }
  .pchip-pop { animation: pchip-pop 1200ms var(--ease-out) both; }
  body.session .tkeys .topt { transition: transform 100ms var(--ease-out), border-color var(--fast) ease, background-color var(--fast) ease; }
  body.session .tkeys .topt:active:not(:disabled) { transform: translateY(4px); box-shadow: none; }
}

/* ---------- Lesson success (js/success-screen.js; numbers from js/success-core.js) ----------
   A raised card: the medal (the one place the tier colour shows) beside the title and "before → after P", the earned lines
   and the total, one line to the next tier over a green bar. The good sheet under it holds the one way forward, a dark key:
   no orange on this screen. Values follow mockups/d/style.css (.medal, .tally, .ladder). The selectors with three classes
   beat the lesson text rules (.step .prose h2 / p). */
.success { display: flex; flex-direction: column; gap: var(--s-4); }
.succ-card { padding: 18px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--line), inset 0 1px 0 rgb(255 255 255 / .06); }
.succ-head { display: flex; align-items: center; gap: 14px; }
.succ-head > div { min-width: 0; }
.succ-medal { flex: none; width: 46px; height: 52px; }
.success[data-tier="bronze"] .succ-medal { color: var(--tier-bronze); }
.success[data-tier="silver"] .succ-medal { color: var(--tier-silver); }
.success[data-tier="gold"] .succ-medal { color: var(--tier-gold); }
.success[data-tier="platinum"] .succ-medal { color: var(--tier-platinum); }
.success .succ-head .succ-title { margin: 0; font: 600 2.125rem/1 var(--font); letter-spacing: -.035em; color: var(--text); }
.success .succ-head .succ-title:focus { outline: none; } /* focused when the screen shows, so it is read; it is not a control */
.success .succ-head .succ-range { margin: 6px 0 0; font: 500 var(--fs-sm)/1.3 var(--mono); color: var(--muted); }
.succ-range b { color: var(--text); font-weight: 600; }
.succ-tally { margin: var(--s-4) 0 0; padding: 4px 0 0; border-top: 1px solid var(--line); }
.succ-tally > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); padding: 5px 0; font: 500 var(--fs-sm)/1.4 var(--mono); color: var(--muted); }
.succ-tally dt, .succ-tally dd { margin: 0; }
.succ-tally dd { color: var(--text); font-weight: 600; white-space: nowrap; }
.succ-tally > .succ-sum { margin-top: 4px; padding-top: 9px; border-top: 1px solid var(--line); color: var(--text); }
.succ-tally > .succ-sum dd { font-size: var(--fs-base); font-weight: 600; }
.succ-next { margin-top: var(--s-5); }
.success .succ-next .succ-next-head { display: flex; justify-content: space-between; gap: var(--s-3); margin: 0; font: 500 var(--fs-xs)/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.succ-next-head b { color: var(--text); font-weight: 500; }
.succ-next-head .succ-of { white-space: nowrap; }
.succ-bar { height: 8px; margin-top: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.succ-bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); border-radius: 4px; background: var(--good); }
.success > .btn { align-self: flex-start; } /* the quiz's Try again: a secondary key under the card */
/* In a session the screen takes the rest of the page, so its sheet sits on the dock as in the mockup: while it is shown, the
   stage, the step, the lesson text box and the box around the screen grow as flex columns, and the sheet's slot takes the free
   space above it. Its negative bottom margin crosses the dock's top margin (--s-5), so sheet and dock meet. */
body.session .pstage:has(> .step:not([hidden]) .success),
body.session .pstage > .step:not([hidden]):has(.success),
body.session .pstage > .step:not([hidden]) > .prose:has(.success),
body.session .prose :is(.success-slot, .tutor):has(> .success) { display: flex; flex-direction: column; }
body.session .pstage > .step:not([hidden]):has(.success),
body.session .pstage > .step:not([hidden]) > .prose:has(.success),
body.session .prose :is(.success-slot, .tutor):has(> .success),
body.session .prose .success { flex: 1 0 auto; }
body.session .success > .tact { margin-top: auto; margin-bottom: calc(-1 * var(--s-5)); }
/* "The beat you made" (js/beat-made.js, beat lessons only): a mono label, a small read-only copy of the lanes run edge to edge
   in the card (negative margin = the card padding) with each name in its lane's top corner, then three stats in thirds.
   The stems are the lanes' own rules above, at thumbnail size; nothing here takes a tap. */
.beat-made { margin-top: var(--s-3); }
.success .beat-made .bm-label { margin: 0 0 6px; font: 500 var(--fs-xs)/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.bm-lanes { margin-inline: -18px; pointer-events: none; user-select: none; -webkit-user-select: none; }
.bm-lanes .lane-axis { height: 18px; }
.bm-lanes .lane-ax { padding-top: 2px; font-size: 12px; }
.bm-lanes .lane-ax.b { font-size: 12px; }
.bm-lanes .lane-ax.b::after { height: 6px; }
.bm-lane { --area: 10px; --head: 5px; --sw: 2px; --ink: var(--text);
  position: relative; display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); height: 20px; border-bottom: 1px solid var(--line-strong); }
.bm-cell { --f: 0; position: relative; min-width: 0; background: var(--band-a); }
.bm-cell:nth-child(8n+5), .bm-cell:nth-child(8n+6), .bm-cell:nth-child(8n+7), .bm-cell:nth-child(8n+8) { background: var(--band-b); }
.bm-cell:nth-child(4n+1):not(:first-child) { box-shadow: inset 1px 0 0 var(--line); }
.bm-lanes .bm-cell[data-v="off"]::after { --head: 3px; bottom: 2px; }
.bm-name { position: absolute; top: 1px; left: 6px; font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.bm-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.bm-stats > div { min-width: 0; padding: 6px 0 0; }
.bm-stats > div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.bm-stats dt { font: 500 var(--fs-xs)/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.bm-stats dd { margin: 2px 0 0; font: 600 1.375rem/1.1 var(--font); letter-spacing: -.03em; color: var(--text); overflow-wrap: anywhere; }
.bm-stats small { font: 500 var(--fs-xs)/1 var(--mono); letter-spacing: 0; color: var(--muted); }
@media (min-width: 561px) {
  .succ-card { padding: 24px; }
  .bm-lanes { margin-inline: -24px; }
  .bm-lane { --area: 20px; --head: 8px; height: 32px; }
  .succ-medal { width: 60px; height: 67px; }
  .success .succ-head .succ-title { font-size: 2.5rem; }
}
/* Motion is opt-in: the medal grows in only when reduced motion is not asked for (with it, it is simply there). */
@media (prefers-reduced-motion: no-preference) {
  .succ-medal { animation: pm-medal-pop var(--dur-hero) var(--ease-pop) both; }
}
body.session .step.busy .beat-presets { display: none; } /* the preset row is the mission answer: hidden until the mission succeeds (busy removed) */

/* Term cards: unscored definitions shown under the ear quiz (Phase 2D). Each card is a question, a "show answer" key and the answer. */
.tcards { margin-top: var(--s-5); }
.tcards summary { cursor: pointer; font: 500 var(--fs-xs)/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); min-height: 44px; display: flex; align-items: center; }
.tcards .tcard { margin: var(--s-4) 0; padding-top: var(--s-3); border-top: 1px solid var(--line, rgb(255 255 255 / .12)); }
.tcards .tcard .tq { margin: 0 0 var(--s-2); font-size: var(--fs-md); font-weight: 600; }
.tcards .tcard-a b { display: block; margin-bottom: var(--s-1); }
.tcards .tcard-a p { margin: 0; }
.tcards .btn { min-height: 44px; }
.tcards .tcards-h { margin: 0 0 var(--s-2); }
.tcards h3.tcards-h { font-size: var(--fs-md); font-weight: 600; }
.tcards .tcards-note { margin: 0 0 var(--s-3); }
.tcards .tcard .tcount { margin: 0 0 var(--s-1); font: 500 var(--fs-xs)/1.4 var(--mono); color: var(--muted); }
.tcards .tcard .btn { width: 100%; }
.tcards .tcard-a:focus { outline: none; }
.tcards .tcards-seen { margin: var(--s-3) 0 0; font-size: var(--fs-sm); }
.tcards :is(.tq, .tcard-a, .tcards-note) { overflow-wrap: anywhere; }
/* The beat pad pulses on its beat (Rebuild P1 motion #8). */
.pad.now { animation: pm-beat var(--dur-base) var(--ease-std); }
