/* ========================================
   第六場 めでたし、めでたし（最後の場面。引き抜かずに止まる）
   言葉の頭（--beat-N）
     0 桃太郎たちは宝物を村へ持ち帰りました。 / 1 おじいさんとおばあさんは大喜び。
     2 村には笑顔が戻り、 / 3 みんな仲良く、 / 4 幸せに暮らしましたとさ。
   ======================================== */

/* ---------- ずっと動いているもの（夕日・雲） ---------- */

.scene-home .s6-sun { animation: s6-sunset 12s linear both; }
@keyframes s6-sunset {
  to { translate: 0 26px; }
}
.scene-home .s6-cloud-a { animation: drift 18s ease-in-out -6s infinite alternate; }
.scene-home .s6-cloud-b { animation: drift 23s ease-in-out -12s infinite alternate-reverse; }
.scene-home .momotaro .tails { animation: sway 1.1s ease-in-out infinite; }

/* ---------- 宝物を持ち帰る（大八車を引いて、右から帰ってくる） ---------- */

.scene-home .s6-arrive { animation: s6-arrive 3.1s cubic-bezier(0.2, 0.6, 0.4, 1) 0.3s both; }
@keyframes s6-arrive {
  from { translate: 620px 0; }
  to { translate: 0 0; }
}
.scene-home .s6-wheel { animation: s6-roll 3.1s cubic-bezier(0.2, 0.6, 0.4, 1) 0.3s both; }
@keyframes s6-roll {
  to { rotate: -540deg; }
}
.scene-home .s6-walk { animation: bob 0.42s ease-in-out 0.3s 7; }
.scene-home .s6-walk.w2 { animation-delay: 0.45s; }

/* 雉は車の上を飛んできて、「村には笑顔が戻り」で家の屋根へ */
.scene-home .s6-bird-fly { animation: s6-bird-roof 1.5s ease-in-out var(--beat-2) forwards; }
@keyframes s6-bird-roof {
  0% { translate: 0 0; }
  50% { translate: -740px -200px; }
  100% { translate: -1473px -225px; }
}
.scene-home .pheasant { animation: s6-bird-turn 0.25s ease-in-out var(--beat-2) forwards; }
@keyframes s6-bird-turn {
  from { scale: 1 1; }
  to { scale: -1 1; }
}
.scene-home .pheasant .wing { animation: flap 0.2s ease-in-out 41; }

/* ---------- おじいさんとおばあさんは大喜び ---------- */

.scene-home .s6-joy-a { animation: hop 0.55s ease-out var(--beat-1) 2; }
.scene-home .s6-joy-b { animation: hop 0.55s ease-out calc(var(--beat-1) + 0.12s) 2; }
.scene-home .s6-grandpa .arm-b { animation: wave-hand 2.3s ease-in-out calc(var(--beat-1) + 0.1s) both; }
/* おばあさんは手を胸の前で合わせているので、腕を上げると頭に隠れる。手を開いて閉じる拍手にする */
.scene-home .s6-grandma .arm-a { animation: s6-clap-a 0.4s ease-in-out calc(var(--beat-1) + 0.1s) 4; }
.scene-home .s6-grandma .arm-b { animation: s6-clap-b 0.4s ease-in-out calc(var(--beat-1) + 0.1s) 4; }
@keyframes s6-clap-a {
  50% { rotate: 24deg; }
}
@keyframes s6-clap-b {
  50% { rotate: -24deg; }
}
.scene-home .s6-hearts .heart { animation: float-up 1.8s ease-out calc(var(--beat-1) + 0.3s) both; }
.scene-home .s6-hearts g:nth-child(2) .heart { animation-delay: calc(var(--beat-1) + 0.6s); }
.scene-home .s6-hearts g:nth-child(3) .heart { animation-delay: calc(var(--beat-1) + 0.9s); }

/* ---------- 村には笑顔が戻る（灯り・笑顔・花） ---------- */

.scene-home .lit { animation: fade 0.4s ease calc(var(--beat-2) + 0.1s) both; }
.scene-home .lit.l2 { animation-delay: calc(var(--beat-2) + 0.3s); }
.scene-home .lit.l3 { animation-delay: calc(var(--beat-2) + 0.5s); }
.scene-home .lit.l4 { animation-delay: calc(var(--beat-2) + 0.7s); }
.scene-home .s6-smiles .smile { animation: pop 0.45s var(--ease-pop) calc(var(--beat-2) + 0.2s) both; }
.scene-home .s6-smiles g:nth-child(2) .smile { animation-delay: calc(var(--beat-2) + 0.4s); }
.scene-home .s6-smiles g:nth-child(3) .smile { animation-delay: calc(var(--beat-2) + 0.6s); }
.scene-home .s6-smiles g:nth-child(4) .smile { animation-delay: calc(var(--beat-2) + 0.8s); }
.scene-home .s6-flowers .bloom { animation: pop 0.5s var(--ease-pop) calc(var(--beat-2) + 0.3s) both; }
.scene-home .s6-flowers g:nth-child(2) .bloom { animation-delay: calc(var(--beat-2) + 0.45s); }
.scene-home .s6-flowers g:nth-child(3) .bloom { animation-delay: calc(var(--beat-2) + 0.6s); }
.scene-home .s6-flowers g:nth-child(4) .bloom { animation-delay: calc(var(--beat-2) + 0.75s); }
.scene-home .s6-flowers g:nth-child(5) .bloom { animation-delay: calc(var(--beat-2) + 0.9s); }

/* ---------- みんな仲良く（順にはねる・花びらが舞う） ---------- */

.scene-home .s6-hop.h1 { animation: hop 0.5s ease-out var(--beat-3); }
.scene-home .s6-hop.h2 { animation: hop 0.5s ease-out calc(var(--beat-3) + 0.12s); }
.scene-home .s6-hop.h3 { animation: hop 0.5s ease-out calc(var(--beat-3) + 0.24s); }
.scene-home .s6-hop.h4 { animation: hop 0.5s ease-out calc(var(--beat-3) + 0.36s); }
.scene-home .s6-hop.h5 { animation: hop 0.5s ease-out calc(var(--beat-3) + 0.48s); }
.scene-home .petal { animation: s6-petal 4.2s linear var(--beat-3) infinite both; }
.scene-home .petal.p2 { animation-delay: calc(var(--beat-3) + 0.7s); }
.scene-home .petal.p3 { --dx: -170px; animation-delay: calc(var(--beat-3) + 0.3s); }
.scene-home .petal.p4 { --dx: -150px; animation-delay: calc(var(--beat-3) + 1.1s); }
.scene-home .petal.p5 { animation-delay: calc(var(--beat-3) + 1.5s); }
.scene-home .petal.p6 { --dx: -190px; animation-delay: calc(var(--beat-3) + 1.8s); }
@keyframes s6-petal {
  0% { opacity: 0; translate: 0 0; rotate: 0deg; }
  10% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; translate: var(--dx, 110px) 620px; rotate: 600deg; }
}

/* ---------- 幸せに暮らしましたとさ（めでたし めでたし） ---------- */

.scene-home .s6-char {
  fill: #8a3a2e;
  stroke: #fff8ec;
  stroke-width: 12px;
  stroke-linejoin: round;
  paint-order: stroke;
  font-family: var(--font-title);
  font-size: 88px;
  font-weight: 900;
  animation: pop 0.5s var(--ease-pop) var(--beat-4) both;
}
.scene-home .s6-char.c2 { animation-delay: calc(var(--beat-4) + 0.09s); }
.scene-home .s6-char.c3 { animation-delay: calc(var(--beat-4) + 0.18s); }
.scene-home .s6-char.c4 { animation-delay: calc(var(--beat-4) + 0.27s); }
.scene-home .s6-title-peach { animation: pop 0.5s var(--ease-pop) calc(var(--beat-4) + 0.36s) both; }
.scene-home .s6-char.c5 { animation-delay: calc(var(--beat-4) + 0.45s); }
.scene-home .s6-char.c6 { animation-delay: calc(var(--beat-4) + 0.54s); }
.scene-home .s6-char.c7 { animation-delay: calc(var(--beat-4) + 0.63s); }
.scene-home .s6-char.c8 { animation-delay: calc(var(--beat-4) + 0.72s); }
.scene-home .s6-title-shine .sparkle { animation: twinkle 1.4s ease-in-out calc(var(--beat-4) + 0.9s) infinite both; }
.scene-home .s6-title-shine g:nth-child(2) .sparkle { animation-delay: calc(var(--beat-4) + 1.3s); }
.scene-home .s6-title-shine g:nth-child(3) .sparkle { animation-delay: calc(var(--beat-4) + 1.7s); }
