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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    touch-action: manipulation; /* Améliore la réactivité tactile */
}

.game-container {
    background: rgba(0, 0, 0, 0.9);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
}

.game-header h1 {
    font-size: 3em;
    font-weight: bold;
    background: linear-gradient(45deg, #00ff88, #00bbff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(0, 255, 136, 0.5);
}

.game-content {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 150px;
}

.info-box {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.info-box h3 {
    font-size: 0.9em;
    margin-bottom: 10px;
    color: #00ff88;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-box div {
    font-size: 1.5em;
    font-weight: bold;
    color: #fff;
}

.game-board {
    position: relative;
}

#gameCanvas {
    border: 3px solid #00ff88;
    border-radius: 5px;
    background: #111;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

#nextCanvas {
    background: #111;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 5px;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
}

.overlay-content h2 {
    font-size: 3em;
    margin-bottom: 20px;
    color: #ff6b6b;
}

.overlay-content p {
    font-size: 1.2em;
    margin-bottom: 30px;
    color: #ccc;
}

button {
    background: linear-gradient(45deg, #00ff88, #00bbff);
    border: none;
    color: #000;
    padding: 15px 40px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 5px;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 255, 136, 0.5);
}

button.hidden {
    display: none;
}

.controls {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
}

.controls h3 {
    font-size: 0.9em;
    margin-bottom: 15px;
    color: #00ff88;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.control-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85em;
}

.key {
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
    font-size: 0.9em;
}

/* Mobile Controls */
.mobile-controls {
    display: none; /* Caché par défaut sur desktop */
    margin-top: 20px;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 320px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 60px;
    height: 60px;
    font-size: 1.5em;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.1s;
    padding: 0;
    margin: 0;
}

.control-btn:active {
    background: rgba(0, 255, 136, 0.5);
    transform: scale(0.95);
}


/* Responsive Design */
@media (max-width: 768px) {
    .game-content {
        flex-direction: column;
        align-items: center;
    }
    
    .side-panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        min-width: auto;
        max-width: 320px;
        gap: 10px;
    }
    
    .info-box {
        flex: 1;
        min-width: 120px;
    }

    .controls {
        width: 100%;
        order: 1; /* Met les contrôles en bas */
    }
    
    #gameCanvas {
        width: 250px;
        height: 500px;
    }

    .mobile-controls {
        display: flex; /* Affiché sur mobile */
    }
}

/* Animation for line clear */
@keyframes lineClear {
    0% { background: rgba(255, 255, 255, 0.8); }
    100% { background: rgba(255, 255, 255, 0); }
}

.line-clear {
    animation: lineClear 0.3s ease-out;
}