body,
html {
    height: 100%;
    /* Ensure html and body take full height */
    margin: 0;
    padding: 0;
    background-color: #0c0c0d;
    /* Very dark charcoal background */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    display: flex;
    /* Added to center the loading-container if it's the only direct child */
    justify-content: center;
    /* Added */
    align-items: center;
    /* Added */
    overflow: hidden;
    /* Prevent scrollbars from particle overflow */
}

.loading-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: fixed;
    /* Or absolute if body is the main flex container */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: transparent;
    /* Make container transparent to see body bg */
    z-index: 9999;
    transition: opacity 0.8s ease-in-out;
    /* Smoother and slightly longer fade-out */
}

/* Enhanced Star Dust & Shooting Stars Background */
.star-dust-bg {
    position: fixed;
    /* Changed from absolute to fixed to ensure it covers viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    /* Adjusted z-index: behind .loading-container, but visible on body */
}

.star-dust-bg .star {
    position: absolute;
    background-color: rgba(220, 225, 230, 0.65);
    /* Even brighter base for stars */
    border-radius: 50%;
    animation: twinkle 3.5s infinite ease-in-out;
    /* Slightly faster twinkle */
    /* Ensure no other transform is accidentally inherited or applied here that causes panning */
}

/* Star definitions */
.star-dust-bg .star:nth-child(1) {
    width: 1px;
    height: 1px;
    top: 20%;
    left: 30%;
    animation-delay: -0.1s;
}

.star-dust-bg .star:nth-child(2) {
    width: 2px;
    height: 2px;
    top: 50%;
    left: 70%;
    animation-delay: -0.6s;
}

.star-dust-bg .star:nth-child(3) {
    width: 1px;
    height: 1px;
    top: 80%;
    left: 10%;
    animation-delay: -1.1s;
}

.star-dust-bg .star:nth-child(4) {
    width: 2px;
    height: 2px;
    top: 10%;
    left: 80%;
    animation-delay: -1.6s;
}

.star-dust-bg .star:nth-child(5) {
    width: 1px;
    height: 1px;
    top: 35%;
    left: 55%;
    animation-delay: -2.1s;
}

.star-dust-bg .star:nth-child(6) {
    width: 2px;
    height: 2px;
    top: 65%;
    left: 20%;
    animation-delay: -2.6s;
}

.star-dust-bg .star:nth-child(7) {
    width: 1px;
    height: 1px;
    top: 90%;
    left: 90%;
    animation-delay: -3.1s;
}

.star-dust-bg .star:nth-child(8) {
    width: 3px;
    height: 3px;
    top: 5%;
    left: 45%;
    animation-delay: -3.6s;
}

.star-dust-bg .star:nth-child(9) {
    width: 1px;
    height: 1px;
    top: 40%;
    left: 5%;
    animation-delay: -0.3s;
}

.star-dust-bg .star:nth-child(10) {
    width: 2px;
    height: 2px;
    top: 75%;
    left: 85%;
    animation-delay: -0.8s;
}

.star-dust-bg .star:nth-child(11) {
    width: 1px;
    height: 1px;
    top: 25%;
    left: 65%;
    animation-delay: -1.3s;
}

.star-dust-bg .star:nth-child(12) {
    width: 2px;
    height: 2px;
    top: 55%;
    left: 35%;
    animation-delay: -1.8s;
}

.star-dust-bg .star:nth-child(13) {
    width: 1px;
    height: 1px;
    top: 85%;
    left: 75%;
    animation-delay: -2.3s;
}

.star-dust-bg .star:nth-child(14) {
    width: 2px;
    height: 2px;
    top: 15%;
    left: 15%;
    animation-delay: -2.8s;
}

.star-dust-bg .star:nth-child(15) {
    width: 1px;
    height: 1px;
    top: 45%;
    left: 95%;
    animation-delay: -3.3s;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.6);
    }
}

.shooting-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    filter: drop-shadow(0 0 6px white);
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    opacity: 0;
}

.shooting-star::after {
    content: '';
    position: absolute;
    top: calc(50% - 0.5px);
    left: 1px;
    width: 0px;
    height: 1px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 100%);
    transform-origin: left center;
    border-radius: 1px;
}

.ss1 {
    animation-name: shoot-path1, tail-animate1;
    animation-duration: 3s, 3s;
    animation-delay: 1.5s, 1.5s;
}

.ss2 {
    animation-name: shoot-path2, tail-animate2;
    animation-duration: 2.5s, 2.5s;
    animation-delay: 5s, 5s;
}

.ss3 {
    animation-name: shoot-path3, tail-animate3;
    animation-duration: 3.2s, 3.2s;
    animation-delay: 8s, 8s;
}

/* Calculated angles: atan2(dy, dx) * 180 / PI */
/* Path 1: dx=140, dy=60. Angle = atan2(60, 140) * 180 / PI = 23.2 degrees */
@keyframes shoot-path1 {
    0% {
        transform: translate(-20vw, 5vh) rotate(23.2deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translate(120vw, 65vh) rotate(23.2deg);
        opacity: 0;
    }
}

/* Path 2: dx=140, dy=70. Angle = atan2(70, 140) * 180 / PI = 26.6 degrees */
@keyframes shoot-path2 {
    0% {
        transform: translate(-20vw, 25vh) rotate(26.6deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translate(120vw, 95vh) rotate(26.6deg);
        opacity: 0;
    }
}

/* Path 3: dx=140, dy=-40. Angle = atan2(-40, 140) * 180 / PI = -15.9 degrees */
@keyframes shoot-path3 {
    0% {
        transform: translate(-20vw, 55vh) rotate(-15.9deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translate(120vw, 15vh) rotate(-15.9deg);
        opacity: 0;
    }
}

@keyframes tail-animate1 {

    0%,
    10% {
        width: 0px;
        opacity: 0;
    }

    15% {
        width: 80px;
        opacity: 0.7;
    }

    85% {
        width: 80px;
        opacity: 0.7;
    }

    100% {
        width: 0px;
        opacity: 0;
    }
}

@keyframes tail-animate2 {

    0%,
    10% {
        width: 0px;
        opacity: 0;
    }

    15% {
        width: 60px;
        opacity: 0.7;
    }

    85% {
        width: 60px;
        opacity: 0.7;
    }

    100% {
        width: 0px;
        opacity: 0;
    }
}

@keyframes tail-animate3 {

    0%,
    10% {
        width: 0px;
        opacity: 0;
    }

    15% {
        width: 100px;
        opacity: 0.7;
    }

    85% {
        width: 100px;
        opacity: 0.7;
    }

    100% {
        width: 0px;
        opacity: 0;
    }
}

/* Converging Particle Stream & Progress Core */
.particle-converge-loader {
    position: relative;
    width: 180px;
    height: 180px;
    margin-bottom: 30px;
}

.particle-converge-loader .particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background: radial-gradient(circle, rgba(121, 188, 255, 0.95) 0%, rgba(79, 195, 247, 0.75) 40%, rgba(79, 195, 247, 0) 75%);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(79, 195, 247, 0.6), 0 0 12px rgba(79, 195, 247, 0.5);
    opacity: 0.15;
}

.particle-converge-loader .p1 {
    top: 0;
    left: 50%;
    animation: converge_loop_optimized1 3.2s 0s ease-in-out infinite;
}

.particle-converge-loader .p2 {
    top: 50%;
    left: 0;
    animation: converge_loop_optimized2 3.0s 0.2s ease-in-out infinite;
}

.particle-converge-loader .p3 {
    top: 100%;
    left: 50%;
    animation: converge_loop_optimized3 3.2s 0.4s ease-in-out infinite;
}

.particle-converge-loader .p4 {
    top: 50%;
    left: 100%;
    animation: converge_loop_optimized4 3.0s 0.6s ease-in-out infinite;
}

.particle-converge-loader .p5 {
    top: 15%;
    left: 15%;
    animation: converge_loop_optimized5 3.1s 0.1s ease-in-out infinite;
}

.particle-converge-loader .p6 {
    top: 85%;
    left: 85%;
    animation: converge_loop_optimized6 3.3s 0.3s ease-in-out infinite;
}

.particle-converge-loader .p7 {
    top: 15%;
    left: 85%;
    animation: converge_loop_optimized7 3.1s 0.5s ease-in-out infinite;
}

.particle-converge-loader .p8 {
    top: 85%;
    left: 15%;
    animation: converge_loop_optimized8 3.3s 0.7s ease-in-out infinite;
}

@keyframes converge_loop_optimized1 {

    0%,
    100% {
        opacity: 0.2;
        transform: translate(-50%, -70px) scale(0.6);
        box-shadow: 0 0 3px rgba(79, 195, 247, 0.3), 0 0 5px rgba(79, 195, 247, 0.2);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, 0px) scale(1.3);
        box-shadow: 0 0 10px #4FC3F7, 0 0 20px #4FC3F7, 0 0 30px rgba(79, 195, 247, 0.5);
    }
}

@keyframes converge_loop_optimized2 {

    0%,
    100% {
        opacity: 0.2;
        transform: translate(-70px, -50%) scale(0.6);
        box-shadow: 0 0 3px rgba(79, 195, 247, 0.3), 0 0 5px rgba(79, 195, 247, 0.2);
    }

    50% {
        opacity: 1;
        transform: translate(0px, -50%) scale(1.3);
        box-shadow: 0 0 10px #4FC3F7, 0 0 20px #4FC3F7, 0 0 30px rgba(79, 195, 247, 0.5);
    }
}

@keyframes converge_loop_optimized3 {

    0%,
    100% {
        opacity: 0.2;
        transform: translate(-50%, 70px) scale(0.6);
        box-shadow: 0 0 3px rgba(79, 195, 247, 0.3), 0 0 5px rgba(79, 195, 247, 0.2);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, 0px) scale(1.3);
        box-shadow: 0 0 10px #4FC3F7, 0 0 20px #4FC3F7, 0 0 30px rgba(79, 195, 247, 0.5);
    }
}

@keyframes converge_loop_optimized4 {

    0%,
    100% {
        opacity: 0.2;
        transform: translate(70px, -50%) scale(0.6);
        box-shadow: 0 0 3px rgba(79, 195, 247, 0.3), 0 0 5px rgba(79, 195, 247, 0.2);
    }

    50% {
        opacity: 1;
        transform: translate(0px, -50%) scale(1.3);
        box-shadow: 0 0 10px #4FC3F7, 0 0 20px #4FC3F7, 0 0 30px rgba(79, 195, 247, 0.5);
    }
}

@keyframes converge_loop_optimized5 {

    0%,
    100% {
        opacity: 0.2;
        transform: translate(-60px, -60px) scale(0.6);
        box-shadow: 0 0 3px rgba(79, 195, 247, 0.3), 0 0 5px rgba(79, 195, 247, 0.2);
    }

    50% {
        opacity: 1;
        transform: translate(0, 0) scale(1.3);
        box-shadow: 0 0 10px #4FC3F7, 0 0 20px #4FC3F7, 0 0 30px rgba(79, 195, 247, 0.5);
    }
}

@keyframes converge_loop_optimized6 {

    0%,
    100% {
        opacity: 0.2;
        transform: translate(60px, 60px) scale(0.6);
        box-shadow: 0 0 3px rgba(79, 195, 247, 0.3), 0 0 5px rgba(79, 195, 247, 0.2);
    }

    50% {
        opacity: 1;
        transform: translate(0, 0) scale(1.3);
        box-shadow: 0 0 10px #4FC3F7, 0 0 20px #4FC3F7, 0 0 30px rgba(79, 195, 247, 0.5);
    }
}

@keyframes converge_loop_optimized7 {

    0%,
    100% {
        opacity: 0.2;
        transform: translate(60px, -60px) scale(0.6);
        box-shadow: 0 0 3px rgba(79, 195, 247, 0.3), 0 0 5px rgba(79, 195, 247, 0.2);
    }

    50% {
        opacity: 1;
        transform: translate(0, 0) scale(1.3);
        box-shadow: 0 0 10px #4FC3F7, 0 0 20px #4FC3F7, 0 0 30px rgba(79, 195, 247, 0.5);
    }
}

@keyframes converge_loop_optimized8 {

    0%,
    100% {
        opacity: 0.2;
        transform: translate(-60px, 60px) scale(0.6);
        box-shadow: 0 0 3px rgba(79, 195, 247, 0.3), 0 0 5px rgba(79, 195, 247, 0.2);
    }

    50% {
        opacity: 1;
        transform: translate(0, 0) scale(1.3);
        box-shadow: 0 0 10px #4FC3F7, 0 0 20px #4FC3F7, 0 0 30px rgba(79, 195, 247, 0.5);
    }
}

.progress-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background-color: rgba(121, 188, 255, 0.3);
    border-radius: 50%;
    opacity: 0.1;
    box-shadow: 0 0 10px rgba(121, 188, 255, 0.2), 0 0 15px rgba(121, 188, 255, 0.1);
    transform-origin: center center;
    animation: core-evolve 7s 0.5s ease-out forwards;
}

@keyframes core-evolve {
    0% {
        transform: translate(-50%, -50%) scale(0.2);
        opacity: 0.2;
        background-color: rgba(121, 188, 255, 0.3);
        box-shadow: 0 0 10px rgba(121, 188, 255, 0.2), 0 0 15px rgba(121, 188, 255, 0.1);
    }

    30% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.7;
        background-color: rgba(150, 200, 255, 0.7);
    }

    70% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
        width: 22px;
        height: 22px;
        background-color: rgba(173, 216, 230, 1);
        box-shadow: 0 0 20px rgba(173, 216, 230, 0.8), 0 0 35px rgba(173, 216, 230, 0.7);
    }

    100% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
        width: 20px;
        height: 20px;
        background-color: rgba(200, 230, 255, 1);
        box-shadow: 0 0 30px rgba(200, 230, 255, 0.9), 0 0 60px rgba(200, 230, 255, 0.8);
    }
}

.loading-text {
    font-size: 17px;
    color: rgba(200, 210, 220, 0.75);
    font-weight: 300;
    letter-spacing: 1px;
    margin-top: 20px;
    /* This was margin-top: 20px in original inline style, ensure it matches the loader structure */
    opacity: 0;
    animation: fadeInText 1s 2.8s ease-out forwards, subtleTextPulseEnhanced 2s 3.8s ease-in-out infinite;
    z-index: 1;
    position: relative;
}

@keyframes fadeInText {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes subtleTextPulseEnhanced {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.03);
    }
}

/* Styles for the simple spinner and message - kept in case, but not used by the primary loading animation */
/*
#loading_indicator {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.spinner {
    border: 5px solid #e0e0e0;
    border-top: 5px solid #3B82F6;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
#loading_message {
    color: #333;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
}
*/
/* ===== New Minimal Theme (sync with app's black/white style) ===== */
html,
body {
    background: #ffffff;
    color: #111111;
}

/* Subtle grid background */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.02) 0, rgba(0, 0, 0, 0.02) 2px, transparent 2px) 0 0/24px 24px,
        linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
}

/* Soft sheen sweep */
.bg-sheen {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(115deg,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0) 40%,
            rgba(0, 0, 0, 0.04) 50%,
            rgba(0, 0, 0, 0) 60%,
            rgba(0, 0, 0, 0) 100%);
    transform: translateX(-100%);
    animation: sheenMove 7s ease-in-out infinite;
}

@keyframes sheenMove {

    0%,
    10% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(0%);
    }

    90%,
    100% {
        transform: translateX(100%);
    }
}

/* Centered loader container with smooth fade-out */
.loading-container {
    z-index: 2;
    transition: opacity 0.8s ease-in-out;
}

/* Brand mark & title */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.brand .logo-mark {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #111111;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06);
}

.brand .title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: #111111;
    animation: titleFloat 4s ease-in-out infinite;
}

@keyframes titleFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-2px);
    }
}

/* Ripple animation */
.ripple {
    position: relative;
    width: 180px;
    height: 180px;
}

.ripple span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    border: 2px solid rgba(0, 0, 0, 0.9);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.18;
    animation: ripplePulse 1.8s ease-out infinite;
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.08);
}

.ripple span:nth-child(2) {
    animation-delay: 0.3s;
}

.ripple span:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes ripplePulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.22;
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.08);
    }

    60% {
        opacity: 0.08;
    }

    100% {
        transform: translate(-50%, -50%) scale(2.4);
        opacity: 0;
        box-shadow: 0 0 0 30px rgba(0, 0, 0, 0);
    }
}

/* Slow rotating ultra-thin orbit */
.orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 220px;
    height: 220px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03) inset;
    animation: orbitSpin 12s linear infinite;
}

@keyframes orbitSpin {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.loading-text {
    margin-top: 16px;
    font-size: 14px;
    color: #4b5563;
    letter-spacing: 0.2px;
}

/* Accessibility: reduce animations when user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ripple span {
        animation: none !important;
        opacity: 0.3;
    }

    .bg-sheen {
        animation: none !important;
    }

    .brand .title {
        animation: none !important;
    }

    .orbit {
        animation: none !important;
    }
}