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

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

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

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

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

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

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

.ielts-cw-board {
    width: 100%;
    max-width: calc(var(--ielts-cw-cols) * 42px);
}

.ielts-cw-grid {
    display: grid;
    grid-template-columns: repeat(var(--ielts-cw-cols), 1fr);
    gap: 2px;
}

.ielts-cw-cell {
    position: relative;
    aspect-ratio: 1;
    background-color: white;
    border: 1px solid #a9a1bd;
    border-radius: 4px;
}

.ielts-cw-empty {
    aspect-ratio: 1;
}

.ielts-cw-cell.is-active {
    background-color: #fff3c4;
    border-color: #d9a520;
}

.ielts-cw-cell.is-solved {
    background-color: #dcf3e2;
    border-color: #5fb67a;
}

.ielts-cw-number {
    position: absolute;
    top: 1px;
    left: 3px;
    font-size: 10px;
    line-height: 1;
    color: rgb(60, 60, 60);
    pointer-events: none;
}

.ielts-cw-game .ielts-cw-input,
.ielts-cw-game .ielts-cw-input:focus {
    box-sizing: border-box;
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    color: black;
    background-color: transparent;
    border: 0 solid transparent;
    border-radius: 4px;
    box-shadow: none;
    caret-color: transparent;
}

.ielts-cw-game .ielts-cw-input:focus {
    background-color: #ffd966;
    outline: 2px solid black;
    outline-offset: -2px;
}

.ielts-cw-game .ielts-cw-input.is-hinted {
    color: #1f4f99;
}

.ielts-cw-clues {
    flex: 1 1 260px;
    display: grid;
    gap: 16px;
}

.ielts-cw-game .ielts-cw-heading {
    margin: 0 0 8px 0;
    font-size: 18px;
    line-height: 1.3;
}

.ielts-cw-game .ielts-cw-clue-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ielts-cw-game .ielts-cw-clue {
    margin: 0;
}

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

.ielts-cw-game .ielts-cw-clue-button:hover {
    color: black;
    background-color: #f1edf8;
    border: 1px solid #c8bedb;
}

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

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

.ielts-cw-game .ielts-cw-clue.is-solved .ielts-cw-clue-button {
    background-color: #dcf3e2;
    border-color: #5fb67a;
}

.ielts-cw-clue-number {
    margin-right: 4px;
    font-weight: bold;
}

.ielts-cw-clue-meta {
    color: rgb(80, 80, 80);
}

.ielts-cw-card {
    margin-top: 4px;
    padding: 8px 12px;
    font-size: 14px;
    background-color: white;
    border-left: 4px solid teal;
    border-radius: 8px;
    animation: ielts-cw-pop 0.35s;
}

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

.ielts-cw-game .ielts-cw-card .ielts-cw-card-term {
    font-size: 16px;
}

.ielts-cw-game .ielts-cw-card .ielts-cw-card-example {
    margin-top: 2px;
    font-style: italic;
    color: rgb(70, 70, 70);
}

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

.ielts-cw-game .ielts-cw-hint,
.ielts-cw-game .ielts-cw-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-cw-game .ielts-cw-hint:hover {
    color: #004d4d;
    background-color: #e6f4f2;
    border: 1px solid #006666;
}

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

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

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

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

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

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

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

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

    .ielts-cw-game .ielts-cw-input,
    .ielts-cw-game .ielts-cw-input:focus {
        font-size: 16px;
    }

    .ielts-cw-number {
        font-size: 8px;
    }
}

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