#glitch-selection-screen {
    backdrop-filter: blur(5px);
}

.glitch-card {
    background: rgba(10, 5, 16, 0.95);
    border: 1px solid #ff00ff;
    padding: 25px;
    width: 320px;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.15);
    position: relative;
    overflow: hidden;
}

.glitch-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.4);
    border-color: #00ffff;
}

.glitch-title {
    color: #fff;
    font-size: 1.6rem;
    font-weight: bold;
    margin-bottom: 15px;
    text-transform: uppercase;
    text-shadow: 2px 2px 0px #ff00ff;
    text-align: center;
}

.glitch-select-btn {
    background: transparent;
    border: 1px solid #ff00ff;
    color: #ff00ff;
    padding: 12px 0;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.glitch-card:hover .glitch-select-btn {
    background: #00ffff;
    color: #000;
    border-color: #00ffff;
}

/* For BLANK modifier */
.input-hidden {
    opacity: 0 !important;
    pointer-events: none;
}

/* For LAGGY modifier */
.input-lag {
    transition: opacity 0.5s ease;
}

/* ========================================= */
/* GLOBAL GLITCH TRANSITION                  */
/* ========================================= */
/* ========================================= */
/* ADVANCED GLITCH TRANSITION                */
/* ========================================= */

#transition-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #000;
opacity: 0;
pointer-events: none;
z-index: 9998;
transition: opacity 0.1s ease;
}

#transition-overlay.active {
    opacity: 1;
    display: block;
    animation: flashNoise 0.5s steps(1) forwards;
}

/* Apply this class to #screen-wrapper via JS */
.screen-glitch-anim {
    animation: glitchSlice 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    position: relative;
}

.screen-glitch-anim::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--accent);
    opacity: 0;
    z-index: 100;
    pointer-events: none;
    mix-blend-mode: hard-light;
    animation: colorShift 0.5s steps(2) forwards;
}

#game-stage {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* The Tearing/Slicing Animation */
@keyframes glitchSlice {
    0% { transform: translate(0); filter: brightness(1); }
    
    10% { 
        clip-path: inset(10% 0 85% 0); 
        transform: translate(-10px, 5px) skew(5deg);
        filter: hue-rotate(90deg) contrast(2);
    }
    
    20% { 
        clip-path: inset(80% 0 0 0); 
        transform: translate(10px, -5px) skew(-5deg);
        filter: invert(1);
    }
    
    30% { 
        clip-path: inset(10% 0 10% 0); 
        transform: translate(-20px, 0) scale(1.1);
        filter: brightness(2) drop-shadow(5px 0 #f0f);
    }
    
    40% { 
        clip-path: inset(50% 0 30% 0); 
        transform: translate(20px, 0) scale(1.1);
    }
    
    50% { 
        /* SWAP POINT - Maximum Chaos */
        clip-path: inset(0 0 0 0);
        transform: translate(0) scale(1);
        filter: brightness(0); /* Blackout briefly for clean swap */
    }
    
    60% { 
        clip-path: inset(15% 0 60% 0); 
        transform: translate(10px, 10px);
        filter: hue-rotate(-90deg) contrast(1.5);
    }
    
    80% { 
        clip-path: inset(60% 0 10% 0); 
        transform: translate(-5px, -5px);
        filter: none;
    }
    
    100% { transform: translate(0); clip-path: inset(0 0 0 0); }
}

/* Flash Animation for the Overlay */
@keyframes flashNoise {
    0% { opacity: 0; }
    10% { opacity: 0.8; background: #fff; }
    20% { opacity: 0.1; background: #ff00ff; }
    40% { opacity: 0.5; background: #00ffff; }
    50% { opacity: 1; background: #000; } /* Blackout at swap */
    60% { opacity: 0.2; background: #fff; }
    100% { opacity: 0; }
}

@keyframes colorShift {
    0% { opacity: 0; }
    20% { opacity: 0.5; }
    50% { opacity: 0; }
    70% { opacity: 0.3; }
    100% { opacity: 0; }
}

.screen-victory-anim {
animation: victoryAscend 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
transform-origin: center;
}
@keyframes victoryAscend {
0% {
transform: scale(1);
filter: brightness(1) blur(0px);
}
40% {
transform: scale(1.02);
filter: brightness(1.5) blur(1px) contrast(1.1);
}
50% {
/* The Peak Flash */
transform: scale(1.05);
filter: brightness(5) blur(4px) saturate(0);
}
100% {
transform: scale(1);
filter: brightness(1) blur(0px);
}
}
#transition-overlay.victory-mode::after {
content: '';
position: absolute;
top: 0; left: 0; width: 100%; height: 100%;
background: linear-gradient(to bottom, transparent, rgba(0, 255, 136, 0.5), transparent);
animation: scanDown 0.5s ease-out;
}
@keyframes scanDown {
0% { transform: translateY(-100%); }
100% { transform: translateY(100%); }
}