/* ============================================================
   SOUNDVFX OVERLAY — Visual Effects for Fight Point Soundboard
   ============================================================ */

/* ===== OVERLAY CONTAINER ===== */
#soundvfx-layer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 15000;
    pointer-events: none;
    overflow: hidden;
    font-family: 'Quicksand', 'Segoe UI', sans-serif;
}

/* ===== TOAST QUEUE (Tier 2 + Tier 3 popups) ===== */
#soundvfx-queue {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 100%;
    max-width: 480px;
    padding: 0 15px;
    box-sizing: border-box;
}

/* ===== TIER 2 — ACCENTED TOAST ===== */
.soundvfx-toast {
    width: 100%;
    background: rgba(10, 10, 15, 0.82);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 18px 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    cursor: pointer;
    pointer-events: auto;

    /* Entrance animation */
    animation: soundvfx-toast-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    transform: translateY(-25px) scale(0.92);
}

.soundvfx-toast.soundvfx-exiting {
    animation: soundvfx-toast-out 0.35s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* Color accent bar (left edge) */
.soundvfx-toast::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--svfx-color, #888);
    box-shadow: 0 0 12px var(--svfx-color, #888);
    border-radius: 12px 0 0 12px;
}

/* Shimmer sweep */
.soundvfx-toast::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    transform: skewX(-20deg);
    animation: soundvfx-shimmer 0.8s ease-in-out 0.3s forwards;
}

/* Icon container */
.soundvfx-toast-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    animation: soundvfx-icon-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

.soundvfx-toast-icon svg {
    width: 26px;
    height: 26px;
}

.soundvfx-toast-icon .svfx-emoji {
    font-size: 22px;
    line-height: 1;
    filter: drop-shadow(0 0 4px var(--svfx-color, #888));
}

/* Text */
.soundvfx-toast-text {
    flex: 1;
    min-width: 0;
}

.soundvfx-toast-label {
    font-family: 'Cinzel', serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--svfx-color, #ccc);
    text-shadow: 0 0 10px var(--svfx-color, transparent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.soundvfx-toast-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Auto-dismiss progress bar */
.soundvfx-toast-progress {
    position: absolute;
    bottom: 0; left: 0;
    height: 2px;
    background: var(--svfx-color, #888);
    opacity: 0.5;
    border-radius: 0 0 12px 12px;
    animation: soundvfx-progress var(--svfx-duration, 3.5s) linear forwards;
}


/* ===== TIER 3 — DRAMATIC POPUP ===== */
.soundvfx-dramatic {
    width: 100%;
    max-width: 420px;
    background: rgba(8, 8, 12, 0.88);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border: 1px solid var(--svfx-color, #ff2222);
    border-radius: 14px;
    padding: 20px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 40px rgba(0, 0, 0, 0.6),
        0 0 20px var(--svfx-glow, rgba(255, 0, 0, 0.15)),
        inset 0 0 30px var(--svfx-glow, rgba(255, 0, 0, 0.05));
    cursor: pointer;
    pointer-events: auto;

    animation: soundvfx-dramatic-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    transform: scale(0.7);
}

.soundvfx-dramatic.soundvfx-exiting {
    animation: soundvfx-toast-out 0.4s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* Dramatic background pulse */
.soundvfx-dramatic::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--svfx-color, #ff2222), transparent, var(--svfx-color, #ff2222));
    opacity: 0.15;
    animation: soundvfx-border-rotate 3s linear infinite;
    z-index: -1;
}

/* Inner glow */
.soundvfx-dramatic::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 200%; height: 200%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--svfx-glow, rgba(255,0,0,0.1)) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.soundvfx-dramatic-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    animation: soundvfx-icon-dramatic 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
    position: relative;
    z-index: 1;
}

.soundvfx-dramatic-icon svg {
    width: 100%;
    height: 100%;
}

.soundvfx-dramatic-label {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--svfx-color, #ff2222);
    text-shadow: 0 0 20px var(--svfx-color, #ff2222), 0 2px 8px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 1;
    animation: soundvfx-text-dramatic 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

.soundvfx-dramatic-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 6px;
    position: relative;
    z-index: 1;
    animation: soundvfx-text-dramatic 0.6s ease 0.45s both;
}

.soundvfx-dramatic-progress {
    position: absolute;
    bottom: 0; left: 0;
    height: 3px;
    background: var(--svfx-color, #ff2222);
    opacity: 0.4;
    border-radius: 0 0 14px 14px;
    animation: soundvfx-progress var(--svfx-duration, 4.5s) linear forwards;
}


/* ===== SCREEN EDGE EFFECTS (Tier 3) ===== */
#soundvfx-edge {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

.soundvfx-edge-vignette {
    position: absolute;
    inset: 0;
    opacity: 0;
    animation: soundvfx-edge-pulse 0.5s ease forwards;
}

.soundvfx-edge-vignette.soundvfx-exiting {
    animation: soundvfx-edge-out 0.5s ease forwards;
}

.soundvfx-edge-vignette.edge-red {
    box-shadow: inset 0 0 120px rgba(255, 0, 0, 0.25), inset 0 0 60px rgba(255, 0, 0, 0.15);
}

.soundvfx-edge-vignette.edge-purple {
    box-shadow: inset 0 0 120px rgba(155, 50, 200, 0.25), inset 0 0 60px rgba(155, 50, 200, 0.15);
}

.soundvfx-edge-vignette.edge-orange {
    box-shadow: inset 0 0 120px rgba(255, 120, 0, 0.22), inset 0 0 60px rgba(255, 120, 0, 0.12);
}

.soundvfx-edge-vignette.edge-cyan {
    box-shadow: inset 0 0 120px rgba(0, 200, 255, 0.2), inset 0 0 60px rgba(0, 200, 255, 0.1);
}

.soundvfx-edge-vignette.edge-yellow {
    box-shadow: inset 0 0 120px rgba(255, 255, 0, 0.22), inset 0 0 60px rgba(255, 255, 0, 0.12);
}

.soundvfx-edge-vignette.edge-blood {
    box-shadow: inset 0 0 150px rgba(139, 0, 0, 0.35), inset 0 0 80px rgba(139, 0, 0, 0.2);
}

.soundvfx-edge-vignette.edge-green {
    box-shadow: inset 0 0 100px rgba(34, 197, 94, 0.2), inset 0 0 50px rgba(34, 197, 94, 0.1);
}


/* ===== TIER 4 — CINEMATIC SHOWSTOPPER ===== */
#soundvfx-cinema {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#soundvfx-cinema.active {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
}

/* Backdrop overlay */
.soundvfx-cinema-backdrop {
    position: absolute;
    inset: 0;
    animation: soundvfx-backdrop-in 0.6s ease forwards;
}

.soundvfx-cinema-backdrop.backdrop-gold {
    background: radial-gradient(ellipse at center,
        rgba(255, 215, 0, 0.12) 0%,
        rgba(10, 8, 2, 0.75) 50%,
        rgba(5, 5, 5, 0.85) 100%);
}

.soundvfx-cinema-backdrop.backdrop-crimson {
    background: radial-gradient(ellipse at center,
        rgba(100, 0, 10, 0.15) 0%,
        rgba(15, 2, 2, 0.8) 50%,
        rgba(5, 0, 0, 0.9) 100%);
}

.soundvfx-cinema-backdrop.backdrop-triumph {
    background: radial-gradient(ellipse at center,
        rgba(255, 215, 0, 0.15) 0%,
        rgba(10, 8, 2, 0.7) 40%,
        rgba(5, 5, 5, 0.88) 100%);
}

.soundvfx-cinema-backdrop.backdrop-legendary {
    background: radial-gradient(ellipse at center,
        rgba(255, 100, 0, 0.12) 0%,
        rgba(15, 5, 0, 0.78) 50%,
        rgba(5, 2, 0, 0.9) 100%);
}

/* Central content */
.soundvfx-cinema-content {
    position: relative;
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Large SVG icon */
.soundvfx-cinema-icon {
    width: 120px;
    height: 120px;
    animation: soundvfx-cinema-icon-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    filter: drop-shadow(0 0 30px var(--svfx-color, #ffd700));
}

.soundvfx-cinema-icon svg {
    width: 100%;
    height: 100%;
}

/* Pulse rings behind icon */
.soundvfx-cinema-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.soundvfx-ring {
    position: absolute;
    inset: 0;
    border: 2px solid var(--svfx-color, #ffd700);
    border-radius: 50%;
    opacity: 0;
}

.soundvfx-ring:nth-child(1) { animation: soundvfx-ring-expand 2s ease-out 0.3s infinite; }
.soundvfx-ring:nth-child(2) { animation: soundvfx-ring-expand 2s ease-out 0.8s infinite; }
.soundvfx-ring:nth-child(3) { animation: soundvfx-ring-expand 2s ease-out 1.3s infinite; }

/* Main title text */
.soundvfx-cinema-title {
    font-family: 'Cinzel', serif;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: var(--svfx-color, #ffd700);
    text-shadow:
        0 0 30px var(--svfx-color, #ffd700),
        0 0 60px var(--svfx-glow, rgba(255, 215, 0, 0.4)),
        0 4px 12px rgba(0, 0, 0, 0.9);
    animation: soundvfx-cinema-text-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}

/* Subtitle */
.soundvfx-cinema-subtitle {
    font-family: 'Cinzel', serif;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 0 10px var(--svfx-glow, rgba(255, 215, 0, 0.3));
    animation: soundvfx-cinema-text-in 0.6s ease 0.7s both;
}

/* Particle container */
.soundvfx-cinema-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.soundvfx-particle {
    position: absolute;
    bottom: -5%;
    border-radius: 50%;
    opacity: 0;
    animation: soundvfx-particle-rise var(--svfx-particle-duration, 4s) var(--svfx-particle-delay, 0s) linear forwards;
}

/* Light ray decoration */
.soundvfx-cinema-rays {
    position: absolute;
    top: 50%; left: 50%;
    width: 300px; height: 300px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
    opacity: 0.15;
    animation: soundvfx-rays-spin 12s linear infinite, soundvfx-fade-in 1s ease 0.3s both;
}

.soundvfx-ray {
    position: absolute;
    top: 0; left: 50%;
    width: 2px; height: 50%;
    transform-origin: bottom center;
    background: linear-gradient(to top, var(--svfx-color, #ffd700), transparent);
}

/* Cinema exit */
#soundvfx-cinema.soundvfx-cinema-exiting {
    animation: soundvfx-cinema-out 0.5s ease forwards;
}


/* ===== SCREEN SHAKE (for impacts) ===== */
@keyframes soundvfx-shake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-4px, 2px); }
    20% { transform: translate(4px, -2px); }
    30% { transform: translate(-3px, -1px); }
    40% { transform: translate(3px, 1px); }
    50% { transform: translate(-2px, 2px); }
    60% { transform: translate(2px, -1px); }
    70% { transform: translate(-1px, 1px); }
    80% { transform: translate(1px, -1px); }
}

.soundvfx-shaking {
    animation: soundvfx-shake 0.4s ease-in-out !important;
}


/* ===== KEYFRAMES ===== */

/* Toast entrance */
@keyframes soundvfx-toast-in {
    from {
        opacity: 0;
        transform: translateY(-25px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Toast exit */
@keyframes soundvfx-toast-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-15px) scale(0.9);
    }
}

/* Dramatic entrance */
@keyframes soundvfx-dramatic-in {
    0% {
        opacity: 0;
        transform: scale(0.6);
    }
    70% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Icon pop */
@keyframes soundvfx-icon-pop {
    0% {
        transform: scale(0) rotate(-30deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.2) rotate(5deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Dramatic icon entrance */
@keyframes soundvfx-icon-dramatic {
    0% {
        transform: scale(0) rotate(-90deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.15) rotate(5deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Dramatic text entrance */
@keyframes soundvfx-text-dramatic {
    0% {
        opacity: 0;
        transform: translateY(10px);
        letter-spacing: 8px;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        letter-spacing: 4px;
    }
}

/* Edge vignette pulse */
@keyframes soundvfx-edge-pulse {
    0% { opacity: 0; }
    30% { opacity: 1; }
    60% { opacity: 0.7; }
    80% { opacity: 0.9; }
    100% { opacity: 0.8; }
}

@keyframes soundvfx-edge-out {
    from { opacity: 0.8; }
    to { opacity: 0; }
}

/* Shimmer */
@keyframes soundvfx-shimmer {
    from { left: -100%; }
    to { left: 200%; }
}

/* Progress bar (auto-dismiss timer) */
@keyframes soundvfx-progress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Border rotation for dramatic popups */
@keyframes soundvfx-border-rotate {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* Cinema backdrop in */
@keyframes soundvfx-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Cinema icon entrance */
@keyframes soundvfx-cinema-icon-in {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.4) rotate(-15deg);
    }
    60% {
        opacity: 1;
        transform: translateY(-8px) scale(1.08) rotate(3deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
}

/* Cinema text entrance */
@keyframes soundvfx-cinema-text-in {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
        letter-spacing: 10px;
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        letter-spacing: 6px;
    }
}

/* Expanding ring pulse */
@keyframes soundvfx-ring-expand {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

/* Particle rise */
@keyframes soundvfx-particle-rise {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0;
    }
    8% {
        opacity: 0.9;
    }
    100% {
        transform: translateY(-110vh) translateX(var(--svfx-particle-drift, 0px)) scale(0.2);
        opacity: 0;
    }
}

/* Light rays spin */
@keyframes soundvfx-rays-spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Fade in utility */
@keyframes soundvfx-fade-in {
    from { opacity: 0; }
    to { opacity: 0.15; }
}

/* Cinema exit */
@keyframes soundvfx-cinema-out {
    0% { opacity: 1; }
    100% { opacity: 0; }
}


/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #soundvfx-queue {
        top: 50px;
        max-width: 95vw;
        padding: 0 8px;
    }

    .soundvfx-toast {
        padding: 10px 14px 10px 12px;
    }

    .soundvfx-toast-label {
        font-size: 11px;
        letter-spacing: 1px;
    }

    .soundvfx-toast-desc {
        font-size: 10px;
    }

    .soundvfx-dramatic {
        padding: 16px 18px;
    }

    .soundvfx-dramatic-label {
        font-size: 15px;
        letter-spacing: 3px;
    }

    .soundvfx-cinema-icon {
        width: 90px;
        height: 90px;
    }

    .soundvfx-cinema-title {
        font-size: 20px;
        letter-spacing: 4px;
    }

    .soundvfx-cinema-subtitle {
        font-size: 12px;
        letter-spacing: 3px;
    }
}


/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .soundvfx-toast,
    .soundvfx-dramatic,
    .soundvfx-cinema-icon,
    .soundvfx-cinema-title,
    .soundvfx-cinema-subtitle,
    .soundvfx-toast-icon,
    .soundvfx-edge-vignette,
    .soundvfx-ring,
    .soundvfx-particle,
    .soundvfx-cinema-rays {
        animation-duration: 0.01s !important;
    }
}

/* Settings: disable animations fallback */
.disable-animations #soundvfx-layer * {
    animation-duration: 0.01s !important;
    transition-duration: 0.01s !important;
}
