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

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

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

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

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

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

.ielts-sp-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-sp-hearts {
    font-size: 22px;
    letter-spacing: 2px;
    color: #c8193c;
}

.ielts-sp-game .ielts-sp-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 #e85d8a;
    border-radius: 10px;
}

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

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

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

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

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

.ielts-sp-game .ielts-sp-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-sp-done {
    margin-top: 12px;
    padding: 18px;
    text-align: center;
    background-color: white;
    border: 2px solid #9fd8c5;
    border-radius: 14px;
}

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

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

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

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

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

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

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

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

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


.ielts-sp-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    min-height: 360px;
    padding: 30px 16px 20px 16px;
    box-sizing: border-box;
    background: radial-gradient(circle at 15% 20%, #ffe3ee, transparent 40%), radial-gradient(circle at 85% 85%, #fff0d1, transparent 45%), #fff9fb;
    border: 1px solid #f6d3e0;
}

.ielts-sp-bubble {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 220px;
    max-width: min(600px, 92%);
    padding: 24px 36px;
    text-align: center;
    background-color: white;
    border: 3px solid #e85d8a;
    border-radius: 28px;
    box-shadow: 0 6px 0 rgba(232, 93, 138, 0.25);
}

.ielts-sp-bubble::after {
    content: "";
    position: absolute;
    bottom: -19px;
    left: 50%;
    margin-left: -14px;
    border-width: 18px 14px 0 14px;
    border-style: solid;
    border-color: #e85d8a transparent transparent transparent;
}

.ielts-sp-word {
    font-size: 34px;
    font-weight: bold;
    line-height: 1.2;
    word-break: break-word;
    color: black;
}

.ielts-sp-ipa {
    margin-top: 6px;
    font-size: 18px;
    line-height: 1.3;
    color: rgb(60, 60, 60);
}

.ielts-sp-meaning {
    margin-top: 12px;
    font-size: 16px;
    line-height: 1.5;
    color: black;
}

.ielts-sp-example {
    margin-top: 6px;
    font-size: 15px;
    font-style: italic;
    line-height: 1.5;
    color: rgb(70, 70, 70);
}

.ielts-sp-bubble.is-new {
    animation: ielts-sp-in 0.3s;
}

.ielts-sp-bubble.is-popped {
    background-color: #dcf3e2;
    border-color: #3e9e5a;
    animation: ielts-sp-pop 0.6s;
}

.ielts-sp-bubble.is-popped::after {
    border-top-color: #3e9e5a;
}

.ielts-sp-burst {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.ielts-sp-burst i {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
    opacity: 0;
}

.ielts-sp-burst i:nth-child(1) { --x: -120px; --y: -50px; background-color: #ffb3c6; }
.ielts-sp-burst i:nth-child(2) { --x: 120px; --y: -55px; background-color: #ffe08a; }
.ielts-sp-burst i:nth-child(3) { --x: -100px; --y: 55px; background-color: #a8d8ff; }
.ielts-sp-burst i:nth-child(4) { --x: 110px; --y: 50px; background-color: #bdebbd; }
.ielts-sp-burst i:nth-child(5) { --x: 0px; --y: -80px; background-color: #dccbff; }
.ielts-sp-burst i:nth-child(6) { --x: 10px; --y: 80px; background-color: #ffd2a8; }

.ielts-sp-bubble.is-popped .ielts-sp-burst i {
    animation: ielts-sp-fly 0.6s ease-out;
}

.ielts-sp-speaker {
    position: relative;
    width: 72px;
    height: 72px;
    background-color: #ffb347;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}

.ielts-sp-speaker::before {
    content: "";
    position: absolute;
    top: 22px;
    left: 20px;
    width: 9px;
    height: 9px;
    background-color: black;
    border-radius: 50%;
    box-shadow: 22px 0 0 black;
}

.ielts-sp-speaker::after {
    content: "";
    position: absolute;
    top: 40px;
    left: 26px;
    width: 18px;
    height: 10px;
    background-color: #7a2d16;
    border-radius: 0 0 12px 12px;
}

.ielts-sp-stage.is-listening .ielts-sp-speaker {
    animation: ielts-sp-ring 1.4s infinite;
}

.ielts-sp-stage.is-listening .ielts-sp-speaker::after {
    animation: ielts-sp-talk 0.45s infinite alternate;
}

.ielts-sp-game .ielts-sp-heard {
    min-height: 26px;
    margin: 0;
    font-size: 16px;
    font-style: italic;
    line-height: 1.5;
    text-align: center;
    color: rgb(60, 60, 60);
}

.ielts-sp-trail {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

.ielts-sp-dot {
    box-sizing: border-box;
    width: 18px;
    height: 18px;
    background-color: #ece3e7;
    border: 2px solid #ece3e7;
    border-radius: 50%;
}

.ielts-sp-dot.is-current {
    background-color: white;
    border-color: #e85d8a;
}

.ielts-sp-dot.is-popped {
    background-color: #5fb67a;
    border-color: #5fb67a;
}

.ielts-sp-dot.is-skipped {
    background-color: #f3a6b6;
    border-color: #f3a6b6;
}

.ielts-sp-actions {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

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

.ielts-sp-game .ielts-sp-skip:hover {
    color: #004d4d;
    background-color: #e6f4f2;
    border: 1px solid #006666;
}

.ielts-sp-game .ielts-sp-skip:disabled,
.ielts-sp-game .ielts-sp-skip:disabled:hover {
    color: rgb(90, 90, 90);
    background-color: #f2f2f2;
    border: 1px solid #c8c8c8;
    cursor: default;
}

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

@keyframes ielts-sp-in {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes ielts-sp-pop {
    0% { transform: scale(1); }
    40% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@keyframes ielts-sp-fly {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(0.6); }
}

@keyframes ielts-sp-ring {
    0% { box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15), 0 0 0 0 rgba(232, 93, 138, 0.45); }
    70% { box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15), 0 0 0 16px rgba(232, 93, 138, 0); }
    100% { box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15), 0 0 0 0 rgba(232, 93, 138, 0); }
}

@keyframes ielts-sp-talk {
    from { height: 6px; }
    to { height: 14px; }
}

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

    .ielts-sp-stage {
        min-height: 320px;
    }

    .ielts-sp-bubble {
        min-width: 0;
        padding: 20px 24px;
    }

    .ielts-sp-word {
        font-size: 28px;
    }
}

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