/* Flip 7 - Game Animations (Bust and Stay) */

.player-area.stayed {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.25) 0%, rgba(16, 185, 129, 0.20) 100%) !important;
    border: 2px solid rgba(34, 197, 94, 0.8) !important;
    box-shadow: inset 0 0 20px rgba(34, 197, 94, 0.3) !important;
    position: relative;
}

/* Keep stayed indicator visible and properly positioned */
.player-area.stayed .stayed-indicator {
    animation: none;
    opacity: 1;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

/* Stayed indicator badge */
.stayed-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1em;
    box-shadow: 
        0 4px 15px rgba(34, 197, 94, 0.4),
        0 0 30px rgba(34, 197, 94, 0.3);
    animation: stayedBadgeIn 0.5s ease-out;
    white-space: nowrap;
    z-index: 1002;
}

.stayed-icon {
    font-size: 1.2em;
    animation: checkmarkPop 0.6s ease-out;
}

.stayed-text {
    font-size: 1.1em;
    letter-spacing: 1px;
}

.stayed-points {
    font-size: 0.9em;
    opacity: 0.9;
}

@keyframes stayedBadgeIn {
    0% {
        transform: translateX(-50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translateX(-50%) scale(1.1);
    }
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

@keyframes checkmarkPop {
    0% {
        transform: scale(0) rotate(-180deg);
    }
    50% {
        transform: scale(1.3) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Card glow effect when staying */
.card.stay-glow {
    animation: stayGlow 0.8s ease-out;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.6);
}

@keyframes stayGlow {
    0% {
        transform: scale(1);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 
            0 0 30px rgba(34, 197, 94, 0.8),
            0 0 50px rgba(34, 197, 94, 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }
}

/* Bust overlay - absolutely positioned */
.bust-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.8);
    z-index: 10;
    pointer-events: none;
}

.bust-text {
    font-size: 2em;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    animation: bustTextPop 0.5s ease-out;
}

@keyframes bustTextPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* Flip7 banner - absolutely positioned */
.flip7-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
    animation: flip7BannerAppear 1s ease-out;
}

.flip7-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.6);
}

.flip7-number {
    font-size: 3em;
    font-weight: bold;
    color: white;
}

.flip7-text {
    font-size: 1.2em;
    font-weight: bold;
    color: white;
}

.flip7-bonus {
    font-size: 0.9em;
    color: white;
}

@keyframes flip7BannerAppear {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-180deg); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2) rotate(10deg); }
    100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
}

/* Freeze overlay - absolutely positioned */
.custom-freeze-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, 
        rgba(96, 165, 250, 0.85) 0%, 
        rgba(59, 130, 246, 0.9) 25%,
        rgba(147, 197, 253, 0.85) 50%,
        rgba(59, 130, 246, 0.9) 75%,
        rgba(96, 165, 250, 0.85) 100%);
    backdrop-filter: blur(2px);
    border-radius: 8px;
    z-index: 10;
    pointer-events: none;
    animation: freezeOverlayAppear 0.5s ease-out;
}

.second-chance-enhanced-backdrop {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    pointer-events: none;
}

.freeze-text {
    font-size: 2em;
    font-weight: bold;
    color: white;
    text-shadow: 
        0 0 20px rgba(255,255,255,0.8),
        0 0 40px rgba(96, 165, 250, 1),
        0 0 60px rgba(147, 197, 253, 1),
        0 4px 8px rgba(0,0,0,0.5);
    text-align: center;
    animation: freezeTextGlow 1s ease-in-out infinite alternate;
}

@keyframes freezeOverlayAppear {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes freezeTextGlow {
    0% { 
        text-shadow: 
            0 0 20px rgba(255,255,255,0.8),
            0 0 40px rgba(96, 165, 250, 1),
            0 0 60px rgba(147, 197, 253, 1),
            0 4px 8px rgba(0,0,0,0.5);
    }
    100% { 
        text-shadow: 
            0 0 30px rgba(255,255,255,1),
            0 0 60px rgba(96, 165, 250, 1),
            0 0 80px rgba(147, 197, 253, 1),
            0 4px 8px rgba(0,0,0,0.5);
    }
}

/* Flip 7 celebration enhancements */
.player-area.flip7-achieved,
.player-area.flip7-winner {
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.45);
    position: relative;
}

.sparkle-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.sparkle {
    position: absolute;
    width: 4px;
    height: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(255,215,0,0.1) 100%);
    border-radius: 2px;
    opacity: 0;
    animation: sparkleTwinkle 1.2s ease-out forwards;
}

@keyframes sparkleTwinkle {
    0% { transform: scaleY(0.2); opacity: 0; }
    40% { opacity: 1; }
    100% { transform: scaleY(1); opacity: 0; }
}

.celebration-burst {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255,215,0,0.4) 0%, transparent 60%);
    animation: celebrationBurst 0.9s ease-out forwards;
    pointer-events: none;
}

@keyframes celebrationBurst {
    0% { opacity: 0; transform: scale(0.6); }
    60% { opacity: 1; }
    100% { opacity: 0; transform: scale(1.2); }
}

.confetti {
    position: absolute;
    top: -10px;
    width: 6px;
    height: 14px;
    border-radius: 2px;
    opacity: 0;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(220px) rotate(220deg); opacity: 0; }
}

.firework {
    position: fixed;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.9);
    transform: scale(0);
    opacity: 0;
    animation: fireworkBlast 1.5s ease-out forwards;
    pointer-events: none;
}

@keyframes fireworkBlast {
    0% { transform: scale(0); opacity: 0; }
    40% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0); opacity: 0; }
}

/* Card state helpers injected from JS */
.card.bust-card {
    filter: grayscale(0.6);
    opacity: 0.5;
}

.card.freezing {
    box-shadow: 0 0 18px rgba(96, 165, 250, 0.8);
    transform: translateY(-3px);
}

.player-area.busted {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.18) 0%, rgba(190, 18, 60, 0.24) 100%);
    border-color: rgba(239, 68, 68, 0.6);
    filter: grayscale(0.4);
    position: relative;
}

.animate-in {
    animation: fadeScaleIn 0.35s ease-out;
}

@keyframes fadeScaleIn {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

/* Score transfer visuals */
.score-transfer-animation {
    text-shadow: 0 0 12px rgba(74, 222, 128, 0.9);
}

.score-pulse-effect {
    pointer-events: none;
}

@keyframes scorePulse {
    0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0.7; }
    100% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; }
}

/* Targeting visuals */
.targeting-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 12px;
    border: 2px dashed rgba(59, 130, 246, 0.7);
    animation: targetingPulse 1.2s ease-in-out infinite;
    pointer-events: none;
}

.target-indicator {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 1.6em;
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.6));
    pointer-events: none;
}

.targetable-name {
    color: var(--info-blue);
    text-shadow: 0 0 6px rgba(59, 130, 246, 0.7);
}

@keyframes targetingPulse {
    0% { opacity: 0.4; transform: scale(0.96); }
    50% { opacity: 0.9; transform: scale(1.02); }
    100% { opacity: 0.4; transform: scale(0.96); }
}

.action-choice-prompt {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 20px 28px;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.45);
    color: var(--text-white);
    text-align: center;
    z-index: calc(var(--z-modals, 1000) + 60);
    max-width: min(420px, 92vw);
    backdrop-filter: blur(8px);
}

.action-choice-title {
    margin: 0;
    font-size: 1.35em;
    font-weight: 700;
    color: var(--accent-gold);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.35);
    letter-spacing: 0.5px;
}

.action-choice-description {
    margin: 0;
    font-size: 0.95em;
    opacity: 0.85;
}

.action-choice-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    width: 100%;
}

.action-choice-buttons .btn {
    min-width: 140px;
}

.targeting-instructions {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 14px 22px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.3);
    color: var(--text-white);
    z-index: calc(var(--z-modals, 1000) + 50);
    font-size: 0.95em;
    backdrop-filter: blur(7px);
    max-width: min(480px, 94vw);
    text-align: center;
}

.targeting-instruction-message {
    text-align: center;
    line-height: 1.4;
}

.targeting-instruction-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.targeting-instruction-buttons .btn {
    min-width: 140px;
}

.targeting-disabled {
    opacity: 0.45;
    filter: grayscale(35%);
}

.targeting-disabled .player-header h3,
.targeting-disabled .player-name {
    color: rgba(148, 163, 184, 0.6);
}

.targeting-disabled:hover {
    cursor: not-allowed !important;
}

.targeting-discard-option {
    display: none;
}

@media (max-width: 768px) {
    .action-choice-prompt {
        bottom: 92px;
        padding: 18px 20px;
        width: min(92vw, 360px);
        gap: 12px;
    }

    .action-choice-buttons {
        flex-direction: column;
    }

    .action-choice-buttons .btn {
        width: 100%;
    }

    .targeting-instructions {
        top: 12px;
        width: min(92vw, 360px);
        padding: 12px 16px;
    }

    .targeting-instruction-buttons {
        flex-direction: column;
        width: 100%;
    }

    .targeting-instruction-buttons .btn {
        width: 100%;
    }
}

.card-discard-toast-container {
    position: fixed;
    top: 18%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 3200;
    pointer-events: none;
}

.card-discard-notification {
    min-width: 220px;
    max-width: 360px;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.92);
    color: #f8fafc;
    text-align: center;
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.35);
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
    backdrop-filter: blur(8px);
    pointer-events: none;
}

.card-discard-notification.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.card-discard-notification.leaving {
    opacity: 0;
    transform: translateY(-24px) scale(0.93);
    transition: opacity 0.3s ease-in, transform 0.3s ease-in;
}

.card-discard-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    padding: 4px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(147, 197, 253, 0.3));
    color: #bfdbfe;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.82em;
    letter-spacing: 0.08em;
    border: 1px solid rgba(96, 165, 250, 0.4);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.25);
}

.card-discard-title {
    font-size: 1.15em;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}

.card-discard-text {
    font-size: 0.95em;
    color: #e2e8f0;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .card-discard-toast-container {
        top: 16%;
        gap: 10px;
    }

    .card-discard-notification {
        width: min(90%, 320px);
        padding: 12px 16px;
    }

    .card-discard-title {
        font-size: 1.05em;
    }
}
