body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f5f5f5;
}

h1 {
    color: #333;
    margin-bottom: 20px;
}

.container {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 1200px;
    flex-wrap: wrap;
}

.grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 10px 20px 10px;
}

h2 {
    color: #444;
    margin-bottom: 10px;
}

.grid {
    display: grid;
    gap: 2px;
    margin-bottom: 20px;
}

.cell {
    background-color: #fff;
    border: 1px solid #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pion {
    background-color: #000;
}

.propagation {
    background-color: #666;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

button {
    padding: 10px 15px;
    font-size: 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #45a049;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.control-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
    max-width: 600px;
}

.switch-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    flex-direction: column;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin: 0 10px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.switch-label {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.grid-size-container {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

#gridSizeSelect {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 14px;
    width: 140px;
}

.info {
    margin-top: 20px;
    padding: 15px;
    background-color: #e9f7ef;
    border-radius: 5px;
    max-width: 600px;
    text-align: center;
}

.navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.navigation button {
    padding: 5px 10px;
    font-size: 14px;
}

.navigation span {
    font-weight: bold;
    min-width: 30px;
    text-align: center;
}

.stats {
    margin-top: 10px;
    font-weight: bold;
}

.ratio {
    margin-top: 15px;
    margin-bottom: 15px;
    font-size: 18px;
    color: #2196F3;
    font-weight: bold;
    background-color: #e3f2fd;
    padding: 10px 15px;
    border-radius: 5px;
    border: 1px solid #bbdefb;
}

.progress-container {
    width: 100%;
    max-width: 400px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: #2196F3;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
    max-width: 300px;
}

.slider-row {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
    margin-top: 5px;
}

.range-slider {
    width: 100%;
    margin: 10px 0;
}

/* Code couleur pour les différentes itérations */
.color-scale {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

.color-item {
    display: inline-flex;
    align-items: center;
    margin: 5px 10px;
}

.color-box {
    width: 20px;
    height: 20px;
    margin-right: 5px;
    border: 1px solid #ddd;
}

.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 2s linear infinite;
    margin: 20px auto;
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
        align-items: center;
    }
    
    .grid-container {
        margin-bottom: 30px;
    }
}
