.search-panel-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(4px);
    z-index: 1200;
}

body.search-panel-open {
    overflow: hidden;
}

body.search-panel-open #list_body {
    overflow: hidden;
}

.search-panel-overlay.is-open {
    display: flex;
}

.search-panel {
    width: min(720px, 92vw);
    max-height: min(70vh, 680px);
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.search-panel-overlay.is-open .search-panel {
    opacity: 1;
    transform: translateY(0);
}

.search-header,
.search-body,
.search-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.search-header {
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    background: #f8fafc;
}

.search-panel-icon {
    color: var(--color-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.search-panel-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--color-text);
    font-size: 1rem;
    outline: none;
    padding: 0.35rem 0;
}

.search-panel-input::placeholder {
    color: var(--color-muted);
}

.search-panel-close {
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #fff;
    color: var(--color-muted);
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.search-panel-close:hover {
    background: rgba(14, 165, 233, 0.08);
    color: var(--color-primary);
    transform: rotate(6deg);
}

.search-body {
    flex: 1;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow-y: auto;
    padding: 0.5rem 0;
    position: relative;
}

.search-panel-status {
    padding: 0.75rem 1.25rem 0.5rem;
    font-size: 0.9rem;
}

.search-panel-loading {
    display: none;
    padding: 1.5rem 0;
    align-items: center;
    justify-content: center;
}

.search-panel-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 0.5rem 1rem;
}

.search-panel-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.search-panel-section-title {
    padding: 0.5rem 0.95rem 0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--color-muted);
}

.search-panel-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.95rem;
    border-radius: 14px;
    color: var(--color-text);
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.search-panel-item:hover {
    background: rgba(14, 165, 233, 0.08);
    transform: translateX(2px);
}

.search-panel-thumb {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    background: #f1f5f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--color-primary);
    overflow: hidden;
    flex-shrink: 0;
}

.search-panel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-panel-thumb--placeholder {
    background: rgba(14, 165, 233, 0.12);
    color: var(--color-primary);
}

.search-panel-item-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.search-panel-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-panel-item-meta {
    font-size: 0.8rem;
    color: var(--color-muted);
    margin: 0.1rem 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-footer {
    padding: 0.9rem 1.25rem;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    background: #f8fafc;
    gap: 0.75rem;
}

.search-panel-submit {
    border: none;
    border-radius: 999px;
    padding: 0.5rem 1.5rem;
    font-weight: 600;
    background: linear-gradient(45deg, var(--color-primary), var(--color-secondary));
    color: #fff;
    box-shadow: 0 8px 18px rgba(14, 165, 233, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.search-panel-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(14, 165, 233, 0.22);
}

@media (max-width: 767.98px) {
    .search-panel-overlay {
        padding: 0;
        align-items: stretch;
    }

    .search-panel {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }

    .search-header {
        padding: 1rem;
    }

    .search-panel-results {
        padding-bottom: 1.5rem;
    }

    .search-footer {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .search-panel-submit {
        width: 100%;
    }
}

/* Panel entrance animation (shared). Keyframes, not transitions, because the
   overlay toggles display:none -> flex, which skips CSS transitions. */
.search-panel-overlay.is-open{animation:spFadeIn .22s ease;}
.search-panel-overlay.is-open .search-panel{animation:spSlideIn .26s ease;}
@keyframes spFadeIn{from{opacity:0;}to{opacity:1;}}
@keyframes spSlideIn{from{opacity:0;transform:translateY(-14px);}to{opacity:1;transform:none;}}
@media (prefers-reduced-motion:reduce){
  .search-panel-overlay.is-open,
  .search-panel-overlay.is-open .search-panel{animation:none;}
}
