/* ========================================
   FINAL PS1 TITLE SCREEN
   3D logo + sword animation + starfield
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

/* ========== BASE ========== */
body {
    font-family: 'Press Start 2P', 'Courier New', monospace;
    background: #050a15;
    color: #ffffff;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Allow scrolling on mobile for title screen */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
        min-height: 100vh;
        padding: 20px 0;
    }
}

/* PS1 dithering effect overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 1px,
            rgba(0, 0, 0, 0.03) 1px,
            rgba(0, 0, 0, 0.03) 2px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 1px,
            rgba(0, 0, 0, 0.03) 1px,
            rgba(0, 0, 0, 0.03) 2px
        );
    opacity: 0.4;
    mix-blend-mode: multiply;
}

/* ========== STARFIELD ========== */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ========== CRT EFFECTS ========== */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.4) 100%);
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    animation: scanline-move 8s linear infinite;
}

@keyframes scanline-move {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

/* ========== TITLE CONTAINER ========== */
.title-container {
    position: relative;
    z-index: 10;
    text-align: center;
    width: 100%;
    max-width: 900px;
    padding: 40px;
    animation: fade-in 1.5s ease-out;
    filter: contrast(1.1) saturate(1.2);
}

@keyframes fade-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* ========== 3D LOGO AREA ========== */
.logo-area {
    position: relative;
    margin-bottom: 40px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 3D Rendered Logo */
.logo-3d {
    max-width: 700px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 30px rgba(100, 150, 255, 0.6))
            drop-shadow(0 0 60px rgba(100, 150, 255, 0.4));
    opacity: 0;
    animation: logo-entrance 2s ease-out forwards;
    animation-fill-mode: forwards;
    position: relative;
    z-index: 3;
}

@keyframes logo-entrance {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
        filter: drop-shadow(0 0 30px rgba(100, 150, 255, 0.6))
                drop-shadow(0 0 60px rgba(100, 150, 255, 0.4))
                blur(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: drop-shadow(0 0 30px rgba(100, 150, 255, 0.6))
                drop-shadow(0 0 60px rgba(100, 150, 255, 0.4))
                blur(0);
    }
}

/* Logo float after entrance */
.logo-3d.floating {
    animation: logo-float 4s ease-in-out infinite;
}

@keyframes logo-float {
    0%, 100% { 
        transform: translateY(0px);
    }
    50% { 
        transform: translateY(-15px);
    }
}

/* Logo rumble on impact */
.logo-area.rumble {
    animation: logo-rumble 0.3s ease-out;
}

@keyframes logo-rumble {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-4px, 3px); }
    20% { transform: translate(4px, -3px); }
    30% { transform: translate(-4px, -2px); }
    40% { transform: translate(4px, 2px); }
    50% { transform: translate(-3px, 3px); }
    60% { transform: translate(3px, -2px); }
    70% { transform: translate(-2px, -2px); }
    80% { transform: translate(2px, 1px); }
    90% { transform: translate(-1px, 1px); }
}

/* Fallback text logo (hidden when image loads) */
.logo-fallback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.3;
}

.logo-3d + .logo-fallback {
    display: none;
}

.main-title {
    font-size: 3rem;
    letter-spacing: 8px;
    color: #ffffff;
    text-shadow: 
        0 0 20px rgba(100, 150, 255, 0.8),
        0 0 40px rgba(100, 150, 255, 0.5),
        4px 4px 0px rgba(0, 0, 0, 0.8);
}

/* ========== SWORD ANIMATION ========== */
.sword {
    position: absolute;
    width: 1000px;
    height: auto;
    top: 60%;
    left: -1400px;
    opacity: 0;
    transform: translateY(-50%) rotate(-25deg);
    filter: drop-shadow(0 0 20px rgba(218, 165, 32, 0.8))
            drop-shadow(0 0 40px rgba(218, 165, 32, 0.6));
    z-index: 2;
    animation: sword-pierce 0.5s cubic-bezier(0.1, 0.9, 0.2, 1) 1.5s forwards;
}

@keyframes sword-pierce {
    0% {
        left: -1400px;
        top: 60%;
        opacity: 1;
        transform: translateY(-50%) rotate(-25deg);
    }
    100% {
        left: 50%;
        top: 50%;
        opacity: 1;
        transform: translateY(-50%) translateX(-50%) rotate(0deg);
    }
}

/* Pierce glow effect - DISABLED */
.pierce-glow {
    display: none;
}

/* ========== SUBTITLE ========== */
.subtitle {
    font-size: 0.6rem;
    letter-spacing: 2px;
    color: #c9a565;
    text-transform: uppercase;
    line-height: 1.6;
    margin-top: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-shadow: 
        2px 2px 0px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(201, 165, 101, 0.5);
    opacity: 0;
    animation: subtitle-entrance 0.8s ease-out 2.5s forwards;
}

@keyframes subtitle-entrance {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ========== ORNATE MENU FRAME ========== */
.menu-frame {
    position: relative;
    padding: 60px 50px;
    background-image: url('assets/menu_box.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    margin: 0 auto 50px;
    max-width: 500px;
    min-height: 300px;
    opacity: 0;
    animation: menu-entrance 0.8s ease-out 2.7s forwards;
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
}

@keyframes menu-entrance {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Remove the old corner decorations since we're using the PNG */
.frame-corner {
    display: none;
}

/* ========== MENU ========== */
.title-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.menu-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 8px 40px;
    background: transparent;
    border: none;
    text-decoration: none;
    color: #ffffff;
    transition: all 0.2s ease;
    position: relative;
}

.menu-option:hover,
.menu-option.active {
    background: rgba(220, 80, 100, 0.5);
}

.menu-option:hover .menu-icon,
.menu-option.active .menu-icon {
    opacity: 1;
}

.menu-icon {
    font-size: 1.2rem;
    color: #ff6b7a;
    opacity: 0.4;
    transition: opacity 0.3s ease;
    text-shadow: 0 0 10px rgba(255, 107, 122, 0.8);
}

.menu-text {
    font-size: 1rem;
    letter-spacing: 4px;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.8);
}

/* Quest Option - Sparkly Gold */
.menu-option-quest .menu-text {
    color: #daa520;
    text-shadow: 
        0 0 10px rgba(218, 165, 32, 0.8),
        0 0 20px rgba(218, 165, 32, 0.6),
        0 0 30px rgba(218, 165, 32, 0.4),
        2px 2px 0px rgba(0, 0, 0, 0.8);
    animation: sparkle 2s infinite;
}

.menu-option-quest .menu-icon {
    color: #daa520;
    text-shadow: 0 0 10px rgba(218, 165, 32, 0.8);
    animation: sparkle 2s infinite;
}

.menu-option-quest:hover .menu-text,
.menu-option-quest.active .menu-text {
    color: #ffd700;
    text-shadow: 
        0 0 15px rgba(255, 215, 0, 1),
        0 0 25px rgba(255, 215, 0, 0.8),
        0 0 35px rgba(255, 215, 0, 0.6),
        2px 2px 0px rgba(0, 0, 0, 0.8);
}

@keyframes sparkle {
    0%, 100% {
        filter: brightness(1);
        text-shadow: 
            0 0 10px rgba(218, 165, 32, 0.8),
            0 0 20px rgba(218, 165, 32, 0.6),
            0 0 30px rgba(218, 165, 32, 0.4),
            2px 2px 0px rgba(0, 0, 0, 0.8);
    }
    50% {
        filter: brightness(1.3);
        text-shadow: 
            0 0 15px rgba(255, 215, 0, 1),
            0 0 25px rgba(255, 215, 0, 0.8),
            0 0 35px rgba(255, 215, 0, 0.6),
            2px 2px 0px rgba(0, 0, 0, 0.8);
    }
}

/* ========== COPYRIGHT ========== */
.copyright {
    font-size: 0.5rem;
    color: #8b7355;
    letter-spacing: 2px;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.8);
    opacity: 0;
    animation: copyright-entrance 0.8s ease-out 3s forwards;
}

@keyframes copyright-entrance {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .logo-3d {
        max-width: 90%;
    }
    
    .logo-area {
        margin-bottom: 30px;
    }

    .sword {
        width: 480px;
        max-width: 90vw;
        animation: sword-pierce-mobile 0.5s cubic-bezier(0.1, 0.9, 0.2, 1) 1.5s forwards;
    }
    
    @keyframes sword-pierce-mobile {
        0% {
            left: -550px;
            top: 60%;
            opacity: 1;
            transform: translateY(-50%) rotate(-25deg);
        }
        100% {
            left: 50%;
            top: 50%;
            opacity: 1;
            transform: translateY(-50%) translateX(-50%) rotate(0deg);
        }
    }

    .subtitle {
        font-size: 0.5rem;
        letter-spacing: 1px;
        padding: 0 20px;
    }

    .menu-frame {
        padding: 50px 30px;
        max-width: 90%;
        min-height: 250px;
    }

    .menu-option {
        padding: 12px 20px;
    }

    .menu-text {
        font-size: 0.85rem;
        letter-spacing: 2px;
    }
}

@media (max-width: 480px) {
    .logo-3d {
        max-width: 100%;
    }
}

    .subtitle {
        font-size: 0.45rem;
    }

    .menu-text {
        font-size: 0.75rem;
    }

    .main-title {
        font-size: 2rem;
        letter-spacing: 4px;
    }
