/* ==========================================================================
   Readlings — shared design system
   --------------------------------------------------------------------------
   1.  Fonts & tokens
   2.  Base, accessibility & buttons
   3.  Site header
   4.  Homepage hero
   5.  Reading trail
   6.  Reading levels
   7.  Book nook
   8.  Grown-up notes, closing CTA & footer
   9.  Dialogs, toast & utility states
   10. Reader: toolbar
   11. Reader: chapter layout, story type & completion
   12. Reader: line focus & celebrations
   13. Responsive rules
   14. Print styles
   15. Reduced-motion preferences
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts & tokens
   -------------------------------------------------------------------------- */

/* OpenDyslexic is not distributed through Google Fonts. It is loaded from a
   pinned CDN build, with a generous system fallback if the network is slow. */
@font-face {
  font-family: "OpenDyslexic";
  src: url("https://cdn.jsdelivr.net/gh/antijingoist/opendyslexic@0.91.12/compiled/OpenDyslexic-Regular.woff") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "OpenDyslexic";
  src: url("https://cdn.jsdelivr.net/gh/antijingoist/opendyslexic@0.91.12/compiled/OpenDyslexic-Bold.woff") format("woff");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  /* Brand palette */
  --cream: #FFFDF7;
  --cream-deep: #FFF8E8;
  --paper: #FFFFFF;
  --ink: #1E293B;
  --ink-soft: #556273;
  --ink-muted: #5F6B7E;
  --line: #EAE3D6;
  --line-strong: #DCD2C0;

  --sunny: #FFB800;
  --sunny-soft: #FFF4CC;
  --sunny-deep: #6A4300;
  --coral: #FF6B6B;
  --coral-soft: #FFE7E7;
  --coral-deep: #6D1F1F;
  --teal: #06B6D4;
  --teal-soft: #DFF9FD;
  --teal-deep: #064C5C;
  --green: #10B981;
  --green-soft: #DFF8EE;
  --green-deep: #075744;
  --violet: #8B5CF6;
  --violet-soft: #EEE6FF;
  --violet-deep: #3F2572;

  /* Active level theme. app.js replaces these per chapter. */
  --level-color: var(--sunny);
  --level-soft: var(--sunny-soft);
  --level-ink: var(--sunny-deep);
  --level-line: #F0D988;

  /* Type */
  --font-ui: "Lexend", "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  --font-comic: "Comic Neue", "Comic Sans MS", "Trebuchet MS", cursive;
  --font-dyslexic: "OpenDyslexic", "Lexend", "Trebuchet MS", sans-serif;
  --reading-font: var(--font-ui);
  --reader-font-size: 1.4rem;

  /* Shape & depth */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow-xs: 0 2px 8px rgba(30, 41, 59, 0.05);
  --shadow-sm: 0 6px 18px rgba(30, 41, 59, 0.07);
  --shadow-md: 0 14px 40px rgba(30, 41, 59, 0.10);
  --shadow-lg: 0 26px 70px rgba(30, 41, 59, 0.14);

  /* Layout */
  --container: 1180px;
  --gutter: clamp(1.25rem, 4vw, 2rem);
  --section-space: clamp(4rem, 7vw, 6.5rem);
  --focus-band-height: 4.8rem;
}

/* --------------------------------------------------------------------------
   2. Base, accessibility & buttons
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 7rem;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 4%, rgba(255, 184, 0, 0.10), transparent 30rem),
    radial-gradient(circle at 93% 30%, rgba(6, 182, 212, 0.07), transparent 28rem),
    var(--cream);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4,
p,
figure,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

::selection {
  color: var(--ink);
  background: #FFE58A;
}

:focus-visible {
  outline: 3px solid #0E9DB8;
  outline-offset: 3px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1.18em;
  height: 1.18em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.18em;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.print-only {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 500;
  padding: 0.8rem 1.1rem;
  color: var(--ink);
  background: var(--sunny);
  border: 2px solid var(--ink);
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.container {
  width: min(calc(100% - (var(--gutter) * 2)), var(--container));
  margin-inline: auto;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow .icon {
  color: var(--sunny);
  width: 1rem;
  height: 1rem;
}

.eyebrow--pill {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 1.35rem;
  padding: 0.5rem 0.85rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(30, 41, 59, 0.08);
  border-radius: 999px;
  font-size: 0.71rem;
  letter-spacing: 0.07em;
  text-transform: none;
  box-shadow: var(--shadow-xs);
}

.eyebrow--dark {
  color: rgba(255, 255, 255, 0.68);
}

.eyebrow--dark .icon {
  color: var(--sunny);
}

.btn {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.84rem 1.35rem;
  border: 2px solid transparent;
  border-radius: 16px;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.btn .icon {
  width: 1.08rem;
  height: 1.08rem;
  transition: transform 160ms ease;
}

.btn:hover .icon {
  transform: translateX(2px);
}

.btn--primary {
  color: var(--ink);
  background: var(--sunny);
  border-color: #F4AE00;
  box-shadow: 0 5px 0 #CB9000, 0 10px 24px rgba(180, 124, 0, 0.16);
}

.btn--primary:hover {
  background: #FFC42E;
  box-shadow: 0 7px 0 #CB9000, 0 14px 28px rgba(180, 124, 0, 0.18);
  transform: translateY(-2px);
}

.btn--primary:active {
  box-shadow: 0 2px 0 #CB9000;
  transform: translateY(3px);
}

.btn--ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}

.btn--ghost:hover {
  background: var(--paper);
  border-color: var(--ink);
  transform: translateY(-2px);
}

.btn--ink {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 5px 0 #0B1220;
}

.btn--ink:hover {
  background: #2B3B52;
  transform: translateY(-2px);
}

.btn--light {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--paper);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.14);
}

.btn--light:hover {
  background: var(--sunny-soft);
  transform: translateY(-2px);
}

.btn--small {
  min-height: 44px;
  padding: 0.68rem 1rem;
  border-radius: 13px;
  font-size: 0.84rem;
}

.icon-btn {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.icon-btn:hover:not(:disabled) {
  color: var(--ink);
  background: #F7F2E8;
  border-color: var(--line);
}

.icon-btn:disabled {
  opacity: 0.35;
}

.chip-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.chip-button .icon {
  width: 0.85rem;
  height: 0.85rem;
}

.chip-button:hover {
  color: var(--ink);
  border-color: var(--ink);
}

[hidden] {
  display: none !important;
}

.noscript-banner {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 700;
  padding: 1rem;
  color: var(--ink);
  background: var(--sunny-soft);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-align: center;
}

/* --------------------------------------------------------------------------
   3. Site header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 253, 247, 0.88);
  border-bottom: 1px solid rgba(220, 210, 192, 0.7);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.site-header--reader {
  position: relative;
}

.site-header__inner {
  display: flex;
  min-height: 82px;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand__mark {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 4px 7px rgba(142, 97, 0, 0.14));
  transition: transform 220ms ease;
}

.brand:hover .brand__mark {
  transform: rotate(-4deg) scale(1.04);
}

.brand__copy {
  display: flex;
  flex-direction: column;
  gap: 0.02rem;
}

.brand__name {
  color: var(--ink);
  font-size: 1.32rem;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.15;
}

.brand__tagline {
  color: var(--ink-muted);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.35;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.12rem;
  margin-left: auto;
}

.site-nav a {
  padding: 0.65rem 0.8rem;
  color: var(--ink-soft);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease;
}

.site-nav a:hover {
  color: var(--ink);
  background: #F7F1E4;
}

.star-pill {
  display: inline-flex;
  min-height: 42px;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  color: var(--sunny-deep);
  background: rgba(255, 244, 204, 0.9);
  border: 1px solid #F0D47F;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 160ms ease, transform 160ms ease;
}

.star-pill .icon {
  width: 1rem;
  height: 1rem;
  color: #B97800;
}

.star-pill strong {
  font-size: 0.9rem;
  font-weight: 800;
}

.star-pill:hover {
  background: #FFEDB0;
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   4. Homepage hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3.25rem, 6vw, 5.7rem) 0 clamp(3rem, 5vw, 4.8rem);
}

.hero::before {
  position: absolute;
  top: 12%;
  left: -10rem;
  width: 21rem;
  height: 21rem;
  background: radial-gradient(circle, rgba(255, 184, 0, 0.14), transparent 66%);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.hero__grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  align-items: center;
  gap: clamp(2rem, 5.5vw, 4.8rem);
}

.hero__copy {
  position: relative;
  z-index: 2;
  max-width: 650px;
}

.hero h1 {
  max-width: 11ch;
  margin-bottom: 1.35rem;
  font-size: clamp(2.9rem, 5.4vw, 4.85rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1.01;
}

.marker-highlight {
  position: relative;
  display: inline;
  z-index: 0;
  padding: 0 0.05em;
}

.marker-highlight::after {
  position: absolute;
  right: -0.03em;
  bottom: 0.05em;
  left: -0.03em;
  z-index: -1;
  height: 0.33em;
  background: #FFE28A;
  border-radius: 0.2em 0.5em 0.18em 0.42em;
  content: "";
  transform: rotate(-1.2deg);
}

.hero__lead {
  max-width: 47ch;
  margin-bottom: 1.9rem;
  color: var(--ink-soft);
  font-size: clamp(1.02rem, 1.35vw, 1.14rem);
  line-height: 1.75;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.hero__trust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 500;
}

.hero__trust li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.trust-dot {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 9px;
}

.trust-dot .icon {
  width: 0.84rem;
  height: 0.84rem;
}

.trust-dot--teal {
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.trust-dot--pink {
  color: var(--coral-deep);
  background: var(--coral-soft);
}

.trust-dot--green {
  color: var(--green-deep);
  background: var(--green-soft);
}

.hero__doodle {
  position: absolute;
  z-index: 0;
  font-family: var(--font-comic);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.hero__doodle--one {
  top: 17%;
  left: 47%;
  color: rgba(255, 184, 0, 0.25);
  font-size: 3.5rem;
  transform: rotate(13deg);
}

.hero__doodle--two {
  right: 2%;
  bottom: 7%;
  color: rgba(6, 182, 212, 0.15);
  font-size: 4rem;
  transform: rotate(-10deg);
}

.hero__visual {
  position: relative;
  min-width: 0;
}

.hero-art-card {
  position: relative;
  padding: clamp(1rem, 2.8vw, 1.8rem);
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.72), transparent 24%),
    linear-gradient(145deg, #FFF9E8 0%, #FFEDB4 100%);
  border: 1.5px solid #F0DD9E;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.hero-art-card::before {
  position: absolute;
  inset: 0.7rem;
  border: 1px dashed rgba(135, 94, 8, 0.16);
  border-radius: 25px;
  content: "";
  pointer-events: none;
}

.hero-art-card__pill {
  position: absolute;
  top: 1.35rem;
  left: 1.35rem;
  z-index: 3;
  padding: 0.44rem 0.72rem;
  color: var(--ink-soft);
  background: rgba(255, 253, 247, 0.84);
  border: 1px solid rgba(30, 41, 59, 0.09);
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: var(--shadow-xs);
}

.hero-illustration {
  width: 100%;
  height: auto;
  animation: hero-bob 7s ease-in-out infinite;
}

@keyframes hero-bob {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-7px) rotate(0.3deg);
  }
}

.hero-art-stat {
  position: absolute;
  bottom: 1.4rem;
  left: -1.1rem;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 0.9rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #E6DBC4;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  transform: rotate(-2deg);
}

.hero-art-stat__icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  color: var(--sunny-deep);
  background: var(--sunny-soft);
  border-radius: 11px;
}

.hero-art-stat__icon .icon {
  width: 1.05rem;
  height: 1.05rem;
  color: #B97800;
}

.hero-art-stat > span:last-child {
  display: flex;
  flex-direction: column;
}

.hero-art-stat strong {
  font-size: 0.8rem;
  line-height: 1.25;
}

.hero-art-stat small {
  color: var(--ink-muted);
  font-size: 0.64rem;
  line-height: 1.4;
}

.hero-scribble {
  position: absolute;
  z-index: 3;
  color: var(--coral);
  font-size: 1.4rem;
  line-height: 1;
  pointer-events: none;
}

.hero-scribble--left {
  bottom: 1.1rem;
  left: 1.2rem;
  transform: rotate(-15deg);
}

.hero-scribble--right {
  top: 1.1rem;
  right: 1.2rem;
  color: var(--teal);
  font-size: 1.15rem;
  transform: rotate(12deg);
}

/* --------------------------------------------------------------------------
   5. Reading trail
   -------------------------------------------------------------------------- */

.trail-section {
  position: relative;
  z-index: 2;
  padding-bottom: 1.5rem;
}

.trail-card {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 2rem;
  overflow: hidden;
  padding: clamp(1.5rem, 3vw, 2.2rem);
  color: var(--paper);
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 184, 0, 0.13), transparent 27%),
    radial-gradient(circle at 96% 90%, rgba(6, 182, 212, 0.16), transparent 32%),
    #1E293B;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 48px rgba(30, 41, 59, 0.17);
}

.trail-card::after {
  position: absolute;
  top: -5rem;
  right: 17%;
  width: 12rem;
  height: 12rem;
  border: 1px dashed rgba(255, 255, 255, 0.11);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.trail-card__main {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 1.2rem;
}

.trail-badge {
  position: relative;
  display: grid;
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  place-items: center;
  color: var(--sunny-deep);
  background: var(--sunny);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 24px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  transform: rotate(-4deg);
}

.trail-badge .icon {
  width: 2rem;
  height: 2rem;
  fill: #5F4300;
  stroke: #5F4300;
}

.trail-badge__ring {
  position: absolute;
  inset: -7px;
  border: 1px dashed rgba(255, 208, 71, 0.45);
  border-radius: 29px;
}

.trail-card__copy {
  min-width: 0;
}

.trail-card .eyebrow {
  margin-bottom: 0.35rem;
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.67rem;
}

.trail-card h2 {
  margin-bottom: 0.25rem;
  color: var(--paper);
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  letter-spacing: -0.035em;
}

.trail-card__copy > p:last-of-type {
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.8rem;
  line-height: 1.55;
}

.trail-progress {
  display: flex;
  max-width: 480px;
  align-items: center;
  gap: 0.85rem;
  margin-top: 1rem;
}

.trail-progress__track {
  position: relative;
  height: 9px;
  flex: 1;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.trail-progress__fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--sunny), #F6DE73 55%, #77E3BC);
  border-radius: inherit;
  transition: width 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.trail-progress__label {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.69rem;
  white-space: nowrap;
}

.trail-progress__label strong {
  color: var(--paper);
  font-size: 0.82rem;
}

.trail-next {
  position: relative;
  display: flex;
  min-width: 244px;
  flex: 0 0 255px;
  flex-direction: column;
  justify-content: center;
  padding: 1rem 1.2rem;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
}

.trail-next__eyebrow {
  margin-bottom: 0.2rem;
  color: #FFD66E;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.trail-next__book {
  overflow: hidden;
  color: var(--paper);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trail-next__chapter {
  overflow: hidden;
  margin-bottom: 0.7rem;
  color: rgba(255, 255, 255, 0.57);
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trail-next .btn {
  min-height: 38px;
  padding: 0.52rem 0.84rem;
  font-size: 0.75rem;
}

/* --------------------------------------------------------------------------
   6. Reading levels
   -------------------------------------------------------------------------- */

.section {
  padding-top: var(--section-space);
  padding-bottom: var(--section-space);
}

.section-heading {
  margin-bottom: 2.3rem;
}

.section-heading--split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2.5rem;
}

.section-heading h2 {
  max-width: 700px;
  font-size: clamp(2rem, 3.8vw, 3.1rem);
  letter-spacing: -0.05em;
  line-height: 1.08;
}

.section-heading__note {
  max-width: 335px;
  padding-bottom: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.7;
}

.levels-section {
  padding-bottom: 3.5rem;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.9rem;
}

.level-card {
  --card-color: var(--sunny);
  --card-soft: var(--sunny-soft);
  --card-ink: var(--sunny-deep);
  position: relative;
  display: flex;
  min-height: 275px;
  flex-direction: column;
  overflow: hidden;
  padding: 1.1rem;
  color: var(--ink);
  text-align: left;
  background:
    radial-gradient(circle at 90% 4%, rgba(255, 255, 255, 0.7), transparent 28%),
    var(--card-soft);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  box-shadow: inset 0 -4px 0 rgba(30, 41, 59, 0.035);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.level-card::before {
  position: absolute;
  top: -1.8rem;
  right: -1.2rem;
  color: var(--card-color);
  font-size: 5.7rem;
  font-weight: 800;
  letter-spacing: -0.08em;
  line-height: 1;
  opacity: 0.16;
  content: attr(data-number);
  pointer-events: none;
}

.level-card:hover {
  border-color: var(--card-color);
  box-shadow: 0 14px 28px rgba(30, 41, 59, 0.09);
  transform: translateY(-5px);
}

.level-card[aria-pressed="true"] {
  border-color: var(--card-color);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.85), 0 16px 32px rgba(30, 41, 59, 0.11);
  transform: translateY(-4px);
}

.level-card__top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.level-card__icon {
  display: grid;
  width: 41px;
  height: 41px;
  place-items: center;
  color: var(--card-ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 13px;
}

.level-card__icon .icon {
  width: 1.22rem;
  height: 1.22rem;
}

.level-card__number {
  position: relative;
  z-index: 1;
  padding: 0.28rem 0.55rem;
  color: var(--card-ink);
  background: rgba(255, 255, 255, 0.54);
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.level-card__category {
  position: relative;
  z-index: 1;
  margin-bottom: 0.2rem;
  color: var(--card-ink);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.level-card h3,
.level-card__title {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: 0.5rem;
  color: var(--ink);
  font-size: 1.01rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.level-card__description {
  position: relative;
  z-index: 1;
  display: -webkit-box;
  overflow: hidden;
  color: var(--card-ink);
  font-size: 0.73rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.level-card__footer {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: auto;
  padding-top: 1rem;
}

.level-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  color: var(--card-ink);
  font-size: 0.62rem;
  font-weight: 600;
  opacity: 0.82;
}

.level-card__progress {
  display: block;
  height: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 999px;
}

.level-card__progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--card-color);
  border-radius: inherit;
  transition: width 400ms ease;
}

.filter-hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.filter-hint .icon {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--sunny);
}

/* --------------------------------------------------------------------------
   7. Book nook
   -------------------------------------------------------------------------- */

.library-section {
  position: relative;
  background:
    radial-gradient(rgba(30, 41, 59, 0.035) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--cream-deep);
  border-top: 1px solid #F0E7D5;
  border-bottom: 1px solid #F0E7D5;
}

.catalog-bar {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.catalog-status {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.catalog-status strong {
  color: var(--ink);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 1.2rem;
}

.book-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 0.6rem;
  background: var(--paper);
  border: 1px solid rgba(220, 210, 192, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  animation: card-in 440ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--card-index, 0) * 45ms);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.book-card:hover {
  border-color: #DFD2B9;
  box-shadow: 0 18px 40px rgba(30, 41, 59, 0.11);
  transform: translateY(-6px);
}

.book-cover {
  --cover-color: var(--sunny);
  --cover-soft: var(--sunny-soft);
  --cover-ink: var(--sunny-deep);
  position: relative;
  display: flex;
  aspect-ratio: 1.3 / 1;
  flex-direction: column;
  overflow: hidden;
  padding: 0.8rem;
  color: var(--cover-ink);
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 255, 255, 0.75), transparent 24%),
    linear-gradient(140deg, var(--cover-soft), #FFFDF7);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 19px;
}

.book-cover::before {
  position: absolute;
  top: 23%;
  right: -12%;
  width: 64%;
  aspect-ratio: 1;
  background: var(--cover-color);
  border-radius: 50%;
  content: "";
  opacity: 0.16;
}

.book-cover::after {
  position: absolute;
  bottom: -2.4rem;
  left: -2.3rem;
  width: 8rem;
  height: 8rem;
  border: 1px dashed currentColor;
  border-radius: 50%;
  content: "";
  opacity: 0.2;
}

.book-cover__top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.cover-series {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cover-series svg {
  width: 14px;
  height: 14px;
}

.cover-level {
  padding: 0.23rem 0.45rem;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 999px;
  font-size: 0.51rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cover-art {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
}

.cover-emoji {
  position: relative;
  display: grid;
  width: clamp(62px, 5.8vw, 84px);
  height: clamp(62px, 5.8vw, 84px);
  place-items: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: clamp(2rem, 3.3vw, 2.75rem);
  line-height: 1;
  background: rgba(255, 253, 247, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 27% 33% 31% 25%;
  box-shadow: 0 8px 20px rgba(73, 54, 14, 0.1);
  transform: rotate(-4deg);
}

.cover-emoji::after {
  position: absolute;
  inset: -7px;
  border: 1px dashed rgba(30, 41, 59, 0.17);
  border-radius: 32% 28% 34% 29%;
  content: "";
}

.cover-star {
  position: absolute;
  color: var(--cover-color);
  line-height: 1;
}

.cover-star--one {
  top: 7%;
  right: 9%;
  font-size: 0.9rem;
  transform: rotate(12deg);
}

.cover-star--two {
  bottom: 11%;
  left: 8%;
  color: var(--coral);
  font-size: 0.65rem;
  transform: rotate(-12deg);
}

.book-cover__title {
  position: relative;
  z-index: 1;
  padding: 0.48rem 0.55rem;
  background: rgba(255, 253, 247, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 11px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.book-cover__title h3 {
  display: -webkit-box;
  overflow: hidden;
  color: var(--cover-ink);
  font-size: clamp(0.9rem, 1.25vw, 1.07rem);
  letter-spacing: -0.04em;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.book-cover__title p {
  overflow: hidden;
  margin-top: 0.12rem;
  color: var(--cover-ink);
  font-size: 0.58rem;
  font-weight: 500;
  opacity: 0.7;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-cover__sticker {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.24rem 0.45rem;
  color: var(--green-deep);
  background: rgba(223, 248, 238, 0.95);
  border: 1px solid #A9E8CE;
  border-radius: 999px;
  font-size: 0.5rem;
  font-weight: 700;
}

.book-cover__sticker .icon {
  width: 0.65rem;
  height: 0.65rem;
}

.book-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 0.9rem 0.4rem 0.3rem;
}

.book-info__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
  color: var(--ink-muted);
  font-size: 0.62rem;
  font-weight: 600;
}

.book-level-chip {
  padding: 0.2rem 0.46rem;
  color: var(--cover-ink);
  background: var(--cover-soft);
  border-radius: 999px;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.book-info__blurb {
  display: -webkit-box;
  overflow: hidden;
  min-height: 3.1em;
  margin-bottom: 0.8rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.book-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-bottom: 0.9rem;
}

.book-skills span {
  padding: 0.2rem 0.4rem;
  color: var(--ink-soft);
  background: #F8F4EB;
  border-radius: 6px;
  font-size: 0.55rem;
  font-weight: 600;
}

.book-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  padding: 0.62rem 0;
  border-top: 1px solid #F0EBE1;
}

.book-progress__stars {
  display: flex;
  gap: 0.18rem;
}

.book-progress__star {
  display: inline-grid;
  width: 17px;
  height: 17px;
  place-items: center;
  color: #D7D0C2;
}

.book-progress__star .icon {
  width: 0.8rem;
  height: 0.8rem;
  fill: currentColor;
  stroke: currentColor;
}

.book-progress__star.is-earned {
  color: var(--sunny);
}

.book-progress__label {
  color: var(--ink-muted);
  font-size: 0.6rem;
  font-weight: 600;
  white-space: nowrap;
}

.book-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.book-actions .btn {
  flex: 1;
}

.book-actions .btn--chapters {
  min-width: 0;
  flex: 0 0 auto;
  padding-inline: 0.7rem;
}

.book-actions .btn .icon {
  width: 0.9rem;
  height: 0.9rem;
}

.empty-state {
  padding: 3rem 1rem;
  color: var(--ink-soft);
  text-align: center;
}

/* --------------------------------------------------------------------------
   8. Grown-up notes, closing CTA & footer
   -------------------------------------------------------------------------- */

.grownups-section {
  padding-top: clamp(4.2rem, 7vw, 6.5rem);
}

.grownups-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  align-items: center;
  gap: clamp(2.5rem, 6vw, 5rem);
}

.grownups-copy h2 {
  max-width: 15ch;
  margin-bottom: 1rem;
  font-size: clamp(2rem, 3.6vw, 3rem);
}

.grownups-copy > p {
  max-width: 49ch;
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.8;
}

.grownups-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

.grownups-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.6;
}

.grownups-list span {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  margin-top: 0.02rem;
  place-items: center;
  color: var(--green-deep);
  background: var(--green-soft);
  border-radius: 7px;
}

.grownups-list .icon {
  width: 0.75rem;
  height: 0.75rem;
  stroke-width: 2.7;
}

.grownups-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.tip-card {
  position: relative;
  min-height: 190px;
  overflow: hidden;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
}

.tip-card:last-child {
  grid-column: 1 / -1;
  min-height: 0;
}

.tip-card--yellow {
  background: var(--sunny-soft);
}

.tip-card--teal {
  background: var(--teal-soft);
}

.tip-card--pink {
  background: var(--coral-soft);
}

.tip-card__number {
  position: absolute;
  top: 0.7rem;
  right: 0.9rem;
  color: var(--ink);
  font-size: 2.7rem;
  font-weight: 800;
  letter-spacing: -0.08em;
  opacity: 0.55;
}

.tip-card__icon {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 0.9rem;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
}

.tip-card__icon .icon {
  width: 1.1rem;
  height: 1.1rem;
}

.tip-card h3 {
  margin-bottom: 0.35rem;
  font-size: 0.98rem;
}

.tip-card p {
  color: rgba(30, 41, 59, 0.67);
  font-size: 0.76rem;
  line-height: 1.6;
}

.tip-card:last-child {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
}

.tip-card:last-child .tip-card__icon {
  margin: 0;
}

.tip-card:last-child h3 {
  margin: 0;
}

.tip-card:last-child p {
  grid-column: 2;
  margin-top: -0.45rem;
}

.closing-cta {
  padding: 0 0 clamp(4.5rem, 8vw, 7rem);
}

.closing-cta__inner {
  position: relative;
  display: flex;
  overflow: hidden;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(1.7rem, 4vw, 2.7rem);
  color: var(--paper);
  background:
    radial-gradient(circle at 15% 30%, rgba(255, 184, 0, 0.17), transparent 24%),
    linear-gradient(115deg, #1E293B 0%, #24364A 100%);
  border-radius: var(--radius-xl);
}

.closing-cta__inner h2 {
  max-width: 16ch;
  color: var(--paper);
  font-size: clamp(1.65rem, 3vw, 2.3rem);
}

.closing-cta .eyebrow {
  margin-bottom: 0.4rem;
  color: rgba(255, 255, 255, 0.55);
}

.closing-cta .eyebrow--dark {
  color: rgba(255, 255, 255, 0.55);
}

.closing-cta__sparkle {
  position: absolute;
  color: var(--sunny);
  line-height: 1;
  opacity: 0.6;
  pointer-events: none;
}

.closing-cta__sparkle--one {
  top: 1.2rem;
  right: 38%;
  font-size: 1rem;
}

.closing-cta__sparkle--two {
  bottom: 1rem;
  left: 42%;
  color: var(--teal);
  font-size: 1.4rem;
}

.site-footer {
  padding: 2.8rem 0 1.25rem;
  background: #F7F1E5;
  border-top: 1px solid #EDE4D4;
}

.site-footer__main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 2rem;
}

.brand--footer {
  align-items: center;
}

.brand--footer .brand__mark {
  width: 44px;
  height: 44px;
}

.brand--footer .brand__tagline {
  max-width: 290px;
}

.site-footer__note {
  margin-top: 0.8rem;
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.footer-nav {
  display: flex;
  max-width: 420px;
  flex-wrap: wrap;
  gap: 0.5rem 1.3rem;
  padding-top: 0.35rem;
}

.footer-nav a {
  color: var(--ink-soft);
  font-size: 0.77rem;
  font-weight: 500;
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.site-footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  color: var(--ink-muted);
  border-top: 1px solid #E9DFCE;
  font-size: 0.67rem;
}

.site-footer__made {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.site-footer__made .icon {
  width: 0.8rem;
  height: 0.8rem;
  color: var(--coral);
}

/* --------------------------------------------------------------------------
   9. Dialogs, toast & utility states
   -------------------------------------------------------------------------- */

.book-dialog {
  width: min(760px, calc(100% - 2rem));
  max-height: min(88vh, 820px);
  padding: 0;
  overflow: visible;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: var(--radius-lg);
}

.book-dialog::backdrop {
  background: rgba(20, 29, 44, 0.56);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.book-dialog[open] {
  animation: dialog-in 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.book-dialog__panel {
  position: relative;
  overflow: hidden auto;
  max-height: min(88vh, 820px);
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overscroll-behavior: contain;
}

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 4;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(30, 41, 59, 0.1);
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
}

.modal-close:hover {
  background: var(--paper);
  transform: rotate(4deg);
}

.dialog-cover {
  --dialog-color: var(--sunny);
  --dialog-soft: var(--sunny-soft);
  --dialog-ink: var(--sunny-deep);
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  overflow: hidden;
  padding: 2rem;
  background:
    radial-gradient(circle at 92% 10%, var(--dialog-color), transparent 33%),
    var(--dialog-soft);
}

.dialog-cover::after {
  position: absolute;
  right: -2.5rem;
  bottom: -4rem;
  width: 14rem;
  height: 14rem;
  border: 1px dashed var(--dialog-ink);
  border-radius: 50%;
  content: "";
  opacity: 0.15;
}

.dialog-cover__emoji {
  position: relative;
  z-index: 1;
  display: grid;
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  place-items: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 3.1rem;
  background: rgba(255, 253, 247, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 26px;
  box-shadow: var(--shadow-md);
  transform: rotate(-4deg);
}

.dialog-cover__copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.dialog-kicker {
  margin-bottom: 0.3rem;
  color: var(--dialog-ink);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dialog-cover h2 {
  margin-bottom: 0.35rem;
  color: var(--dialog-ink);
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  line-height: 1.05;
}

.dialog-cover p {
  max-width: 47ch;
  color: var(--dialog-ink);
  font-size: 0.8rem;
  line-height: 1.55;
  opacity: 0.78;
}

.dialog-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.dialog-stats span {
  padding: 0.24rem 0.5rem;
  color: var(--dialog-ink);
  background: rgba(255, 255, 255, 0.52);
  border-radius: 999px;
  font-size: 0.59rem;
  font-weight: 600;
}

.dialog-body {
  padding: 1.4rem 1.7rem 1.7rem;
}

.dialog-body__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.dialog-body__heading h3 {
  font-size: 0.96rem;
}

.dialog-body__heading span {
  color: var(--ink-muted);
  font-size: 0.65rem;
  font-weight: 600;
}

.dialog-chapter-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dialog-chapter {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem;
  color: var(--ink);
  background: #FCFAF5;
  border: 1px solid #F0EADD;
  border-radius: 14px;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.dialog-chapter:hover {
  background: var(--paper);
  border-color: var(--line-strong);
  transform: translateX(3px);
}

.dialog-chapter__number {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
}

.dialog-chapter__copy {
  min-width: 0;
  flex: 1;
}

.dialog-chapter__copy strong {
  display: block;
  overflow: hidden;
  font-size: 0.82rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-chapter__copy small {
  display: block;
  overflow: hidden;
  margin-top: 0.1rem;
  color: var(--ink-muted);
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-chapter__status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.25rem;
  color: var(--ink-muted);
  font-size: 0.6rem;
  font-weight: 600;
}

.dialog-chapter__status.is-complete {
  color: #9A6800;
}

.dialog-chapter__status .icon {
  width: 0.8rem;
  height: 0.8rem;
  fill: currentColor;
  stroke: currentColor;
}

.dialog-chapter > .icon {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--ink-muted);
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid #F0EADD;
}

.dialog-footer__note {
  max-width: 34ch;
  color: var(--ink-muted);
  font-size: 0.64rem;
  line-height: 1.5;
}

.dialog-footer .btn {
  flex: 0 0 auto;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  z-index: 400;
  max-width: min(420px, calc(100% - 2rem));
  padding: 0.75rem 1.1rem;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  font-size: 0.78rem;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* --------------------------------------------------------------------------
   10. Reader: toolbar
   -------------------------------------------------------------------------- */

.reader-main {
  padding: 1.4rem 0 3.5rem;
}

.reader-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.breadcrumbs {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink-muted);
  font-size: 0.73rem;
  font-weight: 500;
}

.breadcrumbs a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 160ms ease;
}

.breadcrumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.breadcrumbs a .icon {
  width: 0.82rem;
  height: 0.82rem;
}

.breadcrumbs__divider {
  color: #C6BCAC;
}

.breadcrumbs [aria-current="page"] {
  overflow: hidden;
  color: var(--ink);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-btn--compact {
  flex: 0 0 auto;
}

.reading-toolbar {
  position: sticky;
  top: 1rem;
  z-index: 70;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.6rem;
  padding: 0.55rem 0.65rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 35px rgba(30, 41, 59, 0.09);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.toolbar-audio {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.35rem 0.25rem 0.55rem;
  background: #FFFAEA;
  border: 1px solid #F2E7C8;
  border-radius: 14px;
}

.sound-wave {
  display: flex;
  width: 24px;
  height: 23px;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  gap: 2.5px;
}

.sound-wave span {
  width: 3px;
  height: 7px;
  background: #D39A00;
  border-radius: 999px;
  transform-origin: center;
}

.sound-wave span:nth-child(2) {
  height: 14px;
}

.sound-wave span:nth-child(3) {
  height: 20px;
}

.sound-wave span:nth-child(4) {
  height: 11px;
}

.sound-wave span:nth-child(5) {
  height: 6px;
}

.reading-toolbar.is-playing .sound-wave span {
  animation: sound-wave 780ms ease-in-out infinite;
}

.reading-toolbar.is-playing .sound-wave span:nth-child(2) {
  animation-delay: 130ms;
}

.reading-toolbar.is-playing .sound-wave span:nth-child(3) {
  animation-delay: 260ms;
}

.reading-toolbar.is-playing .sound-wave span:nth-child(4) {
  animation-delay: 390ms;
}

.reading-toolbar.is-playing .sound-wave span:nth-child(5) {
  animation-delay: 520ms;
}

@keyframes sound-wave {
  0%,
  100% {
    transform: scaleY(0.58);
  }
  50% {
    transform: scaleY(1.15);
  }
}

.toolbar-audio__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding-right: 0.1rem;
}

.toolbar-audio__title {
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.toolbar-audio__status {
  display: block;
  overflow: hidden;
  max-width: 150px;
  color: var(--ink-muted);
  font-size: 0.58rem;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-toggle {
  display: inline-flex;
  height: 40px;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.72rem;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 11px;
  font-size: 0.73rem;
  font-weight: 700;
  transition: background-color 160ms ease, transform 160ms ease;
}

.audio-toggle .icon {
  width: 0.82rem;
  height: 0.82rem;
}

.audio-toggle:hover:not(:disabled) {
  background: #2B3B52;
  transform: translateY(-1px);
}

.audio-toggle:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.toolbar-audio .icon-btn--stop {
  width: 33px;
  height: 33px;
  flex-basis: 33px;
  border-radius: 9px;
}

.toolbar-audio .icon-btn--stop .icon {
  width: 0.78rem;
  height: 0.78rem;
}

.speed-select {
  position: relative;
  display: inline-flex;
  height: 31px;
  align-items: center;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #EFE1BD;
  border-radius: 8px;
}

.speed-select select {
  height: 100%;
  max-width: 105px;
  padding: 0 1.25rem 0 0.5rem;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: inherit;
  font-size: 0.59rem;
  font-weight: 700;
  outline-offset: 2px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.speed-select > .icon {
  position: absolute;
  right: 0.3rem;
  width: 0.62rem;
  height: 0.62rem;
  pointer-events: none;
}

.voice-select {
  position: relative;
  display: inline-flex;
  height: 31px;
  align-items: center;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #EFE1BD;
  border-radius: 8px;
}

.voice-select select {
  height: 100%;
  max-width: 150px;
  padding: 0 1.25rem 0 0.5rem;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: inherit;
  font-size: 0.59rem;
  font-weight: 700;
  outline-offset: 2px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.voice-select > .icon {
  position: absolute;
  right: 0.3rem;
  width: 0.62rem;
  height: 0.62rem;
  pointer-events: none;
}

.toolbar-divider {
  width: 1px;
  height: 29px;
  flex: 0 0 1px;
  background: var(--line);
}

.toolbar-tools,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.12rem;
}

.toolbar-actions {
  margin-left: auto;
}

.tool-btn {
  display: inline-flex;
  height: 40px;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 0.65rem;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.tool-btn .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.tool-btn:hover {
  color: var(--ink);
  background: #F7F2E8;
  border-color: var(--line);
}

.tool-btn[aria-expanded="true"] {
  color: var(--ink);
  background: #F7F2E8;
  border-color: var(--line);
}

.tool-btn[aria-pressed="true"] {
  color: var(--ink);
  background: var(--sunny-soft);
  border-color: #EFD587;
}

.font-swatch {
  display: inline-flex;
  align-items: baseline;
  color: var(--ink);
  font-family: var(--font-comic);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
}

.size-stepper {
  display: flex;
  height: 40px;
  align-items: center;
  gap: 0;
  background: #F8F4EB;
  border: 1px solid #F1EADF;
  border-radius: 11px;
}

.size-btn {
  width: 32px;
  height: 31px;
  flex-basis: 32px;
  border-radius: 8px;
}

.size-stepper .size-btn + .size-btn {
  border-left: 1px solid #EDE5D8;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.size-stepper .size-btn:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.size-btn .icon {
  width: 0.82rem;
  height: 0.82rem;
}

.popover {
  position: relative;
}

.popover__menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 120;
  width: 258px;
  padding: 0.45rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.popover__label {
  padding: 0.35rem 0.55rem 0.4rem;
  color: var(--ink-muted);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.font-option,
.menu-option {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 11px;
}

.font-option:hover,
.menu-option:hover {
  background: #F8F4EB;
}

.font-option[aria-checked="true"] {
  background: #FFF8E5;
}

.font-option > span:first-child {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 35px;
  place-items: center;
  color: var(--ink);
  background: #F8F4EB;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 700;
}

.font-option--lexend > span:first-child {
  font-family: var(--font-ui);
}

.font-option--comic > span:first-child {
  font-family: var(--font-comic);
}

.font-option--dyslexic > span:first-child {
  font-family: var(--font-dyslexic);
  font-size: 0.7rem;
}

.font-option > span:nth-child(2),
.menu-option > span {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.font-option strong,
.menu-option strong {
  font-size: 0.75rem;
  line-height: 1.35;
}

.font-option small,
.menu-option small {
  color: var(--ink-muted);
  font-size: 0.6rem;
  line-height: 1.35;
}

.font-option__check {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--green);
  opacity: 0;
}

.font-option[aria-checked="true"] .font-option__check {
  opacity: 1;
}

.menu-option > .icon {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--ink-soft);
}

.toolbar-audio,
.toolbar-tools,
.toolbar-actions {
  min-height: 44px;
}

/* --------------------------------------------------------------------------
   11. Reader: chapter layout, story type & completion
   -------------------------------------------------------------------------- */

.reader-layout {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  align-items: start;
  gap: 2rem;
}

.chapter-sidebar {
  position: sticky;
  top: 6.7rem;
}

.sidebar-card {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.sidebar-book {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem;
  background:
    radial-gradient(circle at 100% 0, var(--level-soft, var(--sunny-soft)), transparent 52%),
    #FFFDF8;
  border-bottom: 1px solid #F2EBDD;
}

.sidebar-cover {
  display: grid;
  width: 58px;
  height: 68px;
  flex: 0 0 58px;
  place-items: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.7rem;
  background: var(--level-color, var(--sunny));
  border-radius: 13px;
  box-shadow: 0 5px 12px rgba(30, 41, 59, 0.12);
  transform: rotate(-3deg);
}

.sidebar-book__copy {
  min-width: 0;
}

.sidebar-book__level {
  display: block;
  margin-bottom: 0.18rem;
  color: var(--level-ink, var(--sunny-deep));
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.sidebar-book__title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sidebar-book__author {
  margin-top: 0.15rem;
  color: var(--ink-muted);
  font-size: 0.58rem;
}

.sidebar-progress {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #F2EBDD;
}

.sidebar-progress__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  color: var(--ink-muted);
  font-size: 0.62rem;
  font-weight: 600;
}

.sidebar-progress__top strong {
  color: var(--ink);
  font-weight: 700;
}

.sidebar-progress__track {
  height: 6px;
  overflow: hidden;
  background: #F4EEE2;
  border-radius: 999px;
}

.sidebar-progress__fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--level-color, var(--sunny));
  border-radius: inherit;
  transition: width 420ms ease;
}

.chapter-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.65rem;
}

.chapter-nav-link {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.55rem;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: 12px;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.chapter-nav-link:hover {
  color: var(--ink);
  background: #F9F5EC;
}

.chapter-nav-link[aria-current="page"] {
  color: var(--ink);
  background: var(--level-soft, var(--sunny-soft));
  border-color: var(--level-line, #F0D988);
}

.chapter-nav-link__number {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  color: var(--ink-muted);
  background: #F8F3E9;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 700;
}

.chapter-nav-link[aria-current="page"] .chapter-nav-link__number {
  color: var(--level-ink, var(--sunny-deep));
  background: rgba(255, 255, 255, 0.65);
}

.chapter-nav-link__text {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.chapter-nav-link__text strong {
  overflow: hidden;
  font-size: 0.73rem;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-nav-link__text small {
  color: var(--ink-muted);
  font-size: 0.56rem;
  line-height: 1.35;
}

.chapter-nav-link__status {
  display: grid;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  place-items: center;
  color: #D8D0C1;
}

.chapter-nav-link__status .icon {
  width: 0.8rem;
  height: 0.8rem;
  fill: currentColor;
  stroke: currentColor;
}

.chapter-nav-link__status.is-complete {
  color: var(--sunny);
}

.sidebar-footer {
  padding: 0.8rem;
  border-top: 1px solid #F2EBDD;
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem;
  color: var(--ink-muted);
  border-radius: 9px;
  font-size: 0.64rem;
  font-weight: 600;
  text-decoration: none;
}

.sidebar-footer a:hover {
  color: var(--ink);
  background: #F9F5EC;
}

.sidebar-tip {
  position: relative;
  margin-top: 0.8rem;
  overflow: hidden;
  padding: 0.95rem;
  background: var(--level-soft, var(--sunny-soft));
  border: 1px solid var(--level-line, #F0D988);
  border-radius: 17px;
}

.sidebar-tip::after {
  position: absolute;
  right: -1rem;
  bottom: -1.5rem;
  width: 4rem;
  height: 4rem;
  border: 1px dashed var(--level-color, var(--sunny));
  border-radius: 50%;
  content: "";
  opacity: 0.32;
}

.sidebar-tip__icon {
  display: grid;
  width: 26px;
  height: 26px;
  margin-bottom: 0.45rem;
  place-items: center;
  color: var(--level-ink, var(--sunny-deep));
  background: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
}

.sidebar-tip__icon .icon {
  width: 0.8rem;
  height: 0.8rem;
}

.sidebar-tip strong {
  display: block;
  color: var(--level-ink, var(--sunny-deep));
  font-size: 0.66rem;
  line-height: 1.35;
}

.sidebar-tip p {
  position: relative;
  z-index: 1;
  margin-top: 0.2rem;
  color: var(--level-ink, var(--sunny-deep));
  font-size: 0.61rem;
  line-height: 1.55;
  opacity: 0.9;
}

.chapter-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  overflow: hidden;
  margin-bottom: 1rem;
  padding: clamp(1.2rem, 3vw, 1.8rem);
  background:
    radial-gradient(circle at 96% 4%, var(--level-color), transparent 31%),
    var(--level-soft);
  border: 1px solid var(--level-line);
  border-radius: var(--radius-lg);
}

.chapter-hero::after {
  position: absolute;
  right: -2.5rem;
  bottom: -3.6rem;
  width: 13rem;
  height: 13rem;
  border: 1px dashed var(--level-ink);
  border-radius: 50%;
  content: "";
  opacity: 0.12;
  pointer-events: none;
}

.chapter-hero__cover {
  position: relative;
  z-index: 1;
  display: grid;
  width: clamp(74px, 10vw, 102px);
  height: clamp(88px, 12vw, 122px);
  flex: 0 0 auto;
  place-items: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: clamp(2rem, 4vw, 2.75rem);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.45), transparent 32%),
    var(--level-color);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(30, 41, 59, 0.14);
  transform: rotate(-3deg);
}

.chapter-hero__cover::after {
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.45);
  border-radius: 14px;
  content: "";
}

.chapter-hero__copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.chapter-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.level-badge,
.chapter-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.26rem 0.5rem;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.3;
}

.level-badge {
  color: #FFFDF7;
  background: var(--level-ink);
}

.chapter-badge {
  color: var(--level-ink);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.chapter-hero h1 {
  margin-bottom: 0.35rem;
  color: var(--level-ink);
  font-size: clamp(1.8rem, 4.2vw, 2.75rem);
  letter-spacing: -0.045em;
  line-height: 1.06;
}

.chapter-summary {
  max-width: 55ch;
  color: var(--level-ink);
  font-size: 0.82rem;
  line-height: 1.55;
  opacity: 0.75;
}

.chapter-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.75rem;
  color: var(--level-ink);
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.7;
}

.chapter-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.chapter-meta .icon {
  width: 0.8rem;
  height: 0.8rem;
}

.reading-card {
  position: relative;
  padding: clamp(1.35rem, 4vw, 3.1rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 55px rgba(30, 41, 59, 0.07);
}

.reading-card__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(1.5rem, 3.5vw, 2.4rem);
  padding-bottom: 0.9rem;
  border-bottom: 1px dashed #ECE4D6;
}

.reading-guide {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink-soft);
  font-size: 0.69rem;
  font-weight: 600;
  line-height: 1.4;
}

.reading-guide__icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--teal-deep);
  background: var(--teal-soft);
  border-radius: 7px;
}

.reading-guide__icon .icon {
  width: 0.75rem;
  height: 0.75rem;
}

.reading-hint {
  color: var(--ink-muted);
  font-size: 0.65rem;
  line-height: 1.4;
  text-align: right;
}

.reading-hint strong {
  color: var(--ink-soft);
}

.chapter-body {
  max-width: 65ch;
  margin-inline: auto;
  color: var(--ink);
  font-family: var(--reading-font);
  font-size: var(--reader-font-size);
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: 0.002em;
  transition: font-size 180ms ease;
}

body[data-reader-font="comic"] .chapter-body {
  line-height: 1.8;
  letter-spacing: 0.006em;
}

body[data-reader-font="dyslexic"] .chapter-body {
  line-height: 1.9;
  letter-spacing: 0.015em;
  word-spacing: 0.05em;
}

.story-text {
  width: 100%;
}

.story-paragraph {
  max-width: 62ch;
  margin: 0 auto;
  text-wrap: pretty;
}

.story-paragraph + .story-paragraph {
  margin-top: 1.35em;
}

.story-page {
  position: relative;
  display: flex;
  max-width: 64ch;
  min-height: 190px;
  align-items: center;
  margin: 0 auto 1.1rem;
  padding: 2.35rem clamp(1.1rem, 4vw, 2.2rem) 1.4rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 184, 0, 0.07), transparent 40%),
    #FFFCF3;
  border: 1px solid #F2E7CE;
  border-radius: 20px;
}

.story-page::after {
  position: absolute;
  top: 0.8rem;
  right: 0.95rem;
  color: var(--sunny);
  font-size: 1rem;
  content: "✦";
  opacity: 0.75;
}

.story-page__number {
  position: absolute;
  top: 0.75rem;
  left: 0.95rem;
  color: var(--ink-muted);
  font-family: var(--font-ui);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.story-page .story-paragraph {
  font-size: calc(var(--reader-font-size) * 1.12);
  font-weight: 500;
  line-height: 1.65;
}

body[data-reader-font="dyslexic"] .story-page .story-paragraph {
  line-height: 1.75;
}

.word {
  border-radius: 4px;
  transition: background-color 90ms ease, box-shadow 90ms ease, color 90ms ease;
}

.speaking-highlight {
  color: #3A2900;
  background: #FFE27A;
  box-shadow: 0 2px 0 #F2C94C;
}

.speaking-highlight:first-letter {
  color: #3A2900;
}

.completion-zone {
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

.completion-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  background:
    radial-gradient(circle at 95% 10%, rgba(255, 255, 255, 0.5), transparent 35%),
    var(--level-soft);
  border: 1px dashed var(--level-line);
  border-radius: 20px;
}

.completion-card.is-complete {
  background:
    radial-gradient(circle at 95% 10%, rgba(255, 255, 255, 0.55), transparent 35%),
    #EDFBF4;
  border-color: #B8E9D3;
  border-style: solid;
}

.completion-star {
  position: relative;
  display: grid;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  place-items: center;
  color: #B87900;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 15px;
  transform: rotate(-4deg);
}

.completion-star .icon {
  width: 1.5rem;
  height: 1.5rem;
  fill: var(--sunny);
  stroke: var(--sunny);
}

.completion-card.is-complete .completion-star {
  color: var(--green-deep);
  background: #D7F7E8;
}

.completion-card.is-complete .completion-star .icon {
  fill: var(--green);
  stroke: var(--green);
  animation: star-pop 480ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes star-pop {
  0% {
    transform: scale(0.35) rotate(-18deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.18) rotate(6deg);
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.completion-copy {
  min-width: 0;
  flex: 1;
}

.completion-copy h2 {
  margin-bottom: 0.18rem;
  font-size: 0.98rem;
  letter-spacing: -0.025em;
}

.completion-copy p {
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.55;
}

.complete-button {
  flex: 0 0 auto;
  min-height: 43px;
  padding: 0.62rem 0.9rem;
  border-radius: 12px;
  font-size: 0.75rem;
  box-shadow: 0 4px 0 #9E6C00;
}

.complete-button.is-complete {
  color: var(--green-deep);
  background: #D9F8EB;
  border-color: #AFE9D1;
  box-shadow: 0 4px 0 #A6DEC5;
  cursor: default;
}

.complete-button.is-complete:hover {
  transform: none;
}

.chapter-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.page-turn {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.7rem;
  padding: 0.95rem 1.05rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.page-turn:hover {
  background: var(--paper);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.page-turn--next {
  justify-content: flex-end;
  text-align: right;
}

.page-turn__icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  color: var(--level-ink, var(--sunny-deep));
  background: var(--level-soft, var(--sunny-soft));
  border-radius: 9px;
}

.page-turn__icon .icon {
  width: 0.9rem;
  height: 0.9rem;
}

.page-turn__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.page-turn__copy small {
  color: var(--ink-muted);
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.page-turn__copy strong {
  overflow: hidden;
  margin-top: 0.1rem;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-turn--placeholder {
  visibility: hidden;
}

.reader-footer {
  padding: 1.7rem 0 1.1rem;
  background: #F7F1E5;
  border-top: 1px solid #EDE4D4;
}

.reader-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.reader-footer .brand__mark {
  width: 40px;
  height: 40px;
}

.reader-footer .brand__tagline {
  font-size: 0.57rem;
}

.reader-footer p {
  color: var(--ink-muted);
  font-size: 0.66rem;
  text-align: right;
}

.reader-footer a:not(.brand) {
  color: var(--ink-soft);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   12. Reader: line focus & celebrations
   -------------------------------------------------------------------------- */

.line-focus-mask {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: none;
  pointer-events: none;
}

.line-focus-on .line-focus-mask {
  display: block;
}

.line-focus-mask__shade {
  position: absolute;
  right: 0;
  left: 0;
  background: rgba(17, 25, 40, 0.72);
  transition: height 140ms ease, top 140ms ease;
}

.line-focus-mask__shade--top {
  top: 0;
  height: var(--focus-top, calc(50vh - 4.8rem));
}

.line-focus-mask__shade--bottom {
  top: calc(var(--focus-top, calc(50vh - 4.8rem)) + var(--focus-height, var(--focus-band-height)));
  bottom: 0;
}

.line-focus-mask__band {
  position: absolute;
  top: var(--focus-top, calc(50vh - 4.8rem));
  right: 0;
  left: 0;
  height: var(--focus-height, var(--focus-band-height));
  border-top: 1px solid rgba(255, 255, 255, 0.42);
  border-bottom: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 0 24px rgba(255, 226, 122, 0.08);
  transition: top 140ms ease, height 140ms ease;
}

.line-focus-mask__notch {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  background: var(--sunny);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 184, 0, 0.2);
  transform: translateY(-50%);
}

.line-focus-mask__notch--start {
  left: 0.65rem;
}

.line-focus-mask__notch--end {
  right: 0.65rem;
}

.celebration-layer {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  overflow: hidden;
  pointer-events: none;
}

.celebration-layer.is-active {
  display: block;
}

.star-pop {
  position: absolute;
  top: 42%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1.35rem 1.7rem;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid #F0D988;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform: translate(-50%, -50%);
  animation: star-card-pop 2700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.star-pop__icon {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  color: #B87900;
  background: var(--sunny-soft);
  border-radius: 21px;
  animation: star-badge-spin 800ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.star-pop__icon .icon {
  width: 2.1rem;
  height: 2.1rem;
  fill: var(--sunny);
  stroke: var(--sunny);
}

.star-pop strong {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.star-pop span:last-child {
  color: var(--ink-soft);
  font-size: 0.7rem;
}

@keyframes star-card-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.85);
  }
  10% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  84% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -55%) scale(0.98);
  }
}

@keyframes star-badge-spin {
  0% {
    transform: scale(0.4) rotate(-25deg);
  }
  65% {
    transform: scale(1.12) rotate(7deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

.confetti-piece {
  position: absolute;
  top: -1.5rem;
  left: var(--confetti-x, 50%);
  width: var(--confetti-size, 9px);
  height: calc(var(--confetti-size, 9px) * 1.6);
  background: var(--confetti-color, var(--sunny));
  border-radius: 2px;
  opacity: 0;
  transform: rotate(var(--confetti-rotate, 0));
  animation: confetti-fall var(--confetti-duration, 2.3s) var(--confetti-delay, 0s) cubic-bezier(0.26, 0.51, 0.45, 1) forwards;
}

.confetti-piece.is-round {
  height: var(--confetti-size, 9px);
  border-radius: 50%;
}

@keyframes confetti-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(var(--confetti-rotate, 0));
  }
  8% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--confetti-drift, 0), 105vh, 0) rotate(calc(var(--confetti-rotate, 0) + 620deg));
  }
}

/* --------------------------------------------------------------------------
   13. Responsive rules
   -------------------------------------------------------------------------- */

@media (max-width: 1160px) {
  .site-nav {
    gap: 0;
  }

  .site-nav a {
    padding-inline: 0.6rem;
    font-size: 0.8rem;
  }

  .hero h1 {
    font-size: clamp(2.8rem, 5vw, 4.3rem);
  }

  .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .reading-toolbar {
    gap: 0.35rem;
  }

  .toolbar-audio__status {
    max-width: 110px;
  }

  .tool-btn {
    padding-inline: 0.5rem;
  }
}

@media (max-width: 1060px) {
  .site-nav {
    display: none;
  }

  .star-pill {
    margin-left: auto;
  }

  .level-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .level-card {
    min-height: 245px;
  }

  .reader-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .chapter-sidebar {
    display: none;
  }

  .toolbar-audio__status {
    max-width: 150px;
  }

  .tool-btn--chapters {
    display: none;
  }
}

@media (max-width: 900px) {
  .hero {
    padding-top: 3rem;
  }

  .hero__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.8rem;
  }

  .hero__copy {
    max-width: 650px;
  }

  .hero h1 {
    max-width: 12ch;
    font-size: clamp(2.7rem, 7vw, 4rem);
  }

  .hero__lead {
    max-width: 52ch;
  }

  .hero__visual {
    width: min(100%, 620px);
    margin-inline: auto;
  }

  .hero-art-stat {
    left: 0.9rem;
  }

  .trail-card {
    flex-direction: column;
    gap: 1.2rem;
  }

  .trail-next {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 0.5rem;
  }

  .trail-next__eyebrow {
    flex-basis: 100%;
    margin-bottom: 0;
  }

  .trail-next__book {
    flex-basis: auto;
  }

  .trail-next__chapter {
    flex-basis: 100%;
    margin-bottom: 0.25rem;
  }

  .trail-next .btn {
    margin-left: auto;
  }

  .section-heading--split {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.8rem;
  }

  .section-heading__note {
    max-width: 50ch;
    padding-bottom: 0;
  }

  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grownups-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.3rem;
  }

  .grownups-copy h2 {
    max-width: 20ch;
  }

  .closing-cta__inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 1.3rem;
  }

  .closing-cta__inner h2 {
    max-width: 22ch;
  }

  .reading-toolbar {
    top: 0.65rem;
  }

  .toolbar-actions {
    margin-left: 0;
  }

  .tool-btn--chapters {
    display: inline-flex;
  }

  .reading-card {
    padding: clamp(1.25rem, 4vw, 2.25rem);
  }

  .story-page {
    min-height: 155px;
  }
}

@media (max-width: 720px) {
  :root {
    --gutter: 1.15rem;
    --section-space: clamp(3.4rem, 10vw, 5rem);
  }

  html {
    scroll-padding-top: 5.5rem;
  }

  .site-header__inner {
    min-height: 70px;
    gap: 0.8rem;
  }

  .brand__mark {
    width: 42px;
    height: 42px;
  }

  .brand__name {
    font-size: 1.18rem;
  }

  .brand__tagline {
    display: none;
  }

  .star-pill {
    min-height: 38px;
    padding: 0.35rem 0.65rem;
    font-size: 0.7rem;
  }

  .star-pill__word {
    display: none;
  }

  .hero {
    padding-top: 2.4rem;
  }

  .hero__doodle--one {
    left: auto;
    right: 5%;
  }

  .hero h1 {
    font-size: clamp(2.55rem, 10vw, 3.7rem);
    letter-spacing: -0.055em;
  }

  .hero__lead {
    font-size: 0.98rem;
    line-height: 1.7;
  }

  .hero__actions .btn {
    flex: 1 1 auto;
  }

  .hero__trust {
    gap: 0.7rem 0.95rem;
    font-size: 0.7rem;
  }

  .hero-art-card {
    padding: 0.8rem;
    border-radius: 26px;
  }

  .hero-art-card__pill {
    top: 0.9rem;
    left: 0.9rem;
    font-size: 0.58rem;
  }

  .hero-art-stat {
    bottom: 0.8rem;
    left: 0.7rem;
  }

  .trail-card {
    padding: 1.2rem;
    border-radius: 20px;
  }

  .trail-card__main {
    align-items: flex-start;
    gap: 0.9rem;
  }

  .trail-badge {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
    border-radius: 17px;
  }

  .trail-badge .icon {
    width: 1.45rem;
    height: 1.45rem;
  }

  .trail-badge__ring {
    inset: -5px;
    border-radius: 21px;
  }

  .trail-progress {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.45rem;
  }

  .trail-progress__track {
    width: 100%;
    flex: none;
  }

  .trail-next {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0.85rem;
  }

  .trail-next__eyebrow {
    grid-column: 1 / -1;
  }

  .trail-next__book {
    grid-column: 1;
  }

  .trail-next__chapter {
    grid-column: 1;
  }

  .trail-next .btn {
    grid-row: 2 / 4;
    grid-column: 2;
    align-self: center;
    margin-left: 0.5rem;
  }

  .section-heading h2 {
    font-size: clamp(1.8rem, 7vw, 2.6rem);
  }

  .level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .level-card {
    min-height: 245px;
  }

  .book-grid {
    gap: 0.85rem;
  }

  .book-card {
    padding: 0.48rem;
    border-radius: 20px;
  }

  .book-cover {
    border-radius: 16px;
  }

  .book-cover__title {
    padding: 0.4rem;
  }

  .book-cover__title h3 {
    font-size: 0.9rem;
  }

  .book-cover__title p {
    font-size: 0.52rem;
  }

  .book-info {
    padding: 0.7rem 0.28rem 0.2rem;
  }

  .book-info__topline {
    font-size: 0.55rem;
  }

  .book-info__blurb {
    font-size: 0.7rem;
  }

  .book-skills {
    display: none;
  }

  .book-actions {
    flex-direction: column;
  }

  .book-actions .btn {
    width: 100%;
  }

  .book-actions .btn--chapters {
    min-height: 38px;
  }

  .book-progress {
    padding: 0.5rem 0;
  }

  .book-progress__star {
    width: 15px;
    height: 15px;
  }

  .grownups-cards {
    gap: 0.65rem;
  }

  .tip-card {
    min-height: 0;
    padding: 1rem;
  }

  .tip-card h3 {
    font-size: 0.88rem;
  }

  .tip-card p {
    font-size: 0.7rem;
  }

  .tip-card:last-child {
    grid-column: 1 / -1;
    display: block;
  }

  .tip-card:last-child .tip-card__icon {
    margin-bottom: 0.65rem;
  }

  .tip-card:last-child p {
    margin-top: 0.3rem;
  }

  .site-footer__main {
    flex-direction: column;
    gap: 1.3rem;
  }

  .footer-nav {
    padding-top: 0;
  }

  .site-footer__bottom {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.4rem;
  }

  .dialog-cover {
    padding: 1.5rem 1.25rem;
  }

  .dialog-cover__emoji {
    width: 72px;
    height: 72px;
    flex-basis: 72px;
    border-radius: 20px;
    font-size: 2.3rem;
  }

  .dialog-cover h2 {
    font-size: 1.5rem;
  }

  .dialog-cover p {
    font-size: 0.74rem;
  }

  .dialog-body {
    padding: 1.1rem;
  }

  .dialog-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .reader-main {
    padding-top: 0.9rem;
  }

  .reader-topline {
    margin-bottom: 0.7rem;
  }

  .breadcrumbs {
    font-size: 0.66rem;
  }

  .breadcrumbs .icon {
    display: none;
  }

  .reading-toolbar {
    gap: 0.3rem;
    margin-bottom: 1rem;
    padding: 0.4rem;
    border-radius: 16px;
  }

  .toolbar-audio {
    width: 100%;
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .toolbar-audio__copy {
    flex: 1;
  }

  .toolbar-audio__status {
    max-width: none;
  }

  .toolbar-audio .speed-select {
    margin-left: auto;
  }

  .toolbar-divider {
    display: none;
  }

  .toolbar-tools {
    flex: 1 1 auto;
  }

  .toolbar-actions {
    margin-left: auto;
  }

  .toolbar-actions .tool-btn span {
    display: none;
  }

  .toolbar-actions .tool-btn {
    padding-inline: 0.55rem;
  }

  .font-picker .tool-btn span:not(.font-swatch) {
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chapter-hero {
    gap: 0.9rem;
    padding: 1rem;
    border-radius: 19px;
  }

  .chapter-hero__cover {
    width: 64px;
    height: 78px;
    border-radius: 15px;
    font-size: 1.8rem;
  }

  .chapter-hero:has(.chapter-cover) {
    align-items: flex-start;
  }

  .chapter-hero h1 {
    font-size: clamp(1.55rem, 6.4vw, 2rem);
  }

  .chapter-summary {
    font-size: 0.75rem;
  }

  .chapter-meta {
    gap: 0.55rem;
    margin-top: 0.55rem;
    font-size: 0.58rem;
  }

  .reading-card {
    padding: 1.1rem;
    border-radius: 19px;
  }

  .reading-card__topline {
    margin-bottom: 1.5rem;
  }

  .reading-hint {
    display: none;
  }

  .reading-guide {
    font-size: 0.62rem;
  }

  .chapter-body {
    font-size: var(--reader-font-size);
    line-height: 1.75;
  }

  .story-paragraph {
    max-width: none;
  }

  .story-page {
    min-height: 130px;
    padding: 2.05rem 1rem 1.15rem;
    border-radius: 16px;
  }

  .story-page .story-paragraph {
    font-size: calc(var(--reader-font-size) * 1.08);
    line-height: 1.65;
  }

  .completion-card {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem;
  }

  .completion-star {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    border-radius: 12px;
  }

  .completion-copy {
    flex: 1 1 calc(100% - 56px);
  }

  .complete-button {
    width: 100%;
  }

  .chapter-pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-turn--placeholder {
    display: none;
  }

  .reader-footer__inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.8rem;
  }

  .reader-footer p {
    text-align: left;
  }

  .star-pop {
    padding: 1.1rem 1.3rem;
  }

  .line-focus-mask__notch--start {
    left: 0.4rem;
  }

  .line-focus-mask__notch--end {
    right: 0.4rem;
  }
}

@media (max-width: 560px) {
  .hero h1 {
    max-width: none;
  }

  .hero__actions {
    flex-direction: column;
  }

  .hero__actions .btn {
    width: 100%;
  }

  .hero__visual {
    width: 100%;
  }

  .hero-art-card {
    border-radius: 22px;
  }

  .hero-art-stat {
    position: absolute;
    bottom: 0.6rem;
    left: 0.55rem;
    padding: 0.55rem 0.65rem;
  }

  .hero-art-stat__icon {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .hero-art-stat strong {
    font-size: 0.7rem;
  }

  .hero-art-stat small {
    font-size: 0.56rem;
  }

  .trail-card__main {
    flex-direction: column;
  }

  .trail-card h2 {
    font-size: 1.32rem;
  }

  .trail-next {
    grid-template-columns: minmax(0, 1fr);
  }

  .trail-next .btn {
    grid-row: auto;
    grid-column: 1;
    margin: 0.35rem 0 0;
  }

  .trail-next__book,
  .trail-next__chapter {
    white-space: normal;
  }

  .level-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .level-card {
    min-height: 0;
    padding: 1.1rem;
  }

  .level-card__description {
    -webkit-line-clamp: 4;
  }

  .level-card__footer {
    padding-top: 0.85rem;
  }

  .book-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .book-card {
    padding: 0.65rem;
  }

  .book-cover {
    aspect-ratio: 1.45 / 1;
  }

  .cover-emoji {
    width: 76px;
    height: 76px;
    font-size: 2.5rem;
  }

  .book-cover__title h3 {
    font-size: 1.08rem;
  }

  .book-cover__title p {
    font-size: 0.62rem;
  }

  .book-info {
    padding: 0.8rem 0.4rem 0.3rem;
  }

  .book-info__blurb {
    min-height: 0;
    font-size: 0.78rem;
  }

  .book-skills {
    display: flex;
  }

  .book-actions {
    flex-direction: row;
  }

  .book-actions .btn {
    width: auto;
  }

  .book-actions .btn--chapters {
    min-height: 44px;
  }

  .grownups-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .tip-card:last-child {
    grid-column: auto;
  }

  .closing-cta {
    padding-bottom: 3.5rem;
  }

  .closing-cta .btn {
    width: 100%;
  }

  .site-footer__bottom {
    font-size: 0.62rem;
  }

  .dialog-cover {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.8rem;
  }

  .dialog-cover__emoji {
    width: 62px;
    height: 62px;
    flex-basis: 62px;
    font-size: 2rem;
  }

  .dialog-body__heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }

  .dialog-chapter {
    padding: 0.65rem;
  }

  .dialog-chapter__copy small {
    display: none;
  }

  .dialog-chapter__status {
    display: none;
  }

  .toolbar-tools {
    width: 100%;
    flex-wrap: wrap;
  }

  .toolbar-actions {
    margin-left: auto;
  }

  .toolbar-audio {
    flex-wrap: wrap;
  }

  .toolbar-audio__copy {
    flex: 1 0 120px;
  }

  .toolbar-audio .speed-select {
    margin-left: 0;
  }

  .chapter-hero__cover {
    display: none;
  }

  .chapter-hero h1 {
    font-size: 1.6rem;
  }

  .chapter-hero {
    padding: 1rem;
  }

  .chapter-badge {
    font-size: 0.55rem;
  }

  .reading-card {
    padding: 0.9rem;
  }

  .reading-card__topline {
    padding-bottom: 0.7rem;
  }

  .reading-guide {
    font-size: 0.59rem;
  }

  .chapter-body {
    font-size: var(--reader-font-size);
  }

  .story-page {
    margin-bottom: 0.75rem;
    min-height: 116px;
    padding: 1.9rem 0.9rem 1rem;
  }

  .story-page__number {
    top: 0.6rem;
    left: 0.75rem;
  }

  .story-page::after {
    top: 0.6rem;
    right: 0.75rem;
  }

  .completion-card {
    padding: 0.9rem;
  }

  .completion-copy h2 {
    font-size: 0.9rem;
  }

  .page-turn {
    padding: 0.8rem;
  }

  .reader-topline .tool-btn span {
    display: none;
  }

  .reader-topline .tool-btn {
    padding-inline: 0.5rem;
  }

  .popover__menu {
    position: fixed;
    top: auto;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    width: auto;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
  }
}

@media (max-width: 390px) {
  .toolbar-audio__copy {
    display: none;
  }

  .sound-wave {
    display: none;
  }

  .toolbar-audio {
    gap: 0.35rem;
  }

  .toolbar-audio .speed-select select {
    max-width: 92px;
  }

  .toolbar-audio .voice-select select {
    max-width: 92px;
  }

  .toolbar-audio .audio-toggle {
    flex: 1;
    justify-content: center;
  }

  .size-stepper {
    order: 2;
  }

  .font-picker {
    order: 1;
  }

  #line-focus-toggle {
    order: 3;
  }

  .toolbar-tools {
    justify-content: space-between;
  }
}

/* --------------------------------------------------------------------------
   13b. Not-found page
   -------------------------------------------------------------------------- */

.site-header__404-home {
  flex: 0 0 auto;
  margin-left: auto;
}

.error-page {
  position: relative;
  overflow: hidden;
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(4rem, 8vw, 7rem);
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 184, 0, 0.17), transparent 30%),
    radial-gradient(circle at 92% 88%, rgba(6, 182, 212, 0.13), transparent 31%),
    var(--cream);
}

.error-page::before,
.error-page::after {
  position: absolute;
  width: 14rem;
  height: 14rem;
  border: 2px dashed rgba(255, 184, 0, 0.38);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.error-page::before {
  top: -8rem;
  right: -4rem;
}

.error-page::after {
  bottom: -9rem;
  left: -5rem;
  border-color: rgba(6, 182, 212, 0.28);
}

.error-card {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem);
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.error-art {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.35rem, 1.6vw, 0.85rem);
  margin-bottom: clamp(1.4rem, 3vw, 2rem);
}

.error-art__digit {
  color: var(--sunny);
  font-size: clamp(4.2rem, 12vw, 7.5rem);
  font-weight: 800;
  line-height: 0.85;
  letter-spacing: -0.09em;
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 4px 5px 0 rgba(30, 41, 59, 0.14);
}

.error-art__mark {
  display: grid;
  width: clamp(4.6rem, 11vw, 6.8rem);
  height: clamp(4.6rem, 11vw, 6.8rem);
  flex: 0 0 auto;
  place-items: center;
  background: var(--sunny-soft);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 4px 5px 0 rgba(30, 41, 59, 0.14);
  transform: rotate(-5deg);
}

.error-art__mark img {
  width: 72%;
  height: 72%;
}

.error-card .eyebrow {
  margin-bottom: 1rem;
}

.error-card h1 {
  max-width: 18ch;
  margin: 0 auto 1rem;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.error-card__copy {
  max-width: 54ch;
  margin: 0 auto 1.8rem;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.75;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}

.error-card__note {
  margin-top: 1.6rem;
  color: var(--ink-muted);
  font-size: 0.78rem;
}

@media (max-width: 720px) {
  .error-page {
    padding-top: 1.6rem;
  }

  .error-card {
    border-radius: var(--radius-lg);
  }

  .error-art__digit {
    -webkit-text-stroke-width: 2px;
    text-shadow: 3px 4px 0 rgba(30, 41, 59, 0.14);
  }

  .site-header__404-home {
    padding-inline: 0.65rem;
    font-size: 0.7rem;
  }
}

/* --------------------------------------------------------------------------
   14. Print styles
   -------------------------------------------------------------------------- */

@media print {
  @page {
    margin: 0.75in;
  }

  html,
  body {
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #000 !important;
    background: #FFF !important;
    font-family: "Lexend", "Arial", sans-serif !important;
    font-size: 16pt !important;
    line-height: 1.8 !important;
    -webkit-print-color-adjust: economy;
    print-color-adjust: economy;
  }

  body {
    overflow: visible !important;
  }

  .skip-link,
  .site-header,
  .site-footer,
  .reader-footer,
  .reader-topline,
  .reading-toolbar,
  .chapter-sidebar,
  .chapter-hero,
  .chapter-pager,
  .completion-zone,
  .reading-card__topline,
  .line-focus-mask,
  .celebration-layer,
  .book-dialog,
  .toast,
  .icon-sprite,
  .noscript-banner {
    display: none !important;
  }

  .container {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
  }

  .reader-main {
    margin: 0 !important;
    padding: 0 !important;
  }

  .reader-layout {
    display: block !important;
  }

  .reader-content {
    display: block !important;
    width: 100% !important;
  }

  .reading-card {
    margin: 0 !important;
    padding: 0 !important;
    background: #FFF !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .print-running-header {
    display: block !important;
    margin: 0 0 18pt;
    padding-bottom: 4pt;
    color: #000 !important;
    background: #FFF !important;
    border-bottom: 0.5pt solid #000;
    font-family: "Lexend", "Arial", sans-serif !important;
    font-size: 8.5pt !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
  }

  .chapter-body,
  .story-text,
  .story-paragraph,
  .story-page,
  .story-page .story-paragraph {
    max-width: none !important;
    width: 100% !important;
    margin: 0 0 0.55em !important;
    padding: 0 !important;
    color: #000 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    font-family: "Lexend", "Arial", sans-serif !important;
    font-size: 16pt !important;
    font-weight: 400 !important;
    line-height: 1.8 !important;
    letter-spacing: normal !important;
    text-wrap: wrap;
    break-inside: auto !important;
  }

  .chapter-body {
    margin: 0 !important;
  }

  .story-page {
    min-height: 0 !important;
  }

  .story-page::after,
  .story-page__number {
    display: none !important;
  }

  .story-paragraph + .story-paragraph {
    margin-top: 0.55em !important;
  }

  .word,
  .speaking-highlight {
    color: #000 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .print-book {
    display: none !important;
    color: #000 !important;
    background: #FFF !important;
  }

  body[data-print-mode="book"] .reader-layout,
  body[data-print-mode="book"] .print-running-header {
    display: none !important;
  }

  body[data-print-mode="book"] .print-book {
    display: block !important;
  }

  .print-chapter {
    break-inside: avoid-page;
    page-break-inside: avoid;
    break-after: page;
    page-break-after: always;
  }

  .print-chapter:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .print-chapter__header {
    display: block;
    margin-bottom: 0.45in;
    padding-bottom: 4pt;
    color: #000;
    border-bottom: 0.5pt solid #000;
    font-size: 8.5pt;
    font-weight: 500;
    line-height: 1.4;
  }

  .print-chapter__kicker {
    margin: 0 0 6pt;
    font-size: 9pt;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .print-chapter h2 {
    margin: 0 0 18pt;
    color: #000;
    font-size: 24pt;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: normal;
  }

  .print-chapter p {
    margin: 0 0 0.55em;
    color: #000;
    font-size: 16pt;
    line-height: 1.8;
    orphans: 3;
    widows: 3;
  }

  a {
    color: #000 !important;
    text-decoration: none !important;
  }
}

/* --------------------------------------------------------------------------
   15. Reduced-motion preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-illustration {
    animation: none;
  }

  .reading-toolbar.is-playing .sound-wave span {
    animation: none;
    transform: scaleY(1);
  }

  .confetti-piece {
    display: none;
  }

  .star-pop {
    animation: none;
    opacity: 1;
  }
}
