* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Remove blue highlight on touch/click */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.rubik {
  font-family: "Rubik", sans-serif;
  font-optical-sizing: auto;
  font-weight: 900;
  font-style: normal;
}

html, body {
    height: 100%;
    overflow: hidden; /* Prevent any scrolling */
    font-family: 'Rubik', sans-serif;
    font-weight: 900;
    background: #0b0e1f;
}

/* Screen System - Each screen fills viewport */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease-in-out, visibility 1s ease-in-out;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* Screen 1: Night Sky */
#screen-1 {
    background: linear-gradient(180deg, #0c1445 0%, #1a1a2e 50%, #000000 100%);
    cursor: pointer;
}

#night-sky-base {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/night-sky.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.8;
    z-index: 1;
}

.click-prompt {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    font-size: 1.2rem;
    animation: fadeInOut 2s infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.click-prompt.hidden {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

#night-sky-clouds {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/night-sky-clouds.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    z-index: 2;
    transform: translateY(20px);
    transition: all 3s ease-in-out;
}

#night-sky-clouds.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.password-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    padding: 3rem;
    text-align: center;
    min-width: 320px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease-in-out;
}

.password-container.show {
    opacity: 1;
    visibility: visible;
}

#password-form label {
    font-size: 1.5rem;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0.4) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.4);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

.input-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
}

#troop-password {
    width: 120px;
    padding: 1rem;
    font-size: 2rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.119);
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
    color: white;
    letter-spacing: 0.5rem;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.119),
        inset 0 1px 0 rgba(255, 255, 255, 0.119),
        inset 0 -1px 0 rgba(0, 0, 0, 0.119);
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    /* Allow text selection for password input */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

#troop-password:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1),
        0 0 0 3px rgba(255, 255, 255, 0.15);
}

#password-form button {
    padding: 0.8rem 0rem;
    font-size: 1.1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0.4) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.4);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
}

#password-form button.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

#password-form button:hover {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 1) 0%,
        rgba(255, 255, 255, 0.9) 50%,
        rgba(255, 255, 255, 0.7) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
    transform: translateY(-1px);
}

#password-form button:active {
    transform: translateY(0px);
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.8) 0%,
        rgba(255, 255, 255, 0.6) 50%,
        rgba(255, 255, 255, 0.4) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
}

/* Screen 2: Poster Scroller */
#screen-2 {
    background: #0b0f1f;
    overflow: hidden;
}

.poster-scroller-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--poster-height, 300vh); /* Dynamic height based on image aspect ratio */
    background-image: url('assets/posterScroller.png');
    background-size: 100% auto; /* Fill width, auto height for consistent scaling */
    background-position: top center;
    background-repeat: no-repeat;
    opacity: 0;
    transform: translateY(30px) translateZ(0); /* Start with slight downward offset like clouds */
    transition: all 3s ease-in-out; /* Match clouds animation duration */
    will-change: transform, opacity; /* Optimize for animations */
    backface-visibility: hidden; /* Reduce repaints */
}

.poster-scroller-background.animate-in {
    opacity: 1;
    transform: translateY(0) translateZ(0); /* Slide up into position like clouds */
}

.poster-scroller-background.scrolling {
    animation: none; /* Animation handled by JavaScript for viewport responsiveness */
    transform: translateY(var(--scroll-distance, 0)) translateZ(0);
    transition: transform 40s linear;
}

.text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}

.text-content {
    position: absolute;
    text-align: center;
    color: white;
    font-size: 2rem;
    opacity: 0;
    transition: opacity 1s ease-in-out; /* Faster transition */
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 0.7) 50%,
        rgba(255, 255, 255, 0.5) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.5),
        0 1px 0 rgba(255, 255, 255, 0.4);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
    will-change: opacity; /* Optimize for opacity changes */
    transform: translateZ(0); /* Hardware acceleration */
}

.text-content.show {
    opacity: 1;
}

.scrolling-text {
    position: absolute;
    top: var(--scrolling-text-start, 150vh); /* Start below viewport, positioned relative to poster */
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: white;
    font-size: 1.8rem;
    opacity: 0;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 0.7) 50%,
        rgba(255, 255, 255, 0.5) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow:
        0 2px 4px rgba(0, 0, 0, 0.5),
        0 1px 0 rgba(255, 255, 255, 0.4);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
    will-change: opacity, transform;
    transform: translateX(-50%) translateZ(0);
    transition: transform 40s linear, opacity 1s ease-in-out;
    z-index: 15;
    max-width: 80%;
    line-height: 1.2;
}

.scrolling-text.scrolling {
    opacity: 1;
    transform: translateX(-50%) translateY(var(--scrolling-text-distance, -200vh)) translateZ(0);
}

.fade-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 0;
    transition: opacity 3s ease-in-out;
    z-index: 20;
}

.fade-overlay.fade-to-black {
    opacity: 1;
}

/* Shake animation for wrong password */
@keyframes shake {
    0%, 20%, 40%, 60%, 80%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .click-prompt {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .password-container {
        max-width: 95vw;
        padding: 2rem;
        min-width: unset;
    }
    
    .poster-container {
        max-width: 95vw;
        max-height: 80vh;
    }
    
    #poster {
        max-width: 100%;
        max-height: 100%;
    }
}