:root {
    --brand: #855be8;
    --brand-hover: #7447dd;
    --brand-light: #f7f1ff;
    --brand-rgb: 133, 91, 232;
    --accent: #00b6d8;
    --hero-end: #fff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --line-soft: #e5e6eb;
    --page-bg: #fff;
}

body {
    background: var(--page-bg);
    color: var(--text-main);
}

.xhs-download-page {
    padding: 0 0 72px;
    background: #fff;
}

.theme-home {
    --brand: #855be8;
    --brand-hover: #7447dd;
    --brand-light: #f7f1ff;
    --brand-rgb: 133, 91, 232;
    --hero-end: #f8fbff;
}

.theme-xhs {
    --brand: #ff2442;
    --brand-hover: #e51f3b;
    --brand-light: #fff0f3;
    --brand-rgb: 255, 36, 66;
    --hero-end: #fff7f9;
}

.theme-tiktok {
    --brand: #111827;
    --brand-hover: #000;
    --brand-light: #f4f4f5;
    --brand-rgb: 17, 24, 39;
    --hero-end: #fafafa;
}

.theme-bilibili {
    --brand: #00a1d6;
    --brand-hover: #008ac1;
    --brand-light: #effaff;
    --brand-rgb: 0, 161, 214;
    --hero-end: #f6fcff;
}

.result-theme-home {
    --brand: #855be8;
    --brand-hover: #7447dd;
    --brand-light: #f7f1ff;
    --brand-rgb: 133, 91, 232;
}

.result-theme-xhs,
.result-theme-xiaohongshu {
    --brand: #ff2442;
    --brand-hover: #e51f3b;
    --brand-light: #fff0f3;
    --brand-rgb: 255, 36, 66;
}

.result-theme-tiktok,
.result-theme-douyin {
    --brand: #111827;
    --brand-hover: #000;
    --brand-light: #f4f4f5;
    --brand-rgb: 17, 24, 39;
}

.result-theme-bilibili {
    --brand: #00a1d6;
    --brand-hover: #008ac1;
    --brand-light: #effaff;
    --brand-rgb: 0, 161, 214;
}

.brand-text {
    color: var(--brand);
}

.site-navbar {
    min-height: 64px;
    box-shadow: 0 1px 10px rgba(17, 24, 39, 0.04);
}

.site-brand {
    margin-right: 8px;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 1.38rem;
    letter-spacing: 0;
    white-space: nowrap;
}

.site-brand:hover {
    color: transparent;
}

.site-nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 64px;
    color: var(--text-muted);
    font-size: 1.04rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0;
    white-space: nowrap;
}

.site-nav-link:hover,
.site-nav-link.active {
    color: var(--brand);
}

.site-nav-link.active::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: var(--brand);
    content: "";
}

.nav-settings-btn {
    min-width: 94px;
    min-height: 40px;
    border-radius: 999px;
    font-weight: 700;
}

.hero-section {
    padding: 58px 0 58px;
    transition: padding .2s ease;
}

.hero-search-form {
    max-width: 680px;
    margin: 46px auto 0;
    transition: margin .2s ease;
}

.hero-title {
    margin: 0;
    color: var(--text-main);
    font-size: 3.6rem;
    font-weight: 900;
    line-height: 1.12;
    letter-spacing: 0;
    transition: font-size .2s ease;
}

.hero-subtitle {
    max-width: 980px;
    margin: 18px auto 0;
    color: var(--text-muted);
    font-size: 1.18rem;
    font-weight: 500;
    line-height: 1.7;
    transition: margin .2s ease, font-size .2s ease;
}

.theme-xhs .hero-title,
.theme-bilibili .hero-title {
    color: var(--brand);
}

.hero-input-shell {
    display: grid;
    min-height: 64px;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(17, 24, 39, 0.06);
    overflow: hidden;
    transition: min-height .2s ease, box-shadow .2s ease;
}

.hero-input-shell:focus-within {
    border-color: rgba(var(--brand-rgb), .55);
    box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .12);
}

.hero-paste-icon-btn {
    display: inline-flex;
    width: 100%;
    height: 100%;
    min-height: 64px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-right: 1px solid var(--line-soft);
    background: #fff;
    color: var(--brand);
    font-size: 1.25rem;
    transition: min-height .2s ease, background .18s ease;
}

.hero-paste-icon-btn:hover {
    background: var(--brand-light);
}

.hero-link-input {
    min-height: 64px;
    padding: 0 22px;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    color: var(--text-main);
    font-size: 1.08rem;
    transition: min-height .2s ease, font-size .2s ease;
}

.hero-link-input:focus {
    background: #fff;
    box-shadow: none;
}

.hero-action-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
    margin-top: 18px;
    transition: margin .2s ease;
}

.hero-action-row .btn {
    min-height: 60px;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    transition: min-height .2s ease, font-size .2s ease, opacity .18s ease;
}

.hero-primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hero-primary-action:disabled {
    opacity: .82;
}

.xhs-download-page.has-results .hero-section {
    padding: 14px 0 14px;
}

.xhs-download-page.has-results .hero-title {
    font-size: 1.8rem;
    line-height: 1.2;
}

.xhs-download-page.has-results .hero-subtitle {
    display: none;
}

.xhs-download-page.has-results .hero-search-form {
    margin-top: 12px;
}

.xhs-download-page.has-results .hero-input-shell,
.xhs-download-page.has-results .hero-paste-icon-btn,
.xhs-download-page.has-results .hero-link-input {
    min-height: 46px;
}

.xhs-download-page.has-results .hero-link-input {
    font-size: 1rem;
}

.xhs-download-page.has-results .hero-action-row {
    margin-top: 10px;
}

.xhs-download-page.has-results .hero-action-row .btn {
    min-height: 44px;
    font-size: .94rem;
}

.btn-brand {
    background: linear-gradient(135deg, var(--brand), var(--brand-hover));
    color: #fff;
    border: none;
}

.btn-brand:hover {
    background: linear-gradient(135deg, var(--brand-hover), #6535d5);
    color: #fff;
}

.result-card {
    border-radius: 20px;
    overflow: hidden;
    scroll-margin-top: 86px;
}

.parse-results-region,
.results-scroll-anchor {
    scroll-margin-top: 86px;
}

.parse-loading-card {
    display: flex;
    min-height: 132px;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-bottom: 24px;
    border: 1px solid rgba(var(--brand-rgb), .16);
    border-radius: 8px;
    background: linear-gradient(180deg, #fff 0%, var(--brand-light) 100%);
    color: var(--text-main);
    box-shadow: 0 3px 12px rgba(17, 24, 39, 0.05);
}

.parse-loading-card .spinner-border {
    color: var(--brand);
}

.parse-loading-title {
    font-size: 1.02rem;
    font-weight: 800;
}

.parse-loading-subtitle {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: .92rem;
}

.parse-inline-alert {
    max-width: 960px;
    margin-right: auto;
    margin-left: auto;
}

.result-icon {
    color: var(--brand);
}

.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.asset-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    border: 2px solid transparent;
    cursor: pointer;
    transition: 0.2s ease;
}

.asset-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.asset-card.selected {
    border-color: var(--brand);
    box-shadow: 0 8px 28px rgba(var(--brand-rgb), 0.16);
}

.asset-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.asset-check {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--brand);
    color: #fff;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 12px;
    display: none;
}

.asset-card.selected .asset-check {
    display: inline-flex;
}

.download-progress-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 10px;
    align-items: center;
}

.download-progress-wrap[hidden] {
    display: none;
}

.download-progress-track {
    height: 10px;
    border-radius: 999px;
    background: var(--brand-light);
    overflow: hidden;
}

.download-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--brand), var(--brand-hover));
    transition: width .18s ease;
}

.download-progress-percent {
    color: var(--brand);
    font-size: .85rem;
    font-weight: 800;
    text-align: right;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    background: var(--brand-light);
    color: var(--brand);
    border-radius: 999px;
    font-size: 13px;
    margin-right: 6px;
    margin-bottom: 6px;
}

.note-preview-bg {
    background-image: radial-gradient(rgba(var(--brand-rgb), .16) 1px, transparent 1px);
    background-size: 18px 18px;
}

.platform-pill {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 700;
}

.feature-section {
    margin-top: 4px;
    margin-bottom: 76px;
}

.feature-card {
    display: flex;
    min-height: 254px;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 26px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #fff;
    text-align: center;
    box-shadow: 0 3px 12px rgba(17, 24, 39, 0.05);
}

.theme-xhs .feature-card,
.theme-tiktok .feature-card,
.theme-bilibili .feature-card {
    border-color: rgba(var(--brand-rgb), .12);
    background: linear-gradient(180deg, #fff 0%, var(--brand-light) 100%);
}

.feature-icon {
    display: inline-flex;
    width: 56px;
    height: 56px;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
    border-radius: 8px;
    background: var(--brand-light);
    color: var(--brand);
    font-size: 1.75rem;
}

.feature-section .col-sm-6:nth-child(1) .feature-icon {
    color: #db2777;
}

.feature-section .col-sm-6:nth-child(2) .feature-icon {
    color: #2563eb;
}

.feature-section .col-sm-6:nth-child(3) .feature-icon {
    color: #9333ea;
}

.feature-section .col-sm-6:nth-child(4) .feature-icon {
    color: #16a34a;
}

.theme-xhs .feature-section .col-sm-6 .feature-icon,
.theme-tiktok .feature-section .col-sm-6 .feature-icon,
.theme-bilibili .feature-section .col-sm-6 .feature-icon {
    color: var(--brand);
}

.feature-card h3 {
    margin: 0 0 14px;
    color: var(--text-main);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0;
}

.feature-card p {
    max-width: 220px;
    margin: 0;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.7;
}

.settings-panel {
    display: grid;
    gap: 16px;
}

.settings-section {
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
}

.settings-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-main);
    font-weight: 700;
}

.settings-section-title i {
    color: var(--brand);
}

.settings-subsection {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--line-soft);
}

.settings-toggle {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
}

.settings-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.settings-switch-control {
    position: relative;
    width: 48px;
    height: 26px;
    border-radius: 999px;
    background: #d1d5db;
    transition: background .18s ease;
}

.settings-switch-control::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(17, 24, 39, .22);
    transition: transform .18s ease;
    content: "";
}

.settings-toggle input:checked + .settings-switch-control {
    background: var(--brand);
}

.settings-toggle input:checked + .settings-switch-control::after {
    transform: translateX(22px);
}

.settings-toggle strong,
.settings-toggle small {
    display: block;
    line-height: 1.4;
}

.settings-toggle strong {
    font-size: .98rem;
}

.settings-toggle small {
    color: var(--text-muted);
    font-size: .86rem;
}

.settings-toggle.is-disabled {
    cursor: not-allowed;
    opacity: .62;
}

.download-location-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.download-location-toggle .btn {
    min-height: 44px;
    white-space: normal;
}

.download-location-toggle .btn:disabled {
    color: var(--text-muted);
    background: #f2f3f5;
    border-color: var(--line-soft);
    opacity: 1;
}

@media (max-width: 575.98px) {
    .xhs-download-page {
        padding-bottom: 54px;
    }

    .site-brand {
        font-size: 1.15rem;
    }

    .nav-settings-btn {
        min-width: 76px;
    }

    .hero-section {
        padding: 48px 0 54px;
    }

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

    .hero-subtitle {
        margin-top: 18px;
        font-size: 1.02rem;
    }

    .hero-search-form {
        margin-top: 38px;
    }

    .hero-input-shell,
    .hero-paste-icon-btn,
    .hero-link-input {
        min-height: 56px;
    }

    .hero-input-shell {
        grid-template-columns: 52px minmax(0, 1fr);
    }

    .hero-action-row {
        grid-template-columns: 1fr;
    }

    .feature-section {
        margin-top: 6px;
        margin-bottom: 42px;
    }

    .feature-card {
        min-height: 190px;
        padding: 22px 18px;
    }

    .download-location-toggle {
        grid-template-columns: 1fr;
    }
}
