/* Block reading (src/animatedReading.js): a picture book. Each page is one scene: the picture printed on the
   left page, its sentences in Spanish and Polish on the right; pages fade into each other, nothing slides.
   Then the questions and the student's own page take the right page's place. The controls are icons on the
   book's binding. It borrows the animated conversation's options and buttons (.ac-*).
   Flat colours only (styles/no-gradients.css); the paper's depth comes from box-shadows. The formulas are
   marked in the portal's indigo, so the student recognises the sentences they practised.
   Fresco (styles/fresco-tokens.css): the cover and binding are the portal's indigo, the controls are its
   buttons turned white on indigo, titles are Sora and everything around the story is DM Sans. Andika is
   only for the story's own sentences. The paper and the pictures are the book's own. */
/* Andika (SIL, OFL-Andika.txt): a typeface made for children learning to read, with a single-storey a and g.
   Polish letters come from the latin-ext file, which loads only when they appear. */
@font-face { font-family: "Andika"; src: url("/assets/fonts/andika-400-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Andika"; src: url("/assets/fonts/andika-700-latin.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Andika"; src: url("/assets/fonts/andika-400-latin-ext.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Andika"; src: url("/assets/fonts/andika-700-latin-ext.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2C60-2C7F, U+A720-A7FF; }

.rs {
  --rs-paper: #fffaf0;
  --rs-cover: var(--fresco-primary);
  --rs-key: var(--fresco-primary);
  --rs-key-soft: var(--fresco-primary-soft);
  --rs-right: var(--fresco-success);
  --rs-right-soft: var(--fresco-success-soft);
  --rs-wrong: var(--fresco-danger);
  --rs-wrong-soft: var(--fresco-danger-soft);
  --rs-on-cover: rgba(255, 255, 255, .78);
  --rs-story: "Andika", var(--fresco-font);
}
/* Two upright pages side by side (16:9 in all); the player still fits one screen. */
.rs .rs-player { width: min(100%, 1120px, max(560px, calc((100dvh - 300px) * 16 / 9))); }

.rs-book {
  position: relative; padding: 1.1cqw 1.3cqw 1cqw; border-radius: var(--fresco-radius-lg); background: var(--rs-cover);
  font-family: var(--fresco-font); color: var(--fresco-ink);
  box-shadow: var(--fresco-shadow-hover); container-type: inline-size;
  transition: background-color .4s ease, box-shadow .4s ease;
}
.rs-book:fullscreen { width: 100vw; height: 100vh; padding: 3vh 3vw; border-radius: 0; display: grid; place-content: center; justify-items: center; }
.rs-book:fullscreen .rs-spread { width: min(94vw, calc(84vh * 16 / 7)); }
.rs-spread { position: relative; display: grid; grid-template-columns: 1fr 1fr; aspect-ratio: 16 / 7; transition: opacity .5s ease; }
.rs-spread::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background-color: rgba(90, 60, 20, .22); pointer-events: none; }
.rs-ribbon { position: absolute; top: -1.1cqw; right: 1.6cqw; width: 1.5cqw; height: 7cqw; z-index: 2; background-color: var(--fresco-accent); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%); }
.rs-left, .rs-right { position: relative; min-width: 0; min-height: 0; background: var(--rs-paper); display: flex; flex-direction: column; }
.rs button { font-family: inherit; }
/* Left page: the illustration printed to the edges (full bleed), darkening towards the spine */
.rs-left { border-radius: var(--fresco-radius-sm) 0 0 var(--fresco-radius-sm); overflow: hidden; box-shadow: -.25cqw .3cqw 0 #efe4cc, -.5cqw .6cqw 0 #e4d7ba, -.75cqw .9cqw 0 #d8c8a5; }
.rs-left::after { content: ""; position: absolute; inset: 0; box-shadow: inset -2.4cqw 0 2.2cqw -1.8cqw rgba(60, 40, 15, .4); pointer-events: none; }
.rs-picture { position: relative; margin: 0; flex: 1; min-height: 0; }
/* Scenes lie on top of each other; the one being read fades in slowly, nothing else moves.
   Each scene says where its window sits (object-position inline). */
.rs-scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity 1s ease; }
.rs-scene.is-active { opacity: 1; }
/* Right page: running head, the text, the page number */
.rs-right {
  border-radius: 0 var(--fresco-radius-sm) var(--fresco-radius-sm) 0; padding: 1.6cqw 3.2cqw 2.4cqw 3cqw;
  box-shadow: inset 2.4cqw 0 2.2cqw -1.8cqw rgba(90, 60, 20, .32), .25cqw .3cqw 0 #efe4cc, .5cqw .6cqw 0 #e4d7ba, .75cqw .9cqw 0 #d8c8a5;
}
.rs-running { margin: 0 2.6cqw .5cqw 0; padding-bottom: .4cqw; border-bottom: 1px solid rgba(90, 60, 20, .15); color: #a8987a; font-weight: 600; font-size: .95cqw; letter-spacing: .14em; text-transform: uppercase; }
.rs-folio { position: absolute; bottom: .8cqw; left: 0; right: 0; text-align: center; color: #b3a383; font-weight: 600; font-size: 1.05cqw; }

/* Closed book: just its front cover, centred where the right page will be */
.rs-book.is-activity .rs-folio { visibility: hidden; }
.rs-book.is-closed { background-color: transparent; box-shadow: none; }
.rs-book.is-closed .rs-spread { opacity: 0; pointer-events: none; }
.rs-cover {
  position: absolute; top: 1.1cqw; bottom: 1cqw; left: 26%; width: 48%; z-index: 3; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: .6cqw; padding: 2cqw 3cqw;
  border-radius: var(--fresco-radius-sm) var(--fresco-radius-lg) var(--fresco-radius-lg) var(--fresco-radius-sm); background: var(--rs-cover); color: #fff; text-align: center;
  box-shadow: inset 1.6cqw 0 0 rgba(0, 0, 0, .18), inset 1.9cqw 0 0 rgba(255, 255, 255, .12), .4cqw .5cqw 0 #e4d7ba, .7cqw .9cqw 0 #d8c8a5, var(--fresco-shadow-dialog);
}
.rs-book.is-closed .rs-cover { display: flex; }
.rs-series { margin: 0; color: var(--rs-on-cover); font-weight: 600; font-size: .95cqw; letter-spacing: .18em; text-transform: uppercase; }
.rs .rs-cover .rs-cover-title { margin: 0; color: #fff; font-family: var(--fresco-display); font-weight: 600; font-size: 3.1cqw; line-height: 1.1; letter-spacing: -.015em; text-wrap: balance; }
.rs-cover-pl { margin: 0; color: var(--rs-on-cover); font-weight: 500; font-size: 1.35cqw; }
/* The cover picture takes whatever height is left, square or wide */
.rs-cover-picture { flex: 1 1 0; min-height: 0; max-width: 88%; margin: .4cqw 0; display: flex; justify-content: center; }
.rs-cover-picture img { height: 100%; width: auto; max-width: 100%; object-fit: cover; display: block; border: .4cqw solid #fff; border-radius: var(--fresco-radius-sm); box-shadow: var(--fresco-shadow-hover); }
.rs-cover-words { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .4cqw .6cqw; margin: 0; font-size: .95cqw; }
.rs-cover-words > span:first-child { color: var(--rs-on-cover); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.rs-word { padding: .2cqw .7cqw; border-radius: 999px; background: rgba(255, 255, 255, .14); }
.rs-word b { font-weight: 600; }
.rs-word span { opacity: .75; }
.rs-open {
  display: inline-flex; align-items: center; gap: .7cqw; margin-top: .4cqw; padding: .9cqw 1.9cqw; border: 0; border-radius: var(--fresco-radius-sm); cursor: pointer;
  background-color: #fff; color: var(--fresco-primary); font: inherit; font-weight: 600; font-size: 1.55cqw;
  transition: background-color .2s ease;
}
.rs-open:hover { background-color: var(--fresco-primary-soft); }
.rs-open svg { width: 1.6cqw; height: 1.6cqw; }
.rs-open small { font-size: 1.05cqw; font-weight: 500; opacity: .75; }
.rs-open:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* Right page: one part at a time */
.rs-sheet { position: relative; flex: 1; min-height: 0; }
.rs-part { position: absolute; inset: 0; display: none; flex-direction: column; gap: 1cqw; }
.rs-part.is-shown { display: flex; }
/* The story's pages lie on top of each other; the one being read fades in. Each is set like a picture book:
   a few large sentences, a big first letter on the first page, nothing that looks like a button. */
/* Text never overlaps text: the old page fades out first, then the new one fades in. */
.rs-page { position: absolute; inset: 0 0 4cqw; display: flex; flex-direction: column; justify-content: safe center; gap: 1.5cqw; opacity: 0; visibility: hidden; transition: opacity .4s ease, visibility 0s linear .4s; }
.rs-page.is-active { opacity: 1; visibility: visible; transition: opacity .6s ease .45s, visibility 0s; }
.rs-line {
  display: block; width: 100%; padding: .15cqw 0 .15cqw 1cqw; border: 0; border-radius: 0; background: transparent;
  color: inherit; font: inherit; text-align: left; cursor: pointer; transition: box-shadow .2s ease;
}
.rs-line:focus-visible { outline: 2px solid var(--fresco-primary); outline-offset: 2px; }
.rs-line.is-speaking { box-shadow: inset .3cqw 0 0 var(--ac-purple); }
.rs-es { display: block; margin: 0; color: var(--fresco-ink); font-weight: 600; font-size: 2.55cqw; line-height: 1.3; }
/* Andika has a regular and a bold; the story reads in its bold, large, like a first reader */
.rs-line .rs-es { font-family: var(--rs-story); font-weight: 700; }
.rs .rs-line .ac-pl, .rs .rs-ask .ac-pl { display: block; margin: .2cqw 0 0; color: var(--fresco-muted); font-weight: 400; font-size: 1.5cqw; line-height: 1.25; }
.rs-page:first-child .rs-line:first-child .rs-es::first-letter { float: left; margin: .25cqw .6cqw 0 0; color: var(--rs-cover); font-weight: 700; font-size: 5.6cqw; line-height: .82; }
.rs-line.is-speaking .ac-w { color: var(--fresco-line-strong); }
.rs-line.is-speaking .ac-w.is-said { color: var(--ac-ink); }
.rs-line.is-speaking .ac-w.is-now, .rs-ask .ac-w.is-now { color: var(--ac-purple); }
/* The formulas: printed in a second ink, as a publisher would, never in boxes */
.rs .ac-w.is-key { color: var(--rs-key); }
.rs .is-speaking .ac-w.is-key:not(.is-said) { color: color-mix(in srgb, var(--rs-key) 40%, #fff); }
.rs-story-foot { position: absolute; left: 0; right: 0; bottom: 0; justify-content: flex-end; }

/* Questions */
.rs-back { align-self: flex-start; border: 0; background: transparent; color: var(--fresco-primary); font: inherit; font-weight: 600; font-size: 1.2cqw; cursor: pointer; padding: 0; }
.rs-back small { color: var(--fresco-muted); font-weight: 400; }
.rs-back:focus-visible { outline: 2px solid var(--fresco-primary); outline-offset: 2px; }
.rs-question .ac-tag, .rs-mine .ac-tag { align-self: flex-start; font-size: 1.2cqw; }
.rs-ask { padding: 1cqw 1.4cqw; border-radius: var(--fresco-radius); background: var(--fresco-primary-soft); }
.rs-ask .rs-es { font-size: 2.2cqw; }
.rs .rs-choices { flex: 1; min-height: 0; }
.rs .rs-question .ac-choice img, .rs .rs-question .ac-choice-art { flex: 1 1 0; width: 100%; height: auto; min-height: 0; object-fit: contain; }
.rs .rs-question .ac-choice-es { font-size: 1.45cqw; }
.rs .rs-question .ac-choice .ac-pl { font-size: 1.05cqw; }
.rs .ac-choice.is-right { border-color: var(--rs-right); background: var(--rs-right-soft); }
.rs .ac-choice.is-wrong { border-color: var(--rs-wrong); background: var(--rs-wrong-soft); }
.rs .ac-choice:disabled { cursor: default; opacity: .45; transform: none; }
.rs .ac-choice.is-right:disabled { opacity: 1; }
.rs-foot { display: flex; align-items: center; justify-content: space-between; gap: 1cqw; min-height: 3.6cqw; }
.rs-feedback { color: var(--fresco-ink); font-weight: 600; font-size: 1.7cqw; }
.rs-feedback [lang="pl"] { color: var(--fresco-muted); font-size: 1.2cqw; font-weight: 500; }
.rs .rs-foot .ac-ask-back { font-size: 1.45cqw; padding: .85cqw 1.5cqw; }
.rs .rs-foot .ac-ask-back small { font-size: 1cqw; }

/* The student's own story */
.rs-mine-rows { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .8cqw; }
.rs-mine-row { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .5cqw; padding: .5cqw; border: 1px solid transparent; border-radius: var(--fresco-radius); transition: border-color .3s ease, background .3s ease; }
.rs-mine-row:not(:has(.rs-tiles)) { flex: .4; justify-content: center; }
.rs-mine-row.is-reading { border-color: color-mix(in srgb, var(--fresco-primary) 40%, transparent); background: var(--fresco-primary-soft); }
.rs-mine-sentence { text-align: center; }
.rs-mine-es { margin: 0; color: var(--fresco-ink); font-weight: 600; font-size: 2cqw; line-height: 1.35; }
.rs .rs-mine-sentence .ac-pl { margin: 0; font-size: 1.25cqw; }
.rs-mine-row.is-reading .ac-w { color: var(--fresco-line-strong); }
.rs-mine-row.is-reading .ac-w.is-said { color: var(--fresco-ink); }
.rs-mine-row.is-reading .ac-w.is-key.is-said { color: var(--rs-key); }
.rs-mine-row.is-say .rs-mine-sentence { background: var(--fresco-accent-soft); border-radius: var(--fresco-radius-sm); }
.rs .rs-free { width: 13cqw; font-size: 2cqw; }
.rs-tiles { flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .6cqw; }
/* Tiles lie down: the picture beside its word, so both stay large on a short page */
.rs .rs-tile { flex-direction: row; gap: .5cqw; padding: .35cqw .6cqw; border-radius: var(--fresco-radius-sm); }
.rs .rs-tile img, .rs .rs-tile .ac-choice-art { flex: 0 1 auto; width: auto; height: 100%; max-height: 4.6cqw; min-height: 0; max-width: 55%; object-fit: contain; }
.rs .rs-tile .ac-choice-art img { height: 100%; max-width: 100%; }
.rs .rs-tile .ac-choice-es { font-size: 1.3cqw; }
.rs-say { color: var(--fresco-primary); font-weight: 600; font-size: 1.3cqw; opacity: 0; transition: opacity .3s ease; }
.rs .rs-say .ac-pl { display: inline; font-size: 1cqw; }
.rs-say.is-on { opacity: 1; }

/* End */
.rs-end { justify-content: center; align-items: center; text-align: center; gap: .6cqw; }
.rs-end-title { margin: 0; color: var(--fresco-ink); font-family: var(--fresco-display); font-weight: 600; font-size: 5cqw; line-height: 1.05; letter-spacing: -.015em; }
.rs-end-pl { margin: 0 0 1cqw; color: var(--fresco-muted); font-weight: 500; font-size: 2cqw; }
.rs .rs-end .ac-start { font-size: 1.9cqw; padding: 1.1cqw 2.2cqw; }
.rs .rs-end .ac-start small { font-size: 1.2cqw; font-weight: 500; opacity: .75; }

/* The binding: a few round icons for the teacher, on the book itself: the portal's icon buttons, white on indigo */
.rs-bar { display: flex; justify-content: center; align-items: center; gap: .8cqw; margin-top: 1cqw; }
.rs-book.is-closed .rs-bar { visibility: hidden; }
.rs-bar-gap { width: 1.2cqw; }
.rs-control {
  display: grid; place-items: center; width: 3.6cqw; height: 3.6cqw; min-width: 34px; min-height: 34px; padding: 0; border: 0; border-radius: 50%;
  background-color: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; transition: background-color .2s ease;
}
.rs-control:hover { background-color: rgba(255, 255, 255, .26); }
.rs-control:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.rs-control svg { width: 48%; height: 48%; }
.rs-control .ui-icon { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.rs-control[data-rs-play] { width: 4.6cqw; height: 4.6cqw; min-width: 42px; min-height: 42px; background-color: #fff; color: var(--fresco-primary); }
.rs-control[data-rs-play]:hover { background-color: var(--fresco-primary-soft); }
/* The narrator has finished the page: the next arrow invites the teacher to turn it. */
.rs-book.is-page-end .rs-control[data-rs-next] { background-color: #fff; color: var(--fresco-primary); }
.rs-control-text { font-weight: 600; font-size: 1.25cqw; letter-spacing: .04em; }
.rs-control[aria-pressed="false"] { color: rgba(255, 255, 255, .55); background-color: transparent; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .22); }
.rs-control[aria-pressed="true"] { background-color: #fff; color: var(--fresco-primary); }

.rs .ac-repeat { bottom: 4%; left: 75%; font-size: 1.5cqw; }

/* Narrow (phones): the pages stack, the picture first */
@container (max-width: 620px) {
  .rs-spread { grid-template-columns: 1fr; aspect-ratio: auto; }
  .rs-left { aspect-ratio: 4 / 3; }
  .rs-left::after { box-shadow: none; }
  .rs .rs-scene { object-position: 50% 50% !important; }
  .rs-cover { position: relative; top: 0; left: 0; width: 100%; padding: 5cqw 4cqw; gap: 1.6cqw; }
  .rs-book.is-closed .rs-spread { display: none; }
  .rs-series { font-size: 2.4cqw; }
  .rs .rs-cover .rs-cover-title { font-size: 7cqw; }
  .rs-cover-picture { flex: none; width: 80%; }
  .rs-cover-picture img { width: 100%; height: auto; }
  .rs-cover-pl { font-size: 3.4cqw; }
  .rs-cover-words { font-size: 2.6cqw; }
  .rs-open { font-size: 4cqw; padding: 2cqw 4cqw; }
  .rs-open svg { width: 4cqw; height: 4cqw; }
  .rs-open small { font-size: 2.6cqw; }
  .rs-running { font-size: 2.2cqw; }
  .rs-left { border-radius: 1.6cqw 1.6cqw 0 0; box-shadow: none; }
  .rs-spread::after, .rs-ribbon, .rs-folio { display: none; }
  .rs-page:first-child .rs-line:first-child .rs-es::first-letter { font-size: 11cqw; }
  .rs-right { border-radius: 0 0 1.6cqw 1.6cqw; padding: 2cqw 3cqw 3cqw; min-height: 80cqw; box-shadow: inset 0 1.4cqw 1.4cqw -1.1cqw rgba(90, 60, 20, .25); }
  .rs-es { font-size: 5.4cqw; }
  .rs .rs-line .ac-pl, .rs .rs-ask .ac-pl { font-size: 3.6cqw; }
  .rs-page { inset: 0 0 10cqw; gap: 3cqw; }
  .rs-book.is-activity .rs-right { min-height: 120cqw; }
  .rs-bar { gap: 1.6cqw; margin-top: 2.4cqw; flex-wrap: wrap; }
  .rs-control { width: 9.5cqw; height: 9.5cqw; }
  .rs-control[data-rs-play] { width: 12cqw; height: 12cqw; }
  .rs-control-text { font-size: 3.2cqw; }
  .rs-bar-gap { display: none; }
  .rs-back, .rs-question .ac-tag, .rs-mine .ac-tag { font-size: 2.6cqw; }
  .rs-ask .rs-es { font-size: 4cqw; }
  .rs .rs-question .ac-choice { flex-direction: column; gap: .4cqw; }
  .rs .rs-question .ac-choice-es, .rs .rs-tile .ac-choice-es { font-size: 2.8cqw; }
  .rs .rs-question .ac-choice .ac-pl { display: none; }
  .rs .rs-tile { flex-direction: column; }
  .rs-mine-es, .rs .rs-free { font-size: 3.8cqw; }
  .rs-feedback, .rs .rs-foot .ac-ask-back { font-size: 3cqw; }
  .rs-say { font-size: 2.8cqw; }
  .rs-end-title { font-size: 9cqw; }
}

/* A class's Reading tab (src/classReading.js) */
.class-reading { display: grid; gap: 14px; padding: 18px 0 6px; }
