/* Mobile Landscape Optimization */
@media (max-height: 600px) and (orientation: landscape) {
    .card {
        padding: 1.5rem;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        max-width: 600px;
    }

    .card h1 {
        font-size: 2rem;
        width: 100%;
        text-align: center;
        margin-bottom: 0.2rem;
    }

    .card p {
        display: none; /* Hide subtitle to save space */
    }

    .input-group {
        width: 45%; /* Side by side inputs */
        margin-bottom: 0.5rem;
    }

    .btn {
        width: 100%;
        padding: 0.8rem;
        margin-top: 0.5rem;
    }

    /* Leaderboard Page Landscape Adjustments */
    #screen-leaderboard .card {
        flex-direction: column;
        height: 90vh; /* More height in landscape */
        padding: 1rem;
    }
    
    #screen-menu .card {
        flex-direction: column;
        width: 60%;
    }
}

/* Animations */

.shake {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.flash {
    animation: flash 0.1s ease-out;
}

@keyframes flash {
    0% { background-color: white; }
    100% { background-color: transparent; }
}

.pulse {
    animation: pulse 0.2s ease-in-out;
}

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

.slide-up {
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(40px) scale(0.95); opacity: 0; filter: blur(10px); }
    to { transform: translateY(0) scale(1); opacity: 1; filter: blur(0); }
}

.slide-down-exit {
    animation: slideDownExit 0.2s ease-in forwards;
}

@keyframes slideDownExit {
    from { transform: translateY(0) scale(1); opacity: 1; filter: blur(0); }
    to { transform: translateY(20px) scale(0.95); opacity: 0; filter: blur(5px); }
}

/* Glitch Effect for Titles */
@keyframes glitch-skew {
    0% { transform: skew(0deg); }
    20% { transform: skew(-2deg); }
    40% { transform: skew(2deg); }
    60% { transform: skew(-1deg); }
    80% { transform: skew(1deg); }
    100% { transform: skew(0deg); }
}

@keyframes glitch-anim-1 {
    0% { clip-path: inset(20% 0 80% 0); transform: translate(-2px, 1px); }
    20% { clip-path: inset(60% 0 10% 0); transform: translate(2px, -1px); }
    40% { clip-path: inset(40% 0 50% 0); transform: translate(-2px, 2px); }
    60% { clip-path: inset(80% 0 5% 0); transform: translate(2px, -2px); }
    80% { clip-path: inset(10% 0 70% 0); transform: translate(-1px, 1px); }
    100% { clip-path: inset(30% 0 50% 0); transform: translate(1px, -1px); }
}

.glitch {
    position: relative;
    animation: glitch-skew 4s infinite linear alternate-reverse;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark); /* Matches bg to hide main text parts */
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 #ff00c1;
    clip-path: inset(0 0 0 0);
    animation: glitch-anim-1 3s infinite linear alternate-reverse;
    z-index: -1;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 #00fff9;
    clip-path: inset(0 0 0 0);
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
    z-index: -2;
}

/* Perfect Jump Feedback */
.perfect-fx {
    position: absolute;
    pointer-events: none;
    border: 2px solid white;
    border-radius: 50%;
    animation: ripple 0.4s ease-out forwards;
}

@keyframes ripple {
    0% { transform: scale(0.5); opacity: 1; border-width: 4px; }
    100% { transform: scale(2); opacity: 0; border-width: 0; }
}

/* Stagger Animation for Lists */
.stagger-appear {
    animation: slideInRight 0.3s ease-out forwards;
    opacity: 0;
}

@keyframes slideInRight {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
