.fd-rhythm-search {
    width: 100%;
    max-width: 457px;
    position: relative;
    margin: 0 auto;
    font: inherit;
}

.fd-rhythm-search__form {
    display: flex;
    width: 100%;
    margin: 0;
    border: 3px double #8a3e00;
    border-radius: 5px;
    overflow: hidden;
    box-sizing: border-box;
    background: #050505;
}

.fd-rhythm-search__input {
    flex: 1 1 auto;
    min-width: 0;
    height: 42px;
    margin: 0;
    padding: 7px 14px;
    border: 0;
    border-radius: 0;
    background: #d1d1d1;
    color: #743200;
    font: inherit;
    font-size: 20px;
    line-height: 1.2;
    outline: none;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.fd-rhythm-search__input::placeholder {
    color: #743200;
    opacity: 1;
}

.fd-rhythm-search__input:focus {
    background: #fff;
}

.fd-rhythm-search__button {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    margin: 0;
    padding: 9px;
    border: 0;
    border-radius: 0;
    background: #050505;
    cursor: pointer;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fd-rhythm-search__button svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

.fd-rhythm-search__button:focus-visible,
.fd-rhythm-search__input:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.fd-rhythm-search__results {
    position: absolute;
    z-index: 2147483000;
    top: auto;
    bottom: calc(100% + 6px);
    left: 50%;
    right: auto;
    width: min(457px, calc(100vw - 40px));
    max-width: none;
    transform: translateX(-50%);
    max-height: min(420px, 60vh);
    overflow: hidden;
    background: #fff;
    border: 1px solid #cfcfcf;
    border-radius: 4px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
    text-align: left;
}

.fd-rhythm-search__results:not([hidden]) {
    display: flex;
    flex-direction: column;
}

.fd-rhythm-search__results-header {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 34px;
    padding: 5px 3% 4px;
    box-sizing: border-box;
    background: #fff;
    border-bottom: 1px solid #e7e7e7;
}

.fd-rhythm-search__close {
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #444;
    font: inherit;
    font-size: 25px;
    font-weight: 400;
    line-height: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    appearance: none;
}

.fd-rhythm-search__close:hover,
.fd-rhythm-search__close:focus-visible {
    background: rgba(0, 0, 0, 0.08);
    color: #111;
}

.fd-rhythm-search__close:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.fd-rhythm-search__results-body {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.fd-rhythm-search__results--cols-1 {
    width: min(457px, calc(100vw - 40px));
}

.fd-rhythm-search__results--cols-2 {
    width: min(806px, calc(100vw - 40px));
}

.fd-rhythm-search__results--cols-3 {
    width: min(1183px, calc(100vw - 40px));
}

.fd-rhythm-search__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
}

.fd-rhythm-search__list--cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fd-rhythm-search__list--cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fd-rhythm-search__item {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #e7e7e7;
    border-right: 1px solid #e7e7e7;
}

.fd-rhythm-search__list--cols-1 .fd-rhythm-search__item {
    border-right: 0;
}

.fd-rhythm-search__list--cols-2 .fd-rhythm-search__item:nth-child(2n),
.fd-rhythm-search__list--cols-3 .fd-rhythm-search__item:nth-child(3n) {
    border-right: 0;
}

/* Remove the bottom border only from cells that are actually in the final
   grid row. This avoids stripping borders from the row above when the last
   row is incomplete (for example, 10 results in a 3-column grid). */
.fd-rhythm-search__list--cols-1 .fd-rhythm-search__item:last-child,
.fd-rhythm-search__list--cols-2 .fd-rhythm-search__item:last-child,
.fd-rhythm-search__list--cols-2 .fd-rhythm-search__item:nth-last-child(2):nth-child(odd),
.fd-rhythm-search__list--cols-3 .fd-rhythm-search__item:last-child,
.fd-rhythm-search__list--cols-3 .fd-rhythm-search__item:nth-last-child(2):is(:nth-child(3n + 1), :nth-child(3n + 2)),
.fd-rhythm-search__list--cols-3 .fd-rhythm-search__item:nth-last-child(3):nth-child(3n + 1) {
    border-bottom: 0;
}

.fd-rhythm-search__item-inner {
    padding: 11px 14px 10px;
}

.fd-rhythm-search__link {
    display: inline;
    color: inherit;
    text-decoration: underline;
}

.fd-rhythm-search__link:hover,
.fd-rhythm-search__link:focus {
    text-decoration: underline;
}

.fd-rhythm-search__title {
    font-weight: 700;
    line-height: 1.3;
}

.fd-rhythm-search__details {
    display: block;
    margin-top: 2px;
    font-size: calc(0.88em - 2px);
    font-style: italic;
    line-height: 1.3;
    opacity: 0.72;
}

.fd-rhythm-search__message {
    padding: 12px 14px;
    line-height: 1.4;
}


@media (max-width: 900px) {
    .fd-rhythm-search__results--cols-1 {
        width: min(457px, calc(100vw - 30px));
    }

    .fd-rhythm-search__results--cols-2,
    .fd-rhythm-search__results--cols-3 {
        width: min(753px, calc(100vw - 30px));
    }

    .fd-rhythm-search__list--cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fd-rhythm-search__list--cols-3 .fd-rhythm-search__item {
        border-right: 1px solid #e7e7e7;
        border-bottom: 1px solid #e7e7e7;
    }

    .fd-rhythm-search__list--cols-3 .fd-rhythm-search__item:nth-child(2n) {
        border-right: 0;
    }

    /* At this breakpoint a 3-column result set becomes a 2-column grid.
       Apply the same exact-last-row logic for two columns. */
    .fd-rhythm-search__list--cols-3 .fd-rhythm-search__item:last-child,
    .fd-rhythm-search__list--cols-3 .fd-rhythm-search__item:nth-last-child(2):nth-child(odd) {
        border-bottom: 0;
    }
}

@media (max-width: 480px) {
    .fd-rhythm-search {
        max-width: 100%;
    }

    .fd-rhythm-search__results {
        width: calc(100vw - 20px);
        max-height: min(420px, 60vh);
    }

    .fd-rhythm-search__results-body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: rgba(92, 92, 92, 0.72) rgba(0, 0, 0, 0.08);
        scrollbar-gutter: stable;
        touch-action: pan-y;
    }

    /* Narrow overflow indicator for browsers that support WebKit scrollbar styling.
       On iPhone/iOS Safari the system may auto-hide the thumb until scrolling starts. */
    .fd-rhythm-search__results-body::-webkit-scrollbar {
        width: 5px;
    }

    .fd-rhythm-search__results-body::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.08);
        border-radius: 999px;
    }

    .fd-rhythm-search__results-body::-webkit-scrollbar-thumb {
        background: rgba(92, 92, 92, 0.72);
        border-radius: 999px;
    }

    .fd-rhythm-search__results-body::-webkit-scrollbar-thumb:hover {
        background: rgba(70, 70, 70, 0.9);
    }

    .fd-rhythm-search__list,
    .fd-rhythm-search__list--cols-2,
    .fd-rhythm-search__list--cols-3 {
        grid-template-columns: 1fr;
    }

    .fd-rhythm-search__item,
    .fd-rhythm-search__item:nth-child(2n),
    .fd-rhythm-search__item:nth-child(3n),
    .fd-rhythm-search__item:nth-last-child(-n + 2),
    .fd-rhythm-search__item:nth-last-child(-n + 3) {
        border-right: 0;
        border-bottom: 1px solid #e7e7e7;
    }

    .fd-rhythm-search__item:last-child {
        border-bottom: 0;
    }

    .fd-rhythm-search__input {
        font-size: 17px;
    }
}

.fd-rhythm-search__separator {
    font-style: normal;
    opacity: 0.8;
}
