/* 貓貓谷共用深色模式。僅覆蓋介面色彩；內容圖片及遊戲圖示保留原色。 */
html[data-meow-theme="dark"] {
    color-scheme: dark;
    --meow-theme-bg: #15181f;
    --meow-theme-surface: #20252e;
    --meow-theme-raised: #292f39;
    --meow-theme-input: #181d25;
    --meow-theme-border: #414956;
    --meow-theme-text: #eee9e0;
    --meow-theme-muted: #bbb6af;
    --meow-theme-gold: #ebc977;
    --meow-theme-blue: #a9c8fc;
    --meow-theme-green: #9fd7b3;
    --meow-theme-red: #ffb0a5;
    --ms-text: var(--meow-theme-text);
    --ms-text-muted: var(--meow-theme-muted);
    --ms-success: var(--meow-theme-green);
    --ms-danger: var(--meow-theme-red);
    --dash-bg: var(--meow-theme-bg);
    --dash-bg-2: var(--meow-theme-raised);
    --dash-surface: var(--meow-theme-surface);
    --dash-border: var(--meow-theme-border);
    --dash-border-soft: #363e49;
    --dash-text: var(--meow-theme-text);
    --dash-muted: var(--meow-theme-muted);
    --dash-subtle: #a9a39a;
    --dash-primary-soft: #353020;
    --dash-primary-dark: var(--meow-theme-gold);
    --dash-accent-soft: #353020;
    --dash-success: var(--meow-theme-green);
    --dash-warning: var(--meow-theme-gold);
    --dash-danger: var(--meow-theme-red);
    --dash-shadow: 0 8px 26px rgba(0, 0, 0, .22);
    --dash-shadow-hover: 0 10px 28px rgba(0, 0, 0, .32);
    background-color: var(--meow-theme-bg);
    scrollbar-color: #626b78 var(--meow-theme-bg);
}

html[data-meow-theme="dark"] body,
html[data-meow-theme="dark"] body.has-site-scroll-bg,
html[data-meow-theme="dark"] body.has-site-scroll-bg.page-home,
html[data-meow-theme="dark"] body.has-site-scroll-bg.page-inner,
html[data-meow-theme="dark"] body.phone-body {
    background: var(--meow-theme-bg) !important;
    color: var(--meow-theme-text) !important;
}

html[data-meow-theme="dark"] .site-scroll-bg { opacity: .12 !important; }
html[data-meow-theme="dark"] .main-content,
html[data-meow-theme="dark"] .dashboard-section,
html[data-meow-theme="dark"] .post-review-section { background: transparent !important; }
html[data-meow-theme="dark"] ::selection { background: #695537; color: #fff8e7; }

/* 導覽與頁尾 */
html[data-meow-theme="dark"] :is(.header, .navbar, .phone-header, .meow-site-header) {
    background: #1b2029 !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .3) !important;
}
html[data-meow-theme="dark"] :is(.nav-container, .nav-menu, .nav-list, .nav-dropdown,
    .nav-submenu, .dropdown-menu, .phone-bottom-nav) {
    background: var(--meow-theme-surface) !important;
    border-color: var(--meow-theme-border) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] :is(.nav-link, .nav-dropdown-link, .dropdown-item,
    .phone-logo-text, .phone-nav-item) { color: var(--meow-theme-text) !important; }
html[data-meow-theme="dark"] :is(.nav-link:hover, .nav-link.active,
    .nav-dropdown-link:hover, .dropdown-item:hover, .phone-nav-item.active) {
    color: var(--meow-theme-gold) !important;
    background-color: #353020 !important;
}
html[data-meow-theme="dark"] :is(.phone-online, .ms-online-pill) {
    background: var(--meow-theme-raised) !important;
    border-color: var(--meow-theme-border) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] :is(.footer, .meow-site-footer) {
    background-color: #161b22 !important;
    color: var(--meow-theme-muted) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] :is(.footer-copy, .footer-disclaimer, .footer-left p,
    .footer-legal-link, .footer-link, .phone-desktop-switch a) {
    color: var(--meow-theme-muted) !important;
}
html[data-meow-theme="dark"] :is(.footer-legal-link:hover, .footer-link:hover,
    .phone-desktop-switch a:hover) { color: var(--meow-theme-gold) !important; }

/* 共用容器與列表：不使用萬用 background 覆蓋，以免影響圖片與主要 CTA。 */
html[data-meow-theme="dark"] :is(.card, .panel, .content-card, .content-panel,
    .auth-card, .auth-shell, .homepage-register-card, .submit-section, .history-section,
    .dash-panel, .dash-panel-head, .dash-prize-marquee, .dash-prize-marquee-item,
    .dash-shortcut-card, .character-card, .login-record-details, .equipment-list,
    .home-news-card, .home-frame-media, .home-frame--cream, .home-frame--gold,
    .homepage-discord-modal-content, .discord-modal-content, .phone-intro,
    .phone-news-card, .phone-feature-card, .phone-panel, .news-card,
    .modal-content, .modal-body, .modal-dialog, .modal-footer) {
    background: var(--meow-theme-surface) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
    box-shadow: 0 8px 26px rgba(0, 0, 0, .22) !important;
}
html[data-meow-theme="dark"] :is(.section-header, .dash-panel-head,
    .history-section .section-header, .modal-header, .tab-navigation, .view-toggle-group,
    .info-card, .history-item, .stat-item, .equipment-item, .equipment-details-header,
    .equipment-stat-row, .discord-linked-info, .homepage-discord-benefits,
    .discord-benefits, .post-type-selector, .post-links, .option-item,
    .preview-item, .phone-search input, .phone-shortcuts, .phone-feature-content) {
    background: var(--meow-theme-raised) !important;
    border-color: var(--meow-theme-border) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] :is(.dash-shortcut-icon, .dash-panel-icon,
    .equipment-icon, .equipment-list-icon, .dash-prize-marquee-item img,
    .equipment-list-header, .equipment-details-id, .equipment-stat-value.special) {
    background-color: var(--meow-theme-raised) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] :is(.dash-shortcut-card:hover, .history-item:hover,
    .equipment-item:hover, .info-card:hover, .equipment-list-item:hover,
    .login-record-item:hover, .option-item:hover) {
    background-color: #313844 !important;
    border-color: #806b43 !important;
}

/* 標題與說明 */
html[data-meow-theme="dark"] :is(.page-title, .page-header, .section-title,
    .section-header h2, .card h2, .card h3, .panel h2, .panel h3,
    .dash-panel-title h2, .dash-prize-marquee-title, .dash-shortcut-title,
    .home-panel-title, .home-hero-title, .home-hero-eyebrow, .highlight-title,
    .phone-logo-text, .phone-intro p, .phone-feature-title, .phone-news-title,
    .auth-title, .form-label, .homepage-register-title, .homepage-register-benefits-title,
    .homepage-form-label, .homepage-discord-modal-header h3, .discord-modal-header h3,
    .selector-header, .links-header, .submit-disabled h3, .date-part, .content-preview,
    .equipment-name, .equipment-list-name, .equipment-details-info h4,
    .info-card-title, .info-value, .stat-value, .history-item-body, .discord-head-status) {
    color: var(--meow-theme-text) !important;
    text-shadow: none !important;
}
html[data-meow-theme="dark"] :is(.page-subtitle, .home-panel-desc, .home-hero-desc,
    .highlight-description, .auth-subtitle, .auth-footer, .auth-footer p,
    .form-help, .form-hint, .form-tip, .homepage-register-subtitle,
    .homepage-register-benefits-list li, .homepage-form-tip, .homepage-auth-footer,
    .homepage-auth-footer p, .homepage-discord-modal-body p, .homepage-benefit-item,
    .discord-modal-body p, .discord-benefit-item, .info-label, .stat-label,
    .equipment-id, .equipment-list-id, .equipment-preview, .loading-name,
    .character-count, .upload-tips, .submit-disabled, .time-part, .review-details,
    .file-upload-label span, .option-label, .empty-state, .no-content,
    .page-info, .phone-intro p, .phone-feature-desc, .phone-section-desc) {
    color: var(--meow-theme-muted) !important;
    text-shadow: none !important;
}
html[data-meow-theme="dark"] :is(.info-value a, .auth-footer .link, .content-more,
    .history-section .empty-state a, .equipment-list-header, .equipment-details-id,
    .dash-shortcut-count, .home-kicker) { color: var(--meow-theme-gold) !important; }
html[data-meow-theme="dark"] :is(.dash-shortcut-arrow, .dash-shortcut-note,
    .discord-username, .auth-discord-community h4, .auth-discord-community-title) {
    color: var(--meow-theme-blue) !important;
}

/* 首頁、手機首頁 */
html[data-meow-theme="dark"] :is(.home-hero-frame, .home-hero-bar, .home-news-card__media,
    .live-stats-wrapper, .live-stat-item, .home-live-stats .live-stat-item,
    .phone-stat-card, .phone-stat-item, .phone-feature-card, .phone-news-item) {
    background: var(--meow-theme-surface) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] :is(.live-stat-value, .home-live-stats .live-stat-value,
    .phone-stat-value, .phone-feature-title, .phone-section-title) {
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] :is(.live-stat-label, .live-stats-updated,
    .phone-stat-label, .phone-news-date) { color: var(--meow-theme-muted) !important; }
html[data-meow-theme="dark"] :is(.home-btn--wood, .back-btn, .auth-link-btn,
    .homepage-skip-discord, .discord-skip-btn, .pr-theme-toggle) {
    background: var(--meow-theme-raised) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] :is(.homepage-register-benefits, .homepage-auth-footer,
    .auth-footer, .phone-online, .phone-bottom-nav, .phone-desktop-switch) {
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] :is(.auth-trust-notice, .auth-discord-community,
    .discord-linked-details) {
    background: #242b3b !important;
    border-color: #4b5f83 !important;
    color: var(--meow-theme-blue) !important;
}

/* 表單、檔案選擇與瀏覽器原生控制項 */
html[data-meow-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
    textarea, select, .form-input, .form-control, .form-textarea, .homepage-form-input,
    .file-upload-label) {
    background: var(--meow-theme-input) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
    caret-color: var(--meow-theme-gold);
}
html[data-meow-theme="dark"] :is(input, textarea)::placeholder {
    color: #a29e98 !important;
    opacity: 1;
}
html[data-meow-theme="dark"] :is(input, textarea, select):focus {
    border-color: var(--meow-theme-gold) !important;
    box-shadow: 0 0 0 3px rgba(235, 201, 119, .16) !important;
}
html[data-meow-theme="dark"] input:is([type="checkbox"], [type="radio"]) {
    accent-color: #ccaa65;
}
html[data-meow-theme="dark"] input:-webkit-autofill {
    -webkit-text-fill-color: var(--meow-theme-text) !important;
    box-shadow: 0 0 0 1000px var(--meow-theme-input) inset !important;
}
html[data-meow-theme="dark"] input::file-selector-button {
    background: var(--meow-theme-raised);
    color: var(--meow-theme-text);
    border: 1px solid var(--meow-theme-border);
}
html[data-meow-theme="dark"] :is(.option-item.active, .tab-button.active,
    .view-content-btn, .tab-button:hover, .pagination .active) {
    background: #393221 !important;
    border-color: #827044 !important;
    color: var(--meow-theme-gold) !important;
}
html[data-meow-theme="dark"] .option-item.active .option-label { color: var(--meow-theme-gold) !important; }
html[data-meow-theme="dark"] :is(.tab-button, .view-toggle-btn) { color: var(--meow-theme-muted) !important; }
html[data-meow-theme="dark"] :is(.pagination-btn:disabled, .auth-btn:disabled,
    .homepage-auth-btn:disabled, .submit-btn:disabled) {
    background: #444951 !important;
    color: #cbc7be !important;
    border-color: #565e69 !important;
}

/* 表格、清單與頁碼 */
html[data-meow-theme="dark"] :is(table, .history-table) {
    background: var(--meow-theme-surface) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] :is(table th, .history-table th) {
    background: #303641 !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] :is(table td, .history-table td, .equipment-list-item) {
    background-color: var(--meow-theme-surface) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] table tbody tr:nth-child(even) td { background-color: #242a34 !important; }
html[data-meow-theme="dark"] table tbody tr:hover td { background-color: #313844 !important; }
html[data-meow-theme="dark"] :is(.pagination a, .pagination button, .page-link) {
    background: var(--meow-theme-raised) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}

/* 狀態及通知：保留顏色意義並提高暗底對比。 */
html[data-meow-theme="dark"] :is(.alert, .homepage-alert, .auth-alert) {
    background: var(--meow-theme-raised) !important;
    color: var(--meow-theme-text) !important;
    box-shadow: 0 5px 18px rgba(0, 0, 0, .25) !important;
}
html[data-meow-theme="dark"] :is(.alert.success, .alert-success, .homepage-alert.success,
    .daily-status .status-available, .dash-shortcut-status--approved, .discord-head-status--linked) {
    color: var(--meow-theme-green) !important;
    border-left-color: #75b789 !important;
}
html[data-meow-theme="dark"] :is(.alert.error, .alert-error, .alert-danger,
    .homepage-alert.error, .daily-status .status-used, .dash-shortcut-status--rejected,
    .required, .first-reward-note) {
    color: var(--meow-theme-red) !important;
    border-left-color: #d37c70 !important;
}
html[data-meow-theme="dark"] :is(.alert-info, .auth-discord-community-title,
    .alert-info h4, .alert-info p, .post-type-badge.post-type-daily) {
    color: var(--meow-theme-blue) !important;
}
html[data-meow-theme="dark"] .post-type-badge.post-type-daily { background: #283a54 !important; }
html[data-meow-theme="dark"] :is(.status-badge.status-pending, .post-type-badge.post-type-first_reward,
    .account-id-badge, .first-reward-option, .first-reward-note) {
    background: #3d3424 !important;
    color: var(--meow-theme-gold) !important;
    border-color: #827044 !important;
}
html[data-meow-theme="dark"] :is(.status-badge.status-approved, .discord-status-badge) {
    background: #233b2e !important;
    color: var(--meow-theme-green) !important;
}
html[data-meow-theme="dark"] .status-badge.status-rejected {
    background: #442d2d !important;
    color: var(--meow-theme-red) !important;
}
html[data-meow-theme="dark"] :is(.pending-status, .submit-reminder, .dash-shortcut-status--pending) {
    color: var(--meow-theme-gold) !important;
}
html[data-meow-theme="dark"] :is(.first-reward-option.active, .first-reward-option.active .option-label) {
    background-color: #73552d !important;
    color: #fff4df !important;
}
html[data-meow-theme="dark"] :is(.auth-loading, .homepage-auth-loading) {
    background: rgba(24, 29, 37, .94) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] :is(.close, .modal-close, .carousel-close,
    .carousel-modal-close, .image-modal-close) { color: var(--meow-theme-text) !important; }

/* 頁面中仍有行內固定文字色；只針對已知的文字色，不覆蓋所有行內樣式。 */
html[data-meow-theme="dark"] :is(.auth-card, .homepage-register-card, .modal-body,
    .dashboard-section) :is([style*="color: #333"], [style*="color:#333"],
    [style*="color: #2D1F17"], [style*="color:#2D1F17"]) {
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] :is(.auth-card, .homepage-register-card, .modal-body,
    .dashboard-section) :is([style*="color: #666"], [style*="color:#666"],
    [style*="color: #888"], [style*="color:#888"], [style*="color: #95a5a6"]) {
    color: var(--meow-theme-muted) !important;
}
html[data-meow-theme="dark"] .dashboard-section [style*="color: #3B5998"] { color: var(--meow-theme-blue) !important; }

/* 新版雲朵導覽有獨立 !important，使用相同元件範圍補足深色覆蓋。 */
html[data-meow-theme="dark"] .meow-cloud-nav :is(.nav-dropdown-menu,
    .nav-subdropdown-menu, .user-dropdown-menu),
html[data-meow-theme="dark"] .meow-cloud-nav .nav-menu {
    background: var(--meow-theme-surface) !important;
    border-color: var(--meow-theme-border) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] .meow-cloud-nav :is(.nav-link, .nav-dropdown-trigger,
    .nav-dropdown-item, .nav-subdropdown-item, .dropdown-item) {
    color: var(--meow-theme-text) !important;
    background-color: transparent !important;
}
html[data-meow-theme="dark"] .meow-cloud-nav :is(.nav-link:hover, .nav-link.active,
    .nav-dropdown-trigger:hover, .nav-dropdown-item:hover, .nav-dropdown-item.active,
    .dropdown-item:hover),
html[data-meow-theme="dark"] .meow-cloud-nav .nav-has-dropdown:is(:hover, :focus-within, .active, .open) > .nav-dropdown-trigger {
    background: #313844 !important;
    color: var(--meow-theme-gold) !important;
}
html[data-meow-theme="dark"] .meow-cloud-nav .nav-actions .btn,
html[data-meow-theme="dark"] .meow-cloud-nav .nav-actions .btn-auth-combined,
html[data-meow-theme="dark"] .meow-cloud-nav .nav-game-actions .btn.btn-discord,
html[data-meow-theme="dark"] .meow-cloud-phone :is(.phone-login-btn, .phone-user-btn) {
    background: var(--meow-theme-raised) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] .meow-cloud-nav .nav-actions .btn:hover,
html[data-meow-theme="dark"] .meow-cloud-nav .nav-game-actions .btn.btn-discord:hover {
    background: #364152 !important;
    color: var(--meow-theme-blue) !important;
}
html[data-meow-theme="dark"] .meow-cloud-nav .nav-link.meow-nav-download {
    background: #256b95 !important;
    color: #f5f2ec !important;
}
html[data-meow-theme="dark"] .meow-cloud-nav .nav-link.meow-nav-download:hover { background: #2e7eac !important; }
html[data-meow-theme="dark"] .meow-cloud-nav :is(.nav-link > i,
    .nav-dropdown-item i, .dropdown-item i, .ms-online-pill__value) {
    color: inherit !important;
}
html[data-meow-theme="dark"] .meow-cloud-nav :is(.ms-online-pill, .nav-toggle),
html[data-meow-theme="dark"] .meow-cloud-phone .phone-online {
    background: var(--meow-theme-raised) !important;
    color: var(--meow-theme-green) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] .meow-cloud-nav .nav-toggle .bar { background: var(--meow-theme-text) !important; }
html[data-meow-theme="dark"] .meow-cloud-nav .dropdown-divider { background: var(--meow-theme-border) !important; }

/* 新人／每月福利獎勵區、實物領獎照片牆及其預覽。 */
html[data-meow-theme="dark"] .mr-rewards {
    --mr-ink: var(--meow-theme-text);
    --mr-muted: var(--meow-theme-muted);
    --mr-accent: var(--meow-theme-gold);
    --mr-gold: var(--meow-theme-gold);
    background: var(--meow-theme-surface) !important;
    border-color: var(--meow-theme-border) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .24) !important;
}
html[data-meow-theme="dark"] :is(.mr-head, .mr-foot, .mr-tabs, .mr-icon,
    .mw-wall, .mw-close, .mm-controls) {
    background: var(--meow-theme-raised) !important;
    border-color: var(--meow-theme-border) !important;
    color: var(--meow-theme-text) !important;
    box-shadow: none !important;
}
html[data-meow-theme="dark"] :is(.mr-item, .mw-why, .mw-photo, .mw-image-preview) {
    background: var(--meow-theme-surface) !important;
    border-color: var(--meow-theme-border) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] :is(.mr-item:hover, .mr-tab:hover:not([aria-selected="true"]),
    .mm-control:hover) { background: #313844 !important; }
html[data-meow-theme="dark"] :is(.mr-tab, .mr-quantity small, .mr-resource-note,
    .mw-wall-note, .mw-reason p, .mw-preview-caption small, .mm-counter) {
    color: var(--meow-theme-muted) !important;
}
html[data-meow-theme="dark"] :is(.mr-tab[aria-selected="true"], .mr-gift,
    .mr-summary span, .mr-item--currency, .mw-wall-head span, .mw-number) {
    background: #393221 !important;
    border-color: #6c5c3f !important;
    color: var(--meow-theme-gold) !important;
}
html[data-meow-theme="dark"] :is(.mr-item--resource, .mw-reason:nth-of-type(3) .mw-number) {
    background: #312b3d !important;
    color: #ccb8eb !important;
    border-color: #625472 !important;
}
html[data-meow-theme="dark"] :is(.mr-resource, .mr-more, .mw-eyebrow, .mw-reason strong) {
    color: var(--meow-theme-gold) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] :is(.mw-wall-head h3, .mw-copy h2, .mw-reason h3,
    .mw-photo span, .mw-preview-caption p, .mm-control) { color: var(--meow-theme-text) !important; }
html[data-meow-theme="dark"] .mw-reason { border-color: var(--meow-theme-border) !important; }
html[data-meow-theme="dark"] :is(.mw-online, .mw-reason:nth-of-type(2) .mw-number) {
    background: #263c32 !important;
    color: var(--meow-theme-green) !important;
}

/* 2026/10 會員中心新版：區塊本身定義變數，需在相同層級切換。 */
html[data-meow-theme="dark"] .dashboard-section.dashboard-refresh {
    --dash-bg: var(--meow-theme-bg);
    --dash-bg-2: var(--meow-theme-raised);
    --dash-surface: var(--meow-theme-surface);
    --dash-border: var(--meow-theme-border);
    --dash-border-soft: #363e49;
    --dash-text: var(--meow-theme-text);
    --dash-muted: var(--meow-theme-muted);
    --dash-subtle: #a9a39a;
    --dash-primary: #317da5;
    --dash-primary-dark: var(--meow-theme-blue);
    --dash-primary-soft: #29384a;
    --dash-accent: var(--meow-theme-blue);
    --dash-accent-soft: #29384a;
    --dash-success: var(--meow-theme-green);
    --dash-warning: var(--meow-theme-gold);
    --dash-danger: var(--meow-theme-red);
    --dash-shadow: 0 4px 15px rgba(0, 0, 0, .18);
    --dash-shadow-hover: 0 6px 20px rgba(0, 0, 0, .25);
}
html[data-meow-theme="dark"] .dashboard-refresh :is(.dash-hero, .dash-shortcuts,
    .dash-account-toggle, .dash-panel-body, .section-content, .history-container) {
    background: var(--meow-theme-surface) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] .dashboard-refresh :is(.dash-action,
    .dash-action--ghost, .account-refresh-btn, .dash-avatar, .dash-avatar--image,
    .dash-toggle-icon, .dash-prize-marquee-icon, .section-load-prompt,
    .character-header, .modal-header, .post-history-modal-header, .modal-close,
    .enhance-info, .discord-action-btn--unlink) {
    background: var(--meow-theme-raised) !important;
    border-color: var(--meow-theme-border) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] .dashboard-refresh :is(.dash-hero h1,
    .dash-toggle-title, .dash-panel-title h2, .history-section .section-header h2,
    .dash-shortcut-title, .history-item-body) { color: var(--meow-theme-text) !important; }
html[data-meow-theme="dark"] .dashboard-refresh :is(.dash-hero-label,
    .dash-toggle-state, .dash-toggle-icon, .dash-panel-icon,
    .dash-shortcut-card .dash-shortcut-icon, .dash-lottery-record-prize,
    .dash-prize-marquee-icon, .dash-shortcut-link, .section-load-prompt i) {
    color: var(--meow-theme-blue) !important;
}
html[data-meow-theme="dark"] .dashboard-refresh :is(.character-level,
    .dash-toggle-desc, .dash-shortcut-desc, .dash-prize-marquee-name) {
    color: var(--meow-theme-muted) !important;
}
html[data-meow-theme="dark"] .dashboard-refresh :is(.dash-account-toggle:hover,
    .dash-action:hover, .account-refresh-btn:hover:not(:disabled),
    .discord-action-btn--unlink:hover, .dash-shortcut-card--link:hover) {
    background: #313844 !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] .dashboard-refresh :is(.dash-action--primary,
    .dash-action--primary:hover, .section-load-btn, .pagination-btn,
    .view-equipment-btn, .view-all-btn) {
    background: #256b95 !important;
    color: #f5f2ec !important;
    border-color: #4b86a7 !important;
}
html[data-meow-theme="dark"] .dashboard-refresh :is(.section-load-btn,
    .account-refresh-btn, .pagination-btn):disabled {
    background: #444951 !important;
    color: #cbc7be !important;
    border-color: #565e69 !important;
}
html[data-meow-theme="dark"] .dashboard-refresh .account-inline-error {
    background: #3b292d !important;
    color: var(--meow-theme-red) !important;
    border-color: #82595d !important;
}
html[data-meow-theme="dark"] .dashboard-refresh .account-inline-error .section-load-btn {
    background: #4c3337 !important;
    color: var(--meow-theme-red) !important;
    border-color: #82595d !important;
}
html[data-meow-theme="dark"] .phone-stats {
    background: var(--meow-theme-surface) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] .live-stats-badge { color: var(--meow-theme-blue) !important; }
html[data-meow-theme="dark"] .phone-shortcut:not([class*="phone-shortcut-"]) {
    background: var(--meow-theme-surface) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] :is(.legal-content, .philosophy-item) {
    background: var(--meow-theme-surface) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] :is(.legal-content h2, .legal-content h3,
    .legal-content p, .legal-content li, .philosophy-item p) { color: var(--meow-theme-text) !important; }
html[data-meow-theme="dark"] :is(.legal-btn-outline, .phone-start-secondary,
    .live-stats-badge, .auth-divider span) {
    background: var(--meow-theme-raised) !important;
    color: var(--meow-theme-blue) !important;
    border-color: var(--meow-theme-border) !important;
    box-shadow: none !important;
}

/* 註冊視窗在自身重新宣告色票，避免沿用淺色文字或羊皮紙背景。 */
html[data-meow-theme="dark"] .modal-overlay {
    --ms-text: var(--meow-theme-text);
    --ms-text-muted: var(--meow-theme-muted);
    --ms-danger: var(--meow-theme-red);
    --ms-success: var(--meow-theme-green);
    --ms-oak-light: var(--meow-theme-border);
    color: var(--meow-theme-text);
}
html[data-meow-theme="dark"] .modal-overlay :is(.modal-container, .modal-step,
    .modal-form, .modal-action-card) {
    background: var(--meow-theme-surface) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] .modal-overlay .modal-container {
    box-shadow: 0 20px 60px rgba(0, 0, 0, .55), 0 0 0 1px var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] .modal-overlay :is(.modal-title, .form-group label,
    .account-save-kit h3, .account-save-details dt, .account-save-details dd,
    .account-password-option, .action-content h3) { color: var(--meow-theme-text) !important; }
html[data-meow-theme="dark"] .modal-overlay :is(.modal-subtitle, .modal-footer-text,
    .step-label, .form-hint, .action-content p, .account-save-intro,
    .account-save-location, .account-save-status) { color: var(--meow-theme-muted) !important; }
html[data-meow-theme="dark"] .modal-overlay :is(.modal-subtitle strong,
    .modal-link, .account-save-details a) { color: var(--meow-theme-gold) !important; }
html[data-meow-theme="dark"] .modal-overlay :is(.account-save-kit,
    .modal-btn-secondary, .step-number) {
    background: var(--meow-theme-raised) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] .modal-overlay :is(.account-save-details > div,
    .modal-progress, .modal-footer) { border-color: var(--meow-theme-border) !important; }
html[data-meow-theme="dark"] .modal-overlay .modal-progress-line { background: var(--meow-theme-border) !important; }
html[data-meow-theme="dark"] .modal-overlay .modal-progress-step.active .step-number {
    background: #c7a45b !important;
    color: #231c11 !important;
    border-color: #e1c37e !important;
}
html[data-meow-theme="dark"] .modal-overlay :is(.modal-progress-step.completed .step-number,
    .modal-success-icon) {
    background: #32754b !important;
    color: #f3f0e9 !important;
    border-color: #65a97d !important;
}
html[data-meow-theme="dark"] .modal-overlay .modal-btn-primary { color: #2d2112 !important; }
html[data-meow-theme="dark"] .modal-overlay .modal-btn-primary:disabled {
    background: #444951 !important;
    color: #cbc7be !important;
}
html[data-meow-theme="dark"] .modal-overlay .modal-btn-secondary:hover,
html[data-meow-theme="dark"] .modal-overlay .modal-action-card:hover { background: #313844 !important; }
html[data-meow-theme="dark"] .modal-overlay :is(.modal-error, .modal-pc-notice) {
    background: #3b292d !important;
    color: var(--meow-theme-red) !important;
    border-color: #82595d !important;
}
html[data-meow-theme="dark"] .modal-overlay .account-password-warning { color: var(--meow-theme-red) !important; }
html[data-meow-theme="dark"] .modal-overlay :is(button, a, input, textarea):focus-visible {
    outline-color: var(--meow-theme-gold) !important;
}

/* 前台客服：使用者仍為金色訊息，客服為深灰訊息，附件不調色。 */
html[data-meow-theme="dark"] .chat-widget-container {
    --chat-cream: var(--meow-theme-surface);
    --chat-cream-2: var(--meow-theme-raised);
    --chat-cream-3: #343b47;
    --chat-border: var(--meow-theme-border);
    --chat-border-soft: #414956;
    --chat-text: var(--meow-theme-text);
    --chat-muted: var(--meow-theme-muted);
    --chat-subtle: #b6aea3;
    --chat-surface: var(--meow-theme-surface);
    --chat-bubble-admin: #303845;
    --chat-shadow: 0 12px 32px rgba(0, 0, 0, .4);
    --chat-shadow-soft: 0 6px 18px rgba(0, 0, 0, .3);
    color: var(--meow-theme-text);
}
html[data-meow-theme="dark"] .chat-widget-container :is(.chat-content,
    .chat-main, .chat-nickname-screen, .email-collection-screen) {
    background: var(--meow-theme-surface) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] .chat-widget-container :is(.chat-nickname-screen h3,
    .email-collection-screen h3) { color: var(--meow-theme-text) !important; }
html[data-meow-theme="dark"] .chat-widget-container :is(.chat-nickname-screen p,
    .email-collection-screen > p, .message-time) { color: var(--meow-theme-muted) !important; }
html[data-meow-theme="dark"] .chat-widget-container .chat-input-area {
    background: var(--meow-theme-raised) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] .chat-widget-container :is(.chat-input-container,
    .nickname-input, .email-input) {
    background: var(--meow-theme-input) !important;
    border-color: var(--meow-theme-border) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] .chat-widget-container .chat-input {
    background: transparent !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] .chat-widget-container .message.admin .message-bubble {
    background: #303845 !important;
    color: var(--meow-theme-text) !important;
    border-color: #495465 !important;
}
html[data-meow-theme="dark"] .chat-widget-container .message.admin .message-bubble a {
    color: var(--meow-theme-blue) !important;
}
html[data-meow-theme="dark"] .chat-widget-container .message.system .message-bubble {
    background: var(--meow-theme-raised) !important;
    color: var(--meow-theme-muted) !important;
}
html[data-meow-theme="dark"] .chat-widget-container :is(.email-skip-btn,
    .chat-action-btn:not(.chat-send-btn)) { color: var(--meow-theme-muted) !important; }
html[data-meow-theme="dark"] .chat-widget-container :is(.email-skip-btn:hover,
    .chat-action-btn:not(.chat-send-btn):hover) {
    background: #343b47 !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] .chat-widget-container :is(.start-chat-btn:disabled,
    .chat-send-btn:disabled) {
    background: #444951 !important;
    color: #cbc7be !important;
}
html[data-meow-theme="dark"] .chat-widget-container .chat-messages::-webkit-scrollbar-thumb {
    background: #687383;
}

/* 攻略論壇、文章閱讀與道具百科 */
html[data-meow-theme="dark"] :is(.forum-article-card, .forum-contributor-chip,
    .forum-search-result-item, .forum-empty-card, .forum-cat-sort-item,
    .article-content, .article-edit-card, .forum-modal, .wiki-contributors,
    .wiki-table-panel, .contributor-chip, .wiki-modal, .wiki-lookup-result-item,
    .wiki-cat-sort-item, .guide-section-block, .tabs-content) {
    background: var(--meow-theme-surface) !important;
    border-color: var(--meow-theme-border) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] :is(.forum-search-inner, .forum-btn-outline,
    .forum-card-cover-placeholder, .forum-card-cover-wrap, .article-meta-row,
    .forum-cat-sort-btn, .forum-modal-close, .forum-profile-preview,
    .wiki-btn-outline, .wiki-search-clear, .wiki-icon-src-btn, .wiki-rte-toolbar,
    .wiki-profile-preview, .wiki-cat-sort-btn, .wiki-modal-close,
    .wiki-item-icon-img, .wiki-icon-preview) {
    background: var(--meow-theme-raised) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] :is(.forum-category-title, .forum-section-heading,
    .forum-card-title, .forum-search-result-title, .forum-cat-sort-name,
    .article-title, .article-author-name, .forum-form-label,
    .wiki-form-label, .wiki-lookup-result-name, .wiki-cat-sort-name,
    .article-content h1, .article-content h2, .article-content h3,
    .article-content h4, .article-content h5, .article-content h6) {
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] :is(.forum-sort-hint, .forum-category-count,
    .forum-card-author-name, .forum-card-date, .forum-search-result-meta,
    .forum-empty-state, .article-meta-date, .article-meta-views, .article-meta-sep,
    .article-content blockquote, .forum-breadcrumb, .forum-breadcrumb a,
    .forum-form-hint, .wiki-empty, .wiki-search-result-meta, .wiki-sort-hint,
    .wiki-form-hint, .wiki-lookup-results-title, .wiki-lookup-result-meta) {
    color: var(--meow-theme-muted) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] :is(.forum-contrib-label, .forum-contributor-count,
    .forum-cat-sort-index, .wiki-cat-sort-index, .wiki-cat-nav-icon,
    .contributors-label, .contributor-edit-hint, .forum-contributor-edit-hint,
    .article-content a) { color: var(--meow-theme-blue) !important; }
html[data-meow-theme="dark"] :is(.wiki-rte-area, .forum-form-control,
    .wiki-form-control, .wiki-search-input) {
    background: var(--meow-theme-input) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] :is(.article-edit-title, .forum-modal-title,
    .wiki-modal-title) {
    background: none !important;
    color: var(--meow-theme-text) !important;
    -webkit-text-fill-color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] :is(.wiki-rte-btn, .wiki-entry-sort-handle,
    .forum-search-icon) { color: var(--meow-theme-muted) !important; }
html[data-meow-theme="dark"] .article-content :is(pre, code) {
    background: var(--meow-theme-input) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] .forum-tab:not(.is-active) { color: var(--meow-theme-muted) !important; }
html[data-meow-theme="dark"] .forum-tab:not(.is-active):hover {
    background: var(--meow-theme-raised) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] .forum-tab:not(.is-active) .forum-tab-count {
    background: #393221 !important;
    color: var(--meow-theme-gold) !important;
}
html[data-meow-theme="dark"] :is(.wiki-alert-success, .wiki-alert-error,
    .wiki-alert-warning) { background: var(--meow-theme-raised) !important; }
html[data-meow-theme="dark"] .wiki-alert-success { color: var(--meow-theme-green) !important; }
html[data-meow-theme="dark"] .wiki-alert-error { color: var(--meow-theme-red) !important; }
html[data-meow-theme="dark"] .wiki-alert-warning { color: var(--meow-theme-gold) !important; }
html[data-meow-theme="dark"] .wiki-modal :is([style*="color:rgba(58,36,23"],
    [style*="color: rgba(58,36,23"], [style*="color:#2d3748"],
    [style*="color:#3A2417"]) { color: var(--meow-theme-muted) !important; }

/* 公會內容：卡片、成員、公告、表單與管理視窗。 */
html[data-meow-theme="dark"] :is(.guild-card-wrap, .guild-member-card,
    .guild-message-item, .guild-post-card, .guild-modal-content,
    .guild-quick-action-btn, .guild-badge-link) {
    background: var(--meow-theme-surface) !important;
    border-color: var(--meow-theme-border) !important;
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] :is(.guild-member-info, .guild-post-header,
    .guild-message-action-btn, .guild-modal-header, .guild-modal-footer,
    .guild-type-option .guild-type-btn:not(.active), .guild-pagination a,
    .guild-pagination span, .guild-btn-outline-light.active) {
    background: var(--meow-theme-raised) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] :is(.guild-form-label, .guild-member-name,
    .guild-message-content, .guild-modal-header h4,
    .guild-card-header:not([class*="bg-"])) { color: var(--meow-theme-text) !important; }
html[data-meow-theme="dark"] :is(.guild-form-text, .guild-member-role,
    .guild-text-muted, .guild-empty-state, .guild-modal-close, .badge-label) {
    color: var(--meow-theme-muted) !important;
}
html[data-meow-theme="dark"] :is(.guild-list-item, .guild-modal-header,
    .guild-modal-footer, .guild-message-item) { border-color: var(--meow-theme-border) !important; }
html[data-meow-theme="dark"] :is(.guild-alert-info, .guild-alert-success,
    .guild-alert-warning, .guild-alert-danger) {
    background: var(--meow-theme-raised) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] .guild-alert-info { color: var(--meow-theme-blue) !important; }
html[data-meow-theme="dark"] .guild-alert-success { color: var(--meow-theme-green) !important; }
html[data-meow-theme="dark"] .guild-alert-warning { color: var(--meow-theme-gold) !important; }
html[data-meow-theme="dark"] .guild-alert-danger { color: var(--meow-theme-red) !important; }
html[data-meow-theme="dark"] .guild-pagination .active {
    background: #393221 !important;
    color: var(--meow-theme-gold) !important;
}
html[data-meow-theme="dark"] .guild-type-option input[type="radio"]:checked + .guild-type-btn {
    background: #2e5144 !important;
    color: #d8eee1 !important;
    border-color: #66967d !important;
}

/* 下載與安裝教學：在容器近層更新既有主題變數。 */
html[data-meow-theme="dark"] #meow-download-guide {
    --page: var(--meow-theme-bg);
    --surface: var(--meow-theme-surface);
    --surface-soft: var(--meow-theme-raised);
    --surface-2: var(--meow-theme-raised);
    --text: var(--meow-theme-text);
    --muted: var(--meow-theme-muted);
    --line: var(--meow-theme-border);
    --accent: var(--meow-theme-blue);
    --accent-hover: #c0dafc;
    --accent-soft: #29384a;
    --accent-line: #52718d;
    --warm: #393221;
    --warm-line: #756341;
    --warm-text: var(--meow-theme-gold);
    --success: var(--meow-theme-green);
    --success-soft: #243e30;
    --shadow: 0 12px 35px rgba(0, 0, 0, .3);
    --sidebar: #1b2734;
    --purple: var(--meow-theme-blue);
    --purple-dark: #c0dafc;
    background: var(--meow-theme-bg) !important;
    color: var(--meow-theme-text) !important;
    color-scheme: dark;
}
html[data-meow-theme="dark"] #meow-download-guide .mg-download-entry {
    background: var(--meow-theme-surface) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] #meow-download-guide .mg-email-panel {
    background: var(--meow-theme-raised) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] #meow-download-guide :is(.mg-entry-copy,
    .mg-source-note, .mg-email-inner > p) { color: var(--meow-theme-muted) !important; }
html[data-meow-theme="dark"] #meow-download-guide .mg-entry-eyebrow {
    color: var(--meow-theme-gold) !important;
}
html[data-meow-theme="dark"] #meow-download-guide .mg-pc-badge {
    background: #393221 !important;
    color: var(--meow-theme-gold) !important;
    border-color: #756341 !important;
}
html[data-meow-theme="dark"] #meow-download-guide .mg-email-fields input {
    background: var(--meow-theme-input) !important;
    color: var(--meow-theme-text) !important;
    border-color: var(--meow-theme-border) !important;
}
html[data-meow-theme="dark"] #meow-download-guide #mg-guide-email-status[data-state="error"] {
    color: var(--meow-theme-red) !important;
}
html[data-meow-theme="dark"] #meow-download-guide #mg-guide-email-status[data-state="success"] {
    color: var(--meow-theme-green) !important;
}

/* Keep the sign-in reminders readable against their dark panels. */
html[data-meow-theme="dark"] .auth-card label[for="remember-me"],
html[data-meow-theme="dark"] .auth-discord-community-info strong {
    color: var(--meow-theme-text) !important;
}
html[data-meow-theme="dark"] .auth-discord-community-info p {
    color: var(--meow-theme-muted) !important;
}

@media (prefers-reduced-motion: reduce) {
    html[data-meow-theme="dark"] .meow-theme-toggle { transition: none !important; }
}
