/* ============================================
   DEMINOO.CSS — Démineur quotidien (grille 13x13, 28 mines)
   Dépend de common.css (chargé avant ce fichier)
   ============================================ */

.stat-badge .stat-badge-icon {
    font-size: 1.2em;
}

#mines-left {
    color: #ef5350;
}

.deminoo-grid {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    grid-template-rows: repeat(13, 1fr);
    gap: 2px;
    width: min(100%, 440px);
    aspect-ratio: 1 / 1;
    margin: 10px auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 5px;
    box-sizing: border-box;
    box-shadow: 0 8px 22px rgba(102, 126, 234, 0.35);
}

.deminoo-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    /* case encore à jouer : blanche avec un léger relief */
    background: linear-gradient(135deg, #ffffff 0%, #eef1ff 100%);
    box-shadow: inset 0 -2px 0 rgba(102, 126, 234, 0.28);
    border-radius: 4px;
    font-size: 1em;
    font-weight: 800;
    color: #333;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    transition: background 0.15s ease, transform 0.1s ease;
    animation: deminooCellIn 0.35s ease backwards;
}

@keyframes deminooCellIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.deminoo-cell:not(.revealed):hover {
    background: linear-gradient(135deg, #eef0ff 0%, #dfe4ff 100%);
}

/* case déjà révélée (sûre, plus cliquable) : grisée et plate */
.deminoo-cell.revealed {
    background: #dcdfe8;
    cursor: default;
    box-shadow: none;
}

.deminoo-cell.flagged {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.deminoo-cell.mine {
    background: linear-gradient(135deg, #ffcdd2 0%, #ef9a9a 100%);
}

.deminoo-cell.mine.exploded {
    background: linear-gradient(135deg, #ef5350 0%, #d32f2f 100%);
}

.deminoo-cell.n1 { color: #2565e8; }
.deminoo-cell.n2 { color: #388e3c; }
.deminoo-cell.n3 { color: #e53935; }
.deminoo-cell.n4 { color: #5e35b1; }
.deminoo-cell.n5 { color: #8d4e2a; }
.deminoo-cell.n6 { color: #00897b; }
.deminoo-cell.n7 { color: #333333; }
.deminoo-cell.n8 { color: #4a4a4a; }

/* Mode drapeau : grille orange qui pulse, cases teintées, bouton orange vif */
.deminoo-grid {
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.deminoo-grid.flag-mode {
    background: linear-gradient(135deg, #ff9800 0%, #e53935 100%);
    animation: deminooFlagPulse 1.4s ease-in-out infinite;
}

@keyframes deminooFlagPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 112, 67, 0.55), 0 8px 22px rgba(229, 57, 53, 0.35); }
    50% { box-shadow: 0 0 0 7px rgba(255, 112, 67, 0), 0 8px 22px rgba(229, 57, 53, 0.35); }
}

.deminoo-grid.flag-mode .deminoo-cell:not(.revealed):not(.flagged) {
    background: linear-gradient(135deg, #fff8f0 0%, #ffe9d6 100%);
}

.deminoo-flag-toggle.active,
.deminoo-flag-toggle.active:hover {
    background: linear-gradient(135deg, #ff9800 0%, #e53935 100%);
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.35), 0 4px 14px rgba(229, 57, 53, 0.45);
}

/* Modale de résultat */
.deminoo-result-content {
    max-width: 460px;
    text-align: center;
}

.deminoo-result-content h2.perfect {
    color: #43a047;
}

.deminoo-result-content h2.lost {
    color: #ef5350;
}

#submit-deminoo-score-btn,
#replay-early-deminoo-btn {
    width: 100%;
    margin-bottom: 10px;
}

#skip-deminoo-score-btn {
    width: 100%;
}

@media screen and (max-width: 480px) {
    .deminoo-cell {
        font-size: 0.72em;
        border-radius: 3px;
    }
}

@media screen and (max-height: 720px) {
    .deminoo-grid {
        /* la grille rétrécit avec la hauteur d'écran pour garder les boutons visibles */
        width: min(100%, 350px, calc(100svh - 255px)) !important;
        margin: 6px auto !important;
    }
}
