/* =====================================================================
   THE THEATER — City of Creativity world
   The stage fills the left, the felt card guides on the right
   (stage on top, card below on phones). Every child's choice changes the stage.
   ===================================================================== */
html, body { height: 100%; }
body { margin: 0; background: var(--cb-walnut); color: var(--cb-ivory); font-family: var(--cb-body); }
* { box-sizing: border-box; }
img { max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; }

.world { display: grid; grid-template-columns: minmax(0,1fr) minmax(340px, 440px); height: 100%; }
.scene { position: relative; overflow: hidden; container-type: size; min-height: 0; display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 45%, #2c1b10, #120a05 75%); }
.stagebox { position: relative; width: min(100cqw, calc(100cqh * 16 / 9)); aspect-ratio: 16 / 9; overflow: hidden; border-radius: 6px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.8); container-type: inline-size; touch-action: manipulation; }
.stagebox .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; max-width: none; transition: opacity .7s ease, transform 1.4s cubic-bezier(.45,0,.2,1), filter .8s ease; }
.stagebox .bg.off { opacity: 0; }
.stagebox .bg.quick { transition: opacity .28s linear; }
.stagebox .bg.slow { transition: opacity 1.4s ease; }
.stagebox.zoom .bg:not(.off) { transform: scale(1.9); transform-origin: var(--zx, 50%) var(--zy, 50%); opacity: 0; transition: transform 1.2s cubic-bezier(.5,0,.2,1), opacity 1.1s ease .2s; }
.stagebox.house-dim .bg { filter: brightness(.72) saturate(.95); }
.stagebox.dark .bg { filter: brightness(.18); }

/* Painted set flat that lowers onto the stage */
.flat { position: absolute; left: 50%; top: 12%; width: 19%; aspect-ratio: 1 / 1.22; transform: translate(-50%, -140%); opacity: 0;
  transition: transform 1.1s cubic-bezier(.3,1.25,.5,1), opacity .5s ease; border-radius: 6px; z-index: 2;
  background: var(--flat) center / cover no-repeat, #e8dcc2;
  box-shadow: 0 0 0 4px #f1e8d4, 0 0 0 6px rgba(185,132,28,.9), 0 14px 26px -8px rgba(0,0,0,.75); }
.flat::before { content: ""; position: absolute; left: 18%; right: 18%; top: -60%; height: 60%; border-left: 2px solid rgba(214,190,150,.7); border-right: 2px solid rgba(214,190,150,.7); }
.flat.on { transform: translate(-50%, 0); opacity: 1; }
.flat .flat-name { position: absolute; left: 6%; right: 6%; bottom: 6%; padding: 6px 8px; text-align: center; border-radius: 8px;
  background: #f8f3e7; color: #071a3d; font: max(9px, 1.6cqw)/1.1 var(--cb-hand); box-shadow: inset 0 0 0 2px rgba(185,132,28,.7); }

/* Emotion lighting */
.light { position: absolute; inset: 0; pointer-events: none; z-index: 3; opacity: 0; transition: opacity 1s ease, background 1s ease; mix-blend-mode: soft-light; }
.light.on { opacity: 1; }
.light.mood-hopeful { background: radial-gradient(60% 70% at 50% 35%, rgba(255,200,90,.95), rgba(255,170,60,.35) 60%, transparent); mix-blend-mode: overlay; }
.light.mood-worried { background: linear-gradient(rgba(140,165,215,.85), rgba(110,135,190,.8)); mix-blend-mode: multiply; }
.light.mood-angry { background: linear-gradient(90deg, rgba(220,60,30,.85), rgba(160,30,20,.3) 55%, rgba(60,10,10,.5)); mix-blend-mode: overlay; }
.light.mood-sad { background: linear-gradient(rgba(120,150,225,.9), rgba(95,120,200,.85)); mix-blend-mode: multiply; }
.light.mood-surprised { background: radial-gradient(22% 46% at 50% 58%, rgba(255,250,230,.9), rgba(0,0,0,.65) 70%); mix-blend-mode: overlay; }
.light.mood-afraid { background: radial-gradient(40% 40% at 70% 10%, rgba(235,235,255,.9), transparent 60%), linear-gradient(rgba(150,120,220,.9), rgba(115,95,195,.9)); mix-blend-mode: multiply; }
.light.mood-curious { background: radial-gradient(26% 50% at 50% 60%, rgba(255,215,140,.85), rgba(20,40,30,.55) 75%); mix-blend-mode: overlay; }
.light.mood-excited { background: radial-gradient(70% 80% at 50% 40%, rgba(255,220,110,1), rgba(255,160,60,.5) 70%); mix-blend-mode: overlay; }
.light.mood-caring { background: radial-gradient(60% 70% at 50% 45%, rgba(255,160,170,.9), rgba(230,120,140,.35) 70%); mix-blend-mode: overlay; }

/* Actors: characters + props on the stage. Positions are percentages of the stage. */
.actors { position: absolute; inset: 0; z-index: 4; }
.actor { position: absolute; transform: translate(-50%, -100%); transition: left .9s cubic-bezier(.4,0,.2,1), top .9s ease, opacity .6s ease; filter: drop-shadow(0 .6cqw .5cqw rgba(0,0,0,.55)); }
.actor.hidden { opacity: 0; }
.actor .fig, .actor > img { display: block; height: 100%; width: auto; }
.actor.enter-l { animation: enterL 1.1s cubic-bezier(.3,.8,.3,1) both; }
.actor.enter-r { animation: enterR 1.1s cubic-bezier(.3,.8,.3,1) both; }
.actor.step { animation: stepFwd .7s ease both; }
.actor.bow { animation: bow 1.2s ease both; }
.actor.talk .fig, .actor.talk > img { animation: talk .5s ease-in-out 2; transform-origin: 50% 100%; }
@keyframes enterL { from { transform: translate(-50%, -100%) translateX(-28cqw); } 60% { transform: translate(-50%, -103%) translateX(-4cqw); } to { transform: translate(-50%, -100%); } }
@keyframes enterR { from { transform: translate(-50%, -100%) translateX(28cqw); } 60% { transform: translate(-50%, -103%) translateX(4cqw); } to { transform: translate(-50%, -100%); } }
@keyframes stepFwd { from { transform: translate(-50%, -96%) scale(.9); opacity: 0; } to { transform: translate(-50%, -100%) scale(1); opacity: 1; } }
@keyframes bow { 0%,100% { transform: translate(-50%, -100%) rotate(0); } 40%,60% { transform: translate(-50%, -96%) rotate(0) scaleY(.9); } }
@keyframes talk { 50% { transform: translateY(-3%) rotate(-1.5deg); } }

/* posture changes with the feeling (never color alone) */
.mood-sad .fig, .mood-sad > img { transform: translateY(2%) scaleY(.97) rotate(-2deg); transform-origin: 50% 100%; }
.mood-excited .fig, .mood-excited > img { animation: hop 1s ease-in-out infinite; transform-origin: 50% 100%; }
.mood-afraid .fig, .mood-afraid > img { animation: shiver .18s linear infinite; }
.mood-angry .fig, .mood-angry > img { animation: stomp 1.4s ease-in-out infinite; transform-origin: 50% 100%; }
.mood-surprised .fig, .mood-surprised > img { animation: jump .6s ease 1; transform-origin: 50% 100%; }
.mood-curious .fig, .mood-curious > img { transform: rotate(4deg); transform-origin: 50% 100%; }
.mood-worried .fig, .mood-worried > img { animation: fidget 2s ease-in-out infinite; transform-origin: 50% 100%; }
.mood-caring .fig, .mood-caring > img { animation: sway 2.6s ease-in-out infinite; transform-origin: 50% 100%; }
.mood-hopeful .fig, .mood-hopeful > img { transform: translateY(-1.5%); }
@keyframes hop { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5%); } }
@keyframes shiver { 0%,100% { transform: translateX(0); } 50% { transform: translateX(1.2%); } }
@keyframes stomp { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
@keyframes jump { 40% { transform: translateY(-8%); } }
@keyframes fidget { 0%,100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }
@keyframes sway { 0%,100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
.moodtag { position: absolute; left: 50%; top: -2%; transform: translate(-50%, -100%); width: 3.8cqw; height: 3.8cqw; border-radius: 50%; display: grid; place-items: center;
  background: #f8f3e7; box-shadow: inset 0 0 0 .25cqw rgba(185,132,28,.85), 0 .4cqw .8cqw rgba(0,0,0,.5); font-size: 2.2cqw; line-height: 1; }

/* custom felt figure: a 300 x 520 box, every layer placed in percent */
.fig.custom { position: relative; aspect-ratio: 300 / 520; height: 100%; }
.fig.custom img { position: absolute; max-width: none; }

.prop { position: absolute; transform: translate(-50%, -100%); width: calc(var(--s, 1) * 7cqw); z-index: 5; cursor: grab; touch-action: none; background: none; border: 0; padding: 0; margin: 0; appearance: none;
  filter: drop-shadow(0 .4cqw .4cqw rgba(0,0,0,.55)); transition: left .25s ease, top .25s ease; }
.prop img { width: 100%; display: block; pointer-events: none; }
.prop.pop { animation: pop .5s cubic-bezier(.3,1.6,.5,1) both; }
.prop.sel { outline: .3cqw dashed #f2b82b; outline-offset: .4cqw; border-radius: 6px; }
.prop:focus-visible { outline: 3px solid var(--cb-teal); outline-offset: 3px; }
@keyframes pop { from { transform: translate(-50%, -100%) scale(.2); opacity: 0; } to { transform: translate(-50%, -100%) scale(1); opacity: 1; } }

/* FX */
.fx { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.bubble { position: absolute; transform: translate(-50%, -100%); max-width: 30cqw; min-width: 10cqw; padding: 1cqw 1.4cqw; border-radius: 1.6cqw;
  background: #fffdf7; color: #2b3a67; font: max(11px, 1.75cqw)/1.25 var(--cb-hand); box-shadow: inset 0 0 0 .2cqw rgba(185,132,28,.8), 0 .8cqw 1.6cqw -0.6cqw rgba(0,0,0,.6);
  animation: pop .45s cubic-bezier(.3,1.6,.5,1) both; text-align: center; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -1.1cqw; margin-left: -1cqw; border: 1cqw solid transparent; border-top-color: #fffdf7; border-bottom: 0; }
.bubble b { display: block; font: 600 max(7px, 1cqw)/1.2 var(--cb-body); letter-spacing: .08em; text-transform: uppercase; color: #8a5f0e; margin-bottom: .3cqw; }
.bubble.think { border-radius: 3cqw; font-style: italic; }
.fxcard { position: absolute; left: 50%; top: 42%; width: 15cqw; transform: translate(-50%, -50%); border-radius: 1.2cqw; overflow: hidden;
  box-shadow: 0 1cqw 2.4cqw rgba(0,0,0,.7); animation: cardIn 1.2s cubic-bezier(.3,1.4,.5,1) both; }
.fxcard img { display: block; width: 100%; }
@keyframes cardIn { from { transform: translate(-50%, 30%) rotate(-12deg) scale(.3); opacity: 0; } to { transform: translate(-50%, -50%) rotate(-2deg) scale(1); opacity: 1; } }
.fxbulb { position: absolute; width: 11cqw; transform: translate(-50%, -100%); mix-blend-mode: screen; animation: bulb 1.8s ease both; }
@keyframes bulb { 0% { opacity: 0; transform: translate(-50%, -80%) scale(.2); } 40% { opacity: 1; } 60% { transform: translate(-50%, -100%) scale(1.1); } 100% { opacity: 1; transform: translate(-50%, -100%) scale(1); } }
.star { position: absolute; width: 1.6cqw; height: 1.6cqw; background: #f2b82b; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  animation: fall var(--d, 2.4s) linear var(--delay, 0s) both; }
@keyframes fall { from { transform: translateY(-10cqw) rotate(0); opacity: 0; } 10% { opacity: 1; } to { transform: translateY(60cqw) rotate(540deg); opacity: .9; } }
.spark { position: absolute; width: 1cqw; height: 1cqw; border-radius: 50%; background: #fff3c4; box-shadow: 0 0 1.4cqw .6cqw rgba(242,184,43,.8); animation: spark 1.2s ease-out both; }
@keyframes spark { from { transform: translate(0,0) scale(1); opacity: 1; } to { transform: translate(var(--tx), var(--ty)) scale(.2); opacity: 0; } }
.flash { position: absolute; inset: 0; background: #b81d12; mix-blend-mode: overlay; animation: flash 1.2s steps(2) 1 both; }
@keyframes flash { 0%,50% { opacity: .8; } 25%,75%,100% { opacity: 0; } }
.shake { animation: shake .5s ease 2; }
@keyframes shake { 25% { transform: translateX(-.8%); } 75% { transform: translateX(.8%); } }
.audience { position: absolute; left: 0; right: 0; bottom: -1%; height: 16%; z-index: 7; pointer-events: none; opacity: 0; transition: opacity 1s;
  background:
    radial-gradient(3.2cqw 3.6cqw at 8% 100%, #0d0805 98%, transparent) ,
    radial-gradient(3cqw 3.4cqw at 19% 100%, #120a06 98%, transparent),
    radial-gradient(3.4cqw 3.8cqw at 31% 100%, #0d0805 98%, transparent),
    radial-gradient(2.6cqw 3cqw at 41% 100%, #140c07 98%, transparent),
    radial-gradient(3.2cqw 3.6cqw at 60% 100%, #0d0805 98%, transparent),
    radial-gradient(3cqw 3.2cqw at 71% 100%, #120a06 98%, transparent),
    radial-gradient(3.4cqw 3.8cqw at 83% 100%, #0d0805 98%, transparent),
    radial-gradient(2.8cqw 3.2cqw at 94% 100%, #140c07 98%, transparent); }
.audience.on { opacity: 1; }
.audience.clap { animation: clap .35s ease-in-out 8; }
@keyframes clap { 50% { transform: translateY(-.5cqw); } }

/* Felt curtains inside the proscenium arch */
.curtain { position: absolute; top: 4%; height: 62%; width: 19.6%; z-index: 8; pointer-events: none; opacity: 0; transition: transform 1.3s cubic-bezier(.6,0,.3,1), opacity .5s ease .8s;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.28) 0 .8cqw, rgba(255,255,255,.06) .8cqw 1.6cqw, rgba(0,0,0,.18) 1.6cqw 2.6cqw),
    linear-gradient(#8f1d1a, #6c1210);
  box-shadow: inset 0 -1.2cqw 0 #c8952a, inset 0 -1.6cqw 0 #7a5410; }
.curtain.l { left: 30.4%; transform: scaleX(.12); transform-origin: 0 50%; border-radius: 0 0 0 1cqw; }
.curtain.r { right: 30.4%; transform: scaleX(.12); transform-origin: 100% 50%; border-radius: 0 0 1cqw 0; }
.stagebox.closed .curtain.l, .stagebox.closed .curtain.r { transform: scaleX(1); opacity: 1; transition: transform 1.3s cubic-bezier(.6,0,.3,1), opacity .2s ease; }
.stagebox:not(.has-curtains) .curtain { visibility: hidden; }

/* Hotspots */
.hots { position: absolute; inset: 0; z-index: 9; }
.hot { position: absolute; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 4px; border: 0; background: none; padding: 0; cursor: pointer; color: #f8f3e7; }
.hot .dot { width: clamp(30px, 4cqw, 54px); height: clamp(30px, 4cqw, 54px); border-radius: 50%; display: grid; place-items: center; font-size: clamp(15px, 2cqw, 26px);
  background: radial-gradient(circle at 40% 30%, #2a4377, #071a3d); box-shadow: 0 0 0 3px #f2b82b, 0 0 22px 6px rgba(242,184,43,.55); animation: glow 1.8s ease-in-out infinite; }
.hot .lbl { font: 600 clamp(11px, 1.2cqw, 15px)/1.1 var(--cb-body); background: rgba(7,26,61,.85); padding: 5px 9px; border-radius: 999px; white-space: nowrap; }
.hot.locked .dot { filter: grayscale(.8) brightness(.7); animation: none; box-shadow: 0 0 0 3px rgba(242,184,43,.4); }
.hot.done .dot { background: radial-gradient(circle at 40% 30%, #ffe28a, #f2b82b); color: #071a3d; }
.hot.next .dot { animation: glow .9s ease-in-out infinite; }
.hot:focus-visible .dot { outline: 3px solid var(--cb-teal); outline-offset: 4px; }
@keyframes glow { 50% { box-shadow: 0 0 0 3px #f2b82b, 0 0 34px 12px rgba(242,184,43,.75); } }
.envelope-hot { position: absolute; left: 70.5%; top: 63%; width: 7cqw; height: 4cqw; transform: translate(-50%, -50%); border: 0; background: transparent; cursor: pointer; border-radius: 6px; animation: wiggle 1.4s ease-in-out infinite; box-shadow: 0 0 0 3px rgba(242,184,43,.9), 0 0 18px 6px rgba(242,184,43,.6); }
@keyframes wiggle { 0%,80%,100% { transform: translate(-50%,-50%) rotate(0); } 85% { transform: translate(-50%,-50%) rotate(-6deg); } 90% { transform: translate(-50%,-50%) rotate(6deg); } }

.caption { position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%); z-index: 10; margin: 0; max-width: 80%; padding: .8cqw 1.6cqw; border-radius: 999px;
  background: rgba(7,26,61,.88); color: #f8f3e7; font: 600 max(10px, 1.5cqw)/1.3 var(--cb-body); text-align: center; box-shadow: inset 0 0 0 .15cqw rgba(242,184,43,.7); }
.caption:empty { display: none; }
.title-card { position: absolute; inset: 0; z-index: 11; display: grid; place-items: center; text-align: center; pointer-events: none; }
.title-card div { font: 600 5cqw/1 var(--cb-display); color: #f2b82b; text-shadow: 0 .4cqw 1.6cqw rgba(0,0,0,.9); animation: pop .8s cubic-bezier(.3,1.5,.5,1) both; }
.title-card small { display: block; font: italic 500 2cqw/1.3 var(--cb-display); color: #f8f3e7; margin-top: 1cqw; }
.badge-pop { position: absolute; left: 50%; top: 50%; width: 30cqw; transform: translate(-50%, -50%); z-index: 11; animation: badge 1.4s cubic-bezier(.3,1.4,.5,1) both; filter: drop-shadow(0 1.4cqw 2.4cqw rgba(0,0,0,.8)); }
@keyframes badge { from { transform: translate(-50%, -30%) scale(.3) rotate(-14deg); opacity: 0; } to { transform: translate(-50%, -50%) scale(1) rotate(-2deg); opacity: 1; } }
.spot { position: absolute; inset: 0; z-index: 10; pointer-events: none; background: radial-gradient(22% 40% at 50% 50%, transparent 40%, rgba(0,0,0,.82) 75%); animation: fadeIn 1s ease both; }
@keyframes fadeIn { from { opacity: 0; } }
.stampfx { position: absolute; left: 50%; top: 50%; width: 26cqw; aspect-ratio: 1; transform: translate(-50%, -50%) rotate(-8deg); z-index: 12; border-radius: 50%;
  display: grid; place-items: center; text-align: center; color: #8f1d1a; background: rgba(248,243,231,.94); box-shadow: inset 0 0 0 .7cqw #8f1d1a, inset 0 0 0 1.1cqw #f8f3e7, inset 0 0 0 1.4cqw #8f1d1a, 0 1cqw 3cqw rgba(0,0,0,.6);
  font: 600 3.6cqw/1 var(--cb-display); animation: stamp .7s cubic-bezier(.5,0,.6,1.4) both; }
.stampfx small { display: block; font: 600 1.1cqw/1.3 var(--cb-body); letter-spacing: .14em; text-transform: uppercase; margin-top: .8cqw; }
@keyframes stamp { 0% { transform: translate(-50%, -160%) rotate(-8deg) scale(1.8); opacity: 0; } 70% { transform: translate(-50%, -50%) rotate(-8deg) scale(.94); opacity: 1; } 100% { transform: translate(-50%, -50%) rotate(-8deg) scale(1); } }
.fiber { position: absolute; width: .5cqw; height: .5cqw; border-radius: 50%; background: #e9dcc0; animation: spark 1s ease-out both; }

/* ---------- Top bar ---------- */
.topbar { position: fixed; left: 14px; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 50; display: flex; gap: 8px; flex-wrap: wrap; }
.topbar a, .topbar button { color: var(--cb-ivory); background: rgba(27,17,10,.72); padding: 10px 14px; border-radius: 999px; text-decoration: none; border: 0; cursor: pointer;
  font: 600 .84rem/1 var(--cb-body); display: inline-flex; gap: 6px; align-items: center; min-height: 44px; }
.topbar a:focus-visible, .topbar button:focus-visible { outline: 3px solid var(--cb-teal); outline-offset: 2px; }

/* ---------- Panel ---------- */
.panel { overflow-y: auto; min-height: 0; padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 120px 8px; }
.panel .cb-card { margin-top: 10px; }
.panel h1, .panel h2 { font: 600 clamp(1.7rem, 3vw, 2.3rem)/1.05 var(--cb-display); color: var(--cb-navy); margin: .1em 0 .3em; text-wrap: balance; }
.panel h1 { font-size: clamp(1.9rem, 3.2vw, 2.5rem); }
.panel h3 { font: 600 1rem/1.2 var(--cb-body); color: var(--cb-navy); margin: 14px 0 8px; }
.panel p { margin: 0 0 10px; }
.crumbs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 6px; }
.crumbs span { font: 600 .66rem/1 var(--cb-body); letter-spacing: .08em; text-transform: uppercase; padding: 5px 8px; border-radius: 999px; color: var(--cb-ink-soft); background: rgba(7,26,61,.05); }
.crumbs span.on { background: var(--cb-navy); color: var(--cb-gold); }
.crumbs span.done { color: #8a5f0e; background: rgba(242,184,43,.18); }
.guide { display: grid; grid-template-columns: 54px minmax(0,1fr); gap: 12px; align-items: start; margin: 8px 0 14px; }
.guide img { width: 54px; height: 54px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(242,184,43,.6); }
.guide .say { position: relative; background: #fffdf7; border-radius: 14px 14px 14px 4px; padding: 11px 40px 11px 14px; box-shadow: 0 6px 14px -10px rgba(0,0,0,.6); }
.guide .who { display: block; font: 600 .68rem/1.2 var(--cb-body); letter-spacing: .1em; text-transform: uppercase; color: var(--cb-gold-thread); margin-bottom: 4px; }
.guide p { margin: 0; font-size: 1rem; }
.speak { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer; background: rgba(7,26,61,.07); font-size: 15px; }
.speak:focus-visible { outline: 3px solid var(--cb-teal); }
.q { display: flex; align-items: center; gap: 8px; }
.q h2 { margin: 0; flex: 1; }
.q .speak { position: static; flex: none; }
.lede { color: var(--cb-ink-soft); font-size: .92rem; }

.btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.btns.nav { justify-content: space-between; }
.cb-btn[disabled] { opacity: .45; cursor: not-allowed; }
.gold-btn { background: var(--cb-gold); color: var(--cb-navy); box-shadow: 0 6px 14px -6px rgba(0,0,0,.6); }

/* choice grids */
.grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(var(--min, 84px), 1fr)); margin: 6px 0 12px; }
.tile { position: relative; border: 2px solid rgba(7,26,61,.15); background: #fffdf7; border-radius: 12px; padding: 6px; cursor: pointer; display: grid; justify-items: center; gap: 4px;
  color: var(--cb-ink); font: 600 .74rem/1.15 var(--cb-body); text-align: center; min-height: 44px; transition: transform .15s ease, border-color .15s ease; }
.tile:hover { transform: translateY(-2px); }
.tile:focus-visible { outline: 3px solid var(--cb-teal); outline-offset: 2px; }
.tile[aria-pressed="true"] { border-color: var(--cb-navy); box-shadow: inset 0 0 0 2px var(--cb-navy), 0 0 0 3px rgba(242,184,43,.7); }
.tile img { width: 100%; height: 76px; object-fit: contain; }
.tile.card { padding: 0; overflow: hidden; border-radius: 12px; }
.tile.card img { height: auto; aspect-ratio: auto; object-fit: cover; display: block; }
.tile.card[aria-pressed="true"] { transform: translateY(-6px) rotate(-1.5deg); }
.tile.locked { opacity: .55; }
.tile .lock { position: absolute; right: 4px; top: 4px; font-size: 13px; }
.tile.tall img { height: 110px; }
.tile.face img { height: 64px; object-fit: cover; object-position: 50% 0; }
.emo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.emo .tile { padding: 0; overflow: hidden; }
.emo .tile img { height: auto; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin: 6px 0; scrollbar-width: thin; }
.tabs button { flex: none; border: 2px solid rgba(7,26,61,.15); background: #fffdf7; color: var(--cb-navy); border-radius: 999px; padding: 8px 12px; font: 600 .78rem/1 var(--cb-body); cursor: pointer; min-height: 40px; }
.tabs button[aria-selected="true"] { background: var(--cb-navy); color: var(--cb-gold); border-color: var(--cb-navy); }
.tray { max-height: 300px; overflow-y: auto; padding: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.chips button { border: 2px solid rgba(7,26,61,.18); background: #fffdf7; color: #2b3a67; border-radius: 999px; padding: 9px 13px; cursor: pointer; font: 1.05rem/1 var(--cb-hand); min-height: 44px; }
.chips button[aria-pressed="true"] { background: var(--cb-navy); color: var(--cb-ivory); border-color: var(--cb-navy); }
.chips button:focus-visible { outline: 3px solid var(--cb-teal); outline-offset: 2px; }
.count { font: 600 .74rem/1 var(--cb-body); color: var(--cb-ink-soft); text-align: right; margin-top: -8px; margin-bottom: 8px; }

.placed { display: grid; gap: 6px; margin: 8px 0; }
.placed .row { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 8px; align-items: center; background: #fffdf7; border-radius: 10px; padding: 6px 8px; }
.placed img { width: 40px; height: 40px; object-fit: contain; }
.placed .ctl { display: flex; gap: 4px; }
.placed .ctl button { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(7,26,61,.2); background: #fff; cursor: pointer; font-size: 14px; color: var(--cb-navy); }
.placed .row.sel { box-shadow: inset 0 0 0 2px var(--cb-gold); }

.lines { display: grid; gap: 10px; margin: 8px 0; }
.line { background: #fffdf7; border-radius: 12px; padding: 10px; box-shadow: inset 0 0 0 2px rgba(7,26,61,.1); }
.line .who { display: flex; align-items: center; gap: 8px; font: 600 .82rem/1.2 var(--cb-body); color: var(--cb-navy); margin-bottom: 6px; }
.line .who .av { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; background: #efe5cf; display: grid; place-items: end center; }
.line .who .av img { width: 100%; height: 160%; object-fit: cover; object-position: 50% 0; }
.line textarea { font: 1.15rem/1.35 var(--cb-hand); color: #2b3a67; }
.line .tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mini { border: 0; background: rgba(7,26,61,.07); color: var(--cb-navy); border-radius: 999px; padding: 8px 12px; font: 600 .78rem/1 var(--cb-body); cursor: pointer; min-height: 36px; }
.mini:focus-visible { outline: 3px solid var(--cb-teal); }
.helpers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.helpers span { font: .95rem/1 var(--cb-hand); color: #2b3a67; background: rgba(242,184,43,.18); padding: 7px 10px; border-radius: 999px; }

.cast { display: flex; gap: 10px; align-items: flex-end; justify-content: center; margin: 4px 0 10px; }
.cast .mini-fig { height: 120px; display: grid; justify-items: center; gap: 2px; font: 600 .74rem/1.1 var(--cb-body); color: var(--cb-navy); text-align: center; }
.cast .mini-fig .fig, .cast .mini-fig > img { height: 100px; }
.preview { display: grid; place-items: center; height: 230px; background: radial-gradient(60% 60% at 50% 60%, #fff9ea, #efe2c6); border-radius: 12px; margin: 6px 0 10px; box-shadow: inset 0 0 0 2px rgba(185,132,28,.4); }
.preview .fig { height: 210px; }

.feltnote { margin: 10px 0; padding: 12px 14px; background: var(--cb-ivory); border-radius: 4px; transform: rotate(-.6deg); box-shadow: 0 6px 14px -8px rgba(0,0,0,.4); font: 1.2rem/1.35 var(--cb-hand); color: #2b3a67; }
.feltnote small { display: block; font: 600 .66rem/1.2 var(--cb-body); letter-spacing: .1em; text-transform: uppercase; color: var(--cb-ink-soft); margin-bottom: 4px; }
.think-pair { display: grid; gap: 8px; margin: 8px 0 12px; }
.think-pair .feltnote:nth-child(2) { transform: rotate(.6deg); background: #eef4fb; }

.playbill { position: relative; background: linear-gradient(#0b2350, #071a3d); color: #f8f3e7; border-radius: 14px; padding: 22px 18px; text-align: center; box-shadow: inset 0 0 0 3px #f2b82b, inset 0 0 0 6px #071a3d, inset 0 0 0 7.5px rgba(242,184,43,.7); }
.playbill .pb-eyebrow { font: 600 .66rem/1.2 var(--cb-body); letter-spacing: .2em; text-transform: uppercase; color: var(--cb-gold); }
.playbill .pb-title { font: 600 1.9rem/1.05 var(--cb-display); color: #fff; margin: 8px 0 4px; text-wrap: balance; }
.playbill .pb-by { font: italic 500 1.05rem/1.2 var(--cb-display); color: #f3dfaa; margin-bottom: 12px; }
.playbill dl { text-align: left; display: grid; gap: 8px; margin: 12px 0 0; font-size: .9rem; }
.playbill dt { font: 600 .64rem/1.2 var(--cb-body); letter-spacing: .14em; text-transform: uppercase; color: var(--cb-gold); }
.playbill dd { margin: 2px 0 0; }
.playbill .pb-cast { display: flex; justify-content: center; gap: 10px; align-items: flex-end; height: 120px; margin: 8px 0; }
.playbill .pb-cast .fig, .playbill .pb-cast > img { height: 110px; }
.playbill .pb-summary { font: 1.1rem/1.35 var(--cb-hand); color: #fdf3d6; background: rgba(255,255,255,.06); border-radius: 8px; padding: 10px; margin-top: 10px; text-align: left; }

.parents { margin-top: 16px; border-top: 1.5px dashed rgba(185,132,28,.6); padding-top: 12px; font-size: .9rem; }
.parents summary { cursor: pointer; font-weight: 600; color: var(--cb-navy); min-height: 32px; }
.parents h2 { font-size: 1.25rem !important; margin: 12px 0 4px !important; }
.parents a { color: var(--cb-navy); }

.err { background: #fff4e5; border-radius: 10px; padding: 12px; }

.playbill-print { display: none; }
@media print {
  body > *:not(.playbill-print) { display: none !important; }
  .playbill-print { display: block !important; color: #000; }
  .playbill-print .playbill { max-width: 520px; margin: 0 auto; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 820px) {
  .world { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); }
  .scene { container-type: inline-size; padding-top: calc(60px + env(safe-area-inset-top, 0px)); }
  .stagebox { width: 100%; border-radius: 0; }
  .panel { padding: 0 12px 120px; }
  .tray { max-height: 240px; }
  .bubble { max-width: 44cqw; }
  /* on phones the Book / Backpack / Ideas dock moves up beside the top bar so it never covers the buttons */
  body:not(:has(.cb-book:not([hidden]))) .cb-dock { top: calc(8px + env(safe-area-inset-top, 0px)); bottom: auto; right: 10px; left: auto; padding-bottom: 0; }
  body:not(:has(.cb-book:not([hidden]))) .cb-dock button { width: 44px; height: 44px; }
  body:not(:has(.cb-book:not([hidden]))) .cb-dock .lbl { display: none; }
  .topbar { left: 10px; }
  .topbar a, .topbar button { padding: 8px 11px; font-size: .78rem; }
}
@media (max-width: 820px) and (orientation: landscape) and (max-height: 520px) {
  .world { grid-template-columns: minmax(0,1.3fr) minmax(280px,1fr); grid-template-rows: none; }
  .scene { container-type: size; padding-top: 0; }
  .stagebox { width: min(100cqw, calc(100cqh * 16 / 9)); }
  .panel { padding: 10px 10px 100px 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
}

/* ===== Phase 5: Ms. Belle, the Rehearsal Studio, performance modes, Expression Map ===== */
.guide.belle .belle-face { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: radial-gradient(circle at 40% 30%, #2b3a67, #071a3d); box-shadow: 0 0 0 3px rgba(32,184,208,.6); }
.guide.belle .say { border-left: 4px solid #20b8d0; }
.starter dl { margin: 0; display: grid; gap: 6px; }
.starter dl div { display: grid; grid-template-columns: minmax(90px, 34%) 1fr; gap: 8px; align-items: baseline; }
.starter dt { font: 700 .64rem/1.2 var(--cb-body); letter-spacing: .08em; text-transform: uppercase; color: var(--cb-gold-thread); }
.starter dd { margin: 0; }
.chips.small button { min-height: 36px; padding: 6px 10px; font-size: .95rem; }
.chainlist { list-style: none; margin: 8px 0 10px; padding: 0; display: grid; gap: 8px; }
.chainlist .beat { background: #fffdf7; border-radius: 12px; padding: 8px 10px; border-left: 5px solid #f2b82b; }
.chainlist .beat.reaction { border-left-color: #20b8d0; margin-left: 14px; }
.chainlist .beat-hd { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.chainlist .beat-hd b { font: 700 .72rem/1 var(--cb-body); letter-spacing: .08em; text-transform: uppercase; color: var(--cb-navy); }
.chainlist .chips { margin: 4px 0 0; }
.voicecard { background: #fffdf7; border-radius: 12px; padding: 8px 12px; margin: 8px 0; }
.voicecard summary { cursor: pointer; font: 600 .95rem/1.3 var(--cb-body); color: var(--cb-navy); padding: 4px 0; }
.voicecard .cb-field { margin: 8px 0 0; }
.actor.nervy { animation: nervy 1.6s ease both; }
@keyframes nervy { 15% { transform: translate(-50%, -100%) rotate(-3deg); } 30% { transform: translate(-50%, -100%) rotate(3deg); } 55% { transform: translate(-62%, -100%) rotate(-1deg); } 100% { transform: translate(-70%, -100%); } }
.audience.lean { transform: translateY(-2%); transition: transform .4s ease; }
.xmap { width: 100%; border-collapse: separate; border-spacing: 0 4px; margin: 10px 0; font-size: .9rem; }
.xmap caption { text-align: left; font: 600 1.15rem/1.2 var(--cb-display); color: var(--cb-navy); margin-bottom: 4px; }
.xmap th { text-align: left; width: 38%; font: 700 .68rem/1.2 var(--cb-body); letter-spacing: .08em; text-transform: uppercase; color: var(--cb-gold-thread); padding: 6px 8px; background: #fffdf7; border-radius: 8px 0 0 8px; vertical-align: top; }
.xmap td { padding: 6px 8px; background: #fffdf7; border-radius: 0 8px 8px 0; font: 1.02rem/1.25 var(--cb-hand); color: #2b3a67; }
.dmark { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; background: #071a3d; color: #f8f3e7; border-radius: 14px; padding: 10px 14px; margin: 10px 0; border: 2px dashed #f2b82b; }
.dmark span { grid-row: span 2; font-size: 30px; }
.dmark b { font: 600 1.1rem/1.1 var(--cb-display); color: #f2b82b; }
.dmark small { font: .82rem/1.2 var(--cb-body); }
.voicethread { position: relative; height: 54px; margin: 10px 0; display: grid; place-items: center; }
.voicethread span { position: absolute; inset: 22px 6px; border-radius: 99px; background: repeating-linear-gradient(115deg, #f2b82b 0 10px, #20b8d0 10px 16px); box-shadow: 0 0 14px rgba(242,184,43,.7); }
.voicethread b { position: relative; background: #fffdf7; padding: 2px 10px; border-radius: 99px; font: 600 .8rem/1.4 var(--cb-body); color: var(--cb-navy); }
.xwords { position: absolute; inset: 0; z-index: 12; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 2cqw 3cqw; pointer-events: none; }
.xwords span { font: 600 3cqw/1 var(--cb-display); color: #f8f3e7; text-shadow: 0 .3cqw 1cqw rgba(0,0,0,.9); animation: floaty 2.4s ease-in-out infinite alternate; animation-delay: calc(var(--i) * .2s); transition: transform 1.2s ease, opacity 1.2s ease; }
.xwords.stitch span { transform: scale(.3); opacity: 0; }
@keyframes floaty { from { transform: translateY(-.6cqw); } to { transform: translateY(.6cqw); } }
@media (prefers-reduced-motion: reduce) { .actor.nervy, .xwords span { animation: none !important; } }
.title-card.xp small { max-width: 64cqw; margin-left: auto; margin-right: auto; white-space: normal; }
