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

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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Press Start 2P', cursive;
    background-color: #121212;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #33ff66;
    text-shadow: 0 0 5px #33ff66;
    background-image: 
        radial-gradient(#33ff66 1px, transparent 1px),
        radial-gradient(#33ff66 1px, transparent 1px);
    background-size: 50px 50px;
    background-position: 0 0, 25px 25px;
    background-color: #121212;
    background-attachment: fixed;
    background-blend-mode: soft-light;
    overflow: hidden;
}

.container {
    width: 96vw;
    height: 96vh;
    padding: 0.8vw;
    background-color: rgba(0, 0, 0, 0.8);
    border: 4px solid #33ff66;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(51, 255, 102, 0.7), inset 0 0 20px rgba(51, 255, 102, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    justify-content: space-between;
}

h1 {
    text-align: center;
    margin: 0;
    padding: 0.7vh 0;
    color: #ffcc00;
    text-shadow: 0 0 15px #ffcc00;
    font-size: min(3rem, 4vw);
    letter-spacing: 3px;
    transform: rotate(-1deg);
    position: relative;
    flex-shrink: 0;
}

h1::before, h1::after {
    content: "★";
    color: #ffcc00;
    position: absolute;
    top: 0;
    font-size: 2.5rem;
    text-shadow: 0 0 15px #ffcc00;
}

h1::before {
    left: 0;
}

h1::after {
    right: 0;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1vw;
    width: 100%;
    padding: 0 1vw;
    max-height: 85vh;
}

.game-card {
    background-color: rgba(0, 0, 0, 0.7);
    border: 3px solid;
    border-radius: 8px;
    padding: 0.7vw;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 0.65;
    height: auto;
}

.game-card[data-game="bacterium"] {
    border-color: #ff5555;
    box-shadow: 0 0 15px rgba(255, 85, 85, 0.5);
}

.game-card[data-game="drunker"] {
    border-color: #55aaff;
    box-shadow: 0 0 15px rgba(85, 170, 255, 0.5);
}

.game-card[data-game="farmville"] {
    border-color: #55ff55;
    box-shadow: 0 0 15px rgba(85, 255, 85, 0.5);
}

.game-card[data-game="pokemon_clone"] {
    border-color: #ffaa55;
    box-shadow: 0 0 15px rgba(255, 170, 85, 0.5);
}

.game-card[data-game="zelduf"] {
    border-color: #aa55ff;
    box-shadow: 0 0 15px rgba(170, 85, 255, 0.5);
}

.game-card[data-game="candycrushy"] {
    border-color: #ff55aa;
    box-shadow: 0 0 15px rgba(255, 85, 170, 0.5);
}

.game-card::before {
    content: "INSERT COIN";
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-card:hover {
    transform: translateY(-10px) scale(1.05);
}

.game-card:hover::before {
    opacity: 1;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.joystick-overlay {
    position: absolute;
    width: min(30px, 3vw);
    height: min(30px, 3vw);
    bottom: 5px;
    right: 5px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    opacity: 0.3;
}

.game-card:hover .joystick-overlay {
    opacity: 0.7;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.joystick-overlay::after {
    content: '';
    position: absolute;
    width: min(15px, 1.5vw);
    height: min(15px, 1.5vw);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
}

.arcade-footer {
    text-align: center;
    font-size: min(0.7rem, 1vw);
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
    flex-shrink: 0;
    padding: 0.3vh 0;
    height: 2vh;
}

.game-card h2 {
    color: white;
    margin-bottom: min(0.3rem, 0.3vw);
    font-size: min(0.9rem, 1.2vw);
    text-shadow: 0 0 5px currentColor;
    letter-spacing: 1px;
}

.game-icon {
    font-size: min(3.5rem, 4vw);
    margin: min(0.3rem, 0.3vw) 0;
    filter: drop-shadow(0 0 6px currentColor);
    transition: transform 0.3s ease;
}

.game-card:hover .game-icon {
    transform: rotate(10deg) scale(1.2);
    animation: pulse 1.5s infinite;
}

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

/* CRT screen effect */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    opacity: 0.15;
}

body::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 2;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% { opacity: 0.27861; }
    5% { opacity: 0.34769; }
    10% { opacity: 0.23604; }
    15% { opacity: 0.90626; }
    20% { opacity: 0.18128; }
    25% { opacity: 0.83891; }
    30% { opacity: 0.65583; }
    35% { opacity: 0.67807; }
    40% { opacity: 0.26559; }
    45% { opacity: 0.84693; }
    50% { opacity: 0.96019; }
    55% { opacity: 0.08594; }
    60% { opacity: 0.20313; }
    65% { opacity: 0.71988; }
    70% { opacity: 0.53455; }
    75% { opacity: 0.37288; }
    80% { opacity: 0.71428; }
    85% { opacity: 0.70419; }
    90% { opacity: 0.7003; }
    95% { opacity: 0.36108; }
    100% { opacity: 0.24387; }
}

@media (max-width: 900px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 700px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .game-card {
        aspect-ratio: 1 / 0.6;
    }
    
    .game-icon {
        font-size: min(2.5rem, 5vw);
    }
}

@media (max-width: 550px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .container {
        padding: 6px;
        width: 98vw;
        height: 98vh;
        border-width: 2px;
    }
    
    .game-card {
        aspect-ratio: 1 / 0.6;
        padding: 6px;
        border-width: 2px;
    }
    
    .game-icon {
        font-size: min(2rem, 8vw);
        margin: 0.2rem 0;
    }
    
    .game-card h2 {
        font-size: min(0.7rem, 2vw);
        margin-bottom: 0.2rem;
        letter-spacing: 0;
    }
    
    h1 {
        font-size: min(1.8rem, 6vw);
        padding: 0.4vh 0;
        letter-spacing: 1px;
    }
}