/* Loading Screen & CRT Effects */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: 'VT323', monospace;
    color: #ffb300;
    overflow: hidden;
    animation: crtOn 0.8s ease-in-out;
}

@keyframes crtOn {
    0% {
        transform: scale(0.1, 0.02);
        opacity: 0;
        filter: brightness(0);
    }
    50% {
        transform: scale(1, 0.02);
        opacity: 0.7;
        filter: brightness(3);
    }
    80% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(2) blur(1px);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }
}

.loading-screen::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(255, 179, 0, 0.15) 50%
    );
    background-size: 100% 4px;
    z-index: 1;
    pointer-events: none;
    animation: scanlines 0.3s linear infinite;
}

.loading-screen::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;    width: 100%;
    height: 100%;
    background: rgba(255, 179, 0, 0.05);
    opacity: 0;
    z-index: 2;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

.loading-content {
    position: relative;
    z-index: 3;
    width: 80%;
    max-width: 800px;
}

.loading-logo {
    font-size: 12px;    line-height: 1;
    white-space: pre;
    text-align: center;
    margin-bottom: 30px;
    animation: textShadow 1.6s infinite;
    color: #ffb300;
    text-shadow: 0 0 5px #ffb300, 0 0 10px #ffea00;
    position: relative;
    overflow: hidden;
}

.loading-logo::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(255, 179, 0, 0.3) 50%,
        transparent 100%
    );
    animation: logoScan 2.5s linear infinite;
    z-index: 1;
}

@keyframes logoScan {
    0% {
        left: -100%;
    }
    100% {
        left: 200%;
    }
}

.loading-progress-container {    width: 100%;
    height: 30px;
    background-color: #222;
    border: 1px solid #ffb300;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(255, 179, 0, 0.5);
}

.loading-progress-bar {    height: 100%;
    width: 0%;
    background-color: #ffb300;
    transition: width 0.3s ease;
    position: relative;
}

.loading-progress-bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;    background: linear-gradient(
        90deg,
        rgba(255, 179, 0, 0.3) 0%,
        rgba(255, 234, 0, 0.6) 50%,
        rgba(255, 179, 0, 0.3) 100%
    );
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);    color: #fff;
    font-size: 16px;
    z-index: 1;
    text-shadow: 0 0 5px rgba(255, 179, 0, 0.7);
}

.loading-console {    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid #ffb300;
    padding: 10px;
    height: 200px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    margin-top: 20px;
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: #ffb300;
    position: relative;
    box-shadow: inset 0 0 10px rgba(255, 179, 0, 0.3), 0 0 10px rgba(255, 179, 0, 0.5);
    text-shadow: 0 0 5px rgba(255, 179, 0, 0.7);
}

.loading-console-text {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    max-height: 100%;
    overflow-y: hidden;
}

.loading-console-line {
    margin: 0;
    padding: 0;
    animation: fadeIn 0.1s ease-in-out;
    white-space: pre-wrap;
    word-break: break-word;
    position: relative;
    font-weight: 400;
    max-width: 100%;
}

.cursor {    display: inline-block;
    width: 8px;
    height: 16px;
    background-color: #ffb300;
    vertical-align: middle;
    animation: blink 1s step-end infinite;
}

/* Animations */
@keyframes scanlines {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 4px;
    }
}

@keyframes flicker {
    0% {
        opacity: 0.37861;
    }
    5% {
        opacity: 0.44769;
    }
    10% {
        opacity: 0.33604;
    }
    15% {
        opacity: 0.90626;
    }
    20% {
        opacity: 0.28128;
    }
    25% {
        opacity: 0.83891;
    }
    30% {
        opacity: 0.65583;
    }
    35% {
        opacity: 0.77807;
    }
    40% {
        opacity: 0.36559;
    }
    45% {
        opacity: 0.84693;
    }
    50% {
        opacity: 0.86019;
    }
    55% {
        opacity: 0.18594;
    }
    60% {
        opacity: 0.40313;
    }
    65% {
        opacity: 0.71988;
    }
    70% {
        opacity: 0.53455;
    }
    75% {
        opacity: 0.47288;
    }
    80% {
        opacity: 0.71428;
    }
    85% {
        opacity: 0.80419;
    }
    90% {
        opacity: 0.7003;
    }
    95% {
        opacity: 0.46108;
    }
    100% {
        opacity: 0.34387;
    }
}

@keyframes textShadow {
    0% {
        text-shadow: 0.4389924193300864px 0 1px rgba(255, 179, 0, 0.5), -0.4389924193300864px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    5% {
        text-shadow: 2.7928974010788217px 0 1px rgba(255, 179, 0, 0.5), -2.7928974010788217px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    10% {
        text-shadow: 0.02956275843481219px 0 1px rgba(255, 179, 0, 0.5), -0.02956275843481219px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    15% {
        text-shadow: 0.40218538552878136px 0 1px rgba(255, 179, 0, 0.5), -0.40218538552878136px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    20% {
        text-shadow: 3.4794037899852017px 0 1px rgba(255, 179, 0, 0.5), -3.4794037899852017px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    25% {
        text-shadow: 1.6125630401149584px 0 1px rgba(255, 179, 0, 0.5), -1.6125630401149584px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    30% {
        text-shadow: 0.7015590085143956px 0 1px rgba(255, 179, 0, 0.5), -0.7015590085143956px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    35% {
        text-shadow: 3.896914047650351px 0 1px rgba(255, 179, 0, 0.5), -3.896914047650351px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    40% {
        text-shadow: 3.870905614848819px 0 1px rgba(255, 179, 0, 0.5), -3.870905614848819px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    45% {
        text-shadow: 2.231056963361899px 0 1px rgba(255, 179, 0, 0.5), -2.231056963361899px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    50% {
        text-shadow: 0.08084290417898504px 0 1px rgba(255, 179, 0, 0.5), -0.08084290417898504px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    55% {
        text-shadow: 2.3758461067427543px 0 1px rgba(255, 179, 0, 0.5), -2.3758461067427543px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    60% {
        text-shadow: 2.202193051050636px 0 1px rgba(255, 179, 0, 0.5), -2.202193051050636px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    65% {
        text-shadow: 2.8638780614874975px 0 1px rgba(255, 179, 0, 0.5), -2.8638780614874975px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    70% {
        text-shadow: 0.48874025155497314px 0 1px rgba(255, 179, 0, 0.5), -0.48874025155497314px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    75% {
        text-shadow: 1.8948491305757957px 0 1px rgba(255, 179, 0, 0.5), -1.8948491305757957px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    80% {
        text-shadow: 0.0833037308038857px 0 1px rgba(255, 179, 0, 0.5), -0.0833037308038857px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    85% {
        text-shadow: 0.09769827255241735px 0 1px rgba(255, 179, 0, 0.5), -0.09769827255241735px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    90% {
        text-shadow: 3.443339761481782px 0 1px rgba(255, 179, 0, 0.5), -3.443339761481782px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    95% {
        text-shadow: 2.1841838852799786px 0 1px rgba(255, 179, 0, 0.5), -2.1841838852799786px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
    100% {
        text-shadow: 2.6208764473832513px 0 1px rgba(255, 179, 0, 0.5), -2.6208764473832513px 0 1px rgba(255, 234, 0, 0.3), 0 0 3px;
    }
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-5px);
        filter: blur(1px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.6;
        transform: scale(0.98);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0.6;
        transform: scale(0.98);
    }
}

/* Color Shift Animation for Logo */
@keyframes colorShift {
    0%, 100% {
        color: #ffb300;
        text-shadow: 0 0 5px #ffb300, 0 0 10px #ffea00;
    }
    33% {
        color: #ffd700;
        text-shadow: 0 0 5px #ffd700, 0 0 10px #ff8c00;
    }
    66% {
        color: #ff8c00;
        text-shadow: 0 0 5px #ff8c00, 0 0 10px #ffb300;
    }
}

/* Apply color shifting to logo occasionally */
.loading-logo.color-shift {
    animation: textShadow 1.6s infinite, colorShift 5s linear infinite;
}

.hidden {
    display: none;
}

/* VHS glitch effect */
.vhs-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
    mix-blend-mode: screen;
}

.vhs-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 1px,
        rgba(255, 179, 0, 0.03) 1px,
        rgba(255, 179, 0, 0.03) 2px
    );
}

.vhs-noise {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/png;base64,iVBORw0KGgo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tOvnW4irMMFNV4H0uqwS5ExsmP9AxbDTc9JwgneAT5vTiUSm1E7BSflSt3bfa1tv8Di3R8n3Af7MNWzs49hmauE2wP+ttrq+AsWpFG2awvsuOqbipWHgtuvuaAE+A1Z/7gC9hesnr+7wqCwG8c5yAg3AL1fm8T9AZtp/bbJGwl1pNrE7RuOX7PeMRUERVaPpEs+yqeoSmuOlokqw49pgomjLeh7icHNlG19yjs6XXOMedYm5xH2YxpV2tc0Ro2jJfxC50ApuxGob7lMsxfTbeUv07TyYxpeLucEH1gNd4IKH2LAg5TdVhlCafZvpskfncCfx8pOhJzd76bJWeYFnFciwcYfubRc12Ip/ppIhA1/mSZ/RxjFDrJC5xifFjJpY2Xl5zXdguFqYyTR1zSp1Y9p+tktDYYSNflcxI0iyO4TPBdlRcpeqjK/piF5bklq77VSEaA+z8qmJTFzIWiitbnzR794USKBUaT0NTEsVjZqLaFVqJoPN9ODG70IPbfBHKK+/q/AWR0tJzYHRULOa4MP+W/HfGadZUbfw177G7j/OGbIs8TahLyynl4X4RinF793Oz+BU0saXtUHrVBFT/DnA3ctNPoGbs4hRIjTok8i+algT1lTHi4SxFvONKNrgQFAq2/gFnWMXgwffgYMJpiKYkmW3tTg3ZQ9Jq+f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==');
    opacity: 0.08;
    animation: noise 0.2s infinite;
}

@keyframes noise {
    0%, 100% {
        transform: translateX(0);
    }
    10% {
        transform: translateX(-1%);
    }
    20% {
        transform: translateX(1%);
    }
    30% {
        transform: translateX(-2%);
    }
    40% {
        transform: translateX(3%);
    }
    50% {
        transform: translateX(-3%);
    }
    60% {
        transform: translateX(2%);
    }
    70% {
        transform: translateX(-1%);
    }
    80% {
        transform: translateX(2%);
    }
    90% {
        transform: translateX(-2%);
    }
}

.tape-glitch {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
}

.tape-glitch-line {    position: absolute;
    background: rgba(255, 179, 0, 0.2);
    height: 5px;
    width: 100%;
    left: 0;
    transform: translateY(-10px);
    animation: tape-glitch 6s infinite;
}

@keyframes tape-glitch {
    0% {
        opacity: 0;
        top: -100px;
    }
    1% {
        opacity: 1;
        top: 120px;
    }
    2% {
        top: 150px;
    }
    3% {
        top: 150px;
        opacity: 0;
    }
    4% {
        top: 300px;
        opacity: 0;
    }
    5% {
        top: 300px;
        opacity: 0;
    }
    6% {
        top: 300px;
        opacity: 0;
    }
    7% {
        top: 300px;
        opacity: 0.2;
    }
    8% {
        top: 350px;
        opacity: 0;
    }
    9% {
        top: 400px;
        opacity: 0;
    }
    10% {
        top: 450px;
        opacity: 0;
    }
    11% {
        top: 450px;
        opacity: 0;
    }
    12% {
        top: 450px;
        opacity: 0;
    }
    13% {
        top: 500px;
        opacity: 0.3;
    }
    14% {
        top: 500px;
        opacity: 0;
    }
    100% {
        top: -100px;
        opacity: 0;
    }
}

.loading-fade-out {
    animation: fadeOut 1s forwards;
}

@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
        filter: brightness(2) saturate(1.5);
    }
    100% {
        opacity: 0;
        transform: scale(0.5);
        filter: brightness(0);
        visibility: hidden;
    }
}

.glitch-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 6;
    pointer-events: none;
    opacity: 0;
    animation: randomGlitch 10s step-end infinite;
}

@keyframes randomGlitch {
    0%, 97%, 100% {
        opacity: 0;
    }
    98% {
        opacity: 1;
        transform: translateX(2px);
        background-image: linear-gradient(transparent 25%, rgba(255, 179, 0, 0.3) 25%, rgba(255, 179, 0, 0.3) 26%, transparent 26%, transparent 74%, rgba(255, 179, 0, 0.3) 74%, rgba(255, 179, 0, 0.3) 75%, transparent 75%);
    }
    99% {
        opacity: 1;
        transform: translateX(-2px);
        background-image: linear-gradient(transparent 40%, rgba(255, 179, 0, 0.3) 40%, rgba(255, 179, 0, 0.3) 41%, transparent 41%, transparent 59%, rgba(255, 179, 0, 0.3) 59%, rgba(255, 179, 0, 0.3) 60%, transparent 60%);
    }
}

/* Mobile responsiveness */
@media screen and (max-width: 768px) {
    .loading-content {
        width: 95%;
        max-width: 600px;
    }
    
    .loading-logo {
        font-size: 7px; /* Smaller font for ASCII logo */
        margin-bottom: 15px;
        line-height: 1.2;
    }
    
    .loading-console {
        height: 150px; /* Smaller console */
        font-size: 12px;
        padding: 8px;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .loading-console-line {
        max-width: 100%;
    }
    
    .loading-progress-container {
        margin: 15px 0;
        height: 25px;
    }
    
    .loading-console-text {
        font-size: 12px;
        padding: 8px;
    }
    
    .skip-info {
        bottom: 10px !important;
        right: 10px !important;
        font-size: 12px !important;
    }
    
    .loading-progress-text {
        font-size: 14px;
    }
    
    .vhs-lines, .vhs-noise {
        opacity: 0.7;
    }
}

@media screen and (max-width: 480px) {
    .loading-content {
        width: 95%;
        padding: 10px 0;
    }
    
    .loading-logo {
        font-size: 4.5px; /* Even smaller font for very small screens */
        margin-bottom: 10px;
    }
    
    .loading-console {
        height: 120px;
        margin-top: 10px;
        padding: 6px;
        width: 100%;
    }
    
    .loading-console-text {
        font-size: 11px;
        padding: 6px;
        width: 100%;
    }
    
    .loading-console-line {
        font-size: 11px;
    }
    
    .loading-progress-text {
        font-size: 13px;
    }
    
    .loading-progress-container {
        height: 20px;
        margin: 10px 0;
        width: 100%;
    }
    
    .cursor {
        width: 6px;
        height: 14px;
    }
}

/* Specific adjustments for very small screens */
@media screen and (max-width: 320px) {
    .loading-logo {
        font-size: 3.5px;
    }
    
    .loading-console {
        height: 100px;
        padding: 5px;
    }
    
    .loading-console-text {
        padding: 5px;
    }
    
    .loading-progress-container {
        height: 18px;
    }
}

/* For ultra-small screens */
@media screen and (max-width: 280px) {
    .loading-logo {
        font-size: 3px;
        margin-bottom: 5px;
    }
    
    .loading-console {
        height: 80px;
        font-size: 10px;
        padding: 3px;
    }
    
    .loading-console-text {
        font-size: 10px;
        padding: 3px;
    }
    
    .loading-progress-container {
        height: 15px;
        margin: 5px 0;
    }
    
    .loading-progress-text {
        font-size: 11px;
    }
    
    .cursor {
        width: 5px;
        height: 12px;
    }
    
    .skip-info {
        font-size: 10px !important;
        bottom: 5px !important;
        right: 5px !important;
    }
}

/* Orientation-specific adjustments */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .loading-content {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: flex-start;
    }
    
    .loading-logo {
        font-size: 4px;
        margin-bottom: 5px;
        width: 100%;
    }
    
    .loading-progress-container {
        width: 100%;
        height: 20px;
        margin: 5px 0;
    }
    
    .loading-console {
        height: 100px;
        margin-top: 5px;
    }
    
    .skip-info {
        bottom: 5px !important;
        right: 5px !important;
    }
}

/* Support for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .loading-screen::before,
    .loading-screen::after,
    .loading-logo,
    .loading-logo::before,
    .vhs-noise,
    .tape-glitch,
    .loading-progress-bar::after,
    .cursor {
        animation: none !important;
    }
    
    .loading-console-line {
        animation: none !important;
        opacity: 1 !important;
    }
    
    .loading-screen::before {
        opacity: 0.2 !important;
    }
    
    .loading-screen::after {
        opacity: 0.1 !important;
    }
    
    .vhs-noise {
        opacity: 0.05 !important;
    }
    
    .loading-progress-bar::after {
        opacity: 0.5 !important;
    }
}
