@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');

/* --- General Styles --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: center;
    transition: background-color 0.3s, color 0.3s;
}

/* --- Thème Sombre (inspiré de l'image) --- */
body.dark-theme {
    background-color: #2c3e50;
    color: #ecf0f1;
}

.dark-theme h1 {
    color: #ecf0f1;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 1px solid #34495e;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.dark-theme #config-panel {
    background-color: #34495e;
    border: 1px solid #4a627a;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.dark-theme .dropdown-btn {
    background: linear-gradient(to bottom, #566f8a, #4a627a);
    color: #ecf0f1;
    border-color: #4a627a;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.dark-theme .dropdown-btn:hover {
    background: linear-gradient(to bottom, #67809f, #5a738f);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.dark-theme .dropdown-content {
    background-color: #34495e;
    border-color: #4a627a;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.3);
}

.dark-theme .dropdown-content a {
    color: #ecf0f1;
}

.dark-theme .dropdown-content a:hover {
    background-color: #4a627a;
}

.dark-theme #game {
    background-color: #2c3e50;
    border-color: #4a627a;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.dark-theme .cell {
    background: linear-gradient(to bottom, #4a627a, #34495e);
    border-color: #2c3e50;
    color: #ecf0f1;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.dark-theme .cell:not(.revealed):hover {
    border-color: #5dade2;
}

.dark-theme .cell.revealed {
    background: #2c3e50;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
}

.dark-theme .cell.bomb {
    background: #c0392b;
}

/* --- Thème Clair --- */
body.light-theme {
    background-color: #ecf0f1;
    color: #2c3e50;
}

.light-theme h1 {
    color: #2c3e50;
    border-bottom-color: #bdc3c7;
}

.light-theme #config-panel {
    background-color: #ffffff;
    border-color: #bdc3c7;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.light-theme .dropdown-btn {
    background: linear-gradient(to bottom, #fdfdfd, #f1f1f1);
    color: #2c3e50;
    border-color: #bdc3c7;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.light-theme .dropdown-btn:hover {
    background: linear-gradient(to bottom, #ffffff, #f5f5f5);
    border-color: #3498db;
}

.light-theme .dropdown-content {
    background-color: #ffffff;
    border-color: #bdc3c7;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.1);
}

.light-theme .dropdown-content a {
    color: #2c3e50;
}

.light-theme .dropdown-content a:hover {
    background-color: #ecf0f1;
}

.light-theme #game {
    background-color: #bdc3c7;
    border-color: #95a5a6;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}

.light-theme .cell {
    background: linear-gradient(to bottom, #ffffff, #e8e8e8);
    border-color: #bdc3c7;
    color: #2c3e50;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

.light-theme .cell:not(.revealed):hover {
    border-color: #3498db;
}

.light-theme .cell.revealed {
    background: #ecf0f1;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.light-theme .cell.bomb {
    background: #e74c3c;
}


/* --- Styles Communs --- */
#config-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 10px 20px;
    border-radius: 8px;
}

#action-group {
    display: flex;
    gap: 10px;
}

#info-panel {
    display: flex;
    gap: 25px;
    align-items: center;
}

#info-panel > div {
    display: flex;
    flex-direction: column;
}

#info-panel .counter-value {
    font-family: 'Orbitron', sans-serif;
    background-color: #000;
    color: #e74c3c;
    padding: 5px 10px;
    border-radius: 5px;
    border: 2px solid #444;
    font-size: 1.5em;
    letter-spacing: 2px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}

.dropdown-btn {
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    min-width: 160px;
    text-align: left;
}

.dropdown-btn:hover {
    transform: translateY(-2px);
}

.dropdown-content {
    display: none;
    position: absolute;
    min-width: 160px;
    z-index: 1;
    border-radius: 5px;
    padding: 5px 0;
}

.dropdown-content a {
    padding: 10px 20px;
    text-decoration: none;
    display: block;
    text-align: left;
}

.show {
    display: block;
}

#game {
    display: inline-grid;
    grid-template-columns: repeat(var(--taille-grille, 10), 40px);
    grid-gap: 5px;
    justify-content: center;
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
}

.cell {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 22px;
    font-weight: bold;
    user-select: none;
    transition: all 0.2s ease;
}

.cell:not(.revealed):hover {
    transform: scale(1.05);
}

.cell.revealed {
    cursor: default;
}

.cell.bomb {
    color: white;
    animation: explode 0.5s forwards;
}

@keyframes explode {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.cell.bomb::after {
    content: '💣';
}

.cell.flag::after {
    content: '🚩';
    font-size: 22px;
}

.cell[data-mines="1"] { color: #3498db; }
.cell[data-mines="2"] { color: #2ecc71; }
.cell[data-mines="3"] { color: #e74c3c; }
.cell[data-mines="4"] { color: #9b59b6; }
.cell[data-mines="5"] { color: #f1c40f; }
.cell[data-mines="6"] { color: #e67e22; }
.cell[data-mines="7"] { color: #1abc9c; }
.cell[data-mines="8"] { color: #ecf0f1; }