/* Home Schooling Kids — design system
   Idea: everything is cut paper. Flat colours, hard offset shadows (no blur),
   rounded type, big touch targets. Motion = paper physics: unfold, flip, pop. */

@font-face { font-family: "Fredoka"; src: url("../fonts/fredoka-latin-wght-normal.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-latin-wght-normal.woff2") format("woff2"); font-weight: 200 1000; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-latin-ext-wght-normal.woff2") format("woff2"); font-weight: 200 1000; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --sky: #dff1f7;
  --sky-2: #c4e5f0;
  --paper: #fffdf8;
  --ink: #1f2a44;
  --ink-2: #47526d;
  --meadow: #4fa36a;
  --meadow-d: #2b7449;
  --sun: #ffc94a;
  --sun-d: #e9a91a;
  --coral: #ff7a8a;
  --coral-d: #c93a50;
  --sea: #3b93bb;
  --night: #24345e;

  --cut: 0 5px 0 rgb(31 42 68 / .14);
  --cut-lg: 0 9px 0 rgb(31 42 68 / .13);
  --display: "Fredoka", "Nunito", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: min(1120px, 100% - 2 * var(--gut));
  --gut: clamp(18px, 4vw, 40px);
  --ease-paper: cubic-bezier(.2, .9, .25, 1.15);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--sky); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.08; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
.wrap { width: var(--wrap); margin-inline: auto; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.25em; height: 1.25em; flex: none; }

:focus-visible { outline: 3px solid var(--sea); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; text-decoration: none; font-weight: 700; }
.skip:focus { top: 12px; }

/* ---------- Buttons: paper tabs that press down ---------- */
.btn {
  --bg: var(--sun); --fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 52px; padding: .7em 1.35em; border: 0; border-radius: 16px;
  background: var(--bg); color: var(--fg); text-decoration: none; cursor: pointer;
  font: 600 1.1rem/1.1 var(--display); letter-spacing: .005em;
  box-shadow: 0 5px 0 rgb(31 42 68 / .22);
  transition: transform .12s ease, box-shadow .12s ease, background-color .2s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 rgb(31 42 68 / .22); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgb(31 42 68 / .22); }
.btn.ghost { --bg: var(--paper); }
.btn.ink { --bg: var(--ink); --fg: #fff; box-shadow: 0 5px 0 #0d1427; }
.btn.round { min-width: 56px; padding: 0; border-radius: 50%; aspect-ratio: 1; }
.btn[aria-pressed="true"] { --bg: var(--meadow-d); --fg: #fff; }

/* ---------- Header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(8px); backdrop-filter: saturate(1.4) blur(8px);
  box-shadow: 0 3px 0 rgb(31 42 68 / .08);
}
.site-head .wrap { display: flex; align-items: center; gap: 14px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.brand svg { width: 44px; height: 44px; }
.brand b { font: 650 1.12rem/1 var(--display); letter-spacing: -.01em; }
.brand b span { display: block; font-size: .8em; font-weight: 500; color: var(--ink-2); margin-top: 3px; }
.nav { display: none; gap: 4px; }
.nav a { text-decoration: none; font-weight: 700; padding: 10px 12px; border-radius: 12px; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--sky); }
.lang { display: inline-flex; background: var(--sky); border-radius: 12px; padding: 4px; gap: 2px; }
.lang button {
  min-width: 44px; min-height: 40px; border: 0; border-radius: 9px; background: transparent; cursor: pointer;
  font: 700 .95rem/1 var(--display);
}
.lang button[aria-pressed="true"] { background: var(--paper); box-shadow: 0 2px 0 rgb(31 42 68 / .14); }
.head-cta { display: none; }
@media (min-width: 860px) {
  .nav { display: flex; }
  .head-cta { display: inline-flex; min-height: 46px; font-size: 1rem; }
}

/* ---------- Hero: the pop-up book ---------- */
.hero { position: relative; overflow: clip; }
.hero-in {
  min-height: calc(100svh - 68px); display: grid; align-content: center; gap: clamp(18px, 4vh, 40px);
  padding-block: clamp(20px, 5vh, 56px) clamp(28px, 6vh, 64px);
}
.hero-copy { max-width: 34rem; }
.hero h1 { font-size: clamp(2rem, 6.4vw, 3.6rem); }
.hero .lead { margin-top: 16px; font-size: clamp(1.05rem, 2.6vw, 1.25rem); color: var(--ink-2); max-width: 30rem; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px 14px; margin-top: 24px; }
.hint { display: flex; align-items: center; gap: 8px; margin-top: 20px; font-weight: 700; color: var(--ink-2); font-size: .95rem; }
.hint i { width: 22px; height: 34px; border: 3px solid currentColor; border-radius: 12px; position: relative; flex: none; }
.hint i::after { content: ""; position: absolute; left: 50%; top: 6px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: currentColor; animation: wheel 1.6s ease-in-out infinite; }
@keyframes wheel { 0%, 100% { transform: translateY(0); opacity: 1 } 60% { transform: translateY(9px); opacity: 0 } }

.stage { position: relative; display: grid; place-items: center; perspective: 1400px; }
.hero-book {
  --w: min(62vw, 330px);
  position: relative; width: var(--w); aspect-ratio: 5 / 6;
  transform-style: preserve-3d;
}
.hb-board { position: absolute; inset: -8px -10px -10px -4px; background: var(--night); border-radius: 10px 14px 14px 10px; box-shadow: var(--cut-lg); }
.hb-edges { position: absolute; inset: 2px -6px 2px auto; width: 8px; background: repeating-linear-gradient(90deg, #e9e2d3 0 2px, #fffdf8 2px 4px); border-radius: 0 4px 4px 0; }
.hb-page {
  position: absolute; inset: 0; border-radius: 4px 8px 8px 4px; overflow: hidden;
  background: linear-gradient(#fff5d6, #ffe9b8 70%);
  perspective: 700px; perspective-origin: 50% 20%;
  transform-style: preserve-3d;
}
.hb-page::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 18px; background: linear-gradient(90deg, rgb(31 42 68 / .16), transparent); pointer-events: none; }
.pop { position: absolute; inset: 0; width: 100%; height: 100%; transform-origin: 50% 100%; backface-visibility: hidden; will-change: transform; }
.pop svg { width: 100%; height: 100%; }
.hb-cover {
  position: absolute; inset: 0; transform-origin: 0 50%; transform-style: preserve-3d; will-change: transform;
}
.hb-face { position: absolute; inset: 0; border-radius: 4px 10px 10px 4px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.hb-front { background: var(--sea); color: #fff; box-shadow: inset 10px 0 0 rgb(0 0 0 / .1); }
.hb-front svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hb-front h2 { position: absolute; left: 9%; right: 9%; top: 9%; font-size: calc(var(--w) * .118); line-height: 1.02; color: #fff; text-shadow: 0 3px 0 rgb(0 0 0 / .18); }
.hb-front small { position: absolute; left: 9%; bottom: 7%; font: 650 calc(var(--w) * .045)/1 var(--display); background: var(--paper); color: var(--ink); padding: .5em .8em; border-radius: 99px; }
.hb-back { transform: rotateY(180deg); background: #f4ecdb; display: grid; place-items: center; padding: 14%; }
.hb-back p { font: 500 calc(var(--w) * .062)/1.3 var(--display); color: var(--ink-2); text-align: center; border-bottom: 3px dashed #cdbf9f; padding-bottom: 10px; }

.bubble {
  position: absolute; left: 20%; bottom: 45%; z-index: 5;
  background: var(--paper); color: var(--ink); font: 600 clamp(.9rem, 2.4vw, 1.05rem)/1.25 var(--display);
  padding: 10px 14px; border-radius: 16px; box-shadow: var(--cut); max-width: 13rem;
  opacity: 0; transform-origin: 10% 100%;
}
.bubble::after { content: ""; position: absolute; left: 18px; bottom: -10px; border: 10px solid transparent; border-top-color: var(--paper); border-bottom: 0; }

@media (min-width: 860px) {
  .hero-in { grid-template-columns: 1.05fr .95fr; align-items: center; }
  .hero-book { --w: min(32vw, 420px); }
}

/* ---------- Sections ---------- */
.section { padding-block: clamp(64px, 11vw, 128px); position: relative; }
.section h2 { font-size: clamp(1.8rem, 4.8vw, 2.8rem); }
.section .sub { margin-top: 12px; color: var(--ink-2); font-size: 1.12rem; max-width: 36rem; }
.paper { background: var(--paper); }
.torn-top::before {
  content: ""; position: absolute; left: 0; right: 0; top: -22px; height: 24px; background: inherit;
  -webkit-mask: radial-gradient(14px 12px at 14px 100%, #000 98%, transparent) 0 0 / 28px 24px repeat-x;
          mask: radial-gradient(14px 12px at 14px 100%, #000 98%, transparent) 0 0 / 28px 24px repeat-x;
}
.sec-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 32px; }
.link-more { font-weight: 800; color: var(--meadow-d); text-decoration-thickness: 2px; text-underline-offset: 4px; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }

/* ---------- Shelf (home) ---------- */
.shelf {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(46vw, 220px); gap: clamp(16px, 3vw, 32px);
  overflow-x: auto; scroll-snap-type: x mandatory; padding: 28px var(--gut) 34px; margin-inline: calc(-1 * var(--gut));
  overscroll-behavior-x: contain; scrollbar-width: none; scroll-padding-inline: var(--gut);
}
.shelf::-webkit-scrollbar { display: none; }
@media (min-width: 860px) { .shelf { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); grid-auto-columns: auto; overflow: visible; padding-inline: 0; margin-inline: 0; } }
.book-card { scroll-snap-align: start; text-decoration: none; display: block; perspective: 900px; }
.book-3d {
  position: relative; aspect-ratio: 1; border-radius: 3px 8px 8px 3px; transform-style: preserve-3d;
  transition: transform .45s var(--ease-paper); box-shadow: var(--cut-lg); background: #ddd;
}
.book-3d img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.book-3d::before { /* spine fold */
  content: ""; position: absolute; inset: 0 auto 0 0; width: 12px; z-index: 1; border-radius: 3px 0 0 3px;
  background: linear-gradient(90deg, rgb(0 0 0 / .22), rgb(255 255 255 / .18) 55%, transparent);
}
.book-card:hover .book-3d, .book-card:focus-visible .book-3d { transform: rotateY(-16deg) translateY(-4px); }
.book-card:active .book-3d { transform: rotateY(-8deg) translateY(2px) scale(.98); }
.book-card h3 { font-size: 1.15rem; margin-top: 16px; }
.book-card p { font-size: .95rem; color: var(--ink-2); margin-top: 4px; font-weight: 700; }
.tag-demo { position: absolute; top: 8px; right: 8px; z-index: 2; background: var(--paper); font: 700 .75rem/1 var(--body); padding: 5px 8px; border-radius: 99px; }

/* ---------- How it works ---------- */
.how-grid { display: grid; gap: 40px; margin-top: 44px; }
@media (min-width: 900px) { .how-grid { grid-template-columns: 1fr 1fr; align-items: center; gap: 64px; } }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 30px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 56px 1fr; gap: 16px; counter-increment: s; }
.steps li::before {
  content: counter(s); display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px;
  font: 650 1.6rem/1 var(--display); background: var(--sun); box-shadow: var(--cut);
}
.steps li:nth-child(2)::before { background: var(--coral); color: #fff; }
.steps li:nth-child(3)::before { background: var(--meadow); color: #fff; }
.steps h3 { font-size: 1.35rem; }
.steps p { color: var(--ink-2); margin-top: 6px; }
.steps .btn { margin-top: 14px; min-height: 48px; font-size: 1rem; }
.mini-wrap { position: relative; display: grid; place-items: center; padding: 18px 0 8px; }
.mini-book { width: min(78vw, 560px); position: relative; }
.mini-book .pg { border-radius: 2px; }
.mini-try { display: flex; align-items: center; gap: 8px; margin-top: 18px; font-weight: 800; color: var(--coral-d); }
.mini-try .icon { animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0) rotate(0) } 50% { transform: translateX(-8px) rotate(-14deg) } }

/* ---------- Parents ---------- */
.parents-grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .parents-grid { grid-template-columns: .9fr 1.1fr; gap: 72px; } }
.trust { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 18px; }
.trust li { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; font-size: 1.08rem; }
.trust .icon { width: 44px; height: 44px; padding: 10px; border-radius: 14px; background: var(--sky); color: var(--sea); }
.trust li:nth-child(2) .icon { color: var(--coral-d); background: #ffe6e9; }
.trust li:nth-child(3) .icon { color: var(--meadow-d); background: #e2f3e6; }
.trust li:nth-child(4) .icon { color: var(--night); background: #e6e9f6; }
.trust li:nth-child(5) .icon { color: #9a6a00; background: #fff1cc; }
.trust p { padding-top: 9px; }
.parents-art { max-width: 460px; justify-self: center; width: 100%; }

/* ---------- Verse (type moment) ---------- */
.verse { background: var(--night); color: #fff; text-align: center; overflow: clip; }
.verse blockquote { margin: 0; }
.verse .words { font: 650 clamp(2.6rem, 11vw, 7rem)/1 var(--display); letter-spacing: -.02em; display: flex; flex-wrap: wrap; justify-content: center; gap: .05em .28em; }
.verse .w { display: inline-block; padding: .08em .22em .14em; border-radius: .18em; background: var(--paper); color: var(--ink); box-shadow: 0 .09em 0 rgb(0 0 0 / .3); }
.verse .w:nth-child(2) { background: var(--sun); }
.verse .w:nth-child(3) { background: var(--coral); color: #fff; }
.verse .w:nth-child(4) { background: var(--meadow); color: #fff; }
.verse cite { display: block; margin-top: 28px; font: 600 1.2rem/1 var(--display); font-style: normal; opacity: .85; }
.verse .note { max-width: 34rem; margin: 18px auto 0; opacity: .8; }
.verse .stars { position: absolute; inset: 0; pointer-events: none; opacity: .9; }

/* ---------- Install ---------- */
.install { display: grid; gap: 28px; align-items: center; }
@media (min-width: 860px) { .install { grid-template-columns: 1fr auto; } }
.install .msg { margin-top: 14px; font-weight: 700; color: var(--meadow-d); }

/* ---------- Footer ---------- */
.site-foot { background: var(--ink); color: #dfe5f3; padding-block: 48px 64px; font-size: .98rem; }
.site-foot .wrap { display: grid; gap: 18px; }
.site-foot a { color: #fff; font-weight: 700; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.site-foot .demo { opacity: .75; font-size: .9rem; }

/* ---------- Library ---------- */
.lib-head { padding-block: clamp(36px, 7vw, 72px) 8px; }
.lib-head h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); }
.lib-tools { display: grid; gap: 14px; margin-top: 26px; }
.search { position: relative; max-width: 30rem; }
.search .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-2); }
.search input {
  width: 100%; min-height: 56px; padding: 0 18px 0 50px; border: 3px solid transparent; border-radius: 16px;
  background: var(--paper); box-shadow: var(--cut); font: 600 1.08rem var(--body); color: var(--ink);
}
.search input:focus { outline: none; border-color: var(--sea); }
.chips { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 46px; padding: 0 18px; border-radius: 99px; border: 0; cursor: pointer;
  background: var(--paper); box-shadow: 0 3px 0 rgb(31 42 68 / .12); font: 600 1rem/1 var(--display);
  transition: transform .12s, background-color .2s;
}
.chip:active { transform: translateY(2px); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.lib-count { color: var(--ink-2); font-weight: 700; margin-top: 4px; }
.lib-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 34px 20px; padding-block: 26px 90px; }
@media (min-width: 700px) { .lib-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .lib-grid { grid-template-columns: repeat(4, 1fr); gap: 44px 32px; } }
.lib-grid .book-card { animation: rise .5s var(--ease-paper) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) rotate(-2deg); } }
.empty { padding: 40px 0; font-size: 1.1rem; font-weight: 700; color: var(--ink-2); }

/* ---------- Book page ---------- */
.bk { display: grid; grid-template-columns: minmax(0, 1fr); gap: 34px; padding-block: 28px 80px; }
.bk > * { min-width: 0; }
@media (min-width: 900px) { .bk { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 64px; align-items: start; padding-top: 48px; } }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; text-decoration: none; min-height: 44px; margin-top: 12px; }
.bk-cover { perspective: 1200px; max-width: min(480px, 86%); width: 100%; justify-self: center; }
.bk-cover .book-3d { transform: rotateY(-10deg) rotateX(3deg); }
.bk h1 { font-size: clamp(2.1rem, 6vw, 3.3rem); }
.bk .series { font-weight: 800; color: var(--sea); margin-bottom: 10px; }
.bk .summary { margin-top: 16px; font-size: 1.15rem; color: var(--ink-2); max-width: 34rem; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 26px 0 0; padding: 0; }
@media (min-width: 560px) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.facts div { background: var(--paper); border-radius: 14px; padding: 12px 14px; box-shadow: 0 3px 0 rgb(31 42 68 / .08); }
.facts dt { font-size: .85rem; font-weight: 700; color: var(--ink-2); }
.facts dd { margin: 2px 0 0; font: 600 1.1rem/1.2 var(--display); }
.bk .actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }
.preview { margin-top: 40px; }
.preview h2, .more h2 { font-size: 1.4rem; }
.preview-strip { display: flex; gap: 14px; overflow-x: auto; padding: 16px 2px 14px; scrollbar-width: thin; }
.preview-strip button { flex: none; width: 130px; padding: 0; border: 0; border-radius: 6px; background: none; cursor: pointer; box-shadow: var(--cut); overflow: hidden; transition: transform .2s var(--ease-paper); }
.preview-strip button:hover { transform: translateY(-3px) rotate(-1deg); }
.preview-strip img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.more { margin-top: 30px; }
.more .shelf { padding-top: 16px; }
@media (min-width: 860px) { .more .shelf { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Reader ---------- */
.reader-body { background: var(--night); color: #fff; height: 100svh; overflow: hidden; overscroll-behavior: none; }
.reader { height: 100svh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
.r-top { display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) var(--gut) 8px; }
.r-top h1 { flex: 1; min-width: 0; font-size: clamp(1rem, 3.6vw, 1.3rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.r-top .btn { min-height: 46px; font-size: .95rem; box-shadow: 0 4px 0 #0d1427; }
.r-top .btn.round { min-width: 46px; }
.r-top .lang { background: rgb(255 255 255 / .12); }
.r-top .lang button { color: #fff; }
.r-top .lang button[aria-pressed="true"] { background: #fff; color: var(--ink); }
.r-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 6px var(--gut); }
.r-book { position: relative; }
.r-book .stf__parent { margin: 0 auto; }
.r-mark {
  position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; opacity: .11;
  background-image: var(--wm); background-size: 380px 170px;
}
.r-loading { position: absolute; inset: 0; display: grid; place-items: center; font: 600 1.2rem var(--display); }
.r-bottom { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px var(--gut) max(14px, env(safe-area-inset-bottom)); }
.r-mid { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.r-mid .row { display: flex; gap: 8px; justify-content: center; }
.r-bottom .btn.round { min-width: 64px; }
.r-bottom .btn.round .icon { width: 30px; height: 30px; }
.r-bottom .btn.ghost { --bg: rgb(255 255 255 / .14); --fg: #fff; box-shadow: 0 4px 0 #0d1427; }
.r-bottom .btn.ghost[aria-pressed="true"] { --bg: var(--meadow-d); }
.r-listen { min-width: 9.5rem; }
.r-progress { width: min(100%, 340px); height: 8px; border-radius: 9px; background: rgb(255 255 255 / .16); overflow: hidden; }
.r-progress i { display: block; height: 100%; width: 0; background: var(--sun); border-radius: inherit; transition: width .45s var(--ease-paper); }
.r-count { font: 600 .95rem/1 var(--display); opacity: .85; }
.r-end {
  position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; text-align: center; padding: 24px;
  background: rgb(36 52 94 / .86); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.r-end[hidden] { display: none; }
.r-end h2 { font-size: clamp(1.8rem, 6vw, 2.6rem); margin-top: 8px; }
.r-end .row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.r-end svg.lamb { width: 160px; margin: 0 auto; }
.r-toast { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: var(--paper); color: var(--ink); font-weight: 700; padding: 10px 16px; border-radius: 12px; box-shadow: var(--cut); z-index: 30; max-width: 90%; text-align: center; }
@media (max-width: 560px) {
  .r-top { gap: 8px; }
  .r-top .t-close { min-width: 46px; padding: 0; border-radius: 50%; aspect-ratio: 1; }
  .r-top .t-close span, #autoBtn .lbl { display: none; }
  .r-top .lang button { min-width: 38px; }
  .r-bottom { gap: 8px; }
  .r-bottom .btn.round { min-width: 54px; }
  .r-listen { min-width: 0; padding-inline: 1em; }
  #autoBtn { min-width: 50px; padding: 0 .8em; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .r-progress, .r-count { display: none; }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .hint { display: none; }
}

/* Mobile hero: text + book must fit one screen while the hero is pinned */
@media (max-width: 859px) {
  .hero-in { gap: 18px; padding-block: 18px 22px; align-content: start; }
  .hero h1 { font-size: clamp(1.6rem, 7.2vw, 2.4rem); }
  .hero .lead { margin-top: 10px; font-size: 1rem; line-height: 1.5; }
  .hero .actions { margin-top: 16px; }
  .hero .actions .ghost, .hint { display: none; }
  .hero-book { --w: min(76vw, 340px, calc((100svh - 68px - 330px) * .83)); }
  .stage { padding-top: 6px; }
}
@media (max-width: 859px) and (max-height: 640px) {
  .hero .lead { display: none; }
  .hero-book { --w: min(56vw, 260px, calc((100svh - 68px - 230px) * .83)); }
}

/* Reader pages (HTML mode of the flip library: crisp on retina screens) */
.r-book { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pg { background: #fffdf8; overflow: hidden; }
.pg-img { position: absolute; inset: 0; background: center / cover no-repeat; }
.pg.--hard, .pg[data-density="hard"] { background: #e9e2d3; }
.r-mid .btn { min-height: 50px; }
