/* Splash Screen Styles - Universal Multi-Browser & Multi-Device Flexible Engine */

html.skip-splash #splash-screen,
body.skip-splash #splash-screen {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

html.skip-splash #app-shell.hidden,
body.skip-splash #app-shell.hidden {
    display: block !important;
}

#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    width: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    height: 100%;
    background: radial-gradient(circle at center, #140e1e 0%, #06050a 55%, #000000 100%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: max(16px, env(safe-area-inset-top, 16px)) 16px max(16px, env(safe-area-inset-bottom, 16px)) 16px;
    box-sizing: border-box;
    transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1), transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

#splash-screen::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

#splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.03);
}

.splash-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 440px;
    margin: auto 0;
    padding: 6px 0;
    box-sizing: border-box;
}

/* --- ANIMATED FILM REEL & MEMORY STREAM THEMES --- */
:root {
    --reel-hi: #fedcd2;
    --reel-mid: #f09a88;
    --reel-shadow: #b35645;
    --halo-color: rgba(240, 154, 136, 0.35);
    --strip-border: rgba(255, 255, 255, 0.18);
}

[data-reel-theme="coral"] {
    --reel-hi: #fedcd2;
    --reel-mid: #f09a88;
    --reel-shadow: #b35645;
    --halo-color: rgba(240, 154, 136, 0.35);
    --strip-border: rgba(240, 154, 136, 0.4);
}

[data-reel-theme="neon"] {
    --reel-hi: #00ffcc;
    --reel-mid: #00b4d8;
    --reel-shadow: #7209b7;
    --halo-color: rgba(0, 255, 204, 0.4);
    --strip-border: rgba(0, 255, 204, 0.5);
}

[data-reel-theme="gold"] {
    --reel-hi: #fff2a3;
    --reel-mid: #fbd561;
    --reel-shadow: #996e18;
    --halo-color: rgba(251, 213, 97, 0.35);
    --strip-border: rgba(251, 213, 97, 0.45);
}

/* Film Reel Stage — centered disk with horizontal strip below */
.splash-film-reel-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin-bottom: clamp(16px, 3.5vh, 24px);
    transform: translateY(-15px);
    width: 100%;
    max-width: 420px;
    user-select: none;
    -webkit-user-select: none;
    overflow: visible;
}

.reel-stage-flex {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    width: 100%;
    height: clamp(100px, 17vh, 135px);
    margin-bottom: 4px;
}

.reel-glow-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(110px, 26vw, 150px);
    height: clamp(110px, 26vw, 150px);
    border-radius: 50%;
    background: radial-gradient(circle, var(--halo-color) 0%, rgba(0,0,0,0) 70%);
    filter: blur(18px);
    -webkit-filter: blur(18px);
    z-index: 1;
    animation: pulseHalo 3.5s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes pulseHalo {
    0% { transform: scale(0.9); opacity: 0.5; }
    100% { transform: scale(1.25); opacity: 0.9; }
}

/* 3D Film Reel Spool - Centered */
.splash-film-reel-wrap {
    position: relative;
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 800px;
    -webkit-perspective: 800px;
    margin: 0 auto;
    flex-shrink: 0;
}

.reel-spool-disc {
    width: clamp(120px, 32vw, 150px);
    height: clamp(120px, 32vw, 150px);
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 8px 18px rgba(0,0,0,0.85));
    -webkit-filter: drop-shadow(0 8px 18px rgba(0,0,0,0.85));
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    will-change: transform;
}

.reel-spool-disc.rotating {
    animation: spinFilmReel 7s linear infinite;
}

@keyframes spinFilmReel {
    0% {
        transform: rotate3d(0, 0, 1, 0deg);
    }
    100% {
        transform: rotate3d(0, 0, 1, 360deg);
    }
}

.reel-svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Horizontal Film Strip - scrolls right-to-left entering the disk */
.splash-film-strip-wrapper.horizontal-strip {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    z-index: 3;
    padding: 4px 0;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, transparent 50%, black 50%, black 95%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, transparent 50%, black 50%, black 95%, transparent 100%);
}

/* Legacy diagonal wrapper (hidden, not used) */
.splash-film-strip-wrapper.diagonal-top-right {
    display: none;
}


.splash-film-strip-track {
    display: flex;
    gap: clamp(3px, 1vw, 6px);
    width: max-content;
    animation: flowFilmFrames 30s linear infinite;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

@keyframes flowFilmFrames {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

/* Individual Film Frame (Pure Clean Celluloid Frame) */
.film-frame-card {
    width: clamp(55px, 14vw, 80px);
    height: clamp(55px, 14vw, 78px);
    background: #0d0d12;
    border: 1px solid var(--strip-border);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0,0,0,0.7);
    flex-shrink: 0;
    padding: 2px 2px;
    box-sizing: border-box;
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.25s ease;
}

.film-frame-card:hover {
    transform: scale(1.08);
    border-color: #00ffcc;
}

/* Sprocket Perforations */
.sprocket-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1px 3px;
    height: 4px;
}

.sprocket-row span {
    display: block;
    width: 3.5px;
    height: 2px;
    background: #ffffff;
    opacity: 0.85;
    border-radius: 0.5px;
}

/* Inside Frame Screen */
.frame-screen {
    flex: 1;
    background: radial-gradient(circle at center, #1b1c28 0%, #101118 100%);
    border-radius: 2.5px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.frame-art {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.frame-art svg {
    display: none; /* Hide old SVGs if any */
}

.negative-human-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    filter: invert(1) hue-rotate(180deg) brightness(1.2) contrast(1.1);
    opacity: 0.9;
    z-index: 1;
}

.frame-text {
    font-size: clamp(0.35rem, 0.75vw, 0.45rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    opacity: 0.95;
    position: relative;
    z-index: 2;
    background: rgba(0, 0, 0, 0.6);
    padding: 1px 3px;
    border-radius: 2px;
}

/* Role Camera Action Badge right below the Film Reel Wheel */
.reel-caption-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(4px, 1.5vw, 8px);
    margin-top: clamp(2px, 0.8vh, 6px);
    margin-bottom: clamp(2px, 0.8vh, 6px);
    padding: 3px clamp(8px, 2.5vw, 14px);
    background: rgba(18, 18, 24, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.5);
    font-size: clamp(0.62rem, 2.2vw, 0.72rem);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    animation: fadeInReelBadge 0.8s ease forwards 0.3s;
    opacity: 0;
}

@keyframes fadeInReelBadge {
    0% {
        opacity: 0;
        transform: translateY(6px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.rca-role {
    color: #fedcd2;
    text-shadow: 0 0 10px rgba(240, 154, 136, 0.6);
}

.rca-camera {
    color: #fbd561;
    text-shadow: 0 0 10px rgba(251, 213, 97, 0.6);
}

.rca-action {
    color: #ff0050;
    font-weight: 800;
    text-shadow: 0 0 12px rgba(255, 0, 80, 0.75);
}

.rca-dot {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.55rem;
}

/* VIROL Logo with Animated Cross-Browser Cinematic Liquid Glow */
.splash-logo {
    font-size: clamp(2.4rem, 8.5vw, 3.8rem);
    font-weight: 900;
    letter-spacing: clamp(3px, 1.2vw, 6px);
    margin-bottom: clamp(4px, 1.2vh, 8px);
    display: flex;
    justify-content: center;
    align-items: center;
    filter: drop-shadow(0 0 25px rgba(255, 0, 80, 0.45)) drop-shadow(0 0 12px rgba(0, 242, 254, 0.4));
    -webkit-filter: drop-shadow(0 0 25px rgba(255, 0, 80, 0.45)) drop-shadow(0 0 12px rgba(0, 242, 254, 0.4));
    user-select: none;
    -webkit-user-select: none;
}

/* Letters Flying from Different Directions - Multi-Browser Fallback */
.splash-char {
    display: inline-block;
    opacity: 0;
    color: #ffffff; /* Fallback for browsers without background-clip: text */
    background: linear-gradient(125deg, #ff0050 0%, #00f2fe 50%, #a855f7 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation-duration: 1.0s;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
    animation-fill-mode: forwards;
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* V - Flies from Top-Left */
.char-v {
    background: linear-gradient(135deg, #ff0050 0%, #ff416c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation-name: flyInTopLeft;
    animation-delay: 0.12s;
}
@keyframes flyInTopLeft {
    0% {
        opacity: 0;
        transform: translate3d(-100px, -90px, 0) rotate(-40deg) scale(0.25);
    }
    70% {
        opacity: 1;
        transform: translate3d(4px, 3px, 0) rotate(5deg) scale(1.12);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    }
}

/* I - Flies from Top-Right */
.char-i {
    background: linear-gradient(135deg, #ff416c 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation-name: flyInTopRight;
    animation-delay: 0.28s;
}
@keyframes flyInTopRight {
    0% {
        opacity: 0;
        transform: translate3d(80px, -110px, 0) rotate(35deg) scale(0.25);
    }
    70% {
        opacity: 1;
        transform: translate3d(-3px, 4px, 0) rotate(-4deg) scale(1.12);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    }
}

/* R - Drops In from Bottom Center */
.char-r {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation-name: flyInBottom;
    animation-delay: 0.45s;
}
@keyframes flyInBottom {
    0% {
        opacity: 0;
        transform: translate3d(0, 110px, 0) rotate(-20deg) scale(0.25);
    }
    70% {
        opacity: 1;
        transform: translate3d(0, -6px, 0) rotate(3deg) scale(1.12);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    }
}

/* O - Flies from Bottom-Left */
.char-o,
.char-a {
    background: linear-gradient(135deg, #4facfe 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation-name: flyInBottomLeft;
    animation-delay: 0.62s;
}
@keyframes flyInBottomLeft {
    0% {
        opacity: 0;
        transform: translate3d(-90px, 100px, 0) rotate(30deg) scale(0.25);
    }
    70% {
        opacity: 1;
        transform: translate3d(4px, -4px, 0) rotate(-3deg) scale(1.12);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    }
}

/* L - Flies from Far-Right */
.char-l {
    background: linear-gradient(135deg, #a855f7 0%, #ff0050 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation-name: flyInRight;
    animation-delay: 0.80s;
}
@keyframes flyInRight {
    0% {
        opacity: 0;
        transform: translate3d(110px, 40px, 0) rotate(-35deg) scale(0.25);
    }
    70% {
        opacity: 1;
        transform: translate3d(-5px, -3px, 0) rotate(4deg) scale(1.12);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    }
}

/* Sequential Tagline Words Animation (Paced gracefully across 3.5s sequence) */
.splash-tagline {
    font-size: clamp(0.85rem, 3.2vw, 1.15rem);
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: clamp(12px, 2.5vh, 26px);
    display: flex;
    gap: clamp(5px, 1.5vw, 8px);
    justify-content: center;
    align-items: center;
    letter-spacing: 0.5px;
}

.tag-word {
    display: inline-block;
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInWord 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.tag-word.tag-1 {
    animation-delay: 1.15s;
    color: #ffffff;
    font-weight: 500;
}

.tag-word.tag-2 {
    animation-delay: 1.60s;
    color: #00f2fe;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
}

.tag-word.tag-3 {
    animation-delay: 2.05s;
    color: #ff0050;
    font-weight: 800;
    text-shadow: 0 0 14px rgba(255, 0, 80, 0.7);
    letter-spacing: 0.8px;
}

@keyframes slideInWord {
    0% {
        opacity: 0;
        transform: translateX(-25px) scale(0.88);
    }
    70% {
        opacity: 1;
        transform: translateX(3px) scale(1.04);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Ambient Pulse Glow Behind Logo */
.splash-content::before {
    content: '';
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(140px, 35vw, 220px);
    height: clamp(80px, 20vh, 130px);
    background: radial-gradient(circle, rgba(255, 0, 80, 0.22) 0%, rgba(0, 242, 254, 0.12) 50%, transparent 70%);
    filter: blur(20px);
    -webkit-filter: blur(20px);
    z-index: -1;
    animation: pulseGlow 3.5s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes pulseGlow {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.9; }
}

/* Loader */
.loader {
    width: clamp(26px, 5.5vw, 34px);
    height: clamp(26px, 5.5vw, 34px);
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    border-top-color: #ff0050;
    border-right-color: #00f2fe;
    margin-bottom: clamp(6px, 1.4vh, 12px);
    opacity: 0;
    animation: fadeInLoader 0.5s ease forwards 1.0s, spinLoader 0.9s linear infinite 1.0s;
}

@keyframes spinLoader {
    to { transform: rotate(360deg); }
}

@keyframes fadeInLoader {
    to { opacity: 1; }
}

.splash-status {
    font-size: clamp(0.74rem, 2.5vw, 0.85rem);
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.4px;
    opacity: 0;
    animation: fadeInStatus 0.5s ease forwards 1.2s;
}

@keyframes fadeInStatus {
    to { opacity: 1; }
}

/* Bottom Creator & Copyright Tag - Flexible Natural Bottom Attachment */
.splash-copyright {
    flex-shrink: 0;
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 0 2px;
    margin-top: auto;
    margin-bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 14px));
    background: transparent;
    border: none;
    z-index: 10;
    opacity: 0;
    animation: fadeInCopyright 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards 1.0s;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
    text-align: center;
}

@keyframes fadeInCopyright {
    0% {
        opacity: 0;
        transform: translate3d(0, 10px, 0);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.splash-copyright .copyright-brand {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(0.82rem, 2.8vw, 0.95rem);
    font-weight: 800;
    letter-spacing: 0.9px;
    line-height: 1.3;
    display: inline-block;
    color: #ffffff; /* Fallback */
    background: linear-gradient(125deg, #ff0050 0%, #00f2fe 25%, #a855f7 50%, #ff2b54 75%, #00f2fe 100%);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textWaveGradient 4s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.45)) drop-shadow(0 0 16px rgba(255, 0, 80, 0.35));
    -webkit-filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.45)) drop-shadow(0 0 16px rgba(255, 0, 80, 0.35));
}

@keyframes textWaveGradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.splash-copyright .copyright-rights {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(0.64rem, 2.2vw, 0.72rem);
    font-weight: 500;
    letter-spacing: 0.5px;
    line-height: 1.3;
    display: block;
    color: rgba(255, 255, 255, 0.4);
    text-shadow: none;
}

/* Splash Error State */
.splash-error {
    text-align: center;
    padding: 20px;
}

.splash-error h2 {
    color: var(--accent-color);
    margin-bottom: 12px;
}

.splash-error p {
    color: var(--text-muted);
    line-height: 1.5;
}

/* --- ADAPTIVE COMPACT & SHORT SCREENS (e.g. Small phones, landscape mode, split screens) --- */
@media (max-height: 620px) {
    #splash-screen {
        padding: 8px 12px;
    }
    .splash-film-reel-stage {
        margin-bottom: 4px;
    }
    .reel-spool-disc {
        width: 105px;
        height: 105px;
    }
    .splash-film-strip-wrapper.horizontal-strip {
        margin-top: 4px;
    }
    .film-frame-card {
        width: 65px;
        height: 65px;
    }
    .splash-logo {
        font-size: 2.2rem;
        margin-bottom: 2px;
    }
    .splash-tagline {
        font-size: 0.82rem;
        margin-bottom: 10px;
    }
    .loader {
        width: 22px;
        height: 22px;
        margin-bottom: 4px;
    }
    .splash-status {
        font-size: 0.7rem;
    }
    .splash-copyright {
        padding: 4px 0 0;
    }
}

/* --- ADAPTIVE MOBILE WIDTHS (Phones) --- */
@media (max-width: 768px) {
    .splash-film-reel-wrap {
        transform: translateX(-20vw);
    }
    .splash-film-strip-wrapper.horizontal-strip {
        -webkit-mask-image: linear-gradient(to right, transparent 0%, transparent 25%, black 30%, black 95%, transparent 100%);
        mask-image: linear-gradient(to right, transparent 0%, transparent 25%, black 30%, black 95%, transparent 100%);
    }
}

/* Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
    .splash-char, .tag-word, .loader, .reel-caption-badge, .splash-copyright {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .reel-spool-disc {
        animation: none !important;
    }
    .splash-film-strip-track {
        animation: none !important;
    }
}
