#game-root .mm-shell {
    max-width: 760px;
    margin: 0 auto;
    padding: 16px;
    border: 1px solid var(--cg-line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--cg-shadow);
}

#game-root .mm-bar,
#game-root .mm-ministats,
#game-root .mm-hud,
#game-root .mm-foot,
#game-root .mm-panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#game-root .mm-bar {
    justify-content: space-between;
    margin-bottom: 10px;
}

#game-root .mm-mini,
#game-root .mm-stat {
    padding: 7px 10px;
    border: 1px solid var(--cg-line);
    border-radius: 8px;
    background: #f8faf8;
    text-align: center;
}

#game-root .mm-mini span,
#game-root .mm-stat span {
    display: block;
    color: var(--cg-muted);
    font-size: 0.67rem;
    font-weight: 800;
    text-transform: uppercase;
}

#game-root .mm-mini strong,
#game-root .mm-stat strong {
    display: block;
    margin-top: 2px;
    font-size: 0.98rem;
}

#game-root .mm-hud {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    margin-bottom: 10px;
}

#game-root .mm-btn,
#game-root .mm-icon {
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid #bbc8c3;
    border-radius: 8px;
    background: #fff;
    color: var(--cg-ink);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

#game-root .mm-icon {
    min-width: 48px;
    padding: 6px;
}

#game-root .mm-btn:hover,
#game-root .mm-btn:focus-visible,
#game-root .mm-icon:hover,
#game-root .mm-icon:focus-visible {
    border-color: var(--cg-teal);
    outline: none;
}

#game-root .mm-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

#game-root .mm-primary {
    border-color: var(--cg-green);
    background: var(--cg-green);
    color: #fff;
}

#game-root .mm-status {
    min-height: 22px;
    margin-bottom: 9px;
    color: var(--cg-muted);
    text-align: center;
    font-size: 0.84rem;
}

#game-root .mm-board-wrap {
    position: relative;
    min-height: 320px;
    padding: 12px;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(145deg, #e6f1ed, #edf1f7);
}

#game-root .mm-board {
    display: grid;
    grid-template-columns: repeat(var(--mm-cols), minmax(54px, 90px));
    justify-content: center;
    gap: 10px;
    outline: none;
}

#game-root .mm-card {
    aspect-ratio: 0.78;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    perspective: 700px;
    cursor: pointer;
}

#game-root .mm-in {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.28s ease;
}

#game-root .mm-flip .mm-in {
    transform: rotateY(180deg);
}

#game-root .mm-face {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border: 2px solid rgba(30, 37, 40, 0.18);
    border-radius: 10px;
    backface-visibility: hidden;
    box-shadow: 0 5px 12px rgba(33, 43, 40, 0.16);
}

#game-root .mm-back {
    background: linear-gradient(145deg, #176d74, #25528c);
}

#game-root .mm-back::after {
    content: "";
    width: 34%;
    aspect-ratio: 1;
    border: 3px solid rgba(255, 255, 255, 0.72);
    border-radius: 50%;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.12);
}

#game-root .mm-front {
    transform: rotateY(180deg);
    color: #fff;
    font-size: clamp(1.1rem, 4vw, 2rem);
    font-weight: 900;
}

#game-root .mm-c0 { background: #1d7f62; }
#game-root .mm-c1 { background: #315f9d; }
#game-root .mm-c2 { background: #bd3c37; }
#game-root .mm-c3 { background: #7a4f9d; }
#game-root .mm-c4 { background: #c47a17; }
#game-root .mm-c5 { background: #127a89; }
#game-root .mm-c6 { background: #b65371; }
#game-root .mm-c7 { background: #596864; }

#game-root .mm-card.mm-cursor {
    outline: 3px solid var(--cg-amber);
    outline-offset: 3px;
}

#game-root .mm-matched {
    animation: mm-match 0.35s ease;
}

#game-root .mm-matched .mm-front {
    border-color: #fff;
    box-shadow: 0 0 0 3px #52a884, 0 5px 12px rgba(33, 43, 40, 0.16);
}

@keyframes mm-match {
    50% { transform: scale(1.06); }
}

#game-root .mm-banner {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(20, 31, 29, 0.56);
}

#game-root .mm-banner[hidden] {
    display: none;
}

#game-root .mm-panel {
    width: min(380px, 100%);
    padding: 20px;
    border-radius: 12px;
    background: #fff;
    text-align: center;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

#game-root .mm-panel h2 {
    margin: 0 0 6px;
}

#game-root .mm-panel p {
    margin: 0 0 14px;
    color: var(--cg-muted);
    line-height: 1.45;
}

#game-root .mm-panel-actions,
#game-root .mm-foot {
    justify-content: center;
}

#game-root .mm-foot {
    margin-top: 10px;
}

@media (max-width: 600px) {
    #game-root .mm-shell {
        padding: 10px;
    }

    #game-root .mm-bar {
        flex-wrap: wrap;
    }

    #game-root .mm-ministats {
        order: -1;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    #game-root .mm-hud {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    #game-root .mm-board-wrap {
        min-height: 280px;
        padding: 8px 5px;
    }

    #game-root .mm-board {
        grid-template-columns: repeat(var(--mm-cols), minmax(0, 1fr));
        gap: 6px;
    }

    #game-root .mm-face {
        border-radius: 7px;
    }

    #game-root .mm-panel-actions {
        align-items: stretch;
        flex-direction: column;
    }
}
