
/* ============================================================
   LIBURU — INTERFACE DU SUDOKU
   ============================================================ */

.sudoku-partie {
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    padding: 90px 16px 40px;
}

.sudoku-partie-header {
    margin-bottom: 24px;
    text-align: center;
}

.sudoku-sur-titre {
    margin-bottom: 8px;
    color: #a78bfa;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
}

.sudoku-partie-header h1 {
    font-size: clamp(27px, 5vw, 38px);
    font-weight: 800;
}

.sudoku-infos {
    margin-top: 8px;
    color: #b8bdd3;
    font-size: 14px;
}

.sudoku-infos span {
    padding: 0 6px;
    color: #8b5cf6;
}

/* CHRONOMÈTRE */

.sudoku-barre-partie {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    color: #b8bdd3;
    font-size: 14px;
}

.sudoku-barre-partie strong {
    color: #c4b5fd;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}

/* GRILLE */

.sudoku-grille {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border: 2px solid #8b5cf6;
    border-radius: 12px;
    background: #0f1223;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
}

.sudoku-case {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    padding: 0;

    border: 0;
    border-right: 1px solid #343952;
    border-bottom: 1px solid #343952;
    border-radius: 0;

    background: #191d35;
    color: #c4b5fd;

    font-family: inherit;
    font-size: clamp(15px, 4vw, 25px);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}

/* Séparation des blocs 3 × 3 */

.sudoku-case:nth-child(3n) {
    border-right: 2px solid #7770a7;
}

.sudoku-case:nth-child(9n) {
    border-right: 0;
}

.sudoku-case:nth-child(n+19):nth-child(-n+27),
.sudoku-case:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #7770a7;
}

.sudoku-case:nth-child(n+73) {
    border-bottom: 0;
}

/* Chiffres de départ */

.sudoku-case.sudoku-fixe {
    background: #252a49;
    color: #f5f5fa;
    font-weight: 800;
}

/* Sélection et cases liées */

.sudoku-case.sudoku-liee {
    background: #292448;
}

.sudoku-case.sudoku-meme-chiffre {
    background: #3b2c68;
    color: #ffffff;
}

.sudoku-case.sudoku-selectionnee {
    position: relative;
    z-index: 1;
    outline: 2px solid #a78bfa;
    outline-offset: -2px;
    background: #6d45bd;
    color: #ffffff;
}

/* Erreurs */

.sudoku-case.sudoku-erreur {
    background: #672d4a;
    color: #ffc1d5;
}

/* MESSAGE */

.sudoku-message {
    min-height: 42px;
    padding: 12px 4px;
    color: #b8bdd3;
    font-size: 14px;
    text-align: center;
}

.sudoku-message.sudoku-message-erreur {
    color: #fda4af;
}

/* PAVÉ NUMÉRIQUE */

.sudoku-numeros {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 7px;
    margin: 8px 0 18px;
}

.sudoku-numero {
    min-width: 0;
    min-height: 45px;
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 9px;
    background: #191d35;
    color: #c4b5fd;
    font-size: 19px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

.sudoku-numero:hover {
    transform: translateY(-2px);
    background: #3b2c68;
}

.sudoku-numero:disabled {
    opacity: 0.3;
    cursor: default;
    transform: none;
}

/* ACTIONS */

.sudoku-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* MESSAGES D'ERREUR DE CHARGEMENT */

.sudoku-message-erreur {
    padding: 20px;
    border: 1px solid #be123c;
    border-radius: 12px;
    background: #351626;
    color: #fecdd3;
    text-align: center;
}

/* VICTOIRE */

.sudoku-victoire[hidden] {
    display: none;
}

.sudoku-victoire {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 10, 25, 0.86);
    backdrop-filter: blur(8px);
    animation: sudoku-apparition 0.3s ease;
}

.sudoku-victoire-contenu {
    width: 100%;
    max-width: 380px;
    padding: 35px 24px;
    border: 1px solid rgba(167, 139, 250, 0.45);
    border-radius: 20px;
    background: #191d35;
    text-align: center;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.4);
}

.sudoku-victoire-icone {
    margin-bottom: 12px;
    color: #c4b5fd;
    font-size: 48px;
}

.sudoku-victoire-contenu h2 {
    margin-bottom: 12px;
    font-size: 32px;
}

.sudoku-victoire-contenu p {
    margin-bottom: 12px;
    color: #b8bdd3;
}

.sudoku-victoire-contenu .btn {
    margin-top: 15px;
}

@keyframes sudoku-apparition {
    from {
        opacity: 0;
        transform: scale(0.97);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* MOBILE */

@media (max-width: 600px) {
    .sudoku-partie {
        padding: 76px 10px 28px;
    }

    .sudoku-partie-header {
        margin-bottom: 18px;
    }

    .sudoku-grille {
        border-radius: 8px;
    }

    .sudoku-numeros {
        gap: 4px;
    }

    .sudoku-numero {
        min-height: 40px;
        border-radius: 6px;
        font-size: 17px;
    }

    .sudoku-actions {
        gap: 8px;
    }

    .sudoku-actions .btn {
        flex: 1;
        padding: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sudoku-case,
    .sudoku-numero {
        transition: none;
    }

    .sudoku-victoire {
        animation: none;
    }
}

/* ============================================================
   ERREURS : CHIFFRES EN DOUBLON
   ============================================================ */

.sudoku-case.sudoku-erreur {
    color: #ff4545;
    background: rgba(255, 55, 75, 0.16);
    box-shadow: inset 0 0 0 2px #ff4545;
    z-index: 1;
}

/* Conserver un fond d'erreur même lorsque la case est liée. */
.sudoku-case.sudoku-erreur.sudoku-liee {
    background: rgba(255, 55, 75, 0.22);
}

.sudoku-case.sudoku-erreur.sudoku-selectionnee {
    box-shadow: inset 0 0 0 3px #ff4545;
}

/* ============================================================
   NOTES AU CRAYON
   ============================================================ */

.sudoku-case {
    position: relative;
}

.sudoku-notes {
    position: absolute;
    inset: 2px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
    align-items: center;
    justify-items: center;
    pointer-events: none;
    overflow: hidden;
}

.sudoku-note {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: clamp(8px, 1.35vw, 13px);
    line-height: 1;
    color: #bcb5ff;
    font-weight: 400;
}

/* ============================================================
   BOUTON DU MODE NOTES
   ============================================================ */

.sudoku-mode-notes {
    margin-bottom: 10px;
    cursor: pointer;
}

.sudoku-mode-notes.sudoku-notes-actif {
    background: #7563d9;
    color: #fff;
    border-color: #a89bff;
    box-shadow: 0 0 0 2px rgba(168, 155, 255, 0.25);
}

.sudoku-mode-notes:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .sudoku-note {
        font-size: 9px;
    }
}


/* ============================================================
   PARTAGE DU SCORE
   ============================================================ */

.sudoku-partage {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
}

.sudoku-partage p {
    width: 100%;
    margin: 0 0 4px;
    text-align: center;
}

.sudoku-partage a {
    text-decoration: none;
    text-align: center;
}

/* ============================================================
   SUDOKU — FOND GÉNÉRAL SUR MOBILE
   ============================================================ */

@media (max-width: 600px) {
    body:has(.sudoku-partie) {
        background-color: #0f1223;
    }
}