/* ==========================================================================
   CAPTAIN SUPERLAC - HIGH-FIDELITY VIDEO MASCOT SYSTEM
   ========================================================================== */

.mascot-container {
    width: 125px;
    height: 125px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mascot-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1));
}

/* Global Floating Mascot Position */
#global-mascot-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#global-mascot-widget:hover {
    transform: scale(1.05);
}

/* --------------------------------------------------------------------------
   DYNAMIC SPEECH BUBBLE SYSTEM
   -------------------------------------------------------------------------- */

.mascot-speech-bubble {
    position: absolute;
    bottom: 120%;
    right: 0;
    width: 220px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 12px 18px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 100;
}

.mascot-speech-bubble.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.mascot-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 54px;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mascot-message {
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
}

/* --------------------------------------------------------------------------
   SPLASH SCREEN SEQUENCE STYLES
   -------------------------------------------------------------------------- */

#mascot-splash-screen {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.92); /* Lighter, more premium overlay */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: opacity 0.8s ease-out;
}

#splash-mascot-video:not(.living-static), .mascot-video {
    animation: 
        mascot-entrance 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#splash-mascot-video, .mascot-fallback-img {
    width: 220px;
    height: auto;
    max-width: 80vw;
    object-fit: contain;
    filter: drop-shadow(0 0 30px rgba(16, 185, 129, 0.1));
    opacity: 0;
    will-change: transform, filter;
    transform-style: preserve-3d;
}

.mascot-fallback-img {
    display: none; /* Hidden by default, shown via JS if video fails or on Safari */
}

.mascot-fallback-img.living-static {
    perspective: 1000px;
    backface-visibility: hidden;
}

@keyframes mascot-entrance {
    from { 
        opacity: 0; 
        transform: scale(0.9) translateY(10px); 
        filter: blur(10px) drop-shadow(0 0 0 rgba(16, 185, 129, 0));
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0);
        filter: blur(0) drop-shadow(0 0 30px rgba(16, 185, 129, 0.1));
    }
}

@keyframes mascot-breathe {
    0%, 100% { 
        transform: scale(1); 
        filter: drop-shadow(0 0 30px rgba(16, 185, 129, 0.1)); 
    }
    50% { 
        transform: scale(1.04); 
        filter: drop-shadow(0 0 50px rgba(16, 185, 129, 0.2)); 
    }
}

@media (max-width: 768px) {
    #splash-mascot-video, .mascot-fallback-img {
        width: 140px;
    }
}

#splash-flash {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 100002;
}

#splash-scars {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at center, transparent 20%, #10b981 80%);
    opacity: 0;
    mix-blend-mode: multiply;
    pointer-events: none;
    z-index: 3;
    clip-path: polygon(0% 10%, 15% 15%, 33% 5%, 54% 22%, 75% 5%, 100% 20%, 90% 40%, 100% 60%, 80% 80%, 100% 100%, 75% 90%, 50% 100%, 25% 85%, 0% 100%, 10% 75%, 0% 50%);
}

/* Utility classes for progress bars */
.progress-mascot-video {
    width: 40px;
    height: 40px;
}

.mascot-widget.ai-toggle-btn {
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
}

.mascot-widget.ai-toggle-btn:hover {
    background: transparent !important;
}

/* iOS Specific Overrides for high-fidelity fallback */
.ios-mascot-fix .mascot-fallback-img {
    display: block !important;
    opacity: 1 !important;
}

.ios-mascot-fix video {
    display: none !important;
}

/* Aggressive Safari/iOS Video Hiding to prevent black background flicker */
html.is-safari #splash-mascot-video,
html.is-safari #ai-trigger video,
html.is-safari video[src*="maskot_animation"],
html.is-safari video source[src*="maskot_animation"] {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

html.is-safari .mascot-fallback-img {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}
