.wtm-wrapper {
    margin: 25px 0;
    box-sizing: border-box;
}

.wtm-wrapper *,
.wtm-wrapper *::before,
.wtm-wrapper *::after {
    box-sizing: border-box;
}

.wtm-wrapper .wtm-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
    align-items: stretch;
}

.wtm-wrapper .wtm-tab-btn {
    border: 1px solid #dcdcdc;
    background: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--wtm-tab-font-size, 13px);
    font-weight: 600;
    line-height: 1.25;
    font-family: inherit;
    color: inherit;
    transition: 0.2s;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
    flex: 0 1 auto;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
}

.wtm-wrapper .wtm-tab-btn:hover {
    background: #f5f5f5;
}

.wtm-wrapper .wtm-tab-btn.wtm-active {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

/* Tab size presets */
.wtm-wrapper.wtm-tabs-size-small .wtm-tab-btn {
    --wtm-tab-font-size: 11px;
    padding: 6px 6px;
}

.wtm-wrapper.wtm-tabs-size-medium .wtm-tab-btn {
    --wtm-tab-font-size: 13px;
    padding: 8px 10px;
}

.wtm-wrapper.wtm-tabs-size-large .wtm-tab-btn {
    --wtm-tab-font-size: 15px;
    padding: 10px 14px;
}

.wtm-wrapper.wtm-tabs-size-auto .wtm-tab-btn {
    --wtm-tab-font-size: clamp(10px, 2.4vw, 13px);
}

.wtm-wrapper.wtm-tabs-custom-font .wtm-tab-btn {
    font-size: var(--wtm-tab-font-size) !important;
}

.wtm-wrapper .wtm-my-list-section {
    margin-bottom: 20px;
    padding: 16px;
    border: 2px solid #2271b1;
    border-radius: 8px;
    background: #f0f6fc;
}

.wtm-wrapper .wtm-my-list-section.wtm-is-empty {
    display: none;
}

.wtm-wrapper .wtm-my-list-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.wtm-wrapper .wtm-my-list-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.wtm-wrapper .wtm-my-list-count {
    font-weight: 600;
    opacity: 0.85;
}

.wtm-wrapper .wtm-my-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wtm-wrapper .wtm-clear-my-list-btn {
    background: #fff;
    color: #b32d2e;
    border: 1px solid #b32d2e;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.wtm-wrapper .wtm-clear-my-list-btn:hover {
    background: #fcf0f1;
}

.wtm-wrapper .wtm-tab-panel {
    display: none;
}

.wtm-wrapper .wtm-tab-panel.wtm-active {
    display: block;
}

.wtm-wrapper .wtm-copy-wrap {
    margin-bottom: 15px;
}

.wtm-wrapper .wtm-copy-btn {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.wtm-wrapper .wtm-copy-btn:hover {
    opacity: 0.9;
}

.wtm-wrapper .wtm-word-list {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: wtm-word-counter;
}

.wtm-wrapper .wtm-my-word-list {
    margin-left: 0;
}

.wtm-wrapper .wtm-word-list .wtm-word-item {
    counter-increment: wtm-word-counter;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    padding-left: 0;
}

.wtm-wrapper .wtm-word-list .wtm-word-item::before {
    content: counter(wtm-word-counter) ".";
    flex: 0 0 2em;
    font-weight: 600;
    text-align: right;
    color: inherit;
}

.wtm-wrapper .wtm-word-text {
    flex: 0 1 auto;
}

.wtm-wrapper .wtm-save-word-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #c3c4c7;
    border-radius: 50%;
    background: #fff;
    color: #50575e;
    cursor: pointer;
    flex-shrink: 0;
    transition: 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.wtm-wrapper .wtm-save-word-btn:hover {
    border-color: #2271b1;
    color: #2271b1;
    background: #f0f6fc;
}

.wtm-wrapper .wtm-save-word-btn.wtm-is-saved {
    border-color: #2271b1;
    background: #2271b1;
    color: #fff;
}

.wtm-wrapper .wtm-save-word-btn.wtm-is-saved:hover {
    background: #135e96;
    border-color: #135e96;
    color: #fff;
}

.wtm-wrapper .wtm-save-icon {
    display: block;
}

.wtm-wrapper .wtm-copy-success {
    margin-left: 10px;
    color: green;
    font-size: 13px;
}

/* Word Filter */
.wtm-wrapper .wtm-word-filter {
    margin: 0 auto 20px;
    max-width: 720px;
    text-align: center;
    color-scheme: light;
}

.wtm-wrapper .wtm-filter-title {
    margin: 0 0 14px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    color: #1d2327;
}

.wtm-wrapper .wtm-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.wtm-wrapper .wtm-filter-mode {
    min-width: 170px;
    padding: 10px 12px;
    border: 2px solid #c3c4c7;
    border-radius: 8px;
    background: #fff !important;
    background-color: #fff !important;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: #1d2327 !important;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.wtm-wrapper .wtm-filter-mode:focus,
.wtm-wrapper .wtm-filter-mode:active,
.wtm-wrapper .wtm-filter-mode:hover {
    background: #fff !important;
    background-color: #fff !important;
    color: #1d2327 !important;
}

.wtm-wrapper .wtm-filter-mode option {
    background: #fff;
    color: #1d2327;
}

.wtm-wrapper .wtm-filter-positions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    flex: 0 0 auto;
}

.wtm-wrapper .wtm-filter-positions.wtm-is-hidden,
.wtm-wrapper .wtm-filter-letters-wrap.wtm-is-hidden,
.wtm-wrapper .wtm-filter-letters-wrap[hidden] {
    display: none !important;
}

.wtm-wrapper .wtm-filter-pos-input {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 2px solid #c3c4c7;
    border-radius: 8px;
    background: #fff !important;
    background-color: #fff !important;
    text-align: center;
    text-transform: uppercase;
    font-size: 18px;
    font-weight: 700;
    font-family: inherit;
    color: #1d2327 !important;
    -webkit-text-fill-color: #1d2327;
}

.wtm-wrapper .wtm-filter-pos-input:focus,
.wtm-wrapper .wtm-filter-pos-input:active,
.wtm-wrapper .wtm-filter-pos-input:hover {
    background: #fff !important;
    background-color: #fff !important;
    color: #1d2327 !important;
    -webkit-text-fill-color: #1d2327;
}

.wtm-wrapper .wtm-filter-pos-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.wtm-wrapper .wtm-filter-letters-wrap {
    flex: 0 0 auto;
    width: 100%;
    max-width: 280px;
}

.wtm-wrapper .wtm-filter-letters {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 2px solid #c3c4c7;
    border-radius: 8px;
    background: #fff !important;
    background-color: #fff !important;
    text-transform: uppercase;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: #1d2327 !important;
    -webkit-text-fill-color: #1d2327;
}

.wtm-wrapper .wtm-filter-letters:focus,
.wtm-wrapper .wtm-filter-letters:active,
.wtm-wrapper .wtm-filter-letters:hover {
    background: #fff !important;
    background-color: #fff !important;
    color: #1d2327 !important;
    -webkit-text-fill-color: #1d2327;
}

.wtm-wrapper .wtm-filter-letters:focus,
.wtm-wrapper .wtm-filter-mode:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.wtm-wrapper .wtm-filter-search-btn {
    display: none;
}

.wtm-wrapper .wtm-filter-clear-btn {
    height: 42px;
    padding: 0 16px;
    border: 2px solid #c3c4c7;
    border-radius: 8px;
    background: #fff !important;
    background-color: #fff !important;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    color: #1d2327 !important;
    cursor: pointer;
    letter-spacing: 0.04em;
}

.wtm-wrapper .wtm-filter-clear-btn:hover,
.wtm-wrapper .wtm-filter-clear-btn:focus,
.wtm-wrapper .wtm-filter-clear-btn:active {
    background: #fff !important;
    background-color: #fff !important;
    color: #1d2327 !important;
}

.wtm-wrapper .wtm-word-item.wtm-filter-hidden {
    display: none;
}

/* Exact Position - Green */
.wtm-wrapper .wtm-filter-mode-exact .wtm-filter-mode,
.wtm-wrapper .wtm-filter-mode-exact .wtm-filter-pos-input,
.wtm-wrapper .wtm-filter-mode-exact .wtm-filter-letters {
    border-color: #6aaa64;
}

.wtm-wrapper .wtm-filter-mode-exact .wtm-filter-pos-input:focus,
.wtm-wrapper .wtm-filter-mode-exact .wtm-filter-letters:focus,
.wtm-wrapper .wtm-filter-mode-exact .wtm-filter-mode:focus {
    box-shadow: 0 0 0 2px rgba(106, 170, 100, 0.25);
}

/* Misplaced Letter - Yellow */
.wtm-wrapper .wtm-filter-mode-misplaced .wtm-filter-mode,
.wtm-wrapper .wtm-filter-mode-misplaced .wtm-filter-pos-input,
.wtm-wrapper .wtm-filter-mode-misplaced .wtm-filter-letters {
    border-color: #c9b458;
}

.wtm-wrapper .wtm-filter-mode-misplaced .wtm-filter-pos-input:focus,
.wtm-wrapper .wtm-filter-mode-misplaced .wtm-filter-letters:focus,
.wtm-wrapper .wtm-filter-mode-misplaced .wtm-filter-mode:focus {
    box-shadow: 0 0 0 2px rgba(201, 180, 88, 0.25);
}

/* Not Containing - Grey */
.wtm-wrapper .wtm-filter-mode-not-containing .wtm-filter-mode,
.wtm-wrapper .wtm-filter-mode-not-containing .wtm-filter-letters {
    border-color: #a8a8a8;
}

.wtm-wrapper .wtm-filter-mode-not-containing .wtm-filter-letters:focus,
.wtm-wrapper .wtm-filter-mode-not-containing .wtm-filter-mode:focus {
    box-shadow: 0 0 0 2px rgba(168, 168, 168, 0.25);
}

/* Containing - Dark Grey */
.wtm-wrapper .wtm-filter-mode-containing .wtm-filter-mode,
.wtm-wrapper .wtm-filter-mode-containing .wtm-filter-letters {
    border-color: #50575e;
}

.wtm-wrapper .wtm-filter-mode-containing .wtm-filter-letters:focus,
.wtm-wrapper .wtm-filter-mode-containing .wtm-filter-mode:focus {
    box-shadow: 0 0 0 2px rgba(80, 87, 94, 0.25);
}

@media (max-width: 768px) {

    .wtm-wrapper .wtm-tabs {
        gap: 4px;
    }

    /* One row — shrink to fit */
    .wtm-wrapper.wtm-tabs-mobile-fit .wtm-tabs {
        flex-wrap: nowrap;
    }

    .wtm-wrapper.wtm-tabs-mobile-fit .wtm-tab-btn {
        flex: 1 1 0;
        min-width: 0;
        padding: 6px 4px;
        font-size: var(--wtm-tab-font-size, clamp(8px, 2.6vw, 11px));
    }

    /* One row — horizontal scroll */
    .wtm-wrapper.wtm-tabs-mobile-scroll .wtm-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 4px;
    }

    .wtm-wrapper.wtm-tabs-mobile-scroll .wtm-tab-btn {
        flex: 0 0 auto;
        min-width: max(28%, 100px);
        padding: 8px 10px;
        font-size: var(--wtm-tab-font-size, 11px);
        white-space: nowrap;
    }

    /* Wrap to multiple rows */
    .wtm-wrapper.wtm-tabs-mobile-wrap .wtm-tabs {
        flex-wrap: wrap;
    }

    .wtm-wrapper.wtm-tabs-mobile-wrap .wtm-tab-btn {
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
        padding: 8px 6px;
        font-size: var(--wtm-tab-font-size, 11px);
    }

    .wtm-wrapper .wtm-my-list-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .wtm-wrapper .wtm-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .wtm-wrapper .wtm-filter-mode,
    .wtm-wrapper .wtm-filter-letters-wrap {
        width: 100%;
        max-width: none;
        flex: 0 0 auto;
    }

    .wtm-wrapper .wtm-filter-positions {
        width: 100%;
        flex: 0 0 auto;
    }

    .wtm-wrapper .wtm-filter-pos-input {
        flex: 1 1 42px;
        min-width: 38px;
    }

    .wtm-wrapper .wtm-filter-clear-btn {
        width: 100%;
    }

}
