﻿/* =========================================
   Memory Recall Challenge
   ========================================= */
.memory-game-page {
    width: 100%;
    padding: 15px 10px 25px;
}

.memory-game-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}


/* =========================================
   Header
   ========================================= */

.memory-game-header {
    text-align: center;
    margin-bottom: 12px;
}

.memory-game-icon {
    font-size: 28px;
    margin-bottom: 3px;
}

.memory-game-header h1 {
    margin: 0 0 5px;
    color: var(--bg-h1);
    font-size: 26px;
    line-height: 1.2;
}

.memory-game-header p {
    max-width: 700px;
    margin: 0 auto;
    color: #555;
    font-size: 14px;
    line-height: 1.45;
}


/* =========================================
   Setup Box
   ========================================= */

.memory-game-setup {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05);
}

    .memory-game-setup h2 {
        margin: 0 0 15px;
        text-align: center;
        color: var(--bg-h2);
        font-size: 21px;
    }


/* =========================================
   Setup Form
   ========================================= */

.memory-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.memory-form-group {
    display: flex;
    flex-direction: column;
}

    .memory-form-group label {
        font-weight: 700;
        color: #222;
        margin-bottom: 5px;
        font-size: 14px;
    }

    .memory-form-group select {
        width: 100%;
        min-height: 36px;
        padding: 6px 10px;
        border: 1px solid #ced4da;
        border-radius: 6px;
        background: #ffffff;
        color: #222;
        font-size: 14px;
        cursor: pointer;
        outline: none;
    }

        .memory-form-group select:focus {
            border-color: var(--bg-h2);
            box-shadow: 0 0 0 2px rgba(6, 95, 208, 0.10);
        }

    .memory-form-group small {
        margin-top: 3px;
        color: #777;
        font-size: 11px;
        line-height: 1.3;
    }


/* =========================================
   Information Row
   ========================================= */

.memory-game-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #eeeeee;
}

.memory-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f7faff;
    border-radius: 7px;
}

    .memory-info-item > span {
        font-size: 21px;
        flex-shrink: 0;
    }

    .memory-info-item strong {
        display: block;
        color: #222;
        font-size: 13px;
        margin-bottom: 1px;
    }

    .memory-info-item small {
        display: block;
        color: #777;
        font-size: 10px;
    }


/* =========================================
   Start Button
   ========================================= */

.memory-start-button {
    display: block;
    width: 100%;
    max-width: 280px;
    min-height: 42px;
    margin: 18px auto 0;
    padding: 9px 18px;
    border: none;
    border-radius: 7px;
    background: var(--bg-h2);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

    .memory-start-button:hover {
        background: #044da8;
        transform: translateY(-1px);
        box-shadow: 0 4px 10px rgba(6, 95, 208, 0.20);
    }

    .memory-start-button:active {
        transform: translateY(0);
    }


/* =========================================
   Game Area
   ========================================= */

.memory-game-area {
    width: 100%;
    text-align: center;
}

.memory-status {
    margin-bottom: 3px;
    color: var(--bg-h2);
    font-size: 15px;
    font-weight: 700;
}

.memory-countdown {
    min-height: 25px;
    margin-bottom: 5px;
    color: var(--bg-h1);
    font-size: 23px;
    font-weight: 800;
}


/* =========================================
   Target
   ========================================= */

.memory-target {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    padding: 7px 13px;
    max-width: 450px;
    background: #f7faff;
    border: 1px solid #dbe8f5;
    border-radius: 7px;
    color: #333;
    font-size: 15px;
}

    .memory-target strong {
        color: var(--bg-h1);
        margin-left: 5px;
    }

.memory-speak-button {
    margin-left: 5px;
    padding: 2px 5px;
    border: none;
    border-radius: 4px;
    background: transparent;
    font-size: 15px;
    cursor: pointer;
}

    .memory-speak-button:hover {
        background: #e8f2ff;
    }


/* =========================================
   Scoreboard
   ========================================= */

.memory-scoreboard {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0 auto 8px;
}

.memory-player-score {
    min-width: 100px;
    padding: 5px 12px;
    background: #f5f5f5;
    border: 2px solid #dee2e6;
    border-radius: 7px;
    text-align: center;
    transition: all 0.2s ease;
}

    .memory-player-score.active-player {
        border-color: var(--bg-h2);
        background: #eef6ff;
        box-shadow: 0 2px 7px rgba(6, 95, 208, 0.10);
    }

    .memory-player-score .player-label {
        display: inline-block;
        color: #555;
        font-size: 11px;
        font-weight: 700;
        margin-right: 5px;
    }

    .memory-player-score strong {
        display: inline-block;
        margin-top: 0;
        color: var(--bg-h2);
        font-size: 18px;
    }


/* =========================================
   Memory Grid
   ========================================= */

.memory-grid {
    display: grid;
    /*
       JavaScript automatically sets the
       number of columns according to the
       number of cards.
    */

    grid-template-columns: repeat(6, 1fr);
    gap: 7px;
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
}


/* =========================================
   Memory Card
   ========================================= */

.memory-card {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 7px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #d9e2ec;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.07);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

    .memory-card:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 9px rgba(0, 0, 0, 0.10);
    }

    .memory-card img {
        width: 100%;
        height: 100%;
        display: block;
        object-fit: contain;
        padding: 5px;
    }


    /* =========================================
   Hidden Card
   ========================================= */

    .memory-card.hidden-card {
        background: var(--bg-h2);
        border-color: var(--bg-h2);
    }

        .memory-card.hidden-card img {
            visibility: hidden;
        }

        .memory-card.hidden-card::after {
            content: "?";
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #ffffff;
            font-size: 30px;
            font-weight: 800;
        }


/* =========================================
   Back Button
   ========================================= */

.memory-secondary-button {
    display: block;
    margin: 12px auto 0;
    padding: 7px 15px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #ffffff;
    color: #444;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

    .memory-secondary-button:hover {
        background: #f5f5f5;
    }


/* =========================================
   Result
   ========================================= */

.memory-result {
    max-width: 500px;
    margin: 15px auto 0;
    padding: 18px;
    background: #f7faff;
    border: 2px solid #dbe8f5;
    border-radius: 10px;
    text-align: center;
}

    .memory-result h2 {
        margin: 0 0 10px;
        color: var(--bg-h1);
        font-size: 22px;
    }

    .memory-result .winner {
        margin-bottom: 12px;
        color: var(--bg-h2);
        font-size: 17px;
        font-weight: 700;
    }

    .memory-result .final-score {
        display: flex;
        justify-content: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    .memory-result .final-score-box {
        min-width: 110px;
        padding: 9px;
        background: #ffffff;
        border: 1px solid #d9e2ec;
        border-radius: 7px;
    }

        .memory-result .final-score-box strong {
            display: block;
            color: #555;
            font-size: 11px;
        }

        .memory-result .final-score-box span {
            display: block;
            margin-top: 2px;
            color: var(--bg-h2);
            font-size: 21px;
            font-weight: 800;
        }


/* =========================================
   Tablet
   ========================================= */

@media (max-width: 750px) {

    .memory-game-container {
        max-width: 700px;
    }

    .memory-grid {
        max-width: 560px;
        gap: 6px;
    }

    .memory-card img {
        padding: 4px;
    }
}


/* =========================================
   Small Mobile
   ========================================= */

@media (max-width: 650px) {

    .memory-grid {
        max-width: 360px;
        gap: 6px;
    }

        /* Easy: 12 cards = 3 columns × 4 rows */
        .memory-grid.easy-grid {
            grid-template-columns: repeat(3, 1fr) !important;
        }

        /* Hard: 24 cards = 4 columns × 6 rows */
        .memory-grid.hard-grid {
            grid-template-columns: repeat(4, 1fr) !important;
        }
}