body {
    padding: 0;
    margin: 0;
    overflow: hidden;
    background: #000000;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(147, 51, 234, 0.3) 10%, transparent 60%);
    transform: translate(-50%, -50%);
    z-index: -3;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background:
            linear-gradient(0deg, transparent 24%, rgba(147, 51, 234, 0.08) 25%, rgba(147, 51, 234, 0.08) 26%, transparent 27%, transparent 74%, rgba(147, 51, 234, 0.08) 75%, rgba(147, 51, 234, 0.08) 76%, transparent 77%, transparent),
            linear-gradient(90deg, transparent 24%, rgba(147, 51, 234, 0.08) 25%, rgba(147, 51, 234, 0.08) 26%, transparent 27%, transparent 74%, rgba(147, 51, 234, 0.08) 75%, rgba(147, 51, 234, 0.08) 76%, transparent 77%, transparent);
    background-size: 40px 40px, 40px 40px;
    z-index: -2;
    pointer-events: none;
}

#unity-container {
    position: fixed;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#unity-container::before {
    content: '';
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background-image:
            radial-gradient(2px 2px at 20% 30%, rgba(147, 51, 234, 0.6), transparent),
            radial-gradient(2px 2px at 60% 70%, rgba(196, 61, 255, 0.5), transparent),
            radial-gradient(1px 1px at 90% 10%, rgba(255, 255, 255, 0.4), transparent),
            radial-gradient(1px 1px at 15% 80%, rgba(147, 51, 234, 0.5), transparent),
            radial-gradient(2px 2px at 45% 45%, rgba(236, 72, 153, 0.4), transparent);
    background-size: 400px 400px;
    animation: stars-slow 200s linear infinite;
    z-index: -1;
    pointer-events: none;
}

#unity-container::after {
    content: '';
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background-image:
            radial-gradient(3px 3px at 30% 50%, rgba(196, 61, 255, 0.7), transparent),
            radial-gradient(2px 2px at 70% 20%, rgba(147, 51, 234, 0.6), transparent),
            radial-gradient(2px 2px at 10% 90%, rgba(255, 255, 255, 0.5), transparent),
            radial-gradient(3px 3px at 80% 60%, rgba(59, 130, 246, 0.5), transparent);
    background-size: 600px 600px;
    animation: stars-fast 100s linear infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes stars-slow {
    0% { transform: translateY(0); }
    100% { transform: translateY(-400px); }
}

@keyframes stars-fast {
    0% { transform: translateY(0); }
    100% { transform: translateY(-600px); }
}

#unity-canvas {
    position: absolute;
    background: transparent;
    display: block;
}

#unity-loading-bar {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: none;
    text-align: center;
    width: 100%;
}

#unity-logo {
    display: none;
}

#unity-loading-bar::before {
    content: '';
    display: block;
    width: 512px;
    height: 296px;
    margin: 0 auto 50px;
    background: url('game-logo.png') no-repeat center;
    background-size: contain;
    filter: brightness(1.2) drop-shadow(0 0 30px rgba(147, 51, 234, 0.6));
}

#unity-progress-bar-empty {
    width: 400px;
    height: 40px;
    margin: 0 auto 30px;
    position: relative;
    background: rgba(147, 51, 234, 0.15);
    border: 2px solid rgba(147, 51, 234, 0.3);
    border-radius: 25px;
    overflow: hidden;
    box-shadow:
            inset 0 2px 4px rgba(0, 0, 0, 0.3),
            0 0 20px rgba(147, 51, 234, 0.2);
}

#unity-progress-bar-full {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg,
    rgba(147, 51, 234, 0.8) 0%,
    rgba(196, 61, 255, 0.9) 50%,
    rgba(147, 51, 234, 0.8) 100%);
    border-radius: 23px;
    position: relative;
    transition: width 0.1s ease-out;
    box-shadow:
            0 0 15px rgba(196, 61, 255, 0.8),
            inset 0 -2px 4px rgba(0, 0, 0, 0.2),
            inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

#unity-progress-bar-full::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: radial-gradient(circle,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(196, 61, 255, 0.6) 40%,
    transparent 70%);
    border-radius: 50%;
    filter: blur(2px);
}

#unity-warning {
    position: absolute;
    left: 50%;
    top: 5%;
    transform: translate(-50%);
    background: rgba(147, 51, 234, 0.95);
    border: 2px solid rgba(196, 61, 255, 0.8);
    border-radius: 12px;
    padding: 12px 24px;
    display: none;
    color: white;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(147, 51, 234, 0.4);
    backdrop-filter: blur(8px);
}

#unity-logo {
    background: none !important;
}

.loading-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Poetsen One', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
}

.loading-text {
    position: relative;
    top: 0;
    left: 0;
    transform: none;
    margin-top: 20px;
    color: rgba(147, 51, 234, 0.9);
    font-family: 'Poetsen One', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    text-shadow: 0 0 20px rgba(147, 51, 234, 0.6);
}

.loading-text::after {
    content: '';
    animation: loading-dots 2s infinite;
    display: inline;
}

@keyframes loading-dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

.idle-animation {
    position: relative;
    top: 0;
    left: 0;
    transform: none;
    width: auto;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: -60px 0 20px 0;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: rgba(147, 51, 234, 0.6);
    border-radius: 50%;
    animation: pulse-wave 2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(147, 51, 234, 0.4);
}

.pulse-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.pulse-dot:nth-child(3) {
    animation-delay: 0.4s;
}

.pulse-dot:nth-child(4) {
    animation-delay: 0.6s;
}

.pulse-dot:nth-child(5) {
    animation-delay: 0.8s;
}

@keyframes pulse-wave {
    0%, 100% {
        transform: scale(1);
        background: rgba(147, 51, 234, 0.6);
        box-shadow: 0 0 10px rgba(147, 51, 234, 0.4);
    }
    50% {
        transform: scale(1.5);
        background: rgba(196, 61, 255, 0.9);
        box-shadow: 0 0 20px rgba(196, 61, 255, 0.8);
    }
}

.floating-particles {
    position: absolute;
    top: calc(50% - 50px);
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 300px;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(147, 51, 234, 0.4);
    border-radius: 50%;
    animation: float-up 4s linear infinite;
}

.particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 3s;
}

.particle:nth-child(2) {
    left: 30%;
    animation-delay: 1s;
    animation-duration: 4s;
}

.particle:nth-child(3) {
    left: 50%;
    animation-delay: 2s;
    animation-duration: 3.5s;
}

.particle:nth-child(4) {
    left: 70%;
    animation-delay: 0.5s;
    animation-duration: 4.5s;
}

.particle:nth-child(5) {
    left: 90%;
    animation-delay: 1.5s;
    animation-duration: 3.2s;
}

@keyframes float-up {
    0% {
        bottom: -10px;
        opacity: 0;
        transform: translateX(0);
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        bottom: 310px;
        opacity: 0;
        transform: translateX(20px);
    }
}

.loading-size {
    position: relative;
    top: 0;
    left: 0;
    transform: none;
    margin-top: 15px;
    color: rgba(147, 51, 234, 0.9);
    font-family: 'Poetsen One', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    transition: color 0.2s ease, text-shadow 0.2s ease;
    line-height: 1.4;
}

.loading-size.updated {
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 0 12px rgba(147, 51, 234, 0.8);
}

.loading-size .size-loaded {
    color: rgba(196, 61, 255, 0.9);
    font-weight: 600;
    font-family: 'Poetsen One', 'Courier New', monospace;
}

.loading-size .size-separator {
    color: rgba(147, 51, 234, 0.7);
    margin: 0 2px;
}

.loading-size .size-total {
    color: rgba(147, 51, 234, 0.8);
    font-family: 'Poetsen One', 'Courier New', monospace;
}

.loading-size .size-percentage {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    margin-left: 8px;
    text-shadow: 0 0 8px rgba(147, 51, 234, 0.6);
}

/* QR Scanner Overlay Styles */
#qr-video {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    object-fit: cover !important;
    z-index: 1000 !important;
    background: rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: blur(2px) !important;
    pointer-events: auto !important;
    display: none;
}

#qr-video.active {
    display: block !important;
}

/* QR Scanner Frame Overlay */
#qr-video::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 280px;
    border: 3px solid rgba(147, 51, 234, 0.8);
    border-radius: 20px;
    box-shadow:
            0 0 0 9999px rgba(0, 0, 0, 0.6),
            inset 0 0 20px rgba(147, 51, 234, 0.3),
            0 0 30px rgba(147, 51, 234, 0.5);
    pointer-events: none;
    z-index: 1001;
}

/* Corner indicators for QR frame */
#qr-video::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background-image:
            linear-gradient(to right, rgba(147, 51, 234, 0.9) 0%, transparent 20%),
            linear-gradient(to left, rgba(147, 51, 234, 0.9) 0%, transparent 20%),
            linear-gradient(to bottom, rgba(147, 51, 234, 0.9) 0%, transparent 20%),
            linear-gradient(to top, rgba(147, 51, 234, 0.9) 0%, transparent 20%);
    background-size: 40px 6px, 40px 6px, 6px 40px, 6px 40px;
    background-position:
            top left, top right,
            top left, bottom left,
            bottom left, bottom right,
            top right, bottom right;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 1001;
    border-radius: 25px;
}

.scan-region-highlight {
    z-index: 1002 !important;
}

.powered-by {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(147, 51, 234, 0.7);
    font-family: 'Poetsen One', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    text-align: center;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(147, 51, 234, 0.3);
    z-index: 15;
    pointer-events: none;
    display: block;
}

body.unity-loaded .powered-by {
    display: none;
}

body.unity-loaded {
    background-color: #1C0C30 !important;
    background-image: linear-gradient(to bottom,
    #200B5A 0%,
    #1C0C33 39%,
    #1C0C30 65%,
    #2C0A5F 100%
    ) !important;
    background-size: 100% 100% !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
}

body.unity-loaded::before,
body.unity-loaded::after {
    opacity: 0;
}

body.unity-loaded #unity-container::before,
body.unity-loaded #unity-container::after {
    opacity: 0;
}

@media (max-width: 768px) {
    #unity-loading-bar::before {
        width: 512px;
        height: 296px;
        margin-bottom: 40px;
    }

    #unity-progress-bar-empty {
        width: 300px;
        height: 35px;
    }

    .loading-text {
        font-size: 20px;
        letter-spacing: 1px;
    }

    .idle-animation {
        margin: 40px 0 20px 0;
    }

    body::before {
        width: 600px;
        height: 600px;
        background: radial-gradient(circle, rgba(147, 51, 234, 0.2) 10%, transparent 60%);
    }

    .loading-size {
        font-size: 14px;
        margin-top: 12px;
    }

    .loading-size .size-loaded,
    .loading-size .size-total {
        font-size: 13px;
    }

    #qr-video::before {
        width: 240px;
        height: 240px;
    }

    #qr-video::after {
        width: 260px;
        height: 260px;
    }

    .powered-by {
        font-size: 12px;
        bottom: 25px;
        letter-spacing: 0.5px;
    }
}

@media (max-width: 480px) {
    #unity-loading-bar::before {
        width: 256px;
        height: 148px;
        margin-bottom: 30px;
    }

    #unity-progress-bar-empty {
        width: 250px;
        height: 30px;
    }

    .loading-text {
        font-size: 18px;
        letter-spacing: 1px;
    }

    .idle-animation {
        margin: 40px 0 20px 0;
    }

    body::before {
        width: 600px;
        height: 600px;
        background: radial-gradient(circle, rgba(147, 51, 234, 0.1) 0%, transparent 60%);
    }

    .loading-size {
        font-size: 12px;
        margin-top: 10px;
        line-height: 1.3;
    }

    .loading-size .size-loaded,
    .loading-size .size-total {
        font-size: 11px;
    }

    .loading-size .size-percentage {
        display: block;
        margin-left: 0;
        margin-top: 2px;
        font-size: 13px;
    }

    #qr-video::before {
        width: 200px;
        height: 200px;
    }

    #qr-video::after {
        width: 220px;
        height: 220px;
    }

    .powered-by {
        font-size: 11px;
        bottom: 20px;
        letter-spacing: 0.5px;
    }
}
