/* ================================
   TETRIS - Styles spécifiques
   ================================ */

body.page-jeux { background: #0d0d1a; }

.container-tetris {
    max-width: 1200px;
    margin: 10px auto;
    padding: 0 15px;
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    gap: 15px;
    align-items: start;
    position: relative;
}

/* SCORES */
.scores-tetris {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.score-tetris-box  { background: linear-gradient(135deg, #ff2df7, #a855f7); grid-column: 1 / -1; }
.score-lignes-box  { background: #39ff14; color: #0a0a1a !important; }
.score-lignes-box .score-label,
.score-lignes-box .score-valeur { color: #0a0a1a !important; }
.score-niveau-box  { background: #ff8c00; }
.score-temps-box   { background: #00f5ff; color: #0a0a1a !important; }
.score-temps-box .score-label,
.score-temps-box .score-valeur { color: #0a0a1a !important; }

/* PIÈCE SUIVANTE */
.next-piece-container {
    background: #0a0a1a;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 8px;
    text-align: center;
    margin-top: 4px;
}

.next-piece-label {
    font-size: 0.72em;
    color: #888;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#canvas-next {
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

/* BOUTONS */
.boutons-tetris {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.btn-pause-tetris {
    width: 100%;
    background: #333;
    color: #ccc;
    border: none;
    padding: 9px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: background 0.2s;
}
.btn-pause-tetris:hover { background: #444; }

/* INSTRUCTIONS */
.container-tetris .instructions-2048 {
    color: #666;
    font-size: 0.72em;
}

/* ================================
   CANVAS WRAPPER
   ================================ */
.colonne-centrale-tetris {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.canvas-wrapper {
    border: 3px solid #222;
    border-radius: 4px;
    box-shadow:
        0 0 20px rgba(255, 45, 247, 0.3),
        0 0 40px rgba(0, 245, 255, 0.15),
        inset 0 0 20px rgba(0,0,0,0.5);
    line-height: 0;
    position: relative;
}

#canvas-tetris {
    display: block;
    border-radius: 2px;
}

/* Flash lors d'une ligne effacée */
@keyframes flash-ligne {
    0%   { filter: brightness(1); }
    50%  { filter: brightness(2.5); }
    100% { filter: brightness(1); }
}

#canvas-tetris.flash-ligne {
    animation: flash-ligne 0.15s ease;
}

/* ================================
   CONTRÔLES MOBILES
   ================================ */
.controles-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    width: 100%;
}

.ctrl-ligne {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.ctrl-btn {
    width: 60px;
    height: 52px;
    background: #1a1a2e;
    border: 2px solid #333;
    border-radius: 10px;
    color: #fff;
    font-size: 1.3em;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.1s, transform 0.1s;
    user-select: none;
    -webkit-user-select: none;
}

.ctrl-btn:active {
    background: #ff2df7;
    transform: scale(0.93);
}

.ctrl-rot {
    background: #a855f7;
    border-color: #a855f7;
    width: 60px;
}

.ctrl-bas {
    background: #1a1a2e;
}

.ctrl-chute {
    width: 140px;
    font-size: 0.9em;
    background: linear-gradient(135deg, #ff2df7, #a855f7);
    border-color: #ff2df7;
}

/* ================================
   OVERRIDE COULEURS POUR FOND SOMBRE
   ================================ */
.container-tetris .colonne-gauche {
    background: #12122a;
    border-radius: 14px;
    padding: 12px;
}

.container-tetris .defi-box {
    background: #1a1a35;
    border: 1px solid #333;
}

.container-tetris .defi-titre,
.container-tetris .defi-label,
.container-tetris .niveau-label,
.container-tetris .instructions-2048 p {
    color: #aaa;
}

.container-tetris .separateur span {
    background: #12122a;
    color: #555;
}

.container-tetris .separateur {
    border-color: #333;
}

.container-tetris .btn-niveau {
    background: #1a1a35;
    color: #aaa;
    border: 1px solid #333;
}

.container-tetris .btn-niveau.actif {
    background: linear-gradient(135deg, #ff2df7, #a855f7);
    color: white;
    border-color: transparent;
}

.container-tetris .colonne-classement {
    background: #12122a;
    border-radius: 14px;
    padding: 12px;
}

.container-tetris .colonne-classement h3 {
    color: #ff2df7;
}

.container-tetris .classement-ligne {
    color: #ccc;
    border-bottom-color: #222;
}

.container-tetris .classement-moi {
    background: rgba(255,45,247,0.15);
    color: #ff2df7;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .container-tetris { grid-template-columns: 160px 1fr 160px; gap: 8px; }
}

@media (max-width: 768px) {
    .container-tetris { grid-template-columns: 1fr; }
    .colonne-classement { order: 3; }
    .controles-mobile { display: flex !important; }
}