/* MIYU説明版（試作）：スクリーンの下に「話す帯」を足し、MIYUが資料の左下から顔を出して話す。
 * 資料本体の deck.css は変えない。帯の中の単位は帯の幅（＝資料の幅）。 */

.talk { display: none; }
.js .deck--miyu .talk {
  container-type: inline-size;
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 19cqw minmax(0, 1fr); align-items: center; column-gap: 1.6cqw;
  min-height: 11cqw; padding: 1.2cqw 0 0;
}

/* 資料のフッター左（作品名）はMIYUと重なるので隠す */
.js .deck--miyu .slide__foot span:first-child { visibility: hidden; }

.talk__miyu { position: relative; align-self: end; height: 11cqw; }
.talk__miyu img {
  position: absolute; left: 0; bottom: 0; height: 19cqw; width: auto;
  opacity: 0; transform-origin: 50% 100%;
}
.talk__miyu img.is-on { opacity: 1; }
/* 口パク：話している間だけ、その段の口の重ね絵を出す（ポーズの揺れは同じ is-on で一緒に動く） */
.talk__miyu img[data-mouth] { visibility: hidden; }
.talk[data-mouth="0"] img.is-on[data-mouth="0"],
.talk[data-mouth="1"] img.is-on[data-mouth="1"],
.talk[data-mouth="2"] img.is-on[data-mouth="2"] { visibility: visible; }
/* まばたき：目を閉じた重ね絵を一瞬だけ出す */
.talk__miyu img[data-blink] { visibility: hidden; }
.talk.is-blink img.is-on[data-blink] { visibility: visible; }

.talk__bubble {
  position: relative; margin: 0; align-self: center;
  display: grid; gap: .35em; padding: 1.1cqw 1.8cqw 1.3cqw;
  background: var(--card); color: var(--ink); border: .16cqw solid var(--ink); border-radius: 1.6cqw;
  font-size: 1.75cqw; font-weight: 700; line-height: 1.55; min-height: 6.6cqw;
  transform-origin: 0 60%; word-break: auto-phrase;
}
.talk__bubble::before { /* しっぽ */
  content: ''; position: absolute; left: -1.1cqw; top: 55%; width: 2cqw; height: 2cqw;
  background: var(--card); border-left: .16cqw solid var(--ink); border-bottom: .16cqw solid var(--ink);
  transform: translateY(-50%) rotate(45deg);
}
.talk__name { width: max-content; padding: .05em .7em; border-radius: 999px; background: var(--crimson); color: var(--ink); font-size: .62em; letter-spacing: .1em; }
.talk__text::after { content: ''; display: inline-block; width: .5em; }

/* 動き：スライドが変わるたびに、ぴょこっと出て、話している間だけ小さく揺れる（有限回） */
.talk.is-hop .talk__miyu img.is-on { animation: miyu-hop .55s cubic-bezier(.3, 1.4, .5, 1) both, miyu-talk .34s ease-in-out .55s var(--beats, 4) both; }
.talk.is-hop .talk__bubble { animation: bubble-in .35s cubic-bezier(0.16, 1, 0.3, 1) .12s both; }
@keyframes miyu-hop { from { translate: 0 22%; scale: .94 1.04; } 60% { translate: 0 -4%; scale: 1.02 .98; } to { translate: 0 0; scale: 1; } }
@keyframes miyu-talk { 50% { translate: 0 -2.5%; rotate: -1.2deg; } }
@keyframes bubble-in { from { opacity: 0; scale: .86; } }
.is-still .talk *, .is-still .talk { animation: none !important; }

/* 全画面：資料と帯をあわせて画面に収める（帯の高さ ≒ 資料の幅の 12.5%） */
.deck--miyu:fullscreen { align-content: center; justify-items: center; place-items: initial; display: grid; }
.deck--miyu:fullscreen .frame, .deck--miyu:fullscreen .talk { width: min(100vw, calc(100vh / 0.6875)); margin: 0 auto; }
.deck--miyu:fullscreen .talk__bubble { background: var(--card); }

@media (max-width: 40rem) {
  .js .deck--miyu .talk { grid-template-columns: 30cqw minmax(0, 1fr); min-height: 22cqw; column-gap: 3cqw; padding-top: 3cqw; }
  .talk__miyu { height: 22cqw; }
  .talk__miyu img { height: 30cqw; }
  .talk__bubble { font-size: 3.7cqw; padding: 2.4cqw 3cqw 2.8cqw; border-width: .35cqw; border-radius: 3cqw; min-height: 0; }
  .talk__bubble::before { left: -2cqw; width: 3.6cqw; height: 3.6cqw; border-width: .35cqw; }
  .deck--miyu:fullscreen .frame, .deck--miyu:fullscreen .talk { width: min(100vw, calc(100vh / 1.85)); }
}

/* ナレーション：再生ボタン1つで、音声と送りをまとめて操作する */
/* 再生ボタンが送りを受け持つので、通常版の「自動で進める」「もう一度動かす」は出さない */
.deck--miyu ~ .controls #auto, .deck--miyu ~ .controls #replay { display: none; }
.btn-play { min-height: 44px; padding: 0 1.4em; border-radius: var(--r-pill); border: 0; background: var(--crimson); color: var(--ink); font-weight: 700; font-size: var(--fs-small); }
.btn-play[aria-pressed="true"] { background: var(--card); box-shadow: inset 0 0 0 1px var(--ink); }
.btn-play:not(:disabled):active { scale: var(--press-scale); }
.volume { display: inline-flex; align-items: center; gap: .5em; font-size: var(--fs-small); font-weight: 700; min-height: 44px; }
.volume input { width: 96px; accent-color: var(--ink); }

/* 台本はMIYUが読み上げるので、画面には出さない（読み上げ音声の元として本文は残す） */
.script { display: none; }
