:root {
  --paper: #fbf8f0;
  --ink: #243d38;
  --muted: #65746d;
  --green: #35634e;
  --mint: #e5eddf;
  --gold: #f4cd63;
  --line: #dfe3d7;
  --pink: #f7e4df;
  --red: #a34043;
  --white: #fffef9;
  --shadow: 0 8px 30px #3349390a;
  font-family: ui-rounded, "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  min-height: 48px;
  border: 0;
  border-radius: 15px;
  padding: 11px 17px;
  background: var(--mint);
  color: var(--ink);
  font-weight: 700;
}
button:hover {
  filter: brightness(0.97);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
a {
  color: inherit;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid #b37f22;
  outline-offset: 4px;
}
button.primary,
.primary {
  background: var(--green);
  color: white;
}
.secondary {
  background: #fff;
  border: 1px solid var(--line);
}
.quiet {
  background: transparent;
  color: var(--muted);
}
/* Pin the shell to the screen edges, not height: 100dvh. In the home-screen
   app on iPhone, 100dvh counts the status bar too, so the page ran about 60px
   past the bottom and hid the reader bar (Next word, Phonetics, Say this word). */
.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  padding: 14px max(20px, calc((100vw - 1110px) / 2));
  display: flex;
  align-items: center;
  gap: 30px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--paper);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  min-height: 48px;
}
.brand svg {
  width: 28px;
  height: 28px;
  color: var(--green);
}
.brand > span {
  font-size: 25px;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -1px;
}
.brand-sub {
  display: block;
  font-size: 8px;
  letter-spacing: 2px;
  margin-top: 6px;
}
.subjects {
  display: flex;
  gap: 3px;
  margin: auto;
}
.subjects a {
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  display: grid;
  place-items: center;
  min-width: 65px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--muted);
}
.subjects [aria-current] {
  background: var(--mint);
  color: var(--green);
}
.profile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  padding: 0;
  font-size: 13px;
  max-width: 180px;
}
.profile > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.avatar {
  background: #eddfb8;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.main {
  flex: 1;
  overflow: auto;
  min-height: 0;
  scroll-behavior: smooth;
}
.container {
  max-width: 1060px;
  margin: auto;
  padding: 32px 24px 48px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
}
.breadcrumb button {
  padding: 0 9px;
  min-width: 44px;
  background: transparent;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 16px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -1.3px;
}
h1 {
  font-size: clamp(34px, 4.5vw, 54px);
  line-height: 1.08;
  margin-bottom: 14px;
}
h2 {
  font-size: 29px;
  margin-bottom: 0;
}
h3 {
  font-size: 19px;
  margin-bottom: 8px;
}
p {
  line-height: 1.6;
}
.muted {
  color: var(--muted);
}
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 20px;
  padding: 38px;
  border-radius: 28px;
  background: #e7eddf;
  overflow: hidden;
  border: 1px solid #dce4d3;
}
.hero-copy {
  position: relative;
  z-index: 1;
  align-self: center;
}
.hero p {
  max-width: 400px;
  color: #536a59;
}
.hero-art {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.hero-art img {
  width: 100%;
  max-width: 420px;
  mix-blend-mode: multiply;
}
.hero-art:before {
  content: "";
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: #f5f1d2;
  z-index: 0;
}
.hero-art img {
  position: relative;
  z-index: 1;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 9px;
  background: #fff9;
  padding: 7px 9px;
  letter-spacing: 0.4px;
}
.tiny-star {
  color: #ab7a14;
}
.book-layout {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 25px;
}
.book-card {
  display: grid;
  grid-template-columns: 125px 1fr;
  gap: 24px;
  align-items: center;
  background: var(--white);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.cover {
  width: 125px;
  height: 150px;
  object-fit: cover;
  object-position: left;
  border-radius: 10px;
  box-shadow: 4px 6px 0 #ccd5bf;
}
.book-card h3 {
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: 500;
}
.book-card p {
  font-size: 13px;
  margin-bottom: 14px;
}
.progress-line {
  height: 7px;
  background: #e4e8df;
  border-radius: 10px;
  overflow: hidden;
}
.progress-line > i {
  display: block;
  background: #7d9d6a;
  height: 100%;
  border-radius: 10px;
}
.progress-caption {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 15px;
}
.aside {
  border: 1px solid var(--line);
  background: #f4f0e4;
  border-radius: 22px;
  padding: 23px;
}
.aside p {
  font-size: 13px;
}
.aside h3 {
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 500;
}
.mini-steps {
  display: flex;
  gap: 12px;
  margin: 18px 0;
}
.mini-steps span {
  height: 31px;
  width: 31px;
  background: #fff8;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
}
.small-star {
  font-size: 44px;
  color: #ba8c2b;
}
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.mode-card {
  position: relative;
  display: flex;
  text-align: left;
  align-items: center;
  gap: 17px;
  padding: 21px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.mode-card .mode-icon {
  height: 52px;
  width: 52px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 17px;
  font-size: 24px;
  background: var(--mint);
  font-weight: 500;
}
.mode-card.red .mode-icon {
  background: var(--pink);
  color: var(--red);
}
.mode-card.gold .mode-icon {
  background: #f5eac9;
  color: #947025;
}
.mode-card.purple .mode-icon {
  background: #ede7f5;
  color: #705594;
}
.mode-card strong {
  display: block;
  font-size: 16px;
  margin-bottom: 5px;
}
.mode-card small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.5;
  display: block;
}
.arrow {
  margin-left: auto;
  font-size: 23px;
  font-weight: 400;
}
.book-hero {
  margin-bottom: 25px;
  grid-template-columns: 1fr 0.65fr;
}
.book-hero h1 {
  font-size: 60px;
}
.book-hero .hero-art:before {
  width: 185px;
  height: 185px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}
.chip {
  font-size: 12px;
  background: #ffffffa0;
  border: 1px solid #d9e0d3;
  padding: 6px 10px;
  border-radius: 20px;
}
.page-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 6px;
}
.page-grid button {
  min-width: 48px;
  min-height: 48px;
  background: white;
  border: 1px solid var(--line);
}
.page-grid button.done {
  background: var(--mint);
  border-color: #b7cfad;
}
.save-note {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 20px;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b9166;
  display: inline-block;
}
.bottom-nav {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  padding: 6px 16px max(6px, env(safe-area-inset-bottom));
  background: var(--paper);
}
.bottom-nav button {
  min-height: 50px;
  font-size: 11px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
}
.bottom-nav button span {
  font-size: 23px;
}
.bottom-nav button[aria-current] {
  color: var(--green);
}
.session-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}
.session-top button {
  padding: 6px 10px;
  min-width: 44px;
}
.session-top .eyebrow {
  margin: 0;
  font-size: 10px;
  letter-spacing: 1px;
}
.session {
  max-width: 760px;
  margin: auto;
  padding: 20px 24px 24px;
}
/* The book's picture sits under the text it illustrates. In the reader it gets
   a fixed share of the viewport, reserved before the image loads, so the
   sentence, tallies and Next word stay in one view on a phone and the buttons
   do not jump when the page changes. */
.page-picture {
  display: flex;
  justify-content: center;
  margin: 18px 0 4px;
}
.page-picture[hidden] {
  display: none;
}
.page-picture img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: min(42vh, 380px);
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid var(--line);
}
.reading-card .page-picture {
  height: min(24vh, 260px);
  height: min(24svh, 260px);
}
.reading-card .page-picture img {
  max-height: 100%;
}
.empty .page-picture {
  margin: 4px 0 22px;
}
.reading-card {
  background: var(--white);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 23px;
  box-shadow: var(--shadow);
}
.reading-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 13px;
}
.sentence {
  font-size: 32px;
  line-height: 1.75;
  font-weight: 500;
  letter-spacing: 0.2px;
  overflow-wrap: normal;
  word-break: normal;
}
.word {
  position: relative;
  display: inline-block;
  padding: 0 5px;
  margin: 1px 0;
  border-radius: 9px;
  color: #36473e;
  white-space: nowrap;
  transition:
    background 0.12s,
    color 0.12s;
}
.sentence .word.current {
  background: #f5d77c;
  color: #283b31;
  box-shadow: 0 3px 0 #dfb34a;
  outline: 1px solid #e2b952;
}
.word.current::after,
.practice-word.focus-word::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 3px solid #c18012;
  border-radius: 13px;
  pointer-events: none;
  opacity: 1;
  /* After 4s on one word the box briefly doubles, every 4s. The independent
     scale property composes with reading-focus's transform. */
  animation: reading-focus 1.4s ease-in-out infinite, reading-attention 4s ease-in-out 4s infinite;
}
.word.current::before,
.practice-word.focus-word::before {
  content: "";
  position: absolute;
  top: -11px;
  right: -10px;
  width: 20px;
  height: 20px;
  background: #35634e;
  clip-path: polygon(50% 0, 63% 36%, 100% 50%, 63% 64%, 50% 100%, 37% 64%, 0 50%, 37% 36%);
  pointer-events: none;
  z-index: 1;
  animation: reading-sparkle 1.4s ease-in-out infinite;
}
@keyframes reading-focus {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 1px #f4cd6340; }
  50% { transform: scale(1.06, 1.16); box-shadow: 0 0 0 6px #f4cd6373, 0 0 18px #e6b33340; }
}
@keyframes reading-attention {
  0%, 25%, 100% { scale: 1; filter: none; }
  10%, 15% { scale: var(--attention-scale, 2); border-width: 2px; filter: drop-shadow(0 0 5px #f4cd63); }
}
@keyframes reading-sparkle {
  0%, 100% { transform: translateY(1px) rotate(-12deg) scale(0.85); }
  50% { transform: translateY(-3px) rotate(12deg) scale(1.2); }
}
.session[data-state="paused"] .word.current::after,
.session[data-state="starting"] .word.current::after,
.session[data-state="model"] .word.current::after,
.session[data-state="helping"] .word.current::after,
.session[data-state="done"] .word.current::after {
  animation: none;
}
.session[data-state="paused"] .word.current::before,
.session[data-state="starting"] .word.current::before,
.session[data-state="model"] .word.current::before,
.session[data-state="helping"] .word.current::before,
.session[data-state="done"] .word.current::before {
  display: none;
}
.word.heard,
.word.adult,
.word.retry {
  background: #e3eedb;
  color: #406448;
}
.word.help {
  background: #f2e8cf;
  color: #806934;
}
.word .phoneme.active {
  background: #83bba4;
  color: #103e2d;
  border-radius: 4px;
  box-shadow: 0 2px 0 #3d735c;
}
.sentence.large {
  font-size: 38px;
}
.status {
  min-height: 34px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 17px 0 10px;
}
.status .live-dot {
  height: 8px;
  width: 8px;
  border-radius: 50%;
  background: var(--green);
}
.status.active .live-dot {
  animation: breathe 1.7s infinite;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.page-navigation {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}
.page-navigation button { font-size: 13px; padding: 10px; }
.page-navigation > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.word-tallies { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.word-tally { display: flex; align-items: center; gap: 9px; border-radius: 16px; padding: 10px 12px; }
.tally-read { background: #e7f0e4; color: #305f48; }
.tally-practice { background: #faf0d8; color: #796020; }
.word-tally svg { width: 27px; height: 27px; flex: 0 0 27px; }
.tally-read svg { fill: #e4b948; stroke: #a17c1d; stroke-width: 1.2; }
.tally-practice svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.word-tally strong { display: block; font-size: 27px; line-height: 1; font-variant-numeric: tabular-nums; }
.word-tally span { display: block; font-size: 12px; margin-top: 3px; }
.reading-stars { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; font-size: 10px; color: var(--muted); }
.star-track { height: 5px; background: #eee8d7; border-radius: 10px; flex: 1; overflow: hidden; }
.star-track i { display: block; height: 100%; border-radius: inherit; background: #dbb94f; transition: width .25s; }
.tally-celebration { margin: 9px 0 0; font-size: 13px; color: #305f48; font-weight: 700; }
.tally-celebration:empty { display: none; }
.tally-pop { animation: tally-pop .45s ease-out; }
@keyframes tally-pop { 35% { transform: scale(1.06); } 100% { transform: scale(1); } }
.book-review { margin-top: 16px; }
@media (prefers-reduced-motion: reduce) {
  .tally-pop { animation: none; }
  .star-track i { transition: none; }
}
.controls[hidden],
.controls > [hidden] {
  display: none;
}
.listening-choice {
  margin: 12px 0;
}
.listening-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 13px;
}
.switch-end {
  display: flex;
  align-items: center;
  gap: 10px;
}
.switch-track {
  position: relative;
  width: 42px;
  height: 26px;
  border-radius: 20px;
  background: #8b958a;
}
.switch-track i {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s;
}
.listening-toggle[aria-checked="true"] .switch-track {
  background: var(--green);
}
.listening-toggle[aria-checked="true"] .switch-track i {
  transform: translateX(16px);
}
.mode-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 7px 2px 0;
}
.manual-controls {
  margin-top: 10px;
}
.controls button {
  flex: 1;
  min-width: 85px;
  font-size: 13px;
}
.controls .primary {
  flex: 2;
}
.parent-confirm {
  font-size: 12px;
  margin-top: 10px;
  min-height: 44px;
  background: transparent;
  border: 1px dashed #cdd4c7;
  width: 100%;
  color: var(--muted);
}
.legend {
  display: flex;
  gap: 18px;
  margin: 13px 0 0;
  font-size: 11px;
  color: var(--muted);
  justify-content: center;
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #e3eedb;
  margin-right: 5px;
}
.legend i.help-key {
  background: #f2e8cf;
}
.session .progress-line {
  margin-bottom: 18px;
  height: 5px;
}
.completion {
  padding: 24px;
  text-align: center;
  background: #edf2e7;
  border: 1px solid #d5dfce;
  border-radius: 22px;
  margin-top: 15px;
}
.completion h2 {
  font-size: 27px;
  margin: 8px 0 10px;
}
.completion p {
  font-size: 13px;
}
.completion .controls {
  justify-content: center;
}
.helped-words {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 14px;
}
.helped-words span {
  background: #fff9;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 14px;
}
.practice-card {
  text-align: center;
  min-height: 225px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.practice-word {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  font-size: clamp(38px, 9vw, 66px);
  line-height: 1.5;
  letter-spacing: 2px;
  font-weight: 600;
  padding: 12px 0;
}
.practice-word.focus-word {
  padding-inline: 6px;
  /* The practice word is already large; a doubled box would cover the card. */
  --attention-scale: 1.5;
}
.practice-word.red-word {
  color: var(--red);
}
.practice-word .active {
  background: #f5d77c;
  border-radius: 7px;
}
.practice-type {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}
.word-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 5px 0 12px;
}
.word-dots i {
  height: 5px;
  width: 22px;
  border-radius: 8px;
  background: #d9e3d1;
}
.word-dots i.active {
  background: var(--green);
}
.practice-example {
  font-size: 14px;
  color: var(--muted);
  margin: 8px 0;
}
.grid-words {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 18px 0;
}
.grid-words button {
  background: #fff;
  border: 1px solid var(--line);
  font-size: 18px;
  min-height: 56px;
}
.empty {
  text-align: center;
  padding: 36px;
  background: #edf2e7;
  border-radius: 24px;
}
.empty p {
  max-width: 420px;
  margin: 12px auto 22px;
}
.settings {
  max-width: 650px;
}
.setting-row {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.setting-row label {
  font-weight: 700;
  display: block;
  margin-bottom: 9px;
}
.setting-row p {
  font-size: 13px;
  margin: 7px 0 0;
  color: var(--muted);
}
select {
  background: var(--white);
  border: 1px solid #cbd6c7;
  border-radius: 12px;
  padding: 12px;
  width: 100%;
  min-height: 48px;
  color: var(--ink);
}
.settings .controls {
  margin: 18px 0;
}
.file-input {
  display: block;
  min-height: 48px;
  font-size: 13px;
  width: 100%;
  margin: 12px 0;
}
details {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: 14px;
  margin-top: 18px;
}
summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
}
details p {
  font-size: 13px;
}
.question-panel {
  padding: 25px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 23px;
  margin-top: 18px;
}
.question-panel h2 {
  line-height: 1.3;
  margin-bottom: 18px;
}
.question-panel p {
  color: var(--muted);
  font-size: 13px;
}
.notice {
  position: fixed;
  z-index: 10;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  font-size: 13px;
  line-height: 1.5;
  padding: 13px 18px;
  border-radius: 15px;
  max-width: calc(100vw - 30px);
  width: max-content;
  box-shadow: 0 4px 20px #0002;
  pointer-events: none;
}
.loading {
  text-align: center;
  padding: 70px 20px;
}
.loading h1 {
  font-size: 29px;
}
.credit {
  font-size: 11px;
  color: var(--muted);
  margin-top: 20px;
  line-height: 1.6;
}
.switch-reader {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px;
}
.vocab-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}
.vocab-card {
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 20px;
}
.vocab-card p {
  font-size: 14px;
}
.vocab-card button {
  min-width: 48px;
}
.flower {
  font-size: 38px;
  color: #b28224;
}
.restart-confirm {
  padding: 15px;
  border: 1px solid #c8d8c0;
  border-radius: 14px;
}
.stars {
  color: #ae7b18;
  font-size: 32px;
  letter-spacing: 14px;
  animation: arrive 0.5s ease-out;
}
@keyframes breathe {
  50% {
    opacity: 0.35;
  }
}
@keyframes arrive {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@media (max-width: 700px) {
  .topbar {
    padding: 9px 15px;
    gap: 10px;
  }
  .brand > span {
    font-size: 22px;
  }
  .brand svg {
    width: 23px;
  }
  .subjects {
    gap: 0;
  }
  .subjects a {
    min-width: 49px;
    padding: 0 8px;
    font-size: 11px;
  }
  .profile {
    max-width: 38px;
  }
  .profile > span:last-child {
    display: none;
  }
  .avatar {
    width: 34px;
    height: 34px;
  }
  .container {
    padding: 22px 18px 32px;
  }
  .hero {
    padding: 25px;
    grid-template-columns: 1fr 0.6fr;
    gap: 5px;
  }
  .hero h1 {
    font-size: 37px;
  }
  .hero p {
    font-size: 13px;
  }
  .hero-art:before {
    width: 150px;
    height: 150px;
  }
  .hero-art img {
    min-width: 150px;
  }
  .hero .primary {
    font-size: 13px;
    padding: 12px;
  }
  .book-layout {
    grid-template-columns: 1fr;
  }
  .aside {
    padding: 20px;
  }
  .aside .mini-steps {
    margin: 8px 0;
  }
  .book-card {
    grid-template-columns: 95px 1fr;
    gap: 18px;
    padding: 18px;
  }
  .cover {
    width: 95px;
    height: 135px;
  }
  .book-card h3 {
    font-size: 27px;
  }
  .mode-grid {
    gap: 10px;
  }
  .mode-card {
    padding: 16px 13px;
    gap: 10px;
    align-items: flex-start;
  }
  .mode-card .mode-icon {
    width: 38px;
    height: 38px;
    font-size: 20px;
    border-radius: 12px;
  }
  .mode-card strong {
    font-size: 14px;
  }
  .mode-card small {
    font-size: 11px;
  }
  .mode-card .arrow {
    display: none;
  }
  .book-hero {
    grid-template-columns: 1fr 0.55fr;
  }
  .book-hero .hero-art:before {
    width: 130px;
    height: 130px;
  }
  .book-hero h1 {
    font-size: 41px;
  }
  .chips {
    gap: 5px;
    margin-bottom: 15px;
  }
  .chip {
    font-size: 10px;
    padding: 5px 8px;
  }
  .bottom-nav {
    gap: 7px;
    justify-content: space-around;
  }
  .bottom-nav button {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 82px;
    font-size: 10px;
    padding: 4px;
  }
  .bottom-nav button span {
    font-size: 20px;
  }
  .session {
    padding: 14px 17px 26px;
  }
  .page-picture {
    margin-top: 14px;
  }
  .reading-card {
    padding: 17px;
  }
  .sentence {
    font-size: 27px;
    line-height: 1.65;
  }
  .sentence.large {
    font-size: 33px;
  }
  .word {
    padding: 0 4px;
  }
  .status {
    font-size: 12px;
    margin-top: 15px;
  }
  .controls button {
    padding: 12px 9px;
    font-size: 12px;
  }
  .session .progress-line {
    margin-bottom: 12px;
  }
  .practice-card {
    min-height: 190px;
  }
  .practice-word {
    font-size: 48px;
  }
  .section-head {
    margin-top: 23px;
  }
  h2 {
    font-size: 27px;
  }
  .vocab-grid {
    grid-template-columns: 1fr;
  }
  .hero.library-hero {
    grid-template-columns: 1fr;
  }
  .library-hero .hero-art {
    display: none;
  }
  .completion {
    padding: 20px 15px;
  }
  .question-panel h2 {
    font-size: 26px;
  }
}
@media (max-height: 650px) {
  body.reading .topbar {
    padding-top: 5px;
    padding-bottom: 5px;
  }
  body.reading .reading-card .page-picture {
    height: 18vh;
  }
  body.reading .session {
    padding-top: 9px;
  }
  body.reading .session-top {
    margin-bottom: 8px;
  }
  body.reading .reading-card {
    padding: 14px;
  }
  body.reading .sentence {
    font-size: 26px;
  }
  body.reading .sentence.large {
    font-size: 30px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (max-width: 700px) {
  .profile {
    min-width: 44px;
    max-width: 44px;
    justify-content: center;
  }
  .topbar {
    gap: 5px;
  }
}
/* Four subject tabs (Maths, English, Reading, Games) plus the profile button
   must fit a 360px phone without sideways scrolling; keep 44px tap targets. */
@media (max-width: 380px) {
  .subjects a {
    min-width: 44px;
    padding: 0 5px;
  }
}
.bottom-nav[hidden] {
  display: none;
}
.main {
  scroll-behavior: auto;
}
.reading .page-picture img {
  min-width: 0;
}

@media (max-width: 700px) {
  .book-hero .tiny-star {
    display: none;
  }
}
/* A school-order bookshelf that makes the next step and progress easy to see. */
.library-heading{display:flex;align-items:center;justify-content:space-between;gap:24px;margin:14px 0 18px}
.library-heading h1{font-size:clamp(32px,4.5vw,52px);line-height:1.08;margin:6px 0 14px}
.library-heading p{max-width:510px}
.library-reward{width:150px;flex:none;text-align:center;padding:22px 14px;border-radius:30px;background:#fff0bd;box-shadow:inset 0 0 0 2px #efcb65;transform:rotate(3deg)}
.library-reward svg{display:block;width:32px;height:32px;fill:#e4ae28;margin:auto}
.library-reward strong{display:block;font-size:36px;line-height:1.2}.library-reward span{display:block;font-weight:700}.library-reward small{display:block;margin-top:10px;color:var(--muted)}
.library-next{display:flex;gap:26px;align-items:center;background:#e5eddf;border:1px solid #cfdbca;border-radius:28px;padding:26px;margin:22px 0}
.library-next>img{width:145px;height:150px;object-fit:contain;transform:rotate(-4deg);filter:drop-shadow(0 5px 5px #253d3822)}
.library-next h2{font-size:29px;margin:6px 0 10px}.library-next p:not(.eyebrow){margin:0 0 17px;max-width:540px;color:var(--muted)}
.library-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:26px 0 30px}.library-stats>div{padding:19px 10px;border-radius:19px;background:var(--white);border:1px solid var(--line);text-align:center}.library-stats strong{display:block;font-size:29px}.library-stats span{font-size:13px;color:var(--muted);font-weight:700}
.library-filters{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:22px}.library-filters button{background:transparent;border:1px solid var(--line);font-size:13px;min-height:44px;padding:10px 13px}.library-filters .selected{background:var(--green);color:white;border-color:var(--green)}
.library-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.library-grid .book-card{margin:0;padding:22px;align-items:start;gap:17px;min-width:0}.book-card-copy{flex:1;min-width:0}.dashboard-book h3{font-size:23px;margin:10px 0 6px;line-height:1.17}.dashboard-book .book-focus{font-size:12px;margin:0 0 16px}.book-cover-wrap{position:relative;flex:none}.dashboard-book .cover{width:94px;height:128px;object-fit:contain}.story-number{position:absolute;left:-10px;top:-10px;display:grid;place-items:center;width:33px;height:33px;border-radius:50%;background:var(--ink);color:white;font-weight:800;border:3px solid var(--white)}
.book-status{display:inline-block;border-radius:9px;padding:6px 9px;font-size:11px;font-weight:800;background:#eef0ec;color:#667269}.book-status.reading{background:#fff0bf;color:#725511}.book-status.practice{background:#f8e4dd;color:#874b38}.book-status.finished{background:#dcefdc;color:#285b3f}.dashboard-book .progress-caption{font-size:12px}.book-counts{display:flex;flex-wrap:wrap;gap:8px 16px;font-size:12px;color:var(--muted);margin:12px 0 16px}.book-counts>span{display:flex;align-items:center;gap:4px}.book-counts svg{width:16px;height:16px;fill:#ddb745;stroke:var(--green);stroke-width:1}.book-counts b{color:var(--ink)}.dashboard-book button{width:100%;font-size:13px}.library-empty{grid-column:1/-1}.save-note{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.save-note button{min-height:44px;font-size:12px}.save-note a{display:inline-flex;align-items:center;min-height:44px;padding:0 8px}.save-note[data-sync-status="synced"] .dot{background:#4b955c}.save-note[data-sync-status="pending"] .dot,.save-note[data-sync-status="error"] .dot{background:#c2932e}
@media(max-width:760px){.library-grid{grid-template-columns:1fr}.library-heading{gap:12px}.library-reward{width:96px;padding:16px 8px;border-radius:23px}.library-reward strong{font-size:29px}.library-reward span,.library-reward small{font-size:11px}.library-heading h1{font-size:32px}.library-next{gap:16px;padding:20px}.library-next>img{width:90px;height:120px}.library-next h2{font-size:24px}.library-next p:not(.eyebrow){font-size:13px}.library-next .primary{font-size:13px;padding:11px 13px}.library-stats{gap:7px}.library-stats>div{padding:16px 5px}.library-stats span{font-size:10px}.library-stats strong{font-size:25px}}
@media(max-width:380px){.library-heading h1{font-size:28px}.library-reward{width:78px}.library-grid .book-card{padding:18px;gap:14px}.dashboard-book .cover{width:82px;height:114px}.dashboard-book h3{font-size:21px}.library-next{padding:17px;gap:12px}.library-next>img{width:75px}}

.library-grid .book-card{grid-template-columns:94px minmax(0,1fr)}
@media(max-width:380px){.library-grid .book-card{grid-template-columns:82px minmax(0,1fr)}}

/* Reader passage and interruption controls. */
.reader-options{display:flex;gap:8px;justify-content:space-between;margin:8px 0 12px}
.reader-count,.reader-back{min-height:44px;padding:8px 12px;font-size:14px;background:var(--paper,#fff);border:1px solid #d9ddd5;border-radius:12px;color:#425744}
.reader-options + .progress-line{margin-top:8px}
.reader-options ~ .reading-card [data-action="focus-word"]{cursor:pointer;min-height:44px;min-width:44px;justify-content:center;display:inline-flex;align-items:center}
.reader-options ~ .reading-card [data-action="focus-word"]:focus-visible{outline:2px solid #425744;outline-offset:2px}
.set-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px;margin:28px 0}
.set-card{display:flex;align-items:center;gap:16px;text-align:left;background:#fff;border:1px solid var(--line,#e6e1d6);border-radius:22px;padding:22px;min-height:116px;color:inherit}
.set-card>span:nth-child(2){display:grid;gap:5px;flex:1}.set-card strong{font-size:24px}.set-card small,.set-card>span:nth-child(2)>span{font-size:13px;color:var(--muted,#716c60)}
.set-card:disabled{opacity:.55}.set-colour{width:42px;height:58px;border-radius:5px 10px 10px 5px;box-shadow:inset 5px 0 #0002;flex-shrink:0}
.set-green{background:#69a572}.set-purple{background:#9874b5}.set-pink{background:#e887aa}.set-orange{background:#eba262}.set-yellow{background:#e6c949}.set-blue{background:#729ed1}.set-grey{background:#98a0ab}

/* A compact bookshelf: set navigation first, then one clear reading choice. */
.selected-set .set-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:4px 0 16px}
.set-heading h1{font-size:clamp(28px,4vw,38px);line-height:1.15;margin:5px 0 10px}
.set-description{display:flex;align-items:center;gap:7px;margin:0;font-size:14px;color:var(--muted)}
.set-dot{width:14px;height:14px;border-radius:50%;flex:none}
.set-stars{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted);white-space:nowrap}
.set-stars svg{width:19px;height:19px;fill:#ddb745}
.set-back{display:flex;align-items:center;gap:10px;width:100%;min-height:60px;margin:0 0 18px;text-align:left;border:2px solid var(--green);color:var(--green);font-size:20px;font-weight:800}
.set-back span{font-size:24px;line-height:1}
.selected-set .library-next{padding:16px;gap:18px;margin:16px 0 20px;border-radius:20px}
.selected-set .library-next>img{width:62px;height:80px}
.selected-set .library-next .eyebrow{font-size:10px;margin:0 0 5px}
.selected-set .library-next h2{font-size:22px;margin:0 0 10px}
.selected-set .library-next button{min-height:44px}
.selected-set .library-filters{margin-bottom:14px;gap:7px}
.filter-count{display:inline-block;margin-left:3px;opacity:.8}
.selected-set .library-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.selected-set .dashboard-book{grid-template-columns:48px minmax(0,1fr) auto;gap:12px;padding:14px;border-radius:16px;align-items:center;box-shadow:none}
.selected-set .dashboard-book .cover{width:48px;height:68px;border-radius:4px;box-shadow:2px 3px 0 #ccd5bf}
.selected-set .story-number{width:23px;height:23px;left:-7px;top:-7px;border-width:2px;font-size:10px}
.selected-set .dashboard-book h3{font-size:18px;margin:0 0 5px;line-height:1.2;overflow-wrap:anywhere}
.selected-set .book-status{padding:0;background:none;font-size:10px;line-height:1.3;margin-bottom:6px;border-radius:0}
.selected-set .progress-line{height:4px;margin:0 0 4px}
.selected-set .progress-caption{font-size:10px;line-height:1.3}
.selected-set .dashboard-book .book-open{width:auto;min-width:66px;min-height:44px;font-size:12px;padding:10px;border-radius:10px}
.selected-set>.save-note{margin-top:20px}
@media(max-width:1000px){.selected-set .library-grid{grid-template-columns:1fr}}
@media(max-width:600px){.selected-set .set-heading{display:block}.set-stars{margin-top:10px}.selected-set .dashboard-book{padding:12px;gap:10px}.selected-set .dashboard-book h3{font-size:17px}.selected-set .library-next{gap:14px}.selected-set .library-next h2{font-size:20px}}

.reader-name{display:inline-flex;align-items:center;padding:0;min-height:44px;min-width:44px;font:inherit;color:inherit;background:transparent;border-radius:4px;text-decoration:underline;text-decoration-color:#8da68e;text-underline-offset:3px}.eyebrow .reader-name{text-transform:inherit;letter-spacing:inherit}.save-note .reader-name{font-size:inherit}.profile{min-width:44px}

/* The attention pulse's doubled box may pass the card edge but never scrolls the page. */
.sentence .word.current { z-index: 1; }
.session { overflow-x: clip; }

/* Read Write Inc. sound buttons: a dot under each single-letter sound, a line
   under special friends, an arc joining a split digraph. */
.sound-buttons .sound { position: relative; display: inline-block; line-height: 1.15; margin: 0 .08em; }
.sound-buttons .sound::after { content: ""; position: absolute; left: 50%; bottom: -.16em; width: .19em; height: .19em; margin-left: -.095em; border-radius: 50%; background: var(--ink); }
.sound-buttons .sound-multi::after { left: .1em; right: .1em; width: auto; height: .09em; margin: 0; border-radius: .05em; }
.sound-buttons .sound-split > .sound { margin: 0 .05em; }
.sound-buttons .sound-split::after { left: .27em; right: .27em; width: auto; height: .26em; margin: 0; bottom: -.48em; background: none; border: .07em solid var(--ink); border-top: 0; border-radius: 0 0 50% 50% / 0 0 100% 100%; }
.sentence .word.sound-buttons { padding-bottom: .42em; }
.practice-word.sound-buttons { padding-bottom: .5em; letter-spacing: 0; }
.sentence .word.current.whole-word,
.practice-word.whole-word { color: var(--red); font-weight: 700; }

/* After the words on screen: hear them narrated, then talk about them. */
.comprehension { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0 14px; }
.comprehension button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 86px; font-size: 17px; font-weight: 700; border-radius: 18px; }
.comprehension svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.comprehension .narrate { background: var(--gold); color: var(--ink); box-shadow: 0 3px 0 #dfb34a; }
.comprehension .ask { background: var(--white); color: var(--green); border: 2px solid #b9cdb5; }
.ask-card { margin: 0 0 14px; padding: 18px; text-align: left; background: var(--white); border: 1px solid #d5dfce; border-radius: 18px; }
.ask-card[hidden] { display: none; }
.ask-card .eyebrow { margin: 0 0 6px; }
.ask-card h3 { font-size: 23px; line-height: 1.3; margin: 0 0 14px; }
.answer-toggle { min-height: 44px; padding: 8px 13px; font-size: 13px; color: var(--muted); background: transparent; border: 1px dashed #cdd4c7; }
.completion .ask-answer { margin: 10px 0 0; font-size: 18px; font-weight: 700; color: var(--green); }
.comprehension .ask-count { font-size: 13px; font-weight: 700; color: var(--muted); background: #eef3ea; border-radius: 99px; padding: 2px 10px; }
/* Detective (inference) questions: a calm tag for the child, grown-up help below. */
.ask-card .detective-tag { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px; padding: 4px 11px 4px 8px; border-radius: 99px; background: #f1ecfa; color: #59457d; font-size: 13px; font-weight: 800; }
.ask-card .detective-tag svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.ask-card .detective-note { margin: -6px 0 4px; font-size: 15px; color: var(--muted); }
.ask-card .link-button { min-height: 44px; padding: 0; background: none; color: #59457d; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.ask-card .detective-intro { margin: 0 0 16px; padding-left: 22px; font-size: 18px; line-height: 1.45; }
.ask-card .detective-intro li + li { margin-top: 6px; }
.ask-card .guide { margin: 10px 0; padding: 10px 13px; border-radius: 13px; background: #f6f3ea; border: 1px solid #ebe3cf; }
.completion .ask-card .guide p, .completion .ask-answer p { margin: 0; font-size: 15px; line-height: 1.4; }
.completion .ask-card .guide .guide-label { margin-bottom: 3px; font-size: 12px; font-weight: 800; color: var(--muted); }
.completion div.ask-answer { font-size: 15px; font-weight: 400; color: var(--ink); }
.completion div.ask-answer p + p { margin-top: 6px; }
.ask-card .answer-toggle + .answer-toggle, .ask-card .ask-answer + .answer-toggle { margin-top: 8px; }
.ask-card .grown-record { margin-top: 14px; padding: 4px 12px 10px; border-style: dashed; }
.ask-card .grown-record summary { color: var(--muted); }
.completion .record-label { margin: 10px 0 6px; font-size: 12px; font-weight: 800; color: var(--muted); }
.ask-card .chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ask-card .chip { min-height: 44px; padding: 6px 4px; font-size: 13px; line-height: 1.15; background: var(--white); border: 1px solid #cdd8c7; border-radius: 11px; color: var(--ink); }
.ask-card .chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: white; }
.ask-card .record-row { margin-top: 8px; }
.ask-card .record-row > span { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 700; }
.completion .record-note { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.inference-panel label { margin-top: 14px; }
.inference-table { width: 100%; margin-top: 14px; border-collapse: collapse; font-size: 13px; }
.inference-table caption { text-align: left; font-weight: 700; color: var(--muted); padding-bottom: 6px; }
.inference-table th, .inference-table td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.inference-table th[scope="row"], .inference-table thead th:first-child { text-align: left; }
.review-due { margin-top: 14px; padding: 14px; border-radius: 14px; background: #fff6da; border: 1px solid #ecd58e; }
.review-due h4 { margin: 0 0 4px; font-size: 17px; }
.review-due p { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  /* No growing box: a still, thicker outline for one second every 4s instead. */
  .sentence .word.current::after,
  .practice-word.focus-word::after { animation: reading-attention-still 4s step-end 4s infinite !important; }
  .session[data-state="paused"] .word.current::after,
  .session[data-state="starting"] .word.current::after,
  .session[data-state="model"] .word.current::after,
  .session[data-state="helping"] .word.current::after,
  .session[data-state="done"] .word.current::after { animation: none !important; }
}
@keyframes reading-attention-still {
  0% { border-width: 6px; border-color: #9a6200; }
  25% { border-width: 3px; border-color: #c18012; }
}

/* Next word and Say this word sit in a bar pinned under the scrolling reader
   page (outside .main), lined up with the reading card. However long the page,
   they stay on screen; the page scrolls to keep the golden word in view. */
.reader-bar {
  flex-shrink: 0;
  padding: 10px max(17px, calc((100% - 712px) / 2)) max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 -6px 18px #3349390f;
}
.reader-bar[hidden] { display: none; }
.reader-bar > :not([hidden]) ~ :not([hidden]) { margin-top: 8px; }
.reader-bar .manual-controls { margin-top: 0; }
.reader-bar .controls button { min-height: 48px; }
.reader-bar .parent-confirm { margin-top: 0; }
/* Words-read-per-day chart at the top of the bookshelf. */
.week-chart{--wc-gold:#d99a1e;--wc-avg:color-mix(in srgb,var(--ink) 60%,transparent);margin:10px 0 18px;padding:16px 18px 12px;border-radius:22px;background:var(--white);box-shadow:inset 0 0 0 2px var(--line)}
.wc-head{display:flex;align-items:flex-start;justify-content:space-between;gap:6px 16px;flex-wrap:wrap}
.wc-head h2{margin:0;font-size:17px}
.wc-goal{margin:4px 0 0;font-size:14px;color:var(--ink)}
.wc-goal strong{color:var(--green)}
.wc-totals{text-align:right;line-height:1.3}
.wc-totals strong{font-size:15px}
.wc-totals small{display:block;font-size:12px;color:var(--muted)}
.wc-change{margin-left:6px;padding:1px 7px;border-radius:999px;font-size:12px;font-weight:700;background:var(--mint);color:var(--green)}
.wc-change.down{background:#f1ece2;color:var(--muted)}
.wc-plot{position:relative;margin-top:8px}
.wc-bars{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(7,1fr);gap:2px}
.wc-col{position:relative;height:118px;display:flex;justify-content:center}
.wc-col::before{content:"";position:absolute;left:0;right:0;bottom:22px;border-bottom:2px solid var(--line)}
.wc-col i,.wc-ghost{position:absolute;bottom:22px;width:min(70%,40px);transform-origin:bottom}
.wc-col i{border-radius:4px 4px 0 0;background:var(--green);height:max(calc((100% - 22px) * var(--h)),calc(3px * min(1,var(--h) * 1000)))}
.wc-ghost{height:calc((100% - 22px) * var(--h))}
.wc-col b{position:absolute;z-index:2;bottom:calc((100% - 22px) * var(--h) + 24px - var(--in,0) * 20px);display:flex;align-items:center;gap:1px;padding:1px 3px;border-radius:4px;background:var(--white);font-size:12px;color:var(--muted);line-height:1;white-space:nowrap}
.wc-ro{width:12px;height:15px;margin:-2px 0}
.wc-ghost{border:2px dashed color-mix(in srgb,var(--green) 55%,transparent);border-bottom:0;border-radius:6px 6px 0 0;box-sizing:border-box}
.wc-col.today b{color:var(--ink)}
.wc-col.beaten i{background:var(--wc-gold)}
.wc-day{position:absolute;bottom:0;font-size:12px;color:var(--muted)}
.wc-col.today .wc-day{color:var(--ink);font-weight:700}
.wc-avg{position:absolute;left:0;right:0;bottom:calc((100% - 22px) * var(--h) + 22px);z-index:1;border-top:2px dashed var(--wc-avg);pointer-events:none}
.wc-key{display:flex;flex-wrap:wrap;gap:4px 16px;margin:8px 0 0;font-size:12px;color:var(--muted)}
.wc-key:empty{display:none}
.wc-key span{display:inline-flex;align-items:center;gap:6px}
.wc-key-avg{width:18px;border-top:2px dashed var(--wc-avg)}
.wc-key-ghost{width:12px;height:10px;border:2px dashed color-mix(in srgb,var(--green) 55%,transparent);border-bottom:0;border-radius:3px 3px 0 0}
.wc-month{white-space:nowrap;display:flex;align-items:center;gap:10px;margin-top:10px;padding-top:10px;border-top:2px solid var(--line);font-size:12px;color:var(--muted)}
.wc-dots{flex:1;display:flex;justify-content:center;gap:10px}
.wc-week{display:flex;gap:3px}
.wc-week i{width:8px;height:8px;border-radius:2px;box-shadow:inset 0 0 0 1.5px var(--line)}
.wc-week i.read{background:var(--green);box-shadow:none}
.wc-week i.today{outline:2px solid var(--wc-gold);outline-offset:1px}
/* Rosette shelf: one rosette per goal, each opening its certificate. */
.wc-shelf{margin-top:10px;padding-top:10px;border-top:2px solid var(--line)}
.wc-shelf h3{margin:0 0 8px;font-size:14px}
.wc-shelf h3 small{margin-left:6px;font-size:12px;font-weight:400;color:var(--muted)}
.wc-ro-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.wc-ro-item{position:relative;display:flex;align-items:center;gap:8px;min-height:64px;padding:6px 10px 6px 6px;border-radius:16px;background:var(--paper);box-shadow:inset 0 0 0 1.5px var(--line);text-align:left}
.wc-ro-item .rosette{flex:none;width:38px;height:48px;filter:drop-shadow(0 2px 2px rgba(0,0,0,.15))}
.wc-ro-item span{min-width:0;line-height:1.2}
.wc-ro-item strong{display:block;font-size:13px}
.wc-ro-item small{display:block;font-size:11px;font-weight:400;color:var(--muted)}
.wc-ro-count{position:absolute;left:30px;top:4px;min-width:22px;padding:2px 5px;border-radius:999px;background:var(--ink);color:#fff;font-size:11px;line-height:1.2;text-align:center}
.wc-ro-item.empty:disabled{opacity:1}
.wc-ro-item.empty .rosette{filter:grayscale(1);opacity:.32}
.wc-ro-item.empty strong{color:var(--muted)}
@media(max-width:520px){.wc-ro-item{flex-direction:column;justify-content:flex-start;gap:2px;padding:8px 4px;text-align:center}.wc-ro-count{left:calc(50% + 8px)}}
@media(max-width:420px){.week-chart{padding:14px 12px 10px}.wc-col{height:104px}.wc-col b,.wc-day{font-size:11px}.wc-dots{gap:5px}.wc-week{gap:2px}.wc-week i{width:6px;height:6px}.wc-month{gap:8px}.wc-totals{text-align:left}}
/* End-of-page celebration: confetti canvas, light rays and a medal card. */
.celebration{position:fixed;inset:0;z-index:2000;display:grid;place-items:center;padding:16px;background:radial-gradient(circle at 50% 42%,rgba(30,56,48,.62),rgba(10,24,20,.9));-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);opacity:0;transition:opacity .35s ease}
.celebration.cb-in{opacity:1}
.celebration.cb-out{opacity:0;transition-duration:.4s}
.cb-confetti{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:1}.cb-confetti.cb-front{z-index:3}
.cb-rays{position:absolute;left:50%;top:42%;width:170vmax;height:170vmax;margin:-85vmax 0 0 -85vmax;border-radius:50%;background:repeating-conic-gradient(from 0deg,rgba(255,226,140,.26) 0 7deg,transparent 7deg 18deg);-webkit-mask:radial-gradient(circle,#000 0,#000 12%,transparent 52%);mask:radial-gradient(circle,#000 0,#000 12%,transparent 52%);animation:cb-spin 26s linear infinite;opacity:0;transition:opacity .8s ease .15s}
.cb-in .cb-rays{opacity:1}
@keyframes cb-spin{to{transform:rotate(360deg)}}
.cb-card{position:relative;z-index:2;width:min(400px,100%);padding:20px 24px 24px;border-radius:34px;text-align:center;background:linear-gradient(180deg,#fffef9,#fbf4dc);box-shadow:0 0 0 3px #f4cd63,0 0 0 9px rgba(255,254,249,.35),0 30px 80px rgba(0,0,0,.35);transform:scale(.5) rotate(-6deg);opacity:0}
.cb-in .cb-card{animation:cb-pop .75s cubic-bezier(.2,1.6,.4,1) forwards}
@keyframes cb-pop{0%{transform:scale(.5) rotate(-6deg);opacity:0}60%{opacity:1}100%{transform:scale(1) rotate(0);opacity:1}}
.cb-hit .cb-card{animation:cb-pop .75s cubic-bezier(.2,1.6,.4,1) forwards,cb-thump .35s ease-out}
@keyframes cb-thump{0%{scale:1}35%{scale:1.04}100%{scale:1}}
.cb-medal{display:block;width:150px;height:188px;margin:-86px auto 0;filter:drop-shadow(0 10px 14px rgba(0,0,0,.28))}
.ro-score{font:800 22px/1 ui-rounded,"Trebuchet MS",system-ui,sans-serif}
.ro-unit{font:700 8px/1 ui-rounded,"Trebuchet MS",system-ui,sans-serif;letter-spacing:.04em}
.cb-in .cb-medal{animation:cb-medal 1.1s cubic-bezier(.3,1.5,.5,1) .15s both}
@keyframes cb-medal{0%{transform:translateY(-40px) scale(.3) rotate(-25deg);opacity:0}100%{transform:none;opacity:1}}
.cb-shine{animation:cb-shine 2.6s ease-in-out .9s infinite}
@keyframes cb-shine{0%{transform:rotate(25deg) translateX(0)}45%,100%{transform:rotate(25deg) translateX(260px)}}
.cb-medal-score{font:800 44px/1 ui-rounded,"Trebuchet MS",system-ui,sans-serif;fill:#6b4706}
.cb-medal-unit{font:700 13px/1 ui-rounded,"Trebuchet MS",system-ui,sans-serif;fill:#8a5d0b;letter-spacing:.02em}
.cb-title{margin:4px 0 8px;font:700 clamp(28px,7.4vw,40px)/1.08 Georgia,"Times New Roman",serif;color:var(--green)}
.cb-title span{display:inline-block}.cb-title .cb-word{white-space:nowrap}
.cb-in .cb-title span{animation:cb-letter .6s cubic-bezier(.3,1.8,.5,1) calc(.35s + var(--i) * 35ms) both}
@keyframes cb-letter{0%{transform:translateY(22px) scale(.4);opacity:0}100%{transform:none;opacity:1}}
.cb-detail{margin:0 auto 14px;max-width:30ch;font-size:16px;line-height:1.4;color:var(--ink)}
.cb-detail strong{color:var(--green)}
.cb-chips{display:flex;justify-content:center;gap:10px;margin-bottom:14px}
.cb-chip{min-width:84px;padding:8px 12px;border-radius:16px;background:var(--mint)}
.cb-chip small{display:block;font-size:12px;color:var(--muted)}
.cb-chip b{font-size:24px;color:var(--ink)}
.cb-chip.cb-today{background:#f4cd63}
.cb-chip.cb-today small{color:#6b4706}
.cb-in .cb-chip{animation:cb-rise .5s ease-out both}.cb-in .cb-chip:nth-child(2){animation-delay:.9s}.cb-in .cb-chip:nth-child(1){animation-delay:.75s}.cb-in .cb-chip:nth-child(3){animation-delay:1.05s}
@keyframes cb-rise{0%{transform:translateY(12px);opacity:0}100%{transform:none;opacity:1}}
.cb-cheer{margin:0 0 4px;font-size:18px;font-weight:800;color:#b5770c}
.cb-next{margin:0 0 14px;font-size:14px;color:var(--muted)}
.cb-in .cb-cheer,.cb-in .cb-next{animation:cb-rise .5s ease-out 1.25s both}
.cb-close{margin-top:6px;min-width:200px}
.cb-in .cb-close{animation:cb-rise .5s ease-out 1.6s both}
.cb-calm .cb-rays{animation:none}
.cb-calm .cb-card,.cb-calm .cb-medal,.cb-calm .cb-title span,.cb-calm .cb-chip,.cb-calm .cb-cheer,.cb-calm .cb-next,.cb-calm .cb-close,.cb-calm .cb-shine{animation:none!important;transform:none;opacity:1}
@media(max-height:620px){.cb-medal{width:110px;height:138px;margin-top:-56px}.cb-title{font-size:28px}}
.cb-preview{position:fixed;left:50%;bottom:90px;z-index:1500;transform:translateX(-50%);box-shadow:0 10px 30px rgba(0,0,0,.25)}
/* The record celebration glows gold. */
.cb-record .cb-rays{background:repeating-conic-gradient(from 0deg,rgba(255,214,90,.44) 0 7deg,transparent 7deg 18deg)}
.cb-record .cb-card{box-shadow:0 0 0 4px #e4ae28,0 0 0 11px rgba(255,226,140,.45),0 0 60px rgba(255,214,90,.55),0 30px 80px rgba(0,0,0,.35)}
.cb-record .cb-cheer{color:#a8730c}
/* Certificates: a framed page per rosette that prints on its own. */
.certificate{position:fixed;inset:0;z-index:2100;display:grid;place-items:center;padding:16px;overflow:auto;background:rgba(10,24,20,.72)}
.cert-sheet{width:min(560px,100%);padding:14px;border-radius:24px;background:var(--white);box-shadow:0 30px 80px rgba(0,0,0,.35)}
.cert-frame{padding:20px 18px 18px;border:3px solid var(--cert);border-radius:14px;outline:1.5px solid var(--cert);outline-offset:-9px;text-align:center;background:radial-gradient(circle at 50% 30%,#fffef9,#fbf4dc)}
.cert-eyebrow{margin:0;font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.certificate h2{margin:4px 0 4px;font:700 clamp(24px,6vw,32px)/1.1 Georgia,"Times New Roman",serif;color:var(--cert-dark)}
.cert-rosette{display:block;width:96px;height:120px;margin:6px auto;filter:drop-shadow(0 6px 8px rgba(0,0,0,.2))}
.cert-small,.cert-reason,.cert-date{margin:0;font-size:15px;color:var(--ink)}
.cert-name{margin:2px 0 8px;font:italic 700 clamp(28px,8vw,40px)/1.15 Georgia,"Times New Roman",serif;color:var(--green);border-bottom:1.5px solid var(--line);display:inline-block;padding:0 18px 4px}
.cert-words{margin:4px 0 2px;font-size:26px;font-weight:800;color:var(--cert-dark)}
.cert-award{margin:12px 0 0;font-size:13px;font-weight:700;color:var(--muted)}
.cert-chips{display:flex;flex-wrap:wrap;justify-content:center;gap:6px;margin-top:12px}
.cert-chips button{min-height:40px;padding:6px 10px;border-radius:999px;font-size:13px;background:var(--paper);box-shadow:inset 0 0 0 1.5px var(--line)}
.cert-chips button[aria-pressed="true"]{background:var(--ink);color:#fff;box-shadow:none}
.cert-actions{display:flex;justify-content:center;gap:10px;margin-top:12px}
.cert-actions button{min-width:120px}
@media print{
  body.cert-open>*:not(.certificate){display:none!important}
  body.cert-open{background:#fff}
  .certificate{position:static;padding:0;background:none}
  .cert-sheet{width:100%;box-shadow:none;padding:0}
  .cert-frame{padding:48px 32px;print-color-adjust:exact;-webkit-print-color-adjust:exact}
  .cert-chips,.cert-actions{display:none}
}

/* Oxford collections keep their own identity alongside the RWI colour sets. */
.set-oxford { background:#157c9c; }
/* Sound Blending Books come before Set 1 in the RWI progression. */
.set-sound-blending { background:#7a5ea8; }
.original-page {display:block;max-width:100%;height:auto;margin:20px auto;background:white;}

.picture-open {margin:0 0 10px;min-height:44px;}
.picture-dialog {width:min(1000px,96vw);max-width:96vw;max-height:94dvh;padding:12px;border:0;border-radius:18px;background:#fbf8f0;}
.picture-dialog::backdrop {background:#16392dcc;}
.picture-dialog form {position:sticky;top:0;padding-bottom:10px;background:#fbf8f0;}
.picture-dialog img {display:block;width:100%;height:auto;}
