.search-modal {
    position: fixed;
    inset: 0;
    z-index: 140;
    padding: 24px;
    background: rgba(17, 12, 9, 0.58);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-modal[hidden] {
    display: none !important;
}

.search-box {
    width: min(640px, 100%);
    height: min(80vh, 760px);
    padding: 24px;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-box__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.search-box__header h2 {
    margin: 0;
    font-size: 1.4rem;
}

#search-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #f3efe8;
    color: #2a2521;
    cursor: pointer;
}

#search-input {
    width: 100%;
    min-height: 52px;
    flex: 0 0 auto;
    padding: 0 16px;
    border: 1px solid rgba(42, 37, 33, 0.14);
    border-radius: 16px;
    font: inherit;
}

#search-input:focus {
    outline: 2px solid rgba(95, 110, 91, 0.22);
    outline-offset: 0;
}

.search-results {
    display: grid;
    gap: 10px;
    margin-top: 16px;
    padding-right: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
    min-height: 0;
    max-height: calc(80vh - 180px);
    align-content: start;
}

.search-results::-webkit-scrollbar {
    width: 10px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    border: 2px solid #fff;
    border-radius: 999px;
    background: rgba(42, 37, 33, 0.18);
}

.search-results__item {
    display: block;
    padding: 14px 16px;
    border-radius: 16px;
    background: #f8f5ef;
    color: #2a2521;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.search-results__title {
    display: block;
    font-weight: 700;
}

.search-results__description {
    display: block;
    margin-top: 4px;
    color: rgba(42, 37, 33, 0.72);
    font-size: 0.94rem;
    line-height: 1.45;
}

.search-results__item:hover,
.search-results__item:focus-visible {
    background: #ede6da;
    transform: translateY(-1px);
}

.search-results__empty {
    margin: 0;
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: 24px;
    color: rgba(42, 37, 33, 0.72);
    text-align: center;
    line-height: 1.5;
    border: 1px dashed rgba(42, 37, 33, 0.12);
    border-radius: 18px;
    background: #fcfaf6;
}

@media (max-width: 640px) {
    .search-modal {
        padding: 16px;
        align-items: flex-start;
    }

    .search-box {
        margin-top: 48px;
        padding: 18px;
        border-radius: 20px;
        height: calc(100vh - 80px);
    }

    .search-results {
        max-height: calc(100vh - 220px);
    }
}
