/* Battle presentation effects (js/battle-fx.js). All pieces sit in #fxLayer / body with fixed viewport coordinates. */
#fxLayer > [class^="fx-"], #fxLayer > [class*=" fx-"] { position: fixed; pointer-events: none; z-index: 60; }

/* 1. attack ribbon */
.fx-ribbon { height: 0; overflow: visible; z-index: 70 !important; }
.fx-rb-band { position: absolute; left: -6%; right: -6%; top: 0; transform-origin: center; padding: calc(var(--u) * 1.4) 0 calc(var(--u) * 1.6) 30%; color: #fff;
  background: linear-gradient(90deg, transparent 0, var(--rc) 9%, color-mix(in srgb, var(--rc) 70%, #fff) 50%, var(--rc) 91%, transparent 100%);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28); border-top: 3px solid rgba(255, 255, 255, 0.85); border-bottom: 3px solid rgba(255, 255, 255, 0.55); }
.fx-ribbon.theirs .fx-rb-band { padding-left: 0; padding-right: 30%; text-align: right; }
.fx-rb-band b { display: block; font-size: clamp(24px, calc(var(--u) * 7.4), 72px); font-weight: 700; font-style: italic; letter-spacing: 0.01em; line-height: 1; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.18), 0 0 18px rgba(255, 255, 255, 0.45); }
.fx-rb-band small { display: block; margin-top: 3px; font-size: clamp(12px, calc(var(--u) * 2.2), 20px); font-weight: 700; opacity: 0.9; letter-spacing: 0.06em; }

/* 2. impact */
.fx-star { z-index: 62 !important; mix-blend-mode: screen; filter: drop-shadow(0 0 12px rgba(255, 220, 120, 0.9)); }
.fx-star svg { width: 100%; height: 100%; display: block; }
.fx-flash { border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 60%); z-index: 61 !important; }
.fx-shard { border-radius: 2px; box-shadow: 0 0 6px rgba(255, 255, 255, 0.8); z-index: 63 !important; }
.fx-dmg { z-index: 64 !important; text-align: center; white-space: nowrap; }
.fx-dmg b { display: block; font-size: clamp(32px, calc(var(--u) * 9), 96px); font-weight: 700; color: #fff; line-height: 0.95; font-style: italic;
  -webkit-text-stroke: 2px #1a2340; paint-order: stroke fill; text-shadow: 0 4px 0 #1a2340, 0 0 22px rgba(255, 170, 40, 0.9); }
.fx-dmg.big b { font-size: clamp(40px, calc(var(--u) * 11.5), 120px); }
.fx-dmg span { display: inline-block; margin-top: 2px; padding: 2px 10px; border-radius: 99px; background: linear-gradient(180deg, #ff9b3d, #f05a24); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3); }
.fx-dmg.weak b { text-shadow: 0 4px 0 #1a2340, 0 0 26px rgba(255, 60, 60, 0.95); }
.fx-dmg.weak span { background: linear-gradient(180deg, #ff5a6a, #c81e3a); }

/* 3. HP count-down + ghost bar */
.card.field .hp i { position: relative; }
.card.field .hp i .ghost { position: absolute; left: 0; top: 0; bottom: 0; background: #ff6b5a; border-radius: inherit; transition: width 0.55s cubic-bezier(.4,0,.2,1); }
.card.field .hp i span { position: relative; transition: width 0.32s cubic-bezier(.2,.8,.3,1); }
.card.field .hp.hit b { animation: hpHit 0.6s ease; }
@keyframes hpHit { 0% { color: #ff3b3b; transform: scale(1.35); } 100% { transform: none; } }

/* 4. landing flash */
.fx-land { border-radius: 10px; border: 3px solid #fff; z-index: 61 !important; }

/* 5. big card */
.fx-big { z-index: 72 !important; border-radius: 4.5% / 3.2%; overflow: hidden; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 20px 50px rgba(0, 0, 0, 0.45), 0 0 60px rgba(255, 255, 255, 0.35); }
.fx-big img { width: 100%; height: 100%; display: block; }
.fx-big-holo { position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.65) 45%, rgba(160, 220, 255, 0.4) 52%, transparent 65%); background-size: 260% 100%; mix-blend-mode: overlay; animation: bigHolo 0.9s ease-out forwards; }
@keyframes bigHolo { from { background-position: 120% 0; } to { background-position: -40% 0; } }
.fx-big-tag { position: absolute; left: 50%; bottom: -2px; transform: translate(-50%, 100%); padding: 4px 14px; border-radius: 99px; font-size: clamp(12px, calc(var(--u) * 2.2), 20px); font-weight: 700; color: #fff; white-space: nowrap; }
.fx-big-tag.me { background: #2b6bff; } .fx-big-tag.opp { background: #e5484d; }
.fx-big { overflow: visible; }

/* 6. rings */
.fx-ring { border-radius: 50%; border: 4px solid var(--rc); box-shadow: 0 0 18px var(--rc), inset 0 0 14px var(--rc); z-index: 61 !important; }

/* 7. pill */
.fx-pill { position: fixed; z-index: 24; /* below the card sheet (25), modals (40+) and the menu */ transform: translate(-50%, -12px); opacity: 0; padding: 10px 20px; border-radius: 22px; width: max-content; background: rgba(255, 255, 255, 0.97); color: #23314d;
  font-size: clamp(13px, calc(var(--u) * 2.4), 22px); font-weight: 600; text-align: center; line-height: 1.3; box-shadow: 0 8px 22px rgba(20, 30, 60, 0.22); pointer-events: none; transition: opacity 0.22s, transform 0.28s cubic-bezier(.2,.9,.3,1); }
.fx-pill.show { opacity: 1; transform: translate(-50%, 0); }

/* 8. turn ribbon with hexagon sweep */
.fx-turn { z-index: 75 !important; overflow: hidden; }
.fx-hex { position: absolute; inset: -10%; opacity: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 0 56 16v32L28 64 0 48V16zM28 64v33' fill='none' stroke='white' stroke-opacity='.55' stroke-width='2'/%3E%3C/svg%3E");
  background-size: 56px 97px; animation: hexSweep 1.25s ease-out forwards; mask-image: linear-gradient(110deg, transparent 0%, #000 35%, #000 55%, transparent 80%); -webkit-mask-image: linear-gradient(110deg, transparent 0%, #000 35%, #000 55%, transparent 80%); mask-size: 250% 100%; -webkit-mask-size: 250% 100%; }
.fx-turn.mine .fx-hex { filter: drop-shadow(0 0 6px #6ab8ff); } .fx-turn.theirs .fx-hex { filter: drop-shadow(0 0 6px #ff7a8a); }
@keyframes hexSweep { 0% { opacity: 0; mask-position: 120% 0; -webkit-mask-position: 120% 0; } 20% { opacity: 1; } 100% { opacity: 0.0; mask-position: -60% 0; -webkit-mask-position: -60% 0; } }
.fx-turn-band { position: absolute; left: -8%; right: -8%; top: 50%; transform: translateY(-50%) skewY(-7deg); padding: calc(var(--u) * 1.8) 0; text-align: center; animation: turnBand 1.25s cubic-bezier(.2,.9,.3,1) forwards;
  background: linear-gradient(90deg, transparent, var(--tb) 14%, color-mix(in srgb, var(--tb) 70%, #fff) 50%, var(--tb) 86%, transparent); box-shadow: 0 8px 26px rgba(0, 0, 0, 0.25); border-top: 3px solid rgba(255, 255, 255, 0.85); border-bottom: 3px solid rgba(255, 255, 255, 0.5); }
.fx-turn.mine .fx-turn-band { --tb: #2b6bff; } .fx-turn.theirs .fx-turn-band { --tb: #ff5a3c; }
.fx-turn-band b { font-size: clamp(28px, calc(var(--u) * 8), 80px); font-weight: 700; font-style: italic; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), 0 0 20px rgba(255, 255, 255, 0.5); }
@keyframes turnBand { 0% { clip-path: inset(0 100% 0 0); } 30% { clip-path: inset(0 0 0 0); } 80% { clip-path: inset(0 0 0 0); opacity: 1; } 100% { clip-path: inset(0 0 0 0); opacity: 0.95; } }
.fx-turn-no { position: absolute; left: 50%; top: calc(50% + var(--u) * 8.5); transform: translateX(-50%); padding: 4px 16px; border-radius: 99px; background: rgba(20, 28, 55, 0.75); color: #fff; font-size: clamp(13px, calc(var(--u) * 2.4), 22px); font-weight: 700; animation: fadeUp 0.4s 0.3s both; }
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 8px); } }
.fx-turn.out { transition: opacity 0.26s; opacity: 0; }

/* 9. rival entrance */
.fx-rival { z-index: 4 !important; overflow: hidden; }
.fx-rival-art { position: absolute; right: -4%; top: 0; width: 46%; height: 82%; background-size: 130% auto; background-position: 50% 16%; border-radius: 18px;
  mask-image: radial-gradient(ellipse at 60% 40%, #000 35%, transparent 72%); -webkit-mask-image: radial-gradient(ellipse at 60% 40%, #000 35%, transparent 72%);
  animation: rivalIn 0.6s cubic-bezier(.2,.9,.3,1) both; opacity: 0.9; filter: saturate(1.2); }
.fx-rival span { position: absolute; right: 14%; top: 50%; padding: 4px 14px; border-radius: 99px; background: rgba(229, 72, 77, 0.92); color: #fff; font-weight: 700; font-size: 13px; animation: rivalIn 0.6s 0.15s both; }
@keyframes rivalIn { from { transform: translateX(40%); opacity: 0; } }
.fx-rival.out { transition: opacity 0.45s, transform 0.45s; opacity: 0; transform: translateX(-6%); }

/* 10. end-turn confirm */
.fx-confirm { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; background: rgba(15, 22, 45, 0.45); animation: fcIn 0.18s ease; }
.fx-confirm.out { opacity: 0; transition: opacity 0.18s; }
@keyframes fcIn { from { opacity: 0; } }
.fx-cbox { width: min(320px, calc(var(--vw1) * 86)); padding: 18px 16px 14px; border-radius: 18px; background: #fff; color: #23314d; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3); text-align: center; animation: fcPop 0.26s cubic-bezier(.3,1.5,.5,1); }
@keyframes fcPop { from { transform: scale(0.88); } }
.fx-cbox > b { font-size: 18px; font-weight: 700; }
.fx-warn { margin: 12px 0 10px; padding: 8px 12px; border-radius: 12px; background: #fff1f1; text-align: left; }
.fx-warn p { margin: 4px 0; display: flex; gap: 8px; align-items: center; font-size: 13.5px; font-weight: 600; }
.fx-warn i { flex: none; width: 18px; height: 18px; border-radius: 50%; background: #e5484d; color: #fff; font-style: normal; font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.fx-skip { display: flex; gap: 6px; align-items: center; justify-content: center; font-size: 12.5px; color: #7a849b; margin-bottom: 12px; }
.fx-cact { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fx-cact button { height: 42px; border: 0; border-radius: 12px; font: inherit; font-weight: 700; font-size: 15px; background: #eef1f6; color: #59647d; cursor: pointer; }
.fx-cact button.ok { background: linear-gradient(180deg, #3fd08a, #16a34a); color: #fff; box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35); }

@media (prefers-reduced-motion: reduce) { .fx-hex, .fx-big-holo { animation: none; opacity: 0; } }
.atk-cut .atk-name { display: none; }
/* tuning after the first capture: the burst must read on bright cards, rings must pop */
.fx-star { mix-blend-mode: normal; filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 22px rgba(255, 170, 40, 0.85)); }
.fx-ring { border-width: 5px; border-color: #ffe066; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 24px 4px var(--rc), inset 0 0 18px var(--rc); }
.fx-shard { box-shadow: 0 0 8px #fff, 0 0 2px #000; }

/* ---------- cosmetics: card flair on my Pokémon, coin skins ---------- */
.card.field.flair { isolation: isolate; }
.card.field.flair::after { content: ''; position: absolute; inset: -3px; border-radius: 9px; pointer-events: none; z-index: 3; }
.card.field.flair-sparkle::after { background:
  radial-gradient(circle, #fff 0 1.5px, transparent 2.5px) 10% 20% / 30% 30%,
  radial-gradient(circle, #fff7c2 0 1.2px, transparent 2.2px) 70% 60% / 26% 26%,
  radial-gradient(circle, #fff 0 1px, transparent 2px) 40% 85% / 34% 34%;
  animation: flairTwinkle 2.4s linear infinite; mix-blend-mode: screen; }
@keyframes flairTwinkle { 0% { background-position: 10% 20%, 70% 60%, 40% 85%; opacity: .55; } 50% { opacity: 1; } 100% { background-position: 10% -80%, 70% -40%, 40% -15%; opacity: .55; } }
.card.field.flair-flame::after { box-shadow: 0 0 0 2px #ffb347, 0 0 14px 4px rgba(255, 110, 30, 0.85), 0 -6px 18px 2px rgba(255, 70, 20, 0.6); animation: flairFlame 0.9s ease-in-out infinite alternate; }
@keyframes flairFlame { to { box-shadow: 0 0 0 2px #ffd27a, 0 0 20px 6px rgba(255, 140, 40, 0.9), 0 -10px 24px 4px rgba(255, 90, 20, 0.7); } }
.card.field.flair-aurora::after { background: linear-gradient(120deg, rgba(255, 0, 128, 0.35), rgba(0, 200, 255, 0.35), rgba(120, 255, 120, 0.35), rgba(255, 220, 0, 0.35)); background-size: 300% 300%; mix-blend-mode: overlay; animation: flairAurora 4s ease-in-out infinite; }
@keyframes flairAurora { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.card.field.flair-gold::after { box-shadow: 0 0 0 3px #ffd34d, 0 0 0 5px #fff6c9, 0 0 18px 4px rgba(255, 200, 40, 0.75); background: linear-gradient(115deg, transparent 35%, rgba(255, 245, 190, 0.55) 50%, transparent 65%); background-size: 260% 100%; animation: flairGold 2.6s ease-in-out infinite; }
@keyframes flairGold { from { background-position: 130% 0; } to { background-position: -30% 0; } }
.coin-wrap[data-skin="gold"] .coin-face { box-shadow: 0 0 0 calc(var(--u) * 1.2) #ffcf3c, 0 0 24px rgba(255, 200, 40, 0.8), 0 12px 30px rgba(0, 0, 0, 0.35); filter: sepia(0.6) saturate(2.2) hue-rotate(-12deg) brightness(1.08); }
.coin-wrap[data-skin="crystal"] .coin-face { box-shadow: 0 0 0 calc(var(--u) * 1.2) #a8e9ff, 0 0 24px rgba(120, 210, 255, 0.85), 0 12px 30px rgba(0, 0, 0, 0.35); filter: hue-rotate(185deg) saturate(1.2) brightness(1.1); }
@media (prefers-reduced-motion: reduce) { .card.field.flair::after { animation: none; } }

/* 7b. waiting indicator: top-left rail, right of the menu button (inside #board, so sheets / modals cover it) */
.fx-wait { position: absolute; z-index: 6; pointer-events: none; white-space: nowrap;
  left: calc(var(--u) * 2.6 + clamp(40px, calc(var(--u) * 10.4), 54px) + 8px); top: calc(var(--u) * 2.6 + clamp(40px, calc(var(--u) * 10.4), 54px) / 2);
  display: flex; align-items: center; gap: 3px; padding: 5px 12px 5px 10px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.9); color: #23314d; font-size: clamp(10.5px, calc(var(--k) * 2.2), 14px); font-weight: 600;
  box-shadow: 0 4px 12px rgba(20, 30, 60, 0.18); opacity: 0; transform: translate(-6px, -50%); transition: opacity 0.2s, transform 0.25s; }
.fx-wait.show { opacity: 1; transform: translate(0, -50%); }
.fx-wait i { width: 5px; height: 5px; border-radius: 50%; background: #ef4f5a; animation: dot 1s infinite; }
.fx-wait i:nth-child(2) { animation-delay: 0.15s; } .fx-wait i:nth-child(3) { animation-delay: 0.3s; }
.fx-wait span { margin-left: 5px; }

/* Evolution (BattleFX.evolve): light pillar + spiral behind a card that glows white and flips into the evolved card. */
.fx-evo { z-index: 72 !important; perspective: 900px; }
.fx-evo-pillar { position: absolute; left: 50%; top: 50%; width: calc(var(--pw) * 0.55); height: var(--bh); transform: translate(-50%, -50%) scaleY(0); opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 246, 200, 0.55) 30%, #fff 50%, rgba(200, 235, 255, 0.55) 70%, transparent); filter: blur(6px); mix-blend-mode: screen; }
.fx-evo-spiral { position: absolute; left: 50%; top: 50%; width: var(--pw); aspect-ratio: 1; border-radius: 50%; opacity: 0;
  background: conic-gradient(from 0deg, transparent 0 10%, rgba(255, 255, 255, 0.95) 14%, transparent 22% 35%, rgba(255, 224, 120, 0.9) 40%, transparent 48% 60%, rgba(150, 220, 255, 0.9) 66%, transparent 74% 85%, rgba(255, 255, 255, 0.9) 90%, transparent 97%);
  -webkit-mask: radial-gradient(circle, transparent 38%, #000 42%, #000 58%, transparent 66%); mask: radial-gradient(circle, transparent 38%, #000 42%, #000 58%, transparent 66%); filter: blur(1.5px); mix-blend-mode: screen; }
.fx-evo-card { position: absolute; inset: 0; transform-style: preserve-3d; opacity: 0; }
.fx-evo-face { position: absolute; inset: 0; border-radius: 4.5% / 3.2%; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fx-evo-face img { width: 100%; height: 100%; display: block; }
.fx-evo-face.new { transform: rotateY(-90deg); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 0 50px rgba(255, 240, 170, 0.7); }
.fx-evo-holo { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: color-dodge; background-size: 300% 100%; background-position: 120% 0;
  background-image: linear-gradient(110deg, transparent 35%, rgba(255, 120, 200, 0.55) 42%, rgba(255, 240, 120, 0.6) 47%, rgba(120, 255, 200, 0.55) 52%, rgba(120, 180, 255, 0.55) 57%, transparent 64%); }
.fx-evo .fx-big-tag { z-index: 2; }
.fx-evo-quick { z-index: 72 !important; border-radius: 4.5% / 3.2%; overflow: hidden; box-shadow: 0 0 0 3px #fff, 0 0 30px #ffe98a; }
.fx-evo-quick img { width: 100%; height: 100%; display: block; }
