/* ═══════════════════════════════════════════════════════════════════════════
   BATTLE EFFECTS (v3.4.0) — styles for js/battle-fx.js.
   #fx-plane lies on the tilted table (css/game-layout.css); #fx-screen is flat
   over the whole match. Everything here is pointer-events: none.
   ═══════════════════════════════════════════════════════════════════════════ */

/* A zone whose card is being played by a ghost. */
#mat .slot.fx-hold > .card { visibility: hidden; }

/* Hit: the zone jolts (translate, so the layout's transform rules don't fight it). */
#mat .slot.fx-shake { animation: fxShake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes fxShake {
    10%, 90% { translate: -2px 0; }
    20%, 80% { translate: 5px 0; }
    30%, 50%, 70% { translate: -8px 0; }
    40%, 60% { translate: 8px 0; }
    100% { translate: 0 0; }
}

.fx-ghost { pointer-events: none !important; z-index: 5; will-change: transform, opacity; }
.fx-ghost.fx-attacker { z-index: 8; box-shadow: 0 30px 30px rgba(0, 0, 0, .7), 0 0 26px rgba(255, 200, 90, .45) !important; }
.fx-ghost.fx-dead { filter: brightness(1.4) saturate(.6) sepia(.3); }

.fx-hitflash {
    position: absolute;
    border-radius: 8px;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, .95) 0%, rgba(255, 90, 60, .7) 55%, rgba(255, 40, 40, .2) 100%);
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 9;
}
.fx-flash {
    position: absolute;
    width: 220px; height: 220px;
    margin: -110px 0 0 -110px;
    border-radius: 50%;
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 10;
}
.fx-ring {
    position: absolute;
    width: 90px; height: 90px;
    margin: -45px 0 0 -45px;
    border: 4px solid;
    border-radius: 50%;
    pointer-events: none;
    z-index: 4;
}
.fx-spark {
    position: absolute;
    width: 10px; height: 3px;
    margin: -1px 0 0 -5px;
    border-radius: 2px;
    box-shadow: 0 0 8px currentColor, 0 0 4px #fff;
    pointer-events: none;
    z-index: 11;
}
.fx-ember {
    position: absolute;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #ffb347;
    box-shadow: 0 0 10px #ff7a1a, 0 0 4px #fff3c4;
    pointer-events: none;
    z-index: 11;
}
.fx-dust {
    position: absolute;
    width: 26px; height: 14px;
    margin: -7px 0 0 -13px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(200, 190, 170, .55) 0%, transparent 70%);
    pointer-events: none;
    z-index: 3;
}

/* Money stacks count up and down; a gain flashes green, a loss red. */
.money-box.fx-gain { animation: fxGain .7s ease-out; }
.money-box.fx-loss { animation: fxLoss .7s ease-out; }
@keyframes fxGain { 0% { box-shadow: 0 0 0 2px rgba(0, 255, 135, .9), 0 0 24px rgba(0, 255, 135, .6); color: #8affc4; } 100% { box-shadow: none; } }
@keyframes fxLoss { 0% { box-shadow: 0 0 0 2px rgba(255, 59, 59, .9), 0 0 24px rgba(255, 59, 59, .6); color: #ff8a8a; } 100% { box-shadow: none; } }

.fx-bill {
    position: fixed;
    width: 22px; height: 12px;
    margin: -6px 0 0 -11px;
    background: linear-gradient(180deg, #7ad18b 0%, #3f9a52 100%);
    border: 1px solid #1f5a2c;
    border-radius: 1px;
    color: #0d3517;
    font: 900 9px/10px 'Barlow Condensed', sans-serif;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .5);
}

/* Coin flip (BattleFX.coin): the match coin spins over the card, then its result. */
.fx-coin {
    position: fixed;
    z-index: 30;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    transform: translate(-50%, -50%);
    perspective: 400px;
    pointer-events: none;
}
.fx-coin-spin {
    position: relative;
    width: clamp(40px, 9vh, 64px); aspect-ratio: 1;
    transform-style: preserve-3d;   /* no filter here: it would flatten the coin and show the crown from behind */
}
.fx-coin-spin img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .65));
    user-select: none;
}
.fx-coin-spin img.back { transform: rotateY(180deg); }
.fx-coin-label {
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(10, 10, 12, .88);
    font: 400 clamp(.7rem, 1.8vh, .9rem)/1.2 'Bebas Neue', sans-serif;
    letter-spacing: 1.5px;
    white-space: nowrap;
    opacity: 0;
}
.fx-coin.heads .fx-coin-label { color: var(--gold, #d4af37); box-shadow: 0 0 0 1px rgba(212, 175, 55, .6); }
.fx-coin.tails .fx-coin-label { color: #eeedf5; box-shadow: 0 0 0 1px rgba(238, 237, 245, .35); }

/* Trap reveal: the card flips up over the table. */
.fx-trap-reveal {
    position: fixed;
    left: 50%; top: 46%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    perspective: 900px;
    pointer-events: none;
}
.fx-trap-tag {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.6rem;
    letter-spacing: 6px;
    color: #ff7a35;
    text-shadow: 0 0 18px rgba(255, 107, 53, .8), 0 3px 0 #000;
}
.fx-trap-reveal.mine .fx-trap-tag { color: var(--gold); text-shadow: 0 0 18px rgba(212, 175, 55, .8), 0 3px 0 #000; }
.fx-trap-card { pointer-events: none !important; box-shadow: 0 0 0 2px #ff7a35, 0 0 40px rgba(255, 107, 53, .7), 0 30px 40px rgba(0, 0, 0, .7) !important; }

/* Banners: a skewed band sweeping across the middle. */
.fx-banner {
    position: fixed;
    left: 0; right: 0;
    top: 40%;
    display: flex;
    justify-content: center;
    pointer-events: none;
    overflow: hidden;
    padding: 10px 0;
}
.fx-banner-band {
    min-width: 62%;
    padding: 8px 60px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(90deg, transparent 0%, rgba(10, 9, 6, .92) 12%, rgba(10, 9, 6, .92) 88%, transparent 100%);
    border-top: 2px solid var(--gold);
    border-bottom: 2px solid var(--gold);
    box-shadow: 0 0 40px rgba(212, 175, 55, .25);
}
.fx-banner-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(1.8rem, 7vh, 3.4rem);
    letter-spacing: 10px;
    line-height: 1;
    color: var(--gold);
    text-shadow: 0 0 24px rgba(212, 175, 55, .6), 0 3px 0 #000;
    white-space: nowrap;
}
.fx-banner-sub {
    margin-top: 4px;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: clamp(.7rem, 2.6vh, 1rem);
    letter-spacing: 3px;
    color: rgba(255, 255, 255, .75);
    white-space: nowrap;
}
.fx-banner.red .fx-banner-band { border-color: var(--red); box-shadow: 0 0 40px rgba(255, 59, 59, .25); }
.fx-banner.red .fx-banner-text { color: #ff6b6b; text-shadow: 0 0 24px rgba(255, 59, 59, .6), 0 3px 0 #000; }
.fx-banner.phase .fx-banner-band { min-width: 40%; border-color: rgba(255, 255, 255, .25); box-shadow: none; padding: 6px 50px; }
.fx-banner.phase .fx-banner-text { font-size: clamp(1.3rem, 5vh, 2.4rem); color: #fff; text-shadow: 0 3px 0 #000; }
.fx-banner.crew .fx-banner-band { border-color: var(--crew, var(--gold)); box-shadow: 0 0 44px var(--crew, var(--gold)); }
.fx-banner.crew .fx-banner-text { color: var(--crew, var(--gold)); text-shadow: 0 0 24px var(--crew, var(--gold)), 0 3px 0 #000; }

@media (prefers-reduced-motion: reduce) {
    #mat .slot.fx-shake, .money-box.fx-gain, .money-box.fx-loss { animation: none; }
}
