/* Story player: frames + one voice clip per line, speech bubble over the speaker, read-along highlight. */
.sp{max-width:760px;margin:0 auto;padding:6px 0 28px;text-align:center;user-select:none;-webkit-user-select:none}
.sp h1{font-size:30px;margin:4px 0 2px}.sp .sp-sub{margin:0 0 10px;color:var(--muted)}
.sp-stage{position:relative;container-type:inline-size;width:min(100%,calc((100svh - 300px) * 9 / 16));min-width:260px;aspect-ratio:9/16;margin:0 auto;border-radius:26px;overflow:hidden;background:#bfe3f5;box-shadow:0 6px 0 #6b422618,0 10px 30px #6b42261f}
.sp-img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity .7s ease;transform-origin:50% 60%;will-change:transform}
.sp-img.on{opacity:1}
.sp-img.kb1{animation:sp-kb1 14s ease-out forwards}.sp-img.kb2{animation:sp-kb2 14s ease-out forwards}
/* gentle straight zoom only (owner 2026-11-20: the sideways pan read as the picture shifting left and right) */
@keyframes sp-kb1{from{transform:scale(1)}to{transform:scale(1.035)}}
@keyframes sp-kb2{from{transform:scale(1.035)}to{transform:scale(1)}}
.sp-open{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0;pointer-events:none;transform-origin:50% 60%;z-index:1;will-change:transform}
.sp-open.kb1{animation:sp-kb1 14s ease-out forwards}.sp-open.kb2{animation:sp-kb2 14s ease-out forwards}
.sp-memory::after{content:"";position:absolute;inset:0;pointer-events:none;background:radial-gradient(ellipse at center,transparent 55%,#fff8eecc 100%)}
/* bubble: cream box, speaker-coloured outline, name tab fused on top (approved TAIL-FUSED style), tail down toward the speaker */
.sp-bubble{position:absolute;top:3%;left:50%;width:74%;transform:translate(-50%,8px) scale(.96);opacity:0;transition:opacity .25s ease,transform .25s ease;pointer-events:none;z-index:3}
.sp-bubble.on{opacity:1;transform:translate(-50%,0) scale(1)}
.sp-box{position:relative;background:#fff8eef2;border:3px solid var(--c,#4A9BC9);border-radius:20px;padding:10px 14px 9px;margin-top:24px;direction:rtl}
.sp-tab{position:absolute;top:-24px;right:20px;height:24px;box-sizing:border-box;background:var(--c,#4A9BC9);color:#fff;font:800 14px/1 Baloo,sans-serif;padding:5px 12px 0;border-radius:14px 14px 0 0;display:flex;align-items:flex-start}
/* concave fillets so the tab flows into the bubble's border (approved TAIL-FUSED style) */
.sp-tab::before,.sp-tab::after{content:"";position:absolute;bottom:0;width:12px;height:12px}
.sp-tab::before{left:-12px;background:radial-gradient(circle at 0 0,transparent 11.5px,var(--c,#4A9BC9) 12px)}
.sp-tab::after{right:-12px;background:radial-gradient(circle at 100% 0,transparent 11.5px,var(--c,#4A9BC9) 12px)}
.sp-text{margin:0;font:800 clamp(14px,5.2cqw,22px)/1.5 Baloo,sans-serif;color:#6b4226}
.sp-text.in{animation:sp-in .3s ease}@keyframes sp-in{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
.sp-text span{transition:color .15s}.sp-text span.said{color:var(--c,#4A9BC9)}
.sp-bubble:not(.think) .sp-tail{display:none}
.sp-tail{position:absolute;bottom:-18px;width:0;height:0;border:12px solid transparent;border-top:16px solid var(--c,#4A9BC9);margin-left:-12px}
.sp-tail::after{content:"";position:absolute;left:-8px;top:-17px;border:8px solid transparent;border-top:11px solid #fff8ee}
.sp-bubble.think .sp-box{border-style:dashed;border-radius:40px}
.sp-bubble.think .sp-tail{border:0;width:16px;height:16px;border-radius:50%;background:#fff8ee;box-shadow:0 0 0 4px var(--c,#4A9BC9);bottom:-34px}
.sp-bubble.think .sp-tail::after{left:6px;top:22px;width:9px;height:9px;border:0;border-radius:50%;background:#fff8ee;box-shadow:0 0 0 3px var(--c,#4A9BC9)}
/* start / choice / end overlays */
.sp-over{position:absolute;inset:0;display:none;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:18px;z-index:5;background:#fff8eecc;backdrop-filter:blur(2px)}
.sp-over.on{display:flex}
.sp-over h2{margin:0;font-size:clamp(24px,6vw,34px);color:#6b4226}
.sp-over p{margin:0;font-weight:700;color:#6b4226;font-size:18px}
.sp-btn{border:0;border-radius:99px;background:#c8501b;color:#fff;font:800 20px Baloo,sans-serif;padding:12px 28px;box-shadow:0 4px 0 #9b3b11;cursor:pointer}
.sp-btn.alt{background:#4A9BC9;box-shadow:0 4px 0 #2f6f93}
.sp-btn.big{font-size:26px;padding:14px 34px;display:inline-flex;align-items:center;gap:10px}.sp-btn svg{width:26px;height:26px;fill:currentColor}
.sp-start{background:linear-gradient(#fff8ee00 30%,#fff8eeee 70%)}
.sp-start{justify-content:flex-end;padding-bottom:12%}
.sp-opts{display:flex;flex-direction:column;gap:10px;width:min(100%,320px)}
.sp-opt{border:3px solid #bfe3f5;border-radius:20px;background:#fff;font:800 20px Baloo,sans-serif;color:#6b4226;padding:12px;cursor:pointer;box-shadow:0 4px 0 #6b42261a}
.sp-opt.no{border-color:#f4a6a6;animation:sp-shake .35s}.sp-opt.yes{border-color:#7cc47c;background:#eaf7ea}
@keyframes sp-shake{25%{transform:translateX(-6px)}75%{transform:translateX(6px)}}
.sp-reply{min-height:28px}
/* controls */
.sp-bar{display:flex;align-items:center;justify-content:center;gap:10px;margin:12px auto 6px}
.sp-ctl{width:52px;height:52px;border-radius:50%;border:0;background:#fff;box-shadow:0 4px 0 #6b42261a;cursor:pointer;color:#6b4226;display:grid;place-items:center;padding:0}.sp-ctl svg{width:24px;height:24px;fill:currentColor;display:block}.sp-ctl.main svg{width:30px;height:30px}
.sp-ctl.main{width:64px;height:64px;background:#c8501b;color:#fff;box-shadow:0 4px 0 #9b3b11;font-size:26px}
.sp-ctl[aria-pressed="true"]{background:#bfe3f5}
.sp-dots{display:flex;flex-wrap:wrap;justify-content:center;gap:6px;max-width:min(92vw,420px);margin:6px auto 0;direction:rtl}
.sp-dots b{width:10px;height:10px;border-radius:50%;background:#f1e3cf}.sp-dots b.on{background:#4A9BC9}.sp-dots b.cur{background:#c8501b;transform:scale(1.3)}
.sp-note{font-size:13px;color:var(--muted);margin-top:10px}

@media (min-width:900px){
  .sp{max-width:1040px;display:grid;grid-template-columns:auto minmax(260px,360px);column-gap:48px;justify-content:center;text-align:center;
      grid-template-areas:"back back" "stage ." "stage h1" "stage sub" "stage bar" "stage dots" "stage note" "stage .";grid-template-rows:auto 1fr auto auto auto auto auto 1fr}
  .sp>.g-back{grid-area:back}.sp h1{grid-area:h1;font-size:32px;margin:0}.sp .sp-sub{grid-area:sub;margin:4px 0 16px}
  .sp-stage{grid-area:stage;width:calc((100svh - 150px) * 9 / 16);max-width:620px;margin:0}
  .sp-bubble{width:62%;top:2.5%}.sp-box{padding:8px 12px 7px}
  .sp-bar{grid-area:bar;margin:0 auto}.sp-dots{grid-area:dots;margin-top:14px}.sp-note{grid-area:note}
}
