/* 用户主动选择的夜间主题。语义变量覆盖基础色，局部规则处理保留的浅色表面。 */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111816;
  --surface: #17221f;
  --surface-soft: #20302b;
  --text: #e8f0eb;
  --muted: #aebdb6;
  --line: #354740;
  --accent: #3b9f8a;
  --accent-strong: #92ddca;
  --sun: #f2a277;
  --blue: #7bbbc8;
  --red: #ee847c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.28);
  --theme-accent-fill: #237d6e;
  --theme-accent-fill-hover: #1f6c5e;
  --theme-accent-on-fill: #ffffff;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(900px 460px at 8% -8%, rgba(242, 162, 119, 0.1), transparent 64%),
    radial-gradient(920px 520px at 100% 3%, rgba(59, 159, 138, 0.13), transparent 62%),
    var(--bg);
}

:root[data-theme="dark"] ::selection {
  background: rgba(92, 207, 182, 0.34);
  color: #ffffff;
}

:root[data-theme="dark"] .sidebar {
  background: #121b19;
}

:root[data-theme="dark"] .portal-header {
  background: rgba(18, 27, 25, 0.92);
  border-bottom-color: rgba(92, 207, 182, 0.16);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

:root[data-theme="dark"] .home-search-shell .topbar-search-panel,
:root[data-theme="dark"] .mobile-tabs,
:root[data-theme="dark"] .submit-navigation {
  background: rgba(18, 27, 25, 0.96);
}

:root[data-theme="dark"] .nav-item.active,
:root[data-theme="dark"] .portal-nav-item.active,
:root[data-theme="dark"] .mobile-tabs button.active,
:root[data-theme="dark"] .home-search-toggle:hover,
:root[data-theme="dark"] .home-search-shell.is-open .home-search-toggle {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
}

:root[data-theme="dark"] .primary-button,
:root[data-theme="dark"] .auth-page .wide,
:root[data-theme="dark"] .submit-steps button.is-active,
:root[data-theme="dark"] .message-chat-row.is-mine .message-chat-bubble,
:root[data-theme="dark"] .community-tab.active {
  border-color: var(--theme-accent-fill);
  background: var(--theme-accent-fill);
  color: var(--theme-accent-on-fill);
}

:root[data-theme="dark"] .primary-button:hover,
:root[data-theme="dark"] .auth-page .wide:hover {
  background: var(--theme-accent-fill-hover);
}

:root[data-theme="dark"] .my-grid button:disabled,
:root[data-theme="dark"] .auth-tabs,
:root[data-theme="dark"] .guide-list a,
:root[data-theme="dark"] .bbs-visual-toolbar,
:root[data-theme="dark"] .guide-detail-content pre {
  background: var(--surface-soft);
}

:root[data-theme="dark"] .guide-list a {
  border-color: var(--line);
}

:root[data-theme="dark"] .password-form input,
:root[data-theme="dark"] .submit-form textarea,
:root[data-theme="dark"] .submit-form select,
:root[data-theme="dark"] .auth-form input,
:root[data-theme="dark"] .static-language-control select,
:root[data-theme="dark"] .contact-form input,
:root[data-theme="dark"] .contact-form textarea,
:root[data-theme="dark"] .message-compose-card textarea,
:root[data-theme="dark"] .comment-report-form textarea,
:root[data-theme="dark"] .comment-mention-form input,
:root[data-theme="dark"] .app-dialog-field input,
:root[data-theme="dark"] .app-dialog-field textarea {
  background: var(--surface);
}

:root[data-theme="dark"] .message-chat-thread {
  background: var(--surface-soft);
}

:root[data-theme="dark"] .home-hero-card {
  border-color: rgba(92, 207, 182, 0.24);
  background:
    radial-gradient(520px 260px at 15% 0%, rgba(174, 243, 223, 0.09), transparent 68%),
    linear-gradient(135deg, #173029 0%, #17211f 58%, #2a211d 100%);
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.24);
}

:root[data-theme="dark"] .home-hero-card p:not(.eyebrow),
:root[data-theme="dark"] .market-label,
:root[data-theme="dark"] .market-note-inline,
:root[data-theme="dark"] .site-footer {
  color: var(--muted);
}

:root[data-theme="dark"] .market-status {
  color: #ff9ba4;
}

:root[data-theme="dark"] .home-hero-trust span {
  border-color: rgba(92, 207, 182, 0.24);
  background: rgba(23, 48, 41, 0.8);
  color: var(--accent-strong);
}

:root[data-theme="dark"] .my-hero {
  background:
    radial-gradient(circle at 92% 18%, rgba(174, 243, 223, 0.1) 0 5%, transparent 6%),
    linear-gradient(130deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface) 56%);
}

:root[data-theme="dark"] .market-card {
  border-color: rgba(92, 207, 182, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    #13211d;
}

:root[data-theme="dark"] .market-separator {
  color: #647871;
}

:root[data-theme="dark"] .up {
  color: #62d0b0;
}

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

:root[data-theme="dark"] .neutral {
  color: var(--muted);
}

:root[data-theme="dark"] .news-item[href]:hover {
  background: #20322d;
}

:root[data-theme="dark"] .skeleton-line,
:root[data-theme="dark"] .skeleton-thumb {
  background: linear-gradient(100deg, #24342f 25%, #30433c 42%, #24342f 62%);
}

:root[data-theme="dark"] .search-card {
  background: linear-gradient(135deg, #164e44, #0f2924);
}

:root[data-theme="dark"] .my-submission-status {
  background: #283632;
  color: #bfccc6;
}

:root[data-theme="dark"] .my-submission-status.status-scheduled {
  background: #202d4e;
  color: #aabfff;
}

:root[data-theme="dark"] .bbs-badge.pinned,
:root[data-theme="dark"] .guide-article-kicker strong,
:root[data-theme="dark"] .my-submission-reason,
:root[data-theme="dark"] .my-submission-status.status-pending_review,
:root[data-theme="dark"] .my-submission-status.status-archived {
  background: #3b2d18;
  color: #f4c86f;
}

:root[data-theme="dark"] .bbs-badge.highlighted,
:root[data-theme="dark"] .my-submission-status.status-published {
  background: #153c33;
  color: #8edbc7;
}

:root[data-theme="dark"] .bbs-badge.locked,
:root[data-theme="dark"] .my-submission-status.status-rejected,
:root[data-theme="dark"] .guide-like-button.active {
  border-color: #9c474a;
  background: #3a2024;
  color: #f08a84;
}

:root[data-theme="dark"] .bbs-thread-item.is-pinned {
  background: color-mix(in srgb, #58421e 62%, var(--surface));
}

:root[data-theme="dark"] .bbs-bounty-badge,
:root[data-theme="dark"] .bbs-bounty-panel {
  color: #f4c86f;
}

:root[data-theme="dark"] .guide-like-feedback,
:root[data-theme="dark"] .guide-comment-message.error,
:root[data-theme="dark"] .verify-banner-message.error {
  color: var(--red);
}

:root[data-theme="dark"] .verify-banner,
:root[data-theme="dark"] .my-profile-deletion-status {
  border-color: #a8782a;
  background: #302716;
  color: #f4c86f;
}

:root[data-theme="dark"] .verify-banner strong {
  color: #f4c86f;
}

:root[data-theme="dark"] .my-profile-danger {
  border-color: #7e3d43;
  background: #2d1d21;
}

:root[data-theme="dark"] .my-profile-danger .my-profile-section-title,
:root[data-theme="dark"] .my-profile-danger-desc {
  color: #f08a84;
}

:root[data-theme="dark"] .profile-back {
  border-color: rgba(232, 240, 235, 0.18);
  background: rgba(23, 34, 31, 0.9);
  color: var(--text);
}

:root[data-theme="dark"] .profile-message-toggle:disabled {
  border-color: #3c4b46;
  background: #27332f;
  color: #93a39c;
}
