@import url(volume.css);
@import url(book.css);   /* this book's own settings and overrides (not shared), before the rules below */
/* The palette. lib/book.css may redefine any of it in its own ':root' (this one has no specificity), e.g. a light board
   with dark ink: the stage, COL in engine.js, the cards and the player bar all follow. Colours are #rrggbb. The last
   lines are shades between those colours, written out so the dark board stays exact: a palette of its own sets them too
   (the light set in book.css). */
:where(:root) {
  --page: #0f1613; --board: #1d2b27; --panel: #22322d; --edge: #3a5047;
  --chalk: #ece8dc; --dim: #9aaba3; --faint: #5d7068;
  --task: #f0b45a; --quiz: #86c9e8; --good: #8fd6b0; --bad: #f08c7a;
  --ui: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --vignette: rgba(0, 0, 0, .35);   /* the stage's darkened edges; a light board wants a faint, warm one */
  color-scheme: dark;
  --rule: #2e433b;                            /* lines between answer rows */
  --track: #2f4640; --track-ask: #2d4a57;     /* the player bar's steps, and its question steps */
  --bar-edge: #2a3b35; --hover: #2b3f36;      /* the bar's top line, the volume control under the pointer */
  --veil: #0a100e;                            /* behind the help panel and the captions */
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--page); }
body { color: var(--chalk); font: 26px/1.4 var(--ui); }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--task); outline-offset: 3px; }
button[hidden] { display: none; }

/* One fixed 1600×960 frame (900 stage + 60 controls), scaled to fit the window. Fixed, not absolute: a frame wider
   than a phone would otherwise widen the phone's layout viewport, and fit() would scale to that wider width. */
#frame { position: fixed; left: 50%; top: 50%; width: var(--sw, 1600px); height: calc(var(--sh, 900px) + 60px); transform: translate(-50%, -50%) scale(var(--k, .5));
  border-radius: 20px; overflow: hidden; background: var(--board); box-shadow: 0 0 0 1px var(--edge), 0 30px 80px rgba(0, 0, 0, .45); }
#stage { position: absolute; left: 0; top: 0; width: var(--sw, 1600px); height: var(--sh, 900px); display: block;
  background: radial-gradient(75% 75% at 50% 45%, rgba(0,0,0,0) 60%, var(--vignette)), var(--grain, none), var(--board); }
#ui { position: absolute; left: 0; top: 0; width: var(--sw, 1600px); height: var(--sh, 900px); pointer-events: none; }
#ui > * { pointer-events: auto; }

.cover { position: absolute; left: 0; top: 0; width: var(--sw, 1600px); height: var(--sh, 900px); display: grid; place-items: center; background: color-mix(in srgb, var(--page) 50%, transparent); border: 0; }
.cover[hidden] { display: none; }
.cover > div { display: flex; flex-direction: column; align-items: center; }
.cover-k { margin: 0 0 10px; text-align: center; font-size: 31px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--quiz); }
.cover-t { margin: 0 0 44px; max-width: min(1200px, calc(var(--sw, 1600px) - 100px)); text-align: center; font: 500 64px/1.15 "Iowan Old Style", Palatino, Georgia, serif; color: var(--chalk); text-wrap: balance; }
.cover > div > * { animation: rise .7s cubic-bezier(.2, .8, .2, 1) backwards; }
.cover-t { animation-delay: .08s; }
.cover .go { animation-delay: .18s; }
.cover small { animation-delay: .26s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.cover .go { display: inline-flex; align-items: center; gap: 16px; padding: 20px 40px; border-radius: 999px; background: var(--chalk); color: var(--board); font-weight: 600; font-size: 32px; }
.cover small { display: block; margin-top: 22px; font-size: 31px; text-align: center; color: var(--dim); }
.paused-mark { position: absolute; left: 0; top: 0; width: var(--sw, 1600px); height: var(--sh, 900px); display: none; place-items: start center; padding-top: 10px; box-sizing: border-box; pointer-events: none; }
.paused .paused-mark { display: grid; }
.paused-mark div { padding: 8px 24px; border-radius: 999px; background: color-mix(in srgb, var(--page) 85%, transparent); color: var(--dim); font-size: 22px; }

/* Question cards inside the picture. */
.card { position: absolute; padding: 20px 26px; border-radius: 20px; background: color-mix(in srgb, var(--panel) 97%, transparent); border: 1.5px solid var(--edge); border-inline-start: 7px solid var(--quiz); box-shadow: 0 14px 44px rgba(0, 0, 0, .35); }
.card.band { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "pic head body acts" "pic fb body acts"; column-gap: 28px; align-items: center; align-content: center; min-height: 150px; }
.band .mascot { grid-area: pic; }
.band .head { grid-area: head; align-self: end; }
.band .fb { grid-area: fb; align-self: start; }
.band .body { grid-area: body; }
.band .acts { grid-area: acts; }
.card.band .cdock { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 22px; align-items: flex-end; padding: 2px 8px 0 4px; }
.card.band.peek .cdock { visibility: hidden; }
.card.band:has(.cdock) .keys, .card.band:has(.cdock) .mascot { display: none; }
.card.band:has(.cdock) { min-height: 0; }
.side .mascot { float: inline-end; margin-block: -2px 6px; margin-inline: 10px -4px; }
.kicker { margin: 0 0 4px; font-size: 20px; font-weight: 600; color: var(--quiz); }
.prompt { margin: 0; font-size: 28px; line-height: 1.35; }
.side .prompt { font-size: 24px; }
.body:empty { display: none; }
.side .body { margin-top: 14px; }
.opts { display: flex; gap: 12px; flex-wrap: wrap; }
.opt { padding: 8px 24px; border-radius: 999px; border: 2px solid var(--edge); background: transparent; color: var(--chalk); font-size: 24px; min-height: 58px; display: inline-flex; align-items: center; }
.opt:hover:not(:disabled) { border-color: var(--dim); }
.opt[aria-pressed="true"] { background: var(--c, var(--chalk)); border-color: var(--c, var(--chalk)); color: var(--on-fill, #1b2320); font-weight: 600; }
.opt.good { border-color: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 35%, transparent); }
.opt.bad { border-color: var(--bad); color: var(--bad); }
.opt:disabled { cursor: default; }
.fb { margin-top: 8px; font-size: 22px; line-height: 1.4; color: var(--chalk); }
.fb:empty { display: none; }
.fb.ok::before { content: "✓ "; color: var(--good); font-weight: 700; }
.fb.no::before { content: "✗ "; color: var(--bad); font-weight: 700; }
.fb ul { margin: 6px 0 0; padding-inline-start: 22px; }
.side .fb { max-height: 110px; overflow: auto; font-size: 20px; }
.acts { display: flex; gap: 12px; align-items: center; }
.side .acts { margin-top: 16px; }
.side .acts { flex-wrap: wrap; gap: 10px; }
.side .btn { padding: 8px 16px; font-size: 20px; }
.card.side { padding: 18px 22px; }
.btn { padding: 10px 28px; border-radius: 999px; border: 0; background: var(--chalk); color: var(--board); font-weight: 600; font-size: 22px; white-space: nowrap; }
.btn.quiet { background: transparent; color: var(--dim); border: 1.5px solid var(--edge); }
.btn.go { background: var(--quiz); color: var(--on-fill, #10242e); }   /* --on-fill: text on a coloured fill */
.btn:disabled { background: var(--edge); color: var(--dim); cursor: default; }

.grid .row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 34px; gap: 16px; align-items: center; padding: 5px 0; padding-inline-start: 12px; border-bottom: 1px solid var(--rule); }
.grid .num { display: flex; justify-content: flex-end; align-items: center; font-size: 26px; }
.grid.text .row { grid-template-columns: minmax(0, 1fr) auto 34px; }
.grid.text .num { justify-content: flex-start; }
.grid .opts { gap: 8px; }
.grid .opt { padding: 3px 16px; min-height: 42px; font-size: 20px; }
.grid .mark { font-weight: 700; text-align: center; }
.grid .mark.good { color: var(--good); }
.grid .mark.bad { color: var(--bad); }
.grid .why { grid-column: 1 / -1; font-size: 19px; color: var(--dim); padding-inline-start: 186px; }
.grid.text .why { padding-inline-start: 0; }
.grid .why:empty { display: none; }

.hit { cursor: pointer; }
.hit .ring { fill: transparent; stroke: var(--chalk); stroke-width: 2.5; stroke-opacity: 0; }
.hit:hover .ring, .hit:focus .ring { stroke-opacity: .7; }
.hit.bad .ring { stroke: var(--bad); stroke-opacity: 1; }
.hit.good .ring { stroke: var(--good); stroke-opacity: 1; stroke-width: 4; }
/* Listen and find (findWords): the word beside a tapped thing. A book can set --word-font for its early-reader letters. */
.findw rect:focus-visible { stroke: var(--chalk); stroke-width: 5; outline: none; }
#ui > .card.word { pointer-events: none; padding: 2px 36px 10px; border-inline-start-width: 1.5px; border-radius: 30px; font: 600 96px/1.15 var(--word-font, var(--ui)); white-space: nowrap; animation: word-in .3s cubic-bezier(.3, 1.5, .6, 1); }
@keyframes word-in { from { transform: scale(.6); opacity: 0; } }
.tok { cursor: grab; touch-action: none; }   /* a finger drags the chip instead of scrolling the page */

/* Controls strip, part of the frame. */
#bar { position: absolute; left: 0; top: var(--sh, 900px); width: var(--sw, 1600px); height: 60px; display: flex; align-items: center; gap: 10px; padding: 0 20px; background: color-mix(in srgb, var(--page) 50%, var(--board)); border-top: 1px solid var(--bar-edge); }
.icon { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--edge); background: var(--panel); display: grid; place-items: center; flex: none; padding: 0; }
.icon svg { width: 18px; height: 18px; fill: var(--chalk); }
.icon .i-pause { display: none; }
.is-playing .icon .i-play { display: none; }
.is-playing .icon .i-pause { display: block; }
.segs { flex: 1; display: flex; gap: 4px; height: 30px; align-items: center; min-width: 0; margin: 0 8px; }
.seg { position: relative; display: block; min-width: 0; height: 8px; border-radius: 4px; background: var(--track); border: 0; padding: 0; overflow: hidden; }
.seg:hover { height: 12px; }
.seg i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--chalk); }
.seg.ask { background: var(--track-ask); }
.seg.ask i { background: var(--quiz); }
.step { width: 300px; flex: none; color: var(--dim); font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
/* Keep the control strip usable without scaling down its touch targets. */
@media (max-width: 700px) {
  #frame { top: calc(50% - 50px); overflow: visible; }
  #bar { width: calc(var(--sw, 1600px) * var(--k)); height: auto; flex-wrap: wrap; gap: 6px; padding: 8px;
    transform: scale(calc(1 / var(--k))); transform-origin: left top; border-radius: 0 0 12px 12px; }
  #bar .icon { width: 36px; height: 40px; }
  .step { display: none; }
  #bHelp { display: none; }   /* keyboard shortcuts; room for the speed button on a phone */
  #bar .icon.speed { width: 36px; min-width: 0; padding: 0; font-size: 12px; letter-spacing: -.3px; }
  .segs { order: 1; }
  .segs { min-width: 80px; margin: 0; }
  :root.full #bar { transform-origin: left bottom; border-radius: 0; }
}

/* Short landscape phones (e.g. 915x412): same rule as portrait phones, the strip is counter-scaled so its buttons stay 44 px. */
@media (max-height: 500px) and (min-width: 701px) {
  #frame { top: calc(50% - 28px); overflow: visible; }
  #bar { width: calc(var(--sw, 1600px) * var(--k)); height: auto; flex-wrap: wrap; gap: 6px; padding: 6px 8px;
    transform: scale(calc(1 / var(--k))); transform-origin: left top; border-radius: 0 0 12px 12px; }
  #bar .icon { width: 44px; height: 44px; }
  .step, #bHelp { display: none; }
  #bar .icon.speed { min-width: 0; padding: 0; font-size: 13px; }
  .segs { min-width: 60px; margin: 0 4px; }
  :root.full #bar { transform-origin: left bottom; border-radius: 0; }
}
/* Full screen: the stage fills the screen and the controls lie over its foot, out of sight until the pointer moves
   (engine.js wake(): .awake), while paused or ended (.held) and while the pointer is on them. */
:root.full #frame { top: 50%; height: var(--sh, 900px); border-radius: 0; box-shadow: none; }
:root.full #bar { top: auto; bottom: 0; transition: opacity .3s; border-top: 0;
  background: linear-gradient(transparent, color-mix(in srgb, var(--page) 85%, transparent)); }
:root.full #frame:not(.awake):not(.held) #bar:not(:hover):not(:focus-within) { opacity: 0; pointer-events: none; }
:root.full #frame:not(.awake):not(.held):not(:has(#bar:hover)) { cursor: none; }
/* A touch screen has no hover to bring the controls back, and a tap that answers a question would cover the card with
   them: there full screen keeps them, full size, under the stage (fit() leaves them room). */
@media (pointer: coarse) {
  :root.full #frame { top: calc(50% - 30px); overflow: visible; }
  :root.full #frame #bar { top: var(--sh, 900px); bottom: auto; width: calc(var(--sw, 1600px) * var(--k)); height: auto; flex-wrap: wrap;
    gap: 6px; padding: 8px; transform: scale(calc(1 / var(--k))); transform-origin: left top; background: none; opacity: 1 !important; pointer-events: auto !important; }
  :root.full #bar .icon { width: 40px; height: 40px; }
  :root.full .step, :root.full #bHelp { display: none; }
  :root.full .segs { order: 1; min-width: 80px; margin: 0; }
}
@media (pointer: coarse) and (max-width: 700px) { :root.full #frame { top: calc(50% - 55px); } }

.sound-note { position: absolute; inset-inline-start: 24px; top: 20px; margin: 0; padding: 8px 18px; border-radius: 12px; background: color-mix(in srgb, var(--page) 85%, transparent); color: var(--dim); font-size: 19px; }
.sound-note[hidden] { display: none; }
.blanks .brow { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.blanks .brow:last-child { border-bottom: 0; }
.blanks .bline { line-height: 64px; white-space: nowrap; }
.blanks .mark { display: inline-block; margin-inline-start: 14px; font-weight: 700; }
.blanks .mark.good { color: var(--good); animation: pop .35s ease-out; }
.blanks .mark.bad { color: var(--bad); }
.blanks .why { font-size: 19px; color: var(--dim); line-height: 1.35; }
.blanks .why:empty { display: none; }
.box { height: 52px; margin: 0 6px; padding: 0 6px; border: 0; border-bottom: 3px solid var(--quiz); border-radius: 8px 8px 0 0; background: color-mix(in srgb, var(--chalk) 7%, transparent); color: var(--chalk); font: 32px var(--math-font, "STIX Two Text", "Cambria Math", "Iowan Old Style", Palatino, Georgia, serif); text-align: center; vertical-align: -6px; }
.box:focus { outline: none; background: color-mix(in srgb, var(--quiz) 16%, transparent); }
.box.good { border-color: var(--good); }
.box.bad { border-color: var(--bad); }
.box:disabled { opacity: 1; }
kbd { display: inline-block; min-width: 1.5em; padding: 0 .4em; margin-inline-start: .5em; border: 1.5px solid currentColor; border-radius: 6px; font: 600 .7em/1.5 var(--ui); text-align: center; vertical-align: .12em; opacity: .6; }
.opt kbd { margin: 0; margin-inline-end: .6em; }
.keys { margin: 6px 0 0; font-size: 18px; color: var(--dim); }
.keys kbd { margin: 0 .15em; }
.grid .row.cur { background: color-mix(in srgb, var(--chalk) 5%, transparent); box-shadow: inset 4px 0 var(--quiz); }
.help { position: absolute; left: 0; top: 0; width: var(--sw, 1600px); height: var(--sh, 900px); display: grid; place-items: center; background: color-mix(in srgb, var(--veil) 72%, transparent); }
.help[hidden] { display: none; }
.help-box:focus { outline: none; }   /* focused as the open dialog, not as a control */
.help-box { width: min(1120px, calc(var(--sw, 1600px) - 80px)); padding: 40px 50px; border-radius: 22px; background: var(--panel); border: 1.5px solid var(--edge); }
.help h2 { margin: 0 0 22px; font-size: 32px; font-weight: 600; }
.help h3 { margin: 0 0 12px; font-size: 20px; font-weight: 600; color: var(--quiz); }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }
.help-cols:has(> [hidden]) { grid-template-columns: 1fr; }
.help dl { margin: 0; display: grid; grid-template-columns: 150px 1fr; row-gap: 10px; font-size: 22px; }
.help dt { text-align: end; padding-inline-end: 18px; white-space: nowrap; }
.help dt kbd { margin: 0; margin-inline-start: .3em; opacity: .9; }
.help dd { margin: 0; color: var(--dim); }
.help-close { margin: 26px 0 0; font-size: 18px; color: var(--dim); }
.icon.txt { font-size: 20px; font-weight: 700; color: var(--dim); }
/* Optional captions of the narration, one sentence at a time. Off by default: teaching text lives in the picture. */
.caption { position: absolute; left: 50%; bottom: 78px; transform: translateX(-50%); width: max-content; max-width: min(1180px, calc(var(--sw, 1600px) - 80px)); padding: 10px 24px; border-radius: 14px; background: color-mix(in srgb, var(--veil) 82%, transparent); color: var(--chalk); font-size: 28px; line-height: 1.35; text-align: center; pointer-events: none; }
.caption[hidden] { display: none; }
.icon.cc { font-size: 15px; font-weight: 700; color: var(--dim); }
.icon.cc[aria-pressed="true"] { background: var(--chalk); border-color: var(--chalk); color: var(--board); }
.card.side { overflow: auto; }
svg.m { display: inline-block; overflow: visible; }
.card b { font-weight: 700; }   /* not 'bolder' (900 under a 600 prompt) */
.card { animation: card-in .45s cubic-bezier(.2, .9, .3, 1.15); }
.fb:not(:empty) { animation: fb-in .3s ease-out; }
.opt.bad, .grid .mark.bad { animation: shake .4s; }
.grid .mark.good { animation: pop .35s ease-out; }
@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }
@keyframes fb-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.3); } }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
/* Full-screen chapter practice. */
.card.screen { height: 900px; padding: 50px 70px; border: 0; border-radius: 0; background: transparent; box-shadow: none; animation: screen-in .5s ease-out; max-height: none; overflow: visible; }
.screen .kicker { font-size: 22px; }
.screen .prompt { font-size: 40px; font-weight: 600; }
.screen .body { margin-top: 30px; }
.card.screen { display: flex; flex-direction: column; }
.screen .head { order: 1; } .screen .body { order: 2; }
.screen .fb { order: 3; max-width: min(1080px, calc(var(--sw, 1600px) - 140px)); margin: 26px 0 0; font-size: 24px; }   /* feedback right under the answers */
/* Practice screens: the bottom 130 px hold the buttons. Long answers scroll inside the body, so the feedback under
   them stays in view after a wrong answer adds a 'why' line to each row. */
.card.screen:not(.sort):not(.fin) { padding-bottom: 130px; }
.card.screen:not(.sort):not(.fin) > .head, .card.screen:not(.sort):not(.fin) > .fb { flex: none; }
.card.screen:not(.sort):not(.fin) > .body { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
.screen .acts { position: absolute; inset-inline-end: 70px; bottom: 48px; }
.screen .grid .row { grid-template-columns: 200px minmax(0, 1fr) 40px; padding: 9px 0; padding-inline-start: 12px; }
/* a long label (a system of equations) widens the label column for every row instead of running off the card's left */
.screen .grid:not(.text) { display: grid; grid-template-columns: minmax(200px, max-content) minmax(0, 1fr) 40px; }
.screen .grid:not(.text) > .row { grid-column: 1 / -1; grid-template-columns: subgrid; }
.screen .grid.text .row { grid-template-columns: minmax(0, 1fr) auto 40px; }
.screen .grid .opt { font-size: 22px; min-height: 50px; padding: 4px 20px; }
.screen .grid .why { padding-inline-start: 216px; font-size: 20px; }
.screen .grid.text .why { padding-inline-start: 0; }
#ui > .screen.sort { pointer-events: none; }
.screen.sort > * { pointer-events: auto; }
.screen.sort .head { position: absolute; right: 34px; top: 40px; width: 330px; }
.screen.sort .prompt { font-size: 28px; }
.screen.sort .fb { position: absolute; margin: 0; left: auto; right: 34px; bottom: 116px; width: 330px; max-height: 240px; overflow: auto; font-size: 20px; }
.screen.sort .acts { right: 34px; }
.fin .finwrap { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; padding-bottom: 60px; }
.fin .mascot { margin-bottom: 28px; }
.fin .fb, .fin .acts { position: static; }
.fin .fb { order: 0; margin: 0; }   /* result lines, not answer feedback: keep them above the buttons */
.fin .acts { margin-top: 30px; }
@keyframes screen-in { from { opacity: 0; } }

/* The guide: an infinity sign whose loops are its eyes. */
.mascot { display: block; flex: none; overflow: visible; }
.mascot .mbody { transform-box: view-box; transform-origin: 60px 46px; animation: bob 3.4s ease-in-out infinite; }
.mascot .eyes { transition: transform .3s; }
.mascot .pupil { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
.mascot .joy, .mascot .flat { display: none; }
.mascot.happy .pupil { display: none; }
.mascot.happy .joy { display: inline; }
.mascot.happy .mbody { animation: hop .55s ease-out 2, bob 3.4s ease-in-out 1.1s infinite; }
.mascot.oops .eyes { transform: translate(-3px, 4px); }
.mascot.oops .smile { display: none; }
.mascot.oops .flat { display: inline; }
.mascot.oops .mbody { animation: wobble .5s ease-in-out, bob 3.4s ease-in-out .5s infinite; }
@keyframes bob { 50% { transform: translateY(-3px) rotate(-2deg); } }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes hop { 40% { transform: translateY(-12px) rotate(4deg); } }
@keyframes wobble { 25% { transform: rotate(-8deg); } 75% { transform: rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .card, .fb, .opt, .grid .mark, .mascot * { animation: none !important; } }

a.icon { text-decoration: none; }
/* Citations (cite() and plain-text labels found in refs.js) and the finish card's source list open the source in a new tab. */
a.cite { cursor: pointer; }
a.cite text, a.cite tspan { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 5px; }
a.cite:hover text, a.cite:hover tspan { fill: var(--quiz); }
a.cite:focus { outline: none; }
a.cite:focus-visible text, a.cite:focus-visible tspan { fill: var(--task); }
a.cite:focus-visible { outline: 3px solid var(--task); outline-offset: 6px; border-radius: 4px; }
#ui a.cite { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
#ui a.cite:hover { color: var(--quiz); }
.fin .srcs { margin: 26px 0 0; max-width: min(1100px, calc(var(--sw, 1600px) - 100px)); font-size: 19px; line-height: 1.45; color: var(--dim); text-align: start; }
.fin .srcs h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--quiz); }
.fin .srcs ol { margin: 0; padding-left: 0; list-style: none; max-height: 190px; overflow: auto; }
.fin .srcs li { padding-inline-start: 2em; text-indent: -2em; margin: 0 0 6px; }
.fin .srcs a { color: var(--chalk); text-underline-offset: 3px; }
.fin .srcs a:hover { color: var(--quiz); }
.fin .srcs a:focus-visible { outline: 3px solid var(--task); outline-offset: 2px; }
a.btn { text-decoration: none; display: inline-block; }
/* Page-to-page motion: the contents card grows into this frame, and shrinks back on the way out. */
@view-transition { navigation: auto; }
#frame { view-transition-name: lesson; }
::view-transition-group(lesson) { animation-duration: .5s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(lesson), ::view-transition-new(lesson) { height: 100%; object-fit: cover; }
::view-transition-old(lesson) { animation-duration: .18s; }
@media (prefers-reduced-motion: reduce) { .cover > div > * { animation: none; } ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }
/* The finish screen speaks the same type as the chapter cover and the contents page. */
.fin .kicker { font-size: 20px; letter-spacing: .14em; text-transform: uppercase; }
.fin .prompt { margin: 6px 0 14px; font: 500 56px/1.15 "Iowan Old Style", Palatino, Georgia, serif; }
.icon.speed { width: auto; min-width: 44px; padding: 0 10px; border-radius: 22px; font-size: 16px; }
/* An upright stage is seen at about half the scale of a wide one on the same screen: bigger caption text. */
:root[data-stage="portrait"] .step { width: 120px; }   /* the 900-wide bar keeps room for the steps */
:root[data-stage="portrait"] .caption { font-size: 38px; bottom: 60px; }
/* Right-to-left interface text (engine.js sets <html dir="rtl"> for Arabic). Cards, captions, help and the cover read from
   the right through the logical properties above (border-inline-start, inset-inline-end, …). The stage and the player bar
   keep their left-to-right geometry, so a drawing's coordinates, the timeline and the ← → keys mean the same in every
   language (the bar's step label reads "3 / 6  title" as the bar does). Mathematics reads left to right inside Arabic
   text, as in Arabic school books: an expression (svg.m) and an answer line (.bline: "3 + 4 = [box] ✗") keep their order. */
[dir="rtl"] :is(#stage, #bar, svg.m, .bline) { direction: ltr; }
/* Each text on the stage takes its reading order from its own first letter (plaintext): an Arabic line keeps its words,
   its numbers, a Latin name and its closing "." or ":" in Arabic order, an English line stays as it was, in a book of
   any language. The anchor keeps the stage's left-to-right geometry: 'start' is still the text's left end, 'end' its right. */
#stage text { unicode-bidi: plaintext; }
[dir="rtl"] .grid .row.cur { box-shadow: inset -4px 0 var(--quiz); }   /* the current row's bar at its start, the right */
/* Arabic letters join: letter spacing breaks the words apart. The faces are each system's own Arabic UI and book faces;
   no font file is loaded. A book's own lib/book.css :root still wins (these have no specificity). */
:where(:root:lang(ar)) { --ui: "Segoe UI", "SF Arabic", "Geeza Pro", "Noto Sans Arabic", Tahoma, sans-serif; }
[dir="rtl"] :is(.cover-k, .fin .kicker, .fin .srcs h2) { letter-spacing: 0; }
:root:lang(ar) .cover-t, :root:lang(ar) .fin .prompt { font-family: "Noto Naskh Arabic", "Traditional Arabic", "Times New Roman", serif; }
/* Landscape short windows (about 915x412): the stage is scaled to about .36, so the quiz and practice cards (HTML in stage px) need larger type to read at 11 px or more. Portrait and desktop are untouched. */
@media (max-height: 500px) and (min-width: 701px) {
  .card.band { min-height: 0; padding: 10px 22px; column-gap: 20px; margin-top: -8px; }
  .card.band:has(> .body > .opts) { grid-template-columns: auto minmax(440px, 1fr) auto auto; }
  .band .mascot { display: none; }
  .card .kicker { font-size: 31px; margin-bottom: 2px; }
  .card .prompt, .side .prompt { font-size: 34px; line-height: 1.22; }
  .card .tip, .card .tip summary, .card .tip span { font-size: 31px; }
  .card .keys { display: none; }
  .card kbd { font-size: 26px; }
  .card .opt { font-size: 33px; min-height: 66px; padding: 6px 26px; }
  .card .btn { font-size: 31px; min-height: 62px; padding: 6px 24px; }
  .card .box { font-size: 36px; height: 62px; }
  .card .fb, .card .why { font-size: 31px; line-height: 1.2; }
  .screen .prompt { font-size: 44px; }
  .screen .grid .opt, .screen .opt { font-size: 33px; min-height: 66px; }
  .grid .opt { font-size: 31px; min-height: 58px; }
  .grid .num { font-size: 33px; }
}
/* Finals practice cards (number and choice items): a left panel, 52% of the stage, opaque like the band cards, so the lesson figure never prints through the card text. The chart on the right stays visible. */
.card.screen:not(.sort):not(.fin) { width: 880px !important; padding-top: 30px; padding-left: 50px; background: var(--panel); border-right: 2px solid var(--edge); padding-right: 36px; }
.card.screen:not(.sort):not(.fin) .fb { max-width: 100%; }
/* Figure toggle: the panel fades so the stage figure shows; only the Figure button stays. */
.card.screen:not(.sort):not(.fin).peek { background: transparent; border-right-color: transparent; pointer-events: none; }
.card.screen.peek > .head, .card.screen.peek > .fb, .card.screen.peek > .body, .card.screen.peek > .keys { visibility: hidden; }
.card.screen.peek .acts { pointer-events: auto; }
.card.screen.peek .acts .btn:not(.fig) { visibility: hidden; }
.card.screen .acts .btn.fig { white-space: nowrap; }
.card.screen:not(.sort):not(.fin) .prompt { font-size: 32px; line-height: 1.22; }
.card.screen:not(.sort):not(.fin) .body { margin-top: 18px; }
.card.screen:not(.sort):not(.fin) .fb { margin-top: 14px; }
.card.screen:not(.sort):not(.fin) .prompt sub, .card.screen:not(.sort):not(.fin) .prompt sup { line-height: 0; }
.card.screen:not(.sort):not(.fin) .prompt .tip { margin-top: 0; }

/* band card: see-through while the Show figure button is on (the figure and its sliders underneath can be used) */
/* Band cards are opaque: scene text drawn faintly behind the card (lessons reveal captions gradually) must not print through the question. */
.card.band:not(.peek) { background: var(--panel); }
.card.band.peek { background: transparent; box-shadow: none; border-color: transparent; pointer-events: none; }
.card.band.peek > *:not(.acts) { visibility: hidden; }
.card.band.peek .acts > .btn:not(.fig) { visibility: hidden; }
.card.band.peek .acts > .btn.fig { pointer-events: auto; background: var(--page); }
.card.band .acts .btn.fig { white-space: nowrap; }
