
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: #0e1017;
    color: #f1f2f7;
    font-family: Arial, Helvetica, sans-serif;
}

.container {
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    padding: 55px 25px;
}

.header {
    margin-bottom: 55px;
}

.logo {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -2px;
}

.subtitle {
    margin-top: 7px;
    color: #85899b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2.5px;
}

/* Search */

.search-section label {
    display: block;
    margin-bottom: 12px;
    color: #dfe1eb;
    font-size: 14px;
    font-weight: 600;
}

.search-box {
    display: flex;
    align-items: center;
    background: #191c27;
    border: 1px solid #303447;
    border-radius: 10px;
    padding: 0 17px;
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: #8b7cff;
}

.search-box input {
    width: 100%;
    height: 56px;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 16px;
}

.search-box input::placeholder {
    color: #707589;
}

.search-icon {
    color: #85899b;
    font-size: 25px;
}

/* Results heading */

.results-section {
    margin-top: 45px;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 17px;
}

.results-header h2 {
    font-size: 18px;
}

#resultCount {
    color: #9297aa;
    font-size: 13px;
}

/* Sorting and view controls */

.controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.control-label {
    color: #777c90;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.button-group {
    display: flex;
    gap: 7px;
}

.control-button {
    padding: 9px 13px;
    background: #191c27;
    border: 1px solid #303447;
    border-radius: 7px;
    color: #9297aa;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.control-button:hover {
    background: #25293a;
    color: #ffffff;
}

.control-button.active {
    background: #292541;
    border-color: #8b7cff;
    color: #c4baff;
}

/* Results list */

.results-list {
    overflow: hidden;
    background: #171a24;
    border: 1px solid #292d3d;
    border-radius: 10px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 15px 18px;
    border-bottom: 1px solid #292d3d;
}

.result-item:last-child {
    border-bottom: none;
}

.word {
    font-size: 15px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.word-length {
    margin-top: 5px;
    color: #85899b;
    font-size: 12px;
}

/* Matching letter highlighting */

.highlight {
    background: #6554b8;
    color: #ffffff;
    border-radius: 2px;
    padding: 0;
}

/* Copy buttons */

.copy-button {
    flex-shrink: 0;
    padding: 8px 11px;
    background: #25293a;
    border: 1px solid #383d53;
    border-radius: 6px;
    color: #c7c9d6;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.copy-button:hover {
    background: #353a50;
}

/* Three-column view */

.results-list.grid-view {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));

    /* Expand only the results box */
    width: min(950px, calc(100vw - 34px));
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

.grid-view .result-item {
    min-width: 0;
    padding: 14px;
    border-bottom: 1px solid #292d3d;
    border-right: 1px solid #292d3d;
}

.grid-view .result-item:last-child {
    border-bottom: 1px solid #292d3d;
}

.grid-view .word {
    font-size: 13px;
}

.grid-view .word-length {
    font-size: 11px;
}

.grid-view .copy-button {
    padding: 6px 8px;
    font-size: 11px;
}

/* Messages */

.message {
    padding: 25px 18px;
    color: #85899b;
    font-size: 14px;
    text-align: center;
}

.results-list.grid-view .message {
    grid-column: 1 / -1;
}

/* Mobile layout */

@media (max-width: 600px) {
    .container {
        padding: 35px 17px;
    }

    .header {
        margin-bottom: 40px;
    }

    .logo {
        font-size: 33px;
    }

    .controls {
        align-items: flex-start;
    }

    .results-list.grid-view {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 380px) {
    .results-list.grid-view {
        grid-template-columns: 1fr;
    }
}
