:root {
    --vh: 1vh;
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: #1a1a1a;
    color: #d4d4d4;
    overflow: hidden;
}

.screen {
    display: none;
    width: 100vw;
    height: calc(var(--vh, 1vh) * 100);
    position: relative;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
}

.login-bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(9px);
    opacity: 0.3;
    z-index: 0;
}

.menu-bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(50px);
    opacity: 0.3;
    z-index: 0;
}

.game-title {
    font-size: 2rem;
    color: #8b0000;
    text-shadow: 0 0 20px rgba(139, 0, 0, 0.8);
    margin-bottom: 1rem;
    text-align: center;
    letter-spacing: 0.25rem;
}

#login-logo {
    max-width: 250px;
    width: 100%;
    height: auto;
}

.goal-banner {
    color: #ff0000;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8), 0 0 20px rgba(139, 0, 0, 0.5);
    line-height: 1.4;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    border: 2px solid #ff0000;
    padding: 15px;
    background: rgba(30, 0, 0, 0.8);
    border-radius: 8px;
    font-weight: bold;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
    animation: bannerPulse 2s infinite ease-in-out;
    text-transform: uppercase;
    letter-spacing: 1px;
}


.login-container,
.menu-container {
    background: rgba(30, 30, 30, 0.9);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    min-width: 200px;
    position: relative;
    z-index: 1;
    text-align: center;
    width: 90%;
    margin-top: 4rem;
    margin-bottom: 2rem;
}

.login-form input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: #2a2a2a;
    border: 1px solid #444;
    color: #d4d4d4;
    font-size: 0.85rem;
    border-radius: 5px;
}

.login-form input:focus {
    outline: none;
    border-color: #8b0000;
}

button {
    width: 100%;
    padding: 0.5rem;
    background: #8b0000;
    border: none;
    color: #fff;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.1rem;
}

button:hover {
    background: #a00000;
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.6);
}

button:active {
    transform: scale(0.98);
}

.menu-btn {
    margin-bottom: 1rem;
}

.error-message {
    color: #ff4444;
    margin-top: 1rem;
    text-align: center;
    min-height: 20px;
}

.login-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #444;
    text-align: center;
}

.privacy-link {
    color: #8b0000;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.3s;
    letter-spacing: 0.05rem;
}

.privacy-link:hover {
    color: #a00000;
    text-shadow: 0 0 10px rgba(139, 0, 0, 0.5);
}

#game-screen {
    position: relative;
    background: #0a0a0a;
}

#scene-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#ui-overlay > * {
    pointer-events: auto;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.fade-out {
    animation: fadeOut 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes bannerPulse {
    0% { transform: scale(1); box-shadow: 0 0 15px rgba(255, 0, 0, 0.4); border-color: #ff0000; color: #ff0000; }
    50% { transform: scale(1.02); box-shadow: 0 0 30px rgba(255, 0, 0, 0.8); border-color: #ff3333; color: #ff3333; }
    100% { transform: scale(1); box-shadow: 0 0 15px rgba(255, 0, 0, 0.4); border-color: #ff0000; color: #ff0000; }
}

@keyframes logoInvert {
    0%, 100% { filter: invert(0); }
    50% { filter: invert(1); }
}

@keyframes logoFlip {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
}

@keyframes logoSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes logoFlicker {
    0%, 100% { opacity: 1; }
    25% { opacity: 0.3; }
    50% { opacity: 1; }
    75% { opacity: 0.5; }
}

@keyframes logoContrast {
    0%, 100% { filter: contrast(1); }
    50% { filter: contrast(3); }
}

@keyframes logoFade {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

.logo-glitch-invert {
    animation: logoInvert 335ms steps(2, end) 3;
}

.logo-glitch-flip {
    animation: logoFlip 350ms ease-in-out 1;
}

.logo-glitch-spin {
    animation: logoSpin 300ms ease-in-out 1;
}

.logo-glitch-flicker {
    animation: logoFlicker 450ms ease-in-out 2;
}

.logo-glitch-contrast {
    animation: logoContrast 420ms ease-in-out 1;
}

.logo-glitch-fade {
    animation: logoFade 500ms ease-in-out 2;
}

@media (min-width: 768px) {
    .login-container,
    .menu-container {
        width: 40%;
    }
}

@media (max-width: 768px) {
    button {
        padding: 0.65rem;
    }

    #login-logo {
        max-width: 200px;
    }
}
