/* story_cinema.css — EP003 「하나뿐인 별빛 망원경」 시연 영상 · 새 그림(토리 토끼 · 삐오 병아리). story_cinema.js 와 짝.
   귀·몸짓 움직임은 시연 index.html 그대로 (perk 쫑긋 · perk2 쫑긋쫑긋 · one 한쪽만 · tremble 파르르 · droop 축). */

/* ---------------------------------------------------------------- 영상 층 (장면 칸 전체) */
#stage-floor > .cine-layer {
  position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none;
  background: #0d1533; transition: opacity .7s ease;
}
#stage-floor > .cine-layer[hidden] { display: none; }
#stage-floor > .cine-layer.is-out { opacity: 0; }
.cine-layer .cine-poster, .cine-layer .cine-video {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; display: block;
  object-fit: cover; object-position: 50% 62%;   /* 무대 배경 그림(focus 50% 62%)과 같은 자리 → 영상 끝 장면과 그림 친구 자리가 맞는다 */
}
.cine-layer .cine-video { background: transparent; }
.cine-layer.is-calm .cine-video { visibility: hidden; }   /* 움직임 줄이기: 영상은 소리만, 화면은 그림 */
.cine-layer::after {   /* 자막이 밝은 교실 영상 위에서도 또렷하게 — 위쪽만 살짝 어둡게 */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(10, 14, 40, .38), transparent 26%);
}
.cine-layer .cine-figs { position: absolute; inset: 0; }
.cine-fig { position: absolute; display: block; translate: -50% -100%; }
.cine-fig .cine-rig { animation: cine-sway 4s ease-in-out infinite; }
.cine-fig.is-talking .cine-rig { animation: cine-talk .42s ease-in-out 6; }

/* 큰 ▶ (자동 재생이 막혔을 때) */
.cine-layer .cine-play {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 3; pointer-events: auto;
  width: clamp(76px, 14cqw, 132px); aspect-ratio: 1; border-radius: 50%; border: 4px solid #fff;
  background: rgba(255, 196, 64, .94); color: #4a3112; font-size: clamp(30px, 6cqw, 56px); line-height: 1;
  display: grid; place-items: center; padding-left: .12em; cursor: pointer;
  box-shadow: 0 0 0 0 rgba(255, 210, 100, .7), 0 10px 26px rgba(0, 0, 0, .35);
  animation: cine-pulse 1.5s ease-out infinite;
}
.cine-layer .cine-play[hidden], .cine-layer .cine-watch[hidden] { display: none; }
.cine-layer .cine-play:focus-visible, .cine-layer .cine-watch:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
@keyframes cine-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 210, 100, .7), 0 10px 26px rgba(0, 0, 0, .35); } 100% { box-shadow: 0 0 0 22px rgba(255, 210, 100, 0), 0 10px 26px rgba(0, 0, 0, .35); } }
/* 움직임 줄이기에서 영상으로 보기 */
.cine-layer .cine-watch {
  position: absolute; right: 12px; bottom: 12px; z-index: 3; pointer-events: auto;
  border: 2px solid rgba(255, 255, 255, .85); border-radius: 999px; padding: 8px 14px;
  background: rgba(16, 22, 56, .72); color: #fff; font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer;
}

/* 영상이 나오는 동안: 그림 친구 숨김(영상 안에 있다) · 다시 듣기 숨김(영상 소리가 대사) · 아래 판은 건너뛰기/다음 버튼만 */
#stage-floor > .char-chip.is-cine { transition: left .35s ease, top .35s ease, opacity .6s ease, visibility .6s; }
#stage-floor.cine-cast-off > .char-chip,
#stage-floor.cine-sky > .char-chip { opacity: 0; visibility: hidden; pointer-events: none; }
.screen-stage.cine-on #btn-subtitle-replay, .screen-stage.cine-on .narr-replay { display: none; }
.screen-stage.cine-on .stage-side > :not(#cine-panel) { display: none !important; }
.screen-stage.cine-on #stage-objects, .screen-stage.cine-on #stage-skills { display: none !important; }

.cine-panel { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 6px 0; }
.cine-panel[hidden] { display: none; }
.cine-panel-title { margin: 0; font-family: var(--font-display, inherit); font-size: 1.05rem; color: var(--sub, #7a6a58); }
.cine-panel .cine-skip[hidden], .cine-panel .cine-cta[hidden] { display: none; }
.cine-panel .cine-cta { min-width: min(320px, 80%); }

/* ---------------------------------------------------------------- 새 그림 친구 (무대 칩) */
#stage-floor > .char-chip.is-cine { translate: -50% -100%; gap: 0; }   /* 발끝이 자리(바닥) */
#stage-floor > .char-chip.is-cine .char-chip-avatar {
  width: var(--cine-w, 18cqw); height: auto; display: block; font-size: 0;
}
#stage-floor > .char-chip.is-cine .char-chip-avatar::before { bottom: 1%; width: 64%; height: 9%; }
#stage-floor > .char-chip.is-cine .char-chip-name { position: absolute; top: auto; bottom: 0; left: 50%; translate: -50% 35%; z-index: 1; }   /* 이름표는 발끝에 겹쳐서 — 칸 밖으로 잘리지 않게 */
#stage-floor > .char-chip.is-cine .char-chip-emote { display: none; }
.cine-rig { position: relative; display: block; width: 100%; aspect-ratio: var(--cine-ar, 642 / 872); transform-origin: 50% 100%; }
.cine-fig .cine-rig { aspect-ratio: inherit; }
.cine-fig { aspect-ratio: var(--cine-ar, 642 / 872); }
.cine-rig img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-select: none; }
.cine-rig .cine-body { filter: drop-shadow(0 4px 6px rgba(20, 16, 40, .35)); }
.char-chip.is-cine.is-talking .cine-rig { animation: cine-talk .42s ease-in-out infinite; }
.char-chip.is-cine.is-talking .cine-body { filter: drop-shadow(0 0 10px rgba(255, 226, 140, .95)) drop-shadow(0 4px 6px rgba(20, 16, 40, .3)); }
.char-chip.is-cine.is-selected .cine-body { filter: drop-shadow(0 0 7px rgba(255, 205, 70, .95)) drop-shadow(0 0 2px #fff) drop-shadow(0 4px 6px rgba(20, 16, 40, .3)); }
.char-chip.is-cine.is-noticing .cine-rig { animation: cine-hop .45s ease-out 2; }
@keyframes cine-talk { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.015, .985); } }
@keyframes cine-sway { 0%, 100% { transform: rotate(-1deg); } 50% { transform: rotate(1deg); } }
@keyframes cine-hop { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-10%) scale(1.02, .98); } }

/* 토리 귀 */
.cine-tori .cine-ear { transition: transform .35s ease; }
.cine-e-perk .cine-ear-l { animation: cine-earL-perk 1.1s ease-out forwards; }
.cine-e-perk .cine-ear-r { animation: cine-earR-perk 1.1s ease-out forwards; }
@keyframes cine-earL-perk { 0% { transform: rotate(0); } 35% { transform: rotate(11deg); } 100% { transform: rotate(6deg); } }
@keyframes cine-earR-perk { 0% { transform: rotate(0); } 35% { transform: rotate(-11deg); } 100% { transform: rotate(-6deg); } }
.cine-e-perk2 .cine-ear-l { animation: cine-earL-perk2 .9s ease-in-out 2; }
.cine-e-perk2 .cine-ear-r { animation: cine-earR-perk2 .9s ease-in-out 2; }
@keyframes cine-earL-perk2 { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(12deg); } 50% { transform: rotate(-3deg); } 75% { transform: rotate(12deg); } }
@keyframes cine-earR-perk2 { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 50% { transform: rotate(3deg); } 75% { transform: rotate(-12deg); } }
.cine-e-one .cine-ear-r { transform: rotate(-15deg); }
.cine-e-one .cine-ear-l { transform: rotate(-4deg); }
.cine-e-tremble .cine-ear-l { transform: rotate(-9deg); animation: cine-tremL .12s linear infinite; }
.cine-e-tremble .cine-ear-r { transform: rotate(9deg); animation: cine-tremR .12s linear infinite; }
@keyframes cine-tremL { 0%, 100% { transform: rotate(-9deg); } 50% { transform: rotate(-6deg); } }
@keyframes cine-tremR { 0%, 100% { transform: rotate(9deg); } 50% { transform: rotate(6deg); } }
.cine-e-droop .cine-ear-l { transform: rotate(-20deg); }
.cine-e-droop .cine-ear-r { transform: rotate(20deg); }
.cine-e-droop .cine-tori .cine-body { transform: translateY(2%); }
/* 삐오 몸짓 */
.cine-e-perk .cine-pio .cine-body, .cine-e-perk2 .cine-pio .cine-body { animation: cine-hop .45s ease-out 2; }
.cine-e-tremble .cine-pio .cine-body { animation: cine-shake .14s linear 8; }
@keyframes cine-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3%); } 75% { transform: translateX(3%); } }
.cine-e-one .cine-pio .cine-body { transform: rotate(9deg); transition: transform .4s; }
.cine-e-droop .cine-pio .cine-body { transform: translateY(4%) scale(.97) rotate(-4deg); transition: transform .5s; }

/* 에피소드 카드 · 결말 카드 (EP003 만) */
.ep-art .ep003-art { object-fit: contain; }
#screen-ending .ending-emoji img.is-ep003 { object-fit: contain; }

/* 움직임 줄이기 · 자극 줄이기: 흔들림·귀 움직임 없이 (자세만) */
@media (prefers-reduced-motion: reduce) {
  .cine-rig, .cine-rig img, .cine-fig .cine-rig, .cine-layer .cine-play { animation: none !important; }
  #stage-floor > .cine-layer { transition: none; }
}
html.sens-calm .cine-rig, html.sens-calm .cine-rig img, html.sens-calm .cine-layer .cine-play { animation: none !important; }
