/* 全站深浅模式与导航栏切换按钮 */
:root {
    color-scheme: dark;
    --text-main: #f4f6f8;
    --theme-bg: #0b0d12;
    --theme-bg-soft: #11151d;
    --theme-surface: #171b24;
    --theme-surface-raised: #1d222d;
    --theme-text: #f4f6f8;
    --theme-heading: #ffffff;
    --theme-muted: #aeb6c2;
    --theme-subtle: #8e98a7;
    --theme-border: #2d3442;
    --theme-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

:root[data-theme="light"] {
    color-scheme: light;
    --text-main: #1f2937;
    --theme-bg: #ffffff;
    --theme-bg-soft: #f9fafb;
    --theme-surface: #ffffff;
    --theme-surface-raised: #ffffff;
    --theme-text: #1f2937;
    --theme-heading: #111827;
    --theme-muted: #4b5563;
    --theme-subtle: #6b7280;
    --theme-border: #e5e7eb;
    --theme-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

html,
body,
nav,
main,
section,
article,
aside,
footer,
.faq-item,
.quick-card,
.need-card,
.pricing-card,
.platform-card,
.main-dl-card,
.news-item,
.policy-summary,
.policy-notice,
.policy-toc,
.sticky-card {
    transition: background-color 0.28s ease, border-color 0.28s ease, color 0.28s ease, box-shadow 0.28s ease;
}

/* 导航栏模式按钮：浅色时圆点在左，深色时圆点在右 */
.nav-right {
    gap: 14px;
}

.nav-right .btn-link {
    margin-left: 0;
}

.theme-toggle {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 36px;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: #111111;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle-track {
    position: relative;
    display: inline-block;
    flex: 0 0 50px;
    width: 50px;
    height: 26px;
    padding: 2px;
    overflow: hidden;
    border: 1px solid #dddddd;
    border-radius: 999px;
    background: #f3f4f6;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.theme-toggle-thumb {
    display: block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.24);
    transform: translateX(0);
    transition: transform 0.25s ease, background-color 0.25s ease;
}

.theme-toggle-label {
    color: #111111;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--primary-red, #ef443b);
    outline-offset: 4px;
    border-radius: 8px;
}

:root[data-theme="dark"] .theme-toggle {
    color: #f3f4f6;
}

:root[data-theme="dark"] .theme-toggle-track {
    border-color: #666666;
    background: #484848;
}

:root[data-theme="dark"] .theme-toggle-thumb {
    background: #bdbdbd;
    transform: translateX(24px);
}

:root[data-theme="dark"] .theme-toggle-label {
    color: #d1d5db;
}

/* 使用两张真实 Logo，避免滤镜造成品牌红色和文字失真。 */
.site-header .logo img[data-theme-logo] {
    height: auto !important;
    object-fit: contain;
    object-position: left center;
    filter: none !important;
    transition: opacity 0.2s ease;
}

.site-header .logo img[src$="anydesk-logo-c0861c.png"],
.site-header .logo img[src$="anydesk-logo-white-red-cn-cf9b83.png"] {
    width: 250px !important;
}

/* 深色模式基础层 */
:root[data-theme="dark"] body {
    color: var(--theme-text);
    background: var(--theme-bg) !important;
}

:root[data-theme="dark"] nav {
    border-bottom-color: var(--theme-border) !important;
    background: radial-gradient(circle at 10% 20%, rgba(239, 68, 68, 0.10) 0%, rgba(15, 18, 25, 0.96) 52%) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

:root[data-theme="dark"] .nav-links a {
    color: #dce2ea !important;
}

:root[data-theme="dark"] .nav-links a:hover,
:root[data-theme="dark"] .nav-links a[aria-current="page"] {
    color: var(--primary-red, #ef443b) !important;
}

:root[data-theme="dark"] .nav-links li:hover {
    border-bottom-color: rgba(239, 68, 59, 0.55) !important;
}

:root[data-theme="dark"] .hero,
:root[data-theme="dark"] .dl-hero,
:root[data-theme="dark"] .faq-hero,
:root[data-theme="dark"] .feature-split,
:root[data-theme="dark"] .trust-section,
:root[data-theme="dark"] .needs-section,
:root[data-theme="dark"] .pricing-section,
:root[data-theme="dark"] .news-section {
    background: radial-gradient(circle at 15% 10%, rgba(239, 68, 59, 0.09) 0%, var(--theme-bg) 52%) !important;
}

/* 设备图自带透明通道；深色模式移除页面样式追加的浅色底板。 */
:root[data-theme="dark"] .hero-figure img {
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* 首页版本展示图随页面模式切换。 */
:root[data-theme="light"] .feature-split-div {
    background-image: url("/public/index/images/background-version-update.png") !important;
}

:root[data-theme="dark"] .feature-split-div {
    background-image: url("/public/index/images/background-version-update-dark.png") !important;
}

:root[data-theme="dark"] main,
:root[data-theme="dark"] .guide-wrapper,
:root[data-theme="dark"] .faq-container,
:root[data-theme="dark"] .policy-wrapper {
    color: var(--theme-text);
    background-color: var(--theme-bg) !important;
}

/* 标题与正文 */
:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] h4,
:root[data-theme="dark"] .hero-text h1,
:root[data-theme="dark"] .feature-text h2,
:root[data-theme="dark"] .guide-header h1,
:root[data-theme="dark"] .article-body h2,
:root[data-theme="dark"] .article-body h3,
:root[data-theme="dark"] .quick-card h4,
:root[data-theme="dark"] .faq-trigger h3,
:root[data-theme="dark"] .policy-header h1,
:root[data-theme="dark"] .policy-body h2,
:root[data-theme="dark"] .policy-body h3,
:root[data-theme="dark"] .pricing-card h3,
:root[data-theme="dark"] .platform-card h4 {
    color: var(--theme-heading) !important;
}

:root[data-theme="dark"] p,
:root[data-theme="dark"] li,
:root[data-theme="dark"] .hero-text p,
:root[data-theme="dark"] .feature-text p,
:root[data-theme="dark"] .need-card p,
:root[data-theme="dark"] .pricing-subtitle,
:root[data-theme="dark"] .pricing-desc,
:root[data-theme="dark"] .pricing-footnote,
:root[data-theme="dark"] .news-desc,
:root[data-theme="dark"] .news-time,
:root[data-theme="dark"] .dl-hero > p,
:root[data-theme="dark"] .platform-card p,
:root[data-theme="dark"] .guide-meta,
:root[data-theme="dark"] .quick-card p,
:root[data-theme="dark"] .article-body p,
:root[data-theme="dark"] .article-body ol li,
:root[data-theme="dark"] .image-caption,
:root[data-theme="dark"] .faq-hero p,
:root[data-theme="dark"] .faq-answer-content,
:root[data-theme="dark"] .faq-answer-content p,
:root[data-theme="dark"] .promo-content p,
:root[data-theme="dark"] .policy-meta,
:root[data-theme="dark"] .policy-summary p,
:root[data-theme="dark"] .policy-body p,
:root[data-theme="dark"] .policy-body li {
    color: var(--theme-muted) !important;
}

:root[data-theme="dark"] strong,
:root[data-theme="dark"] .article-body p strong,
:root[data-theme="dark"] .info-note p,
:root[data-theme="dark"] .policy-summary strong {
    color: #f8fafc !important;
}

/* 卡片、列表与内容容器 */
:root[data-theme="dark"] .main-dl-card,
:root[data-theme="dark"] .platform-card,
:root[data-theme="dark"] .need-card,
:root[data-theme="dark"] .pricing-card,
:root[data-theme="dark"] .news,
:root[data-theme="dark"] .news-item,
:root[data-theme="dark"] .quick-card,
:root[data-theme="dark"] .guide-media-box,
:root[data-theme="dark"] .guide-media-box img,
:root[data-theme="dark"] .sticky-card,
:root[data-theme="dark"] .faq-item,
:root[data-theme="dark"] .faq-trigger,
:root[data-theme="dark"] .faq-answer,
:root[data-theme="dark"] .faq-media-box,
:root[data-theme="dark"] .troubleshoot-promo,
:root[data-theme="dark"] .policy-summary,
:root[data-theme="dark"] .policy-notice,
:root[data-theme="dark"] .policy-toc {
    border-color: var(--theme-border) !important;
    background: var(--theme-surface) !important;
    box-shadow: var(--theme-shadow);
}

:root[data-theme="dark"] .pricing-card-recommend {
    border-color: rgba(239, 68, 59, 0.72) !important;
    background: linear-gradient(160deg, #21191c 0%, var(--theme-surface) 48%) !important;
}

:root[data-theme="dark"] .news-item:hover,
:root[data-theme="dark"] .faq-item:hover,
:root[data-theme="dark"] .platform-card:hover,
:root[data-theme="dark"] .need-card:hover,
:root[data-theme="dark"] .quick-card:hover {
    border-color: rgba(239, 68, 59, 0.62) !important;
    background: var(--theme-surface-raised) !important;
}

:root[data-theme="dark"] .news-link,
:root[data-theme="dark"] .sticky-card a,
:root[data-theme="dark"] .policy-toc a {
    color: #e9edf3 !important;
}

:root[data-theme="dark"] .news-link:hover,
:root[data-theme="dark"] .sticky-card a:hover,
:root[data-theme="dark"] .policy-toc a:hover {
    color: var(--primary-red, #ef443b) !important;
}

:root[data-theme="dark"] .guide-header,
:root[data-theme="dark"] .news-item,
:root[data-theme="dark"] .footer-bottom,
:root[data-theme="dark"] .policy-header {
    border-color: var(--theme-border) !important;
}

:root[data-theme="dark"] .info-note {
    border-left-color: var(--primary-red, #ef443b) !important;
    background: rgba(239, 68, 59, 0.10) !important;
}

:root[data-theme="dark"] .tips-checklist {
    border-color: #5d4730 !important;
    background: #211b15 !important;
}

:root[data-theme="dark"] .faq-icon::before,
:root[data-theme="dark"] .faq-icon::after {
    background: #d7dde6 !important;
}

/* 下载页存在少量内联颜色，深色模式统一接管。 */
:root[data-theme="dark"] main > section[style],
:root[data-theme="dark"] [style*="background: #ffffff"],
:root[data-theme="dark"] [style*="background: #fcfcfc"] {
    background: var(--theme-bg-soft) !important;
}

:root[data-theme="dark"] [style*="background: #f9fafb"],
:root[data-theme="dark"] [style*="background: #fff;"] {
    border-color: var(--theme-border) !important;
    background: var(--theme-surface) !important;
}

:root[data-theme="dark"] [style*="color: #4b5563"],
:root[data-theme="dark"] [style*="color: #6b7280"],
:root[data-theme="dark"] [style*="color: #9ca3af"] {
    color: var(--theme-muted) !important;
}

/* 保留品牌色块与主按钮的白色文字。 */
:root[data-theme="dark"] .configurator-section,
:root[data-theme="dark"] .pricing-ribbon,
:root[data-theme="dark"] .step-num,
:root[data-theme="dark"] .btn-hero-main,
:root[data-theme="dark"] .btn-more,
:root[data-theme="dark"] .btn-dl-large,
:root[data-theme="dark"] .pricing-btn-solid,
:root[data-theme="dark"] .btn-promo-primary {
    color: #ffffff !important;
}

:root[data-theme="dark"] footer {
    border-top: 1px solid #242a35;
    background: #080a0e !important;
}

@media (max-width: 820px) {
    .nav-right {
        gap: 8px;
    }

    .theme-toggle {
        gap: 7px;
    }

    .theme-toggle-label {
        font-size: 13px;
    }
}

@media (max-width: 1100px) {
    :root[data-theme="light"] .feature-split-div,
    :root[data-theme="dark"] .feature-split-div {
        background-image: none !important;
    }
}

@media (max-width: 620px) {
    /* 窄屏优先保留品牌、模式开关与下载入口，避免开关被导航链接挤出屏幕。 */
    nav {
        padding-right: 16px !important;
        padding-left: 16px !important;
    }

    .nav-left,
    .nav-right {
        flex-shrink: 0;
    }

    .logo {
        margin-right: 0 !important;
    }

    .site-header .logo img[src$="anydesk-logo-c0861c.png"],
    .site-header .logo img[src$="anydesk-logo-white-red-cn-cf9b83.png"] {
        width: 165px !important;
    }

    .nav-links {
        display: none !important;
    }

    .nav-right .btn-link {
        padding: 8px 12px;
        font-size: 13px;
    }

    .theme-toggle-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .theme-toggle-track {
        flex-basis: 46px;
        width: 46px;
        height: 24px;
    }

    .theme-toggle-thumb {
        width: 18px;
        height: 18px;
    }

    :root[data-theme="dark"] .theme-toggle-thumb {
        transform: translateX(22px);
    }
}

@media (prefers-reduced-motion: reduce) {
    html,
    body,
    nav,
    main,
    section,
    article,
    aside,
    footer,
    .theme-toggle-thumb,
    .site-header .logo img {
        transition: none !important;
    }
}
