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

body {
    margin: 0;
    height: 100vh;
    overflow: hidden;
    background: #000;
    font-family: 'Press Start 2P', cursive;
    color: #FF6EC7;
    position: relative;
}

/* Effet CRT */
body::after {
    content: "";
    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: 999;
    pointer-events: none;
    animation: scanline 6s linear infinite;
}

@keyframes scanline {
    0% { background-position: 0 0; }
    100% { background-position: 0 100vh; }
}

.game-container {
    display: grid;
    grid-template-columns: minmax(300px, 1fr);
    gap: 15px;
    padding: 15px;
    margin: 0 auto;
    max-width: 100vw;
    min-height: 100vh;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .game-container {
        grid-template-columns: 300px 1fr;
        max-width: 1200px;
        gap: 20px;
        padding: 20px;
    }
}

#game-board {
    border: 4px solid #4AFF47;
    background-color: #000;
    margin: 10px auto;
    width: 90%;
    max-width: 300px;
    height: auto;
    aspect-ratio: 1/2;
    box-shadow: 0 0 20px #4AFF47;
}

/* Ancien style dupliqué supprimé */

.header-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
}

.mobile-btn {
    width: 60px;
    height: 60px;
    touch-action: manipulation;
    border: 2px solid #4AFF47;
    margin: 5px;
    transition: transform 0.1s, opacity 0.2s;
}

.mobile-btn:active {
    transform: scale(0.9);
    opacity: 0.7;
}

/* Contrôles mobiles - Mode sombre */
body.dark-mode .mobile-btn {
    border-color: #0DFF72;
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    font-size: 24px;
    padding: 0;
}

body.dark-mode .mobile-btn:active {
    background: #0DFF72;
}

@media (max-width: 768px) {
    .game-container {
        display: grid;
        grid-template-columns: 1fr 2fr 1fr;
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .left-panel {
        grid-column: 1;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    #game-board {
        grid-column: 2;
        max-width: 100%;
        height: auto;
        aspect-ratio: 1/2;
    }
    
    .right-panel {
        grid-column: 3;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .dark-mode-toggle {
        order: 1;
        margin-bottom: 1rem;
    }
    
    .controls {
        order: 2;
        margin-top: 0;
    }
    
    .score-container {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
    
    .next-piece {
        text-align: center;
        padding: 0.5rem;
    }
    
    #next-piece-preview {
        width: 100%;
        height: 100px;
    }
    
    .controls {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }
    
    .controls button:nth-child(1),
    .controls button:nth-child(2) {
        grid-column: span 2;
    }
    
    button {
        padding: 0.5rem;
        font-size: 0.7rem;
        margin: 0;
        width: 100%;
    }
    
    .mobile-controls {
        display: none;
    }
    
    .controls-info {
        grid-column: 1 / -1;
        font-size: 0.6rem;
        padding: 0.3rem;
        margin-top: 0.5rem;
    }
}

/* Mode sombre */
body.dark-mode {
    background: #111;
    color: #4AFF47;
}

body.dark-mode #game-board {
    border-color: #0DFF72;
    box-shadow: 0 0 20px #0DFF72;
}

body.dark-mode button {
    background: #1a1a1a;
    color: #0DFF72;
    border-color: #0DFF72;
    box-shadow: 0 0 10px #0DFF72;
}

body.dark-mode button:hover {
    background: #0DFF72;
    color: #000;
}

body.dark-mode .score-container {
    border-color: #0DFF72;
    box-shadow: 0 0 15px #0DFF72;
    color: #0DFF72;
}

body.dark-mode::after {
    background: linear-gradient(rgba(18, 16, 16, 0.1) 50%, rgba(0, 0, 0, 0.3) 50%),
                linear-gradient(90deg, rgba(0, 255, 18, 0.06), rgba(18, 255, 0, 0.02), rgba(0, 18, 255, 0.06));
}


.score-container {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    background: #000;
    border: 3px solid #FF6EC7;
    padding: 15px;
    text-align: center;
    box-shadow: 0 0 15px #FF6EC7;
    color: #4AFF47;
}

.next-piece {
    margin: 10px 0;
    text-align: left;
    padding-left: 0.5rem;
}

#next-piece-preview {
    margin-left: 0;
    width: 80px;
    height: 80px;
}

#next-piece-preview {
    border: 2px solid #333;
    background-color: #fff;
    width: 100px;
    height: 100px;
}

.controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

button {
    padding: 12px 24px;
    font-size: 14px;
    cursor: pointer;
    background: #000;
    color: #FF6EC7;
    border: 3px solid #4AFF47;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    box-shadow: 0 0 10px #4AFF47;
}

.controls-info {
    margin-top: 20px;
    padding: 10px;
    border: 2px solid #4AFF47;
    background: #000;
    color: #FF6EC7;
    font-size: 12px;
    line-height: 1.5;
}

.controls-info p {
    margin: 5px 0;
}

button:hover {
    color: #000;
    background: #4AFF47;
    box-shadow: 0 0 20px #4AFF47;
}

button:active {
    transform: scale(0.95);
}
