/* ==========================================================================
   General Body Styles
   ========================================================================== */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    color: #e0e0e0;
}

/* ==========================================================================
   Memory Game Container
   ========================================================================== */
.memory-game {
    width: 100%;
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    top: unset;
    left: unset;
    overflow: visible;
    z-index: 1;
}

/* ==========================================================================
   Content Area
   ========================================================================== */
.memory-game .content {
    width: 80vw;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    box-sizing: border-box;
}

/* ==========================================================================
   Grid Layout (Responsive)
   ========================================================================== */
.memory-game .grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 440px;
    background: #222;
    padding: 10px;
    border: 2px solid #333;
    border-radius: 8px;
    box-sizing: border-box;
}

.memory-game .box {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #333;
    border: 2px solid #444;
    border-radius: 5px;
    cursor: default;
    transition: background 0.3s;
    box-sizing: border-box;
}

.memory-game .box.clickable {
    cursor: pointer;
}

.memory-game .box.showing {
    background: #0088ff;
}

.memory-game .box.active {
    background: #00ff00;
}

/* ==========================================================================
   Results Display
   ========================================================================== */
.memory-game .results-display {
    font-size: 0.9rem;
    color: #e0e0e0;
    background: rgba(30, 30, 30, 0.95);
    padding: 6px 12px;
    border-radius: 5px;
    display: flex;
    gap: 15px;
    box-sizing: border-box;
}

.memory-game .results-display span {
    font-weight: bold;
    color: #00ff00;
}

/* ==========================================================================
   Menu
   ========================================================================== */
.memory-game .menu {
    position: absolute;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    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);
    box-sizing: border-box;
    max-width: calc(100vw - 20px);
}

.memory-game .menu-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
}

.memory-game .menu button {
    padding: 8px 12px;
    background: #333;
    color: #e0e0e0;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
    width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
}

.memory-game .menu button:hover {
    background: #555;
}

/* ==========================================================================
   Stats Display
   ========================================================================== */
.memory-game .stats-display {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: #e0e0e0;
}

.memory-game .stats-display h3 {
    font-size: 1rem;
    margin: 0 0 5px 0;
    color: #ffffff;
}

.memory-game .stats-display p {
    margin: 0;
    font-size: 0.9rem;
}

.memory-game .stats-display span {
    font-weight: bold;
    color: #00ff00;
}

.memory-game .stats-display button {
    margin-top: 5px;
    box-sizing: border-box;
}

/* ==========================================================================
   Mobile Responsiveness
   ========================================================================== */
@media (max-width: 500px) {
    .memory-game .content {
        width: 95vw;
        gap: 15px;
        padding: 10px;
        box-sizing: border-box;
    }

    .memory-game .grid {
        max-width: 95vw;
        gap: 6px;
        padding: 6px;
        box-sizing: border-box;
    }

    .memory-game .box {
        border-width: 1px;
    }

    .memory-game .results-display {
        font-size: 0.8rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .memory-game .menu {
        position: fixed;
        top: auto;
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        width: 90vw;
        max-width: 100vw;
        max-height: 40vh;
        overflow-y: auto;
        flex-direction: column;
        padding: 10px;
        gap: 10px;
        box-sizing: border-box;
        overflow-wrap: break-word;
    }

    .memory-game .menu-section {
        width: 100%;
    }

    .memory-game .menu button {
        font-size: 0.8rem;
        padding: 6px 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .memory-game .stats-display h3 {
        font-size: 0.9rem;
    }

    .memory-game .stats-display p {
        font-size: 0.8rem;
    }
}
