/* =========================================================
   动效：年份推进、逐行浮现、投币判定、结果与结局
   ========================================================= */
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes lineIn { from { opacity: 0; transform: translateY(6px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes cardin { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes cardup { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes blink { 0%, 90% { opacity: .35; } 95% { opacity: 0; } }

/* 年龄跳动 */
#tb-age { display: inline-block; }
#tb-age.tick { animation: agetick .55s var(--ease); }
@keyframes agetick { 0% { transform: translateY(-6px) scale(1.25); color: #fff2cf; text-shadow: 0 0 18px rgba(214, 168, 78, .8); } 100% { transform: none; } }

/* 日志逐条浮现 */
.yr-body p { opacity: 0; animation: lineIn .6s var(--ease) forwards; }
.scene-title, .inline-choice, .inline-result { animation: lineIn .5s var(--ease) both; }

/* 属性变化 */
.stat.flash-up .v { animation: vflashU 1.2s ease; }
.stat.flash-down .v { animation: vflashD 1.2s ease; }
@keyframes vflashU { 0%, 40% { color: var(--up); } }
@keyframes vflashD { 0%, 40% { color: var(--down); } }
@keyframes sfloat { 0% { opacity: 0; transform: translate(6px, -50%); } 15% { opacity: 1; transform: translate(0, -50%); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(0, -130%); } }
#pc-money.m-up { animation: vflashU 1s ease; }
#pc-money.m-down { animation: vflashD 1s ease; }

/* 弹窗 */
.birth-card { animation: cardin .5s var(--ease); }
.menu-card, .stock-card { animation: cardin .3s var(--ease); }
#choice .choice-card { animation: cardup .36s var(--ease); transition: transform .3s var(--ease); }
#choice.closing { animation: fadeout .22s ease forwards; }
#choice.closing .choice-card { transform: translateY(10px); }
.cc-text { animation: lineIn .5s var(--ease) .05s both; }
.cc-opts button { opacity: 0; animation: lineIn .45s var(--ease) forwards; }

/* 投币 */
.cc-judge { animation: lineIn .4s var(--ease); }
.jg-num.bump { animation: bump .35s var(--ease); }
@keyframes bump { 0% { transform: scale(1.35); color: #fff2cf; text-shadow: 0 0 16px rgba(214, 168, 78, .9); } 100% { transform: none; } }
.coin.spin { animation: coinspin .32s linear infinite; }
@keyframes coinspin { from { transform: rotateY(0) translateY(-4px); } to { transform: rotateY(360deg) translateY(-4px); } }
.coin.heads em { animation: plus .9s var(--ease) forwards; }
@keyframes plus { 0% { opacity: 0; transform: translate(-50%, 4px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -16px); } }
.jg-stamp.show { animation: stamp .45s var(--ease) forwards; }
@keyframes stamp { 0% { opacity: 0; transform: scale(1.8); } 60% { opacity: 1; transform: scale(.95); } 100% { opacity: 1; transform: none; } }

/* 结果 */
.cc-result { animation: lineIn .45s var(--ease); }
.dchip { opacity: 0; animation: chipin .4s var(--ease) forwards; }
.inline-result .dchip { opacity: 1; animation: none; }
@keyframes chipin { from { opacity: 0; transform: translateY(6px) scale(.9); } to { opacity: 1; transform: none; } }

/* 结局入场 */
#death { animation: deathbg 1.4s ease; }
@keyframes deathbg { 0% { background: rgba(6, 5, 7, 0); } 40% { background: rgba(0, 0, 0, .95); } 100% { background: rgba(6, 5, 7, .74); } }
#death .death-card { animation: cardin .8s var(--ease) .5s both; }
.ach-row { animation: lineIn .5s var(--ease) both; }

/* 提示 */
.ach-toast { animation: slidein .35s ease; }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.toast { animation: toastin .3s var(--ease); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .log { scroll-behavior: auto; }
}
