/* Emoji theater (spec §7.2). --u is one emoji unit (set per scene by fitUnit); --s, --kb, --ki, --kc scale items. */
.stage {
  position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 42vh; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden; --u: 56px;
}
.stage.cmp { display: flex; align-items: center; justify-content: space-evenly; padding: 8px; }
.stage.small { aspect-ratio: 4 / 3; max-height: none; box-shadow: none; background: transparent; border-radius: 14px; }
.frame {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: calc(var(--u) * 0.18); padding: 12px; opacity: 0; transition: opacity .35s ease;
}
.frame.on { opacity: 1; }
.stage.cmp .frame { position: static; flex: 1; padding: 4px; transition: none; }
.it { display: inline-grid; place-items: center; position: relative; --sz: calc(var(--u) * var(--s, 1) * var(--kb, 1) * var(--ki, 1) * var(--kc, 1)); }
.it > .em { --em: var(--sz); }
.it > .em-text { font-size: calc(var(--sz) * 0.85); }
.arrow { font-size: calc(var(--sz) * 0.8); font-weight: 900; color: var(--accent); line-height: 1; }
.qmark { font-size: calc(var(--sz) * 0.9); font-weight: 900; color: var(--blue); line-height: 1; }
.divider { align-self: stretch; width: 3px; margin: 6px 4px; border-radius: 3px; background: var(--surface-2); }
.dots { display: inline-flex; gap: 6px; }
.dots i { width: calc(var(--sz) * .16); height: calc(var(--sz) * .16); border-radius: 50%; background: var(--muted); }
.group { display: inline-flex; gap: calc(var(--u) * 0.04); align-items: flex-end; }
.stack { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.stack .row { display: flex; gap: 4px; }
.inside { display: inline-grid; place-items: center; }
.inside > * { grid-area: 1 / 1; }
.inside .inner { --ki: 0.5; z-index: 1; }
.count { display: inline-flex; flex-wrap: wrap; justify-content: center; max-width: calc(var(--u) * 3.2); gap: 2px; }
.bubble {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; margin-left: 8px;
  border-radius: 18px; background: var(--bubble); position: relative; --kb: 0.62;
}
.bubble.say::before {
  content: ''; position: absolute; left: -8px; bottom: 10px;
  border: 8px solid transparent; border-right-color: var(--bubble); border-left: 0;
}
.bubble.think { border-radius: 26px; }
.bubble.think::before { content: ''; position: absolute; left: -12px; bottom: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--bubble); }
.ring > .em, .ring > .em-text { border-radius: 50%; padding: 4%; box-shadow: 0 0 0 4px var(--ring-color); background: color-mix(in srgb, var(--ring-color) 14%, transparent); }
.ring-me { --ring-color: var(--ring-me); }
.ring-you { --ring-color: var(--ring-you); }
.ring-boss { --ring-color: var(--ring-boss); }

/* state modifiers (also shown in stills) */
.m-ghost { opacity: .35; filter: grayscale(1); }
.m-flip > .em { transform: scaleX(-1); }
.m-hl > .em { filter: drop-shadow(0 0 8px var(--accent)) drop-shadow(0 0 2px var(--accent)); }
.m-no::before {
  content: ''; position: absolute; left: -8%; right: -8%; top: 44%; height: 12%; z-index: 2;
  background: var(--bad); border-radius: 99px; transform: rotate(-35deg); box-shadow: 0 0 0 3px var(--surface);
}
.m-yes::after {
  content: '✓'; position: absolute; right: -10%; bottom: -8%; width: 42%; aspect-ratio: 1; z-index: 2;
  border-radius: 50%; background: var(--good); color: #fff; font-weight: 900; display: grid; place-items: center;
  font-size: calc(var(--sz) * .28);
}
/* motion modifiers: end state always, animation only while the frame plays */
.m-grow { transform: scale(1.3); }
.m-shrink { transform: scale(.3); opacity: .5; }
.m-left { transform: translateX(-35%); }
.m-right { transform: translateX(35%); }
.m-up { transform: translateY(-30%); }
.m-down { transform: translateY(30%); }
.m-out { transform: translateX(90%); opacity: 0; }
.anim .m-shake { animation: shake .5s 2; }
.anim .m-bounce { animation: bounce .7s 2; }
.anim .m-pulse { animation: pulse 1.2s ease-in-out infinite; }
.anim .m-spin { animation: spin 1.1s ease-in-out; }
.anim .m-grow { animation: grow .9s ease-out both; }
.anim .m-shrink { animation: shrink 1.1s ease-in both; }
.anim .m-left { animation: go-left 1s ease-in-out both; }
.anim .m-right { animation: go-right 1s ease-in-out both; }
.anim .m-up { animation: go-up .9s ease-out both; }
.anim .m-down { animation: go-down .9s ease-out both; }
.anim .m-in { animation: slide-in .7s ease-out both; }
.anim .m-out { animation: slide-out .9s ease-in both; }
.anim .m-hl > .em { animation: glow 1.2s ease-in-out 2; }
.anim .dots i { animation: blink 1s infinite; }
.anim .dots i:nth-child(2) { animation-delay: .2s; }
.anim .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes shake { 25% { transform: translateX(-8%) rotate(-6deg); } 75% { transform: translateX(8%) rotate(6deg); } }
@keyframes bounce { 40% { transform: translateY(-22%); } 60% { transform: translateY(-8%); } }
@keyframes pulse { 50% { transform: scale(1.12); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes grow { from { transform: scale(.6); } }
@keyframes shrink { from { transform: scale(1); opacity: 1; } }
@keyframes go-left { from { transform: translateX(0); } }
@keyframes go-right { from { transform: translateX(0); } }
@keyframes go-up { from { transform: translateY(0); } }
@keyframes go-down { from { transform: translateY(0); } }
@keyframes slide-in { from { transform: translateX(80%); opacity: 0; } }
@keyframes slide-out { from { transform: translateX(0); opacity: 1; } }
@keyframes glow { 50% { filter: drop-shadow(0 0 16px var(--accent)) drop-shadow(0 0 4px var(--accent)); } }
@keyframes blink { 50% { opacity: .2; } }

/* tone line */
.tone-wrap { display: flex; justify-content: center; min-height: 44px; }
.tone-wrap .tone-line { height: 64px; width: auto; }
.tone-line .tone-path { stroke-dasharray: 100; stroke-dashoffset: 0; }
.tone-line.drawing .tone-path { animation: draw .8s linear both; }
.tone-line.drawing .tone-dot { animation: pop .3s ease both; }
@keyframes draw { from { stroke-dashoffset: 100; } }
@keyframes pop { from { transform: scale(0); opacity: 0; } }
.tone-line .tone-dot { transform-box: fill-box; transform-origin: center; }
