:root {
  color-scheme: light;
  --ink: #352331;
  --muted: #715565;
  --wine: #652c52;
  --deep-wine: #4a2143;
  --paper: #fffaf2;
  --cream: #f9efe5;
  --edge: #e5cfc1;
  --gold: #f8c65e;
  --duration-quick: 150ms;
  --duration-fast: 250ms;
  --ease-smooth-out: cubic-bezier(.22, 1, .36, 1);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font: 500 1rem/1.45 "Avenir Next", system-ui, "PingFang SC", sans-serif;
  background: radial-gradient(ellipse at 20% 0%, #fff7ed 0%, var(--cream) 45%, #f6e9e3 100%);
}
h1, h2, p, figure { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible { outline: 3px solid #9052a2; outline-offset: 3px; }
.studio { width: min(100%, 1230px); margin-inline: auto; padding: 26px 28px max(30px, env(safe-area-inset-bottom)); }
.masthead, .brand, .chapters, .scene-intro, .director-intro, .beat-head, .library-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { justify-content: flex-start; }
.brand h1 { color: var(--deep-wine); font-size: clamp(1.8rem, 6vw, 2.64rem); font-weight: 900; line-height: 1.12; letter-spacing: -.035em; }
.brand p { color: var(--muted); margin-top: 3px; font-size: .9rem; }
.clapper {
  display: block;
  position: relative;
  width: 48px;
  aspect-ratio: 1;
  border-radius: 14px;
  background: var(--wine);
  box-shadow: 0 4px #4a2143;
}
.clapper::before, .clapper::after { content: ''; position: absolute; width: 25px; left: 12px; }
.clapper::before { top: 13px; height: 6px; transform: rotate(-11deg); transform-origin: left; background: repeating-linear-gradient(120deg, #fff7db 0 4px, #d99b64 4px 8px); border-radius: 2px; }
.clapper::after { top: 21px; height: 13px; border: 2px solid #fff7db; border-radius: 2px 2px 5px 5px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 7px 13px;
  border: 1px solid var(--edge);
  border-radius: 11px;
  background: var(--paper);
  color: var(--wine);
  line-height: 1.2;
  font-weight: 750;
}
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { opacity: .48; }
.header-actions { display: flex; align-items: center; gap: 7px; }
.mobile-level, .shot-nav { display: none; }
.library-button { white-space: nowrap; box-shadow: 0 2px #e5c5b7; }
.film-icon { width: 16px; height: 13px; border: 2px solid currentColor; border-inline: 3px dotted currentColor; border-radius: 2px; color: var(--wine); }
.library-count { min-width: 1.5em; border-radius: 12px; padding: 2px 5px; text-align: center; font-size: .8rem; background: #f1dce8; }

.selection { margin: 19px 0 15px; display: grid; gap: 8px; }
.chapter-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.chapter-tab {
  min-width: 0;
  min-height: 42px;
  padding: 6px 9px;
  border: 1px solid #e8d4c8;
  border-radius: 10px;
  background: #fff8ef;
  color: var(--wine);
  font-size: .875rem;
  font-weight: 780;
  white-space: nowrap;
}
.chapter-tab[aria-current="step"] { background: #f0d9e9; border-color: #b77b9f; color: var(--deep-wine); }
.chapter-tab[data-done]::after { content: ' ✓'; }
.scene-nav { display: grid; flex: 1; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.scene-tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 54px;
  min-width: 0;
  border: 1px solid #e8d4c8;
  border-radius: 12px;
  background: #fdf4ec;
  color: var(--wine);
  font-weight: 760;
}
.scene-tab .scene-thumb { font-size: 1.1rem; line-height: 1; }
.scene-tab[aria-current="step"] { background: var(--wine); border-color: var(--wine); color: #fff7e6; box-shadow: 0 3px var(--deep-wine); }
.scene-tab[data-done]::after { content: '✓'; color: #41674d; font-size: .75rem; }
.scene-tab[aria-current="step"][data-done]::after { color: #ffd983; }
.progress { color: var(--muted); font-size: .9rem; white-space: nowrap; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(310px, 350px); align-items: start; gap: 16px; }
.scene-panel, .director-panel { min-width: 0; background: var(--paper); border: 1px solid var(--edge); border-radius: 19px; box-shadow: 0 3px 0 #eeddd1; }
.scene-panel { padding: 14px; }
.scene-intro { padding: 1px 3px 11px; }
.scene-intro h2 { font-size: clamp(1.33rem, 4.1vw, 1.65rem); color: var(--deep-wine); font-weight: 850; line-height: 1.25; }
.scene-intro p { color: var(--muted); margin-top: 3px; }
.cue-controls { flex-shrink: 0; display: flex; gap: 4px; align-items: center; }
.cue-controls .button { font-size: .9rem; }
.text-button { border: 0; min-height: 44px; padding-inline: 9px; border-radius: 8px; background: transparent; color: var(--wine); font-size: .875rem; font-weight: 780; text-decoration: underline; text-decoration-color: #b682a1; text-underline-offset: 3px; }
.text-button:hover { background: #f7ebe9; }
.cue-text { margin: -3px 3px 10px; padding: 6px 10px; border-radius: 8px; background: #f6e7f1; font-weight: 740; }
.stage-frame { position: relative; overflow: hidden; border-radius: 15px; border: 1px solid #6a343f; background: #7a3d48; box-shadow: 0 2px #e2bfa9; }
.shot-status {
  position: absolute;
  z-index: 8;
  top: 10px;
  left: 11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #fff2dd;
  color: #55283a;
  font-size: .8125rem;
  font-weight: 800;
}
.shot-status[data-mode="shooting"] { background: #a6384b; color: white; }
.shot-status[data-mode="shooting"]::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #ffd5ab; }
.shot-status[data-mode="success"] { background: #efefca; color: #32523e; }
.subtitle { position: absolute; z-index: 9; inset: auto 10px 10px; justify-self: center; width: fit-content; max-width: calc(100% - 20px); margin-inline: auto; padding: 5px 11px; border-radius: 8px; background: #362135f2; color: #fff9ec; text-align: center; font-size: clamp(.88rem, 2.6vw, 1.02rem); font-weight: 770; }
.feedback { min-height: 67px; margin-top: 11px; padding: 8px 11px; border-radius: 11px; background: #f9ebe0; color: #633a4a; border: 1px solid #eed9ca; }
.feedback strong { font-size: 1rem; font-weight: 850; }
.feedback p { font-size: .9rem; margin-top: 2px; }
.feedback[data-tone="success"] { background: #edf3de; border-color: #d9e4c1; color: #365239; }
.feedback[data-tone="try"] { background: #ffefdf; border-color: #edcaaa; color: #753f29; }

.director-panel { padding: 13px; }
.director-intro { padding-left: 4px; }
.director-intro h2, .library-head h2 { color: var(--deep-wine); font-size: 1.25rem; font-weight: 850; }
.director-hint { margin: 0 0 9px; padding: 7px 9px; border-radius: 8px; background: #f9e8b9; color: #5c431c; font-size: .9rem; }
.script { display: grid; gap: 10px; }
.beat { padding: 9px; border: 1px solid #ead4d9; border-radius: 12px; background: #fff7f1; min-width: 0; }
.beat[data-playing] { border-color: #b379a4; box-shadow: inset 0 0 0 1px #b379a4; }
.beat-head h3 { font-size: .875rem; margin: 0; color: #70485e; font-weight: 800; }
.listen-line { min-height: 40px; padding: 5px 8px; font-size: .8125rem; }
.line { display: flex; align-items: center; min-height: 43px; padding: 4px 7px; margin: 2px 0 5px; border-radius: 7px; background: #f2e3ef; color: #572247; font-weight: 850; font-size: 1.03rem; line-height: 1.28; overflow-wrap: anywhere; }
.word-group { display: flex; flex-wrap: wrap; gap: 5px; border: 0; margin: 0; padding: 0; min-width: 0; }
.word-group + .word-group { margin-top: 7px; }
.word-group legend { padding: 0 0 2px; color: #765363; font-size: .84rem; }
.word-chip { min-height: 43px; padding: 4px 7px; border-radius: 9px; border: 1px solid #e2c6b9; background: #fffcf7; color: var(--wine); font-size: .9rem; line-height: 1.17; font-weight: 750; text-align: left; }
.word-chip[aria-pressed="true"] { color: #432339; background: #f8d68f; border-color: #ce9962; box-shadow: inset 0 -2px #e7af75; }
.word-chip:disabled { opacity: .75; }
.word-chip:hover:not(:disabled) { border-color: #a45b88; }
.director-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.reset-button { flex: 1; }
.shoot-button { flex: 2.6; }
.shoot-button { min-height: 47px; background: var(--gold); color: #492b1e; border-color: #d9954c; box-shadow: 0 3px #af6e42; font-size: 1.02rem; }
.shoot-button:disabled { opacity: .55; }
.play-icon { width: 12px; height: 14px; background: currentColor; clip-path: polygon(5% 0, 100% 50%, 5% 100%); }
.next-button { flex: 0 0 100%; margin-top: 2px; background: var(--wine); border-color: var(--wine); color: #fff6e5; }

dialog {
  width: min(calc(100% - 30px), 470px);
  max-height: calc(100dvh - 36px);
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #cfa5ae;
  color: var(--ink);
  background: #fff8ed;
  box-shadow: 0 8px 35px #271c3162;
}
dialog::backdrop { background: #3621359b; }
#library-empty { margin: 7px 0 4px; color: var(--muted); }
.clips { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.clip { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 9px; border: 1px solid var(--edge); border-radius: 9px; }
.clip strong { display: block; color: var(--wine); }
.clip small { display: block; color: var(--muted); font-size: .8rem; }
.clip .button { flex: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
 
/* Movable scenery and actors share a floor line on each set. */
.stage {
  position: relative;
  isolation: isolate;
  aspect-ratio: 1.87;
  container-type: inline-size;
  overflow: hidden;
  --floor: 23%;
  background: #bd7772 url('./assets/stage.jpg') center / 100% 100% no-repeat;
}
.stage::before {
  position: absolute;
  inset: 0;
  content: '';
  z-index: 1;
  pointer-events: none;
  opacity: .62;
  background: var(--set-tint, linear-gradient(0deg, #be532333, transparent 60%));
  transition: opacity .55s var(--ease-smooth-out), background .55s var(--ease-smooth-out);
}
.set-prop, .duck, .monster {
  position: absolute;
  left: var(--x);
  bottom: var(--y, var(--floor));
  z-index: var(--layer, 3);
  transform: translateX(-50%);
  transition: left .52s var(--ease-smooth-out), bottom .52s var(--ease-smooth-out), opacity .26s ease-out;
}
.set-prop i, .set-prop::after, .set-prop::before, .duck span, .monster i, .monster-body {
  position: absolute;
  display: block;
}
.prop-label {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: -.7em;
  transform: translate(-50%, 90%);
  padding: 1px 5px;
  border: 1px solid #572e3e50;
  background: #fff3dce8;
  border-radius: 5px;
  color: #563140;
  font-size: clamp(.65rem, 1.9cqw, .85rem);
  line-height: 1.22;
  font-weight: 780;
  white-space: nowrap;
}

.hide-decoration { position: absolute; left: 23%; top: 32%; z-index: 2; display: flex; align-items: center; gap: 3cqw; opacity: .52; }
.hide-decoration i { display: block; width: 2.3cqw; height: 2.3cqw; rotate: 45deg; border-radius: 26%; background: #ffde9d; }
.hide-decoration i:nth-child(2) { width: 1.4cqw; height: 1.4cqw; }
.hide-decoration i:nth-child(3) { width: 1cqw; height: 1cqw; }

.stage-box { --x: 41.5%; --layer: 5; width: 18cqw; height: 10cqw; transform: translateX(-50%) rotate(-2deg); }
.stage-box::before { content: ''; inset: 24% 0 0; border-radius: 0 0 13% 13%; border: .4cqw solid #9b503a; background: linear-gradient(108deg, #e69454 1%, #e69d59 75%, #cb7641 76%); box-shadow: 0 .8cqw #682a2c4d; }
.box-rim { inset: 0 -3% 57%; border: .42cqw solid #a85e3f; border-bottom-width: .8cqw; border-radius: 38% 36% 17% 19% / 41% 40% 12% 13%; background: #704143; box-shadow: inset 0 .6cqw #482d3c, 0 .45cqw #de9761; }
.box-tape { inset: 40% 41% 0 37%; border-radius: 0 0 8% 8%; background: #f6cb83; box-shadow: inset .18cqw 0 #f6dcac; }
.stage-table { --x: 65.5%; --layer: 5; width: 20cqw; height: 12cqw; }
.stage-table::before { content:''; z-index: 3; inset: 0 -3% 72%; border-radius: .9cqw; background: linear-gradient(#ec9f99 0 45%, #aa5258 47% 100%); border: .35cqw solid #903e4f; }
.table-legs { inset: 20% 9% 0; border-inline: 1.6cqw solid #703949; border-radius: .7cqw; }
.table-cloth { inset: 25% 11% 23%; background: repeating-linear-gradient(94deg, #d77d81 0 1.5cqw, #bf636e 1.5cqw 2.45cqw); border-radius: 0 0 .85cqw .85cqw; border-bottom: .42cqw solid #a04152; opacity: .93; }

.duck { --x: 25%; --layer: 6; width: 9.5cqw; height: 9.3cqw; rotate: -5deg; }
.duck-body { inset: 44% 3% 4% 9%; border-radius: 55% 51% 50% 50%; background: linear-gradient(125deg, #ffe078 12%, #ffc44c 55%, #e68d36); box-shadow: inset -.3cqw -.5cqw #de873a, 0 .7cqw 1cqw #5a313044; }
.duck-tail { inset: 50% 65% 18% 4%; border-radius: 60% 10% 40% 60%; background: #ffca53; transform: rotate(29deg); z-index: -1; }
.duck-head { inset: 5% 11% 38% 44%; border-radius: 52% 56% 48% 48%; background: linear-gradient(130deg, #ffe889 0%, #ffc64f 75%); box-shadow: inset -.22cqw -.2cqw #eda344; }
.duck-eye { inset: 21% 20% auto auto; width: 12%; aspect-ratio: .8; border-radius: 50%; background: #402033; box-shadow: inset .1cqw .12cqw #fff6d4; }
.duck-beak { top: 38%; right: -9%; width: 28%; height: 14%; border-radius: 13% 58% 44% 28%; background: #df7437; }
.duck-wing { inset: 53% 29% 18% 20%; border-radius: 65% 46% 70% 44%; background: #ffdc66; transform: rotate(-10deg); box-shadow: inset 0 -.35cqw #e7a339; }
.stage[data-placement="in-box"] .duck { --x: 41.5%; --y: calc(var(--floor) + 1.2cqw); opacity: 0; transition-delay: 0s, 0s, .23s; }
.stage[data-placement="under-box"] .duck { --x: 31%; }
.stage[data-placement="on-box"] .duck { --x: 41.5%; --y: calc(var(--floor) + 9.6cqw); }
.stage[data-placement="in-table"] .duck { --x: 51%; }
.stage[data-placement="on-table"] .duck { --x: 65.5%; --y: calc(var(--floor) + 11.1cqw); }
.stage[data-placement="under-table"] .duck { --layer: 4; --x: 65.5%; --y: calc(var(--floor) - .4cqw); }

.monster { --x: 82%; --layer: 5; width: 16cqw; height: 19cqw; --skin: #9070ae; --skin-light: #bd91cf; --skin-dark: #704983; --belly: #e1aed2; }
.monster-figure { position: absolute; inset: 0; transition: transform var(--duration-fast) var(--ease-smooth-out); }
.monster .ground-shadow { inset: auto 0 1% 2%; height: 15%; border-radius: 50%; background: #53293f43; }
.monster-body { inset: 20% 5% 8% 4%; border-radius: 49% 50% 48% 47% / 56% 56% 35% 35%; background: linear-gradient(126deg, var(--skin-light) 0%, var(--skin) 57%); border: .35cqw solid var(--skin-dark); box-shadow: inset -.5cqw -.65cqw var(--skin-dark), 0 .5cqw .8cqw #582f3c46; }
.monster-ear { top: 11%; left: 16%; width: 19%; height: 28%; border-radius: 33% 70% 40% 45%; transform: rotate(-22deg); background: var(--skin-dark); }
.monster-ear.right { left: auto; right: 15%; transform: scaleX(-1) rotate(-22deg); }
.monster-belly { inset: 53% 22% 4%; border-radius: 50% 52% 40% 38%; background: var(--belly); }
.monster-eye { inset: 31% auto auto 19%; width: 26%; height: 30%; border-radius: 49% 52% 43% 44%; background: #fff8dc; z-index: 4; }
.monster-eye.right { left: auto; right: 18%; }
.monster-eye::after { content: ''; display: block; position: absolute; inset: 32% 31% 15%; background: #452938; border-radius: 55%; box-shadow: inset .14cqw .2cqw #ffefd6; }
.monster-cheek { inset: 60% auto auto 14%; width: 20%; height: 11%; border-radius: 50%; background: #ed9ea5; }
.monster-cheek.right { left: auto; right: 14%; }
.monster-mouth { inset: 62% 40% 17%; border-bottom: .53cqw solid #5f354c; border-radius: 40%; }
.monster-foot { inset: auto auto 4% 15%; width: 31%; height: 16%; background: var(--skin-dark); border-radius: 49%; transform: rotate(-9deg); }
.monster-foot.right { left: auto; right: 14%; transform: rotate(9deg); }
.monster-hat { display: none !important; }
.explorer .monster-hat { display: block !important; inset: 9% 1% 65%; border-radius: 52% 51% 27% 28%; background: #e4a354; border-bottom: .6cqw solid #8c5144; transform: rotate(8deg); }
.explorer .monster-hat::after { position: absolute; content: ''; inset: auto -3% 5%; height: 26%; border-radius: .3cqw; background: #f5bc70; }
.monster .reaction { display: none; position: absolute; right: -6%; top: -10%; width: 4.6cqw; height: 4.6cqw; line-height: 1; border-radius: 41%; background: #fff1cd; color: #804652; align-items: center; justify-content: center; font-weight: 900; font-style: normal; font-size: clamp(.85rem, 3.2cqw, 1.5rem); }
.stage[data-explorer="found"] .explorer { --x: 78%; }
.stage[data-explorer="missed"] .explorer { --x: 89%; }
.stage[data-explorer="found"] .reaction, .stage[data-explorer="missed"] .reaction { display: flex; }
.stage[data-explorer="found"] .reaction::after { content: '!'; }
.stage[data-explorer="missed"] .reaction::after { content: '?'; }

.stage[data-scene="lights"] { --set-tint: #332944c9; }
.stage[data-scene="lights"][data-curtains="true"]::before { opacity: .33; }
.stage[data-scene="lights"][data-curtains="true"][data-lamp="true"]::before { opacity: .12; }
.night-window { --x: 33%; --y: 40%; width: 21cqw; height: 18cqw; background: linear-gradient(#454467, #66759a); border: .8cqw solid #9c675f; box-shadow: inset 0 0 0 .34cqw #5c3d5c, 0 .6cqw #9a635e; border-radius: 38% 38% .8cqw .8cqw / 26% 26% .8cqw .8cqw; overflow: visible; }
.moon { width: 29%; aspect-ratio: 1; top: 17%; right: 20%; border-radius: 50%; background: #fff1ae; box-shadow: 0 0 3cqw #ffe294; }
.window-bars { inset: 4%; background: linear-gradient(90deg, transparent 47%, #a77b82 48% 53%, transparent 54%), linear-gradient(0deg, transparent 44%, #b88483 45% 50%, transparent 51%); }
.window-curtain { inset: -2% 50% -2% 0; transform-origin: left top; border-radius: 35% 3% 15% 13% / 20% 5% 11% 11%; background: repeating-linear-gradient(92deg, #673b68 0 17%, #854972 17% 30%); transition: transform .55s var(--ease-smooth-out); }
.window-curtain.right { inset: -2% 0 -2% 50%; transform-origin: right top; border-radius: 3% 35% 13% 15% / 5% 20% 11% 11%; }
[data-curtains="true"] .window-curtain { transform: scaleX(.22) skewY(-4deg); }
[data-curtains="true"] .window-curtain.right { transform: scaleX(.22) skewY(4deg); }
.lamp-stand { --x: 58%; width: 14cqw; height: 19cqw; }
.lamp-base { inset: 25% 45% 42%; background: #814b50; border-radius: .3cqw; box-shadow: .2cqw 0 #d2936d; }
.lamp-shade { inset: 3% 9% 66%; background: #b96764; clip-path: polygon(25% 0,75% 0,100% 94%,0 94%); box-shadow: inset 0 -.6cqw #793f54; }
.lamp-stool { inset: 60% 6% 0; border-top: 1.1cqw solid #bf7761; border-inline: 1.25cqw solid #895149; border-radius: .65cqw; }
.lamp-glow { width: 26cqw; aspect-ratio: 1; left: -6cqw; top: -9cqw; border-radius: 50%; opacity: 0; background: radial-gradient(#fff4b1e8, #fbc96656 37%, transparent 70%); transition: opacity .5s; }
[data-lamp="true"] .lamp-glow { opacity: 1; }
[data-lamp="true"] .lamp-shade { background: #ffdc70; box-shadow: inset 0 -.6cqw #d99545; }
.lighting-actor { --x: 78%; --skin: #7494ae; --skin-light: #92b9c9; --skin-dark: #536883; --belly: #add5cd; }

.stage[data-scene="kitchen"] { --set-tint: linear-gradient(#f8ae425b, #ed75322b); }
.kitchen-shelf { --x: 31%; --y: 53%; width: 24cqw; height: 7cqw; border-bottom: .85cqw solid #945c52; border-radius: .4cqw; }
.kitchen-shelf i { bottom: 0; left: 11%; width: 18%; height: 75%; border-radius: 15%; background: #f6bc81; border: .33cqw solid #b66e64; }
.kitchen-shelf i:nth-child(2) { left: 44%; width: 22%; background: #b8d1af; height: 57%; }
.kitchen-shelf i:nth-child(3) { left: 76%; width: 14%; background: #eea3a8; height: 93%; }
.kitchen-counter { --x: 52%; --layer: 6; width: 38cqw; height: 12cqw; }
.kitchen-counter::before { content: ''; inset: 13% -3% 73%; border-radius: 1cqw; background: #ffc684; border: .35cqw solid #ad6550; z-index: 3; }
.counter-front { inset: 19% 0 0; border: .5cqw solid #9c544c; border-radius: 1cqw; background: repeating-linear-gradient(90deg, #d97e63 0 21%, #b77259 21% 25%); box-shadow: 0 .8cqw #72394055; }
.plate { inset: -9% 27% 72%; background: #a7c9bc; border: .32cqw solid #477868; box-shadow: inset 0 0 0 .45cqw #d5dfcc; border-radius: 57%; z-index: 4; }
.toast-slices { position: absolute; z-index: 5; inset: -52% 17% 66%; display: flex; align-items: end; justify-content: center; gap: .5cqw; }
.toast-slice { position: relative; display: block; width: 6.3cqw; height: 5.6cqw; border-radius: 46% 44% 19% 20% / 34% 39% 16% 16%; background: #ffcb75; border: .48cqw solid #a65d48; transform: translateY(-3cqw) rotate(8deg); opacity: 0; transition: opacity .18s, transform .52s var(--ease-smooth-out); }
.toast-slice:nth-child(2) { rotate: -10deg; }
.toast-slice .cheese { inset: 13%; background: #f6d92b; border: .3cqw solid #cc9547; border-radius: 10%; opacity: 0; transition: opacity .3s; }
.stage[data-slices="1"] .toast-slice:nth-child(1), .stage[data-slices="2"] .toast-slice:nth-child(-n+2), .stage[data-slices="3"] .toast-slice { opacity: 1; transform: translateY(0) rotate(0); }
.stage[data-cheese="true"] .cheese { opacity: 1; }
.kitchen-guest { --x: 80%; --skin: #d68087; --skin-light: #f2a9a6; --skin-dark: #9f4d67; --belly: #ffd2b0; }

.stage[data-scene="rain"] { --set-tint: linear-gradient(80deg,#cc774439 10%,#546893a1 88%); }
.rainy-door { --x: 74%; width: 22cqw; height: 27cqw; border: 1.25cqw solid #844759; border-bottom-width: .7cqw; border-radius: 52% 53% .45cqw .45cqw / 30% 33% .45cqw .45cqw; background: linear-gradient(#667caa, #a7b1ca 100%); box-shadow: 0 0 0 .4cqw #f1b589, 0 .7cqw #693954; overflow: visible; }
.rain-streaks { inset: 9% 3% 1%; border-radius: 42% 42% 0 0; background: repeating-linear-gradient(119deg, transparent 0 1.6cqw, #d9e5f592 1.6cqw 1.85cqw, transparent 1.85cqw 3.2cqw); animation: rain-curtain .8s linear infinite; }
@keyframes rain-curtain { to { background-position: 3cqw 5cqw; } }
.door-bar { inset: auto 0 -2%; height: 8%; background: #9d6874; }
.coat-rack { --x: 27%; --y: 37%; width: 12cqw; height: 15cqw; }
.hanger { inset: 6% 9% 45%; border: .45cqw solid #995547; border-radius: 50% 50% 23% 23%; }
.coat-prop { inset: 14% 4% 0; background: #f6bf53; border: .52cqw solid #ae6b3b; clip-path: polygon(22% 0,74% 0,100% 32%,88% 69%,73% 55%,85% 100%,15% 100%,26% 57%,12% 73%,0 34%); }
[data-coat="true"] .coat-prop { opacity: .18; }
.rain-actor { --x: 45%; --layer: 6; }
[data-outside="true"] .rain-actor { --x: 75%; }
.costume { inset: 52% 5% 2%; z-index: 3; border-radius: 29% 30% 48% 48%; visibility: hidden; background: linear-gradient(90deg, #ffcf64 0 46%, #b87946 47% 52%, #f1b64e 53%); border: .34cqw solid #bc743c; }
.scarf { inset: 56% 14% 28%; z-index: 3; visibility: hidden; background: #f98878; border: .21cqw solid #99435d; border-radius: .55cqw; transform: rotate(-8deg); }
[data-coat="true"] .costume, [data-scarf="true"] .scarf { visibility: visible; }
.stage[data-dry-at-exit="false"] .rain-actor .reaction { display: flex; background: #dbe9f0; color: #4f5a83; }
.stage[data-dry-at-exit="false"] .rain-actor .reaction::after { content: '…'; }

.stage[data-scene="garden"] { --set-tint: linear-gradient(10deg, #a99c4444, #b1c99923 83%); }
.garden-window { --x: 42%; --y: 44%; width: 33cqw; height: 20cqw; background: linear-gradient(166deg, #d1cead 0 35%, #8cae9c 37% 66%, #b4bd9c 67%); border: .9cqw solid #a57d65; border-radius: 1.4cqw; opacity: .86; }
.garden-window i { inset: 0 auto 0 31%; width: 3%; background: #c7a185; }
.garden-window i:nth-child(2) { left: 65%; }
.garden-window i:nth-child(3) { inset: 47% 0 auto; height: 5%; width: auto; }
.flowerpot { --x: 52%; --layer: 5; width: 14cqw; height: 12cqw; }
[data-moved="true"] .flowerpot { --x: 66%; }
.pot-body { inset: 14% 7% 0; clip-path: polygon(0 0, 100% 0, 83% 100%, 17% 100%); background: linear-gradient(100deg, #d6794d 0 35%,#bc5b49 77%); box-shadow: inset -.75cqw 0 #ab5546; }
.pot-rim { inset: 4% 0 64%; border-radius: 60%; background: #fc9c63; border: .35cqw solid #993f42; z-index: 4; }
.soil { inset: 10% 10% 74%; border-radius: 50%; background: #6d483c; z-index: 5; }
.sprout { left: 33%; bottom: 82%; width: 38%; height: 12cqw; transform-origin: center bottom; transform: scale(.05); opacity: 0; z-index: 6; transition: transform .67s var(--ease-smooth-out), opacity .4s; }
.sprout i:nth-child(1) { inset: 5% 43% 0; border-radius: 50% 50% 7% 9%; background: #416c43; }
.sprout i:nth-child(2), .sprout i:nth-child(3) { inset: 15% auto auto -36%; width: 78%; height: 36%; border-radius: 18% 75% 20% 69%; background: #7aa852; box-shadow: inset -.4cqw -.4cqw #4b824c; transform: rotate(-17deg); }
.sprout i:nth-child(3) { inset: 6% -26% auto auto; transform: scaleX(-1) rotate(-12deg); }
[data-grown="true"] .sprout { transform: scale(1); opacity: 1; }
.water-drops { inset: -117% 0 77%; opacity: 0; z-index: 6; }
.water-drops i { inset: 18% auto auto 20%; width: 13%; aspect-ratio: .81; border-radius: 27% 60% 52% 73%; background: #d8edf7; transform: rotate(26deg); box-shadow: 0 0 .6cqw #659ec5; }
.water-drops i:nth-child(2) { inset: 42% auto auto 57%; }
.water-drops i:nth-child(3) { inset: 2% auto auto 72%; }
[data-watered="true"] .water-drops { animation: watering .8s ease-out both; }
@keyframes watering { 20% { opacity: 1; } 70% { opacity: .72; } 100% { opacity: 0; transform: translateY(4cqw); } }
.seed { --x: 34%; --layer: 6; width: 3.6cqw; height: 3.4cqw; z-index: 6; }
.seed > i { inset: 7%; border-radius: 71% 33% 66% 33%; transform: rotate(22deg); background: #834a40; box-shadow: inset .34cqw .4cqw #cb8358, 0 .4cqw #70474866; }
[data-seed="in"] .seed { --x: 52%; --y: calc(var(--floor) + 10cqw); opacity: 0; transition-delay: 0s,0s,.3s; }
[data-seed="on"] .seed { --x: 57%; --y: calc(var(--floor) + 10.7cqw); }
[data-moved="true"][data-seed="on"] .seed { --x: 71%; }
[data-seed="under"] .seed { --x: 49%; --y: calc(var(--floor) - 1.2cqw); }
[data-seed="on"] .seed .prop-label, [data-seed="under"] .seed .prop-label { opacity: 0; }
.garden-actor { --x: 78%; --skin: #739769; --skin-light: #a2bd77; --skin-dark: #537759; --belly: #d7cf90; }

 
.stage[data-theme="peach"] { --set-tint: linear-gradient(15deg, #b962374c, #ffe6ad41 70%); }
.stage[data-theme="mint"] { --set-tint: linear-gradient(20deg, #386f5d82, #a4c89c66 80%); }
.stage[data-theme="blue"] { --set-tint: linear-gradient(5deg, #246d8985, #91bad477 80%); }
.stage[data-theme="violet"] { --set-tint: linear-gradient(5deg, #44285a99, #88376c66 80%); }
.stage[data-weather="rain"] { --set-tint: linear-gradient(15deg, #2c466cc9, #6591abb3); }
.stage[data-weather="sunny"] { --set-tint: linear-gradient(15deg, #c77d3266, #ffe1a778); }
.stage-piece {
  position: absolute;
  z-index: 3;
  left: var(--piece-x);
  bottom: var(--piece-y);
  transform: translateX(-50%);
  transition: left .48s var(--ease-smooth-out), bottom .48s var(--ease-smooth-out), opacity .33s ease-out;
}
.stage-piece[data-hidden] { opacity: 0; }
.stage-piece .piece-symbol {
  display: block;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
  font-size: clamp(.75rem, calc(var(--piece-size) * 1cqw), 8.6rem);
  font-weight: 900;
  line-height: 1.04;
  white-space: nowrap;
  filter: drop-shadow(0 .48cqw .22cqw #53263164);
}
.stage-piece .prop-label { bottom: -.28em; }
.stage-piece[data-skin="mark"] .piece-symbol,
.stage-piece[data-skin="track"] .piece-symbol,
.stage-piece[data-skin="mat"] .piece-symbol {
  width: calc(var(--piece-size) * 1cqw);
  height: 2.3cqw;
  overflow: hidden;
  border: .3cqw solid #aa643c;
  border-radius: .45cqw;
  background: #ffc66f;
  color: transparent;
}
.stage-piece[data-skin="track"] .piece-symbol {
  width: 60cqw;
  background: repeating-linear-gradient(90deg, #e6b178 0 2cqw, #804d49 2cqw 3cqw);
  border-block-color: #643d42;
}
.stage-piece[data-skin="mat"] .piece-symbol { height: 3.3cqw; border-color: #594176; background: #a77dbc; }
.stage-piece[data-skin="bench"] .piece-symbol,
.stage-piece[data-skin="striped"] .piece-symbol,
.stage-piece[data-skin="plain"] .piece-symbol,
.stage-piece[data-skin="screen"] .piece-symbol,
.stage-piece[data-skin="glass"] .piece-symbol {
  position: relative;
  width: calc(var(--piece-size) * .72cqw);
  height: calc(var(--piece-size) * .76cqw);
  overflow: hidden;
  border: .45cqw solid #995c4d;
  border-radius: 1.1cqw;
  color: transparent;
  background: #ed9b62;
}
.stage-piece[data-skin="bench"] .piece-symbol {
  width: 17cqw; height: 9cqw;
  border: 0;
  background: repeating-linear-gradient(0deg, #c17a48 0 1cqw, #f4bd7c 1cqw 1.8cqw) center top / 100% 66% no-repeat,
    linear-gradient(90deg, transparent 13%, #854a42 13% 25%, transparent 25% 75%, #854a42 75% 86%, transparent 86%);
}
.stage-piece[data-skin="striped"] .piece-symbol {
  background: repeating-linear-gradient(135deg, #764c84 0 1.4cqw, #f2c8dd 1.4cqw 2.65cqw);
  border-color: #694371;
}
.stage-piece[data-skin="plain"] .piece-symbol { background: #e09b62; }
.stage-piece[data-skin="screen"] .piece-symbol { height: 15cqw; background: #cee1d6; border-color: #597f78; }
.stage-piece[data-skin="glass"] .piece-symbol {
  width: 8cqw; height: 11cqw;
  border-radius: .5cqw .5cqw 2cqw 2cqw;
  border-color: #b6d7dc;
  background: linear-gradient(100deg, #d6eeed3b 3%, #f0ffefbb 25%, #bcf2ed54 29% 85%, #e8fff487);
}
.stage-piece[data-skin="glass"][data-fill="juice"] .piece-symbol { box-shadow: inset 0 -7.6cqw #ffc45a; }
.stage-piece[data-skin="glass"][data-fill="water"] .piece-symbol { box-shadow: inset 0 -7.6cqw #85c6ea; }
.stage-piece[data-skin="sign"] .piece-symbol { color: #fff4ca; text-shadow: 0 .3cqw #753d69; }
.stage-piece[data-skin="counter"] .piece-symbol {
  padding: .5cqw 1.2cqw;
  border-radius: .65cqw;
  background: #fff2d3;
  color: #693f54;
  font: 850 clamp(.85rem, 2.4cqw, 1.25rem)/1.3 "Avenir Next", system-ui, sans-serif;
}
.stage-piece[data-skin="water"] .piece-symbol {
  width: 29cqw; height: 4cqw;
  border-radius: 50%;
  background: repeating-linear-gradient(8deg, #86c9df 0 .6cqw, #5f9acc .6cqw 1.4cqw);
  color: transparent;
}
.stage-piece[data-skin="projection"] .piece-symbol {
  display: grid; place-items: center;
  width: 24cqw; height: 15cqw;
  border: .7cqw solid #764b5f;
  border-radius: 1.1cqw;
  background: #45354e;
  color: #5d4667;
  font-size: 10cqw;
}
.stage-piece[data-lit] .piece-symbol {
  background: #fff0b1;
  color: #ee9b5a;
  box-shadow: 0 0 5.5cqw #ffdc8eb3;
}
.stage-piece[data-motion="spin"] .piece-symbol { animation: piece-spin .74s linear infinite; }
.stage-piece[data-motion="wobble"] .piece-symbol { animation: piece-sway .43s ease-in-out 3; }
.stage-piece[data-motion="float"] .piece-symbol { animation: piece-float .7s ease-in-out 3; }
.stage-piece[data-motion="soft"] .piece-symbol { animation: piece-tap .26s ease-out; }
.stage-piece[data-motion="loud"] .piece-symbol { animation: piece-sway .3s ease-in-out 2; }
.stage-piece[data-motion="once"] .piece-symbol { animation: piece-sway .46s ease-in-out; }
.stage-piece[data-motion="twice"] .piece-symbol { animation: piece-sway .46s ease-in-out 2; }
@keyframes piece-spin { to { transform: rotate(360deg); } }
@keyframes piece-sway { 26% { transform: rotate(12deg); } 68% { transform: rotate(-11deg); } }
@keyframes piece-float { 50% { transform: translateY(-.8cqw); } }
@keyframes piece-tap { 50% { transform: scale(.96) translateY(.25cqw); } }

@media (max-width: 780px), (max-height: 500px) and (max-width: 1050px) and (orientation: landscape) {
  body { overflow: hidden; }
  .studio {
    height: 100dvh;
    max-width: 590px;
    padding: max(4px, env(safe-area-inset-top)) max(7px, env(safe-area-inset-right))
      max(6px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 5px;
  }
  .masthead { min-height: 42px; gap: 6px; }
  .brand { gap: 6px; min-width: 0; }
  .brand h1 { font-size: clamp(1.16rem, 5.3vw, 1.62rem); white-space: nowrap; }
  .brand p, .film-icon { display: none; }
  .clapper { width: 28px; border-radius: 8px; box-shadow: 0 2px var(--deep-wine); flex: 0 0 28px; }
  .clapper::before, .clapper::after { width: 15px; left: 7px; }
  .clapper::before { top: 7px; height: 5px; background-size: 10px 5px; }
  .clapper::after { top: 12px; height: 9px; }
  .header-actions { gap: 4px; }
  .mobile-level { display: inline-flex; white-space: nowrap; }
  .header-actions .button { min-height: 42px; padding: 4px 6px; gap: 3px; font-size: .79rem; }
  .library-count { font-size: .72rem; }
  #selection-home { display: none; }

  .selection { margin: 9px 0 0; gap: 6px; }
  .chapters { display: grid; gap: 4px; }
  .chapter-tab { min-height: 44px; padding-inline: 2px; font-size: .77rem; }
  .chapter-tab[data-done]::after { content: ''; }
  .scene-nav { gap: 4px; }
  .scene-tab { min-height: 55px; gap: 4px; padding: 4px 1px; flex-direction: column; font-size: .82rem; }
  .scene-tab[data-done]::after { position: absolute; top: 2px; right: 4px; }
  .progress { padding: 0 2px; text-align: right; font-size: .8rem; }
  #scene-picker { width: min(calc(100% - 18px), 480px); padding: 10px; }

  .workspace { min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; align-items: stretch; gap: 5px; }
  .scene-panel, .director-panel { min-height: 0; padding: 5px; border-radius: 11px; box-shadow: none; }
  .scene-panel { display: grid; grid-template: 'intro' auto 'stage' minmax(0, 1fr) 'feedback' auto / minmax(0, 1fr); }
  .scene-intro { grid-area: intro; display: block; position: relative; padding: 0 1px 4px; }
  .scene-intro h2 { font-size: clamp(1rem, 4.5vw, 1.3rem); line-height: 1.22; }
  .scene-intro:has(.cue-controls:not([hidden])) h2 { padding-inline-end: 108px; min-height: 27px; }
  .scene-intro p { font-size: .81rem; line-height: 1.25; margin-top: 2px; }
  .cue-controls { position: absolute; top: 0; right: 0; gap: 1px; }
  .cue-controls .button, .cue-controls .text-button { min-height: 30px; padding: 4px 5px; font-size: .76rem; }
  .cue-text { grid-area: stage; z-index: 10; align-self: start; margin: 31px 5px 0; padding: 4px 7px; font-size: .86rem; box-shadow: 0 2px 9px #2d162f55; }
  .stage-frame { grid-area: stage; min-height: 0; container-type: size; border-radius: 8px; box-shadow: none; background: #682f43; }
  .stage { height: 100%; max-width: 210cqh; margin-inline: auto; aspect-ratio: auto; --floor: 24%; }
  .shot-status { top: 4px; left: 5px; padding: 2px 5px; font-size: .73rem; }
  .subtitle { bottom: 4px; padding: 3px 6px; font-size: .82rem; }
  .feedback { grid-area: feedback; min-height: 0; margin-top: 4px; padding: 3px 5px; border-radius: 6px; line-height: 1.17; }
  .feedback strong { font-size: .85rem; }
  .feedback p { font-size: .76rem; margin-top: 2px; }

  .director-panel { align-self: start; position: relative; }
  .director-intro { padding: 0 0 0 2px; gap: 4px; }
  .director-intro h2 { font-size: .99rem; }
  .director-intro .text-button { min-height: 30px; font-size: .8rem; }
  .director-hint { position: absolute; z-index: 11; inset: auto 4px calc(100% + 4px); margin: 0; padding: 6px 8px; box-shadow: 0 2px 9px #2d162f4d; font-size: .82rem; }
  .shot-nav { display: flex; gap: 4px; margin-bottom: 4px; }
  .shot-tab { flex: 1; min-height: 36px; padding: 2px 4px; border: 1px solid #e9ccd7; border-radius: 7px; background: #fff8f1; color: var(--wine); font-size: .84rem; font-weight: 760; }
  .shot-tab[aria-pressed="true"] { background: #f0d9e9; border-color: #b77b9f; }
  .shot-tab[data-ready]::after { content: ' ✓'; color: #3b6844; }
  .beat { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; padding: 4px; border-radius: 8px; }
  .beat-head { grid-column: 2; grid-row: 1; align-self: start; }
  .beat-head h3 { display: none; }
  .listen-line { min-height: 35px; padding: 3px 5px; font-size: .74rem; white-space: nowrap; }
  .line { grid-column: 1; grid-row: 1; min-height: 35px; margin: 0; padding: 3px 5px; font-size: .93rem; line-height: 1.18; }
  .word-group { grid-column: 1 / -1; gap: 4px; }
  .word-group + .word-group { margin-top: 0; }
  .word-group legend { padding: 0 0 1px; font-size: .74rem; line-height: 1.16; }
  .word-group[data-choice="action"] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .word-chip { min-height: 41px; min-width: 0; padding: 3px 5px; font-size: .85rem; overflow-wrap: anywhere; }
  .director-actions { flex-wrap: nowrap; gap: 4px; margin-top: 5px; }
  .director-actions .button { min-height: 43px; padding: 3px 7px; font-size: .89rem; }
  .reset-button, .next-button { flex: 0 0 auto; margin: 0; }
  .shoot-button { flex: 1; box-shadow: 0 2px #af6e42; }
}
@media (max-width: 365px) and (orientation: portrait) {
  .clapper { display: none; }
}
@media (max-width: 780px) and (max-height: 640px) and (orientation: portrait),
  (max-width: 1050px) and (max-height: 500px) and (orientation: landscape) {
  .feedback[data-tone="ready"] { display: none; }
  .shot-tab { min-height: 31px; }
  .word-chip { min-height: 35px; font-size: .8rem; }
  .director-actions .button { min-height: 38px; }
}
@media (max-width: 1050px) and (max-height: 500px) and (orientation: landscape) {
  .studio { max-width: none; }
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(238px, .85fr); grid-template-rows: minmax(0, 1fr); }
  .director-panel { align-self: stretch; display: flex; flex-direction: column; }
  .director-hint { inset: 33px 3px auto; }
  .director-actions { margin-top: auto; padding-top: 5px; }
}
@media (max-width: 780px) and (max-height: 455px) and (orientation: portrait) {
  body { overflow-y: auto; }
  .studio { min-height: 455px; }
}
