/* 演出（返し・必殺技発動・ダメージ・勝敗）。fx.js が #fx に要素を足して消す */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }

/* 画面ゆれ */
.shake { animation: shake .38s cubic-bezier(.36,.07,.19,.97); }
.shake-big { animation: shake-big .7s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 10%,90% { transform: translate(-2px, 1px); } 20%,80% { transform: translate(4px, -2px); } 30%,50%,70% { transform: translate(-6px, 3px); } 40%,60% { transform: translate(6px, -3px); } }
@keyframes shake-big { 10%,90% { transform: translate(-4px, 2px) rotate(-.4deg); } 20%,80% { transform: translate(8px, -5px) rotate(.5deg); } 30%,50%,70% { transform: translate(-12px, 6px) rotate(-.8deg); } 40%,60% { transform: translate(12px, -6px) rotate(.8deg); } }

/* 全画面フラッシュ */
.fx-flash { position: absolute; inset: 0; background: var(--c); animation: fx-flash .4s ease-out forwards; mix-blend-mode: screen; }
@keyframes fx-flash { from { opacity: .8; } to { opacity: 0; } }

/* 叩きつける文字（返し！） */
.fx-slam { position: absolute; left: 50%; top: var(--top, 40%); font-weight: 900; font-style: italic; font-size: var(--size, 48px); color: #fff; white-space: nowrap; letter-spacing: .04em;
  -webkit-text-stroke: 2px var(--c); paint-order: stroke fill; text-shadow: 0 0 16px var(--c), 0 0 34px var(--c), 0 5px 0 #000;
  animation: fx-slam var(--dur, .95s) cubic-bezier(.2,1.6,.4,1) forwards; }
.fx-slam small { display: block; font-size: 13px; font-style: normal; -webkit-text-stroke: 0; text-align: center; letter-spacing: .1em; opacity: .9; }
@keyframes fx-slam {
  0% { transform: translate(-50%, -50%) scale(3.2) rotate(-10deg); opacity: 0; }
  16% { transform: translate(-50%, -50%) scale(.9) rotate(-5deg); opacity: 1; }
  26% { transform: translate(-50%, -50%) scale(1.06) rotate(-5deg); }
  78% { opacity: 1; }
  100% { transform: translate(-50%, -62%) scale(1) rotate(-5deg); opacity: 0; }
}
.fx-slam.rainbow { animation: fx-slam var(--dur, .95s) cubic-bezier(.2,1.6,.4,1) forwards, fx-hue .5s linear infinite; }
@keyframes fx-hue { to { filter: hue-rotate(360deg); } }

/* 火花・衝撃波 */
.fx-spark { position: absolute; width: var(--s, 6px); height: var(--s, 6px); margin: calc(var(--s, 6px) / -2); border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); animation: fx-spark var(--d, .6s) cubic-bezier(.1,.8,.3,1) forwards; }
@keyframes fx-spark { from { transform: translate(0, 0) scale(1); opacity: 1; } to { transform: translate(var(--x), var(--y)) scale(.1); opacity: 0; } }
.fx-ring { position: absolute; width: 24px; height: 24px; margin: -12px; border: 4px solid var(--c); border-radius: 50%; box-shadow: 0 0 14px var(--c); animation: fx-ring var(--d, .6s) ease-out forwards; }
@keyframes fx-ring { to { transform: scale(var(--k, 14)); opacity: 0; border-width: 1px; } }

/* 必殺技カットイン */
.fx-cutin { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: radial-gradient(circle at 50% 45%, rgba(0,0,0,.25), rgba(0,0,0,.88) 70%); animation: fx-cut-bg var(--t, 1.7s) forwards; }
@keyframes fx-cut-bg { 0% { opacity: 0; } 7% { opacity: 1; } 86% { opacity: 1; } 100% { opacity: 0; } }
.fx-cutin .rays { position: absolute; left: 50%; top: 45%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; border-radius: 50%;
  background: repeating-conic-gradient(var(--c) 0 5deg, transparent 5deg 15deg); opacity: .22; animation: fx-spin 3s linear; }
@keyframes fx-spin { to { transform: rotate(120deg); } }
.fx-cutin .band { position: absolute; left: -10%; right: -10%; top: 45%; height: 150px; margin-top: -75px;
  background: linear-gradient(90deg, transparent, var(--c) 18%, var(--c2) 50%, var(--c) 82%, transparent);
  transform: skewY(-7deg) scaleX(0); animation: fx-band var(--t, 1.7s) cubic-bezier(.2,.9,.2,1) forwards; opacity: .55; }
@keyframes fx-band { 0% { transform: skewY(-7deg) scaleX(0); } 14% { transform: skewY(-7deg) scaleX(1); } 86% { transform: skewY(-7deg) scaleX(1); opacity: .55; } 100% { transform: skewY(-7deg) scaleX(1.3); opacity: 0; } }
.fx-cutin .speed { position: absolute; left: 0; right: 0; top: 45%; height: 150px; margin-top: -75px; transform: skewY(-7deg);
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.55) 0 2px, transparent 2px 46px); mix-blend-mode: overlay; animation: fx-speed .25s linear infinite; }
@keyframes fx-speed { to { background-position: -48px 0; } }
.fx-cutin .art { position: relative; width: min(46vw, 190px); aspect-ratio: 1; border-radius: 14px; overflow: hidden; border: 3px solid var(--c2);
  box-shadow: 0 0 0 3px #000, 0 0 40px var(--c), 0 0 90px var(--c); animation: fx-art var(--t, 1.7s) cubic-bezier(.2,1.4,.3,1) forwards; margin-top: -4vh; }
.fx-cutin .art svg, .fx-cutin .art .art-img { display: block; width: 100%; height: 100%; }
@keyframes fx-art { 0% { transform: translateX(-120vw) rotate(-20deg) scale(.6); } 16% { transform: translateX(0) rotate(-4deg) scale(1.08); } 24% { transform: rotate(-4deg) scale(1); } 80% { transform: rotate(-4deg) scale(1.04); opacity: 1; } 100% { transform: rotate(-4deg) scale(1.6); opacity: 0; } }
.fx-cutin .nm { position: relative; font-size: clamp(34px, 11vw, 64px); font-weight: 900; color: #fff; letter-spacing: .08em; white-space: nowrap;
  -webkit-text-stroke: 2px var(--c); paint-order: stroke fill; text-shadow: 0 0 20px var(--c), 0 0 50px var(--c), 0 6px 0 #000;
  animation: fx-nm var(--t, 1.7s) cubic-bezier(.2,1.6,.4,1) forwards; }
@keyframes fx-nm { 0%, 14% { transform: translateX(120vw) skewX(-20deg); } 26% { transform: translateX(0) skewX(-8deg) scale(1.1); } 32% { transform: skewX(-8deg) scale(1); } 86% { opacity: 1; } 100% { transform: skewX(-8deg) scale(1.3); opacity: 0; } }
.fx-cutin .who { position: relative; font-size: 13px; letter-spacing: .3em; color: var(--c2); animation: fx-cut-bg var(--t, 1.7s) forwards; }
.fx-cutin .eff { position: relative; font-size: clamp(30px, 10vw, 56px); font-weight: 900; color: var(--c3, #ff5a4a); -webkit-text-stroke: 2px #000; paint-order: stroke fill;
  text-shadow: 0 0 18px var(--c3, #ff5a4a); animation: fx-eff var(--t, 1.7s) cubic-bezier(.2,1.8,.4,1) forwards; }
@keyframes fx-eff { 0%, 34% { transform: scale(0); opacity: 0; } 44% { transform: scale(1.5); opacity: 1; } 52% { transform: scale(1); } 86% { opacity: 1; } 100% { opacity: 0; } }

/* ダメージ・ゲージの数字 */
.fx-num { position: absolute; font-size: var(--size, 34px); font-weight: 900; color: var(--c); -webkit-text-stroke: 2px #000; paint-order: stroke fill;
  text-shadow: 0 0 12px var(--c); transform: translate(-50%, -50%); animation: fx-num 1.1s cubic-bezier(.2,1.8,.4,1) forwards; white-space: nowrap; }
@keyframes fx-num { 0% { transform: translate(-50%, -50%) scale(0); } 18% { transform: translate(-50%, -50%) scale(1.5); } 30% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { transform: translate(-50%, -140%) scale(1); opacity: 0; } }
.side.hit { animation: fx-hit .5s ease-out; }
@keyframes fx-hit { 0% { box-shadow: 0 0 0 3px #ff4a3a, 0 0 30px #ff4a3a; background: #4a1714; } 100% { box-shadow: none; } }
.side.charge { animation: fx-charge .5s ease-out; }
@keyframes fx-charge { 0% { box-shadow: 0 0 0 3px #3f8ff5, 0 0 30px #3f8ff5; } 100% { box-shadow: none; } }

/* 出したカードが場に叩きつけられる */
.stack .slot.enter .card { animation: fx-drop .38s cubic-bezier(.2,1.5,.4,1); }
@keyframes fx-drop { 0% { transform: translateY(-70px) scale(1.6) rotate(-12deg); opacity: 0; } 60% { transform: translateY(0) scale(.94) rotate(2deg); opacity: 1; } 100% { transform: none; } }

/* 勝敗 */
.fx-confetti { position: absolute; top: -12px; width: 8px; height: 14px; background: var(--c); animation: fx-fall var(--d) linear forwards; }
@keyframes fx-fall { to { transform: translate(var(--x), 110vh) rotate(var(--r)); } }

/* 回復 */
.side.heal { animation: fx-heal .6s ease-out; }
@keyframes fx-heal { 0% { box-shadow: 0 0 0 3px #5ccf86, 0 0 30px #5ccf86; } 100% { box-shadow: none; } }
.fx-rise { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); opacity: 0; animation: fx-rise var(--d, .8s) ease-out forwards; }
@keyframes fx-rise { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-70px); opacity: 0; } }

/* カードの小さな絵（連続発動・割れる） */
.fx-mini { position: absolute; width: var(--w, 76px); margin-left: calc(var(--w, 76px) / -2); margin-top: calc(var(--w, 76px) * -.65); border-radius: 8px; overflow: hidden; background: #14161f; border: 2px solid var(--c); box-shadow: 0 0 14px var(--c); }
.fx-mini .art svg, .fx-mini .art .art-img { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.fx-mini .nm { font-size: 11px; font-weight: 700; color: #fff; text-align: center; padding: 2px 3px; white-space: nowrap; overflow: hidden; }
.fx-fly { animation: fx-fly .34s cubic-bezier(.5,0,.8,.5) forwards; }
@keyframes fx-fly { 0% { transform: scale(.5); opacity: 0; } 25% { transform: scale(1.1) rotate(-6deg); opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(.7) rotate(8deg); opacity: .9; } }
.fx-count { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: 64px; font-weight: 900; font-style: italic; color: #fff; -webkit-text-stroke: 2px #ff3df2; paint-order: stroke fill; text-shadow: 0 0 18px #ff3df2, 0 5px 0 #000; white-space: nowrap; }
.fx-count small { font-size: 22px; margin-left: 4px; font-style: normal; }
.fx-count.pop { animation: fx-count .22s cubic-bezier(.2,1.8,.4,1); }
@keyframes fx-count { from { transform: translate(-50%, -50%) scale(1.7); } to { transform: translate(-50%, -50%) scale(1); } }
.fx-half.a { clip-path: polygon(0 0, 100% 0, 0 100%); animation: fx-half-a .78s ease-in forwards; }
.fx-half.b { clip-path: polygon(100% 0, 100% 100%, 0 100%); animation: fx-half-b .78s ease-in forwards; }
@keyframes fx-half-a { 0%, 22% { transform: none; opacity: 1; } 100% { transform: translate(-46px, -40px) rotate(-22deg); opacity: 0; } }
@keyframes fx-half-b { 0%, 22% { transform: none; opacity: 1; } 100% { transform: translate(46px, 44px) rotate(20deg); opacity: 0; } }

/* 斬撃 */
.fx-slash { position: absolute; width: min(92vw, 560px); height: 6px; margin: -3px 0 0 calc(min(92vw, 560px) / -2); border-radius: 3px;
  background: linear-gradient(90deg, transparent, #fff 40%, var(--c) 60%, transparent); box-shadow: 0 0 14px var(--c), 0 0 34px var(--c); animation: fx-slash .44s ease-out forwards; }
@keyframes fx-slash { 0% { transform: rotate(var(--a)) scaleX(0); } 35% { transform: rotate(var(--a)) scaleX(1) scaleY(1.4); opacity: 1; } 100% { transform: rotate(var(--a)) scaleX(1) scaleY(.1); opacity: 0; } }

/* 臨界：ゲージが流れ込む */
.fx-stream { position: absolute; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: var(--c); box-shadow: 0 0 12px var(--c); opacity: 0; animation: fx-stream .5s cubic-bezier(.6,0,.9,.6) forwards; }
@keyframes fx-stream { 0% { opacity: 0; transform: none; } 15% { opacity: 1; } 100% { opacity: .8; transform: translate(var(--x), var(--y)) scale(.4); } }
.track.crack { animation: fx-crack .45s ease-out; }
@keyframes fx-crack { 0%, 40%, 80% { transform: translateX(-3px); box-shadow: 0 0 12px #3f8ff5; } 20%, 60% { transform: translateX(3px); } 100% { transform: none; } }

/* からくり */
.fx-gear { position: absolute; width: 52px; height: 52px; margin: -26px; opacity: 0; animation: fx-gear 1.15s ease-in-out forwards; }
.fx-gear svg { display: block; width: 100%; height: 100%; animation: fx-gear-spin .7s linear infinite; }
@keyframes fx-gear-spin { to { transform: rotate(360deg); } }
@keyframes fx-gear { 0% { transform: scale(0); opacity: 0; } 18% { transform: scale(1.15); opacity: 1; } 28%, 62% { transform: scale(1); opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(.3); opacity: 0; } }

/* 練り：コストの数字が跳ねる */
.card.boost-pop { animation: fx-boost .55s ease-out; }
.card.boost-pop .cost { animation: fx-boost-cost .55s cubic-bezier(.2,1.8,.4,1); }
@keyframes fx-boost { 0% { box-shadow: 0 0 0 3px #5ccf86, 0 0 22px #5ccf86; } 100% { box-shadow: none; } }
@keyframes fx-boost-cost { 0% { transform: scale(1.9); } 100% { transform: scale(1); } }

/* 輪廻の果て：カードが落ちる */
.fx-fallcard { position: absolute; width: 30px; height: 42px; margin: -21px -15px; border-radius: 4px; background: linear-gradient(135deg, #4a3a78, #241c40); border: 1px solid #b58cff; box-shadow: 0 0 8px #b58cff; opacity: 0; animation: fx-fallcard .95s cubic-bezier(.5,0,.9,.6) forwards; }
@keyframes fx-fallcard { 0% { opacity: 0; transform: none; } 10% { opacity: 1; } 100% { opacity: .5; transform: translate(var(--x), 70vh) rotate(var(--r)); } }

/* ピンチ・天命の刻：画面の縁 */
#fx::before, #fx::after { content: ""; position: absolute; inset: 0; opacity: 0; }
#fx.pinch::before { box-shadow: inset 0 0 70px 14px rgba(255, 40, 30, .75); animation: fx-pinch 1.15s ease-in-out infinite; }
@keyframes fx-pinch { 0%, 100% { opacity: .25; } 18% { opacity: 1; } 34% { opacity: .45; } 50% { opacity: .9; } }
#fx.destiny::after { box-shadow: inset 0 0 90px 18px rgba(242, 194, 62, .7); animation: fx-destiny-edge 2.4s ease-in-out infinite; }
@keyframes fx-destiny-edge { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.card.destiny-card { animation: fx-destiny-card 1.6s ease-in-out infinite; }
@keyframes fx-destiny-card { 0%, 100% { box-shadow: 0 0 6px #f2c23e; } 50% { box-shadow: 0 0 0 2px #f2c23e, 0 0 26px #f2c23e; } }

/* 天命の発動 */
.fx-destiny { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, rgba(90,60,0,.5), rgba(0,0,0,.96) 72%); animation: fx-cut-bg var(--t, 2.8s) forwards; }
.fx-destiny .rays { position: absolute; left: 50%; top: 45%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; border-radius: 50%;
  background: repeating-conic-gradient(#f2c23e 0 4deg, transparent 4deg 16deg); opacity: .3; animation: fx-spin 3s linear; }
.fx-destiny .who { position: relative; font-size: 14px; letter-spacing: .3em; color: #fff3b8; }
.fx-destiny .nm { position: relative; writing-mode: vertical-rl; font-size: clamp(72px, 24vw, 130px); line-height: 1.1; font-weight: 900; color: #fff; letter-spacing: .12em; -webkit-text-stroke: 3px #f2c23e; paint-order: stroke fill;
  text-shadow: 0 0 26px #f2c23e, 0 0 70px #f2c23e; animation: fx-destiny-nm var(--t, 2.8s) ease-out forwards; }
@keyframes fx-destiny-nm { 0%, 12% { transform: scale(2.6); opacity: 0; } 34% { transform: scale(1); opacity: 1; } 82% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }

/* バトル開始 */
.fx-versus { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 14px; background: rgba(0,0,0,.72); animation: fx-versus-bg 1.5s forwards; }
@keyframes fx-versus-bg { 0% { opacity: 0; } 8%, 82% { opacity: 1; } 100% { opacity: 0; } }
.fx-versus .band { position: absolute; left: -10%; right: -10%; top: 50%; height: 120px; margin-top: -60px; transform: skewY(-5deg); background: linear-gradient(90deg, #3f8ff5, #1a1c28 45%, #1a1c28 55%, #ff5a3a); opacity: .75; }
.fx-versus .who { position: relative; width: 36vw; max-width: 280px; font-size: clamp(24px, 7vw, 40px); font-weight: 900; color: #fff; text-shadow: 0 3px 0 #000; }
.fx-versus .who small { display: block; font-size: 12px; font-weight: 400; opacity: .85; text-shadow: none; }
.fx-versus .who.l { text-align: right; animation: fx-vs-l .35s cubic-bezier(.2,1.4,.4,1); }
.fx-versus .who.r { text-align: left; animation: fx-vs-r .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes fx-vs-l { from { transform: translateX(-70vw); } }
@keyframes fx-vs-r { from { transform: translateX(70vw); } }
.fx-versus .vs { position: relative; font-size: clamp(44px, 14vw, 72px); font-weight: 900; font-style: italic; color: #fff; -webkit-text-stroke: 2px #f2c23e; paint-order: stroke fill; text-shadow: 0 0 20px #f2c23e, 0 5px 0 #000; animation: fx-vs .4s .2s cubic-bezier(.2,1.8,.4,1) backwards; }
@keyframes fx-vs { from { transform: scale(3); opacity: 0; } }
.fx-versus .first { position: absolute; left: 0; right: 0; top: calc(50% + 74px); text-align: center; font-size: 20px; font-weight: 900; color: #f2c23e; letter-spacing: .1em; text-shadow: 0 2px 0 #000; animation: fx-first .3s .55s ease-out backwards; }
@keyframes fx-first { from { transform: translateY(14px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .shake, .shake-big { animation: none; }
  #fx.pinch::before, #fx.destiny::after { animation: none; opacity: .7; }
  .fx-gear svg { animation: none; }
  .fx-cutin .rays, .fx-cutin .speed { animation: none; }
}
