:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --background-color: #f0f0f0;
    --text-color: #333;
    --cell-size: 15px;
    --grid-gap: 1px;
    --sidebar-width: 250px;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#game-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    width: 100vh;
    max-width: 95%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

h1 {
    text-align: center;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

#game-area {
    display: flex;
    gap: 2rem;
    flex-grow: 1;
    min-height: 0;
}

#grid-container {
    flex-grow: 1;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#grid {
    display: grid;
    gap: var(--grid-gap);
    background-color: #ccc;
    padding: var(--grid-gap);
    max-width: 100%;
    max-height: 100%;
}

#sidebar {
    width: var(--sidebar-width);
    overflow-y: auto;
}

.control-group {
    margin-bottom: 1.5rem;
}

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    background-color: white;
    transition: background-color 0.3s;
}

.cell.alive {
    background-color: var(--primary-color);
}

button {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s, transform 0.1s;
    margin-bottom: 0.5rem;
}

button:hover {
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: #45a049;
}

.secondary-btn {
    background-color: var(--secondary-color);
    color: white;
}

.secondary-btn:hover {
    background-color: #1976D2;
}

.pattern-btn {
    background-color: #FF9800;
    color: white;
}

.pattern-btn:hover {
    background-color: #F57C00;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="range"] {
    width: 100%;
}

input[type="number"] {
    width: 60px;
    height: 2em;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group .secondary-btn {
    width: auto;
}

@media (max-width: 768px) {
    #game-area {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
    }

    :root {
        --cell-size: 10px;
    }

    #game-container {
        height: auto;
        max-height: none;
    }

    #grid-container {
        height: 50vh;
    }
}