/* The stories demo page (3 Dec 2026, rebuilt 4 Dec 2026 from the approved mock-up): the page, the form card and its
   steps, the in-between screen, the player and the owl's name check.
   Given: index.html in this folder. The scene at the top has its own file, stories-scene.css; the player's stage has
   stories-stage.css.
   Gives back: a light page in every viewing mode (no automatic dark version); a white form card with a bold lilac
   border, sitting over the bottom of the grass; one step showing at a time (stories-steps.js), with a blue
   in-between screen over the card for a few seconds; bold, colourful controls (balloons for the age, pills for the
   choices, postcards for the places, a big gradient Create button with a twinkling star).
   Never: a font from outside the site (or the one ruled out on 23 Nov 2026), brown, a shape behind words to
   highlight them (colour only), or movement other than transform and opacity; nothing moves with "reduce motion". */

@font-face{font-family:"Nunito";font-style:normal;font-weight:700;font-display:swap;src:url(/fonts/nunito-latin-700-normal.woff2) format("woff2")}
@font-face{font-family:"Nunito";font-style:normal;font-weight:900;font-display:swap;src:url(/fonts/nunito-latin-900-normal.woff2) format("woff2")}

:root{
  color-scheme:light;
  --ink:#2a2350;--muted:#5d5880;--line:#cbbcff;
  --pink:#f0559b;--deep-pink:#d63384;--violet:#7c4dff;--deep-violet:#5b34d6;--teal:#13a3a8;
  --error:#b3124e;
  --round:"Nunito",ui-rounded,"SF Pro Rounded",-apple-system,BlinkMacSystemFont,system-ui,sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;background:#fffaf2;color:var(--ink)}
html{overflow-x:clip}
body{font-family:var(--round);font-weight:700;font-size:16px;line-height:1.5;-webkit-font-smoothing:antialiased}
.sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* ---------- The form card ---------- */
.maker{position:relative;z-index:5;margin:-36px auto 60px;max-width:620px;padding:0 14px}
.card{position:relative;background:#fff;border-radius:30px;padding:26px 26px 24px;border:3px solid #e4dbff;
  box-shadow:0 8px 0 #e4dbff,0 24px 50px rgba(91,52,214,.14)}
.card[hidden]{display:none}

/* Where they are: "Step 2 of 8" and a star per step, lit as they go */
.progress{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:0 64px 16px 0;font-weight:900;font-size:14px;color:var(--muted);letter-spacing:.02em}
.stars{display:inline-flex;gap:5px}
.stars i{width:14px;height:14px;background:#e4dbff;clip-path:polygon(50% 0,62% 36%,100% 38%,70% 60%,80% 100%,50% 76%,20% 100%,30% 60%,0 38%,38% 36%);transition:transform .25s}
.stars i.done{background:#3fbf7f}           /* done: green (Zesty, 4 Dec 2026: red looked like something wrong) */
.stars i.now{background:#ffc83d;transform:scale(1.35)}   /* this step: yellow */

/* One step at a time */
.step{display:grid;gap:12px;min-width:0;outline:none}
.step[hidden]{display:none}
.step.arrive{animation:arrive .45s cubic-bezier(.3,1.4,.5,1)}
@keyframes arrive{from{opacity:0;transform:translateY(14px) scale(.98)}}
.q{margin:0;padding:0;border:0;min-width:0;display:grid;gap:12px}
.q-title{display:block;margin:0;padding:0 40px 0 0;font-weight:900;font-size:clamp(21px,4.6vw,25px);line-height:1.2;color:var(--ink)}
.q-sub{display:block;margin:6px 0 0;padding:0;font-weight:900;font-size:19px;color:var(--ink)}
.optional{font-weight:700;font-size:14px;color:var(--muted)}
.note{margin:0;font-size:14.5px;color:var(--muted)}
.error{margin:0;font-size:15px;font-weight:900;color:var(--error)}
.error:empty{display:none}

/* Text boxes: big, violet, friendly */
input[type=text]{width:100%;font:inherit;font-weight:900;font-size:24px;color:var(--deep-violet);background:#f7f3ff;
  border:3px solid var(--line);border-radius:18px;padding:12px 18px;min-height:62px;outline:none}
input[type=text]::placeholder{color:#a69dc8;font-weight:700}
input[type=text]:focus{border-color:var(--violet);box-shadow:0 0 0 5px #e7deff;background:#fff}
input[aria-invalid=true]{border-color:var(--error)}
.sounds{display:grid;gap:6px}
.sounds[hidden]{display:none}
.sounds label{font-weight:900;font-size:16px}
.sounds input[type=text]{font-size:20px;min-height:54px}
.link-button{justify-self:start;padding:4px 2px;min-height:44px;font:inherit;font-size:15px;font-weight:900;color:var(--deep-violet);
  background:none;border:0;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.link-button:focus-visible{outline:3px solid var(--violet);outline-offset:2px;border-radius:8px}

/* The name's letters popping up as coloured tiles */
.letters{display:flex;gap:6px;flex-wrap:wrap}
.letters:empty{display:none}
.letters span{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:10px;font-weight:900;color:#fff;font-size:17px;
  animation:pop .35s cubic-bezier(.3,1.6,.5,1)}
@keyframes pop{from{transform:scale(0) rotate(-20deg)}}

/* The spider dangling from the top of the card; a little hop when they type */
.spider{position:absolute;right:30px;top:-14px;width:40px;transform-origin:50% 0;animation:dangle 3.2s ease-in-out infinite;z-index:2;pointer-events:none}
.spider svg{display:block;width:100%;height:auto;overflow:visible}
@keyframes dangle{0%,100%{transform:translateY(0) rotate(-4deg)}50%{transform:translateY(8px) rotate(4deg)}}
.spider.hop{animation:hop .5s ease-out}
@keyframes hop{0%{transform:translateY(0)}40%{transform:translateY(-12px) rotate(-8deg)}100%{transform:translateY(0)}}

/* Age: four bobbing balloons */
.balloons{display:flex;gap:16px;flex-wrap:wrap;padding-top:12px}
.balloon{position:relative;cursor:pointer;padding-bottom:22px}
.balloon input{position:absolute;opacity:0;width:1px;height:1px}
.balloon span{position:relative;display:grid;place-items:center;width:62px;height:74px;border-radius:50% 50% 46% 46%;font-weight:900;font-size:28px;color:#fff;
  background:var(--b);box-shadow:inset -8px -10px 0 rgba(0,0,0,.08);animation:bob 3s ease-in-out infinite alternate;transition:transform .2s}
.balloon:nth-child(2) span{animation-delay:-1s}.balloon:nth-child(3) span{animation-delay:-2s}.balloon:nth-child(4) span{animation-delay:-.5s}
.balloon span::after{content:"";position:absolute;left:50%;top:76px;width:2px;height:22px;background:#c9c2e0}
@keyframes bob{to{transform:translateY(-6px)}}
.balloon input:checked+span{animation:none;transform:scale(1.18);outline:4px solid #fff;box-shadow:0 0 0 7px var(--b),inset -8px -10px 0 rgba(0,0,0,.08)}
.balloon input:focus-visible+span{outline:3px solid var(--violet);outline-offset:4px}

/* Pills for the choices */
.pills{display:flex;flex-wrap:wrap;gap:9px}
.pill{position:relative;cursor:pointer}
.pill input{position:absolute;opacity:0;width:1px;height:1px}
.pill span{display:inline-flex;align-items:center;gap:8px;min-height:48px;padding:0 16px;border-radius:999px;border:3px solid #d9d1f2;
  background:#fff;font-weight:900;font-size:16px;transition:transform .15s}
.pill input:checked+span{border-color:var(--deep-pink);background:#fff0f7;transform:scale(1.05) rotate(-1.5deg)}
.pill input:disabled+span{opacity:.4;cursor:default}
.pill input:focus-visible+span{outline:3px solid var(--violet);outline-offset:2px}
.ico{flex:none;width:26px;height:26px}
.pill-note{margin-top:-4px}

/* Places, as postcards; the ones still to come are stamped "Coming soon" */
.places{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.postcard{position:relative;cursor:pointer}
.postcard input{position:absolute;opacity:0;width:1px;height:1px}
.postcard span{display:flex;align-items:center;gap:12px;min-height:76px;padding:10px 14px;border-radius:18px;border:3px solid #bfe7ea;background:#f3fcfc;
  font-weight:900;font-size:17px}
.postcard input:checked+span{border-color:var(--teal);background:#e2f8f8;box-shadow:0 4px 0 #9edfe2}
.postcard input:focus-visible+span{outline:3px solid var(--violet);outline-offset:2px}
.postcard.soon{cursor:default}
.postcard.soon span{border-style:dashed;background:#f6f5fa;border-color:#cfc9e2;color:#7c7699}
.postcard .stamp{margin-left:auto;font-style:normal;font-size:12px;font-weight:900;color:var(--deep-pink);border:2px solid var(--deep-pink);border-radius:8px;padding:2px 7px;transform:rotate(6deg)}
.postcard svg{flex:none;width:40px;height:48px}

/* Create: big, gradient, with a twinkling star */
.ts-box:empty{display:none}
.create{font:inherit;font-weight:900;font-size:24px;color:#fff;border:0;border-radius:999px;min-height:68px;cursor:pointer;margin-top:6px;
  background:linear-gradient(95deg,#ff7a59,var(--pink) 40%,var(--violet));box-shadow:0 6px 0 #4a2bc2,0 16px 30px rgba(124,77,255,.3);
  display:inline-flex;align-items:center;justify-content:center;gap:10px;transition:transform .12s}
.create svg{width:26px;height:26px;animation:twinkle 1.6s ease-in-out infinite}
@keyframes twinkle{50%{transform:scale(.7) rotate(30deg)}}
.create:active{transform:translateY(3px)}
.create:focus-visible{outline:3px solid var(--violet);outline-offset:3px}
.form-message{margin:0;text-align:center;font-weight:900;color:var(--deep-violet)}
.form-message:empty{display:none}

/* Back and Next under each step; Next says "Skip" on an optional step with nothing picked */
.step-nav{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:20px}
.step-nav .back{font:inherit;font-weight:900;font-size:16px;color:var(--deep-violet);background:#fff;border:3px solid var(--line);border-radius:999px;min-height:50px;padding:0 20px;cursor:pointer}
.step-nav .next{margin-left:auto;font:inherit;font-weight:900;font-size:19px;color:#fff;border:0;border-radius:999px;min-height:56px;padding:0 30px;cursor:pointer;
  background:linear-gradient(95deg,var(--deep-pink),var(--deep-violet));box-shadow:0 4px 0 #4a2bc2}
.step-nav .next.skip{background:#fff;color:var(--deep-violet);border:3px solid var(--line);box-shadow:none}
.step-nav button[hidden]{display:none}
.step-nav button:focus-visible{outline:3px solid var(--violet);outline-offset:3px}
.step-nav .next:active{transform:translateY(2px)}

/* ---------- The in-between screen: a visitor from the sky and a funny message ---------- */
.card.cheering{overflow:hidden}
.cheer{position:absolute;inset:0;z-index:6;border-radius:27px;display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:26px 24px;text-align:center;color:#fff;cursor:pointer;
  background:radial-gradient(120% 90% at 50% 0%,#8fd0f6 0%,#5fb8f0 55%,#4a9fe0 100%)}
.cheer[hidden]{display:none}
.cheer.show{animation:cheerIn .35s ease-out}
@keyframes cheerIn{from{opacity:0;transform:scale(.96)}}
.cheer-pal{width:86px;height:70px;display:grid;place-items:center;margin-bottom:18px;animation:palBob 1.4s ease-in-out infinite alternate}
.cheer-pal svg{display:block;width:100%;height:100%;overflow:visible}
@keyframes palBob{from{transform:translateY(-6px) rotate(-6deg)}to{transform:translateY(6px) rotate(6deg)}}
.cheer-big{margin:0 0 10px;font-weight:900;font-size:clamp(28px,6vw,40px);line-height:1.1;text-shadow:0 3px 0 #5b34d6;max-width:18ch;text-wrap:balance}
.cheer-small{margin:0;font-weight:900;font-size:clamp(17px,3.6vw,20px);line-height:1.4;max-width:30ch;text-shadow:0 2px 0 rgba(91,52,214,.5);text-wrap:balance}
.cheer-bar{width:min(240px,70%);height:8px;margin-top:24px;border-radius:99px;background:rgba(255,255,255,.35);overflow:hidden}
.cheer-bar i{display:block;height:100%;width:100%;border-radius:99px;transform-origin:0 50%;transform:scaleX(0);
  background:linear-gradient(90deg,#ff7aa8,#ffd34d,#b892ff)}
.cheer.show .cheer-bar i{animation:fill var(--cheer-ms,3200ms) linear forwards}
@keyframes fill{to{transform:scaleX(1)}}
.cheer-skip{margin:10px 0 0;font-size:13px;font-weight:900;color:rgba(255,255,255,.85)}

@media (max-width:520px){
  .places{grid-template-columns:1fr}
  .card{padding:22px 18px 20px}
  .spider{right:16px}
  .balloons{gap:12px}
}
@media (prefers-reduced-motion:reduce){
  .maker *{animation:none!important;transition:none!important}
  .cheer .cheer-bar i{transform:scaleX(1)}
}

/* ---------- The simple story player (4 Dec 2026): a bold card under the form ---------- */
.player{max-width:560px;margin:28px auto 0;padding:22px 24px;border-radius:30px;border:3px solid #e4dbff;
  background:#fff;box-shadow:0 8px 0 #e4dbff,0 24px 50px rgba(91,52,214,.14);display:grid;gap:12px}
.player[hidden]{display:none}
.player-title{margin:0;font-family:var(--round);font-weight:900;font-size:24px;color:var(--deep-violet)}
.player-for{margin:-6px 0 0;font-weight:700;color:var(--deep-pink)}
.player-for:empty{display:none}
.player-controls{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:14px;align-items:center}
.play{width:60px;height:60px;border-radius:50%;border:0;cursor:pointer;display:grid;place-items:center;color:#fff;
  background:linear-gradient(140deg,var(--deep-pink),var(--deep-violet));box-shadow:0 3px 0 #4a2bc2}
.play:focus-visible{outline:3px solid var(--violet);outline-offset:3px}
.play svg{width:26px;height:26px;fill:currentColor}
.play .icon-pause,.player.is-playing .play .icon-play{display:none}
.player.is-playing .play .icon-pause{display:block}
#seek{width:100%;accent-color:var(--deep-pink);min-height:44px}
.time{font-variant-numeric:tabular-nums;font-weight:700;color:var(--muted);font-size:14.5px}
.player-error{margin:0;font-weight:600;color:var(--error)}
.player-error:empty{display:none}
.player .link-button{justify-self:start;margin:0}

/* ---------- The name check (4 Dec 2026): an owl's speech bubble, as in the mock-up ---------- */
.name-check{display:flex;align-items:flex-start;gap:12px;margin-top:14px}
.name-check[hidden]{display:none}
.name-check .owl{flex:none;width:60px;height:66px}
.bubble{position:relative;flex:1;min-width:0;background:#fff3c4;border:3px solid #ffd34d;border-radius:20px;padding:12px 16px}
.bubble::before{content:"";position:absolute;left:-12px;top:20px;border:9px solid transparent;border-right-color:#ffd34d;border-left:0}
.bubble p{margin:0 0 10px;font-family:var(--round);font-weight:800;font-size:17px;line-height:1.35;color:var(--ink)}
.bubble b{color:var(--deep-pink)}
.nc-row{display:flex;flex-wrap:wrap;gap:8px}
.nc-btn{font:inherit;font-family:var(--round);font-weight:900;font-size:15.5px;border:0;border-radius:999px;padding:10px 16px;min-height:44px;cursor:pointer;
  display:inline-flex;align-items:center;gap:7px}
.nc-btn[hidden]{display:none}
.nc-btn:focus-visible{outline:3px solid var(--violet);outline-offset:2px}
.nc-btn.hear{background:var(--deep-violet);color:#fff}.nc-btn.hear[disabled]{opacity:.6;cursor:default}
.nc-btn.yes{background:#1f9d5c;color:#fff;box-shadow:0 3px 0 #157144}
.nc-btn.no{background:#fff;color:var(--deep-pink);border:2.5px solid #f6a8c9}
.name-check.is-approved .bubble{background:#e3f8ec;border-color:#1f9d5c}.name-check.is-approved .bubble::before{border-right-color:#1f9d5c}
.nc-note{margin:8px 0 0!important;font-size:15px!important;font-weight:700!important;color:var(--deep-violet)!important}
.nc-note:empty{display:none}


/* Once the story shows, the form steps aside and the book has room to open (stories-steps.js, 4 Dec 2026) */
.maker.has-story{max-width:940px}
.maker.has-story .player{margin-top:0}
.name-check{margin-top:2px}

/* Wider and a little bigger on a laptop (Zesty, 4 Dec 2026: "unnecessarily small when we've got so much space") */
@media (min-width:760px){
  .maker{max-width:860px}
  .card{padding:34px 42px 30px}
  .progress{font-size:15px}
  .q-title{font-size:30px}
  .q-sub{font-size:22px}
  .note{font-size:16px}
  input[type=text]{font-size:28px;min-height:72px;padding:14px 22px}
  .sounds input[type=text]{font-size:23px;min-height:60px}
  .pills{gap:11px}
  .pill span{min-height:56px;padding:0 20px;font-size:18px}
  .balloons{gap:22px}
  .balloon span{width:72px;height:86px;font-size:32px}
  .balloon span::after{top:88px}
  .postcard span{min-height:88px;font-size:19px}
  .create{font-size:27px;min-height:76px}
  .step-nav .back{font-size:18px;min-height:56px;padding:0 24px}
  .step-nav .next{font-size:21px;min-height:62px;padding:0 36px}
}

/* Age, then girl or boy: room between the two questions, with room between them (Zesty, 4 Dec 2026: "very crowded") */
.step[data-step=age] .q + .q{margin-top:26px}

/* One size for the card, whatever the step or the answers (Zesty, 4 Dec 2026: "make sure the boxes are fixed sizes"):
   each step fills the space, Back and Next stay at the bottom, and a message that comes and goes moves nothing */
.story-form{display:flex;flex-direction:column;min-height:680px}
.story-form .step:not([hidden]){flex:1;align-content:start}
@media (min-width:760px){.story-form{min-height:600px}}
