/* ============================================================
   LibreTV 首页样式 - 重构版 (Safari 兼容，无 gap)
   ============================================================ */

/* ── Layout ─────────────────────────────────────────────────── */
.main-wrap {
    padding-top: 4.5rem;
    padding-bottom: 2rem;
}

.main-inner {
    min-height: calc(100vh - 200px);
}

/* ── Top corner buttons ─────────────────────────────────────── */
.top-corner-button {
    background: rgba(255, 255, 255, 0.05);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: .4rem .7rem;
    color: #a0a0b0;
    -webkit-transition: all .2s;
    transition: all .2s;
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.top-corner-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #f1f1f1;
}

.top-corner-button svg {
    display: block;
}

.corner-btn-label {
    display: none;
    font-size: .75rem;
    font-weight: 500;
    margin-left: .4rem;
}

@media (min-width: 640px) {
    .corner-btn-label {
        display: inline;
    }
}

/* ── Hero / search area ─────────────────────────────────────── */
.search-area {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 3rem 0 2rem;
    min-height: 55vh;
}

/* ── Hero header ─────────────────────────────────────────────── */
.hero-header {
    text-align: center;
    width: 100%;
}

.hero-logo-wrap {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    text-decoration: none;
    margin-bottom: .75rem;
}

.hero-icon {
    width: 44px;
    height: 44px;
    background: -webkit-linear-gradient(135deg, #e50914, #c8000b);
    background: linear-gradient(135deg, #e50914, #c8000b);
    border-radius: 12px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-shadow: 0 4px 20px rgba(229, 9, 20, 0.4);
    box-shadow: 0 4px 20px rgba(229, 9, 20, 0.4);
    margin-right: .75rem;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.hero-icon svg {
    width: 24px;
    height: 24px;
    color: white;
    stroke: white;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1;
    background: -webkit-linear-gradient(90deg, #f1f1f1 0%, #c8c8d8 100%);
    background: linear-gradient(90deg, #f1f1f1 0%, #c8c8d8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.hero-tagline {
    font-size: .9rem;
    color: #5a5a6e;
    margin-top: .5rem;
    letter-spacing: .02em;
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.2rem;
    }

    .hero-icon {
        width: 36px;
        height: 36px;
    }

    .hero-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* ── Search box ─────────────────────────────────────────────── */
.search-wrap {
    width: 100%;
    max-width: 640px;
}

.search-box {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: stretch;
    -ms-flex-align: stretch;
    align-items: stretch;
    height: 3.375rem;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    -webkit-box-shadow: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 255, 255, .04);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 255, 255, .04);
    -webkit-transition: all .25s ease;
    transition: all .25s ease;
}

.search-box:focus-within {
    border-color: rgba(229, 9, 20, 0.45);
    -webkit-box-shadow: 0 8px 32px rgba(0, 0, 0, .5), 0 0 0 1px rgba(229, 9, 20, .2), 0 0 20px rgba(229, 9, 20, .1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5), 0 0 0 1px rgba(229, 9, 20, .2), 0 0 20px rgba(229, 9, 20, .1);
    background: rgba(255, 255, 255, 0.06);
}

.search-side-btn {
    width: 5rem;
    min-width: 5rem;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    background: transparent;
    color: #a0a0b0;
    font-weight: 500;
    font-size: .875rem;
    font-family: inherit;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    -webkit-transition: all .2s;
    transition: all .2s;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.search-side-btn:hover {
    color: #f1f1f1;
    background: rgba(255, 255, 255, 0.04);
}

.search-submit {
    border-right: none;
    border-left: 1px solid rgba(0, 0, 0, .2);
    background: -webkit-linear-gradient(135deg, #e50914, #c8000b);
    background: linear-gradient(135deg, #e50914, #c8000b);
    color: white !important;
    font-weight: 600;
    letter-spacing: .01em;
}

.search-submit:hover {
    background: -webkit-linear-gradient(135deg, #ff1a25, #e50914) !important;
    background: linear-gradient(135deg, #ff1a25, #e50914) !important;
}

.search-input {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    background: transparent;
    border: none;
    color: #f1f1f1;
    padding: 0 1.25rem;
    font-size: .95rem;
    font-family: inherit;
    outline: none;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
}

.search-input::-webkit-input-placeholder {
    color: #4a4a5a;
}

.search-input::-moz-placeholder {
    color: #4a4a5a;
}

.search-input:-ms-input-placeholder {
    color: #4a4a5a;
}

.search-clear-btn {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 0 .6rem;
    background: transparent;
    border: none;
    color: #5a5a6e;
    cursor: pointer;
    -webkit-transition: color .2s;
    transition: color .2s;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.search-clear-btn:hover {
    color: #a0a0b0;
}

@media (max-width: 480px) {
    .search-box {
        height: 3rem;
        border-radius: 10px;
    }

    .search-side-btn {
        width: 3.75rem;
        min-width: 3.75rem;
        font-size: .8rem;
    }

    .search-input {
        padding: 0 .75rem;
        font-size: .875rem;
    }
}

/* ── Recent searches ─────────────────────────────────────────── */
.recent-searches {
    margin-top: 1rem;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.recent-search-tag {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    padding: .28rem .8rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 99px;
    color: #8a8a9a;
    font-size: .8rem;
    -webkit-transition: all .2s;
    transition: all .2s;
    cursor: pointer;
    white-space: nowrap;
    margin: .2rem .2rem;
}

.recent-search-tag:hover {
    background: rgba(229, 9, 20, 0.1);
    border-color: rgba(229, 9, 20, 0.3);
    color: #f1f1f1;
}

/* ── Douban section ─────────────────────────────────────────── */
.douban-inner {
    margin: 0 auto;
    max-width: 1280px;
    padding: 0 .5rem;
}

.douban-topbar {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    margin-bottom: .75rem;
}

.douban-heading {
    font-size: .9375rem;
    font-weight: 700;
    color: white;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin: 0;
}

.douban-heading svg {
    margin-right: .5rem;
}

.douban-controls {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

.douban-controls>*+* {
    margin-left: .5rem;
}

.douban-toggle {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 99px;
    padding: 3px;
}

.douban-toggle-button {
    padding: .25rem .875rem;
    font-size: .8rem;
    border-radius: 99px;
    font-weight: 500;
    -webkit-transition: all .2s;
    transition: all .2s;
    cursor: pointer;
    border: none;
    font-family: inherit;
    background: transparent;
    color: #6a6a7a;
}

.douban-toggle-button.active {
    background: var(--accent, #e50914);
    color: white;
    -webkit-box-shadow: 0 2px 8px rgba(229, 9, 20, 0.4);
    box-shadow: 0 2px 8px rgba(229, 9, 20, 0.4);
}

.douban-toggle-button:not(.active):hover {
    color: #a0a0b0;
}

.douban-refresh-button {
    font-size: .8rem;
    padding: .3rem .8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #8a8a9a;
    border-radius: 8px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-transition: all .2s;
    transition: all .2s;
    cursor: pointer;
    font-family: inherit;
}

.douban-refresh-button svg {
    margin-right: .3rem;
}

.douban-refresh-button:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #f1f1f1;
}

.douban-tags-container {
    overflow-x: auto;
    padding-bottom: .5rem;
    -webkit-overflow-scrolling: touch;
}

.douban-tags {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    white-space: nowrap;
}

.douban-tags>*+* {
    margin-left: .5rem;
}

.douban-tag {
    display: inline-block;
    padding: .25rem .75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    color: #6a6a7a;
    font-size: .8rem;
    -webkit-transition: all .2s;
    transition: all .2s;
    cursor: pointer;
    white-space: nowrap;
}

.douban-tag:hover {
    background: rgba(229, 9, 20, 0.1);
    border-color: rgba(229, 9, 20, 0.25);
    color: #d0d0d0;
}

.douban-tag.active {
    background: rgba(229, 9, 20, 0.15);
    border-color: rgba(229, 9, 20, 0.4);
    color: #ff6b6b;
}

.douban-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: -.375rem;
}

.douban-grid>* {
    width: calc(33.333% - .75rem);
    margin: .375rem;
}

@media (min-width: 480px) {
    .douban-grid>* {
        width: calc(25% - .75rem);
    }
}

@media (min-width: 640px) {
    .douban-grid>* {
        width: calc(20% - .75rem);
    }
}

@media (min-width: 768px) {
    .douban-grid>* {
        width: calc(14.2857% - .75rem);
    }
}

@media (min-width: 1280px) {
    .douban-grid>* {
        width: calc(11.111% - .75rem);
    }
}

/* ── Results section ─────────────────────────────────────────── */
.results-inner {
    /* NOTE: 加宽至 1200px 让 auto-fill 网格可展示更多列（每列 ≤160px，最多 ~7 列）*/
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}


.results-header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.results-label {
    font-size: .75rem;
    font-weight: 700;
    color: #5a5a6e;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 0;
}

.results-count {
    font-size: .75rem;
    color: #5a5a6e;
}

.results-count-num {
    color: #a0a0b0;
    font-weight: 600;
}

.results-total {
    color: #686879;
}

.results-remote-hint {
    color: #77778a;
    font-size: .72rem;
    white-space: nowrap;
}

.results-toolbar {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.35rem;
    padding: .85rem;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    background: rgba(21, 21, 29, .92);
}

.results-filter-button {
    min-width: 10.5rem;
    min-height: 3.4rem;
    padding: .6rem .85rem;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 10px;
    background: #22222c;
    color: #fff;
    text-align: left;
    cursor: pointer;
}

.results-filter-button:hover,
.results-filter-button:focus {
    border-color: rgba(229, 9, 20, .75);
    background: #2a2228;
}

.results-filter-kicker,
.results-filter-value {
    display: block;
}

.results-filter-kicker {
    margin-bottom: .18rem;
    color: #858596;
    font-size: .65rem;
}

.results-filter-value {
    color: #f4f4f7;
    font-size: .88rem;
    font-weight: 700;
}

.results-filter-summary {
    flex: 1 1 16rem;
    display: flex;
    align-items: center;
    min-height: 3.4rem;
    padding: .55rem .75rem;
    color: #858596;
    font-size: .7rem;
    line-height: 1.5;
}

.results-empty-filter {
    grid-column: 1 / -1;
    padding: 4rem 1rem;
    color: #9292a3;
    text-align: center;
}

/* 搜索结果海报卡片网格 */
.results-grid {
    display: grid;
    /* NOTE: minmax(0, 160px) 限制每列最大 160px，防止宽屏卡片过大 */
    grid-template-columns: repeat(auto-fill, minmax(120px, 160px));
    grid-gap: 1rem;
    gap: 1rem;
    /* 网格整体居左对齐（避免最后一行拉伸），同时受 results-inner max-width 约束 */
    justify-content: start;
}

@media (max-width: 900px) {
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 145px));
        grid-gap: .85rem;
        gap: .85rem;
    }
}

@media (max-width: 600px) {
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(96px, 130px));
        grid-gap: .65rem;
        gap: .65rem;
    }
}

@media (max-width: 400px) {
    .results-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-gap: .5rem;
        gap: .5rem;
    }
}

/* 搜索结果卡片 */
.result-card {
    opacity: 0;
    -webkit-animation: cardFadeIn .4s ease forwards;
    animation: cardFadeIn .4s ease forwards;
}

.result-poster {
    position: relative;
    /* NOTE: Safari 12 不支持 aspect-ratio，用 padding-bottom 实现 2:3 比例 */
    height: 0;
    padding-bottom: 150%; /* 2:3 = 3/2 = 150% */
    border-radius: 8px;
    overflow: hidden;
    background: #181820;
    -webkit-box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
    -webkit-transition: all .3s cubic-bezier(.4, 0, .2, 1);
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    /* NOTE: 限制海报最大高度，防止宽屏下图片过高 */
    max-height: 220px;
}
/* 现代浏览器恢复 aspect-ratio */
@supports (aspect-ratio: 2/3) {
    .result-poster {
        height: auto;
        padding-bottom: 0;
        aspect-ratio: 2 / 3;
        max-height: 220px;
    }
}


.result-card:hover .result-poster {
    -webkit-transform: scale(1.04);
    transform: scale(1.04);
    -webkit-box-shadow: 0 8px 30px rgba(229, 9, 20, .25), 0 0 0 1px rgba(229, 9, 20, .25);
    box-shadow: 0 8px 30px rgba(229, 9, 20, .25), 0 0 0 1px rgba(229, 9, 20, .25);
}

.result-poster-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
    object-fit: cover;
    display: block;
    -webkit-transition: transform .4s ease;
    transition: transform .4s ease;
}

.result-card:hover .result-poster-img {
    -webkit-transform: scale(1.08);
    transform: scale(1.08);
}

.result-poster-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e, #0f0f1a);
}

.result-poster-fallback span {
    font-size: 2rem;
    font-weight: 800;
    color: #333;
}

.result-poster-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .55);
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    opacity: 0;
    -webkit-transition: opacity .3s;
    transition: opacity .3s;
}

.result-card:hover .result-poster-overlay {
    opacity: 1;
}

.result-poster-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: .5rem .6rem .4rem;
    background: linear-gradient(to top, rgba(0, 0, 0, .85) 0%, transparent 100%);
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    grid-gap: .35rem;
    gap: .35rem;
    opacity: 1;
    /* 取消悬浮才显示的限制，常驻显示 */
    -webkit-transition: opacity .3s;
    transition: opacity .3s;
}

.result-card:hover .result-poster-info {
    opacity: 1;
}

.result-source-tag {
    font-size: .65rem;
    padding: .15rem .4rem;
    background: rgba(229, 9, 20, .8);
    border-radius: 4px;
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

.result-year-tag {
    font-size: .65rem;
    padding: .15rem .4rem;
    background: rgba(255, 255, 255, .25);
    border-radius: 4px;
    color: #eee;
    white-space: nowrap;
}

.result-type-badge {
    position: absolute;
    top: .4rem;
    left: .4rem;
    font-size: .6rem;
    padding: .15rem .4rem;
    background: rgba(59, 130, 246, .7);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    border-radius: 4px;
    color: white;
    font-weight: 600;
    z-index: 2;
}

.result-quality-badge {
    position: absolute;
    top: .4rem;
    right: .4rem;
    z-index: 3;
    padding: .22rem .46rem;
    border-radius: 999px;
    background: rgba(17, 17, 24, .86);
    color: #c4c4ce;
    font-size: .62rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
}

.result-quality-badge.uhd {
    background: rgba(229, 9, 20, .9);
    color: #fff;
}

.result-quality-badge.fhd {
    background: rgba(37, 99, 235, .9);
    color: #fff;
}

.result-quality-badge.hd {
    background: rgba(5, 150, 105, .9);
    color: #fff;
}

.result-quality-badge.sd {
    background: rgba(180, 83, 9, .9);
    color: #fff;
}

.result-speed-badge {
    position: absolute;
    top: 2rem;
    right: .4rem;
    z-index: 2;
    padding: .2rem .42rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, .72);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
}

.result-speed-indicator {
    display: inline-flex;
    align-items: center;
    grid-gap: 2px;
    gap: 2px;
    font-size: .62rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.result-speed-indicator.good {
    color: #34d399;
}

.result-speed-indicator.medium {
    color: #fbbf24;
}

.result-speed-indicator.poor,
.result-speed-indicator.error {
    color: #f87171;
}

.result-speed-indicator.pending {
    color: #d1d5db;
}

.result-card-title {
    padding: .4rem .2rem .2rem;
}

.result-card-name {
    font-size: .78rem;
    font-weight: 600;
    color: #e0e0e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-transition: color .2s;
    transition: color .2s;
    margin: 0;
    line-height: 1.3;
}

.result-card:hover .result-card-name {
    color: white;
}

.result-card-remarks {
    font-size: .65rem;
    color: #5a5a6e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: .1rem 0 0;
    line-height: 1.3;
}

/* ── Site footer ─────────────────────────────────────────────── */
.site-footer {
    margin-top: 2rem;
    padding: 2rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: #0a0a0f;
}

.footer-inner {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    text-align: center;
}

@media (min-width: 768px) {
    .footer-inner {
        -webkit-box-orient: horizontal;
        -webkit-box-direction: normal;
        -ms-flex-direction: row;
        flex-direction: row;
        -webkit-box-align: start;
        -ms-flex-align: start;
        align-items: flex-start;
        -webkit-box-pack: justify;
        -ms-flex-pack: justify;
        justify-content: space-between;
        text-align: left;
    }
}

.footer-brand {
    margin-bottom: 1.25rem;
}

@media (min-width: 768px) {
    .footer-brand {
        margin-bottom: 0;
        margin-right: 2rem;
    }
}

.footer-logo {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    text-decoration: none;
    margin-bottom: .35rem;
}

.footer-logo-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: -webkit-linear-gradient(135deg, #e50914, #c8000b);
    background: linear-gradient(135deg, #e50914, #c8000b);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    margin-right: .5rem;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.footer-logo-icon svg {
    width: 13px;
    height: 13px;
    stroke: white;
    color: white;
}

.footer-logo-text {
    font-size: .875rem;
    font-weight: 700;
    background: -webkit-linear-gradient(90deg, #f1f1f1, #a0a0b0);
    background: linear-gradient(90deg, #f1f1f1, #a0a0b0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-copy {
    font-size: .75rem;
    color: #3a3a4a;
}

.footer-right {
    max-width: 28rem;
}

.footer-disclaimer {
    font-size: .75rem;
    color: #3a3a4a;
    line-height: 1.6;
    margin-bottom: .75rem;
}

.footer-links {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .footer-links {
        -webkit-box-pack: end;
        -ms-flex-pack: end;
        justify-content: flex-end;
    }

    .footer-right {
        text-align: right;
    }
}

.footer-link {
    font-size: .75rem;
    color: #4a4a5a;
    text-decoration: none;
    -webkit-transition: color .2s;
    transition: color .2s;
    margin-left: 1rem;
}

.footer-link:first-child {
    margin-left: 0;
}

.footer-link:hover {
    color: #a0a0b0;
}

.footer-link-red:hover {
    color: #e50914;
}

/* ── Hot Recommend dual-section layout ──────────────────────── */
.hot-recommend-area {
    margin: 2rem 0;
}

.hot-recommend-wrap {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    grid-gap: 1.5rem;
    gap: 1.5rem;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 .5rem;
    -webkit-box-align: start;
    -ms-flex-align: start;
    align-items: flex-start;
}

.hot-section {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 0%;
    flex: 1 1 0%;
    min-width: 0;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    overflow: hidden;
    -webkit-transition: border-color .2s;
    transition: border-color .2s;
}

.hot-section:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.hot-section-inner {
    padding: 1.25rem 1.25rem 1rem;
}

.hot-section-header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    margin-bottom: 1rem;
    grid-gap: .75rem;
    gap: .75rem;
}

.hot-section-title {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    grid-gap: .5rem;
    gap: .5rem;
    font-size: .9375rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}

.hot-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 6px;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.4;
}

.tmdb-badge {
    background: linear-gradient(135deg, #01b4e4, #0d253f);
    color: #90e0f3;
    border: 1px solid rgba(1, 180, 228, .35);
    -webkit-box-shadow: 0 0 12px rgba(1, 180, 228, .25);
    box-shadow: 0 0 12px rgba(1, 180, 228, .25);
}

.douban-badge {
    background: linear-gradient(135deg, #e50914, #7b0008);
    color: #ffb3b3;
    border: 1px solid rgba(229, 9, 20, .35);
    -webkit-box-shadow: 0 0 12px rgba(229, 9, 20, .2);
    box-shadow: 0 0 12px rgba(229, 9, 20, .2);
}

.hot-section-tabs {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    grid-gap: .375rem;
    gap: .375rem;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

.hot-section-controls {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    grid-gap: .5rem;
    gap: .5rem;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

/* TMDB trending grid — 4 columns inside each panel */
.trending-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: .625rem;
    gap: .625rem;
}

@media (max-width: 1100px) {
    .trending-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 700px) {
    .trending-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* trending card fade-in */
.trending-card {
    opacity: 0;
    -webkit-animation: cardFadeIn .4s ease forwards;
    animation: cardFadeIn .4s ease forwards;
}

@-webkit-keyframes cardFadeIn {
    from {
        opacity: 0;
        -webkit-transform: translateY(8px);
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        -webkit-transform: none;
        transform: none;
    }
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* Douban grid compact: 4 cols inside panel */
.douban-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: -.3rem;
}

.douban-grid>* {
    width: calc(25% - .6rem);
    margin: .3rem;
}

@media (max-width: 1100px) {
    .douban-grid>* {
        width: calc(33.333% - .6rem);
    }
}

@media (max-width: 700px) {
    .douban-grid>* {
        width: calc(25% - .6rem);
    }
}

/* When only one section is visible, let it take full width */
.hot-recommend-wrap>.hot-section:only-child,
.hot-recommend-wrap:has(> .hot-section:only-child) .hot-section {
    max-width: 800px;
    margin: 0 auto;
    -webkit-box-flex: 0;
    -ms-flex: none;
    flex: none;
    width: 100%;
}

/* 手机端：纵向堆叠 + 正常显示热门推荐 */
@media (max-width: 767px) {
    .hot-recommend-wrap {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        grid-gap: 1rem;
        gap: 1rem;
    }

    .hot-section {
        width: 100% !important;
        -webkit-box-flex: 0;
        -ms-flex: none;
        flex: none;
    }

    .hot-section-inner {
        padding: 1rem .75rem .75rem;
    }

    .hot-section-header {
        flex-wrap: wrap;
        grid-gap: .5rem;
        gap: .5rem;
    }

    .trending-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-gap: .5rem;
        gap: .5rem;
    }

    .douban-grid>* {
        width: calc(33.333% - .6rem);
    }

    /* 搜索区域不占据过多空间，让热门推荐可见 */
    .search-area {
        min-height: auto !important;
        padding: 2rem 0 1rem;
    }
}

@media (max-width: 480px) {
    .trending-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-gap: .4rem;
        gap: .4rem;
    }

    .douban-grid>* {
        width: calc(33.333% - .4rem);
        margin: .2rem;
    }

    .douban-grid {
        margin: -.2rem;
    }

    .hot-section-inner {
        padding: .75rem .5rem .5rem;
    }
}

/* ── TV-first episode picker ───────────────────────────────── */
body.episode-picker-open {
    overflow: hidden;
}

.episode-picker-overlay {
    padding: 0 !important;
    background: rgba(4, 4, 8, .97) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

.episode-picker-shell {
    width: 100vw !important;
    max-width: none !important;
    height: 100vh;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
    background: #0b0b11 !important;
    box-shadow: none !important;
}

.episode-picker-head {
    min-height: 7rem;
    margin: 0 !important;
    padding: 1.25rem 3vw;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    background: #111119;
}

.episode-picker-heading {
    min-width: 0;
    flex: 1;
}

.episode-picker-kicker,
.episode-picker-section-kicker {
    display: block;
    margin-bottom: .35rem;
    color: #ff777d;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .16em;
}

.episode-picker-head .modal-title-text {
    max-width: none;
    padding: 0;
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    line-height: 1.25;
}

.episode-picker-status {
    margin-top: .45rem;
    color: #b8b8c8;
    font-size: clamp(.9rem, 1.35vw, 1.05rem);
}

.episode-picker-head-actions,
.episode-picker-toolbar-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.episode-picker-remote-hint {
    color: #a8a8b8;
    font-size: .9rem;
    white-space: nowrap;
}

.episode-picker-close {
    width: 3.25rem !important;
    height: 3.25rem !important;
    font-size: 2rem !important;
    border: 1px solid rgba(255, 255, 255, .14) !important;
}

.episode-picker-content {
    overflow: hidden !important;
}

.episode-picker-layout {
    display: grid;
    grid-template-columns: minmax(15rem, 26vw) minmax(0, 1fr);
    height: 100%;
}

.episode-picker-summary {
    overflow-y: auto;
    padding: 2rem 2.25rem;
    border-right: 1px solid rgba(255, 255, 255, .08);
    background: #0e0e15;
}

.episode-picker-summary .modal-detail-info {
    margin: 0;
}

.episode-picker-summary .detail-grid {
    display: block;
}

.episode-picker-summary .detail-item {
    margin-bottom: .85rem;
}

.episode-picker-summary .detail-desc {
    margin-top: 1.4rem;
}

.episode-picker-summary .detail-desc-content {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 8;
    overflow: hidden;
    line-height: 1.75;
}

.episode-picker-empty-summary {
    color: #777789;
    line-height: 1.7;
}

.episode-picker-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 2.5vw 2rem;
}

.episode-picker-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex: none;
    margin-bottom: 1.15rem;
}

.episode-picker-section-title {
    color: #f5f5f8;
    font-size: 1.35rem;
    font-weight: 800;
}

.episode-picker-tool-button {
    min-height: 3.15rem;
    padding: .7rem 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: .8rem;
    background: #242430;
    color: #f5f5f8;
    font-size: .95rem;
    font-weight: 700;
}

.episode-picker-tool-button.secondary {
    background: #191922;
    color: #c6c6d2;
}

.episode-order-icon {
    width: 1.1rem;
    height: 1.1rem;
    transition: transform .2s;
}

.episode-order-icon.is-reversed {
    transform: rotate(180deg);
}

.episode-picker-viewport {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: .35rem .5rem 2rem .35rem;
    scroll-padding: 1.25rem;
}

.episode-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
    gap: .9rem;
}

.episode-btn {
    min-height: 5rem;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: .25rem;
    border: 2px solid rgba(255, 255, 255, .13);
    border-radius: 1rem;
    background: #1a1a24;
    color: #d8d8e1;
    font-family: inherit;
    cursor: pointer;
    transition: transform .12s, border-color .12s, background .12s, box-shadow .12s;
}

.episode-btn strong {
    font-size: clamp(1.35rem, 2.1vw, 1.85rem);
    line-height: 1;
}

.episode-btn-prefix,
.episode-btn-suffix {
    color: #858595;
    font-size: .8rem;
}

.episode-btn:hover {
    background: #242432;
    border-color: rgba(255, 255, 255, .28);
}

.episode-btn:focus,
.episode-picker-tool-button:focus,
.episode-picker-close:focus,
.tv-navigation-active .episode-btn:focus,
.tv-navigation-active .episode-picker-tool-button:focus,
.tv-navigation-active .episode-picker-close:focus,
.episode-btn:focus-visible,
.episode-picker-tool-button:focus-visible,
.episode-picker-close:focus-visible {
    outline: none !important;
    color: #fff !important;
    border-color: #fff !important;
    background: #e50914 !important;
    box-shadow: 0 0 0 5px rgba(229, 9, 20, .36), 0 12px 28px rgba(0, 0, 0, .55) !important;
    transform: scale(1.07);
    position: relative;
    z-index: 2;
}

.episode-btn:focus .episode-btn-prefix,
.episode-btn:focus .episode-btn-suffix,
.tv-navigation-active .episode-btn:focus .episode-btn-prefix,
.tv-navigation-active .episode-btn:focus .episode-btn-suffix,
.episode-btn:focus-visible .episode-btn-prefix,
.episode-btn:focus-visible .episode-btn-suffix {
    color: rgba(255, 255, 255, .82);
}

.episode-picker-loading,
.episode-picker-error {
    height: 100%;
    padding: 2.5rem 4vw;
}

.episode-picker-loading-bar,
.episode-picker-skeleton-button {
    background: #22222d;
    animation: episodePickerPulse 1.2s ease-in-out infinite;
}

.episode-picker-loading-bar {
    width: 55%;
    height: 1.2rem;
    border-radius: .4rem;
    margin-bottom: .75rem;
}

.episode-picker-loading-bar.short {
    width: 32%;
}

.episode-picker-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
    gap: .9rem;
    margin-top: 2rem;
}

.episode-picker-skeleton-button {
    height: 5rem;
    border-radius: 1rem;
}

.episode-picker-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: #aaaaba;
    text-align: center;
}

.episode-picker-error strong {
    color: #fff;
    font-size: 1.5rem;
}

.episode-picker-error-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: .5rem;
}

@keyframes episodePickerPulse {
    50% { opacity: .45; }
}

@media (max-width: 900px) {
    .episode-picker-head {
        min-height: 6rem;
        padding: 1rem 1.25rem;
    }

    .episode-picker-remote-hint {
        display: none;
    }

    .episode-picker-layout {
        display: block;
        overflow-y: auto;
    }

    .episode-picker-summary {
        display: none;
    }

    .episode-picker-main {
        height: 100%;
        padding: 1.1rem 1rem 1.5rem;
    }

    .episode-picker-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: .65rem;
    }

    .episode-btn {
        min-height: 4.2rem;
    }
}

@media (max-width: 520px) {
    .episode-picker-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .episode-picker-toolbar-actions {
        width: 100%;
    }

    .episode-picker-tool-button {
        flex: 1;
    }

    .episode-picker-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Mobile adaptation refinements */
/* ── TV compact result flow ─────────────────────────────────── */
@media (min-width: 1200px) and (pointer: coarse) {
    .results-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-gap: .85rem;
        gap: .85rem;
    }

    .result-poster {
        aspect-ratio: 5 / 7;
    }

    .result-card-title {
        min-height: 2.35rem;
        padding-top: .3rem;
    }

    .result-card-name,
    .result-card-remarks {
        font-size: .72rem;
    }

    .result-card:focus {
        outline: none;
        position: relative;
        z-index: 4;
    }

    .result-card:focus .result-poster {
        transform: scale(1.035);
        box-shadow: 0 0 0 3px #fff, 0 0 0 6px #e50914, 0 10px 26px rgba(0, 0, 0, .55);
    }

    .result-card:focus .result-poster-overlay {
        opacity: 1;
    }
}

@media (min-width: 1600px) and (pointer: coarse) {
    .results-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 1rem;
    }
}

@media (min-width: 1200px) and (pointer: fine) {
    .results-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 1rem;
    }

    .result-poster {
        aspect-ratio: 5 / 7;
    }
}

@media (max-width: 767px) {
    .main-wrap {
        padding-top: 4rem;
        padding-bottom: 1.5rem;
    }

    .top-corner-button {
        padding: .42rem .55rem;
        border-radius: 12px;
    }

    .search-wrap {
        max-width: 100%;
    }

    .search-area {
        padding: 1.75rem 0 1rem;
    }

    .hero-logo-wrap {
        margin-bottom: .6rem;
    }

    .hero-tagline {
        font-size: .82rem;
        line-height: 1.5;
    }

    .results-inner,
    .douban-inner,
    .hot-recommend-wrap {
        padding-left: 0;
        padding-right: 0;
    }

    .hot-recommend-area {
        margin: 1.5rem 0;
    }

    .hot-section {
        border-radius: 14px;
    }

    .douban-topbar,
    .hot-section-header {
        align-items: flex-start;
    }

    .douban-topbar {
        flex-wrap: wrap;
        grid-gap: .75rem;
        gap: .75rem;
    }

    .hot-section-title {
        white-space: normal;
        line-height: 1.35;
    }

    .hot-section-controls,
    .douban-controls {
        width: 100%;
        justify-content: space-between;
    }

    .hot-section-tabs {
        flex: 1 1 auto;
    }

    .douban-controls {
        grid-gap: .375rem;
        gap: .375rem;
    }

    .douban-toggle-button {
        padding: .25rem .7rem;
    }

    .douban-refresh-button {
        padding: .35rem .65rem;
        white-space: nowrap;
    }

    .results-header {
        margin-bottom: 1rem;
        align-items: flex-end;
        grid-gap: .5rem;
        gap: .5rem;
    }
}

@media (max-width: 480px) {
    .main-wrap {
        padding-top: 3.75rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-tagline {
        font-size: .78rem;
    }

    .search-box {
        height: 2.9rem;
    }

    .search-side-btn {
        width: 3.5rem;
        min-width: 3.5rem;
        font-size: .78rem;
    }

    .search-input {
        font-size: .84rem;
        padding: 0 .65rem;
    }

    .search-clear-btn {
        padding: 0 .45rem;
    }

    .results-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-gap: .75rem;
        gap: .75rem;
    }

    .result-card-title {
        padding: .45rem .1rem 0;
    }

    .result-card-name {
        font-size: .74rem;
        white-space: normal;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        min-height: 2em;
    }

    .result-card-remarks {
        font-size: .62rem;
    }

    .hot-section-inner {
        padding: .85rem .65rem .65rem;
    }
}

@media (max-width: 360px) {
    .search-side-btn {
        width: 3.2rem;
        min-width: 3.2rem;
    }

    .results-grid {
        grid-gap: .6rem;
        gap: .6rem;
    }

    .trending-grid {
        grid-gap: .35rem;
        gap: .35rem;
    }
}

/* ── Unified responsive application shell ──────────────────── */
:root {
    --app-shell-max: 118rem;
    --app-gutter: clamp(1rem, 2vw, 2.75rem);
}

.app-shell {
    width: 100%;
    max-width: var(--app-shell-max) !important;
    padding-left: var(--app-gutter) !important;
    padding-right: var(--app-gutter) !important;
}

.app-content {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.app-corner {
    z-index: 60 !important;
    transition: opacity .2s ease, visibility .2s ease;
}

.app-corner-left {
    left: var(--app-gutter) !important;
}

.app-corner-right {
    right: var(--app-gutter) !important;
}

.search-area {
    width: 100%;
    min-height: clamp(22rem, 48vh, 32rem);
    padding-top: clamp(2.25rem, 5vh, 4rem);
    padding-bottom: clamp(1.5rem, 4vh, 3rem);
}

.search-wrap {
    max-width: clamp(40rem, 52vw, 52rem);
}

body.search-mode .search-area {
    min-height: auto;
    padding-top: clamp(.75rem, 2vh, 1.5rem);
    padding-bottom: .5rem;
}

body.search-mode .hero-title {
    font-size: clamp(2rem, 3vw, 2.75rem);
}

body.search-mode .hero-icon {
    width: 40px;
    height: 40px;
}

body.search-mode .hero-icon svg {
    width: 22px;
    height: 22px;
}

body.search-mode .hero-tagline {
    display: none;
}

body.search-mode .search-wrap {
    margin-top: .85rem !important;
}

.results-inner,
.douban-inner,
.hot-recommend-wrap {
    width: 100%;
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

.site-footer .container {
    width: 100%;
    max-width: var(--app-shell-max) !important;
    padding-left: var(--app-gutter) !important;
    padding-right: var(--app-gutter) !important;
}

@media (max-width: 767px) {
    :root {
        --app-gutter: max(.85rem, env(safe-area-inset-left));
    }

    .main-wrap {
        padding-top: max(4rem, calc(env(safe-area-inset-top) + 3.25rem));
    }

    .app-corner {
        top: max(1rem, env(safe-area-inset-top)) !important;
    }

    .search-area {
        min-height: auto;
        padding-top: 1.25rem;
        padding-bottom: .75rem;
    }

    .search-wrap {
        max-width: 100%;
    }

    .hot-recommend-area {
        margin-top: 1.25rem;
    }

    body.search-mode .main-wrap {
        padding-top: max(3.75rem, calc(env(safe-area-inset-top) + 3rem));
    }

    body.search-mode .search-area {
        padding-top: .5rem;
        padding-bottom: .25rem;
    }

    body.search-mode .hero-title {
        font-size: 1.75rem;
    }

    body.search-mode .hero-icon {
        width: 32px;
        height: 32px;
        border-radius: 10px;
    }

    body.search-mode .hero-icon svg {
        width: 18px;
        height: 18px;
    }
}

/* 720p living-room browsers and remote-first devices */
@media (min-width: 1200px) and (hover: none), (min-width: 1200px) and (pointer: coarse) {
    :root {
        --app-gutter: clamp(2rem, 3vw, 3.5rem);
    }

    .search-area {
        min-height: clamp(24rem, 50vh, 30rem);
    }

    .search-box {
        height: 4rem;
    }

    .top-corner-button,
    .search-side-btn,
    .recent-search-tag {
        min-height: 3rem;
    }

    .search-side-btn {
        min-width: 5.75rem;
        width: 5.75rem;
        font-size: .95rem;
    }

    .search-input {
        font-size: 1.05rem;
    }

    .results-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        grid-gap: 1.25rem;
        gap: 1.25rem;
    }
}

/* Television and living-room browser layout */
@media (min-width: 1600px) {
    :root {
        --app-gutter: clamp(2.5rem, 4vw, 5rem);
    }

    .main-wrap {
        padding-top: 5.25rem;
        padding-bottom: 3.5rem;
    }

    .search-area {
        min-height: clamp(28rem, 46vh, 34rem);
        padding-top: 3rem;
        padding-bottom: 2.5rem;
    }

    .hero-icon {
        width: 58px;
        height: 58px;
        border-radius: 16px;
        margin-right: 1rem;
    }

    .hero-icon svg {
        width: 30px;
        height: 30px;
    }

    .hero-title {
        font-size: clamp(3.5rem, 3.6vw, 4.6rem);
    }

    .hero-tagline {
        font-size: 1.05rem;
        margin-top: .75rem;
    }

    .search-wrap {
        max-width: 56rem;
    }

    .search-box {
        height: 4.25rem;
        border-radius: 18px;
    }

    .search-side-btn {
        width: 6.5rem;
        min-width: 6.5rem;
        font-size: 1rem;
    }

    .search-input {
        padding: 0 1.5rem;
        font-size: 1.1rem;
    }

    .recent-searches {
        margin-top: 1.25rem;
    }

    .recent-search-tag {
        min-height: 2.5rem;
        padding: .45rem 1rem;
        font-size: .9rem;
    }

    .top-corner-button {
        min-height: 3rem;
        padding: .65rem 1rem;
        font-size: .95rem;
    }

    .top-corner-button svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    .corner-btn-label {
        font-size: .9rem;
    }

    .hot-recommend-area {
        margin: 2.5rem 0 3rem;
    }

    .hot-recommend-wrap {
        grid-gap: 2rem;
        gap: 2rem;
    }

    .hot-section {
        border-radius: 20px;
    }

    .hot-section-inner {
        padding: 1.5rem;
    }

    .hot-section-title {
        font-size: 1.05rem;
    }

    .trending-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        grid-gap: .8rem;
        gap: .8rem;
    }

    .douban-grid > * {
        width: calc(20% - .7rem);
        margin: .35rem;
    }

    .results-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-gap: 1.5rem;
        gap: 1.5rem;
    }

    .results-label,
    .results-count {
        font-size: .9rem;
    }

    .result-card-name {
        font-size: .9rem;
    }

    .result-card-remarks {
        font-size: .72rem;
    }
}

@media (min-width: 2400px) {
    :root {
        --app-shell-max: 132rem;
    }

    .search-wrap {
        max-width: 64rem;
    }

    .search-box {
        height: 4.75rem;
    }

    .results-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }
}

/* ── Unified recommendation hub ─────────────────────────────── */
.hot-recommend-wrap {
    display: block;
    width: 100%;
    max-width: none;
    padding: 0;
}

.hot-recommend-hub {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 22px;
    background:
        radial-gradient(circle at 8% 0%, rgba(229, 9, 20, .12), transparent 34%),
        radial-gradient(circle at 92% 4%, rgba(1, 180, 228, .11), transparent 32%),
        rgba(15, 15, 22, .9);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
}

.hot-recommend-hub::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px);
    background-size: 100% 4rem;
    opacity: .35;
}

.hot-hub-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    grid-gap: 1.5rem;
    gap: 1.5rem;
    padding: 1.35rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    background: rgba(8, 8, 13, .56);
}

.hot-hub-heading {
    display: flex;
    align-items: center;
    grid-gap: .9rem;
    gap: .9rem;
    min-width: 0;
}

.hot-hub-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.2rem;
    height: 3.2rem;
    border-radius: 14px;
    color: #fff;
    font-size: .62rem;
    font-weight: 900;
    letter-spacing: .12em;
    writing-mode: vertical-rl;
    background: linear-gradient(145deg, #f21b2d, #9c0711);
    box-shadow: 0 12px 30px rgba(229, 9, 20, .24);
}

.hot-hub-title {
    margin: 0;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.hot-hub-subtitle {
    margin: .22rem 0 0;
    color: #6f6f82;
    font-size: .76rem;
}

.hot-hub-actions {
    display: flex;
    align-items: center;
    grid-gap: 1rem;
    gap: 1rem;
    min-width: 0;
}

.hot-source-switch {
    display: flex;
    align-items: center;
    grid-gap: .35rem;
    gap: .35rem;
    padding: .3rem;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    background: rgba(255, 255, 255, .035);
}

.hot-source-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    grid-gap: .48rem;
    gap: .48rem;
    min-height: 2.6rem;
    padding: .55rem .9rem;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #7d7d90;
    background: transparent;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s ease;
}

.hot-source-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, .05);
}

.hot-source-tab.active[data-hot-source="trending"] {
    color: #d8f7ff;
    border-color: rgba(1, 180, 228, .32);
    background: rgba(1, 180, 228, .12);
}

.hot-source-tab.active[data-hot-source="douban"] {
    color: #ffd6d8;
    border-color: rgba(229, 9, 20, .34);
    background: rgba(229, 9, 20, .14);
}

.hot-source-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 7px;
    color: #fff;
    font-size: .68rem;
    font-weight: 900;
}

.hot-source-mark.tmdb {
    background: linear-gradient(135deg, #01b4e4, #075b86);
}

.hot-source-mark.douban {
    background: linear-gradient(135deg, #f21b2d, #8c0710);
}

.hot-remote-hint {
    color: #555568;
    font-size: .68rem;
    white-space: nowrap;
}

.hot-hub-stage {
    position: relative;
    z-index: 1;
}

.hot-source-panel {
    width: 100%;
    min-width: 0;
}

.hot-source-panel.hidden {
    display: none !important;
}

.hot-source-panel.is-active {
    animation: hotSourceReveal .28s ease both;
}

.hot-source-panel .hot-section-inner {
    padding: 1.25rem 1.5rem 1.5rem;
}

.hot-source-toolbar {
    margin-bottom: 1rem;
    padding-bottom: .9rem;
    border-bottom: 1px solid rgba(255, 255, 255, .055);
}

.hot-source-caption {
    display: flex;
    align-items: center;
    grid-gap: .55rem;
    gap: .55rem;
    color: #d8d8e0;
    font-size: .82rem;
    font-weight: 650;
}

.hot-recommend-hub .trending-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-gap: 1rem;
    gap: 1rem;
}

.hot-recommend-hub .douban-grid {
    margin: -.5rem;
}

.hot-recommend-hub .douban-grid > * {
    width: calc(16.666% - 1rem);
    margin: .5rem;
}

@keyframes hotSourceReveal {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Television remote focus language */
.tv-spatial-item,
.hot-source-tab,
.hot-recommend-hub button,
.search-box button,
.top-corner-button {
    scroll-margin: 5rem;
}

body.tv-navigation-active button:focus,
body.tv-navigation-active a:focus,
body.tv-navigation-active input:focus,
body.tv-navigation-active select:focus,
body.tv-navigation-active textarea:focus,
body.tv-navigation-active [role="button"]:focus {
    position: relative;
    z-index: 20;
    outline: 3px solid #fff !important;
    outline-offset: 3px;
    box-shadow: 0 0 0 7px rgba(229, 9, 20, .78), 0 18px 45px rgba(0, 0, 0, .45) !important;
}

body.tv-navigation-active .tv-spatial-item:focus {
    transform: translateY(-4px) scale(1.035);
}

body.tv-navigation-active .trending-card:focus > div:first-child,
body.tv-navigation-active .douban-card:focus > div:first-child,
body.tv-navigation-active .result-card:focus .result-poster {
    transform: scale(1.04);
    box-shadow: 0 18px 42px rgba(0, 0, 0, .48), 0 0 0 4px #fff, 0 0 0 8px #e50914;
}

body.tv-navigation-active .result-card:focus .result-poster-overlay {
    opacity: 1;
}

body.tv-navigation-active .result-card:focus .result-card-name {
    color: #fff;
}

@media (max-width: 700px) {
    .results-header {
        align-items: flex-start;
    }

    .results-remote-hint {
        display: none;
    }

    .results-filter-button {
        flex: 1 1 calc(50% - .75rem);
        min-width: 8rem;
    }

    .results-filter-summary {
        flex-basis: 100%;
        min-height: auto;
        padding: .2rem .15rem;
    }
}

@media (min-width: 1200px) and (min-height: 650px) {
    .results-inner {
        max-width: 1180px;
    }

    .results-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 1.35rem;
    }

    .result-card-name {
        font-size: .9rem;
    }
}

@media (max-width: 900px) {
    .hot-hub-header {
        align-items: flex-start;
        flex-direction: column;
        grid-gap: 1rem;
        gap: 1rem;
    }

    .hot-hub-actions {
        width: 100%;
        justify-content: space-between;
    }

    .hot-recommend-hub .trending-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .hot-recommend-hub .douban-grid > * {
        width: calc(25% - 1rem);
    }
}

@media (max-width: 767px) {
    .hot-recommend-hub {
        border-radius: 17px;
    }

    .hot-hub-header {
        padding: 1rem;
    }

    .hot-hub-kicker {
        min-width: 2.65rem;
        height: 2.65rem;
        border-radius: 11px;
    }

    .hot-hub-title {
        font-size: 1rem;
    }

    .hot-hub-subtitle {
        font-size: .68rem;
    }

    .hot-hub-actions,
    .hot-source-switch {
        width: 100%;
    }

    .hot-source-tab {
        flex: 1 1 0;
        min-width: 0;
        padding: .5rem .55rem;
    }

    .hot-remote-hint {
        display: none;
    }

    .hot-source-panel .hot-section-inner {
        padding: .9rem .75rem 1rem;
    }

    .hot-source-toolbar {
        align-items: flex-start;
    }

    .hot-recommend-hub .trending-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-gap: .55rem;
        gap: .55rem;
    }

    .hot-recommend-hub .douban-grid {
        margin: -.25rem;
    }

    .hot-recommend-hub .douban-grid > * {
        width: calc(33.333% - .5rem);
        margin: .25rem;
    }
}

@media (min-width: 1600px) {
    .hot-hub-header {
        padding: 1.6rem 1.8rem;
    }

    .hot-hub-title {
        font-size: 1.4rem;
    }

    .hot-hub-subtitle {
        font-size: .84rem;
    }

    .hot-source-tab {
        min-height: 3rem;
        padding: .7rem 1.15rem;
        font-size: .88rem;
    }

    .hot-source-panel .hot-section-inner {
        padding: 1.5rem 1.8rem 1.8rem;
    }

    .hot-recommend-hub .trending-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
        grid-gap: 1.15rem;
        gap: 1.15rem;
    }

    .hot-recommend-hub .douban-grid > * {
        width: calc(12.5% - 1rem);
    }

    .hot-recommend-hub button,
    .hot-recommend-hub [role="button"] {
        min-height: 3rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hot-source-panel.is-active,
    .hot-source-tab {
        animation: none !important;
        transition-duration: .01ms !important;
    }

    .tv-spatial-item {
        opacity: 1 !important;
        animation: none !important;
        transition-duration: .01ms !important;
    }

    body.tv-navigation-active .tv-spatial-item:focus {
        transform: none;
    }
}

/* ── 手机端触控目标优化 ───────────────────────────────────── */
/* NOTE: Apple HIG 规定最小触控目标为 44×44px */
@media (max-width: 767px) {
    /* 防止 iOS Safari 自动缩放 */
    .search-input {
        font-size: 16px;
    }

    /* 按钮最小高度保证 */
    .hot-source-tab,
    .recent-search-tag,
    .results-filter-button,
    .douban-toggle-button,
    .douban-refresh-button {
        min-height: 44px;
    }

    /* 热门推荐卡片触控区域增大 */
    .trending-card,
    .douban-card {
        min-height: 180px;
    }

    /* 顶部角落按钮隐藏（已有底部导航栏） */
    .app-corner {
        display: none;
    }

    /* 为底部导航栏留出空间 */
    body {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }

    /* 搜索结果卡片间距增大 */
    .results-grid {
        gap: 0.85rem;
    }
}
