.ielts-mm-game {
    margin: 0 auto 40px auto;
    padding: 18px;
    border-radius: 14px;
    background-color: #f3f6fd;
    color: black;
}

.ielts-mm-game [hidden] {
    display: none !important;
}

.ielts-mm-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.ielts-mm-game .ielts-mm-source {
    line-height: 1.5;
    margin: 0;
    font-size: 15px;
    color: rgb(80, 80, 80);
}

.ielts-mm-source a {
    color: #006666;
    text-decoration: underline;
}

.ielts-mm-game .ielts-mm-help {
    line-height: 1.5;
    margin: 0 0 16px 0;
    font-size: 16px;
}

.ielts-mm-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.ielts-mm-game .ielts-mm-card,
.ielts-mm-game .ielts-mm-card:focus {
    position: relative;
    display: block;
    width: 100%;
    height: 130px;
    margin: 0;
    padding: 0;
    color: black;
    background-color: transparent;
    border: none;
    border-radius: 12px;
    box-shadow: none;
    text-transform: none;
    perspective: 800px;
    cursor: pointer;
}

.ielts-mm-game .ielts-mm-card:hover {
    color: black;
    background-color: transparent;
    border: none;
}

.ielts-mm-game .ielts-mm-card:focus-visible {
    outline: 2px solid black;
    outline-offset: 3px;
}

.ielts-mm-game .ielts-mm-card.is-matched {
    cursor: default;
    animation: ielts-mm-bounce 0.45s;
}

.ielts-mm-inner {
    position: absolute;
    inset: 0;
    display: block;
    transform-style: preserve-3d;
    transition: transform 0.45s;
}

.ielts-mm-card.is-up .ielts-mm-inner {
    transform: rotateY(180deg);
}

.ielts-mm-back,
.ielts-mm-face {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 12px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
}

.ielts-mm-back {
    font-size: 30px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #1f8a7d, #47b3a6);
    border: 3px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.ielts-mm-back::before {
    content: "?";
    content: "?" / "";
}

.ielts-mm-hidden-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ielts-mm-card:hover .ielts-mm-back {
    background: linear-gradient(135deg, #1a7a6f, #3ea89b);
}

.ielts-mm-face {
    transform: rotateY(180deg);
    font-size: 14px;
    line-height: 1.35;
    text-align: center;
    background-color: #eef5ff;
    border: 2px solid #c3daf4;
}

.ielts-mm-term .ielts-mm-face {
    font-size: 19px;
    font-weight: bold;
    background-color: #fff6d9;
    border-color: #efd486;
}

.ielts-mm-card.is-matched .ielts-mm-face {
    background-color: #ddf3e3;
    border-color: #5fb67a;
}

.ielts-mm-game .ielts-mm-progress {
    line-height: 1.5;
    margin: 16px 0 0 0;
    font-size: 15px;
    text-align: center;
    color: rgb(80, 80, 80);
}

.ielts-mm-game .ielts-mm-status {
    line-height: 1.5;
    min-height: 24px;
    margin: 6px 0 0 0;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    color: #1d6a39;
}

.ielts-mm-done {
    margin-top: 12px;
    padding: 18px;
    text-align: center;
    background-color: white;
    border: 2px solid #9fd8c5;
    border-radius: 14px;
    animation: ielts-mm-pop 0.4s;
}

.ielts-mm-game .ielts-mm-done-text {
    line-height: 1.5;
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: bold;
}

.ielts-mm-game .ielts-mm-new,
.ielts-mm-game .ielts-mm-new:focus {
    margin: 0;
    padding: 8px 20px;
    font-size: 15px;
    font-weight: bold;
    line-height: 1.4;
    text-transform: none;
    color: white;
    background-color: teal;
    border: 1px solid teal;
    border-radius: 999px;
    box-shadow: none;
    cursor: pointer;
}

.ielts-mm-game .ielts-mm-new:hover {
    color: white;
    background-color: #0a6b6b;
    border: 1px solid #0a6b6b;
}

.ielts-mm-game .ielts-mm-new:disabled,
.ielts-mm-game .ielts-mm-new:disabled:hover {
    color: white;
    background-color: #5c9c9c;
    border: 1px solid #5c9c9c;
    cursor: wait;
}

.ielts-mm-game .ielts-mm-new:focus-visible {
    outline: 2px solid black;
    outline-offset: 2px;
}

.ielts-mm-cards {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.ielts-mm-word-card {
    padding: 12px 16px;
    background-color: white;
    border-left: 4px solid teal;
    border-radius: 10px;
    animation: ielts-mm-pop 0.35s;
}

.ielts-mm-game .ielts-mm-word-card p {
    margin: 0;
    line-height: 1.5;
}

.ielts-mm-game .ielts-mm-word-card .ielts-mm-card-term {
    font-size: 17px;
}

.ielts-mm-card-meta {
    margin-left: 4px;
    font-size: 14px;
    color: rgb(80, 80, 80);
}

.ielts-mm-game .ielts-mm-word-card .ielts-mm-card-meaning {
    margin-top: 2px;
    font-size: 15px;
}

.ielts-mm-game .ielts-mm-word-card .ielts-mm-card-example {
    margin-top: 4px;
    font-size: 15px;
    font-style: italic;
    color: rgb(70, 70, 70);
}

@keyframes ielts-mm-pop {
    from { opacity: 0; transform: scale(0.94); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes ielts-mm-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

@media (max-width: 560px) {
    .ielts-mm-game {
        padding: 12px;
    }

    .ielts-mm-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .ielts-mm-face {
        padding: 6px;
        font-size: 13px;
    }

    .ielts-mm-term .ielts-mm-face {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ielts-mm-game,
    .ielts-mm-game * {
        animation: none !important;
        transition: none !important;
    }
}
