/* waifu-wars/css/battle.css - All styles for the battle screen */

#battle-screen {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
    background-size: cover;
    background-position: center;
    overflow: hidden; /* To contain floating text */
}

#weather-effects-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0; /* Behind units but above background */
    overflow: hidden;
}

.raindrop {
    position: absolute;
    bottom: 100%;
    width: 1px;
    height: 60px;
    background: linear-gradient(to top, rgba(255,255,255,0), rgba(255,255,255,0.4));
    animation: fall linear infinite;
}

@keyframes fall {
    to { transform: translateY(100vh); }
}

.snowflake {
    position: absolute;
    top: -20px;
    color: #fff;
    user-select: none;
    animation: snowfall linear infinite;
    text-shadow: 0 0 5px #fff;
    opacity: 0;
}

@keyframes snowfall {
    0% { transform: translateY(0vh) translateX(0px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) translateX(50px) rotate(360deg); opacity: 0; }
}

.fog-layer {
    position: absolute;
    width: 200%;
    height: 100%;
    left: -50%;
    background: linear-gradient(to top, rgba(180, 180, 190, 0.4) 0%, rgba(180, 180, 190, 0) 60%);
    animation: drift 60s linear infinite alternate;
}

.fog-layer.fog-1 {
    animation-duration: 60s;
}

.fog-layer.fog-2 {
    animation-duration: 90s;
    animation-direction: alternate-reverse;
    opacity: 0.7;
}

@keyframes drift {
    from { transform: translateX(-25%); }
    to { transform: translateX(0%); }
}


#skill-tooltip, #effect-tooltip {
    position: absolute;
    transform: translate(-50%, -110%);
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #555;
    z-index: 200;
    width: 220px;
    font-size: 12px;
    pointer-events: none;
    text-transform: capitalize;
}
#skill-tooltip h4, #effect-tooltip h4 { margin: 0 0 5px; font-size: 14px; }
#skill-tooltip p, #effect-tooltip p { margin: 3px 0; }
.mana-cost {
    color: #6495ED; /* CornflowerBlue */
    font-weight: bold;
}
.cooldown-value {
    color: yellow;
    font-weight: bold;
}

#spell-effects-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
    overflow: hidden;
}

.spell-effect {
    position: absolute;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    transform-origin: center;
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
    opacity: 1;
}

.battle-side {
    position: absolute;
    width: 100%;
    height: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2vmin;
    padding-left: 10px;
    padding-right: 10px;
    box-sizing: border-box;
}

.player-side {
    bottom: 0;
    align-items: flex-end; /* Align cards to the bottom of the container */
    padding-bottom: 30vh;
}
.enemy-side { top: 0; }

.waifu-card-battle {
    width: 12vmin;
    height: 18vmin;
    min-width: 80px;
    min-height: 120px;
    max-width: 120px;
    max-height: 180px;
    background: rgba(20, 20, 30, 0.7);
    border-radius: 10px;
    border: 2px solid #555;
    padding: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    position: relative;
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: visible;
}
.waifu-card-battle.attacking {
    animation: lurch 0.3s ease-in-out;
    z-index: 10;
}
@keyframes lurch {
    50% { transform: translate(var(--lurch-x), var(--lurch-y)) scale(1.05); }
}

.waifu-card-battle.active {
    transform: translateY(-20px) scale(1.1);
    box-shadow: 0 0 20px #77aaff;
    border-color: #77aaff;
}
.waifu-card-battle.targetable {
    cursor: pointer;
    box-shadow: 0 0 20px #ff5555;
    border-color: #ff5555;
}
.waifu-card-battle.targetable:hover {
    transform: scale(1.05);
}
.waifu-card-battle.dead {
    filter: grayscale(100%);
    opacity: 0.6;
}

.waifu-art {
    width: 8.5vmin;
    height: 8.5vmin;
    min-width: 60px;
    min-height: 60px;
    max-width: 100px;
    max-height: 100px;
    object-fit: cover;
    border-radius: 5px;
}
.waifu-name {
    font-weight: bold;
    margin-top: 5px;
    font-size: 1.5vmin;
}
.hp-bar-container {
    width: 90%;
    height: 15px;
    background: #333;
    border-radius: 7px;
    margin-top: 5px;
    position: relative;
    overflow: hidden;
    display: flex;
}
.hp-bar {
    height: 100%;
    background: linear-gradient(to right, #5cff5c, #1a9c1a);
    border-radius: 7px 0 0 7px;
    transition: width 0.5s ease;
}
.shield-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(0, 191, 255, 0.8);
    border-radius: 7px;
    z-index: 1;
    transition: width 0.5s ease;
}
.hp-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 10px;
    line-height: 15px;
    color: white;
    text-shadow: 1px 1px 1px black;
    z-index: 2;
}

.effects-container {
    position: absolute;
    top: -25px; /* Position above the card */
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 4px;
    z-index: 20;
}

.effect-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: white;
    background-size: 80%;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid black;
    position: relative;
    box-shadow: 0 0 5px black;
}
.turn-counter {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background-color: rgba(0,0,0,0.8);
    color: white;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    font-size: 9px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 1px solid white;
}
/* Specific effect icon styles */
.effect-icon.stun { background-color: #ffd700; background-image: url('../assets/effects/stun.png'); }
.effect-icon.attack_down { background-color: #ff4500; background-image: url('../assets/effects/attack_down.png'); }
.effect-icon.defense_down { background-color: #add8e6; background-image: url('../assets/effects/defense_down.png'); }
.effect-icon.dot_burn { background-color: #dc143c; background-image: url('../assets/effects/burn.png'); }
.effect-icon.attack_up { background-color: #ff4500; background-image: url('../assets/effects/attack_up.png'); }
.effect-icon.defense_up { background-color: #add8e6; background-image: url('../assets/effects/defense_up.png'); }
.effect-icon.regen { background-color: #90ee90; background-image: url('../assets/effects/regen.png'); }
.effect-icon.slow { background-color: #6495ed; background-image: url('../assets/effects/slow.png'); }
.effect-icon.bleed { background-color: #b22222; background-image: url('../assets/effects/bleed.png'); }
.effect-icon.root { background-color: #8b4513; background-image: url('../assets/effects/root.png'); }
.effect-icon.chill { background-color: #a0e8ff; background-image: url('../assets/effects/chill.png'); }
.effect-icon.taunt { background-color: #ff69b4; background-image: url('../assets/effects/taunt.png'); }

.floating-text {
    position: absolute;
    transform: translateX(-50%);
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px black;
    pointer-events: none;
    z-index: 10;
    animation: float-up 1.5s ease-out forwards;
}
.floating-text.crit {
    color: yellow;
    font-size: 32px;
    animation-duration: 2s;
}
.floating-text.miss {
    color: #aaa;
    font-size: 20px;
}
.floating-text.heal {
    color: #5cff5c;
}
.floating-text.shield {
    color: #00bfff;
}

@keyframes float-up {
    from { transform: translate(-50%, 0); opacity: 1; }
    to { transform: translate(-50%, -80px); opacity: 0; }
}

#turn-info-container {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(0,0,0,0.5);
    padding: 5px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#turn-order-ui {
    display: flex;
    gap: 5px;
}

#round-counter {
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
    padding-left: 15px;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
}

.turn-order-entry {
    width: 40px; height: 40px;
    border: 2px solid #555;
    border-radius: 50%;
    overflow: hidden;
}
.turn-order-entry.active {
    border-color: #77aaff;
    box-shadow: 0 0 10px #77aaff;
}
.turn-order-entry img {
    width: 100%; height: 100%;
    object-fit: cover;
}

#action-panel {
    position: absolute;
    bottom: 22vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    padding: 10px;
    background: rgba(0,0,0,0.7);
    border-radius: 10px;
    display: none;
    z-index: 5;
    min-height: 60px;
}

#battle-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20vh; /* Increased height for fanned cards */
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
}

#utility-hand {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    width: 90vw;
    max-width: 700px;
    height: 19vh;
    pointer-events: auto;
}

.utility-card {
    width: 80px;
    height: 120px;
    background: #2a2a3e;
    border: 2px solid #8e8ea8;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    font-weight: bold;
    position: absolute;
    bottom: 10px;
    transform-origin: 50% 300px; /* Lower pivot point for wider fan */
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    user-select: none;
}

.utility-card.discardable {
    cursor: pointer;
    border-color: #ffd700;
}
.utility-card.playable {
    cursor: pointer;
    border-color: #5cff5c; /* Green border to indicate playable */
}

.utility-card.playable:hover {
    box-shadow: 0 0 15px #5cff5c;
}

.utility-card.to-discard {
    transform: translateY(-20px) scale(1.25) !important;
    opacity: 0.8;
    border-color: #ff8c00;
    box-shadow: 0 0 15px #ff8c00;
}

.utility-card.has-art {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    text-indent: -9999px; /* Hide text if there's art */
    border: none;
    background-color: transparent;
}

.utility-card.hovered {
    box-shadow: 0 0 15px #fff;
    border-color: #fff;
    z-index: 100 !important;
}

#resources-bar {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#mana-bar {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.6);
    padding: 5px 10px;
    border-radius: 25px;
    border: 1px solid #3a86ff;
}

.mana-globe {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid #fff;
    background: conic-gradient(#3a86ff 100%, #222 0%);
    transition: background 0.5s;
}

.mana-text {
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
}

#deck-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    background: rgba(0,0,0,0.6);
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 14px;
}
.deck-count, .discard-count {
    padding: 2px;
}

#battle-log {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 25vw;
    max-width: 300px;
    min-width: 200px;
    height: 18vh;
    max-height: 140px;
    background: rgba(0,0,0,0.6);
    border-radius: 5px;
    overflow-y: scroll;
    color: white;
    font-size: 12px;
    padding: 5px;
}

/* --- NEW Spell Effect Styles --- */
.spell-effect-particle, .impact-particle, .self-buff-particle {
    position: absolute;
    pointer-events: none;
    z-index: 15;
    opacity: 1;
    transform-origin: center;
    border-radius: 50%;
}
.heal-plus {
    position: absolute;
    color: #90ee90;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 1px 1px 3px black;
    pointer-events: none;
    z-index: 16;
    animation: heal-float 1.2s ease-out forwards;
}
.revive-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    border-radius: 10px;
    animation: revive-pulse 2s ease-out forwards;
    background: radial-gradient(circle, rgba(255, 255, 150, 0.8) 0%, rgba(255, 255, 150, 0) 70%);
    pointer-events: none;
}
@keyframes revive-pulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}
@keyframes heal-float {
    from { transform: translateY(0) scale(1); opacity: 1; }
    to { transform: translateY(-50px) scale(0.5); opacity: 0; }
}

/* Projectile */
.projectile {
    width: 20px;
    height: 20px;
    transition: transform 0.4s cubic-bezier(0.5, 0, 1, 0.5), opacity 0.4s linear;
}
.projectile.inferno { box-shadow: 0 0 10px #ff8c00, 0 0 5px #ff4500; background: radial-gradient(circle, white, #ff8c00, #ff4500); }
.projectile.glacial { box-shadow: 0 0 10px #a0e8ff, 0 0 5px #6699ff; background: radial-gradient(circle, white, #a0e8ff, #6699ff); }
.projectile.nature { box-shadow: 0 0 10px #90ee90, 0 0 5px #228b22; background: radial-gradient(circle, white, #90ee90, #228b22); }
.projectile.holy { box-shadow: 0 0 10px #fffacd, 0 0 5px #ffd700; background: radial-gradient(circle, white, #fffacd, #ffd700); }
.projectile.void { box-shadow: 0 0 10px #9400d3, 0 0 5px #4b0082; background: radial-gradient(circle, white, #9400d3, #4b0082); }

/* Impact Burst */
.impact-particle { animation: impact-burst 0.5s ease-out forwards; }
@keyframes impact-burst {
    from { transform: scale(0.2) translate(var(--tx-start, 0), var(--ty-start, 0)); opacity: 1; }
    to { transform: scale(1.5) translate(var(--tx-end, 0), var(--ty-end, 0)); opacity: 0; }
}

/* Self Buff Swirl */
.self-buff-particle { animation: self-buff-swirl 1.5s ease-in-out forwards; }
@keyframes self-buff-swirl {
    0% { transform: translate(0, 0) scale(0.5); opacity: 1; }
    100% { transform: translate(var(--tx, 0), var(--ty, 0)) scale(1.2) rotate(360deg); opacity: 0; }
}

/* AOE Wave */
.aoe-wave {
    position: absolute;
    border-radius: 50%;
    border: 3px solid;
    animation: aoe-expand 0.8s ease-out forwards;
}
@keyframes aoe-expand {
    from { transform: scale(0.1); opacity: 1; }
    to { transform: scale(2); opacity: 0; }
}
.aoe-wave.inferno { border-color: #ff8c00; box-shadow: 0 0 15px #ff4500 inset; }
.aoe-wave.glacial { border-color: #a0e8ff; box-shadow: 0 0 15px #6699ff inset; }
.aoe-wave.nature { border-color: #90ee90; box-shadow: 0 0 15px #228b22 inset; }
.aoe-wave.holy { border-color: #fffacd; box-shadow: 0 0 15px #ffd700 inset; }
.aoe-wave.void { border-color: #9400d3; box-shadow: 0 0 15px #4b0082 inset; }


@media (max-width: 768px) {
    .waifu-card-battle {
        width: 15vw;
        height: 22.5vw;
    }
    .waifu-art {
        width: 12vw;
        height: 12vw;
    }
    #action-panel {
        gap: 5px;
        padding: 5px;
    }
    #action-panel .menu-btn {
        padding: 5px 8px;
        font-size: 12px;
    }
}
@media (max-width: 480px) {
    .battle-side {
        gap: 1vmin;
    }
    .waifu-card-battle {
        min-width: 60px;
        min-height: 90px;
    }
    .waifu-art {
        min-width: 40px;
        min-height: 40px;
    }
    .waifu-name {
        font-size: 10px;
    }
    .hp-text {
        font-size: 8px;
    }
}