:root{--mg-blue:#2563eb;--mg-blue-dark:#1d4ed8;--mg-page:#eef4ff;--mg-card:#fff;--mg-text:#14213d;--mg-muted:#6b7280;--mg-line:#dbe4f1;--mg-green:#16a34a;--mg-red:#dc2626;--mg-shadow:0 18px 48px rgba(49,76,123,.16)}
*{box-sizing:border-box}.mg-manager-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:20px}.mg-manager-head h2{margin:4px 0}.mg-manager-head p{margin:5px 0;color:var(--mg-muted)}.mg-manager-search{display:flex;gap:10px;margin-bottom:18px}.mg-manager-search input{width:min(470px,100%);padding:11px 13px;border:1px solid var(--mg-line);border-radius:12px;background:#fff}.mg-set-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(310px,1fr));gap:16px}.mg-set-card{display:grid;grid-template-columns:56px 1fr auto;gap:14px;align-items:center;padding:18px;border:1px solid var(--mg-line);border-radius:16px;background:#fff}.mg-set-card-icon{display:grid;width:52px;height:52px;place-items:center;border-radius:14px;background:#eef4ff;font-size:25px}.mg-set-card h3{margin:0 0 5px}.mg-set-card p{min-height:19px;margin:0 0 8px;color:var(--mg-muted);font-size:13px}.mg-set-card span{font-size:12px;font-weight:700;color:var(--mg-blue)}.mg-empty{grid-column:1/-1;padding:48px 24px;border:1px solid var(--mg-line);border-radius:18px;background:#fff;text-align:center}.mg-empty-icon{font-size:48px}
.mg-play-body{min-height:100dvh;margin:0;color:var(--mg-text);background:var(--mg-page);font-family:Arial,sans-serif}.mg-game-shell{width:min(100%,580px);min-height:100dvh;margin:0 auto;padding:14px 14px 22px}.mg-game-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.mg-game-header span{font-size:10px;font-weight:800;letter-spacing:.12em;text-transform:uppercase}.mg-game-header h1{margin:3px 0 0;font-size:24px}.mg-game-header>a{display:grid;width:38px;height:38px;place-items:center;border-radius:11px;color:var(--mg-text);background:#fff;text-decoration:none}.mg-scorebar{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:9px}.mg-scorebar>div{padding:10px;border-radius:12px;background:#fff;text-align:center}.mg-scorebar small{display:block;color:var(--mg-muted);font-size:10px;text-transform:uppercase}.mg-scorebar strong{display:block;margin-top:3px;font-size:18px}.mg-progress{height:7px;overflow:hidden;border-radius:999px;background:#d6e2f3}.mg-progress i{display:block;width:0;height:100%;border-radius:inherit;background:var(--mg-blue);transition:width .25s ease}.mg-instruction{min-height:20px;margin:10px 0;color:#43516b;font-size:13px;font-weight:700;text-align:center}
.mg-board{display:grid;grid-template-columns:repeat(var(--matching-columns,3),minmax(0,1fr));gap:9px;align-content:start;justify-content:center;margin-inline:auto}.mg-match-card{position:relative;width:100%;height:104px;min-width:0;border:2px solid transparent;border-radius:15px;background:#fff;box-shadow:0 5px 17px rgba(49,76,123,.08);cursor:pointer;transition:transform .15s,border-color .15s,background .15s,opacity .15s}.mg-image-card{display:grid;place-items:center;padding:5px;overflow:hidden;color:var(--mg-blue);font-size:32px;font-weight:900}.mg-image-card img{display:block;width:100%;height:100%;object-fit:contain}.mg-word-card{padding:7px;color:var(--mg-text);font-size:clamp(15px,2.2vw,21px);overflow-wrap:anywhere}.mg-word-card strong{display:block}.mg-match-card.selected{border-color:var(--mg-blue);background:#eff6ff;transform:scale(1.025)}.mg-match-card.correct{border-color:var(--mg-green);background:#ecfdf3}.mg-match-card.wrong{border-color:var(--mg-red);background:#fef2f2;animation:mg-shake .28s}.mg-match-card.matched{opacity:.18;pointer-events:none;transform:scale(.96)}@keyframes mg-shake{25%{transform:translateX(-5px)}75%{transform:translateX(5px)}}.mg-game-footer{display:flex;justify-content:center;gap:10px;margin-top:12px}.mg-game-footer button{width:min(250px,100%);min-height:48px;border:1px solid var(--mg-blue);border-radius:13px;color:#fff;background:var(--mg-blue);font-weight:800;cursor:pointer}.mg-game-footer button:hover{background:var(--mg-blue-dark)}.mg-finish{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:18px;background:rgba(20,33,61,.42);backdrop-filter:blur(4px)}.mg-finish[hidden]{display:none}.mg-finish-card{width:min(390px,100%);padding:28px;border-radius:22px;background:#fff;box-shadow:var(--mg-shadow);text-align:center}.mg-finish-icon{font-size:52px}.mg-finish-card h2{margin:8px 0}.mg-finish-card p{color:var(--mg-muted)}.mg-final-score{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:18px 0}.mg-final-score span{padding:13px;border-radius:13px;background:#f5f8ff}.mg-final-score small{display:block;color:var(--mg-muted)}.mg-final-score strong{display:block;margin-top:4px;font-size:24px}.mg-finish-card button{width:100%;min-height:48px;border:0;border-radius:13px;color:#fff;background:var(--mg-blue);font-weight:800;cursor:pointer}.mg-finish-card>a{display:inline-block;margin-top:15px;color:var(--mg-blue)}.mg-game-empty{padding:50px 20px;border-radius:20px;background:#fff;text-align:center}.mg-game-empty>div{font-size:48px}
@media(max-width:650px){.mg-game-shell{padding:10px 9px 15px}.mg-game-header{margin-bottom:8px}.mg-game-header h1{font-size:21px}.mg-scorebar>div{padding:8px}.mg-scorebar strong{font-size:16px}.mg-board{gap:7px}.mg-match-card{height:clamp(72px,12.7dvh,98px);border-radius:13px}.mg-image-card{padding:4px}.mg-word-card{font-size:clamp(14px,4.5vw,19px)}.mg-instruction{margin:7px 0;font-size:12px}.mg-game-footer{margin-top:9px}.mg-game-footer button{min-height:44px}}
@media(max-width:430px){.mg-set-card{grid-template-columns:48px 1fr}.mg-set-card>a{grid-column:1/-1}.mg-board{gap:6px}.mg-match-card{height:clamp(68px,12dvh,90px)}.mg-word-card{font-size:clamp(13px,4.2vw,18px)}}
@media(max-height:700px){.mg-game-shell{padding-top:8px}.mg-game-header{margin-bottom:6px}.mg-scorebar{margin-bottom:6px}.mg-scorebar>div{padding:6px}.mg-instruction{margin:5px 0}.mg-match-card{height:clamp(62px,11.2dvh,82px)}.mg-game-footer{margin-top:7px}.mg-game-footer button{min-height:42px}}

/* Matching layout follows Memory: 4–5 pairs = 2 columns, 6–8 pairs = 3 columns */
.mg-board[data-columns="2"]{
    width:min(100%,390px);
}

.mg-board[data-columns="3"]{
    width:min(100%,520px);
}

.mg-board[data-columns="2"] .mg-match-card{
    height:clamp(74px,10.5dvh,108px);
}

.mg-board[data-columns="3"] .mg-match-card{
    height:clamp(72px,11.5dvh,108px);
}

.mg-board[data-columns="2"] .mg-word-card{
    font-size:clamp(15px,4.4vw,22px);
}

.mg-board[data-columns="3"] .mg-word-card{
    font-size:clamp(13px,3.8vw,19px);
}

@media(max-width:650px){
    .mg-board{
        grid-template-columns:repeat(var(--matching-columns,3),minmax(0,1fr));
        gap:7px;
    }

    .mg-board[data-columns="2"]{
        width:min(100%,360px);
    }

    .mg-board[data-columns="3"]{
        width:100%;
    }

    .mg-board[data-columns="2"] .mg-match-card{
        height:clamp(68px,10dvh,98px);
    }

    .mg-board[data-columns="3"] .mg-match-card{
        height:clamp(64px,10.5dvh,92px);
    }
}

@media(max-width:360px){
    .mg-board{
        gap:6px;
    }

    .mg-board[data-columns="2"] .mg-match-card{
        height:clamp(64px,9.5dvh,90px);
    }

    .mg-board[data-columns="3"] .mg-match-card{
        height:clamp(58px,9.5dvh,82px);
    }
}

@media(max-height:700px){
    .mg-board[data-columns="2"] .mg-match-card{
        height:clamp(58px,9dvh,78px);
    }

    .mg-board[data-columns="3"] .mg-match-card{
        height:clamp(54px,8.8dvh,74px);
    }
}

