/* Obooga flip-book — one page on stage, book frame, prompt overlay */
:root {
  --coral: #f07a3d; --coral-dark: #d95f22; --teal: #2a9d8f; --ink: #2b2440;
  --paper: #fdf6ec; --paper-edge: #efe2cc;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Georgia, "Times New Roman", serif; background: linear-gradient(160deg, #2b2440, #4a3b6b); color: var(--ink); min-height: 100vh; }
.hidden { display: none !important; }
.screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 16px; }

/* cards (gate/setup) */
.card { background: var(--paper); border-radius: 24px; padding: 36px; max-width: 520px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
h1 { margin: 8px 0 0; font-size: 2.4em; } h1 .dot { color: var(--coral); }
h2 { margin: 8px 0; }
.tag { font-style: italic; color: #6b6180; margin: 4px 0 14px; }
.note { font-size: .82em; color: #8a8098; background: #f4ecdd; border-radius: 10px; padding: 10px; }
.err { color: #c0392b; font-size: .9em; }
input[type=text], textarea { width: 100%; padding: 14px; border: 2px solid var(--paper-edge); border-radius: 14px; font-size: 1.05em; font-family: inherit; margin: 10px 0; background: #fff; }
button.big { background: var(--coral); color: #fff; border: 0; border-radius: 16px; padding: 14px 26px; font-size: 1.1em; font-family: inherit; cursor: pointer; box-shadow: 0 4px 0 var(--coral-dark); }
button.big:active { transform: translateY(3px); box-shadow: none; }

/* Obooga blob */
.obooga-face { width: 110px; height: 96px; margin: 0 auto; position: relative; background: radial-gradient(circle at 38% 32%, #ff9b5e, var(--coral) 70%); border-radius: 48% 52% 55% 45% / 60% 58% 42% 40%; box-shadow: inset -8px -10px 0 rgba(0,0,0,.08); flex-shrink: 0; }
.obooga-face::before, .obooga-face::after { content: ""; position: absolute; top: 26%; width: 26px; height: 30px; background: #fff; border-radius: 50%; box-shadow: inset 0 -2px 0 rgba(0,0,0,.06); }
.obooga-face::before { left: 22%; } .obooga-face::after { right: 22%; }
.obooga-face.small { width: 68px; height: 58px; }
.obooga-face.maxalooey { background: none; box-shadow: none; }
.obooga-face.maxalooey::before, .obooga-face.maxalooey::after { display: none; }
.obooga-face.maxalooey img { height: 100%; width: auto; object-fit: contain; }
.obooga-face.small::before, .obooga-face.small::after { width: 16px; height: 19px; }
.obooga-face.tiny { width: 46px; height: 40px; margin-top: 10px; }
.obooga-face.tiny::before, .obooga-face.tiny::after { width: 11px; height: 13px; }
.obooga-face.stuck { animation: wobble .5s ease infinite alternate; }
.obooga-face.wrong { animation: tilt .4s ease 2; }
.obooga-face.quiet { animation: none; }
@keyframes wobble { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
@keyframes tilt { from { transform: rotate(0); } to { transform: rotate(9deg); } }

/* ---------- world picker ---------- */
.card.wide { max-width: 720px; }
#worldcards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-top: 12px; }
.worldcard { background: #fff; border: 3px solid var(--paper-edge); border-radius: 16px; padding: 0 0 12px; cursor: pointer; font-family: inherit; text-align: center; overflow: hidden; transition: transform .15s ease; }
.worldcard:hover { transform: translateY(-4px); border-color: var(--teal); }
.wc-art { height: 100px; background: linear-gradient(150deg, #4a3b6b, #8d7fa8); overflow: hidden; }
.wc-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wc-title { font-weight: bold; font-size: 1.05em; margin: 10px 8px 4px; }
.wc-hook { font-size: .85em; color: #6b6180; font-style: italic; margin: 0 10px; }

/* ---------- the wrong-drawing gag ---------- */
.sp-no { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); background: var(--coral); color: #fff; border: none; border-radius: 999px; padding: 12px 22px; font-family: inherit; font-size: 1.05em; font-weight: bold; cursor: pointer; box-shadow: 0 4px 0 #c05a24, 0 6px 14px rgba(20,10,40,.35); animation: nopulse 1.2s ease infinite; }
.sp-no:active { transform: translateX(-50%) translateY(3px); box-shadow: 0 1px 0 #c05a24; }
@keyframes nopulse { 0%,100% { scale: 1; } 50% { scale: 1.06; } }
.sp-firsttry { position: absolute; bottom: 10px; left: 10px; width: 24%; min-width: 90px; transform: rotate(-4deg); border: 4px solid #fff; border-radius: 8px; box-shadow: 0 4px 10px rgba(20,10,40,.4); overflow: hidden; background: #fff; }
.sp-firsttry img { display: block; width: 100%; }
.sp-firsttry .ft-label { font-size: .62em; text-align: center; padding: 3px 4px; background: #fff; color: #b3541e; font-style: italic; font-weight: bold; }

/* ---------- audio: toggles + word highlight ---------- */
/* (Oct 21, Josh) a row under the book, not on the page: on the page the toggles covered the tap hint */
#audio-ctl { position: relative; z-index: 30; display: flex; justify-content: center; gap: 10px; width: 100%; max-width: 680px; margin: 14px auto 0; }
#audio-ctl button { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--paper-edge); background: rgba(255,255,255,.9); font-size: 1.05em; cursor: pointer; padding: 0; line-height: 1; box-shadow: 0 2px 5px rgba(20,10,40,.25); }
#audio-ctl button:active { transform: scale(.92); }
#audio-ctl button.dim { opacity: .55; }
/* narrated pages: audio owns the pacing, so the staggered reveal is cancelled */
.pagetext.audio-read .w { animation-delay: 0ms !important; }
/* the bouncing ball: highlighted word gets a pill + a bobbing dot above it */
.w { position: relative; }
.w.hl { background: var(--coral); color: #fff; border-radius: 6px; box-shadow: 0 0 0 3px var(--coral); }
.w.hl::before { content: "●"; position: absolute; top: -1.05em; left: 50%; transform: translateX(-50%); font-size: .55em; color: var(--coral); animation: ballbob .45s ease infinite alternate; }
@keyframes ballbob { 0% { transform: translate(-50%, 0); } 100% { transform: translate(-50%, -4px); } }
@media (prefers-reduced-motion: reduce) { .w.hl::before { animation: none; } }

/* ---------- transient bubbles: tap anywhere to continue ---------- */
#overlay.tappable { cursor: pointer; }
#overlay.tappable .bubble::after { content: "tap ▶"; display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 999px;
  background: var(--coral); color: #fff; font-size: .68em; font-weight: bold; vertical-align: middle; opacity: 0;
  animation: fadein .4s ease .35s forwards, bounce 1.1s ease .8s infinite; }

/* ---------- resume banner (setup screen) ---------- */
.resume-banner { display: flex; gap: 8px; margin-bottom: 14px; }
.resume-banner .resume-go { flex: 1; background: var(--teal); color: #fff; border: none; border-radius: 14px; padding: 12px 14px; font-family: inherit; font-size: 1em; cursor: pointer; box-shadow: 0 3px 0 #1f7268; }
.resume-banner .resume-go:active { transform: translateY(2px); box-shadow: none; }
.resume-banner .resume-no { background: #fff; border: 3px solid var(--paper-edge); border-radius: 12px; cursor: pointer; padding: 0 12px; font-size: 1em; color: #8a8098; }
.resume-banner.stale { align-items: flex-start; }
.resume-banner.stale .resume-no { padding: 8px 12px; }
.resume-banner.stale .stale-note { flex: 1; background: #fff7e6; border: 3px solid #f2d39b; border-radius: 14px; padding: 10px 14px; font-size: .95em; line-height: 1.4; color: #5b4a2f; }

/* ---------- email save moment + share overlay close ---------- */
.email-save input[type=email] { width: 100%; box-sizing: border-box; border: 3px solid var(--paper-edge); border-radius: 12px; padding: 11px 12px; font-family: inherit; font-size: 1em; margin-bottom: 8px; }
.email-save input[type=email]:focus { outline: none; border-color: var(--teal); }
.share-close { position: absolute; top: 6px; right: 8px; background: none; border: none; font-size: 1.15em; color: #8a8098; cursor: pointer; padding: 4px 8px; }
#savemail-slot { margin-top: 8px; }
.save-ok { color: var(--teal); font-weight: bold; padding: 8px 0; }
#input-area { position: relative; }

/* ---------- kid character picker: labeled options left, character right ---------- */
#setup .card { max-width: 600px; }
#kid-layout { display: flex; gap: 12px; align-items: center; text-align: left; }
#kid-picker { flex: 1 1 58%; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kp-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.kp-label { width: 58px; flex-shrink: 0; font-size: .72em; color: #8a8098; text-transform: uppercase; letter-spacing: .06em; text-align: right; }
.kp-opts { display: flex; gap: 6px; flex-wrap: wrap; }
.kp-pill { background: #fff; border: 3px solid var(--paper-edge); border-radius: 999px; padding: 6px 13px; font-family: inherit; font-size: .85em; cursor: pointer; transition: transform .1s; }
.kp-swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--paper-edge); cursor: pointer; padding: 0; transition: transform .1s; }
.kp-pill.sel, .kp-swatch.sel { border-color: var(--teal); box-shadow: 0 0 0 3px #d2efe9; }
.kp-pill:active, .kp-swatch:active { transform: scale(.94); }
.kid-preview { flex: 1 1 42%; display: flex; justify-content: center; align-items: flex-end; }
.kid-preview img { height: 235px; max-width: 100%; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0,0,0,.2)); animation: fadein .25s ease; }
@media (max-width: 480px) {
  #kid-layout { flex-direction: column; align-items: stretch; }
  .kid-preview { justify-content: center; }
  .kid-preview img { height: 180px; }
}

/* the child IN the story */
.kid-sprite { position: absolute; bottom: 0; left: 4%; height: 50%; z-index: 1; filter: drop-shadow(0 6px 7px rgba(20,10,40,.35)); animation: kidin .7s cubic-bezier(.34,1.56,.64,1); transform-origin: bottom center; }
@keyframes kidin { 0% { transform: translateX(-50px) scale(.85); opacity: 0; } 100% { transform: none; opacity: 1; } }
.page.vary-1 .kid-sprite { height: 56%; left: 7%; }
.page.vary-2 .kid-sprite { left: auto; right: 5%; transform: scaleX(-1); height: 46%; }
.kid-sprite.on-cover { height: 40%; bottom: 10px; left: 6%; animation: kidin .9s cubic-bezier(.34,1.56,.64,1); }

/* ---------- avatar builder ---------- */
#builder { margin: 6px 0 16px; }
#av-preview { position: relative; display: flex; justify-content: center; margin-bottom: 10px; }
#av-shuffle { position: absolute; right: calc(50% - 86px); bottom: 0; border: 0; background: #fff; border-radius: 50%; width: 40px; height: 40px; font-size: 1.2em; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.2); }
.helmet { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffffff, #cfe4f0 65%, #9fc2d8); border: 4px solid #e9eef3; box-shadow: inset -6px -8px 14px rgba(60,90,120,.25), 0 4px 12px rgba(0,0,0,.25); overflow: hidden; position: relative; }
.helmet::after { content: ""; position: absolute; top: 8%; left: 12%; width: 30%; height: 16%; background: rgba(255,255,255,.65); border-radius: 50%; transform: rotate(-18deg); }
.helmet img { width: 100%; height: 100%; display: block; }
.helmet.big { width: 120px; height: 120px; }
.helmet.in-scene { position: absolute; bottom: 14px; left: 22px; width: 74px; height: 74px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
.opt-row { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; margin: 7px 0; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--paper-edge); cursor: pointer; padding: 0; }
.swatch.labeled { width: auto; border-radius: 999px; padding: 5px 12px; background: #fff; font-family: inherit; font-size: .85em; height: auto; }
.swatch.sel { border-color: var(--teal); box-shadow: 0 0 0 2px #e4f5f2; }

/* ---------- the book ---------- */
#story { padding: 12px; }
#bookframe { position: relative; width: 100%; max-width: 680px; }
/* stacked page edges behind the book */
/* (Oct 8) the stack lines up with the page's left edge (the lower-left corner looked notched);
   the depth stays on the right and the bottom, with the page's own corner radius */
#bookframe::before { content: ""; position: absolute; inset: 8px -6px -8px 0; background: #e8dcc2; border-radius: 16px; box-shadow: 0 22px 50px rgba(0,0,0,.45); z-index: 0; }
#bookframe::after { content: ""; position: absolute; inset: 4px -3px -4px 0; background: #f6ecd8; border-radius: 16px; z-index: 0; }
#stage { position: relative; z-index: 1; perspective: 1400px; min-height: 66vh; }
.page { background: var(--paper); border-radius: 16px; overflow: hidden; position: relative; min-height: 66vh; display: flex; flex-direction: column; transform-origin: left center; backface-visibility: hidden; }
/* book-real page turn: old page folds away left over the new one */
.page.on-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; }
.page.flip-out { animation: flipout .62s ease-in forwards; }
.page.flip-return { animation: flipreturn .55s ease-out; }
@keyframes flipout { from { transform: rotateY(0); opacity: 1; } to { transform: rotateY(-82deg); opacity: .35; } }
@keyframes flipreturn { from { transform: rotateY(-82deg); opacity: .35; } to { transform: rotateY(0); opacity: 1; } }
/* word-by-word reveal */
.w { opacity: 0; display: inline-block; animation: wordin .4s ease forwards; }
@keyframes wordin { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.plate { flex: 0 0 46%; min-height: 220px; background: linear-gradient(150deg, var(--g1, #666), var(--g2, #999)); position: relative; overflow: hidden; }
.plate-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.plate.has-art .doodle { display: none; }
/* when real art is present, size the band to the image's 16:9 ratio so nothing is cropped */
.page:not(.cover) .plate.has-art { flex: none; height: auto; min-height: 0; aspect-ratio: 16 / 9; }
.doodle { position: absolute; font-size: 2.4em; opacity: .9; }
.doodle.d0 { top: 18%; left: 12%; transform: rotate(-8deg); }
.doodle.d1 { top: 42%; right: 14%; transform: rotate(10deg) scale(1.35); }
.avatar-in-scene { position: absolute; bottom: 14px; left: 22px; font-size: 2.8em; filter: drop-shadow(0 3px 3px rgba(0,0,0,.3)); }
/* Obooga in the scene: bottom-right, contact shadow, bob-in entrance */
.obooga-sprite { position: absolute; bottom: 0; right: 4%; height: 62%; max-width: 40%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 6px 6px rgba(20,10,40,.35)); animation: obooga-arrive .8s cubic-bezier(.34,1.56,.64,1); transform-origin: bottom center; }
@keyframes obooga-arrive { 0% { transform: translateX(40px) scale(.7); opacity: 0; } 60% { transform: translateX(-4px) scale(1.05); opacity: 1; } 100% { transform: translateX(0) scale(1); } }
/* dock face: sprite replaces the CSS blob when available */
.obooga-face.has-sprite { background: none; box-shadow: none; border-radius: 0; }
.obooga-face.has-sprite::before, .obooga-face.has-sprite::after { display: none; }
.obooga-face.has-sprite img { height: 100%; width: auto; display: block; filter: drop-shadow(0 3px 5px rgba(0,0,0,.3)); }
.pagetext { flex: 1; padding: 22px 28px; font-size: 1.3em; line-height: 1.62; }
.pagetext.readback { background: #fff8e8; border-left: 6px solid var(--coral); font-style: italic; }
.pageno { position: absolute; bottom: 8px; right: 16px; font-size: .72em; color: #b0a68f; }

/* special sketch pages */
.plate.sketch { background: #fffdf5; flex-basis: auto; padding: 18px; min-height: 0; }
.sketch-frame { border: 3px dashed #c9b78f; border-radius: 12px; padding: 20px; text-align: center; background: repeating-linear-gradient(0deg, #fffdf5, #fffdf5 26px, #f4ecd9 27px); }
.sketch-label { font-size: .85em; color: #a08d5f; margin-bottom: 10px; }
.sketch-desc { font-size: 1.3em; font-style: italic; color: #6b5b33; }

/* cover: full-bleed art, title panel up top, the co-authors standing on it */
.page.cover { position: relative; }
.page.cover .plate.cover-full { position: absolute; inset: 0; height: auto; min-height: 0; flex: none; aspect-ratio: auto; }
.cover-obooga { position: absolute; bottom: 0; right: 5%; height: 46%; z-index: 1; filter: drop-shadow(0 8px 10px rgba(20,10,40,.45)); animation: obooga-arrive .9s cubic-bezier(.34,1.56,.64,1); transform-origin: bottom center; }
.helmet.cover-kid { position: absolute; bottom: 16px; left: 5%; width: 104px; height: 104px; z-index: 1; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); }
.cover-inner { position: absolute; top: 7%; left: 7%; right: 7%; border: 4px solid rgba(255,255,255,.75); border-radius: 14px; background: rgba(30,22,50,.28); backdrop-filter: blur(2px); display: flex; flex-direction: column; align-items: center; text-align: center; padding: 22px 16px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.45); }
.cover-title { font-size: 2.3em; font-weight: bold; line-height: 1.15; }
.cover-byline { margin-top: 10px; font-style: italic; font-size: 1.1em; }
.cover-ded { margin-top: 10px; font-size: .82em; opacity: .9; }

/* nav + pacing */
.nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 7; width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); color: var(--ink); font-size: 1.6em; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.3); line-height: 1; }
#nav-prev { left: -14px; } #nav-next { right: -14px; }
#continue { position: absolute; bottom: 16px; right: 16px; z-index: 3; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--coral); color: #fff; font-size: 1.5em; cursor: pointer; box-shadow: 0 5px 0 var(--coral-dark); animation: bounce 1.1s ease infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
#pageind { text-align: center; color: #cfc6e8; font-size: .82em; margin-top: 12px; }
#backchip { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); z-index: 7; background: var(--teal); color: #fff; padding: 8px 16px; border-radius: 999px; font-size: .9em; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.3); white-space: nowrap; }

/* ---------- prompt overlay ---------- */
#overlay { position: absolute; inset: 0; z-index: 40; display: flex; align-items: flex-end; border-radius: 16px; background: rgba(43,36,64,.35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fadein .35s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
#overlay-inner { width: 100%; padding: 14px; }
.dock-row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 10px; }
/* the face's base margin:0 auto (used by centered placements) becomes flex
   auto-margins here and pushed the avatar away from narrow bubbles */
.dock-row .obooga-face { margin: 0; }
.bubble { background: #fff; border-radius: 18px 18px 18px 4px; padding: 13px 17px; font-size: 1.05em; box-shadow: 0 6px 20px rgba(0,0,0,.3); animation: fadein .3s ease; }
.speaker-tag { display: none; }   /* markup always present; only the modern theme reveals it */
.bubble.stuck { background: #ffe9d6; font-weight: bold; }
.bubble.wrong { background: #fdeaea; font-style: italic; }
.bubble.quiet { background: #e8f2f0; font-style: italic; }

#input-area { max-height: 46vh; overflow-y: auto; }
.choices { display: grid; gap: 10px; }
.choice-card { background: var(--paper); border: 3px solid var(--paper-edge); border-radius: 14px; padding: 15px 17px; font-size: 1.12em; line-height: 1.4; font-family: inherit; text-align: left; cursor: pointer; box-shadow: 0 4px 0 var(--paper-edge); }
/* three distinct doors: orange, teal, purple */
.choices .choice-card:nth-child(3n+1) { border-color: var(--coral); box-shadow: 0 4px 0 #d95f22aa; }
.choices .choice-card:nth-child(3n+2) { border-color: var(--teal); box-shadow: 0 4px 0 #1f7a70aa; }
.choices .choice-card:nth-child(3n+3) { border-color: #8b5fbf; box-shadow: 0 4px 0 #6a4497aa; }
.choice-card:active { transform: translateY(2px); box-shadow: none; }
.choice-card.mini { font-size: 1.05em; padding: 12px 15px; margin: 8px 8px 0 0; display: inline-block; border: 3px solid var(--teal); }
.fallback .choice-card.mini:nth-of-type(2) { border-color: var(--coral); }
.escape-invite { background: linear-gradient(90deg, var(--teal), #4fae9c); color: #fff; border: 0; border-radius: 14px; padding: 13px 16px; font-size: 1em; font-family: inherit; cursor: pointer; width: 100%; margin-top: 9px; }
.freetext textarea { margin-top: 9px; }
.freetext.collapsed textarea, .freetext.collapsed .go { display: none; }
.fallback { margin-top: 10px; color: #f4ecdd; font-size: .9em; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.skip { background: none; border: 0; color: #2b2440; font-family: inherit; font-size: 1em; cursor: pointer; margin-top: 10px; text-decoration: underline; }
.big.teal { background: var(--teal); box-shadow: 0 4px 0 #1d7268; }
.big.plum { background: #241d44; color: #e8e2f5; box-shadow: 0 4px 0 #171130; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row .big { flex: 1; font-size: 1em; padding: 12px 10px; margin: 0; }
.share-row { display: flex; gap: 8px; } .share-row input { flex: 1; margin: 0; }

/* destination-banner choice cards (see the world you're choosing) */
.dest-col { display: flex; flex-direction: column; gap: 12px; max-width: 560px; margin: 0 auto; }
.dest { display: block; width: 100%; height: 118px; padding: 0; border-radius: 18px;
  border: 3px solid var(--bc, #fff); cursor: pointer; position: relative; overflow: hidden;
  background: #241d44; box-shadow: 0 6px 16px rgba(20,10,40,.45);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s; }
.dest img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  object-position: center 38%; filter: brightness(.68) saturate(.92);
  transition: transform 3.5s ease, filter .25s ease; }
.dest:hover, .dest:focus-visible { transform: scale(1.025);
  box-shadow: 0 8px 22px rgba(20,10,40,.55), 0 0 0 3px var(--bc); }
.dest:hover img, .dest:focus-visible img { transform: scale(1.07); filter: brightness(1) saturate(1); }
/* the shade PERSISTS on hover so titles stay anchored against bright skies */
.dest .shade { position: absolute; inset: 0;
  background: linear-gradient(250deg, rgba(20,10,40,.62) 0%, rgba(20,10,40,.14) 55%, rgba(20,10,40,0) 100%); }
.dest .txt { position: absolute; top: 12px; right: 16px; left: 16px; text-align: right;
  color: #fff; font-family: 'Trebuchet MS', 'Segoe UI', sans-serif; pointer-events: none; }
.dest .t { font-weight: 800; font-size: 1.42em; letter-spacing: .02em; line-height: 1.1;
  text-shadow: 0 2px 6px rgba(0,0,0,.8), 0 0 18px rgba(0,0,0,.45); }
.dest .sub { margin-top: 4px; font-size: .86em; font-style: italic; opacity: .94;
  text-shadow: 0 1px 4px rgba(0,0,0,.85); }
.dest .go { position: absolute; right: 12px; bottom: 9px; color: #fff; font-size: .85em;
  font-family: 'Trebuchet MS', sans-serif; opacity: 0; transition: opacity .18s;
  background: var(--bc); border-radius: 999px; padding: 3px 12px; }
.dest:hover .go, .dest:focus-visible .go { opacity: .95; }
.dest.noimg .txt { text-align: center; top: 38%; }   /* image failed: readable text card */
@media (max-height: 700px) { .dest { height: 96px; } .dest .t { font-size: 1.2em; } }

/* Maxalooey (guest sprite) + Mad Lib UI */
.guest-sprite { position: absolute; bottom: 0; left: 3%; height: 54%; max-width: 38%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 6px 6px rgba(20,10,40,.35)); animation: obooga-arrive .8s cubic-bezier(.34,1.56,.64,1); transform-origin: bottom center; }
.madlib { max-width: 560px; margin: 0 auto; }
.madlib-sentence { background: #fdf6e3; color: var(--ink); border-radius: 12px; padding: 8px 12px; font-size: .92em; line-height: 1.4; box-shadow: 0 3px 10px rgba(20,10,40,.3); }
.madlib-sentence .mblank { border-bottom: 3px dotted var(--coral); color: transparent; letter-spacing: 2px; }
.madlib-sentence .mfill { color: var(--coral); }
.madlib-nudge { animation: mnudge .5s ease; }
@keyframes mnudge { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-6px) } 75% { transform: translateX(6px) } }
.madlib-stage { margin-top: 12px; display: flex; flex-direction: column; gap: 9px; align-items: stretch; }
.madlib-big-input { width: 100%; box-sizing: border-box; border-radius: 12px; border: 0; padding: 13px 14px; font-family: inherit; font-size: 1.15em; }
.madlib-chips { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }
.madlib-chips .choice-card.mini { padding: 7px 14px; font-size: .95em; }
.madlib .go { margin-top: 2px; padding: 12px 22px; font-size: 1.05em; }

/* comptune-calibrated story pages: comp placement owns the framing */
.page.comp-fit .plate-img { transform: none !important; }

/* ---------- intro trailer overlay ---------- */
#introov { position: fixed; inset: 0; z-index: 90; background: #0d0a1a; display: flex; align-items: center; justify-content: center; opacity: 1; transition: opacity .6s ease; }
#introov.intro-out { opacity: 0; pointer-events: none; }
.intro-frame { position: relative; width: 100vw; height: 56.25vw; max-height: 100vh; max-width: 177.78vh; overflow: hidden; background: #000; }
.intro-layer { position: absolute; inset: -6%; width: 112%; height: 112%; object-fit: cover; opacity: 0; transition: opacity .9s ease; will-change: transform; }
.intro-layer.on { opacity: 1; }
.intro-layer[data-l="lib"] { transform-origin: 49% 58%; }
.intro-layer[data-l="desk"] { transform-origin: 55% 60%; }
.intro-layer[data-l="obo"] { transform-origin: 36% 52%; }
.intro-dim { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 55%, transparent 30%, rgba(8,5,20,.55) 100%); opacity: 0; transition: opacity 1s ease; pointer-events: none; }
.intro-dim.on { opacity: 1; }
.intro-skip { position: absolute; top: 2.5%; right: 2%; background: rgba(10,6,24,.55); color: #e8e2f5; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: .8vh 2.2vh; font-family: inherit; font-size: 2vh; cursor: pointer; opacity: 0; transition: opacity .5s; }
.intro-skip.on { opacity: 1; }

/* wide screens: bigger stage, roomier text */
/* ---------- christening: named vehicle ---------- */
.vehicle-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 4; }   /* above occluder layers: the named ship is always the hero */
.vehicle-wrap { position: relative; height: 58%; }
.vehicle-wrap img { height: 100%; width: auto; filter: drop-shadow(0 8px 10px rgba(20,10,40,.4)); }
@keyframes vehiclein { 0% { transform: translateX(-70px) scale(.8); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes vehiclehop { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
/* painted-on hull lettering (July 24): hard-light blend absorbs the hull's shading,
   warm paint tone + thin dark paint edge instead of a floating drop shadow;
   per-vehicle skew follows the hull surface (vehtune-calibrated) */
.vehicle-name { position: absolute; transform: translate(-50%,-50%) rotate(var(--rot, -3deg)) skewY(var(--skew, 0deg)); color: #e6d9bd; opacity: .9; mix-blend-mode: hard-light; font-family: 'Orbitron', 'Trebuchet MS', sans-serif; font-weight: 800; text-transform: uppercase; text-shadow: 0 1px 1px rgba(40,25,12,.5); letter-spacing: .08em; white-space: nowrap; line-height: 1.08; text-align: center; }
.vehicle-name .L { display: inline-block; opacity: 0; animation: letterpop .4s cubic-bezier(.34,1.56,.64,1) forwards; }
/* (Oct 14) the kingdom's rides: Obooga writes the name with a lost crayon, so dark crayon ink */
.vehicle-wrap.ride .vehicle-name, .cvr .cvr-sprite.ride .vehicle-name { color: #2c3e8f; opacity: .92; mix-blend-mode: multiply; text-shadow: none; }
@keyframes letterpop { 0% { opacity: 0; transform: translateY(12px) scale(.3) rotate(-8deg); } 100% { opacity: 1; transform: none; } }

/* ---------- ambient plate effects ---------- */
.fx { position: absolute; pointer-events: none; z-index: 1; }
.fx-star { width: 5px; height: 5px; background: #fff; border-radius: 50%; box-shadow: 0 0 6px 2px rgba(255,255,255,.65); animation-name: twinkle; animation-iteration-count: infinite; animation-direction: alternate; animation-timing-function: ease-in-out; }
@keyframes twinkle { from { opacity: .1; transform: scale(.6); } to { opacity: .95; transform: scale(1.2); } }
.fx-firefly { width: 6px; height: 6px; background: #ffe9a3; border-radius: 50%; box-shadow: 0 0 9px 3px rgba(255,214,110,.8); animation-name: floaty; animation-iteration-count: infinite; animation-direction: alternate; animation-timing-function: ease-in-out; }
@keyframes floaty { from { transform: translate(0,0); opacity: .3; } to { transform: translate(16px,-20px); opacity: 1; } }
.fx-bubble { width: 10px; height: 10px; border: 2px solid rgba(255,255,255,.6); border-radius: 50%; animation-name: rise; animation-iteration-count: infinite; animation-timing-function: linear; }
@keyframes rise { from { transform: translateY(0) translateX(0); opacity: .75; } 60% { transform: translateY(-85px) translateX(6px); opacity: .5; } to { transform: translateY(-150px) translateX(-4px); opacity: 0; } }
.fx-blink { border-radius: 50%; background: radial-gradient(circle, rgba(255,90,60,.55), rgba(255,90,60,0) 65%); transform: translate(-50%,-50%); animation: pulseglow 1.15s ease-in-out infinite; cursor: pointer; pointer-events: auto; }
/* pressing the forbidden button */
.strobe { position: absolute; inset: 0; z-index: 4; background: rgba(255,60,40,.4); animation: strobe .27s linear 6; pointer-events: none; }
@keyframes strobe { 0%,100% { opacity: .05; } 50% { opacity: .8; } }
.page.shake { animation: pageshake .55s ease 2; }
@keyframes pageshake { 0%,100% { transform: translate(0); } 20% { transform: translate(-7px,3px) rotate(-.5deg); } 40% { transform: translate(6px,-4px); } 60% { transform: translate(-5px,2px) rotate(.5deg); } 80% { transform: translate(5px,-2px); } }
/* repeated-background variation: zoom + reframe + Obooga moves */
.page.vary-1 .plate-img { transform: scale(1.18); transform-origin: 30% 45%; }
.page.vary-1 .obooga-sprite { height: 70%; right: 8%; }
.page.vary-2 .plate-img { transform: scale(1.3); transform-origin: 72% 35%; }
/* when a real camera-variant plate loaded, drop the CSS fake-zoom (characters still move) */
.page.vary-img .plate-img { transform: none; }
.page.vary-2 .obooga-sprite { right: auto; left: 4%; height: 54%; transform: scaleX(-1); }
.page.vary-2 .helmet.in-scene { left: auto; right: 22px; }
/* the back page */
.endpage .plate { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; }
.end-obooga { position: absolute; bottom: 0; right: 6%; height: 52%; filter: drop-shadow(0 6px 6px rgba(0,0,0,.35)); }
.end-inner { text-align: center; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.4); z-index: 1; }
.end-title { font-size: 3em; font-weight: bold; }
.end-byline { font-style: italic; margin-top: 8px; font-size: 1.15em; }
.end-date { opacity: .8; margin-top: 4px; font-size: .95em; }
.end-ctas { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.buy-btn { width: 100%; max-width: 420px; }
.make-btn { width: 100%; max-width: 420px; background: var(--teal); box-shadow: 0 4px 0 #1f7a70; }
#buychip { position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%); z-index: 7; background: var(--coral); color: #fff; border: 0; padding: 9px 18px; border-radius: 999px; font-family: inherit; font-size: .95em; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.35); white-space: nowrap; }
.share-book-row { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 6px; flex-wrap: wrap; }
.share-native { background: none; border: 2px solid var(--paper-edge); border-radius: 999px; padding: 9px 16px; font-family: inherit; font-size: .95em; cursor: pointer; color: var(--ink); }
.share-mini { color: #8a8098; font-size: .88em; text-decoration: underline; }

/* ship name char counter */
.char-hint { color: #f4ecdd; font-size: .85em; margin-top: 4px; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.char-hint.at-max { color: #ffd08a; font-weight: bold; }
@keyframes pulseglow { 0%,100% { opacity: .25; transform: translate(-50%,-50%) scale(.85); } 50% { opacity: 1; transform: translate(-50%,-50%) scale(1.15); } }
.fx-sparkle { color: #fff; font-size: 15px; text-shadow: 0 0 8px rgba(255,255,255,.9); animation-name: spark; animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
@keyframes spark { 0%,100% { opacity: 0; transform: scale(.4) rotate(0deg); } 50% { opacity: 1; transform: scale(1.2) rotate(24deg); } }
@media (prefers-reduced-motion: reduce) { .fx, .obooga-sprite, .w, .hero-obooga img, #continue { animation: none !important; opacity: 1; } }

/* generated special page */
.sp-badge { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: rgba(253,246,236,.92); color: #6b5b33; font-size: .78em; font-style: italic; padding: 6px 12px; border-radius: 999px; box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.sp-redraw { position: absolute; top: 10px; right: 12px; border: 0; background: rgba(253,246,236,.92); color: #6b5b33; font-family: inherit; font-size: .8em; padding: 6px 12px; border-radius: 999px; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.sp-reveal { animation: spreveal .8s ease; }
@keyframes spreveal { from { opacity: 0; transform: scale(.96); filter: saturate(.3); } to { opacity: 1; transform: scale(1); filter: none; } }
.pencil { font-size: 2em; display: inline-block; animation: scribble 1.1s ease-in-out infinite; transform-origin: bottom left; margin-bottom: 6px; }
@keyframes scribble { 0%,100% { transform: translateX(-30px) rotate(-12deg); } 25% { transform: translateX(10px) rotate(8deg); } 50% { transform: translateX(35px) rotate(-6deg); } 75% { transform: translateX(5px) rotate(10deg); } }
.sp-cycler { min-height: 1.3em; transition: opacity .3s; }

/* hero Obooga on gate/setup/worldpick */
.hero-obooga { display: flex; justify-content: center; }
.hero-obooga img { height: 130px; filter: drop-shadow(0 5px 8px rgba(0,0,0,.25)); animation: hero-bob 3s ease-in-out infinite; }
@keyframes hero-bob { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-6px) rotate(1deg); } }

@media (min-width: 900px) {
  #bookframe { max-width: 760px; }
  #stage, .page { min-height: 72vh; }
  .pagetext { font-size: 1.42em; padding: 26px 40px; }
}
/* small phones: tighter chrome */
@media (max-width: 480px) {
  #nav-prev { left: 4px; } #nav-next { right: 4px; }
  .nav { width: 38px; height: 38px; font-size: 1.3em; }
  #stage, .page { min-height: 74vh; }
  .plate { min-height: 180px; }
  .choice-card { font-size: 1.15em; padding: 16px; }
  .choice-card.mini { font-size: 1.08em; }
  .pagetext { font-size: 1.22em; }
}

/* ---- real print-cover on the studio finish page (July 21; mirrors bookview) ---- */
.page.cover .cvr-fit { position: absolute; inset: 0; display: grid; place-items: center;
  background: #221a33; overflow: hidden; border-radius: inherit; }
.cvr-fit .cvr { position: relative; width: 480px; height: 620px; transform-origin: center;
  overflow: hidden; flex: none; }
.cvr img.cvr-bg, .cvr img.cvr-occl { position: absolute; inset: 0; width: 100%; height: 100%; }
.cvr img.cvr-occl { z-index: 90; pointer-events: none; }
.cvr .cvr-sprite { position: absolute; }
.cvr .cvr-sprite img { filter: drop-shadow(3px 5px 5px rgba(20,10,20,.3)); }
.cvr .cvr-sprite .vehicle-name { position: absolute; transform: translate(-50%,-50%) rotate(var(--rot,0deg)) skewY(var(--skew,0deg));
  white-space: nowrap; line-height: 1.08; text-align: center; }
.cvr svg.cvr-title { position: absolute; overflow: visible; z-index: 70;
  font-family: 'Bree Serif', Georgia, serif; }
.cvr .cvr-byline { position: absolute; z-index: 70; text-align: center;
  font-family: 'Lora', Georgia, serif; font-weight: 600; line-height: 1.26; }

/* words not read aloud (attributions, typed inserts): lighter ink, story view only (Jul 27) */
.pagetext .w.unvoiced { color: #9d95ab; }

/* quiet text-link variant for de-emphasized choices (email-save "keep going") */
.skip-link { background: none; border: none; color: #8a8098; font-family: inherit; font-size: .95em;
  text-decoration: underline; cursor: pointer; padding: 10px; display: block; margin: 2px auto 0; }
.skip-link:hover { color: var(--ink); }

/* =====================================================================
   STORY REBUILD (Oct 2026) — demo-app-next
   ===================================================================== */
/* prompt panel: a solid backing so the controls never sit ON the page text
   (live test: "Stuck? Obooga's ideas" and the grown-ups opt-in collided with it) */
#input-area { background: rgba(30,23,56,.96); border-radius: 18px; padding: 12px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 8px 24px rgba(10,6,24,.35); }
#input-area:empty { display: none; }
#input-area .fallback, #input-area .skip { color: #f4ecdd; }

/* picture choice cards: art, a short title, a small line, a speaker to hear it again */
body .choices.pics { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 760px) { body .choices.pics { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); } }
body .choices.pics .choice-card.pic { display: flex; align-items: center; gap: 12px; padding: 10px 40px 10px 10px; min-height: 76px; text-align: left; position: relative; }
body.modern .choices.pics .choice-card.pic::after { content: none; }
.cc-art { flex: 0 0 64px; height: 64px; border-radius: 12px; background: #f3ead9; display: flex; align-items: center; justify-content: center; font-size: 2.1em; overflow: hidden; }
.cc-art img { width: 100%; height: 100%; object-fit: contain; }
.cc-art img[src*="/gen/"] { object-fit: cover; }
.cc-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cc-t { font-weight: 700; line-height: 1.25; }
.cc-s { font-size: .84em; font-weight: 500; opacity: .78; line-height: 1.3; }
.cc-say { position: absolute; top: 6px; right: 8px; font-size: .95em; opacity: .55; padding: 4px; border-radius: 50%; }
.cc-say:hover { opacity: 1; background: rgba(42,157,143,.15); }
@media (min-width: 760px) {
  body .choices.pics .choice-card.pic { flex-direction: column; align-items: stretch; text-align: center; padding: 10px 10px 12px; }
  body .choices.pics .cc-art { flex: none; height: 96px; width: 100%; font-size: 3em; }
}
.choice-card.reading, .dest.reading, .escape-invite.reading, .skip.reading {
  outline: 4px solid rgba(42,157,143,.75); outline-offset: 2px; transform: scale(1.03);
  box-shadow: 0 10px 26px rgba(42,157,143,.35) !important; transition: transform .2s ease;
}
.skip.reading { outline-width: 3px; border-radius: 8px; }

/* story taps: a pulsing ring on the real button/lever/vine, a hint, Obooga's accident */
.tap-ring { position: absolute; z-index: 6; transform: translate(-50%, -50%); aspect-ratio: 1; padding: 0;
  border-radius: 50%; border: 4px solid #fff; background: radial-gradient(circle, rgba(255,255,255,.18), rgba(255,255,255,0) 70%);
  box-shadow: 0 0 0 6px rgba(240,122,61,.55), 0 0 26px 10px rgba(255,220,120,.6); cursor: pointer; animation: tapring 1.2s ease-in-out infinite; }
.tap-ring::after { content: "👆"; position: absolute; right: -18%; bottom: -34%; font-size: 1.9em; animation: tapfinger 1.2s ease-in-out infinite; pointer-events: none; }
.tap-ring.hit { animation: none; transform: translate(-50%, -50%) scale(.85); opacity: .3; }
@keyframes tapring { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.12); } }
@keyframes tapfinger { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-6px,-8px); } }
.tap-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 9; width: max-content; background: #fffaf2; color: #2b2440;
  border-radius: 999px; padding: 10px 18px; font-weight: 700; font-family: 'Trebuchet MS', 'Segoe UI', sans-serif; font-size: .98em;
  box-shadow: 0 6px 18px rgba(20,10,40,.4); max-width: 88%; text-align: center; animation: fadein .4s ease; pointer-events: none; }
.tap-finger { display: inline-block; animation: tapfinger 1.2s ease-in-out infinite; }
.tap-sprite { position: absolute; z-index: 7; left: 74%; top: 22%; width: 15%; aspect-ratio: 1; border: 0; padding: 0; background: none; cursor: pointer;
  filter: drop-shadow(0 6px 8px rgba(20,10,40,.45)); animation: bonkwiggle 1s ease-in-out infinite; }
.tap-sprite img { width: 100%; height: 100%; object-fit: contain; }
.tap-sprite .tap-emoji { font-size: 3.2em; line-height: 1; }
.tap-sprite::after { content: ""; position: absolute; inset: -14%; border-radius: 50%; border: 3px dashed rgba(255,255,255,.85); animation: spin 6s linear infinite; }
.tap-sprite.swing { animation: bonkswing .45s ease-in forwards; }
.tap-sprite.swing::after { display: none; }
@keyframes bonkwiggle { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(10deg) translateY(-4px); } }
@keyframes bonkswing { 0% { transform: rotate(0); } 60% { transform: translate(-150%, 40%) rotate(-55deg); } 100% { transform: translate(-130%, 30%) rotate(-30deg); opacity: .0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.page.await-bonk .vehicle-name .L { animation-play-state: paused; }
.fx-splash { position: absolute; z-index: 8; font-size: 1.4em; pointer-events: none; animation: splash 1.1s ease-out forwards; }
@keyframes splash { 0% { transform: translate(0,0) scale(.6); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(1.2); opacity: 0; } }
/* (Oct 14, the T1D story) a thing in the scene to press: the big red tag, the juice box.
   left/top = its center (the "translate" property composes with the wiggle's transform) */
.tap-sprite.tap-press { translate: -50% -50%; aspect-ratio: auto; }
.tap-sprite.tap-press img { height: auto; display: block; }
.tap-sprite.tap-press::after { inset: -22% -30%; }
.tap-sprite.press-juicebox { animation: pressbob 1.4s ease-in-out infinite; }
.tap-sprite.pulled { animation: tagpull .45s ease-in forwards; }
.tap-sprite.slurp { animation: slurp .5s ease-in-out 2; }
.tap-sprite.pulled::after, .tap-sprite.slurp::after { display: none; }
@keyframes pressbob { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-5px) scale(1.04); } }
@keyframes tagpull { 0% { transform: translateY(0) rotate(0); } 45% { transform: translateY(26%) rotate(6deg); } 100% { transform: translate(60%, -40%) rotate(-28deg); opacity: 0; } }
@keyframes slurp { 0%,100% { transform: scale(1, 1); } 50% { transform: scale(1.06, .88); } }
.fx-word { position: absolute; z-index: 9; transform: translate(-50%, -50%); pointer-events: none; font-family: 'Bree Serif', Georgia, serif;
  font-size: clamp(18px, 3.4vw, 34px); color: #fffaf0; -webkit-text-stroke: 1.5px #c2410c; paint-order: stroke fill;
  text-shadow: 0 3px 8px rgba(40,20,0,.35); animation: wordpop 1.4s ease-out forwards; white-space: nowrap; }
@keyframes wordpop { 0% { transform: translate(-50%, -30%) scale(.5); opacity: 0; } 20% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  70% { transform: translate(-50%, -70%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -95%) scale(.95); opacity: 0; } }
/* the creature speaks (its first drawing is its face) */
.obooga-face.creature { background: #fffdf5; border-radius: 50%; box-shadow: 0 3px 10px rgba(20,10,40,.3); overflow: hidden; }
.obooga-face.creature::before, .obooga-face.creature::after { display: none; }
.obooga-face.creature img { width: 100%; height: 100%; object-fit: cover; }
/* the CGM card: the child's own kid */
.cc-art.kid img { object-fit: contain; object-position: center 20%; }

/* the creature rides along after its first drawing (a small polaroid) */
.creature-inset { position: absolute; z-index: 5; top: 5%; right: 3%; width: 17%; min-width: 74px; aspect-ratio: 1; background: #fffdf5;
  padding: 4px 4px 12px; border-radius: 4px; transform: rotate(4deg); box-shadow: 0 5px 14px rgba(20,10,40,.4); pointer-events: none; animation: fadein .6s ease; }
.creature-inset img { width: 100%; height: 100%; object-fit: cover; border-radius: 2px; display: block; }
.creature-inset.waiting { display: none; }
.creature-inset::before { content: ""; position: absolute; top: -8px; left: 35%; width: 30%; height: 14px; background: rgba(255,240,180,.75); transform: rotate(-3deg); }

/* parade confetti */
.fx-confetti { position: absolute; top: -6%; width: 8px; height: 13px; border-radius: 2px; opacity: .9; z-index: 3; pointer-events: none; animation-name: confall; animation-timing-function: linear; animation-iteration-count: infinite; }
@keyframes confall { 0% { top: -6%; transform: rotate(0); } 100% { top: 106%; transform: rotate(540deg); } }

/* the TA-DA joke: the NO! button no longer covers the caption it answers */
.sp-no { bottom: auto; top: 12px; }
.sp-no:active { transform: translateX(-50%) translateY(3px); }

/* finish screen: the close ✕ gets its own corner instead of sitting on "View Finished Story" */
#input-area:has(.share-close) { padding-top: 40px; }
.share-close { top: 8px; right: 10px; color: #e8e2f5; font-size: 1.3em; }

/* destination banners fit a 1024 × 768 tablet without an inner scroll */
@media (max-height: 820px) { .dest { height: 92px; } .dest-col { gap: 9px; } .dest .t { font-size: 1.25em; } }
/* the new builder kid: hidden until its pose composite is ready (no old-sprite flash) */
.kid-sprite.nk-wait { visibility: hidden; }

/* ---- Oct 6 review round (Josh) ---- */
/* typed words the narration does not say: gray in the story view, never in print */
.pagetext .w.typed, .bubble .typed { color: #9d95ab; }
/* Maxalooey's finished sentence on the page after he reads it (Oct 7): a card, not gray text */
.pagetext .mxq { display: block; margin: 0 0 .6em; padding: .45em .8em; border-radius: 14px; font-style: italic;
  background: linear-gradient(135deg, #eef4ff, #e2ebff); border: 2px solid #a9c4f2; color: #2c3a6b;
  box-shadow: 0 4px 14px rgba(70,100,180,.18); transform-origin: 50% 60%;
  animation: mxqpop .5s cubic-bezier(.2,1.5,.4,1) both, mxqglow 1.3s ease-in-out .5s 3; }
.pagetext .mxq .w.typed { color: inherit; }
@keyframes mxqpop { from { transform: scale(.82); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes mxqglow { 50% { transform: scale(1.025); box-shadow: 0 0 0 7px rgba(120,160,240,.28), 0 4px 14px rgba(70,100,180,.18); } }
@media (prefers-reduced-motion: reduce) { .pagetext .mxq { animation: none; } }

/* ---------- finish panel (Oct 7): one button shape, one primary action ---------- */
.fin { display: flex; flex-direction: column; gap: 10px; max-width: 400px; margin: 0 auto; font-family: 'Trebuchet MS', 'Segoe UI', sans-serif; }
.fin-btn { display: flex; align-items: center; justify-content: center; gap: 9px; height: 50px; padding: 0 18px; box-sizing: border-box; width: 100%;
  border-radius: 999px; border: 1.5px solid rgba(255,255,255,.16); background: rgba(255,255,255,.07); color: #f1ecfb;
  font: 600 1rem/1 'Trebuchet MS', 'Segoe UI', sans-serif; text-decoration: none; cursor: pointer; transition: background .15s, transform .1s; -webkit-tap-highlight-color: transparent; }
.fin-btn:hover { background: rgba(255,255,255,.13); }
.fin-btn:active { transform: scale(.98); }
.fin-btn svg { width: 19px; height: 19px; flex: none; opacity: .9; }
.fin-btn.primary { height: 56px; border-color: transparent; background: var(--coral); color: #fff; font-size: 1.08rem; box-shadow: 0 6px 18px rgba(240,122,61,.32); }
.fin-btn.primary:hover { background: #f4874f; }
.fin-btn:disabled { opacity: .6; cursor: default; }
.fin-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fin-row.one { grid-template-columns: 1fr; }
.fin-note { display: flex; align-items: center; justify-content: center; gap: 6px; color: #8fd3c7; font-size: .88rem; }
.fin-note svg { width: 15px; height: 15px; }
.fin-link { display: block; text-align: center; color: #b9aee0; font-size: .92rem; text-decoration: underline; text-underline-offset: 3px; padding: 4px 0 2px; }
.fin-link:hover { color: #e8e2f5; }
#savemail-slot:empty { display: none; }
.fin-save { display: flex; flex-direction: column; gap: 9px; padding: 12px; border-radius: 16px; background: rgba(255,255,255,.05); }
.fin-input { width: 100%; box-sizing: border-box; height: 48px; padding: 0 16px; border-radius: 14px; border: 1.5px solid rgba(255,255,255,.2);
  background: #fffaf3; color: #2b2440; font: 1rem 'Trebuchet MS', 'Segoe UI', sans-serif; margin: 0; }
.fin-opt { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.4; color: #b9aee0; text-align: left; cursor: pointer; }
.fin-opt input { margin-top: 2px; flex: none; }
.fin-opt b { color: #d9cffb; }
.fin-err { color: #ffb4a0; font-size: .88rem; text-align: center; }
.fin-title { color: #f1ecfb; font-weight: 700; font-size: 1.15rem; text-align: center; }
.fin-sub { color: #b9aee0; font-size: .9rem; text-align: center; margin-top: -4px; }

/* world pick (Oct 7): the tapped card answers at once; the others step back */
.worldcard { transition: transform .15s ease, box-shadow .15s ease, opacity .2s ease; }
#worldcards.picking .worldcard:not(.picked) { opacity: .45; }
.worldcard.picked { transform: scale(1.04); box-shadow: 0 0 0 4px var(--teal), 0 10px 26px rgba(10,6,24,.35); }

/* name check in progress (Oct 8): the Start button says what Obooga is doing */
#startbtn.busy { opacity: .85; cursor: progress; }
#startbtn .pencil { display: inline-block; animation: pencilwrite .5s ease-in-out infinite alternate; }
@keyframes pencilwrite { from { transform: translateX(-3px) rotate(-12deg); } to { transform: translateX(3px) rotate(8deg); } }
@media (prefers-reduced-motion: reduce) { #startbtn .pencil { animation: none; } }

/* Co-Author fallback offer on the name screen (Oct 8) */
.ca-offer { margin: 14px auto 0; max-width: 440px; padding: 14px; border-radius: 18px; background: #fff;
  border: 2px solid var(--paper-edge); box-shadow: 0 6px 18px rgba(43,36,64,.12); font-family: 'Trebuchet MS', 'Segoe UI', sans-serif; animation: fadein .3s ease; }
.ca-msg { display: flex; align-items: center; gap: 10px; text-align: left; }
.ca-msg img { width: 52px; height: auto; flex: none; }
.ca-msg p { margin: 0; font-size: 1rem; line-height: 1.4; color: var(--ink); }
.ca-msg .nw { white-space: nowrap; }
.ca-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.ca-row button { white-space: nowrap; height: 46px; border-radius: 999px; font: 600 .95rem/1.1 'Trebuchet MS', 'Segoe UI', sans-serif; cursor: pointer; padding: 0 10px; }
.ca-yes { background: var(--coral); color: #fff; border: 0; box-shadow: 0 4px 12px rgba(240,122,61,.3); }
.ca-no { background: transparent; color: var(--ink); border: 1.5px solid var(--paper-edge); }
@media (max-width: 380px) { .ca-row { grid-template-columns: 1fr; } }

/* ---------- story map trail (Oct 8): Obooga walks a path along the bottom of the book ---------- */
#trail { position: relative; z-index: 1; height: 46px; margin: 2px 6px 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#trail svg { position: absolute; inset: 0; overflow: visible; }
#trail .tp { position: absolute; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; border-radius: 50%; }
#trail .tp.done { width: 26px; height: 26px; background: #fff; box-shadow: 0 1px 4px rgba(43,36,64,.22); font-size: 13px; overflow: hidden; }
#trail .tp.done img { width: 100%; height: 100%; object-fit: cover; }
#trail .tp.next { width: 16px; height: 16px; background: #eadfc9; color: #a99c86; font: 700 10px/1 'Trebuchet MS', sans-serif; }
#trail .tp.end { width: 26px; height: 26px; font-size: 17px; }
#trail .tp.end.reached { animation: trailend 1s ease 2; }
#trail .me { position: absolute; top: 50%; width: 32px; height: 32px; margin-left: -16px; margin-top: -19px; border-radius: 50%;
  background: url(/icon-192.png) center/cover; box-shadow: 0 0 0 2px #fff, 0 3px 8px rgba(43,36,64,.3); transition: left .7s cubic-bezier(.4,1.4,.5,1); }
#trail .me.hop { animation: trailhop .5s ease; }
#trail .tip { position: absolute; bottom: 100%; transform: translate(-50%, -4px); background: #2b2440; color: #fff; font: 600 12px/1 'Trebuchet MS', sans-serif;
  padding: 6px 9px; border-radius: 8px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .2s; }
#trail .tip.on { opacity: 1; }
@keyframes trailhop { 40% { transform: translateY(-6px); } }
@keyframes trailend { 50% { transform: translate(-50%, -50%) scale(1.3); } }
@media (prefers-reduced-motion: reduce) { #trail .me { transition: none; } #trail .me.hop, #trail .tp.end.reached { animation: none; } }
/* with the trail, the page controls sit fully on the page, and the text keeps clear of them */
#bookframe.has-trail #pageind { display: none; }
#bookframe.has-trail #continue { bottom: 64px; }
#bookframe.has-trail .page:not(.cover) .pagetext { padding-bottom: 62px; }
