/* ==========================================================================
   Game of Life Container
   ========================================================================== */
.game-of-life {
    width: 100%;
    min-height: 600px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    background-color: #181818;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    overflow: visible;
    z-index: 1;
}

/* ==========================================================================
   Game of Life Canvas
   ========================================================================== */
.game-of-life #lifeCanvas {
    width: calc(100% - 240px);
    max-width: 800px;
    height: auto;
    aspect-ratio: 1 / 1;
    max-height: 800px;
    border: 2px solid #333;
    background: #222 !important;
    border-radius: 8px;
    display: block;
    position: relative;
    margin: 0 auto 60px auto;
    cursor: pointer;
}

/* ==========================================================================
   Menu
   ========================================================================== */
.game-of-life .menu {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(30, 30, 30, 0.95);
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    max-width: 200px;
    width: auto;
}

.game-of-life .menu-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-of-life .menu button,
.game-of-life .menu select,
.game-of-life .menu input[type="number"],
.game-of-life .menu input[type="checkbox"] {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: var(--fg, #ffffff);
    font-size: 0.95rem;
    cursor: pointer;
    width: 100%;
    max-width: 150px;
    box-sizing: border-box;
    transition: background 0.2s, color 0.2s;
}

.game-of-life .menu button:hover,
.game-of-life .menu select:hover,
.game-of-life .menu input[type="number"]:hover {
    background: var(--fg, #ffffff);
    color: var(--bg, #000000);
    border-color: transparent;
}

.game-of-life .menu input[type="checkbox"]:checked {
    background: var(--fg, #ffffff);
    color: var(--bg, #000000);
    border-color: transparent;
}

.game-of-life .menu button:disabled {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
}

.game-of-life .grid-control,
.game-of-life .speed-control,
.game-of-life .pattern-control,
.game-of-life .loop-control {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
}

.game-of-life .grid-control label,
.game-of-life .speed-control label,
.game-of-life .pattern-control label,
.game-of-life .loop-control label {
    font-size: 0.9rem;
    color: var(--fg, #e0e0e0);
}

.game-of-life .menu select,
.game-of-life .menu input[type="number"] {
    background: rgba(255, 255, 255, 0.05);
    color: var(--fg, #ffffff);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-of-life .menu select:focus,
.game-of-life .menu input[type="number"]:focus {
    outline: none;
    border-color: var(--accent, #007bff);
}

.game-of-life .info-display {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    color: var(--fg, #e0e0e0);
    background: rgba(30, 30, 30, 0.95);
    padding: 6px 12px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 15px;
    z-index: 1000;
    pointer-events: none;
}

.game-of-life .info-display span {
    font-weight: bold;
    color: #00ff00;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .game-of-life {
        min-height: 500px;
        padding: 15px;
    }
    
    .game-of-life #lifeCanvas {
        width: 100%;
        max-height: 500px;
        margin: 0 auto 50px auto;
    }
    
    .game-of-life .menu {
        position: relative;
        top: 0;
        right: 0;
        max-width: 100%;
        width: 100%;
        margin-bottom: 15px;
    }
    
    .game-of-life .menu-section {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .game-of-life .grid-control,
    .game-of-life .speed-control,
    .game-of-life .pattern-control,
    .game-of-life .loop-control {
        flex: 1;
        min-width: 120px;
    }
    
    .game-of-life .info-display {
        font-size: 0.8rem;
        padding: 4px 10px;
        bottom: 10px;
        flex-direction: column;
        gap: 5px;
    }
}
