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

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

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

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

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

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

.ielts-ws-play {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
}

.ielts-ws-board {
    width: 100%;
    max-width: 440px;
}

.ielts-ws-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.ielts-ws-game .ielts-ws-cell,
.ielts-ws-game .ielts-ws-cell:focus {
    aspect-ratio: 1;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    font-size: clamp(14px, 4.2vw, 20px);
    font-weight: bold;
    line-height: 1;
    text-transform: uppercase;
    color: black;
    background-color: white;
    border: 1px solid #d3e6e3;
    border-radius: 6px;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.15s;
}

.ielts-ws-game .ielts-ws-cell:hover {
    color: black;
    background-color: #e3f3f0;
    border: 1px solid #b5d8d3;
}

.ielts-ws-game .ielts-ws-cell:focus-visible {
    outline: 2px solid black;
    outline-offset: 1px;
}

.ielts-ws-game .ielts-ws-cell.ielts-ws-color-0 { background-color: #ffe08a; border-color: #ffe08a; }
.ielts-ws-game .ielts-ws-cell.ielts-ws-color-1 { background-color: #b0dcff; border-color: #b0dcff; }
.ielts-ws-game .ielts-ws-cell.ielts-ws-color-2 { background-color: #bdebbd; border-color: #bdebbd; }
.ielts-ws-game .ielts-ws-cell.ielts-ws-color-3 { background-color: #ffc6dc; border-color: #ffc6dc; }
.ielts-ws-game .ielts-ws-cell.ielts-ws-color-4 { background-color: #dccbff; border-color: #dccbff; }
.ielts-ws-game .ielts-ws-cell.ielts-ws-color-5 { background-color: #ffd2a8; border-color: #ffd2a8; }

.ielts-ws-game .ielts-ws-cell.is-selected {
    background-color: #fff3c4;
    border-color: #d9a520;
    transform: scale(1.08);
}

.ielts-ws-game .ielts-ws-cell.is-wrong {
    animation: ielts-ws-shake 0.3s;
}

.ielts-ws-game .ielts-ws-words {
    display: grid;
    gap: 8px;
    flex: 1 1 280px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ielts-ws-game .ielts-ws-word {
    margin: 0;
}

.ielts-ws-game .ielts-ws-clue,
.ielts-ws-game .ielts-ws-clue:focus {
    display: block;
    width: 100%;
    margin: 0;
    padding: 8px 12px;
    font-size: 15px;
    font-weight: normal;
    line-height: 1.45;
    text-align: left;
    text-transform: none;
    color: black;
    background-color: white;
    border: 1px solid #d3e6e3;
    border-radius: 8px;
    box-shadow: none;
    cursor: pointer;
}

.ielts-ws-game .ielts-ws-clue:hover {
    color: black;
    background-color: #f3faf8;
    border: 1px solid #b5d8d3;
}

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

.ielts-ws-game .ielts-ws-word.is-active .ielts-ws-clue {
    background-color: #fff3c4;
    border-color: #d9a520;
}

.ielts-ws-game .ielts-ws-word.is-found .ielts-ws-clue {
    background-color: #e4f4e6;
    border-color: #9fd3ab;
    cursor: default;
}

.ielts-ws-letters {
    display: block;
    margin-top: 4px;
    font-weight: bold;
    letter-spacing: 2px;
}

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

.ielts-ws-game .ielts-ws-hint,
.ielts-ws-game .ielts-ws-hint:focus {
    margin: 0;
    padding: 8px 20px;
    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-ws-game .ielts-ws-hint:hover {
    color: #004d4d;
    background-color: #e6f4f2;
    border: 1px solid #006666;
}

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

.ielts-ws-word-answer {
    margin-right: 4px;
}

.ielts-ws-word-pos {
    margin-right: 4px;
    color: rgb(80, 80, 80);
}

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

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

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

.ielts-ws-game .ielts-ws-new,
.ielts-ws-game .ielts-ws-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-ws-game .ielts-ws-new:hover {
    color: white;
    background-color: #0a6b6b;
    border: 1px solid #0a6b6b;
}

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

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

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

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

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

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

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

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

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

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

@keyframes ielts-ws-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

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

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