.cws-wrap,
.cws-wrap * { box-sizing: border-box; }

.cws-wrap {
    --ws-green: #057a1b;
    --ws-green-dark: #046516;
    --ws-green-light: #0a9b2d;
    --ws-ink: #16344a;
    --ws-muted: #65798a;
    --ws-line: #dce7e0;
    --ws-soft: #f0f8f2;
    --ws-pale: #f7fbf8;
    --ws-gold: #ffc107;
    width: 100%;
    max-width: 780px;
    margin: 28px auto 40px;
    color: var(--ws-ink);
    font-family: inherit;
}

.cws-form {
    position: relative;
    overflow: hidden;
    padding: 25px;
    border: 1px solid #cfe1d4 !important;
    border-radius: 16px !important;
    background: linear-gradient(145deg, #f4fbf5, #ffffff) !important;
    box-shadow: 0 8px 24px rgba(24, 62, 37, .05) !important;
}

.cws-form::before {
    content: "";
    position: absolute;
    width: 170px;
    height: 170px;
    right: -80px;
    top: -85px;
    border-radius: 50%;
    background: rgba(10, 155, 45, .06);
    pointer-events: none;
}

.cws-form > * { position: relative; z-index: 1; }

.cws-title {
    margin: 0 0 12px !important;
    color: var(--ws-ink) !important;
    font-size: 26px !important;
    line-height: 1.25 !important;
    font-weight: 900 !important;
}

.cws-description,
.cws-help {
    color: var(--ws-muted) !important;
    font-size: 13px;
    line-height: 1.5;
}

.cws-description { margin: 0 0 20px; }
.cws-help { margin: 0 0 10px; }

.cws-field { margin-bottom: 17px; }

.cws-field label,
.cws-advanced label {
    display: block;
    margin: 0 0 7px;
    color: var(--ws-ink);
    font-size: 13px;
    line-height: 1.4;
    font-weight: 800;
}

.cws-pattern-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}

.cws-letter-box {
    width: 46px;
    flex: 0 0 46px;
    min-width: 46px;
    min-height: 46px;
    padding: 9px 4px;
    border: 1px solid #cfe1d4 !important;
    border-radius: 5px !important;
    background: #fff !important;
    color: var(--ws-ink) !important;
    font-family: inherit;
    font-size: 17px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    box-shadow: 0 4px 0 #c8d3cb, 0 8px 15px rgba(24,62,37,.08) !important;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.cws-letter-box:focus,
.cws-advanced select:focus {
    border-color: var(--ws-green) !important;
    box-shadow: 0 0 0 3px rgba(5, 122, 27, .10) !important;
}

.cws-length-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.cws-length-control select {
    width: max-content !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    min-height: 0 !important;
    padding: 8px 12px !important;
    border: 1px solid #cfe1d4 !important;
    background: #fff !important;
    color: var(--ws-ink);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    box-shadow: none !important;
    border-radius: 9px !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2212%22 height=%228%22 viewBox=%220 0 12 8%22%3E%3Cpath d=%22M0 0L6 8L12 0Z%22 fill=%22%23057a1b%22/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px 8px !important;
    padding-right: 25px !important;
    cursor: pointer;
}


.cws-advanced select {
    width: 100% !important;
    min-height: 46px !important;
    padding: 11px 14px !important;
    border: 1px solid #cfe1d4!important;
    border-radius: 10px!important;
    background: #fff!important;
    color: var(--ws-ink) !important;
    font-family: inherit;
    font-size: 15px;
    outline: none;
    box-shadow: none !important;
}

.cws-hint-icon {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    padding: 0 !important;
    border: 1px solid #cfe1d4 !important;
    border-radius: 50% !important;
    background: #fff !important;
    color: var(--ws-green) !important;
    font-family: inherit;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
}

.cws-hint-icon:hover,
.cws-hint-icon:focus {
    background: var(--ws-soft) !important;
    border-color: #b8d8c0 !important;
    outline: none;
}

.cws-hint {
    display: none;
    margin-top: 10px;
    padding: 11px 13px;
    border: 1px solid #dce7e0;
    border-radius: 10px;
    background: #f7fbf8;
    color: var(--ws-muted);
    font-size: 12px;
    line-height: 1.5;
}

.cws-hint.is-visible { display: block; }

.cws-advanced-toggle,
.cws-button {
    width: 100%;
    min-height: 45px;
    padding: 10px 14px !important;
    border-radius: 10px !important;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    box-sizing: border-box;
    transition: .18s ease;
}

.cws-advanced-toggle {
    margin-top: 10px !important;
    border: 1px solid #cfe1d4 !important;
    background: #fff !important;
    color: var(--ws-green) !important;
    box-shadow: none !important;
}

.cws-advanced-toggle:hover,
.cws-advanced-toggle:focus {
    background: var(--ws-soft) !important;
    border-color: #b8d8c0 !important;
    color: var(--ws-green-dark) !important;
    outline: none;
}

.cws-advanced {
    display: none;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 14px;
}

.cws-advanced.is-open {
    display: grid;
    padding-top: 14px;
    border-top: 1px solid #dce7e0;
}

.cws-button {
    margin-top: 10px;
    border: 1px solid var(--ws-green) !important;
    background: var(--ws-green) !important;
    color: #fff !important;
    box-shadow: 0 5px 12px rgba(5, 122, 27, .16);
}

.cws-button:hover,
.cws-button:focus,
.cws-button:active {
    background: var(--ws-green-dark) !important;
    border-color: var(--ws-green-dark) !important;
    color: #fff !important;
    transform: translateY(-2px);
    outline: none;
}

.cws-results { margin-top: 25px; }

.cws-results-title {
    position: relative;
    margin: 0 0 12px !important;
    padding: 0 0 0 15px !important;
    color: #303639 !important;
    font-size: 26px !important;
    line-height: 1.25 !important;
    font-weight: 900 !important;
}

.cws-results-title::before {
    content: "" !important;
    position: absolute !important;
    left: 0 !important;
    top: 1px !important;
    width: 5px !important;
    height: calc(100% - 8px) !important;
    border-radius: 99px !important;
    background: #057a1b !important;
}

.cws-count {
    margin: 0 0 14px;
    color: #303639 !important;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 700;
}

.cws-group {
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid var(--ws-line) !important;
    border-radius: 15px !important;
    box-shadow: 0 4px 15px rgba(20, 50, 30, .035);
}

.cws-group-title {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 10px !important;
    padding: 13px 16px 13px 18px !important;
    background: #f7fbf8 !important;
    border: 0 !important;
    border-bottom: 1px solid #dce7e0 !important;
    color: var(--ws-ink) !important;
    font-size: 15px;
    line-height: 1.3;
    font-weight: 900;
}


.cws-group-title span:last-child {
    color: var(--ws-muted) !important;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.cws-word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 16px;
    list-style: none;
}

.cws-word-list li { width: auto; margin: 0; }

.cws-word {
    display: block;
    width: auto;
    padding: 8px 12px;
    border: 1px solid #cfe1d4 !important;
    border-radius: 9px !important;
    background: #f7fbf8 !important;
    color: #034c11 !important;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.35;
    font-weight: 800;
    text-decoration: none !important;
    cursor: pointer;
    box-sizing: border-box;
    box-shadow: 0 2px 0 rgba(5, 122, 27, .04);
    transition: .16s ease;
}

.cws-word:hover,
.cws-word:focus,
.cws-word:active {
    background: #eaf7ed !important;
    border-color: #b8d8c0 !important;
    color: var(--ws-green-dark) !important;
    transform: translateY(-1px);
    outline: none;
}

.cws-word sub {
    color: #7c8e9a;
    font-size: 10px;
    font-weight: 800;
    margin-left: 3px;
    vertical-align: baseline;
}

.cws-empty {
    padding: 20px;
    border: 1px solid #dce7e0;
    border-radius: 12px;
    background: #f7fbf8;
    color: var(--ws-muted);
    font-size: 13px;
    line-height: 1.5;
}

.cws-popup {
    position: fixed !important;
    inset: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 30, 16, .48) !important;
    color: #333 !important;
    z-index: 2147483647 !important;
}

.cws-popup-box {
    width: 100% !important;
    max-width: 360px;
    padding: 22px;
    border: 1px solid #dce7e0;
    border-radius: 16px;
    background: #fff !important;
    color: #333 !important;
    box-shadow: 0 15px 50px rgba(0, 0, 0, .22) !important;
}

.cws-popup-word {
    margin: 0 0 18px !important;
    color: #16344a !important;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 900;
    text-align: center;
}

.cws-popup-button {
    display: block;
    width: 100%;
    margin-top: 9px;
    min-height: 43px;
    padding: 11px 14px;
    border: 1px solid #057a1b !important;
    border-radius: 10px;
    background: #057a1b !important;
    color: #fff !important;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
    box-sizing: border-box;
    transition: .18s ease;
}

.cws-popup-button:hover,
.cws-popup-button:focus {
    background: #046516 !important;
    border-color: #046516 !important;
    color: #fff !important;
    outline: none;
}

.cws-popup-close,
.cws-popup-close:hover {
    background: #fff !important;
    border-color: #cfe1d4 !important;
    color: #057a1b !important;
}

@media (max-width: 600px) {
    .cws-wrap { margin: 22px auto 32px; padding: 10px; }
    .cws-form { padding: 18px; border-radius: 15px !important; }
    .cws-pattern-row { gap: 5px; }
    .cws-letter-box { width: 42px; flex-basis: 42px; min-width: 42px; min-height: 42px; font-size: 15px; }
    .cws-results-title { font-size: 22px !important; line-height: 1.3 !important; }
    .cws-group-title { align-items: flex-start; flex-direction: column; gap: 3px; padding: 13px 14px 13px 17px !important; }
    .cws-word-list { gap: 7px; padding: 14px; }
    .cws-word { padding: 8px 10px; font-size: 13px; }
    .cws-popup { padding: 15px; }
    .cws-popup-box { padding: 18px; }
}
