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

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

body {
    font-family: 'Press Start 2P', 'Courier New', monospace;
    background: #0a0a0a;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3), transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(255, 119, 168, 0.3), transparent 50%),
        radial-gradient(circle at 50% 100%, rgba(255, 204, 0, 0.2), transparent 50%);
    animation: pulse 4s ease-in-out infinite;
    pointer-events: none;
}

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

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 255, 255, 0.03) 2px,
        rgba(255, 255, 255, 0.03) 4px
    );
    pointer-events: none;
    z-index: 100;
}

.main-container {
    display: flex;
    gap: 2rem;
    max-width: 1400px;
    width: 95%;
    align-items: flex-start;
}

.game-container {
    background: rgba(13, 17, 23, 0.98);
    border-radius: 0;
    padding: 2rem;
    flex: 1;
    box-shadow: 
        0 0 50px rgba(248, 93, 127, 0.5),
        inset 0 0 30px rgba(120, 119, 198, 0.1);
    border: 3px solid #F85D7F;
    position: relative;
    image-rendering: pixelated;
    animation: glitchBorder 10s infinite;
}

@keyframes glitchBorder {
    0%, 100% { border-color: #F85D7F; }
    33% { border-color: #F8D866; }
    66% { border-color: #00FF00; }
}

.snake-section {
    background: rgba(13, 17, 23, 0.98);
    border: 3px solid #00FF00;
    padding: 1.5rem;
    box-shadow: 
        0 0 50px rgba(0, 255, 0, 0.3),
        inset 0 0 30px rgba(0, 255, 0, 0.1);
    position: relative;
}

h1 {
    color: #F85D7F;
    text-align: center;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    text-shadow: 
        0 0 10px rgba(248, 93, 127, 0.8),
        0 0 20px rgba(248, 93, 127, 0.6),
        0 0 30px rgba(248, 93, 127, 0.4);
    animation: textGlitch 3s infinite;
    letter-spacing: 2px;
}

@keyframes textGlitch {
    0%, 100% { 
        text-shadow: 
            0 0 10px rgba(248, 93, 127, 0.8),
            0 0 20px rgba(248, 93, 127, 0.6),
            0 0 30px rgba(248, 93, 127, 0.4);
    }
    50% { 
        text-shadow: 
            2px 2px 0 rgba(0, 255, 255, 0.8),
            -2px -2px 0 rgba(255, 0, 255, 0.8),
            0 0 20px rgba(248, 93, 127, 0.6);
    }
}

.subtitle {
    color: #F8D866;
    text-align: center;
    font-size: 0.8rem;
    margin-bottom: 2rem;
    animation: blink 1s step-end infinite;
    letter-spacing: 1px;
}

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

.links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.game-button {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #00FF00;
    padding: 0.8rem 1rem;
    text-decoration: none;
    border: 2px solid #00FF00;
    font-size: 0.6rem;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.game-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 0, 0.4), transparent);
    transition: left 0.5s;
}

.game-button:hover::before {
    left: 100%;
}

.game-button:hover {
    transform: scale(1.05);
    box-shadow: 
        0 0 20px rgba(0, 255, 0, 0.6),
        inset 0 0 20px rgba(0, 255, 0, 0.1);
    background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
    color: #F8D866;
    border-color: #F8D866;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, rgba(248, 93, 127, 0.1), rgba(120, 119, 198, 0.1));
    border: 2px solid #F85D7F;
    padding: 1rem;
    text-align: center;
    position: relative;
    clip-path: polygon(
        0 0,
        calc(100% - 10px) 0,
        100% 10px,
        100% 100%,
        10px 100%,
        0 calc(100% - 10px)
    );
}

.stat-card:hover {
    background: linear-gradient(135deg, rgba(248, 93, 127, 0.2), rgba(120, 119, 198, 0.2));
    box-shadow: 0 0 20px rgba(248, 93, 127, 0.5);
}

.stat-value {
    color: #F8D866;
    font-size: 1rem;
    font-weight: bold;
    text-shadow: 0 0 10px currentColor;
}

.stat-label {
    color: #a0a0a0;
    font-size: 0.5rem;
    margin-top: 0.5rem;
    text-transform: uppercase;
}

.snake-game-container {
    text-align: center;
}

.snake-title {
    color: #00FF00;
    font-size: 1rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
}

#gameCanvas {
    border: 2px solid #00FF00;
    background: #0a0f0a;
    box-shadow: 
        0 0 30px rgba(0, 255, 0, 0.3),
        inset 0 0 30px rgba(0, 255, 0, 0.05);
    image-rendering: pixelated;
}

.game-controls {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.control-button {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #00FF00;
    border: 2px solid #00FF00;
    padding: 0.8rem 2rem;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
}

.control-button:hover {
    background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.6);
    transform: scale(1.05);
}

.control-button:active {
    transform: scale(0.95);
}

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1rem;
    font-size: 0.7rem;
}

.score, .high-score {
    color: #F8D866;
    text-shadow: 0 0 5px currentColor;
}

.instructions {
    color: #a0a0a0;
    font-size: 0.5rem;
    margin-top: 1rem;
    line-height: 1.5;
}

.pixel-art-decoration {
    position: absolute;
    width: 30px;
    height: 30px;
    background: linear-gradient(45deg, #F85D7F 25%, transparent 25%, transparent 75%, #F85D7F 75%, #F85D7F),
                linear-gradient(45deg, #F85D7F 25%, transparent 25%, transparent 75%, #F85D7F 75%, #F85D7F);
    background-size: 10px 10px;
    background-position: 0 0, 5px 5px;
    opacity: 0.5;
}

.pixel-art-decoration.top-left {
    top: -15px;
    left: -15px;
}

.pixel-art-decoration.bottom-right {
    bottom: -15px;
    right: -15px;
    transform: rotate(180deg);
}

.loading-text {
    color: #F8D866;
    text-align: center;
    margin-top: 1rem;
    font-size: 0.6rem;
    animation: pulse 2s infinite;
}

@media (max-width: 900px) {
    .main-container {
        flex-direction: column;
        align-items: center;
    }
    
    .snake-section {
        width: 100%;
        max-width: 500px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.7rem;
    }
}

@media (max-width: 600px) {
    .game-container, .snake-section {
        padding: 1.5rem 1rem;
    }
    
    h1 {
        font-size: 1.2rem;
    }
    
    .game-button {
        font-size: 0.5rem;
        padding: 0.6rem 0.8rem;
    }
}