/* Explicit and system dark appearance share the same component palette. */
body[data-theme="dark"] {
    color-scheme: dark;
    --night-bg: #171b23; --night-panel: #202630; --night-raised: #282f3b;
    --night-line: #394352; --night-text: #e6edf6; --night-muted: #a8b6ca;
    --night-blue: #94b8ff; --night-selected: #293a56;
    --review-correct-bg: #1b3b30; --review-correct-text: #a7f3c3; --review-correct-line: #4ade80;
    --review-wrong-bg: #44262d; --review-wrong-text: #fecdd3; --review-wrong-line: #fb7185;
    --review-selected-bg: #293f65; --review-selected-text: #dbeafe; --review-selected-line: #93b4ff;
    background: var(--night-bg); color: var(--night-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
body[data-theme="dark"] :is(button, input, select, textarea) { font-family: inherit; }
body[data-theme="dark"] :is(.app, .app-body, .main-content, .content, .sidebar) { background: var(--night-bg); }
body[data-theme="dark"] :is(.topbar, .mobile-bottom-nav, .settings-card, .fsrs-dashboard, .deck-item, .vocab-stat-card, .library-words-panel, .lib-video-card, .lib-deck-card, .lib-new-deck-modal, .fc-review-screen, .fc-settings-modal, .fc-report-dialog, .language-dropdown, .user-dropdown) { background: var(--night-panel); color: var(--night-text); border-color: var(--night-line); box-shadow: 0 4px 18px #00000012; }
body[data-theme="dark"] :is(.deck-item, .lib-deck-card) { border: 1px solid var(--night-line); }
body[data-theme="dark"] :is(.topbar-stats, .language-selector, .user-selector, .import-video-button, .daily-goal-card, .topbar-daily-goal .daily-goal-card, .fsrs-summary-grid article, .vocabulary-status-grid article, .fc-settings-row, .review-card-context, .lq-example-row, .lq-audio-btn, .review-card-audio, .lq-card-status) { background: var(--night-raised); border-color: var(--night-line); color: var(--night-text); box-shadow: none; }
body[data-theme="dark"] :is(.page-title, .library-page-header h1, .vocab-stats-title, .library-section-title, .vocab-stat-number, .lib-video-title, .lib-deck-name, .deck-name, .daily-goal-title, .fsrs-dashboard-heading h2, .fsrs-summary-grid strong, .vocabulary-status-grid strong, .vocabulary-status-heading h3, .fsrs-dashboard-detail h3, .fsrs-due-row strong, .vocabulary-status-grid span, .stat-item, .review-card-word, .lq-reveal-word, .lq-reveal-word-text, .lq-reveal-translation, .fc-settings-header h2, .lib-new-deck-modal h3, .settings-card-heading h2, .settings-preference-row strong, .settings-topics-toggle strong) { color: var(--night-text); }
body[data-theme="dark"] :is(.deck-name, .lib-deck-name, .fsrs-due-row strong, .vocabulary-status-grid span) { font-weight: 500; }
body[data-theme="dark"] :is(.library-page-header p, .deck-word-count, .deck-order-help, .deck-order-status, .deck-empty, .lib-empty, .vocab-stat-label, .lib-video-meta, .lib-deck-meta, .daily-goal-minutes, .fsrs-summary-grid span, .vocabulary-status-heading span, .vocabulary-status-grid small, .fsrs-dashboard-heading small, .fsrs-due-row span, .fsrs-forecast-bars span, .fsrs-forecast-bars small, .fsrs-due-list p, .library-words-table th, .fc-settings-header p, .fc-settings-section-label, .lq-session-timer, .lq-sync-status, .review-card-ipa, .lq-ipa, .review-card-context-text, .lq-example-text) { color: var(--night-muted); }
body[data-theme="dark"] :is(.vocabulary-status-grid small, .fsrs-due-row span, .fsrs-forecast-bars span, .fsrs-forecast-bars small) { font-size: 11px; }
body[data-theme="dark"] :is(.menu-item, .settings-submenu-item, .language-option, .user-dropdown a, .logout-button) { color: var(--night-muted); }
body[data-theme="dark"] :is(.menu-item:hover, .settings-submenu-item:hover, .language-option:hover, .user-dropdown a:hover, .logout-button:hover) { background: var(--night-raised); color: var(--night-text); }
body[data-theme="dark"] :is(.menu-item.active, .settings-submenu-item.active, .language-option.active) { background: var(--night-selected); color: var(--night-blue); }
body[data-theme="dark"] :is(.logo, .library-page-header > span, .fsrs-dashboard-heading > div > span, .fsrs-dashboard-heading > span, .library-words-table small, .review-card-prompt, .review-card-context-word, .lq-example-word) { color: var(--night-blue); }
body[data-theme="dark"] :is(.vocabulary-status-section, .fsrs-dashboard-detail, .fsrs-due-row, .library-words-table td, .library-words-table th, .fc-settings-header, .fc-settings-footer, .lq-bottom-bar, .settings-preference-row, .settings-topics-row, .menu-divider) { border-color: var(--night-line); }
body[data-theme="dark"] :is(.daily-goal-progress, .lq-progress-bar, .library-scroll-progress) { background: #3a4453; }
body[data-theme="dark"] :is(.library-words-toolbar button, .library-words-toolbar select, .lib-new-deck-modal input, .btn-cancel-modal, .btn-new-deck, .fsrs-dashboard-toggle, .fc-settings-modal select, .fc-settings-modal input:not([type=checkbox]):not([type=range]), .fc-report-dialog select, .fc-report-dialog textarea, .settings-preference-row select, .settings-field select, .review-card-option, .review-card-option-index, .review-card-rating-button, .lq-level-btn, .lq-recall-actions button) { background: var(--night-panel); color: var(--night-text); border-color: var(--night-line); }
body[data-theme="dark"] :is(.deck-order-handle:hover, .deck-order-handle:focus-visible, .lq-settings-btn:hover, .lq-close-btn:hover, .fsrs-summary-grid .fsrs-due-now.is-actionable:hover) { background: var(--night-selected); color: var(--night-blue); border-color: #688dca; }
body[data-theme="dark"] :is(.deck-order-handle, .lq-settings-btn, .lq-close-btn, .lq-report-btn, .fc-settings-close) { color: var(--night-muted); }
body[data-theme="dark"] .deck-item.is-reordering { background: var(--night-selected); outline-color: #688dca; }
body[data-theme="dark"] .deck-order-ghost { outline-color: #688dca; box-shadow: 0 18px 38px #00000055 !important; }
body[data-theme="dark"] .btn-study { background: #315fae; color: #f4f7ff; font-weight: 500; }
body[data-theme="dark"] .btn-study:hover { background: #3a70ca; }
body[data-theme="dark"] .btn-study:disabled { background: #343e4d; color: #a8b6ca; }
body[data-theme="dark"] :is(.lq-footer-action, .lq-flip-btn, .lq-next-btn) { background: var(--night-raised); color: var(--night-text); }
body[data-theme="dark"] :is(.review-card-rating-button.active, .lq-level-btn.active) { background: var(--night-selected); border-color: #7ea3ed; color: #bdd2ff; }
body[data-theme="dark"] :is(.review-card-option.correct, .lq-right-btn, .vocab-stat-icon.known) { background: #1b3b30; color: #8fdfb1; border-color: #3a9265; }
body[data-theme="dark"] :is(.review-card-option.wrong, .lq-wrong-btn) { background: #47282e; color: #ffafb7; border-color: #b9606e; }
body[data-theme="dark"] .vocab-stat-icon.vocab { background: var(--night-selected); color: var(--night-blue); }
body[data-theme="dark"] .vocab-stat-icon.review { background: #443528; color: #edc291; }
body[data-theme="dark"] :is(.fsrs-calibration-status, .fsrs-calibration-details) { background: var(--night-selected); }
body[data-theme="dark"] :is(.fsrs-calibration-status strong, .fsrs-readiness-row strong) { color: var(--night-blue); }
body[data-theme="dark"] :is(.fsrs-calibration-status span, .fsrs-readiness-label span, .fsrs-readiness-label small) { color: var(--night-muted); }
body[data-theme="dark"] .vocabulary-import { --vi-paper: var(--night-panel); --vi-bg: var(--night-bg); --vi-text: var(--night-text); --vi-muted: var(--night-muted); --vi-line: var(--night-line); --vi-soft: var(--night-selected); --vi-blue: var(--night-blue); }

@media (prefers-color-scheme: dark) {
body[data-theme="system"] {
    color-scheme: dark;
    --night-bg: #171b23; --night-panel: #202630; --night-raised: #282f3b;
    --night-line: #394352; --night-text: #e6edf6; --night-muted: #a8b6ca;
    --night-blue: #94b8ff; --night-selected: #293a56;
    --review-correct-bg: #1b3b30; --review-correct-text: #a7f3c3; --review-correct-line: #4ade80;
    --review-wrong-bg: #44262d; --review-wrong-text: #fecdd3; --review-wrong-line: #fb7185;
    --review-selected-bg: #293f65; --review-selected-text: #dbeafe; --review-selected-line: #93b4ff;
    background: var(--night-bg); color: var(--night-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
body[data-theme="system"] :is(button, input, select, textarea) { font-family: inherit; }
body[data-theme="system"] :is(.app, .app-body, .main-content, .content, .sidebar) { background: var(--night-bg); }
body[data-theme="system"] :is(.topbar, .mobile-bottom-nav, .settings-card, .fsrs-dashboard, .deck-item, .vocab-stat-card, .library-words-panel, .lib-video-card, .lib-deck-card, .lib-new-deck-modal, .fc-review-screen, .fc-settings-modal, .fc-report-dialog, .language-dropdown, .user-dropdown) { background: var(--night-panel); color: var(--night-text); border-color: var(--night-line); box-shadow: 0 4px 18px #00000012; }
body[data-theme="system"] :is(.deck-item, .lib-deck-card) { border: 1px solid var(--night-line); }
body[data-theme="system"] :is(.topbar-stats, .language-selector, .user-selector, .import-video-button, .daily-goal-card, .topbar-daily-goal .daily-goal-card, .fsrs-summary-grid article, .vocabulary-status-grid article, .fc-settings-row, .review-card-context, .lq-example-row, .lq-audio-btn, .review-card-audio, .lq-card-status) { background: var(--night-raised); border-color: var(--night-line); color: var(--night-text); box-shadow: none; }
body[data-theme="system"] :is(.page-title, .library-page-header h1, .vocab-stats-title, .library-section-title, .vocab-stat-number, .lib-video-title, .lib-deck-name, .deck-name, .daily-goal-title, .fsrs-dashboard-heading h2, .fsrs-summary-grid strong, .vocabulary-status-grid strong, .vocabulary-status-heading h3, .fsrs-dashboard-detail h3, .fsrs-due-row strong, .vocabulary-status-grid span, .stat-item, .review-card-word, .lq-reveal-word, .lq-reveal-word-text, .lq-reveal-translation, .fc-settings-header h2, .lib-new-deck-modal h3, .settings-card-heading h2, .settings-preference-row strong, .settings-topics-toggle strong) { color: var(--night-text); }
body[data-theme="system"] :is(.deck-name, .lib-deck-name, .fsrs-due-row strong, .vocabulary-status-grid span) { font-weight: 500; }
body[data-theme="system"] :is(.library-page-header p, .deck-word-count, .deck-order-help, .deck-order-status, .deck-empty, .lib-empty, .vocab-stat-label, .lib-video-meta, .lib-deck-meta, .daily-goal-minutes, .fsrs-summary-grid span, .vocabulary-status-heading span, .vocabulary-status-grid small, .fsrs-dashboard-heading small, .fsrs-due-row span, .fsrs-forecast-bars span, .fsrs-forecast-bars small, .fsrs-due-list p, .library-words-table th, .fc-settings-header p, .fc-settings-section-label, .lq-session-timer, .lq-sync-status, .review-card-ipa, .lq-ipa, .review-card-context-text, .lq-example-text) { color: var(--night-muted); }
body[data-theme="system"] :is(.vocabulary-status-grid small, .fsrs-due-row span, .fsrs-forecast-bars span, .fsrs-forecast-bars small) { font-size: 11px; }
body[data-theme="system"] :is(.menu-item, .settings-submenu-item, .language-option, .user-dropdown a, .logout-button) { color: var(--night-muted); }
body[data-theme="system"] :is(.menu-item:hover, .settings-submenu-item:hover, .language-option:hover, .user-dropdown a:hover, .logout-button:hover) { background: var(--night-raised); color: var(--night-text); }
body[data-theme="system"] :is(.menu-item.active, .settings-submenu-item.active, .language-option.active) { background: var(--night-selected); color: var(--night-blue); }
body[data-theme="system"] :is(.logo, .library-page-header > span, .fsrs-dashboard-heading > div > span, .fsrs-dashboard-heading > span, .library-words-table small, .review-card-prompt, .review-card-context-word, .lq-example-word) { color: var(--night-blue); }
body[data-theme="system"] :is(.vocabulary-status-section, .fsrs-dashboard-detail, .fsrs-due-row, .library-words-table td, .library-words-table th, .fc-settings-header, .fc-settings-footer, .lq-bottom-bar, .settings-preference-row, .settings-topics-row, .menu-divider) { border-color: var(--night-line); }
body[data-theme="system"] :is(.daily-goal-progress, .lq-progress-bar, .library-scroll-progress) { background: #3a4453; }
body[data-theme="system"] :is(.library-words-toolbar button, .library-words-toolbar select, .lib-new-deck-modal input, .btn-cancel-modal, .btn-new-deck, .fsrs-dashboard-toggle, .fc-settings-modal select, .fc-settings-modal input:not([type=checkbox]):not([type=range]), .fc-report-dialog select, .fc-report-dialog textarea, .settings-preference-row select, .settings-field select, .review-card-option, .review-card-option-index, .review-card-rating-button, .lq-level-btn, .lq-recall-actions button) { background: var(--night-panel); color: var(--night-text); border-color: var(--night-line); }
body[data-theme="system"] :is(.deck-order-handle:hover, .deck-order-handle:focus-visible, .lq-settings-btn:hover, .lq-close-btn:hover, .fsrs-summary-grid .fsrs-due-now.is-actionable:hover) { background: var(--night-selected); color: var(--night-blue); border-color: #688dca; }
body[data-theme="system"] :is(.deck-order-handle, .lq-settings-btn, .lq-close-btn, .lq-report-btn, .fc-settings-close) { color: var(--night-muted); }
body[data-theme="system"] .deck-item.is-reordering { background: var(--night-selected); outline-color: #688dca; }
body[data-theme="system"] .deck-order-ghost { outline-color: #688dca; box-shadow: 0 18px 38px #00000055 !important; }
body[data-theme="system"] .btn-study { background: #315fae; color: #f4f7ff; font-weight: 500; }
body[data-theme="system"] .btn-study:hover { background: #3a70ca; }
body[data-theme="system"] .btn-study:disabled { background: #343e4d; color: #a8b6ca; }
body[data-theme="system"] :is(.lq-footer-action, .lq-flip-btn, .lq-next-btn) { background: var(--night-raised); color: var(--night-text); }
body[data-theme="system"] :is(.review-card-rating-button.active, .lq-level-btn.active) { background: var(--night-selected); border-color: #7ea3ed; color: #bdd2ff; }
body[data-theme="system"] :is(.review-card-option.correct, .lq-right-btn, .vocab-stat-icon.known) { background: #1b3b30; color: #8fdfb1; border-color: #3a9265; }
body[data-theme="system"] :is(.review-card-option.wrong, .lq-wrong-btn) { background: #47282e; color: #ffafb7; border-color: #b9606e; }
body[data-theme="system"] .vocab-stat-icon.vocab { background: var(--night-selected); color: var(--night-blue); }
body[data-theme="system"] .vocab-stat-icon.review { background: #443528; color: #edc291; }
body[data-theme="system"] :is(.fsrs-calibration-status, .fsrs-calibration-details) { background: var(--night-selected); }
body[data-theme="system"] :is(.fsrs-calibration-status strong, .fsrs-readiness-row strong) { color: var(--night-blue); }
body[data-theme="system"] :is(.fsrs-calibration-status span, .fsrs-readiness-label span, .fsrs-readiness-label small) { color: var(--night-muted); }
body[data-theme="system"] .vocabulary-import { --vi-paper: var(--night-panel); --vi-bg: var(--night-bg); --vi-text: var(--night-text); --vi-muted: var(--night-muted); --vi-line: var(--night-line); --vi-soft: var(--night-selected); --vi-blue: var(--night-blue); }
}

body[data-theme="dark"] :is(.flashcards-header h1, .fsrs-dashboard h2, .fsrs-dashboard h3, .fsrs-summary-grid strong, .vocabulary-status-grid strong, .daily-goal-title, .fc-settings-row-copy strong, .fc-activity-copy strong) { font-weight: 500; }
body[data-theme="dark"] :is(.flashcards-header p, .fc-activity-check, .fc-expand-btn, .fc-activity-copy strong, .fc-settings-row-copy strong, .fc-session-counter span, .lq-cloze-sentence, .lq-word, .video-title) { color: var(--night-text); }
body[data-theme="dark"] :is(.fc-study-page) { background: var(--night-bg); }
body[data-theme="dark"] :is(.lq-bottom-bar, .lq-skip-btn, .lq-flip-front, .lq-flip-back, .lq-dictation-input, .video-card, .fc-session-counter button) { background: var(--night-panel); color: var(--night-text); border-color: var(--night-line); }
body[data-theme="dark"] .menu-divider { background: var(--night-line); }
body[data-theme="dark"] .menu-item.active:hover { background: var(--night-selected); color: var(--night-blue); }
body[data-theme="dark"] :is(.fc-session-counter, .fc-session-counter span, .fc-activity-item:has(.fc-activity-opts:not(.hidden))) { border-color: var(--night-line); }
body[data-theme="dark"] :is(.lq-feedback.correct) { color: #8fdfb1; }
body[data-theme="dark"] :is(.lq-feedback.incorrect) { color: #ffafb7; }

@media(prefers-color-scheme: dark) {
body[data-theme="system"] :is(.flashcards-header h1, .fsrs-dashboard h2, .fsrs-dashboard h3, .fsrs-summary-grid strong, .vocabulary-status-grid strong, .daily-goal-title, .fc-settings-row-copy strong, .fc-activity-copy strong) { font-weight: 500; }
body[data-theme="system"] :is(.flashcards-header p, .fc-activity-check, .fc-expand-btn, .fc-activity-copy strong, .fc-settings-row-copy strong, .fc-session-counter span, .lq-cloze-sentence, .lq-word, .video-title) { color: var(--night-text); }
body[data-theme="system"] :is(.fc-study-page) { background: var(--night-bg); }
body[data-theme="system"] :is(.lq-bottom-bar, .lq-skip-btn, .lq-flip-front, .lq-flip-back, .lq-dictation-input, .video-card, .fc-session-counter button) { background: var(--night-panel); color: var(--night-text); border-color: var(--night-line); }
body[data-theme="system"] .menu-divider { background: var(--night-line); }
body[data-theme="system"] .menu-item.active:hover { background: var(--night-selected); color: var(--night-blue); }
body[data-theme="system"] :is(.fc-session-counter, .fc-session-counter span, .fc-activity-item:has(.fc-activity-opts:not(.hidden))) { border-color: var(--night-line); }
body[data-theme="system"] :is(.lq-feedback.correct) { color: #8fdfb1; }
body[data-theme="system"] :is(.lq-feedback.incorrect) { color: #ffafb7; }
}

body[data-theme="dark"] :is(.fc-settings-footer, .fc-settings-cancel, .fc-settings-close, .fc-expand-btn:hover, .fc-settings-row) { background: var(--night-panel); color: var(--night-text); border-color: var(--night-line); }
body[data-theme="dark"] :is(.fc-opt-check, .fc-opt-label, .fc-display-check) { color: var(--night-muted); }
body[data-theme="dark"] :is(.library-page-header h1, .library-section-title, .vocab-stats-title, .vocab-stat-number, .review-card-word) { font-weight: 500; }
body[data-theme="dark"] :is(.lq-progress-track) { background: #3a4453; }
body[data-theme="dark"] .lib-deck-card { background: #222a39; border-color: #39465b; }
body[data-theme="dark"] .lib-deck-card .lib-deck-thumb { background: #2b3d60; }

@media(prefers-color-scheme:dark) {
body[data-theme="system"] :is(.fc-settings-footer, .fc-settings-cancel, .fc-settings-close, .fc-expand-btn:hover, .fc-settings-row) { background: var(--night-panel); color: var(--night-text); border-color: var(--night-line); }
body[data-theme="system"] :is(.fc-opt-check, .fc-opt-label, .fc-display-check) { color: var(--night-muted); }
body[data-theme="system"] :is(.library-page-header h1, .library-section-title, .vocab-stats-title, .vocab-stat-number, .review-card-word) { font-weight: 500; }
body[data-theme="system"] :is(.lq-progress-track) { background: #3a4453; }
body[data-theme="system"] .lib-deck-card { background: #222a39; border-color: #39465b; }
body[data-theme="system"] .lib-deck-card .lib-deck-thumb { background: #2b3d60; }
}

/* Semantic states outrank generic control surfaces, including disabled answers. */
body[data-theme] .review-card-options button.review-card-option.correct {
    background: var(--review-correct-bg, #dcfce7);
    color: var(--review-correct-text, #166534);
    border-color: var(--review-correct-line, #22c55e);
}
body[data-theme] .review-card-options button.review-card-option.wrong {
    background: var(--review-wrong-bg, #fee2e2);
    color: var(--review-wrong-text, #991b1b);
    border-color: var(--review-wrong-line, #ef4444);
}
body[data-theme] .review-card-options .review-card-option.correct .review-card-option-index {
    background: var(--review-correct-bg, #dcfce7);
    color: var(--review-correct-text, #166534);
    border-color: var(--review-correct-line, #22c55e);
}
body[data-theme] .review-card-options .review-card-option.wrong .review-card-option-index {
    background: var(--review-wrong-bg, #fee2e2);
    color: var(--review-wrong-text, #991b1b);
    border-color: var(--review-wrong-line, #ef4444);
}
body[data-theme] .review-card-rating-buttons button.review-card-rating-button.active {
    background: var(--review-selected-bg, #dbeafe);
    color: var(--review-selected-text, #1d4ed8);
    border-color: var(--review-selected-line, #2563eb);
    box-shadow: inset 0 0 0 1px var(--review-selected-line, #2563eb);
}
body[data-theme] .lq-footer-action.lq-next-btn:not(:disabled) {
    background: #2563eb; color: #fff; border-color: #2563eb;
    font-weight: 600;
}
body[data-theme] .lq-footer-action.lq-next-btn:not(:disabled):hover { background: #1d4ed8; }

/* Quiet navigation frame; only the selected video tab is elevated. */
body[data-theme] .video-tabs {
    background: var(--night-bg, #f8fafc);
    border-color: var(--night-line, #e2e8f0);
}
body[data-theme] .video-tabs .tab-button {
    color: var(--night-muted, #64748b);
    background: transparent;
    font-weight: 500;
    transition: background-color .15s ease, color .15s ease;
}
body[data-theme] .video-tabs .tab-button:hover:not(.active) {
    background: var(--night-panel, #f1f5f9);
    color: var(--night-text, #334155);
}
body[data-theme] .video-tabs .tab-button.active {
    background: var(--night-raised, #fff);
    color: var(--night-blue, #2563eb);
    box-shadow: inset 0 0 0 1px var(--night-line, #e2e8f0), 0 1px 2px #0000000a;
    font-weight: 600;
}
body[data-theme] .video-tabs .tab-button:focus-visible {
    outline: 2px solid var(--night-blue, #2563eb);
    outline-offset: -2px;
}

/* Activity is encoded by the fill, never by the empty column track. */
body[data-theme] .dashboard-weekly-chart { height: 175px; gap: 6px; padding-bottom: 8px; }
body[data-theme] .dashboard-day > div { background: var(--night-panel, #f1f5f9); }
body[data-theme] .dashboard-day.is-empty > div { border-bottom: 2px solid var(--night-line, #cbd5e1); }
body[data-theme] .dashboard-day > span { height: auto; min-height: 24px; font-size: 12px; line-height: 1.5; color: var(--night-muted, #64748b); text-align: center; }
body[data-theme] .dashboard-day small { font-size: 12px; line-height: 1.5; color: var(--night-muted, #64748b); }
body[data-theme] .dashboard-day.is-today small strong { font-weight: 600; color: var(--night-blue, #2563eb); }
body[data-theme] .dashboard-day.is-today small::after { width: 5px; height: 5px; bottom: -7px; border-radius: 50%; background: var(--night-blue, #2563eb); }
body[data-theme] .dashboard-card-title small { font-size: 12px; }

body[data-theme] :is(.dashboard-card, .dashboard-metric) { border-color: var(--night-line, #e5eaf2); }
body[data-theme] :is(.dashboard-title, .dashboard-card-title h2, .dashboard-metric strong, .dashboard-metric > div > span) { color: var(--night-text, #172033); }
body[data-theme] .dashboard-metric small { color: var(--night-muted, #64748b); }
body[data-theme] .dashboard-day > div { background: transparent; }
body[data-theme] .dashboard-plan-link { background: transparent; color: var(--night-blue, #2563eb); padding-left: 0; }
body[data-theme] .dashboard-plan-link:hover { text-decoration: underline; }
body[data-theme] .bottom-nav button.active { color: var(--night-blue, #2563eb); }

/* Match the initials avatar to the dark navigation palette. */
body[data-theme="dark"] .topbar .avatar {
    background: #293a56;
    color: #dbeafe;
}
@media (prefers-color-scheme: dark) {
    body[data-theme="system"] .topbar .avatar {
        background: #293a56;
        color: #dbeafe;
    }
}

/* Keep the header goal compact, without a surrounding capsule. */
body[data-theme] .topbar .topbar-daily-goal .daily-goal-card {
    border: 0;
    background: transparent;
    box-shadow: none;
}

/* Touch browsers can retain :hover after a tap. Only unanswered choices may hover. */
@media (hover: hover) and (pointer: fine) {
    body[data-theme] .review-card-option:where(:hover:not(:disabled):not(.correct):not(.wrong)) {
        background: var(--night-selected, #f8fbff);
        color: var(--night-blue, #172033);
        border-color: var(--night-blue, #93b4ff);
    }
}
