/* The stories demo: the story's stage, in place of the book (Zesty, 4 Dec 2026: like the Business page's example
   player, made for children). A deep violet card: "Starring" chips on the left, the line being spoken on the right
   with a little picture, and a rounded player bar under it. On a phone the chips sit above the line.
   Given: the player markup in index.html, filled in by stories-stage.js and run by stories-player.js.
   The chips glow as on the Life and Business pages (Zesty, 5 Dec 2026): the Starring panel is darker, the chips not
   being said are dimmed, and a chip being said is at full brightness, ringed in white with a halo of its own colour that
   pulses on one beat. It comes on quickly and fades slowly.
   Never: brown; a shape behind words (each word changes colour only); movement other than transform and opacity,
   apart from the chips' glow; any movement with "reduce motion". */

.player{max-width:none;margin:0;padding:26px 28px 22px;border-radius:34px;border:0;display:grid;gap:18px;color:#fff;
  background:radial-gradient(120% 90% at 0% 0%,#5b3fd6 0%,#3b2a9c 55%,#2c2178 100%);box-shadow:0 8px 0 #20185c,0 24px 50px rgba(44,33,120,.35)}
.player[hidden]{display:none}
.player-top{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.player-title{margin:0;display:inline-flex;align-items:center;gap:10px;font-family:var(--round);font-weight:900;font-size:22px;color:#ffd34d}
.player-title svg{width:24px;height:24px}
.player-for{margin:0;font-weight:900;font-size:16px;color:#ffc2e0}
.player-for:empty{display:none}
/* Download: a white pill, like the play button, at the top right */
.download{margin-left:auto;display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:8px 18px;border:0;border-radius:999px;
  background:#fff;color:#3b2a9c;font:inherit;font-weight:900;font-size:15px;cursor:pointer;box-shadow:0 4px 0 rgba(0,0,0,.18)}
.download svg{width:18px;height:18px}
.download:hover{background:#ffd34d}
.download:focus-visible{outline:3px solid #ffd34d;outline-offset:3px}
.download[disabled]{opacity:.6;cursor:progress}

.stage{display:grid;grid-template-columns:minmax(220px,300px) minmax(0,1fr);gap:24px;align-items:stretch}

/* Starring: a chip for each answer, each with its own colour. The panel is darker than the card, and the chips not
   being said are dimmed, so the one being said stands out (as on the Life page) */
.cast{background:rgba(12,6,48,.42);border-radius:26px;padding:18px 18px 20px;display:grid;align-content:start;gap:12px;
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.08)}
.cast-title{margin:0;font-size:13px;font-weight:900;letter-spacing:.14em;text-transform:uppercase;color:#d9d0ff}
.chips{display:grid;gap:10px}
.chip{--c:#ffd27a;--ink:#3a2410;--beat:0s}
.chip-title{margin:0 0 4px 4px;display:flex;align-items:center;gap:7px;font-size:12px;font-weight:900;letter-spacing:.12em;text-transform:uppercase;color:#d9d0ff}
.chip-title::before{content:"";width:9px;height:9px;border-radius:50%;background:var(--c)}
/* Off: dimmed by letting the dark panel show through (darkening the colours made the orange and coral look brown),
   and fading back slowly (about a second) after its words; on: quickly, in a fifth of a second */
.chip-value{position:relative;isolation:isolate;margin:0;padding:10px 14px;border-radius:16px;background:var(--c);color:var(--ink);
  font-weight:900;font-size:17px;line-height:1.25;text-align:center;opacity:.5;filter:saturate(.75);outline:3px solid transparent;
  outline-offset:2px;transition:opacity 1s ease,filter 1s ease,transform 1s ease,outline-color 1s ease}
/* The glow (a halo of the chip's own colour) and the white fill that swells with each beat, both under the words */
.chip-value::before,.chip-value::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;opacity:0;
  transition:opacity 1s ease}
.chip-value::before{z-index:-1;background:#fff}
.chip-value::after{z-index:-2;box-shadow:0 0 22px 6px var(--c)}
.chip.is-lit .chip-value{opacity:1;filter:none;transform:scale(1.05);outline-color:#fff;transition-duration:.2s}
.chip.is-lit .chip-value::after{opacity:1;transition-duration:.2s;animation:chipHalo 1.6s ease-in-out var(--beat) infinite}
.chip.is-lit .chip-value::before{animation:chipFill 1.6s ease-in-out var(--beat) infinite}
.chips.is-paused .chip-value::before,.chips.is-paused .chip-value::after{animation-play-state:paused}
@keyframes chipHalo{0%,100%{box-shadow:0 0 14px 3px var(--c)}50%{box-shadow:0 0 34px 11px var(--c)}}
@keyframes chipFill{0%,100%{opacity:0}50%{opacity:.4}}
.chip-name{--c:#ffc46b;--ink:#3b2200}
.chip-age{--c:#7fe0b6;--ink:#063b27}
.chip-looks{--c:#ff9fd2;--ink:#4a0d2f}
.chip-wears{--c:#8fd3ff;--ink:#062c46}
.chip-habit{--c:#c9a9ff;--ink:#28124f}
.chip-toy{--c:#ffe57a;--ink:#3d3000}
.chip-place{--c:#bfe9ef;--ink:#0b3940}
.chip-landmark{--c:#c8f07c;--ink:#233600}
.chip-learn{--c:#ff9e8f;--ink:#4d0f06}

/* The scene: a little picture, who is speaking, the line, then the player bar */
.scene{display:flex;flex-direction:column;gap:16px;min-width:0}
.scene-head{display:flex;align-items:center;gap:16px}
.scene-pic{flex:none;width:150px;height:110px;border-radius:18px;overflow:hidden;background:rgba(255,255,255,.12)}
.scene-pic svg{display:block;width:100%;height:100%}
.scene-who{margin:0;display:inline-block;padding:6px 14px;border-radius:999px;background:rgba(255,255,255,.14);font-weight:900;font-size:16px;color:#fff}
.scene-who:empty{display:none}
.scene-who[data-who=fairy]{color:#ffc2e0}
.scene-who[data-who=new-york]{color:#9fe6ff}
.scene-line{margin:0;flex:1;min-height:6.2em;display:block;font-weight:900;font-size:clamp(22px,3vw,30px);line-height:1.35;color:#fff;text-wrap:pretty}
.scene-line.waiting{color:#d9d0ff}
/* Each word: dim until it's said, then white; the child's own words always in their chip's colour */
.scene-line .w{color:rgba(255,255,255,.45);transition:color .12s linear}
.scene-line .w.said{color:#fff}
.scene-line .own{color:#ffc46b}
.scene-line .own-age{color:#7fe0b6}
.scene-line .own-looks{color:#ff9fd2}
.scene-line .own-wears{color:#8fd3ff}
.scene-line .own-habit{color:#c9a9ff}
.scene-line .own-toy{color:#ffe57a}
/* A story moment's words (stories-moments.js) turn their chip's colour as they're said */
.scene-line .w.said.tag-place{color:#bfe9ef}
.scene-line .w.said.tag-landmark{color:#c8f07c}
.scene-line .w.said.tag-learn{color:#ff9e8f}

/* The player bar: a white play button, the progress and the time, in a rounded bar */
.player .player-controls{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:16px;align-items:center;padding:10px 20px 10px 10px;
  border-radius:999px;background:rgba(255,255,255,.12);border:2px solid rgba(255,255,255,.18)}
.player .play{width:62px;height:62px;background:#fff;color:#3b2a9c;box-shadow:0 4px 0 rgba(0,0,0,.18)}
.player .play:focus-visible{outline:3px solid #ffd34d;outline-offset:3px}
.player #seek{accent-color:#ffc46b}
.player .time{color:#e9e4ff}
.player .player-error{color:#ffc2c2}
.player .link-button{color:#ffd34d}
.player .link-button:focus-visible{outline-color:#ffd34d}

@media (max-width:720px){
  .player{padding:20px 16px 18px;border-radius:28px}
  .stage{grid-template-columns:minmax(0,1fr);gap:16px}
  .chips{grid-template-columns:repeat(2,minmax(0,1fr))}
  .chip-value{font-size:15px;padding:8px 10px}
  .scene-pic{width:110px;height:81px}
  .scene-line{min-height:7.5em}
  .player .player-controls{gap:10px;padding-right:14px}
}
@media (prefers-reduced-motion:reduce){
  .chip-value,.chip-value::before,.chip-value::after,.scene-line .w{transition:none}
  .chip.is-lit .chip-value{transform:none}
  .chip.is-lit .chip-value::before,.chip.is-lit .chip-value::after{animation:none}
}
