/* ================================================================================
   Search Page Styles
   页面独有样式 - 从 search.html 迁移
   ================================================================================ */

/* ---------- 搜索容器 ---------- */
.search-container {
    background: white;
    border-radius: 50px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    margin-bottom: 0;
    position: relative;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.search-box {
    display: flex;
    align-items: center;
    padding: 5px;
}

#searchInput {
    flex: 1;
    padding: 15px 25px;
    font-size: 18px;
    border: none;
    border-radius: 50px;
    outline: none;
    background: transparent;
}

#searchBtn {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: #667eea;
    color: white;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#searchBtn:hover {
    background: #764ba2;
    transform: scale(1.05);
}

.search-inline-emoji {
    display: inline-block;
    margin-right: 0.35rem;
    line-height: 1;
}

/* ---------- 联想建议 ---------- */
.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.suggestion-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.suggestion-item:hover {
    background: #f5f5f5;
}

.suggestion-info {
    flex: 1;
}

.suggestion-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 3px;
}

.suggestion-name small {
    font-weight: normal;
    color: #666;
    font-size: 12px;
    margin-left: 5px;
}

.suggestion-number {
    font-size: 12px;
    color: #999;
}

/* ---------- 操作行 ---------- */
.action-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 15px;
    margin: 10px 0 20px 0;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
}

.advanced-toggle {
    margin: 0;
}

.advanced-toggle button {
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    color: white;
    padding: 10px 30px;
    border-radius: 30px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.advanced-toggle button:hover {
    background: white;
    color: #667eea;
}

.deck-management {
    margin: 0;
}

.deck-manager-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    color: white;
    padding: 10px 30px;
    border-radius: 30px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    margin-left: 10px;
    text-decoration: none;
    display: inline-block;
}

.deck-manager-btn:hover {
    background: white;
    color: #667eea;
}

/* ---------- 高级搜索面板 ---------- */
.advanced-panel {
    background: linear-gradient(145deg, #1a202c 0%, #2d3748 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    display: none;
    color: #e2e8f0;
    /* 宽度与6张卡牌区域一致: 6*220px + 5*12px = 1380px */
    width: 1380px;
    max-width: 95vw;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.advanced-panel.show {
    display: block;
}

.advanced-panel.show.horizontal-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

/* 响应式布局 - 与卡牌网格保持一致 */
@media (max-width: 1400px) {
    .advanced-panel {
        /* 5张卡牌: 5*220px + 4*12px = 1148px */
        width: 1148px;
    }
    .advanced-panel.show.horizontal-layout {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .advanced-panel {
        /* 4张卡牌: 4*220px + 3*12px = 916px */
        width: 916px;
    }
    .advanced-panel.show.horizontal-layout {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 950px) {
    .advanced-panel {
        /* 3张卡牌: 3*220px + 2*12px = 684px */
        width: 684px;
    }
    .advanced-panel.show.horizontal-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .advanced-panel {
        /* 2张卡牌: 2*160px + 1*10px = 330px */
        width: 330px;
        padding: 20px;
    }
    .advanced-panel.show.horizontal-layout {
        grid-template-columns: 1fr;
    }
}

/* ---------- 筛选组 ---------- */
.filter-group {
    margin-bottom: 25px;
}

.filter-group h3 {
    color: #e2e8f0;
    margin-bottom: 8px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-desc {
    font-size: 12px;
    color: #999;
    font-weight: normal;
}

.filter-note {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    padding-left: 5px;
    border-left: 3px solid #667eea;
}

.filter-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #4a5568;
    border-radius: 30px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
    background: #1a202c;
    color: #e2e8f0;
}

.filter-input:focus {
    border-color: #667eea;
    background: #2d3748;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.filter-tag {
    background: #2d3748;
    color: #e2e8f0;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    border: 1px solid #4a5568;
}

.filter-tag:hover {
    background: #4a5568;
}

.filter-tag.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.filter-tag[data-mode="any"],
.filter-tag[data-mode="all"] {
    background: #2d3748;
    border-color: #667eea;
}

.filter-tag[data-mode="any"].active,
.filter-tag[data-mode="all"].active {
    background: #667eea;
    color: white;
}

/* ---------- 数值范围输入 ---------- */
.range-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.range-inputs input {
    width: 100px;
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.range-inputs input:focus {
    border-color: #667eea;
}

.range-separator {
    color: #999;
    font-size: 16px;
    font-weight: bold;
}

/* ---------- 下拉选择器 ---------- */
.filter-select {
    width: 100%;
    height: 45px;
    padding: 12px 15px;
    border: 2px solid #4a5568;
    border-radius: 30px;
    font-size: 14px;
    background: #1a202c;
    color: #e2e8f0;
    outline: none;
    transition: all 0.3s;
}

.filter-select:focus {
    border-color: #667eea;
    background: #2d3748;
}

.custom-select {
    position: relative;
    width: 100%;
    user-select: none;
}

.select-selected {
    background-color: #1a202c;
    color: #e2e8f0;
    border: 2px solid #4a5568;
    border-radius: 30px;
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.select-selected:hover {
    border-color: #667eea;
}

.select-selected.active {
    border-color: #667eea;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.select-text {
    flex: 1;
    font-size: 14px;
}

@media (max-width: 768px) {
    /* Search / Home 移动高级搜索控件统一为同一家族尺寸。 */
    body.mobile-search-page .mobile-search-filter-grid {
        gap: 0.42rem;
    }

    body.mobile-search-page .mobile-search-quick-select,
    body.mobile-search-page .mobile-search-drawer-btn,
    body.mobile-search-page .mobile-search-pill,
    body.mobile-search-page .mobile-search-input,
    body.mobile-search-page .mobile-search-select {
        min-height: 36px;
        border-radius: 12px;
        font-size: 0.75rem;
        font-weight: 800;
    }

    body.mobile-search-page .mobile-search-quick-select,
    body.mobile-search-page .mobile-search-input,
    body.mobile-search-page .mobile-search-select {
        padding: 0 0.58rem;
    }

    body.mobile-search-page .mobile-search-drawer-btn {
        padding: 0 0.64rem;
        font-size: 0.75rem;
    }

    body.mobile-search-page .mobile-search-drawer-body {
        gap: 0.72rem;
    }

    body.mobile-search-page .mobile-search-field,
    body.mobile-search-page .mobile-search-field-grid {
        gap: 0.4rem;
    }

    body.mobile-search-page .mobile-search-drawer-actions .btn {
        min-height: 38px;
        border-radius: 12px;
        font-weight: 800;
    }
}

.filter-option-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.filter-option-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: contain;
    flex-shrink: 0;
}

.select-arrow {
    font-size: 12px;
    color: #a0aec0;
    transition: transform 0.3s;
}

.select-selected.active .select-arrow {
    transform: rotate(180deg);
}

.select-items {
    position: absolute;
    background-color: #1a202c;
    border: 2px solid #667eea;
    border-top: none;
    border-bottom-left-radius: 30px;
    border-bottom-right-radius: 30px;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.select-items.show {
    display: block;
}

.select-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
    font-size: 14px;
    color: #e2e8f0;
}

.select-item:hover {
    background-color: #2d3748;
}

.select-item.selected {
    background-color: #667eea;
    color: white;
}

.select-item img {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    vertical-align: middle;
}

.select-text .filter-option-icon {
    width: 18px;
    height: 18px;
    margin-right: 0;
}

/* ---------- 搜索按钮 ---------- */
.advanced-search-btn {
    flex: 1;
    padding: 6px 14px !important;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 18px !important;
    font-size: 13px !important;
    cursor: pointer;
    transition: all 0.3s;
    height: 36px;
}

.advanced-search-btn:hover {
    background: #764ba2;
}

.reset-btn {
    padding: 6px 14px !important;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 18px !important;
    font-size: 13px !important;
    cursor: pointer;
    transition: all 0.3s;
    height: 36px;
}

.reset-btn:hover {
    background: #e0e0e0;
}

/* ---------- 结果区域 ---------- */
.results-container {
    width: 100%;
}

/* 结果头部布局 - 独立两列布局：左侧结果数，右侧排序 */
.results-header-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 1536px;
    margin: 0 auto 16px;
    padding: 0 10px;
    color: #fff;
}

/* 卡牌计数显示在左侧 */
.results-count-wrapper {
    justify-self: start;
    display: flex;
    align-items: center;
}

/* 排序按钮显示在右侧 */
.results-sort-wrapper {
    justify-self: end;
    display: flex;
    align-items: center;
}

.results-count {
    font-size: 16px;
    opacity: 0.9;
}

.results-sort select {
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

/* 响应式布局 */
@media (max-width: 700px) {
    .results-header-grid {
        padding: 0 5px;
        gap: 10px;
    }
}

/* ---------- 卡片网格 ---------- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 220px);
    gap: 12px;
    margin-top: 0;
    justify-content: center;
    justify-items: stretch;
}

@media (max-width: 700px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fit, 160px);
        gap: 10px;
    }
}

.card {
    background: linear-gradient(145deg, #1a202c 0%, #2d3748 100%) !important;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    border: 1px solid #4a5568;
    width: 220px;
    max-width: none;
    margin: 0;
}

@media (max-width: 700px) {
    .card {
        width: 160px;
    }
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    background: linear-gradient(145deg, #2d3748 0%, #1a202c 100%) !important;
}

.card-image {
    width: 100% !important;
    height: 280px !important;
    object-fit: contain !important;
    background: #2d3748;
    padding: 10px;
    transition: opacity 0.2s ease;
}

.card-item, .card {
    height: auto !important;
}

.card-info {
    padding: 15px;
    border-top: 1px solid #4a5568;
}

.card-name-cn {
    font-size: 16px;
    font-weight: bold;
    color: #e2e8f0;
    margin-bottom: 3px;
}

.card-name-en {
    font-size: 13px;
    color: #a0aec0;
    margin-bottom: 5px;
}

.card-number {
    font-size: 12px;
    color: #718096;
    font-family: monospace;
    margin-bottom: 5px;
}

.card-rarity {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    color: white;
}

/* 稀有度颜色 */
.rarity-C { background: #808080; }
.rarity-U { background: #808080; }
.rarity-R { background: #28a745; }
.rarity-SR { background: #007bff; }
.rarity-UR { background: linear-gradient(135deg, #FFD700, #FFA500); color: #333; }
.rarity-PR { background: linear-gradient(135deg, #FFD700, #FFA500); color: #333; }
.rarity-CSR { background: #dc3545; }
.rarity-CUR { background: #dc3545; }
.rarity-CPR { background: #dc3545; }

/* ---------- 加载与空状态 ---------- */
.loading {
    text-align: center;
    padding: 50px;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin: 20px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.no-results {
    text-align: center;
    padding: 50px;
    color: white;
    font-size: 18px;
    grid-column: 1 / -1;
}

/* ---------- 分页导航 ---------- */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    padding: 20px 0;
    width: 100%;
}

.mobile-search-shell,
.mobile-search-filter-backdrop,
.mobile-search-filter-drawer {
    display: none;
}

@media (min-width: 769px) {
    /* 桌面保护：移动端搜索壳层和抽屉不参与桌面布局。 */
    .mobile-search-shell,
    .mobile-search-filter-backdrop,
    .mobile-search-filter-drawer {
        display: none !important;
    }

    .search-container,
    .action-row {
        display: flex;
    }

    .search-container {
        display: block;
    }
}

@media (max-width: 768px) {
    .search-container,
    .action-row,
    .advanced-panel,
    #resultsContainer {
        display: none !important;
    }

    .mobile-search-shell {
        position: relative;
        display: grid;
        gap: 0.95rem;
        padding:
            calc(var(--mobile-topbar-offset, 72px) + 0.85rem)
            var(--mobile-page-gutter, 0.9rem)
            calc(var(--mobile-tabbar-space, 96px) + 1rem);
    }

    .mobile-search-hero,
    .mobile-search-results-panel {
        border-radius: 26px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        background: linear-gradient(160deg, rgba(12, 20, 36, 0.94), rgba(31, 44, 72, 0.86));
        box-shadow: 0 18px 38px rgba(0, 0, 0, 0.22);
        backdrop-filter: blur(16px);
    }

    .mobile-search-hero {
        position: relative;
        padding: 0.95rem;
    }

    .mobile-search-box {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.55rem;
        padding: 0.38rem;
        border-radius: 22px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-search-box input,
    .mobile-search-input,
    .mobile-search-select {
        min-width: 0;
        width: 100%;
        border: none;
        outline: none;
        color: #f8fafc;
        font-size: 0.94rem;
    }

    .mobile-search-box input {
        background: transparent;
        padding: 0 0.8rem;
    }

    .mobile-search-box input::placeholder,
    .mobile-search-input::placeholder {
        color: #8fa0c2;
    }

    .mobile-search-box button,
    .mobile-search-load-more {
        min-height: 46px;
        border: none;
        border-radius: 18px;
        background: linear-gradient(135deg, #ffd76a, #ffb703);
        color: #111827;
        font-size: 0.9rem;
        font-weight: 800;
    }

    .mobile-search-suggestions {
        position: absolute;
        top: calc(100% - 0.4rem);
        left: 0.95rem;
        right: 0.95rem;
        z-index: 30;
        display: none;
        padding: 0.4rem;
        border-radius: 20px;
        background: rgba(11, 17, 29, 0.98);
        border: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
    }

    .mobile-search-suggestion {
        display: grid;
        gap: 0.12rem;
        width: 100%;
        padding: 0.72rem 0.75rem;
        border: none;
        border-radius: 16px;
        background: transparent;
        color: #eef3ff;
        text-align: left;
    }

    .mobile-search-suggestion + .mobile-search-suggestion {
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    .mobile-search-suggestion small {
        color: #8fa0c2;
    }

    .mobile-search-controls {
        display: grid;
        gap: 0.55rem;
    }

    .mobile-search-chip-row {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        padding: 0.05rem 0.02rem 0.16rem;
        scrollbar-width: none;
    }

    .mobile-search-chip-row::-webkit-scrollbar {
        display: none;
    }

    .mobile-search-chip,
    .mobile-search-drawer-btn,
    .mobile-search-pill {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 0.52rem 0.8rem;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.13);
        background: rgba(255, 255, 255, 0.08);
        color: #dfe6f7;
        font-size: 0.82rem;
        font-weight: 700;
    }

    .mobile-search-chip.active,
    .mobile-search-pill.active {
        background: #f0c75e;
        border-color: #f0c75e;
        color: #151515;
    }

    .mobile-search-drawer-btn {
        margin-left: auto;
        color: #ffd76a;
    }

    .mobile-search-results-panel {
        padding: 0.95rem;
    }

    .mobile-search-results-head {
        margin-bottom: 0.85rem;
    }

    .mobile-search-kicker {
        margin: 0 0 0.28rem;
        color: #ffd76a;
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.14em;
        text-transform: uppercase;
    }

    .mobile-search-results-head h1 {
        margin: 0;
        color: #f8fafc;
        font-size: 1rem;
        line-height: 1.4;
    }

    .mobile-search-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.82rem;
    }

    .mobile-search-card {
        display: grid;
        border-radius: 22px;
        overflow: hidden;
        text-decoration: none;
        background: linear-gradient(180deg, rgba(10, 17, 30, 0.96), rgba(17, 26, 43, 0.94));
        border: 1px solid rgba(255, 255, 255, 0.11);
        box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
    }

    .mobile-search-card-image {
        position: relative;
        aspect-ratio: 9 / 12;
        background: linear-gradient(145deg, #20283f, #111827);
    }

    .mobile-search-card-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
    }

    .mobile-search-card-placeholder {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: rgba(255, 255, 255, 0.4);
        letter-spacing: 0.14em;
        font-size: 0.74rem;
        font-weight: 700;
    }

    .mobile-search-card-body {
        display: grid;
        gap: 0.38rem;
        padding: 0.74rem 0.72rem 0.8rem;
    }

    .mobile-search-card-name {
        color: #f8fafc;
        font-size: 0.9rem;
        font-weight: 800;
        line-height: 1.3;
        min-height: 2.34em;
        display: -webkit-box;
        overflow: hidden;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .mobile-search-card-subtitle {
        color: #9aa8c5;
        font-size: 0.76rem;
        line-height: 1.3;
        min-height: 2.1em;
        display: -webkit-box;
        overflow: hidden;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .mobile-search-card-meta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.45rem;
        color: #8fa0c2;
        font-size: 0.7rem;
        font-family: 'Courier New', monospace;
    }

    .mobile-search-card-rarity {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 42px;
        min-height: 22px;
        padding: 0.15rem 0.46rem;
        border-radius: 999px;
        font-size: 0.68rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    .mobile-search-card-series {
        color: #7f8db0;
        font-size: 0.72rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-search-card-price {
        color: #ffd76a;
        font-size: 0.88rem;
        font-weight: 900;
    }

    .mobile-search-card-price.no-price {
        color: #b6c2de;
    }

    .mobile-search-state {
        grid-column: 1 / -1;
        min-height: 180px;
        padding: 1.4rem 1rem;
        border-radius: 22px;
        border: 1px dashed rgba(255, 255, 255, 0.16);
        background: rgba(255, 255, 255, 0.05);
        color: #dfe6f7;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1.6;
    }

    .mobile-search-load-more {
        width: 100%;
        margin-top: 0.9rem;
    }

    .mobile-search-filter-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1100;
        background: rgba(0, 0, 0, 0.58);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .mobile-search-filter-backdrop.active {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-search-filter-drawer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1101;
        display: block;
        padding: 0.75rem 1rem calc(1rem + env(safe-area-inset-bottom));
        border-radius: 26px 26px 0 0;
        background: linear-gradient(180deg, #172033, #0d1220);
        border: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: 0 -20px 46px rgba(0, 0, 0, 0.38);
        transform: translateY(105%);
        transition: transform 0.24s ease;
    }

    .mobile-search-filter-drawer.active {
        transform: translateY(0);
    }

    .mobile-search-drawer-handle {
        width: 44px;
        height: 5px;
        margin: 0 auto 0.75rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.2);
    }

    .mobile-search-drawer-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.8rem;
        margin-bottom: 0.95rem;
    }

    .mobile-search-drawer-header h2 {
        margin: 0;
        color: #f8fafc;
        font-size: 1.06rem;
    }

    .mobile-search-drawer-close {
        min-width: 38px;
        min-height: 38px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.08);
        color: #f8fafc;
        font-size: 1.2rem;
    }

    .mobile-search-drawer-body {
        display: grid;
        gap: 0.82rem;
        max-height: min(70vh, 640px);
        overflow-y: auto;
        padding-right: 0.1rem;
    }

    .mobile-search-field,
    .mobile-search-field-grid {
        display: grid;
        gap: 0.48rem;
    }

    .mobile-search-field span {
        color: #dfe6f7;
        font-size: 0.8rem;
        font-weight: 700;
    }

    .mobile-search-field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-search-input,
    .mobile-search-select {
        min-height: 44px;
        padding: 0.78rem 0.9rem;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-search-select option {
        color: #111827;
    }

    .mobile-search-pill-row {
        display: flex;
        gap: 0.45rem;
        flex-wrap: wrap;
    }

    .mobile-search-drawer-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
        margin-top: 0.95rem;
    }
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 20px;
    background: #4a5568;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
}

.pagination-btn:hover {
    background: #667eea;
    transform: translateY(-2px);
}

.pagination-btn.active {
    background: #667eea;
    color: white;
    cursor: default;
}

.pagination-btn.pagination-prev,
.pagination-btn.pagination-next {
    padding: 10px 20px;
    background: #667eea;
}

.pagination-btn.pagination-prev:hover,
.pagination-btn.pagination-next:hover {
    background: #764ba2;
}

.pagination-dots {
    padding: 10px 8px;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    #searchInput {
        font-size: 16px;
        padding: 12px 20px;
    }
    #searchBtn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .pagination-container {
        margin-top: 20px;
        padding: 15px 0;
    }
    
    .pagination {
        gap: 6px;
    }
    
    .pagination-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-width: 36px;
    }
    
    .pagination-btn.pagination-prev,
    .pagination-btn.pagination-next {
        padding: 8px 16px;
    }
}

/* ===== 手机端结构重做：贴顶搜索工具页，结果区不再套厚 panel ===== */
@media (max-width: 768px) {
    .mobile-search-shell {
        gap: 0.55rem;
        padding:
            calc(var(--mobile-topbar-offset, 56px) + 0.3rem)
            0.7rem
            calc(var(--mobile-tabbar-space, 64px) + 0.65rem);
    }

    .mobile-search-hero,
    .mobile-search-results-panel {
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
    }

    .mobile-search-box {
        padding: 0.28rem;
        border-radius: 18px;
        background: rgba(246, 248, 252, 0.96);
        border: 1px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
    }

    .mobile-search-box input {
        color: #0f172a;
        padding: 0 0.7rem;
        font-size: 0.94rem;
    }

    .mobile-search-box input::placeholder {
        color: #69758b;
    }

    .mobile-search-box button {
        min-height: 40px;
        padding: 0 0.88rem;
        border-radius: 14px;
        font-size: 0.86rem;
    }

    .mobile-search-controls {
        gap: 0.34rem;
        margin-top: 0.1rem;
    }

    .mobile-search-chip-row {
        gap: 0.36rem;
        padding-bottom: 0.06rem;
    }

    .mobile-search-chip,
    .mobile-search-drawer-btn,
    .mobile-search-pill {
        min-height: 32px;
        padding: 0.38rem 0.66rem;
        font-size: 0.76rem;
        background: rgba(255, 255, 255, 0.07);
    }

    .mobile-search-results-head {
        margin: 0.12rem 0 0.46rem;
    }

    .mobile-search-kicker {
        display: none;
    }

    .mobile-search-results-head h1 {
        color: #cbd5e1;
        font-size: 0.78rem;
        font-weight: 700;
    }

    .mobile-search-grid {
        gap: 0.64rem;
    }

    .mobile-search-card {
        border-radius: 14px;
        box-shadow: none;
        background: rgba(10, 17, 30, 0.88);
    }

    .mobile-search-card-image {
        aspect-ratio: 9 / 12.2;
    }

    .mobile-search-card-body {
        padding: 0.56rem 0.55rem 0.62rem;
        gap: 0.25rem;
    }

    .mobile-search-card-name {
        font-size: 0.82rem;
    }

    .mobile-search-card-subtitle,
    .mobile-search-card-series {
        font-size: 0.68rem;
    }

    .mobile-search-state {
        min-height: 128px;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.05);
    }
}

/* ===== Search mobile 从 0 重做：贴顶搜索工具页 + 紧凑结果流 ===== */
@media (max-width: 768px) {
    body.mobile-search-page .mobile-search-shell {
        display: block;
        box-sizing: border-box;
        width: 100%;
        min-height: calc(100vh - var(--mobile-tabbar-space, 60px));
        padding: 0.4rem 0 0;
        gap: 0;
        background: #f4f6fa;
    }

    body.mobile-search-page .mobile-search-hero {
        position: sticky;
        top: 0;
        z-index: 40;
        padding: 0.42rem 0.65rem 0.35rem;
        background: rgba(244, 246, 250, 0.96);
        border: 0;
        border-bottom: 1px solid #e5eaf2;
        border-radius: 0;
        box-shadow: none;
        backdrop-filter: saturate(160%) blur(14px);
    }

    body.mobile-search-page .mobile-search-topbar {
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr);
        align-items: center;
        gap: 0.45rem;
    }

    body.mobile-search-page .mobile-search-back {
        min-width: 34px;
        min-height: 40px;
        border: 0;
        border-radius: 11px;
        background: transparent;
        color: #111827;
        font-size: 1.75rem;
        line-height: 1;
    }

    body.mobile-search-page .mobile-search-box {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        min-height: 44px;
        padding: 0.22rem;
        border: 1px solid #dbe2ec;
        border-radius: 13px;
        background: #fff;
        box-shadow: none;
    }

    body.mobile-search-page .mobile-search-box input {
        min-width: 0;
        height: 38px;
        padding: 0 0.68rem;
        border: 0;
        background: transparent;
        color: #111827;
        outline: none;
    }

    body.mobile-search-page .mobile-search-box button {
        min-width: 52px;
        min-height: 38px;
        border: 0;
        border-radius: 10px;
        background: #1d4ed8;
        color: #fff;
        font-size: 0.82rem;
        font-weight: 850;
    }

    body.mobile-search-page .mobile-search-controls {
        display: flex;
        flex-direction: row;
        align-items: center;
        width: 100%;
        gap: 0.35rem;
        margin: 0;
        padding: 0.4rem 0.65rem 0.45rem;
        overflow-x: auto;
        background: #f4f6fa;
        border-bottom: 1px solid #e5eaf2;
        scrollbar-width: none;
    }

    body.mobile-search-page .mobile-search-controls::-webkit-scrollbar {
        display: none;
    }

    body.mobile-search-page .mobile-search-chip-row {
        display: flex;
        flex: 0 0 auto;
        flex-wrap: nowrap;
        gap: 0.35rem;
        padding: 0;
        overflow: visible;
    }

    body.mobile-search-page .mobile-search-chip,
    body.mobile-search-page .mobile-search-drawer-btn,
    body.mobile-search-page .mobile-search-pill {
        min-height: 30px;
        padding: 0.3rem 0.62rem;
        border: 1px solid #dbe2ec;
        border-radius: 999px;
        background: #fff;
        color: #334155;
        font-size: 0.74rem;
        font-weight: 800;
        box-shadow: none;
    }

    body.mobile-search-page .mobile-search-chip.active {
        border-color: #1d4ed8;
        background: #dbeafe;
        color: #1d4ed8;
    }

    body.mobile-search-page .mobile-search-drawer-btn {
        color: #1d4ed8;
    }

    body.mobile-search-page .mobile-search-results-panel {
        padding: 0;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    body.mobile-search-page .mobile-search-results-head {
        margin: 0;
        padding: 0.45rem 0.75rem 0.2rem;
    }

    body.mobile-search-page .mobile-search-kicker {
        display: none;
    }

    body.mobile-search-page .mobile-search-results-head h1 {
        margin: 0;
        color: #64748b;
        font-size: 0.76rem;
        font-weight: 800;
    }

    body.mobile-search-page .mobile-search-grid {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0 0 0.75rem;
    }

    body.mobile-search-page .mobile-search-card {
        display: grid;
        grid-template-columns: 54px minmax(0, 1fr);
        gap: 0.68rem;
        min-height: 74px;
        padding: 0.58rem 0.75rem;
        border: 0;
        border-top: 1px solid #e5eaf2;
        border-radius: 0;
        background: #fff;
        color: #111827;
        box-shadow: none;
    }

    body.mobile-search-page .mobile-search-card-image {
        width: 54px;
        height: 74px;
        aspect-ratio: auto;
        border-radius: 8px;
        background: #e5eaf2;
    }

    body.mobile-search-page .mobile-search-card-image img {
        object-fit: contain;
    }

    body.mobile-search-page .mobile-search-card-image img + .mobile-search-card-placeholder {
        display: none;
    }

    body.mobile-search-page .mobile-search-card-body {
        align-content: center;
        gap: 0.18rem;
        padding: 0;
    }

    body.mobile-search-page .mobile-search-card-name {
        color: #111827;
        font-size: 0.9rem;
        line-height: 1.2;
    }

    body.mobile-search-page .mobile-search-card-subtitle,
    body.mobile-search-page .mobile-search-card-series,
    body.mobile-search-page .mobile-search-card-meta {
        color: #64748b;
        font-size: 0.7rem;
    }

    body.mobile-search-page .mobile-search-card-price {
        color: #1d4ed8;
        font-size: 0.82rem;
    }

    body.mobile-search-page .mobile-search-state {
        margin: 0.75rem;
        padding: 0.85rem;
        border: 1px dashed #cbd5e1;
        border-radius: 12px;
        background: #fff;
        color: #64748b;
    }
}

/* ===== 本轮限定：Search mobile 深色回调 + 筛选顺序与 Home 对齐，不触碰桌面 ===== */
@media (max-width: 768px) {
    body.mobile-search-page {
        background:
            radial-gradient(circle at top, rgba(255, 215, 106, 0.1), transparent 24%),
            linear-gradient(180deg, #111a2e 0%, #0b1220 38%, #0a1020 100%) !important;
        color: #f8fafc;
    }

    body.mobile-search-page .main-content {
        background: transparent;
    }

    body.mobile-search-page .mobile-search-shell {
        min-height: calc(100vh - var(--mobile-tabbar-space, 60px));
        padding: 0.35rem 0 calc(var(--mobile-tabbar-space, 60px) + 0.8rem);
        background: transparent;
    }

    body.mobile-search-page .mobile-search-hero {
        position: sticky;
        top: 0;
        z-index: 40;
        padding: 0.4rem 0.65rem 0.34rem;
        background: rgba(11, 18, 32, 0.94);
        border-bottom: 1px solid rgba(255, 215, 106, 0.14);
        backdrop-filter: saturate(160%) blur(14px);
    }

    body.mobile-search-page .mobile-search-back {
        color: #f8fafc;
    }

    body.mobile-search-page .mobile-search-box {
        min-height: 46px;
        border: 1px solid rgba(255, 215, 106, 0.18);
        border-radius: 14px;
        background: rgba(17, 26, 46, 0.92);
        box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
    }

    body.mobile-search-page .mobile-search-box input {
        color: #f8fafc;
    }

    body.mobile-search-page .mobile-search-box input::placeholder {
        color: #8fa0c2;
    }

    body.mobile-search-page .mobile-search-box button {
        background: linear-gradient(135deg, #ffd76a, #ffb703);
        color: #111827;
        box-shadow: 0 8px 18px rgba(255, 183, 3, 0.22);
    }

    body.mobile-search-page .mobile-search-controls {
        margin: 0;
        padding: 0.42rem 0.65rem 0.48rem;
        background: rgba(11, 18, 32, 0.94);
        border-bottom: 1px solid rgba(255, 215, 106, 0.12);
        overflow: visible;
    }

    body.mobile-search-page .mobile-search-filter-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.42rem;
    }

    body.mobile-search-page .mobile-search-quick-field {
        display: grid;
        min-width: 0;
        gap: 0.16rem;
        margin: 0;
    }

    body.mobile-search-page .mobile-search-quick-field span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    body.mobile-search-page .mobile-search-quick-select,
    body.mobile-search-page .mobile-search-drawer-btn,
    body.mobile-search-page .mobile-search-pill,
    body.mobile-search-page .mobile-search-input,
    body.mobile-search-page .mobile-search-select {
        min-width: 0;
        min-height: 36px;
        border: 1px solid rgba(255, 215, 106, 0.14);
        border-radius: 12px;
        background: rgba(17, 26, 46, 0.88);
        color: #e8eefc;
        box-shadow: none;
    }

    body.mobile-search-page .mobile-search-quick-select,
    body.mobile-search-page .mobile-search-select {
        padding: 0 0.58rem;
        appearance: auto;
        color-scheme: dark;
    }

    body.mobile-search-page .mobile-search-quick-select option,
    body.mobile-search-page .mobile-search-select option {
        background: #111a2e;
        color: #f8fafc;
    }

body.mobile-search-page .mobile-search-drawer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 0.64rem;
    color: #ffd76a;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
}

    body.mobile-search-page .mobile-search-results-panel {
        padding: 0;
        background: transparent;
    }

    body.mobile-search-page .mobile-search-results-head {
        margin: 0;
        padding: 0.46rem 0.75rem 0.18rem;
    }

    body.mobile-search-page .mobile-search-results-head h1 {
        color: #aeb9d5;
    }

    body.mobile-search-page .mobile-search-card {
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(17, 26, 46, 0.9);
        color: #f8fafc;
    }

    body.mobile-search-page .mobile-search-card-image {
        background: rgba(9, 14, 26, 0.92);
    }

    body.mobile-search-page .mobile-search-card-name {
        color: #f8fafc;
    }

    body.mobile-search-page .mobile-search-card-subtitle,
    body.mobile-search-page .mobile-search-card-series,
    body.mobile-search-page .mobile-search-card-meta {
        color: #aeb9d5;
    }

    body.mobile-search-page .mobile-search-card-price {
        color: #ffd76a;
        font-weight: 900;
    }

    body.mobile-search-page .mobile-search-card-price.no-price {
        color: #b6c2de;
    }

    body.mobile-search-page .mobile-search-state {
        margin: 0.75rem;
        border: 1px dashed rgba(255, 215, 106, 0.16);
        background: rgba(17, 26, 46, 0.86);
        color: #dfe6f7;
    }

    body.mobile-search-page .mobile-search-pagination {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        gap: 0.5rem;
        align-items: center;
        margin: 0.62rem 0.75rem 0.9rem;
    }

    body.mobile-search-page .mobile-search-page-btn,
    body.mobile-search-page .mobile-search-page-indicator {
        min-height: 38px;
        border-radius: 12px;
        border: 1px solid rgba(255, 215, 106, 0.2);
        background: rgba(17, 26, 46, 0.9);
        color: #e8eefc;
        font-size: 0.78rem;
        font-weight: 800;
    }

    body.mobile-search-page .mobile-search-page-btn:disabled,
    body.mobile-search-page .mobile-search-page-indicator:disabled {
        opacity: 0.42;
        cursor: not-allowed;
    }

    body.mobile-search-page .mobile-search-page-indicator {
        min-width: 78px;
        padding: 0 0.8rem;
        color: #ffd76a;
    }

    body.mobile-search-page .mobile-search-page-jump-modal[hidden] {
        display: none !important;
    }

    body.mobile-search-page .mobile-search-page-jump-modal {
        position: fixed;
        inset: 0;
        z-index: 1200;
    }

    body.mobile-search-page .mobile-search-page-jump-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.58);
    }

    body.mobile-search-page .mobile-search-page-jump-panel {
        position: absolute;
        left: 50%;
        top: 50%;
        width: min(88vw, 320px);
        transform: translate(-50%, -50%);
        border-radius: 18px;
        border: 1px solid rgba(255, 215, 106, 0.16);
        background: linear-gradient(180deg, #17233d 0%, #0f172a 100%);
        box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
        padding: 0.9rem;
        display: grid;
        gap: 0.65rem;
    }

    body.mobile-search-page .mobile-search-page-jump-panel h3 {
        margin: 0;
        color: #f8fafc;
        font-size: 0.94rem;
    }

    body.mobile-search-page .mobile-search-page-jump-hint {
        margin: 0;
        color: #aeb9d5;
        font-size: 0.76rem;
    }

    body.mobile-search-page #mobileSearchPageJumpInput {
        min-height: 42px;
        border-radius: 12px;
        border: 1px solid rgba(255, 215, 106, 0.2);
        background: rgba(17, 26, 46, 0.9);
        color: #f8fafc;
        font-size: 0.96rem;
        font-weight: 800;
        text-align: center;
        outline: none;
    }

    body.mobile-search-page .mobile-search-page-jump-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
    }

    body.mobile-search-page .mobile-search-filter-backdrop {
        background: rgba(0, 0, 0, 0.58);
    }

    body.mobile-search-page .mobile-search-filter-drawer {
        border: 1px solid rgba(255, 215, 106, 0.14);
        background: linear-gradient(180deg, #17233d 0%, #0f172a 100%);
    }

    body.mobile-search-page .mobile-search-drawer-handle {
        background: rgba(255, 255, 255, 0.18);
    }

    body.mobile-search-page .mobile-search-kicker,
    body.mobile-search-page .mobile-search-field span {
        color: #aeb9d5;
    }

    body.mobile-search-page .mobile-search-drawer-header h2 {
        color: #f8fafc;
    }

    body.mobile-search-page .mobile-search-drawer-close {
        border-color: rgba(255, 215, 106, 0.14);
        background: rgba(255, 255, 255, 0.08);
        color: #f8fafc;
    }

    body.mobile-search-page .mobile-search-drawer-actions .btn-secondary {
        border-color: rgba(255, 215, 106, 0.16);
        background: rgba(17, 26, 46, 0.88);
        color: #dfe6f7;
    }

    body.mobile-search-page .mobile-search-drawer-actions .btn-primary {
        background: linear-gradient(135deg, #ffd76a, #ffb703);
        color: #111827;
        border: none;
    }
}
