/* Three.js Intro Styles - PS2 Aesthetic with Cyan Theme */

#intro-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: #000508;
    overflow: hidden;
}

body:has(#intro-container:not([style*="display: none"])) {
    overflow: hidden;
}

body:has(#intro-container:not([style*="display: none"])) #main-content {
    pointer-events: none;
    visibility: hidden;
}

#intro-blocker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, 
        rgba(0, 20, 30, 0.95) 0%, 
        rgba(0, 5, 10, 0.98) 70%,
        rgba(0, 0, 5, 1) 100%
    );
    z-index: 10001;
}

#intro-instructions {
    text-align: center;
    cursor: pointer;
    padding: 40px;
    max-width: 500px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto;
}

#intro-instructions h1 {
    font-family: 'Eurostile', 'Outfit', sans-serif;
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 700;
    color: #00ffff;
    letter-spacing: 0.2em;
    margin-bottom: 0.5rem;
    text-shadow: 
        0 0 30px rgba(0, 255, 255, 0.5),
        0 0 60px rgba(0, 200, 255, 0.3),
        2px 2px 0 rgba(0, 0, 0, 0.5);
    animation: ps2TitleGlow 3s ease-in-out infinite alternate;
    filter: blur(0.3px);
}

#intro-instructions > p {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    color: rgba(100, 200, 255, 0.7);
    letter-spacing: 0.15em;
    margin-bottom: 3rem;
    text-transform: uppercase;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

.intro-prompt {
    margin-bottom: 2rem;
}

.click-text {
    display: inline-block;
    font-family: 'Eurostile', sans-serif;
    font-size: 1.2rem;
    color: #00ffff;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    padding: 1rem 2.5rem;
    border: 2px solid rgba(0, 255, 255, 0.6);
    background: rgba(0, 255, 255, 0.1);
    transition: all 0.3s ease;
    animation: ps2ButtonPulse 2s ease-in-out infinite;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    cursor: pointer;
    min-height: 48px;
    min-width: 200px;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

.click-text:hover,
.click-text:active {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 
        0 0 30px rgba(0, 255, 255, 0.4),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
    border-color: #00ffff;
}

.keys-hint {
    margin-top: 1.5rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    color: rgba(100, 200, 255, 0.5);
}

.keys-hint span {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    background: rgba(0, 255, 255, 0.15);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 2px;
    margin: 0 0.3rem;
    font-family: monospace;
    color: #00ffff;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
}

.intro-subtext {
    font-size: 0.9rem !important;
    color: rgba(100, 200, 255, 0.4) !important;
    font-style: italic;
}

.skip-intro-link {
    display: inline-block;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: rgba(100, 200, 255, 0.4);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.75rem 1.5rem;
    border: 1px solid rgba(100, 200, 255, 0.2);
    border-radius: 0;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
    min-width: 120px;
}

.skip-intro-link:hover,
.skip-intro-link:active {
    color: rgba(0, 255, 255, 0.8);
    border-color: rgba(0, 255, 255, 0.4);
    background: rgba(0, 255, 255, 0.1);
}

#intro-hint {
    position: fixed;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

#intro-hint span {
    font-family: 'Eurostile', sans-serif;
    font-size: 1.5rem;
    color: #00ffff;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
    animation: hintPulse 1.5s ease-in-out infinite;
}

/* PS2 Style Animations */
@keyframes ps2TitleGlow {
    from {
        text-shadow: 
            0 0 20px rgba(0, 255, 255, 0.3),
            0 0 40px rgba(0, 200, 255, 0.1),
            2px 2px 0 rgba(0, 0, 0, 0.5);
        filter: blur(0.3px);
    }
    to {
        text-shadow: 
            0 0 40px rgba(0, 255, 255, 0.6),
            0 0 80px rgba(0, 200, 255, 0.4),
            2px 2px 0 rgba(0, 0, 0, 0.5);
        filter: blur(0.5px);
    }
}

@keyframes ps2ButtonPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
        border-color: rgba(0, 255, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(0, 255, 255, 0.5);
        border-color: rgba(0, 255, 255, 0.8);
    }
}

@keyframes hintPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* Canvas styles */
#intro-container canvas,
#intro-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

#intro-container::after {
    display: none;
}

/* Game UI Overlay */
#game-ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10003;
}

.instruction-text {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    transition: opacity 0.5s ease;
}

.instruction-text.fade-out {
    opacity: 0;
}

.key-prompt {
    display: block;
    font-family: 'Eurostile', sans-serif;
    font-size: 2rem;
    color: #00ffff;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    text-shadow: 
        0 0 15px rgba(0, 255, 255, 0.8),
        2px 2px 0 rgba(0, 0, 0, 0.5);
    animation: keyPulse 2s ease-in-out infinite;
}

.instruction-label {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    color: rgba(100, 200, 255, 0.6);
    margin-top: 0.5rem;
    letter-spacing: 0.1em;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

@keyframes keyPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.02); }
}

.enter-light-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Eurostile', sans-serif;
    font-size: 3rem;
    color: #00ffff;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    text-shadow: 
        0 0 40px rgba(0, 255, 255, 1),
        0 0 80px rgba(0, 200, 255, 0.6),
        3px 3px 0 rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.5s ease;
    text-align: center;
    pointer-events: none;
}

.enter-light-text.visible {
    opacity: 1;
    animation: enterPulsePS2 1.5s ease-in-out infinite;
}

@keyframes enterPulsePS2 {
    0%, 100% {
        text-shadow: 
            0 0 30px rgba(0, 255, 255, 0.8),
            0 0 60px rgba(0, 200, 255, 0.5),
            3px 3px 0 rgba(0, 0, 0, 0.5);
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        text-shadow: 
            0 0 50px rgba(0, 255, 255, 1),
            0 0 100px rgba(0, 200, 255, 0.8),
            3px 3px 0 rgba(0, 0, 0, 0.5);
        transform: translate(-50%, -50%) scale(1.02);
    }
}

.direction-indicator {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    color: #00ffff;
    opacity: 0.6;
    animation: bounceUp 1.5s ease-in-out infinite;
}

.direction-indicator svg {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 0 10px rgba(0, 255, 255, 0.5));
}

@keyframes bounceUp {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

/* Mobile Joystick - Cyan Theme */
#mobile-joystick {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 10005;
    touch-action: none;
    display: none;
    -webkit-tap-highlight-color: transparent;
}

.joystick-base {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: rgba(0, 255, 255, 0.1);
    border: 3px solid rgba(0, 255, 255, 0.4);
    position: relative;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3);
}

.joystick-stick {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: rgba(0, 255, 255, 0.5);
    border: 3px solid #00ffff;
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.5),
        inset 0 0 10px rgba(0, 0, 0, 0.2);
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: none;
}

#mobile-enter-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10005;
    display: none;
    align-items: center;
    justify-content: center;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: rgba(0, 255, 255, 0.2);
    border: 3px solid #00ffff;
    animation: enterBtnPulsePS2 1.5s ease-in-out infinite;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#mobile-enter-btn span {
    font-family: 'Eurostile', sans-serif;
    font-size: 0.75rem;
    color: #00ffff;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: bold;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

@keyframes enterBtnPulsePS2 {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 255, 255, 0.8);
        transform: scale(1.05);
    }
}

/* Mobile-specific styles */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .keys-hint.desktop-only {
        display: none !important;
    }
    
    .keys-hint.mobile-only {
        display: block !important;
    }
    
    .intro-prompt::after {
        content: 'Swipe right side to look around';
        display: block;
        margin-top: 1rem;
        font-size: 0.8rem;
        color: rgba(100, 200, 255, 0.4);
    }
    
    #intro-instructions h1 {
        font-size: 2rem;
    }
    
    #intro-hint {
        bottom: 25%;
    }
    
    #mobile-joystick {
        display: block !important;
    }
    
    .direction-indicator {
        display: none;
    }
    
    .key-prompt {
        font-size: 1.5rem;
    }
    
    .enter-light-text {
        font-size: 1.8rem;
        letter-spacing: 0.15em;
    }
    
    .instruction-text {
        top: 10%;
    }
    
    .click-text {
        padding: 1.25rem 3rem;
        font-size: 1rem;
    }
    
    .skip-intro-link {
        padding: 1rem 2rem;
        font-size: 0.85rem;
    }
}

/* Desktop styles */
@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
    #mobile-joystick {
        display: none !important;
    }
    
    #mobile-enter-btn {
        display: none !important;
    }
    
    .keys-hint.mobile-only {
        display: none !important;
    }
}

/* Main content transition */
#main-content {
    opacity: 1;
    transition: opacity 1s ease-in;
}

/* PS2 Scanline effect overlay */
#intro-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 10004;
    opacity: 0.4;
    mix-blend-mode: multiply;
}

/* Landscape mobile adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    #intro-instructions {
        padding: 20px;
    }
    
    #intro-instructions h1 {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
    
    #intro-instructions > p {
        font-size: 0.8rem;
        margin-bottom: 1rem;
    }
    
    .intro-prompt {
        margin-bottom: 0.5rem;
    }
    
    .click-text {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .intro-subtext {
        font-size: 0.75rem !important;
        margin-bottom: 0.5rem;
    }
    
    .skip-intro-link {
        margin-top: 0.5rem;
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    
    #mobile-joystick {
        bottom: 15px;
        left: 15px;
    }
    
    .joystick-base {
        width: 100px;
        height: 100px;
    }
    
    .joystick-stick {
        width: 45px;
        height: 45px;
    }
    
    #mobile-enter-btn {
        bottom: 15px;
        right: 15px;
        width: 100px;
        height: 100px;
    }
    
    .enter-light-text {
        font-size: 1.5rem;
    }
    
    .key-prompt {
        font-size: 1.2rem;
    }
    
    .instruction-text {
        top: 5%;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    #intro-container {
        height: -webkit-fill-available;
    }
    
    #intro-blocker {
        height: -webkit-fill-available;
    }
}
