/* Game Portal Styles */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.game-card {
    background-color: var(--control-panel-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.3s ease;
    text-decoration: none;
    color: inherit;
    box-sizing: border-box;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background-color: var(--control-panel-color);
}

.game-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.game-title {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: var(--counter-color);
}

.game-description {
    color: var(--subtext-color);
    font-size: 0.9em;
}

/* Memory Game Specific Styles */
.memory-game {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 600px;
    margin: 20px auto;
}

.memory-game .card {
    aspect-ratio: 1;
    background-color: rgb(0, 25, 20);
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    min-height: 100px;
    transform-style: preserve-3d;
    position: relative;
    color: white;
}

.memory-game .card.flipped {
    transform: rotateY(180deg);
    background-color: var(--accent-color);
}

.memory-game .game-info {
    text-align: center;
    margin: 20px 0;
}

.memory-game .back-button {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    background-color: var(--accent-color);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.memory-game .back-button:hover {
    background-color: var(--counter-color);
}

/* Life Game Styles */
.life-game {
    display: grid;
    gap: 0;
    background-color: var(--background-color);
    padding: 0;
    border-radius: 0;
    margin: 20px auto;
    max-width: 800px;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    position: relative;
    border: 1px solid var(--counter-color);
    box-sizing: border-box;
    outline: 1px solid var(--counter-color);
}

.life-cell {
    background-color: var(--background-color);
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: background-color 0.2s;
    position: absolute;
    box-sizing: border-box;
}

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

.controls {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background-color: var(--control-panel-color);
    border-radius: 4px;
    border: 1px solid var(--counter-color);
    box-sizing: border-box;
    width: 100%;
}

.control-group {
    margin-bottom: 15px;
    width: 100%;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--counter-color);
    font-size: 0.9em;
}

.control-group input[type="range"] {
    width: 100%;
    margin: 5px 0;
    background-color: var(--background-color);
    border: 1px solid var(--counter-color);
    border-radius: 2px;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.button-group button {
    padding: 8px 16px;
    background-color: var(--counter-color);
    color: var(--text-color);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    flex: 1;
    min-width: 100px;
    font-size: 0.9em;
}

.button-group button:hover {
    background-color: var(--accent-color);
}

.button-group button#clear-btn {
    background-color: var(--background-color);
    border: 1px solid var(--counter-color);
    color: var(--counter-color);
}

.button-group button#clear-btn:hover {
    background-color: var(--counter-color);
    color: var(--text-color);
}

/* モバイル対応のメディアクエリ */
@media screen and (max-width: 600px) {
    .games-grid {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .game-card {
        padding: 15px;
    }

    .game-icon {
        font-size: 36px;
    }

    .game-title {
        font-size: 1.2em;
    }

    .game-description {
        font-size: 0.8em;
    }

    .controls {
        padding: 15px;
        margin: 15px auto;
    }

    .control-group label {
        font-size: 0.8em;
    }

    .button-group button {
        padding: 6px 12px;
        font-size: 0.8em;
    }

    .life-game {
        margin: 15px auto;
    }
}