/* Bookahoo — mobile-first. Phones get the simplest layout; tablets (≥700px) and desktops (≥1024px)
   progressively add columns, a side rail and split-screen reading. */

:root {
  --bg: #FFF6E9; --bg2: #FFEEDB; --ink: #2B2340; --card: #FFFFFF; --line: rgba(43,35,64,.08);
  --accent: #FF6B6B; --accent-ink: #fff; --accent2: #4D96FF; --gold: #FFC857; --ok: #2BB673; --bad: #E5484D;
  --muted: #7A7290; --glow: rgba(255,107,107,.28); --hl: #FFE48A; --shadow: 0 6px 20px rgba(43,35,64,.10);
  --r: 20px; --r-sm: 14px;
  --ease-out: cubic-bezier(.23, 1, .32, 1); --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-sheet: cubic-bezier(.32, .72, 0, 1);
  --rail: 0px; --tabbar: calc(68px + env(safe-area-inset-bottom, 0px));
  color-scheme: light;
}
.bedtime {
  --bg: #141233; --bg2: #1B1844; --ink: #F3EEFF; --card: #221F4A; --line: rgba(255,255,255,.08);
  --accent: #FFC857; --accent-ink: #221F4A; --accent2: #9D8CFF; --muted: #A59FCF;
  --glow: rgba(255,200,87,.25); --hl: #4A3F8F; --shadow: 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior: none;
  background: var(--bg); color: var(--ink); transition: background .6s var(--ease-out), color .6s var(--ease-out);
}
body { margin: 0; min-height: 100dvh; font-family: Fredoka, ui-rounded, system-ui, sans-serif; font-size: 17px; line-height: 1.45; }
.bedtime body { background-image:
  radial-gradient(1.2px 1.2px at 12% 18%, #fff9, transparent), radial-gradient(1px 1px at 68% 8%, #fff8, transparent),
  radial-gradient(1.4px 1.4px at 85% 34%, #fffa, transparent), radial-gradient(1px 1px at 35% 62%, #fff7, transparent),
  radial-gradient(1.2px 1.2px at 52% 88%, #fff8, transparent), radial-gradient(1px 1px at 92% 75%, #fff6, transparent);
  background-attachment: fixed; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
a { color: var(--accent2); }
input, textarea, select { font: inherit; font-size: 16px; color: inherit; }
button, a, [role="button"], .tab, .chip, label.check {
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
:focus-visible { outline: 3px solid var(--accent2); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- shell */
#view { padding: 0 16px calc(var(--tabbar) + 24px); max-width: 1180px; margin: 0 auto; min-height: 100dvh; }
#view.bare { padding-bottom: 32px; }
.view-enter { animation: viewIn .32s var(--ease-out) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }

.topbar { display: flex; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top, 0px)) 0 10px; }
.topbar h1 { font-size: 26px; flex: 1; }
.brand { font-weight: 700; font-size: 22px; display: flex; gap: 8px; align-items: center; text-decoration: none; color: var(--ink); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line);
  transition: transform .35s var(--ease-out);
}
.tabbar.hidden { transform: translateY(110%); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; padding: 4px 8px; border-radius: 14px;
  color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; transition: color .2s, transform .16s var(--ease-out); }
.tab .ico { font-size: 24px; line-height: 1; transition: transform .3s var(--ease-spring); }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"] .ico { transform: translateY(-2px) scale(1.12); }
.tab:active { transform: scale(.92); }

/* ---------------------------------------------------------------- building blocks */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px;
  border-radius: 16px; font-weight: 600; font-size: 18px; background: var(--card); box-shadow: 0 3px 0 var(--line);
  transition: transform .14s var(--ease-out), box-shadow .14s, background .2s, opacity .2s; text-decoration: none; color: var(--ink); }
.btn:active { transform: scale(.97) translateY(1px); box-shadow: 0 1px 0 var(--line); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px var(--glow); }
.btn.blue { background: var(--accent2); color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; font-size: 15px; padding: 0 14px; border-radius: 12px; }
.btn[disabled], .btn.busy { opacity: .6; pointer-events: none; }
.btn.busy::after { content: ""; width: 16px; height: 16px; border: 2.5px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row-h { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--bg2); color: var(--ink); }
.pill.gold { background: var(--gold); color: #2B2340; }
.pill.blue { background: var(--accent2); color: #fff; }
.pill.ok { background: var(--ok); color: #fff; }

/* forms */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.input { width: 100%; min-height: 52px; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--card); transition: border-color .2s, box-shadow .2s; }
.input:focus { outline: none; border-color: var(--accent2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent2) 20%, transparent); }
.field.invalid .input { border-color: var(--bad); animation: shake .35s var(--ease-out); }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.field.invalid .hint { color: var(--bad); }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 8px; top: 8px; height: 36px; padding: 0 10px; border-radius: 10px; color: var(--muted); font-size: 14px; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; width: 0; border-radius: 3px; transition: width .3s var(--ease-out), background .3s; }
label.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; margin: 6px 0 16px; cursor: pointer; }
label.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin-top: 1px; }
.form-error { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); padding: 12px 14px;
  border-radius: 12px; margin-bottom: 14px; font-size: 15px; animation: viewIn .25s var(--ease-out); }
.form-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; }

/* auth screens */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top, 0px)) 0 24px; }
.auth .card { width: 100%; max-width: 440px; padding: 26px 22px; }
.auth h1 { font-size: 28px; margin: 6px 0 4px; }
.auth .sub { color: var(--muted); margin: 0 0 20px; }
.auth .alt { text-align: center; margin-top: 16px; font-size: 15px; color: var(--muted); }
.auth .mascot { font-size: 44px; display: inline-block; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-4deg); } }

/* ---------------------------------------------------------------- landing */
.hero { min-height: 100svh; display: grid; align-content: center; gap: 22px; padding: calc(28px + env(safe-area-inset-top, 0px)) 0 32px; text-align: center; }
.hero h1 { font-size: clamp(34px, 8vw, 64px); letter-spacing: -.5px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { font-size: 19px; color: var(--muted); max-width: 560px; margin: 0 auto; }
.hero .ctas { display: grid; gap: 10px; max-width: 360px; width: 100%; margin: 0 auto; }
.floaters { position: relative; height: 150px; }
.floaters span { position: absolute; font-size: 56px; animation: float 6s ease-in-out infinite; animation-delay: calc(var(--i) * -1.2s); }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-14px) rotate(6deg); } }
.quote { margin: 4px auto 34px; max-width: 640px; text-align: center; padding: 26px 22px; border-radius: var(--r);
  background: var(--card); box-shadow: var(--shadow); position: relative; animation: rise .6s var(--ease-out) both; }
.quote::before { content: "📖"; position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 34px; }
.quote blockquote { margin: 6px 0 10px; font-size: clamp(22px, 5vw, 30px); font-weight: 600; line-height: 1.3; color: var(--accent); }
.quote figcaption { color: var(--muted); font-size: 15px; }
.features { display: grid; gap: 14px; margin: 10px 0 30px; }
.features .card h3 { font-size: 20px; margin: 6px 0; }
.features .emoji { font-size: 34px; }
.footer { text-align: center; color: var(--muted); font-size: 14px; padding: 30px 0 calc(30px + env(safe-area-inset-bottom, 0px)); }
.footer a { color: var(--muted); margin: 0 8px; }

/* ---------------------------------------------------------------- profiles */
.who { min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 26px; padding: 30px 0; text-align: center; }
.who h1 { font-size: 30px; }
.avatars { display: grid; grid-template-columns: repeat(2, 132px); gap: 18px; }
.avatar-tile { display: grid; justify-items: center; gap: 8px; font-weight: 600; font-size: 18px; animation: pop .45s var(--ease-spring) both;
  animation-delay: calc(var(--i) * 70ms); position: relative; }
.avatar-tile .face { width: 120px; height: 120px; border-radius: 34px; display: grid; place-items: center; font-size: 64px;
  background: var(--card); box-shadow: var(--shadow); transition: transform .16s var(--ease-out); }
.avatar-tile:active .face { transform: scale(.94); }
.avatar-tile .edit { position: absolute; top: -6px; right: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--accent2); color: #fff;
  display: grid; place-items: center; font-size: 16px; animation: pop .3s var(--ease-spring); }
.avatar-tile .lock-badge { position: absolute; top: 88px; right: 2px; width: 34px; height: 34px; border-radius: 50%; background: var(--card);
  box-shadow: var(--shadow); display: grid; place-items: center; font-size: 16px; }
@media (min-width: 700px) { .avatar-tile .lock-badge { top: 106px; } }
.avatar-tile.add .face { border: 3px dashed var(--muted); background: transparent; box-shadow: none; font-size: 44px; color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
.avatar-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
.avatar-pick button { font-size: 32px; height: 58px; border-radius: 16px; background: var(--bg2); transition: transform .2s var(--ease-spring), background .2s; }
.avatar-pick button[aria-pressed="true"] { background: var(--accent); transform: scale(1.08); }

/* ---------------------------------------------------------------- home */
.greet { display: flex; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top, 0px)) 0 6px; }
.greet .me { width: 48px; height: 48px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); font-size: 28px; display: grid; place-items: center; }
.greet h1 { font-size: 24px; flex: 1; }
.mood { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border-radius: 18px; padding: 5px;
  box-shadow: var(--shadow); margin: 12px 0 6px; }
.mood button { position: relative; z-index: 1; min-height: 46px; border-radius: 14px; font-weight: 600; font-size: 17px; transition: color .3s; }
.mood .thumb { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); border-radius: 14px; background: var(--accent);
  box-shadow: 0 6px 18px var(--glow); transition: transform .45s var(--ease-spring), background .4s; }
.bedtime .mood .thumb { transform: translateX(100%); }
.mood button[aria-pressed="true"] { color: var(--accent-ink); }
.books-tabs { max-width: 420px; }
.bedtime .books-tabs .thumb { transform: none; }
.books-tabs.second .thumb, .bedtime .books-tabs.second .thumb { transform: translateX(100%); }
.save-btn { border: 2px solid var(--line); }
.save-btn.saved { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.book .saved-dot { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.55);
  color: #fff; display: grid; place-items: center; font-size: 13px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 9px 15px; border-radius: 999px; background: var(--card); font-size: 15px; font-weight: 600; box-shadow: 0 2px 0 var(--line);
  transition: background .2s, color .2s, transform .14s var(--ease-out); }
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"] { background: var(--accent2); color: #fff; }

.banner { display: flex; gap: 12px; align-items: center; border-radius: var(--r); padding: 14px 16px; margin: 12px 0;
  background: linear-gradient(120deg, var(--accent2), var(--accent)); color: #fff; animation: viewIn .4s var(--ease-out) both; }
.banner.soft { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.banner .emoji { font-size: 30px; }
.banner b { display: block; }
.banner .btn { margin-left: auto; flex: none; }

.shelf { margin-top: 22px; }
.shelf-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.shelf-head h2 { font-size: 21px; }
.row { display: grid; grid-auto-flow: column; grid-auto-columns: 138px; gap: 14px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; padding: 4px 16px 14px; margin: 0 -16px; scroll-padding: 16px; scrollbar-width: none; }
.row::-webkit-scrollbar { display: none; }
.book { position: relative; text-align: left; scroll-snap-align: start; animation: rise .5s var(--ease-out) both;
  animation-delay: calc(min(var(--i), 8) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.book .cover { position: relative; aspect-ratio: 5 / 8; border-radius: 16px; overflow: hidden; background: var(--bg2); box-shadow: var(--shadow);
  transition: transform .18s var(--ease-out), box-shadow .25s; }
.book .cover img { width: 100%; height: 100%; object-fit: cover; }
.book:active .cover { transform: scale(.96); }
.book .title { font-weight: 600; font-size: 15px; line-height: 1.2; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.book .lock { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(transparent 40%, rgba(20,18,51,.75));
  color: #fff; font-size: 13px; font-weight: 700; align-content: end; padding: 12px; text-align: center; }
.book .lock span { background: rgba(0,0,0,.45); border-radius: 999px; padding: 4px 10px; }
.book .tag { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 11.5px; padding: 3px 8px; border-radius: 999px; }
.book .bar { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.4); overflow: hidden; }
.book .bar i { display: block; height: 100%; background: var(--gold); }
.book.wide { grid-column: span 2; }
.book.add .cover { border: 3px dashed var(--muted); background: transparent; box-shadow: none; display: grid; place-items: center; text-align: center; color: var(--muted); font-weight: 600; }
.book.add .cover b { font-size: 42px; display: block; }
.gen { width: 100%; height: 100%; display: grid; place-items: center; text-align: center; padding: 12px; font-weight: 700; font-size: 18px; color: #fff;
  background: linear-gradient(160deg, var(--accent2), var(--accent)); }
.movie .cover { aspect-ratio: 16 / 10; }
.movie .play-badge { position: absolute; inset: 0; display: grid; place-items: center; }
.movie .play-badge i { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.92); display: grid; place-items: center;
  font-style: normal; color: #2B2340; font-size: 22px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.row.movies { grid-auto-columns: 240px; }
.continue { display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow);
  text-align: left; width: 100%; transition: transform .16s var(--ease-out); animation: rise .45s var(--ease-out) both; }
.continue:active { transform: scale(.98); }
.continue img, .continue .gen { width: 64px; height: 100px; border-radius: 12px; object-fit: cover; flex: none; }
.continue .play { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 22px; flex: none; }
.empty { color: var(--muted); padding: 10px 0; }
.skeleton { background: linear-gradient(90deg, var(--bg2) 25%, color-mix(in srgb, var(--bg2) 60%, var(--card)) 50%, var(--bg2) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 16px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- sheets & modals */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.sheet .scrim { position: absolute; inset: 0; background: rgba(10,8,30,.5); opacity: 0; transition: opacity .35s var(--ease-out); }
.sheet .panel { position: relative; width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 28px 28px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateY(105%); transition: transform .45s var(--ease-sheet); box-shadow: 0 -10px 40px rgba(0,0,0,.2); }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 14px; }
.sheet.open { pointer-events: auto; }
.sheet.open .scrim { opacity: 1; }
.sheet.open .panel { transform: none; }
.sheet .close-x { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border-radius: 50%; background: var(--card); font-size: 18px; }
.detail-head { display: flex; gap: 16px; margin-bottom: 14px; }
.detail-head .c { width: 120px; flex: none; aspect-ratio: 5/8; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.detail-head .c img { width: 100%; height: 100%; object-fit: cover; }
.detail-head h2 { font-size: 23px; margin: 4px 0; }
.chapters { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 6px; }
.chapters button { width: 100%; text-align: left; background: var(--card); padding: 12px 14px; border-radius: 12px; font-size: 16px; display: flex; gap: 10px; }
.chapters button .n { color: var(--muted); width: 26px; }
.note { background: var(--card); border-radius: 14px; padding: 10px 14px; font-size: 14.5px; color: var(--muted); margin: 8px 0; }
.note b { color: var(--ink); }
.btn-col { display: grid; gap: 10px; margin-top: 16px; }

.toasts { position: fixed; z-index: 60; left: 0; right: 0; top: calc(10px + env(safe-area-inset-top, 0px)); display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: toastIn .4s var(--ease-spring) both; max-width: calc(100% - 32px); }
.toast.out { animation: toastOut .25s var(--ease-out) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px); } }

/* ---------------------------------------------------------------- reader */
#reader { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; height: 100dvh;
  transform: translateY(100%); transition: transform .45s var(--ease-sheet); visibility: hidden; }
#reader.open { transform: none; visibility: visible; }
.r-top { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 8px; }
.r-top .t { flex: 1; font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { width: 46px; height: 46px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-size: 20px; flex: none;
  box-shadow: 0 2px 0 var(--line); transition: transform .14s var(--ease-out); }
.icon:active { transform: scale(.92); }
.r-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 0 16px; }
.r-page { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.r-page.turn-next { animation: turnNext .38s var(--ease-out) both; }
.r-page.turn-prev { animation: turnPrev .38s var(--ease-out) both; }
@keyframes turnNext { from { opacity: 0; transform: translateX(40px) rotateY(-8deg); } }
@keyframes turnPrev { from { opacity: 0; transform: translateX(-40px) rotateY(8deg); } }
.r-img { flex: none; max-height: 40dvh; display: grid; place-items: center; }
.r-img img { max-height: 40dvh; width: auto; border-radius: 20px; box-shadow: var(--shadow); }
.r-title { font-weight: 700; color: var(--accent); font-size: 19px; }
.r-text { flex: 1; min-height: 60px; overflow-y: auto; overscroll-behavior: contain; font-size: clamp(19px, 4.6vw, 26px); line-height: 1.6;
  user-select: text; -webkit-user-select: text; }
.r-text p { margin: 0 0 .7em; }
.s { border-radius: 6px; transition: background .25s, box-shadow .25s; }
.s.on { background: var(--hl); box-shadow: 0 0 0 3px var(--hl); }
.r-progress { height: 6px; background: var(--card); margin: 4px 16px 0; border-radius: 3px; overflow: hidden; }
.r-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s var(--ease-out); }
.r-status { text-align: center; font-size: 14px; color: var(--muted); min-height: 20px; margin-top: 4px; }
.r-controls { display: flex; justify-content: center; align-items: center; gap: 26px; padding: 6px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }
.playbtn { position: relative; width: 80px; height: 80px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 32px;
  box-shadow: 0 8px 24px var(--glow); transition: transform .16s var(--ease-out); }
.playbtn:active { transform: scale(.93); }
.playbtn.on::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--accent); opacity: .5;
  animation: ring 1.8s var(--ease-out) infinite; }
@keyframes ring { from { transform: scale(.9); opacity: .6; } to { transform: scale(1.35); opacity: 0; } }
.r-menu { position: absolute; right: 14px; top: calc(64px + env(safe-area-inset-top, 0px)); width: 270px; background: var(--card); border-radius: 18px;
  padding: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.25); transform-origin: top right; transform: scale(.9); opacity: 0; pointer-events: none;
  transition: transform .25s var(--ease-spring), opacity .2s; z-index: 2; }
.r-menu.open { transform: none; opacity: 1; pointer-events: auto; }
.r-menu label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
.r-menu select { width: 100%; min-height: 44px; border-radius: 12px; border: 0; background: var(--bg); padding: 0 10px; }
.upsell-page { text-align: center; display: grid; gap: 14px; justify-items: center; padding: 20px 0; }
.upsell-page .big { font-size: 70px; animation: bob 3s ease-in-out infinite; }

.hearts { display: flex; justify-content: center; gap: 8px; margin: 14px 0; }
.hearts button { font-size: 42px; filter: grayscale(1) opacity(.45); transition: filter .2s, transform .25s var(--ease-spring); }
.hearts button.on { filter: none; animation: heart .45s var(--ease-spring); }
@keyframes heart { 40% { transform: scale(1.35); } }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

/* video player */
#player { position: fixed; inset: 0; z-index: 35; background: #000; display: grid; place-items: center; opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease-out); }
#player.open { opacity: 1; pointer-events: auto; }
#player video { width: 100%; max-height: 100dvh; }
#player .icon { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: 12px; z-index: 2; }

/* ---------------------------------------------------------------- plans, account, admin */
.billing-toggle { display: inline-grid; grid-template-columns: 1fr 1fr; background: var(--card); padding: 5px; border-radius: 16px; position: relative; box-shadow: var(--shadow); }
.billing-toggle button { position: relative; z-index: 1; padding: 10px 18px; border-radius: 12px; font-weight: 600; }
.billing-toggle .thumb { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); background: var(--accent2); border-radius: 12px; transition: transform .4s var(--ease-spring); }
.billing-toggle.yearly .thumb { transform: translateX(100%); }
.billing-toggle button[aria-pressed="true"] { color: #fff; }
.plans { display: grid; gap: 16px; margin: 18px 0; }
.plan { position: relative; display: flex; flex-direction: column; gap: 10px; animation: rise .5s var(--ease-out) both; animation-delay: calc(var(--i) * 80ms); }
.plan.featured { outline: 3px solid var(--accent); }
.plan .ribbon { position: absolute; top: -12px; right: 16px; }
.plan h3 { font-size: 22px; }
.plan .price { font-size: 34px; font-weight: 700; }
.plan .price small { font-size: 15px; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.plan li::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.plan .btn { margin-top: auto; }
.section-title { font-size: 19px; margin: 26px 0 10px; }
.settings { display: grid; gap: 14px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border: 0; }
details.card summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
details.card summary::after { content: "›"; transition: transform .25s var(--ease-out); font-size: 22px; line-height: 1; }
details.card[open] summary::after { transform: rotate(90deg); }
details.card[open] > :not(summary) { animation: viewIn .3s var(--ease-out); }
.danger-zone { border: 2px solid color-mix(in srgb, var(--bad) 40%, transparent); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat { background: var(--card); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); animation: rise .45s var(--ease-out) both; animation-delay: calc(var(--i) * 40ms); }
.stat b { display: block; font-size: 28px; }
.stat span { color: var(--muted); font-size: 13.5px; }
.admin-list { display: grid; gap: 10px; }
.admin-item { display: grid; grid-template-columns: 56px 1fr; gap: 12px; background: var(--card); border-radius: 16px; padding: 12px; box-shadow: var(--shadow); }
.admin-item img, .admin-item .gen { width: 56px; height: 86px; border-radius: 10px; object-fit: cover; font-size: 10px; }
.admin-item .ctrls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.admin-item select, .admin-users select { min-height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 0 8px; font-size: 15px; }
.switch { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line); position: relative; transition: background .25s; cursor: pointer; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .3s var(--ease-spring); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }
.seg { display: flex; gap: 6px; overflow-x: auto; margin: 8px 0 16px; }
.log { white-space: pre-wrap; font-family: ui-monospace, monospace; font-size: 12px; background: var(--bg2); border-radius: 12px; padding: 10px; max-height: 240px; overflow: auto; }
.legal { max-width: 760px; }
.legal h2 { margin: 22px 0 8px; font-size: 20px; }

/* ---------------------------------------------------------------- hover only where it exists */
@media (hover: hover) and (pointer: fine) {
  .book:hover .cover { transform: translateY(-4px) rotate(-.6deg); box-shadow: 0 14px 30px rgba(43,35,64,.18); }
  .btn:hover { filter: brightness(1.04); }
  .chip:hover, .tab:hover { color: var(--accent); }
  .avatar-tile:hover .face { transform: translateY(-4px) scale(1.03); }
  .continue:hover { transform: translateY(-2px); }
}

/* ---------------------------------------------------------------- tablet (≥700px) */
@media (min-width: 700px) {
  body { font-size: 18px; }
  #view { padding-left: 28px; padding-right: 28px; }
  .tab { flex-direction: row; gap: 8px; font-size: 15px; padding: 8px 16px; }
  .tabbar { justify-content: center; gap: 18px; }
  .row { grid-auto-columns: 170px; gap: 18px; margin: 0 -28px; padding: 4px 28px 16px; scroll-padding: 28px; }
  .row.movies { grid-auto-columns: 300px; }
  .greet h1 { font-size: 30px; }
  .mood { max-width: 420px; }
  .avatars { grid-template-columns: repeat(3, 150px); gap: 26px; }
  .avatar-tile .face { width: 140px; height: 140px; font-size: 76px; }
  .features { grid-template-columns: repeat(3, 1fr); }
  .plans { grid-template-columns: repeat(3, 1fr); align-items: stretch; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .settings { grid-template-columns: 1fr 1fr; align-items: start; }
  .sheet { align-items: center; }
  .sheet .panel { border-radius: 28px; transform: translateY(24px) scale(.96); opacity: 0; transition: transform .4s var(--ease-spring), opacity .25s; }
  .sheet.open .panel { transform: none; opacity: 1; }
  .sheet .grab { display: none; }
  .detail-head .c { width: 150px; }
  .r-img img { max-height: 46dvh; }
  .hero { grid-template-columns: 1.1fr 1fr; text-align: left; align-items: center; }
  .hero p, .hero .ctas { margin: 0; }
  .floaters { height: 320px; }
  .floaters span { font-size: 84px; }
}
/* tablet landscape & desktop: read side by side */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .r-page { flex-direction: row; align-items: center; gap: 32px; padding: 0 12px; }
  .r-img { flex: 1; max-height: none; }
  .r-img img { max-height: 70dvh; }
  .r-words { flex: 1; display: flex; flex-direction: column; max-height: 72dvh; }
  .r-text { font-size: clamp(20px, 2vw, 28px); }
}
/* ---------------------------------------------------------------- desktop (≥1024px): side rail */
@media (min-width: 1024px) {
  :root { --rail: 220px; --tabbar: 0px; }
  #view { margin-left: calc(var(--rail) + max(0px, (100vw - var(--rail) - 1180px) / 2)); padding-bottom: 40px; }
  #view.bare { margin-left: auto; }
  .tabbar { top: 0; right: auto; width: var(--rail); flex-direction: column; justify-content: flex-start; gap: 6px; padding: 26px 16px;
    border-top: 0; border-right: 1px solid var(--line); }
  .tabbar .brand { margin: 0 8px 22px; }
  .tab { width: 100%; justify-content: flex-start; font-size: 16px; padding: 12px 14px; }
  .tab[aria-current="page"] { background: color-mix(in srgb, var(--accent) 14%, transparent); }
  .tab[aria-current="page"] .ico { transform: scale(1.1); }
  .row { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); overflow: visible; margin: 0; padding: 4px 0 10px; }
  .row.movies { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .book.add .cover { min-height: 0; }
}
.tabbar .brand { display: none; }
@media (min-width: 1024px) { .tabbar .brand { display: flex; } }

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

/* ================================================================ UI polish (v2) */
body { font-family: Nunito, ui-rounded, system-ui, sans-serif; font-weight: 600; }
h1, h2, h3, .btn, .tab, .chip, .pill, .book .title, .mood button, .brand, .r-title, .r-top .t, label.field > span, .field > span {
  font-family: Fredoka, ui-rounded, system-ui, sans-serif; }
.r-text { font-family: Nunito, ui-rounded, system-ui, sans-serif; font-weight: 700; letter-spacing: .1px; }
svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
svg.i.fill { fill: currentColor; stroke: none; }

/* nav: line icons, active pill */
.tab .ico { display: grid; place-items: center; width: 56px; height: 32px; border-radius: 16px;
  transition: background-color .2s var(--ease-out), transform .2s var(--ease-out); font-size: 0; }
.tab[aria-current="page"] .ico { background: color-mix(in srgb, var(--accent) 18%, transparent); transform: none; }
.rail-only { display: none; }

/* home header */
.home-head { display: flex; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top, 0px)) 0 4px; }
.home-head .me { width: 52px; height: 52px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); font-size: 30px;
  display: grid; place-items: center; flex: none; transition: transform .16s var(--ease-out); }
.home-head .me:active { transform: scale(.94); }
.home-head .hello { flex: 1; min-width: 0; }
.home-head h1 { font-size: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-head .sub { color: var(--muted); font-size: 14.5px; }
.logout-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 12px;
  background: var(--card); box-shadow: 0 2px 0 var(--line); color: var(--ink); font: 600 14px Fredoka, system-ui, sans-serif;
  transition: transform .14s var(--ease-out); }
.logout-btn svg.i { width: 18px; height: 18px; }
.logout-btn:active { transform: scale(.96); }

/* featured story */
.feature { position: relative; display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; margin: 14px 0 6px;
  padding: 14px; border-radius: 24px; color: #fff; overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, var(--accent2), color-mix(in srgb, var(--accent) 85%, #7a3cff)); box-shadow: 0 14px 34px var(--glow);
  animation: rise .35s var(--ease-out) both; }
.bedtime .feature { background: linear-gradient(135deg, #2E2A6B, #4B3FA8); color: #F3EEFF; }
.feature::after { content: ""; position: absolute; inset: auto -40px -60px auto; width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.12); z-index: -1; }
.feature .fc { aspect-ratio: 5/8; border-radius: 14px; overflow: hidden; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.feature .fc img { width: 100%; height: 100%; object-fit: cover; }
.feature .kicker { font: 600 12.5px Fredoka, sans-serif; text-transform: uppercase; letter-spacing: .8px; opacity: .85; }
.feature h2 { font-size: 21px; margin: 2px 0 4px; }
.feature p { margin: 0 0 12px; font-size: 14.5px; opacity: .92; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feature .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.feature .btn { min-height: 44px; font-size: 16px; padding: 0 16px; }
.feature .btn.primary { background: #fff; color: #2B2340; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.feature .btn.primary svg.i { width: 18px; height: 18px; }
.feature .btn.ghost { color: inherit; background: rgba(255,255,255,.16); }
.feature .bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.3); margin: 0 0 10px; overflow: hidden; }
.feature .bar i { display: block; height: 100%; background: #FFE48A; }

/* compact controls row */
.controls-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; }
.controls-row .mood { margin: 0; max-width: 300px; flex: 1 1 260px; padding: 4px; border-radius: 16px; }
.controls-row .mood button { min-height: 40px; font-size: 15.5px; }
.controls-row .mood .thumb { top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); }
.controls-row .chips { padding: 0; }
.controls-row .chip { padding: 8px 13px; font-size: 14px; }

/* shelves */
.shelf-head { align-items: center; }
.see-all { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font: 600 14px Fredoka, sans-serif; color: var(--accent2);
  text-decoration: none; padding: 6px 4px; }
.see-all svg.i { width: 16px; height: 16px; }

/* slim, dismissible notices */
.strip { display: flex; align-items: center; gap: 10px; margin: 22px 0 0; padding: 10px 12px; border-radius: 14px; background: var(--card);
  box-shadow: 0 2px 0 var(--line); font-size: 14px; }
.strip .grow { flex: 1; }
.strip button { font: 600 14px Fredoka, sans-serif; color: var(--accent2); padding: 6px 8px; border-radius: 10px; }
.strip .x { color: var(--muted); }

/* cards: saved badge out of the art's way */
.book .saved-dot { top: auto; bottom: 8px; right: 8px; width: 24px; height: 24px; background: #fff; color: var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.book .saved-dot svg.i { width: 14px; height: 14px; }
.book .cover { border-radius: 18px; }
.book .title { font-size: 15.5px; }

/* story panel actions */
.actions-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions-2 .btn { min-height: 48px; font-size: 16px; padding: 0 10px; }
.save-btn.saved { color: var(--ok); }

/* calmer, snappier motion */
.book { animation-duration: .35s; }
.view-enter { animation-duration: .24s; }
.sheet .panel { transition-duration: .36s; }

@media (min-width: 700px) {
  .feature { grid-template-columns: 150px 1fr; padding: 18px; gap: 20px; }
  .feature h2 { font-size: 26px; }
  .feature p { font-size: 16px; }
  .home-head h1 { font-size: 28px; }
}
@media (min-width: 1024px) {
  .tabbar .rail-only { display: flex; margin-top: auto; color: var(--muted); }
  .tab .ico { width: 36px; height: 32px; }
  .tabbar .tab { gap: 12px; }
  .feature { grid-template-columns: 170px 1fr; max-width: 820px; }
}
.btn.primary svg.i { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.feature .btn.primary svg.i { fill: currentColor; stroke: none; }
.actions-2:empty { display: none; }
.actions-2 > :only-child { grid-column: 1 / -1; }
/* voice recorder */
.rec { display: flex; align-items: center; gap: 16px; margin: 16px 0; }
.rec-btn { width: 72px; height: 72px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; flex: none;
  transition: transform .14s var(--ease-out); }
.rec-btn:active { transform: scale(.94); }
.rec-btn span { width: 28px; height: 28px; border-radius: 50%; background: var(--bad); transition: border-radius .2s var(--ease-out), transform .2s var(--ease-out); }
.rec-btn.on span { border-radius: 6px; transform: scale(.85); }
.rec-btn.on { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad) 25%, transparent); }
.rec b { font: 600 22px Fredoka, sans-serif; }
#rec-play { width: 100%; margin-bottom: 8px; }
.logout-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.logout-card p { margin: 2px 0 0; }
.logout-card .btn svg.i { width: 20px; height: 20px; }

/* ---- reader v3: word highlighting, self-read, puppets, choices */
.w { border-radius: 5px; transition: background-color .12s, box-shadow .12s; }
.w.on { background: var(--hl); box-shadow: 0 0 0 2px var(--hl); }
.s.on { background: color-mix(in srgb, var(--hl) 35%, transparent); box-shadow: none; }
.mode-btn { flex: none; min-height: 40px; padding: 0 12px; border-radius: 999px; background: var(--card); box-shadow: 0 2px 0 var(--line);
  font: 600 14px Fredoka, sans-serif; transition: transform .14s var(--ease-out), background-color .2s; }
.mode-btn:active { transform: scale(.95); }
.mode-btn[aria-pressed="true"] { background: var(--accent2); color: #fff; }
.self-read .playbtn { visibility: hidden; }
.self-read .r-controls .icon { width: 64px; height: 64px; font-size: 26px; }
.self-read .w.on, .self-read .s.on { background: none; box-shadow: none; }
.choices { margin-top: 18px; display: grid; gap: 10px; }
.choose-title { font: 600 18px Fredoka, sans-serif; color: var(--accent); }
.choices .choice { justify-content: flex-start; text-align: left; min-height: 56px; font-size: 18px; border: 2px solid var(--line); }
.choices.ask .choice { animation: nudge .6s var(--ease-out) 2; }
@keyframes nudge { 30% { transform: translateX(6px); } 60% { transform: translateX(-3px); } }
.puppet { position: absolute; right: 12px; bottom: calc(118px + env(safe-area-inset-bottom, 0px)); width: 96px; z-index: 3;
  display: grid; justify-items: center; pointer-events: none; animation: puppetIn .35s var(--ease-spring) both; }
.puppet svg { width: 96px; height: 90px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.2)); transform-origin: 50% 100%; }
.puppet.talking svg { animation: puppetBob 1.1s ease-in-out infinite; }
.puppet span { font: 600 12px Fredoka, sans-serif; background: var(--card); padding: 2px 8px; border-radius: 999px; box-shadow: var(--shadow); margin-top: -4px; }
.puppet #mouth { transition: ry .06s linear; }
@keyframes puppetIn { from { opacity: 0; transform: translateY(20px) scale(.9); } }
@keyframes puppetBob { 50% { transform: rotate(-3deg) translateY(-2px); } }
@media (min-width: 900px) { .puppet { width: 130px; right: 28px; } .puppet svg { width: 130px; height: 122px; } }
@media (prefers-reduced-motion: reduce) { .puppet.talking svg { animation: none; } }
.star-toggle { display: flex; align-items: center; gap: 12px; margin: 10px 0 4px; padding: 12px 14px; border-radius: 14px; background: var(--card);
  box-shadow: 0 2px 0 var(--line); cursor: pointer; }
.star-toggle input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.star-toggle span { display: grid; }
.star-toggle small { color: var(--muted); font-size: 13.5px; }

/* ---- where a book comes from */
.book .src { position: absolute; right: 0; top: 10px; z-index: 2; padding: 3px 7px 3px 9px; border-radius: 999px 0 0 999px; font: 600 11px Fredoka, sans-serif;
  letter-spacing: .2px; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.book .src.original { background: linear-gradient(90deg, #FF6B6B, #FF9F43); }
.book .src.classic { background: linear-gradient(90deg, #6C5CE7, #4D96FF); }
/* the status tag (⭐ Read, 🎧, ⬇ Offline) sits bottom-left so it never runs into the source ribbon on narrow cards */
.book .tag { top: auto; bottom: 8px; z-index: 2; }
.book .cover:has(.bar) .tag { bottom: 20px; }
.source-line { display: inline-block; margin-top: 6px; padding: 4px 10px; border-radius: 999px; font: 600 13px Fredoka, sans-serif; color: #fff; }
.source-line.original { background: linear-gradient(90deg, #FF6B6B, #FF9F43); }
.source-line.classic { background: linear-gradient(90deg, #6C5CE7, #4D96FF); }
.source-line.mine { background: var(--bg2); color: var(--ink); }
.src-chip .n { opacity: .7; font-size: .85em; margin-left: 2px; }
.src-pill { display: inline-block; white-space: nowrap; padding: 4px 10px; border-radius: 999px; font: 600 12.5px Fredoka, sans-serif; color: #fff; }
.src-pill.original { background: linear-gradient(90deg, #FF6B6B, #FF9F43); }
.src-pill.classic { background: linear-gradient(90deg, #6C5CE7, #4D96FF); }

/* ---- announcement banner + promo form */
.announce { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; padding: 12px 14px; border-radius: 18px; color: #fff;
  background: linear-gradient(120deg, var(--accent), color-mix(in srgb, var(--accent2) 80%, #7a3cff)); box-shadow: 0 10px 24px var(--glow);
  animation: rise .35s var(--ease-out) both; font-weight: 700; }
.announce .emoji { font-size: 24px; }
.announce .grow { flex: 1; }
.announce .btn { background: #fff; color: #2B2340; box-shadow: none; flex: none; }
.announce .x { color: #fff; opacity: .8; padding: 6px; font-size: 16px; }
.promo-form .row-h { gap: 8px; }
.promo-form .input { text-transform: uppercase; }
.tab[hidden] { display: none !important; }

/* ---- other languages */
.r-text.translating p { opacity: .7; animation: pulse-soft 1.4s ease-in-out infinite; }
@keyframes pulse-soft { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .r-text.translating p { animation: none; } }
.r-words[dir="rtl"] .r-text, .r-words[dir="rtl"] .r-title { text-align: right; }
#r-lang-btn { font-size: 20px; }

[hidden] { display: none !important; }

/* ---- four look tabs on Home (Storybook / Playful / Cinematic / Bedtime) */
.controls-row .mood.looks { max-width: calc(var(--n) * 150px); flex: 1 1 calc(var(--n) * 120px); grid-template-columns: repeat(var(--n), 1fr); }
.mood.looks .thumb, .bedtime .mood.looks .thumb { width: calc((100% - 8px) / var(--n)); transform: translateX(calc(var(--i) * 100%)); }
.mood.looks button { font-size: 14.5px; padding: 0 6px; white-space: nowrap; }
@media (max-width: 520px) { .mood.looks button { font-size: 13px; padding: 0 2px; } .mood.looks button span { display: block; font-size: 17px; line-height: 1.1; } .controls-row .mood.looks button { min-height: 54px; } }

/* ---------------------------------------------------------------- Books: sort and filters */
.book-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.book-tools .sort-pick { flex: 0 1 220px; min-width: 0; }
.book-tools .sort-pick .input { min-height: 42px; padding: 8px 12px; border-radius: 999px; font-size: 16px; font-weight: 600; cursor: pointer; }
.book-tools .chip { min-height: 42px; }
.book-tools .count { margin-left: auto; }
.filters-btn .n:empty { display: none; }
.filters-btn .n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 4px; padding: 0 6px;
  border-radius: 999px; background: var(--accent2); color: #fff; font-size: 12px; }
.filters-btn.on, .filters-btn[aria-expanded="true"] { box-shadow: inset 0 0 0 2px var(--accent2), 0 2px 0 var(--line); }
.chip.ghost { background: transparent; box-shadow: none; text-decoration: underline; }
.book-filters { margin-top: 8px; padding: 6px 14px 12px; border-radius: 20px; background: var(--card); box-shadow: 0 2px 0 var(--line); }
.book-filters .chips { padding: 6px 0; }
.topic-pick { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-weight: 600; }
.topic-pick .input { min-height: 42px; padding: 8px 12px; max-width: 320px; font-size: 16px; }
.empty .btn { margin-left: 6px; }
@media (max-width: 520px) { .book-tools .sort-pick { flex: 1 1 100%; } .book-tools .count { width: 100%; margin-left: 0; } }

/* dark looks: a select's open list is drawn by the browser on white unless the options get their own colours */
html.t-cinematic select option, html.t-cinematic select optgroup { background: #14142A; color: #F4F1FF; }
html.bedtime select option, html.bedtime select optgroup { background: #221F4A; color: #F3EEFF; }
html.t-cinematic select, html.bedtime select { color-scheme: dark; }

/* ---------------------------------------------------------------- categories: genre tiles, labels */
.genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.genre-strip { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 10px 2px 6px; margin: 0 -2px; scroll-snap-type: x proximity; }
.genre-strip::-webkit-scrollbar { display: none; }
.genre-strip .genre-tile { flex: none; width: 128px; scroll-snap-align: start; }
.genre-tile { display: grid; gap: 2px; justify-items: start; text-align: left; padding: 12px 14px; border-radius: 18px; background: var(--card);
  box-shadow: var(--shadow); color: var(--ink); transition: transform .16s var(--ease-out), box-shadow .2s; }
.genre-tile .ge { font-size: 28px; line-height: 1.1; }
.genre-tile b { font-size: 15px; line-height: 1.2; }
.genre-tile small { font-size: 12.5px; color: var(--muted); }
.genre-tile:active { transform: scale(.97); }
.genre-tile[aria-pressed="true"] { background: var(--accent2); color: #fff; }
.genre-tile[aria-pressed="true"] small { color: rgba(255,255,255,.85); }
@media (hover: hover) and (pointer: fine) { .genre-tile:hover { transform: translateY(-2px); } }
.pill.genre { cursor: pointer; border: 0; font: inherit; font-size: 13.5px; }
.pill.genre:active { transform: scale(.96); }
.themes-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 6px 0 10px; font-size: 15px; }
.themes-line span { white-space: nowrap; }
@media (max-width: 520px) { .genre-grid { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------------- profile form: pick a look */
.look-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.look-opt { display: grid; gap: 4px; align-content: start; text-align: left; padding: 8px; border-radius: 16px; background: var(--card);
  border: 3px solid var(--line); transition: transform .16s var(--ease-out), border-color .2s; }
.look-opt:active { transform: scale(.97); }
.look-opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.look-opt .sw { display: block; position: relative; height: 64px; border-radius: 10px; overflow: hidden; }
.look-opt .sw i { position: absolute; bottom: 8px; width: 20px; height: 32px; border-radius: 3px 6px 6px 3px; }
.look-opt .sw i:nth-child(1) { left: 10px; background: #E8604C; }
.look-opt .sw i:nth-child(2) { left: 34px; background: #2F7FB8; }
.look-opt .sw i:nth-child(3) { left: 58px; background: #F2B544; }
.look-opt b { font-size: 15px; }
.look-opt small { font-size: 12px; line-height: 1.25; color: var(--muted); }
@media (max-width: 420px) { .look-pick { grid-template-columns: 1fr; } .look-opt { grid-template-columns: 72px 1fr; align-items: center; column-gap: 10px; }
  .look-opt .sw { grid-row: span 2; height: 52px; } .look-opt .sw i { width: 14px; height: 24px; } .look-opt .sw i:nth-child(2) { left: 28px; } .look-opt .sw i:nth-child(3) { left: 46px; } }
@media (hover: hover) and (pointer: fine) { .look-opt:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); } }

/* Books: "Show more" under the grid */
.more-wrap { display: flex; justify-content: center; margin: 4px 0 24px; }
.more-wrap:empty { display: none; }
.more-btn { min-width: 240px; }
.book-tools .per-page { flex: 0 0 auto; }
.book-tools .per-page .input { min-height: 42px; padding: 8px 12px; border-radius: 999px; font-size: 16px; font-weight: 600; cursor: pointer; width: auto; }
@media (max-width: 520px) { .book-tools .per-page { flex: 1 1 100%; } .book-tools .per-page .input { width: 100%; } }

/* ---------------------------------------------------------------- narrators: choose who reads (listen first) */
.r-menu .r-menu-label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
.r-narrator { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; padding: 0 12px;
  border-radius: 12px; background: var(--bg); color: var(--ink); font-weight: 600; text-align: left; }
.r-narrator b { color: var(--accent2); font-size: 14px; }
.r-narrator:active { transform: scale(.98); }
.voice-list { display: grid; gap: 10px; margin-top: 12px; }
.voice-card { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px;
  background: var(--bg); border: 2px solid transparent; }
.voice-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.voice-card .vc-ico { font-size: 26px; }
.voice-card .vc-txt { display: grid; min-width: 0; }
.voice-card .vc-txt b { font-size: 16px; }
.voice-card .vc-txt small { color: var(--muted); font-size: 13px; }
.voice-card [data-sample].on { background: var(--accent2); color: #fff; }
.voice-card .btn[disabled] { opacity: 1; }
@media (max-width: 420px) { .voice-card { grid-template-columns: auto 1fr; } .voice-card .btn { grid-column: span 1; } }
.narrator-line { display: flex; align-items: center; gap: 6px; width: 100%; margin: 4px 0 10px; padding: 10px 14px; border-radius: 14px;
  background: var(--bg2); color: var(--ink); font-size: 15px; text-align: left; }
.narrator-line span { margin-left: auto; color: var(--accent2); font-weight: 700; }
.narrator-line:active { transform: scale(.98); }

/* Classic Tales on Home: "More ↻" sits just before "See all" */
.shelf-head .see-all.more + .see-all { margin-left: 16px; }
.shelf-head .see-all.more { min-height: 32px; }

/* the Bookahoo owl mark beside the name */
.brand-mark { width: 30px; height: 30px; border-radius: 9px; flex: none; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.admin-brand { display: inline-flex; align-items: center; gap: 8px; }
.admin-brand .brand-mark { width: 28px; height: 28px; border-radius: 8px; }

/* desktop side rail: the reader's avatar under the logo (opens Who's reading?) */
.tabbar .rail-me { display: none; }
@media (min-width: 1024px) {
  .tabbar .rail-me { display: flex; flex: none; flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; height: auto;
    margin: -10px 0 18px; padding: 8px 10px; border-radius: 18px;
    background: color-mix(in srgb, currentColor 9%, transparent); }
  .rail-me .av { flex: none; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-size: 27px;
    background: var(--card); box-shadow: 0 2px 6px rgba(0,0,0,.18); }
  .rail-me .rm-who { display: grid; min-width: 0; line-height: 1.15; text-align: left; }
  .rail-me .rm-who b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rail-me .rm-who small { font-size: 12.5px; font-weight: 600; opacity: .75; }
  .rail-me:active { transform: scale(.98); }
}

/* Starring your child (Premium): the locked version offers Premium */
.star-toggle.locked { width: 100%; text-align: left; cursor: pointer; border: 0; font: inherit; color: inherit; }
.star-toggle.locked i { margin-left: auto; font-style: normal; font-size: 18px; }
.star-toggle.locked:active { transform: scale(.98); }

/* Grown-ups: Log out and account settings at the top */
.acct-top .acct-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.acct-top .btn.small { min-height: 40px; display: inline-flex; align-items: center; gap: 6px; }
.acct-top .btn.small svg.i { width: 18px; height: 18px; }
.acct-top .icon-only { width: 40px; padding: 0; justify-content: center; }
.acct-who { margin: -6px 0 12px; }
.settings-stack { display: grid; gap: 12px; margin-top: 12px; }
.settings-stack .card { margin: 0; }
.settings-stack details > summary { cursor: pointer; font-weight: 700; }
