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

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

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

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

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

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

.ielts-sd-hud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: bold;
    line-height: 1.5;
}

.ielts-sd-hearts {
    font-size: 22px;
    letter-spacing: 2px;
    color: #c8193c;
}

.ielts-sd-game .ielts-sd-clue {
    min-height: 54px;
    margin: 0 0 10px 0;
    padding: 10px 14px;
    font-size: 17px;
    line-height: 1.5;
    background-color: white;
    border-left: 4px solid #6c5ce7;
    border-radius: 10px;
}

.ielts-sd-stage {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    user-select: none;
    -webkit-user-select: none;
}

.ielts-sd-start {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.35);
}

.ielts-sd-game .ielts-sd-start-button,
.ielts-sd-game .ielts-sd-start-button:focus,
.ielts-sd-game .ielts-sd-new,
.ielts-sd-game .ielts-sd-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-sd-game .ielts-sd-start-button,
.ielts-sd-game .ielts-sd-start-button:focus {
    padding: 12px 40px;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

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

.ielts-sd-game .ielts-sd-start-button:focus-visible,
.ielts-sd-game .ielts-sd-new:focus-visible {
    outline: 2px solid black;
    outline-offset: 2px;
}

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

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

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

.ielts-sd-recap {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.ielts-sd-game .ielts-sd-recap-heading {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    line-height: 1.5;
}

.ielts-sd-card {
    padding: 12px 16px;
    background-color: white;
    border-left: 4px solid teal;
    border-radius: 10px;
}

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

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

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

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

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


.ielts-sd-stage {
    height: 400px;
    background: radial-gradient(circle at 50% 0%, #5b4fc7, transparent 60%), linear-gradient(#2b2d6e, #3f3590);
    touch-action: manipulation;
}

.ielts-sd-game .ielts-sd-replay,
.ielts-sd-game .ielts-sd-replay:focus {
    position: absolute;
    top: 14px;
    left: 50%;
    z-index: 3;
    margin: 0;
    padding: 8px 20px;
    font-size: 15px;
    font-weight: bold;
    line-height: 1.4;
    text-transform: none;
    color: #2b2d6e;
    background-color: white;
    border: 2px solid white;
    border-radius: 999px;
    box-shadow: none;
    transform: translateX(-50%);
    cursor: pointer;
}

.ielts-sd-game .ielts-sd-replay:hover {
    color: #2b2d6e;
    background-color: #eceafd;
    border: 2px solid #eceafd;
}

.ielts-sd-game .ielts-sd-replay:disabled,
.ielts-sd-game .ielts-sd-replay:disabled:hover {
    color: rgb(90, 90, 90);
    background-color: #d9d7ea;
    border: 2px solid #d9d7ea;
    cursor: default;
}

.ielts-sd-game .ielts-sd-replay:focus-visible {
    outline: 2px solid #ffe08a;
    outline-offset: 2px;
}

.ielts-sd-stage.is-speaking .ielts-sd-replay {
    animation: ielts-sd-pulse 0.8s ease-in-out infinite alternate;
}

.ielts-sd-lane {
    position: absolute;
    top: 70px;
    right: 0;
    left: 0;
    z-index: 2;
    display: flex;
    justify-content: center;
    gap: 6%;
    padding: 0 4%;
}

.ielts-sd-game .ielts-sd-card,
.ielts-sd-game .ielts-sd-card:focus,
.ielts-sd-game .ielts-sd-card:disabled {
    flex: 0 1 44%;
    min-height: 74px;
    margin: 0;
    padding: 10px 12px;
    font-size: 26px;
    font-weight: bold;
    line-height: 1.2;
    text-transform: none;
    word-break: break-word;
    color: black;
    background-color: white;
    border: 3px solid #ffe08a;
    border-radius: 18px;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
    cursor: pointer;
}

.ielts-sd-game .ielts-sd-card:hover {
    color: black;
    background-color: #fff8dc;
    border: 3px solid #ffd24d;
}

.ielts-sd-game .ielts-sd-card:disabled {
    cursor: default;
}

.ielts-sd-game .ielts-sd-card:focus-visible {
    outline: 3px solid #ffe08a;
    outline-offset: 3px;
}

.ielts-sd-game .ielts-sd-card.is-right {
    background-color: #bdebbd;
    border: 3px solid #3e9e5a;
}

.ielts-sd-game .ielts-sd-card.is-wrong {
    background-color: #ffc9d2;
    border: 3px solid #c8193c;
}

.ielts-sd-line {
    position: absolute;
    right: 4%;
    bottom: 28px;
    left: 4%;
    height: 0;
    border-top: 4px dashed #ff7a90;
}

.ielts-sd-recap-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ielts-sd-game .ielts-sd-recap-item {
    margin: 0;
    padding: 8px 12px;
    font-size: 15px;
    line-height: 1.5;
    background-color: white;
    border-left: 4px solid #c8c8c8;
    border-radius: 8px;
}

.ielts-sd-game .ielts-sd-recap-item.is-right {
    border-left-color: #3e9e5a;
}

.ielts-sd-game .ielts-sd-recap-item.is-wrong {
    border-left-color: #c8193c;
}

.ielts-sd-recap-item.is-right::before {
    content: "✓ ";
    font-weight: bold;
    color: #1d6a39;
}

.ielts-sd-recap-item.is-wrong::before {
    content: "✗ ";
    font-weight: bold;
    color: #b3122e;
}

@keyframes ielts-sd-pulse {
    from { box-shadow: 0 0 0 0 rgba(255, 224, 138, 0.8); }
    to { box-shadow: 0 0 0 10px rgba(255, 224, 138, 0); }
}

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

    .ielts-sd-stage {
        height: 360px;
    }

    .ielts-sd-game .ielts-sd-card,
    .ielts-sd-game .ielts-sd-card:focus,
    .ielts-sd-game .ielts-sd-card:disabled {
        min-height: 64px;
        font-size: 21px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ielts-sd-stage.is-speaking .ielts-sd-replay {
        animation: none;
    }
}
