/* Taletoss: warm paper, coral and ink. Mobile first; the game screens are built for a phone in hand. */
:root {
  --coral: #ff6b4a;
  --coral-dark: #e2502f;
  --gold: #ffc94a;
  --cream: #fff4e6;
  --paper: #fffaf2;
  --ink-main: #2b2340;
  --muted: #6f6680;
  --line: #eadfce;
  --ok: #2fb380;
  --radius: 18px;
  --shadow: 0 6px 22px rgba(43, 35, 64, 0.12);
  --display: Fredoka, 'Nunito', system-ui, sans-serif;
  --body: Nunito, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --story: Fraunces, Georgia, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; overflow-wrap: anywhere; font: 17px/1.5 var(--body); color: var(--ink-main); background: var(--cream); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; outline: none; }
img, svg { max-width: 100%; }
a { color: var(--coral-dark); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 0.4em; }
h1 { font-size: clamp(1.9rem, 6vw, 3.1rem); font-weight: 700; }
h2 { font-size: clamp(1.35rem, 4vw, 1.9rem); font-weight: 600; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 0.8em; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.center-text { text-align: center; }
.lead { font-size: 1.15rem; }
.eyebrow { font-weight: 900; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem; color: var(--coral-dark); margin-bottom: 0.4em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }

/* Header and footer */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(16px, env(safe-area-inset-left)); position: sticky; top: 0; z-index: 20; background: rgba(255, 244, 230, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink-main); font: 700 1.35rem var(--display); }
.brand-logo svg { width: 38px; height: 38px; border-radius: 10px; display: block; }
#nav { display: flex; align-items: center; gap: 14px; font-weight: 800; }
#nav a { color: var(--ink-main); text-decoration: none; }
#nav a[href="#/settings"] { font-size: 1.3rem; }
.nav-continue { background: var(--ink-main); color: #fff !important; padding: 6px 12px; border-radius: 99px; font-size: 0.9rem; }
.pro-badge { background: var(--gold); border: 0; border-radius: 99px; font: 900 0.85rem var(--body); padding: 6px 12px; cursor: pointer; color: var(--ink-main); }
.foot { padding: 28px 16px 40px; text-align: center; font-size: 0.9rem; border-top: 1px solid var(--line); }
.foot a { color: var(--ink-main); }
body[data-route='play'] .foot, body[data-route='board'] .foot, body[data-route='book'] .foot { display: none; }
@media (max-width: 520px) { .brand-name { display: none; } #nav { gap: 10px; } }

/* Layout */
.band { padding: 36px max(18px, env(safe-area-inset-left)); max-width: 1120px; margin: 0 auto; }
.band.narrow { max-width: 760px; }
.band-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.grow { flex: 1; }
.split { display: grid; gap: 32px; align-items: center; }
@media (min-width: 820px) { .split { grid-template-columns: 1.1fr 0.9fr; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 800 1rem var(--body); padding: 11px 18px; border-radius: 99px; border: 2px solid var(--ink-main); background: #fff; color: var(--ink-main); text-decoration: none; cursor: pointer; transition: transform 0.08s, box-shadow 0.15s; box-shadow: 0 3px 0 var(--ink-main); min-height: 46px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink-main); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--coral); color: #fff; }
.btn-gold { background: var(--gold); }
.btn-danger { background: #c4405a; color: #fff; }
.btn-ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn-small { padding: 6px 12px; font-size: 0.9rem; min-height: 36px; }
.btn-big { font-size: 1.12rem; padding: 14px 24px; }
.btn-huge { font-size: 1.3rem; padding: 18px 30px; min-width: min(100%, 320px); }
.link { background: none; border: 0; color: var(--coral-dark); text-decoration: underline; font: inherit; font-weight: 800; cursor: pointer; padding: 4px; }
.icon-btn { background: none; border: 0; font-size: 1.1rem; cursor: pointer; padding: 8px; color: var(--muted); }
.badge { position: absolute; top: 10px; right: 10px; font: 900 0.72rem var(--body); padding: 3px 8px; border-radius: 99px; background: #fff; color: var(--ink-main); }
.badge-pro { background: var(--gold); }
.badge-adult { background: #c2426b; color: #fff; }
.badge-free { background: var(--ok); color: #fff; }

/* Home */
.hero { display: grid; gap: 28px; padding: 34px max(18px, env(safe-area-inset-left)) 20px; max-width: 1120px; margin: 0 auto; align-items: center; }
@media (min-width: 880px) { .hero { grid-template-columns: 1.15fr 0.85fr; padding-top: 60px; } }
.hero h1 { font-size: clamp(2.2rem, 7vw, 3.8rem); }
.pills { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pills li { background: #fff; border-radius: 99px; padding: 5px 12px; font-weight: 800; font-size: 0.88rem; border: 1px solid var(--line); }
.hero-demo { position: relative; min-height: 300px; }
.paper { position: absolute; left: 6%; right: 6%; background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); padding: 18px 20px; font: 400 1.15rem/1.4 var(--story); border: 1px solid var(--line); }
.paper .who { display: block; font: 900 0.75rem var(--body); text-transform: uppercase; letter-spacing: 0.1em; color: var(--coral-dark); margin-bottom: 4px; }
.paper.p1 { top: 0; transform: rotate(-2deg); }
.paper.p2 { top: 100px; transform: rotate(1.5deg); left: 12%; background: #ffeedd; }
.paper.p2.folded { filter: blur(0.6px); }
.paper.p3 { top: 200px; transform: rotate(-1deg); }
@media (prefers-reduced-motion: no-preference) {
  .paper { animation: float 6s ease-in-out infinite; }
  .paper.p2 { animation-delay: -2s; }
  .paper.p3 { animation-delay: -4s; }
  @keyframes float { 50% { translate: 0 -6px; } }
}
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
@media (min-width: 700px) { .deck-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; } }
@media (max-width: 420px) { .deck-tag { display: none; } .deck-name { font-size: 1.15rem; } }
.deck-grid.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.deck-tile { position: relative; display: flex; flex-direction: column; text-align: left; border: 3px solid transparent; border-radius: var(--radius); overflow: hidden; background: var(--bg); color: var(--ink); text-decoration: none; padding: 0; cursor: pointer; font: inherit; box-shadow: var(--shadow); transition: transform 0.12s; }
.deck-tile:hover { transform: translateY(-3px) rotate(-0.5deg); }
.deck-tile.selected { border-color: var(--ink-main); outline: 4px solid var(--gold); }
.deck-art { display: block; aspect-ratio: 4 / 3; overflow: hidden; }
.deck-art svg { width: 100%; height: 100%; display: block; }
.deck-text { padding: 10px 12px 12px; display: flex; flex-direction: column; }
.deck-name { font: 600 1.35rem/1.1 var(--deck-font), var(--display); font-synthesis: none; }
.deck-tag { font-size: 0.85rem; opacity: 0.85; }
.compact .deck-name { font-size: 1.1rem; }
.compact .deck-tag { display: none; }
.step-list { list-style: none; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.step-list li { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.step-n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--coral); color: #fff; font: 700 1rem var(--display); margin-right: 8px; flex: none; }
.step-list .step-n { margin-bottom: 8px; }
.sample-card { border-radius: var(--radius); box-shadow: var(--shadow); transform: rotate(2deg); justify-self: center; max-width: min(420px, 100%); height: auto; }
.classroom-teaser { background: #fff; border-radius: 28px; margin: 20px auto; }
.ticks { list-style: none; padding: 0; margin: 0 0 1em; }
.ticks li { padding-left: 30px; position: relative; margin-bottom: 8px; }
.ticks li::before { content: '✓'; position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #fff; font-weight: 900; font-size: 0.8rem; display: grid; place-items: center; }
.ticks.cols { columns: 2 280px; }
.pro-band { text-align: center; background: var(--ink-main); color: #fff; border-radius: 28px; margin: 20px auto; }
.pro-band .ticks { text-align: left; max-width: 760px; margin: 18px auto; }
.faq details { background: #fff; border-radius: 14px; padding: 12px 16px; margin-bottom: 10px; }
.faq summary { font-weight: 900; cursor: pointer; }
.faq details p { margin: 8px 0 0; }
.story-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.story-mini { background: #fff; border-radius: 14px; padding: 14px; text-decoration: none; color: var(--ink-main); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.story-mini span { font: italic 0.95rem/1.35 var(--story); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Forms */
.input { width: 100%; font: 600 1.05rem var(--body); padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink-main); }
.input:focus { border-color: var(--coral); outline: none; }
textarea.input { resize: vertical; line-height: 1.4; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-weight: 800; }
.field > span, .field legend { font-size: 0.9rem; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 800; margin-bottom: 6px; padding: 0; }
.step-h { display: flex; align-items: center; margin-top: 26px; }
.players { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.player-row { display: flex; gap: 8px; align-items: center; }
.kid-toggle { flex: none; border: 2px solid var(--line); background: #fff; border-radius: 99px; padding: 8px 12px; font: 800 0.85rem var(--body); cursor: pointer; color: var(--muted); }
.kid-toggle.on { background: var(--gold); border-color: var(--ink-main); color: var(--ink-main); }
@media (max-width: 420px) { .kid-toggle span { display: none; } }
.opener { margin: 10px 0; padding: 18px 20px; background: #fff; border-radius: 14px; border-left: 6px solid var(--coral); font: 400 1.3rem/1.4 var(--story); box-shadow: var(--shadow); }
.options summary { list-style: none; cursor: pointer; }
.options summary::-webkit-details-marker { display: none; }
.options summary h2::after { content: ' ▾'; font-size: 0.8em; color: var(--muted); }
.options[open] summary h2::after { content: ' ▴'; }
.seg { margin-top: 14px; }
.seg-row { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: inline-block; padding: 8px 14px; border-radius: 99px; border: 2px solid var(--line); background: #fff; font-weight: 800; font-size: 0.92rem; cursor: pointer; }
.seg-opt input:checked + span { background: var(--ink-main); color: #fff; border-color: var(--ink-main); }
.seg-opt input:focus-visible + span { outline: 3px solid var(--coral); }
.seg-opt.is-pro span { border-style: dashed; }
.start-bar { position: sticky; bottom: 0; padding: 16px 0 calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--cream) 30%); text-align: center; margin-top: 18px; }
.toggle { display: flex; gap: 12px; align-items: flex-start; background: #fff; border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; }
.toggle input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--coral); }
.toggle small { display: block; color: var(--muted); font-weight: 600; }
.note { background: #fff7d6; border: 1px solid #f1dd8a; border-radius: 12px; padding: 10px 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip-btn { border: 2px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 13px; font: 800 0.9rem var(--body); cursor: pointer; color: var(--ink-main); }
.chip-btn.on { background: var(--ink-main); color: #fff; border-color: var(--ink-main); }
.chip-btn.is-pro { border-style: dashed; }
.chip { background: var(--c); color: #fff; border-radius: 99px; padding: 2px 10px; font-weight: 800; }
.code-form { margin-top: 18px; }
.code-form .row { flex-wrap: nowrap; }
.the-code { font: 700 1.6rem var(--display); letter-spacing: 0.08em; text-align: center; background: #fff; border: 2px dashed var(--ink-main); border-radius: 12px; padding: 10px; }

/* Deck-coloured screens (play, reveal, vote, story) */
.deck-bg { background: var(--bg); color: var(--ink); min-height: calc(100vh - 60px); }
.deck-bg.dark .muted, .deck-bg.dark .eyebrow { color: color-mix(in srgb, var(--ink) 75%, transparent); }
.deck-bg .eyebrow { color: var(--accent); }
.deck-bg.dark .input { background: rgba(255, 255, 255, 0.95); }
.deck-bg.dark a:not(.btn) { color: var(--accent); }

/* Pass and write */
.pass, .write { max-width: 680px; margin: 0 auto; padding: 18px max(18px, env(safe-area-inset-left)) 40px; }
.pass { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: calc(100vh - 70px); justify-content: center; }
.pass-label { font-weight: 900; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.85rem; margin: 0; }
.pass-name { font: 700 clamp(3rem, 14vw, 5.5rem)/1 var(--display); color: var(--c); -webkit-text-stroke: 2px rgba(0, 0, 0, 0.08); margin: 0 0 6px; word-break: break-word; }
.dark .pass-name { -webkit-text-stroke: 0; filter: brightness(1.25); }
.pass .btn-huge { margin: 18px 0 6px; background: var(--c); }
.play-top { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 18px; }
.progress { flex: 1; display: flex; gap: 4px; }
.progress span { flex: 1; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 15%, transparent); }
.progress .done { background: var(--accent); }
.progress .now { background: var(--accent2); }
.game-menu { position: relative; }
.game-menu summary { list-style: none; cursor: pointer; font-size: 1.6rem; line-height: 1; padding: 0 8px; font-weight: 900; }
.game-menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: 34px; background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 5; min-width: 220px; }
.menu-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; font: 800 0.95rem var(--body); border-radius: 8px; cursor: pointer; color: var(--ink-main); }
.menu-item:hover { background: var(--cream); }
.write-who { font: 600 1.3rem var(--display); margin-bottom: 10px; }
.write-who::before { content: ''; display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--c); margin-right: 8px; vertical-align: 1px; }
.prev { margin: 0 0 14px; background: var(--paper); color: var(--ink-main); border-radius: var(--radius); padding: 14px 18px 18px; box-shadow: var(--shadow); }
.prev figcaption { font-weight: 900; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 4px; }
.prev blockquote { margin: 0; font: 400 1.35rem/1.4 var(--story); }
.twist { background: var(--accent2); color: #1d1630; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; box-shadow: var(--shadow); border: 2px dashed rgba(0, 0, 0, 0.25); }
.twist p { margin: 2px 0 0; font-weight: 800; font-size: 1.08rem; }
.twist-label { font: 900 0.75rem var(--body); text-transform: uppercase; letter-spacing: 0.12em; }
.twist-ending { background: var(--accent); color: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .twist { animation: flipin 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
  @keyframes flipin { from { transform: rotateX(90deg) scale(0.9); opacity: 0; } }
}
.line-input { font: 400 1.25rem/1.4 var(--story); min-height: 110px; }
.line-meta { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 800; min-height: 1.4em; margin: 4px 2px 10px; opacity: 0.8; }
.line-meta .warn { color: #c4405a; opacity: 1; }
.dark .line-meta .warn { color: #ff9db0; }
.voice { text-align: center; margin: 4px 0 14px; }
.mic { display: inline-flex; align-items: center; gap: 10px; border: 0; background: var(--paper); color: var(--ink-main); border-radius: 99px; padding: 10px 20px 10px 10px; font: 800 1.05rem var(--body); cursor: pointer; box-shadow: var(--shadow); }
.mic-icon { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); font-size: 1.6rem; }
.voice.prominent .mic-icon { width: 76px; height: 76px; font-size: 2.2rem; }
.mic.on .mic-icon { background: #e2487f; animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(226, 72, 127, 0.25); } }
.scribe { font-weight: 800; background: var(--paper); color: var(--ink-main); border-radius: 12px; padding: 10px; }
.timer { height: 12px; background: color-mix(in srgb, var(--ink) 15%, transparent); border-radius: 6px; overflow: hidden; margin-bottom: 16px; position: relative; }
.timer span { display: block; height: 100%; width: 100%; background: var(--accent2); transition: width 0.25s linear; }
.timer.low span { background: #e2487f; }
.timer.up { height: auto; background: #e2487f; color: #fff; text-align: center; padding: 6px; font-weight: 900; }
.timer.up::after { content: attr(data-label); }
.timer.up span { display: none; }
.curtain { animation: curtain 0.5s; }
@keyframes curtain { 40% { opacity: 0; transform: translateY(10px); } }

/* Board (classroom projector): everything bigger */
.board .prev blockquote { font-size: clamp(2rem, 4.5vw, 3.4rem); }
.board .write { max-width: 1100px; }
.board .twist p { font-size: 1.6rem; }
.board .line-input { font-size: 1.8rem; }
.board .write-who { font-size: 2rem; }
.board .story-lines .line-text { font-size: 1.7rem; }

/* Reveal and story */
.title-row { display: flex; gap: 8px; align-items: flex-end; }
.title-row .btn { margin-bottom: 12px; }
.story-lines { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 10px; perspective: 900px; }
.line { position: relative; background: var(--paper); color: var(--ink-main); border-radius: 16px; box-shadow: var(--shadow); border-left: 6px solid var(--c); min-height: 64px; transition: transform 0.5s, box-shadow 0.3s; }
.line-face { padding: 12px 16px; }
.line-text { font: 400 1.25rem/1.45 var(--story); margin: 0 0 4px; }
.line[data-i='0'] .line-text { font-style: italic; }
.line-by { font-size: 0.88rem; font-weight: 800; color: var(--c); margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.line-back { display: none; }
.line.face-down { cursor: pointer; background: var(--accent); border-left-color: transparent; }
.line.face-down .line-face { visibility: hidden; }
.line.face-down .line-back { display: grid; place-items: center; position: absolute; inset: 0; font: 700 1.8rem var(--display); color: #fff; }
@media (prefers-reduced-motion: no-preference) { .line.face-up { animation: turn 0.5s; } @keyframes turn { from { transform: rotateX(80deg); } } }
.line.reading { transform: scale(1.03); box-shadow: 0 0 0 4px var(--accent2), var(--shadow); }
.line.win { box-shadow: 0 0 0 4px var(--gold), var(--shadow); }
.tbadge { font-size: 0.78rem; background: var(--cream); color: var(--ink-main); border-radius: 99px; padding: 2px 8px; font-weight: 800; }
.tbadge.ok { background: #d8f5e8; }
.tbadge.miss { background: #fde2e6; }
.after { text-align: center; margin-top: 24px; }
.styles .chips { justify-content: center; }
.reveal .row.center { margin: 10px 0; }
.choice-cards { display: grid; gap: 12px; margin: 20px 0; }
.choice { text-align: left; border: 2px solid var(--ink-main); background: var(--paper); color: var(--ink-main); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 3px 0 var(--ink-main); }
.choice strong { font: 600 1.3rem var(--display); }
.vote-list { display: grid; gap: 10px; margin: 16px 0; }
.vote-line { text-align: left; background: var(--paper); color: var(--ink-main); border: 2px solid transparent; border-left: 6px solid var(--c); border-radius: 14px; padding: 14px 16px; cursor: pointer; font: inherit; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.vote-line:hover, .vote-line:focus-visible { border-color: var(--ink-main); }
.vote-line .line-by { color: var(--c); }
.winner-line { font: 400 1.6rem/1.4 var(--story); background: var(--paper); color: var(--ink-main); border-radius: var(--radius); padding: 20px; box-shadow: 0 0 0 5px var(--gold), var(--shadow); margin: 16px 0; }
.saved-note { background: rgba(255, 255, 255, 0.85); color: var(--ink-main); display: inline-block; padding: 6px 14px; border-radius: 99px; font-weight: 800; }
.story-title { font-family: var(--deck-font), var(--display); font-weight: 600; font-synthesis: none; font-size: clamp(2.2rem, 8vw, 3.6rem); }
.title-input { font: 700 1.6rem var(--display); margin-bottom: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 20px 0; }
.cta-box { background: var(--paper); color: var(--ink-main); border-radius: var(--radius); padding: 22px; text-align: center; box-shadow: var(--shadow); margin-top: 28px; }
.card-preview { display: grid; place-items: center; min-height: 240px; margin: 12px 0; }
.card-preview img { max-height: 58vh; width: auto; border-radius: 12px; box-shadow: var(--shadow); }

/* Shelf */
.shelf { list-style: none; padding: 0; display: grid; gap: 10px; margin: 16px 0 22px; }
.shelf-item { display: flex; gap: 14px; align-items: center; background: #fff; border-radius: 16px; padding: 12px 14px; text-decoration: none; color: var(--ink-main); box-shadow: var(--shadow); border-left: 6px solid var(--accent); }
.shelf-emoji { font-size: 1.9rem; width: 52px; height: 52px; display: grid; place-items: center; background: var(--bg); border-radius: 12px; flex: none; }
.shelf-text { display: flex; flex-direction: column; min-width: 0; }
.shelf-text > span:first-of-type { font: italic 0.95rem var(--story); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Dialogs */
.dialog { border: 0; border-radius: 22px; padding: 26px 22px 22px; max-width: min(520px, calc(100vw - 24px)); width: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); color: var(--ink-main); background: var(--cream); max-height: calc(100vh - 24px); }
.dialog::backdrop { background: rgba(43, 35, 64, 0.55); }
.dialog-wide { max-width: min(640px, calc(100vw - 24px)); }
.dialog-small { max-width: min(420px, calc(100vw - 24px)); }
.dialog-x { position: absolute; top: 8px; right: 10px; background: none; border: 0; font-size: 1.8rem; cursor: pointer; color: var(--muted); line-height: 1; padding: 6px; }
.ask { font-weight: 800; font-size: 1.1rem; margin-right: 20px; }
.paywall-deck { display: flex; gap: 14px; background: var(--bg); color: var(--ink); border-radius: 16px; padding: 10px; margin-bottom: 14px; align-items: center; }
.paywall-deck .deck-art { width: 120px; flex: none; border-radius: 10px; }
.paywall-deck p { margin: 2px 0; font-size: 0.9rem; }
@media (max-width: 480px) { .paywall-deck { flex-direction: column; align-items: stretch; } .paywall-deck .deck-art { width: 100%; } }

/* Toast and confetti */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink-main); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 800; z-index: 1000; box-shadow: var(--shadow); max-width: calc(100vw - 32px); transition: opacity 0.4s; }
.toast.out { opacity: 0; }
.celebrate { position: fixed; inset: 0; pointer-events: none; z-index: 999; overflow: hidden; }
.celebrate span { position: absolute; top: -40px; animation: fall 3s ease-in forwards; }
@keyframes fall { to { transform: translate(var(--drift), 110vh) rotate(540deg); } }

/* Settings, decks, classroom, lessons, prose */
.settings h2 { margin-top: 30px; font-size: 1.3rem; }
.emoji-field { width: 90px; }
.look-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.look { background: var(--bg); color: var(--ink); border-radius: 12px; padding: 8px 10px; font-weight: 800; cursor: pointer; display: flex; gap: 6px; align-items: center; border: 3px solid transparent; }
.look:has(input:checked) { border-color: var(--ink-main); }
.tools { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 20px 0; }
.tool { position: relative; background: #fff; border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink-main); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.tool-icon { font-size: 2rem; }
.tool span:not(.tool-icon):not(.badge) { color: var(--muted); font-size: 0.92rem; }
.tool.is-locked { opacity: 0.75; }
.price-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 18px 0; }
.price-card { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.price { font: 700 1.8rem var(--display); color: var(--coral-dark); margin: 0; }
.lesson-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.lesson-item { display: flex; flex-direction: column; background: #fff; border-radius: 14px; padding: 14px 16px; text-decoration: none; color: var(--ink-main); box-shadow: var(--shadow); }
.lesson-item.is-locked { opacity: 0.7; }
.lesson-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.lesson-steps { list-style: none; padding: 0; }
.lesson-steps li { display: flex; gap: 14px; margin-bottom: 12px; }
.mins { flex: none; width: 64px; font: 700 1rem var(--display); background: var(--gold); border-radius: 10px; text-align: center; padding: 6px 0; height: fit-content; }
.rubric { border-collapse: collapse; width: 100%; font-size: 0.9rem; background: #fff; }
.rubric th, .rubric td { border: 1px solid var(--line); padding: 8px; vertical-align: top; text-align: left; }
.rubric thead th { background: var(--ink-main); color: #fff; }
.prose h2 { margin-top: 1.4em; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tab { padding: 8px 14px; border-radius: 99px; background: #fff; text-decoration: none; color: var(--ink-main); font-weight: 800; border: 2px solid var(--line); }
.tab.on { background: var(--ink-main); color: #fff; border-color: var(--ink-main); }
.howto { background: #fff; border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.howto summary { font-weight: 900; cursor: pointer; }

/* Storybook and printables on screen: pages as paper previews */
.book-bar, .print-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.book-bar { padding: 16px; justify-content: center; }
.book { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 10px 10px 50px; }
.book .page { width: min(148mm, 100%); aspect-ratio: 148 / 210; background: #fffaf2; box-shadow: var(--shadow); border-radius: 4px; padding: 12mm 12mm 10mm; display: flex; flex-direction: column; position: relative; overflow: hidden; color: #2b2340; }
@media (max-width: 600px) { .book .page { aspect-ratio: auto; min-height: 140vw; } }
.book.locked .page:not(.cover) { filter: blur(5px); pointer-events: none; }
.cover { background: var(--bg) !important; color: var(--ink) !important; text-align: center; justify-content: flex-start; }
.cover-art { border-radius: 50% 50% 12px 12px / 30% 30% 12px 12px; overflow: hidden; margin-bottom: 8mm; }
.cover-art svg { display: block; width: 100%; height: auto; }
.cover h1 { font-size: 26pt; font-weight: 600; font-synthesis: none; margin-bottom: 3mm; }
.cover-by { font: italic 12pt var(--story); }
.cover-date { margin-top: auto; font-size: 9pt; opacity: 0.8; }
.page.story { justify-content: center; gap: 6mm; }
.spot { width: 34mm; align-self: center; }
.spot svg { width: 100%; height: auto; display: block; }
.book-line { font: 400 15pt/1.5 var(--story); margin: 0; }
.book-line.opener { font-style: italic; }
.book-by { display: block; font: 800 8.5pt var(--body); text-align: right; margin-top: 1mm; }
.folio { position: absolute; bottom: 6mm; left: 0; right: 0; text-align: center; font-size: 9pt; color: #8a7d70; margin: 0; }
.page.end { text-align: center; justify-content: center; }
.page.end h2 { font-size: 30pt; font-weight: 600; font-synthesis: none; color: var(--accent); }
.award { border: 2px solid var(--accent2); border-radius: 10px; padding: 5mm; margin: 6mm 0; }
.award-title { font-weight: 900; }
.award-line { font: italic 13pt var(--story); }
.authors-h { font-weight: 900; margin-top: 6mm; }
.authors { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 3mm; justify-content: center; }
.authors li { background: var(--c); color: #fff; border-radius: 99px; padding: 1mm 4mm; font-weight: 800; }
.page.back { justify-content: center; align-items: center; text-align: center; background: var(--bg) !important; color: var(--ink) !important; }
.back-logo svg { width: 30mm; height: 30mm; border-radius: 6mm; }

.sheets { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 10px 10px 60px; }
.sheet { background: #fff; width: min(210mm, 100%); box-shadow: var(--shadow); padding: 12mm; color: #2b2340; }
.paper-letter .sheet { width: min(216mm, 100%); }
.sheet-head { display: flex; gap: 5mm; align-items: center; }
.sheet-spot { width: 20mm; flex: none; }
.sheet-spot svg, .cert-spot svg { width: 100%; height: auto; display: block; }
.sheet-kicker { font: 900 9pt var(--body); text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); margin: 0; }
.sheet-rule { font: 700 11pt var(--body); margin: 0; }
.sheet-opener { background: var(--bg); color: var(--ink); border-radius: 4mm; padding: 4mm 5mm; margin: 4mm 0; }
.sheet-opener span { font: 900 8pt var(--body); text-transform: uppercase; letter-spacing: 0.1em; }
.sheet-opener p { font: 400 14pt/1.35 var(--story); margin: 1mm 0 0; }
.strip { padding: 1mm 0; }
.strip-head { display: flex; gap: 4mm; align-items: center; font-size: 9pt; font-weight: 800; }
.strip-n { width: 7mm; height: 7mm; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.strip-end { margin-left: auto; color: var(--accent); }
.ruled { border-bottom: 0.4mm solid #c9bfb2; height: 8mm; }
.fold { border-top: 0.5mm dashed #8a7d70; text-align: center; font-size: 7.5pt; color: #8a7d70; padding-top: 0.5mm; margin-top: 2mm; }
.sheet-foot { text-align: center; font-size: 8pt; color: #8a7d70; margin-top: 3mm; }
.card-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 8mm; }
.card-sheet.starter { grid-template-columns: repeat(2, 1fr); }
.pcard { border: 0.3mm dashed #b8ad9f; padding: 5mm; min-height: 62mm; display: flex; flex-direction: column; background: color-mix(in srgb, var(--bg) 45%, white); }
.starter .pcard { min-height: 50mm; }
.pcard-label { font: 900 8pt var(--body); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.pcard p { font: 400 12pt/1.35 var(--story); margin: 3mm 0; flex: 1; }
.pcard-foot { font-size: 7pt; color: #8a7d70; text-align: right; }
.cert-page { display: grid; gap: 10mm; }
.cert { border: 2mm double var(--accent); border-radius: 4mm; padding: 8mm; text-align: center; min-height: 118mm; }
.cert-spot { width: 22mm; margin: 0 auto; }
.cert-kicker { font: 900 9pt var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin: 2mm 0; }
.cert-title { font: 700 26pt var(--display); }
.cert-line { border-bottom: 0.4mm solid #2b2340; margin: 2mm 18mm 5mm; }
.cert-sign { display: flex; justify-content: space-around; margin-top: 8mm; font-size: 9pt; }
.cert-sign span { border-top: 0.4mm solid #2b2340; padding-top: 1mm; width: 45mm; }

@media (max-width: 879px) {
  .hero-demo { min-height: 0; display: grid; }
  .paper { position: relative; left: auto; right: auto; top: auto !important; margin: 0 4% -6px; }
  .paper.p2 { left: auto; margin-left: 9%; }
}
