/* Theme controls and palette overrides live here to keep component CSS focused. */
.theme-toggle {
    width: 38px;
    height: 38px;
    margin-right: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--c-text-sec);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s, background 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
    transform: translateY(-1px) rotate(8deg);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.45);
    background: rgba(251, 191, 36, 0.1);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 3px;
}

[data-theme="light"] {
    --c-bg-void: #cfd8e3;
    --c-bg-deep: #e5eaf0;
    --c-bg-surface: #edf1f5;
    --c-primary: #078262;
    --c-primary-bright: #05694f;
    --c-primary-dark: #b8dfd3;
    --c-primary-glow: rgba(7, 130, 98, 0.34);
    --c-primary-dim: rgba(7, 130, 98, 0.14);
    --c-accent: #315fc4;
    --c-accent-bright: #23499e;
    --c-accent-glow: rgba(49, 95, 196, 0.3);
    --c-accent-dim: rgba(49, 95, 196, 0.13);
    --c-danger: #dc2626;
    --c-danger-bright: #b91c1c;
    --c-danger-glow: rgba(220, 38, 38, 0.2);
    --c-text-main: #172235;
    --c-text-sec: #4b5b70;
    --c-text-dim: #718096;
    --glass-bg: rgba(239, 243, 247, 0.9);
    --glass-border: 1px solid rgba(44, 62, 86, 0.14);
    --glass-highlight: 1px solid rgba(44, 62, 86, 0.2);
    --glass-shine: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 60%);
    --shadow-card: 0 14px 32px -18px rgba(48, 61, 80, 0.42);
    --shadow-neon: 0 0 0 1px rgba(7, 130, 98, 0.12), 0 8px 24px var(--c-primary-glow);
}

[data-theme="light"] body {
    background: #cfd8e3;
}

[data-theme="light"] .app-root {
    background: #e5eaf0;
    box-shadow: 0 0 70px rgba(49, 61, 78, 0.24);
    border-color: rgba(44, 62, 86, 0.12);
}

[data-theme="light"] .fx-gradient {
    background:
        radial-gradient(circle at 15% 5%, rgba(80, 168, 151, 0.16), transparent 34%),
        radial-gradient(circle at 90% 88%, rgba(75, 105, 174, 0.14), transparent 38%),
        linear-gradient(165deg, #dbe3ea 0%, #e9edf2 48%, #dfe6ed 100%);
    opacity: 1;
}

[data-theme="light"] .fx-grid {
    background-image:
        linear-gradient(rgba(44, 62, 86, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(44, 62, 86, 0.055) 1px, transparent 1px);
}

[data-theme="light"] .fx-noise { opacity: 0.025; }
[data-theme="light"] .fx-vignette { background: radial-gradient(circle at center, transparent 25%, rgba(71, 85, 105, 0.13) 100%); }
[data-theme="light"] .fx-orb { opacity: 0.09; }

[data-theme="light"] .hud-header {
    background: rgba(232, 237, 242, 0.94);
    border-bottom-color: rgba(44, 62, 86, 0.13);
}

[data-theme="light"] .nav-glass-bg {
    background: rgba(232, 237, 242, 0.95);
    border-top-color: rgba(44, 62, 86, 0.13);
}

[data-theme="light"] .theme-toggle {
    color: #475569;
    background: rgba(239, 243, 247, 0.9);
    border-color: rgba(44, 62, 86, 0.16);
    box-shadow: 0 5px 16px rgba(51, 65, 85, 0.12);
}

[data-theme="light"] .theme-toggle:hover {
    color: #4f46e5;
    border-color: rgba(79, 70, 229, 0.28);
    background: #eef2ff;
}

[data-theme="light"] .dock-btn.active,
[data-theme="light"] .reactor-digits,
[data-theme="light"] .ph-date,
[data-theme="light"] .ex-title-lg,
[data-theme="light"] .p-val,
[data-theme="light"] .username-input,
[data-theme="light"] .kpi-val,
[data-theme="light"] .mini-val,
[data-theme="light"] .onb-title {
    color: var(--c-text-main);
    text-shadow: none;
}

[data-theme="light"] .cyber-card,
[data-theme="light"] .ex-detail-card,
[data-theme="light"] .log-entry,
[data-theme="light"] .planner-day,
[data-theme="light"] .pt-ex-card,
[data-theme="light"] .pm-panel {
    box-shadow: var(--shadow-card);
}

[data-theme="light"] .cyber-card {
    background: rgba(239, 243, 247, 0.92);
    border-color: rgba(44, 62, 86, 0.14);
}

[data-theme="light"] .btn-icon-only,
[data-theme="light"] .btn-reset-mini,
[data-theme="light"] .btn-neon.ghost,
[data-theme="light"] .filter-chip,
[data-theme="light"] .btn-action-pdf {
    background: rgba(235, 240, 245, 0.92);
    border-color: rgba(44, 62, 86, 0.16);
    color: var(--c-text-sec);
}

[data-theme="light"] .dash-dropdown,
[data-theme="light"] .pm-dropdown-list {
    background: rgba(255, 255, 255, 0.97);
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 18px 45px rgba(51, 65, 85, 0.18);
}

[data-theme="light"] .dd-item:hover,
[data-theme="light"] .btn-icon-only:hover,
[data-theme="light"] .filter-chip:hover,
[data-theme="light"] .btn-action-pdf:hover {
    background: rgba(15, 23, 42, 0.05);
    color: var(--c-text-main);
}

[data-theme="light"] .timer-mode-switch,
[data-theme="light"] .selector-track,
[data-theme="light"] .reactor-meta,
[data-theme="light"] .at-range-bar {
    background: rgba(210, 219, 229, 0.82);
    border-color: rgba(44, 62, 86, 0.14);
}

[data-theme="light"] .track-bg { stroke: rgba(44, 62, 86, 0.13); }
[data-theme="light"] .track-deco { stroke: rgba(44, 62, 86, 0.18); }
[data-theme="light"] .reactor-svg { filter: drop-shadow(0 8px 18px rgba(49, 61, 78, 0.18)); }
[data-theme="light"] .mode-btn.active { color: var(--c-text-main); text-shadow: none; }
[data-theme="light"] .mode-indicator { background: rgba(240, 244, 248, 0.96); box-shadow: 0 3px 12px rgba(51, 65, 85, 0.18); }

/* Loader needs its own contrast treatment because the base version uses white text. */
[data-theme="light"] .loader-terminal {
    background:
        radial-gradient(circle at 50% 42%, rgba(7, 130, 98, 0.13), transparent 26%),
        linear-gradient(155deg, #d6dee7, #e6ebf0 52%, #d9e1e9);
}

[data-theme="light"] .loader-title,
[data-theme="light"] .loader-title::before,
[data-theme="light"] .loader-title::after {
    color: #172235;
    text-shadow: none;
}

[data-theme="light"] .loader-status {
    color: #526176;
    font-weight: 700;
}

[data-theme="light"] .scan-line {
    background: #078262;
    box-shadow: 0 0 10px rgba(7, 130, 98, 0.5);
    opacity: 0.65;
}

[data-theme="light"] .ring-1 {
    border-top-color: #078262;
    border-left-color: rgba(7, 130, 98, 0.32);
}

[data-theme="light"] .ring-2 {
    border-right-color: #315fc4;
    border-bottom-color: rgba(49, 95, 196, 0.3);
}

[data-theme="light"] .spin-core {
    background: #078262;
    box-shadow: 0 0 0 8px rgba(7, 130, 98, 0.1), 0 0 24px rgba(7, 130, 98, 0.42);
}

/* System config sliders: visible track, filled thumb and keyboard focus. */
[data-theme="light"] .cyber-range {
    accent-color: var(--c-primary);
}

[data-theme="light"] .cyber-range::-webkit-slider-runnable-track {
    height: 8px;
    background: linear-gradient(90deg, #aab8c7, #c5d0db);
    border: 1px solid rgba(44, 62, 86, 0.18);
    border-radius: 999px;
    box-shadow: inset 0 1px 3px rgba(44, 62, 86, 0.16);
}

[data-theme="light"] .cyber-range::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -9px;
    background: #edf2f5;
    border: 3px solid var(--c-primary);
    box-shadow: 0 0 0 5px rgba(7, 130, 98, 0.12), 0 4px 10px rgba(44, 62, 86, 0.24);
}

[data-theme="light"] .cyber-range::-moz-range-track {
    height: 8px;
    background: linear-gradient(90deg, #aab8c7, #c5d0db);
    border: 1px solid rgba(44, 62, 86, 0.18);
    border-radius: 999px;
}

[data-theme="light"] .cyber-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #edf2f5;
    border: 3px solid var(--c-primary);
    border-radius: 50%;
    box-shadow: 0 0 0 5px rgba(7, 130, 98, 0.12), 0 4px 10px rgba(44, 62, 86, 0.24);
}

[data-theme="light"] .cyber-range:focus-visible {
    outline: 2px solid rgba(7, 130, 98, 0.5);
    outline-offset: 6px;
    border-radius: 999px;
}

/* Plan mode gets a cool lavender surface instead of the inherited black panel. */
[data-theme="light"] #tab-dashboard.plan-mode-active .timer-reactor {
    background:
        radial-gradient(ellipse at 50% 32%, rgba(116, 92, 190, 0.1), transparent 58%),
        linear-gradient(145deg, #e2e5ed, #d4dbe5);
    border: 1px solid rgba(85, 69, 145, 0.3);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.62),
        0 10px 22px rgba(54, 61, 83, 0.16),
        0 0 0 3px rgba(113, 86, 194, 0.05);
}

[data-theme="light"] #tab-dashboard.plan-mode-active .reactor-svg-rect {
    filter: drop-shadow(0 0 4px rgba(92, 63, 169, 0.28));
}

[data-theme="light"] .rect-track-bg {
    stroke: rgba(57, 52, 76, 0.3);
}

[data-theme="light"] #tab-dashboard.plan-mode-active .reactor-status,
[data-theme="light"] #tab-dashboard.plan-mode-active .reactor-digits {
    color: #1b2335;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

[data-theme="light"] #tab-dashboard.plan-mode-active .reactor-meta {
    background: rgba(232, 236, 243, 0.82);
    border: 1px solid rgba(44, 62, 86, 0.12);
    color: #536176;
}

[data-theme="light"] .plan-mode-reactor .reactor-hud::before,
[data-theme="light"] .pm-progress-label,
[data-theme="light"] .pm-countdown-label {
    color: #6547b3;
    text-shadow: none;
}

[data-theme="light"] .pm-progress-track,
[data-theme="light"] .pm-countdown-bar-wrap {
    background: rgba(78, 65, 119, 0.18);
}

[data-theme="light"] .pm-progress-fill,
[data-theme="light"] .pm-countdown-bar {
    background: linear-gradient(90deg, #6547b3, #8b6ad2);
    box-shadow: 0 0 5px rgba(101, 71, 179, 0.26);
}

[data-theme="light"] .pm-custom-selected,
[data-theme="light"] .pm-ex-accordion,
[data-theme="light"] .pm-active-card,
[data-theme="light"] .pm-ex-item,
[data-theme="light"] .pm-list-item {
    background: rgba(226, 229, 238, 0.92);
    border-color: rgba(85, 69, 145, 0.23);
    box-shadow: 0 7px 18px rgba(61, 57, 82, 0.1);
}

[data-theme="light"] .pm-csel-label,
[data-theme="light"] .pm-ex-select-label,
[data-theme="light"] .pm-ex-item-meta,
[data-theme="light"] .pm-list-meta,
[data-theme="light"] .pm-active-comment {
    color: #4b5b70;
}

[data-theme="light"] #tab-dashboard.plan-mode-active .pm-csel-label,
[data-theme="light"] .pm-list-title,
[data-theme="light"] .pm-ex-item-title,
[data-theme="light"] .pm-active-title {
    color: #172235 !important;
    text-shadow: none;
}

[data-theme="light"] .pm-ex-acc-btn {
    background: rgba(101, 71, 179, 0.09);
    border-color: rgba(85, 69, 145, 0.28);
    color: #4f3a91;
    text-shadow: none;
}

[data-theme="light"] .pm-ex-acc-btn:hover,
[data-theme="light"] .pm-ex-acc-btn.pm-acc-open {
    background: rgba(101, 71, 179, 0.14);
    border-color: rgba(85, 69, 145, 0.38);
    color: #4f3a91;
}

[data-theme="light"] .pm-ex-scroll-list.pm-acc-open {
    background: #e8edf3;
    border-color: rgba(85, 69, 145, 0.28);
    box-shadow: 0 10px 24px rgba(51, 65, 85, 0.12);
}

[data-theme="light"] .pm-ex-scroll-list.pm-acc-open .pm-list-item {
    background: rgba(247, 249, 251, 0.96);
    border-color: rgba(44, 62, 86, 0.12);
    box-shadow: 0 3px 9px rgba(51, 65, 85, 0.08);
}

[data-theme="light"] .pm-list-item:hover:not(.pm-list-done),
[data-theme="light"] .pm-list-item.pm-list-active {
    background: #f0edf9;
    border-color: rgba(92, 63, 169, 0.34);
}

[data-theme="light"] .pm-list-category {
    color: var(--pm-col-light, #5c3fa9);
}

[data-theme="light"] .pm-list-link {
    color: #6547b3;
}

[data-theme="light"] .pm-list-indicator {
    background: rgba(255, 255, 255, 0.58);
}

[data-theme="light"] .pm-list-empty {
    color: #58697e;
}

[data-theme="light"] .pm-csel-icon,
[data-theme="light"] .pm-csel-arrow,
[data-theme="light"] .pm-ex-acc-icon,
[data-theme="light"] .pm-ex-acc-arrow {
    color: #6547b3;
}

[data-theme="light"] .tms-btn[data-tmode="plan"].active {
    background: rgba(101, 71, 179, 0.18);
    color: #5c3fa9;
    box-shadow: inset 0 0 0 1px rgba(101, 71, 179, 0.2), 0 4px 12px rgba(101, 71, 179, 0.16);
}

[data-theme="light"] .modal-overlay,
[data-theme="light"] .onb-overlay {
    background: rgba(71, 85, 105, 0.48);
}

[data-theme="light"] .modal-window,
[data-theme="light"] .onb-modal {
    background: linear-gradient(160deg, #edf1f5, #e2e8ee);
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 28px 70px rgba(51, 65, 85, 0.25);
}

[data-theme="light"] .modal-header,
[data-theme="light"] .modal-footer,
[data-theme="light"] .modal-content-area {
    background: #e9eef3;
    border-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .cyber-input,
[data-theme="light"] .cyber-select,
[data-theme="light"] .search-wrap input,
[data-theme="light"] .at-date-inp {
    background: rgba(235, 240, 245, 0.92);
    color: var(--c-text-main);
    border-color: rgba(15, 23, 42, 0.13);
}

[data-theme="light"] :is(.cyber-select, select) option {
    background: #f4f7fa;
    color: #172235;
}

[data-theme="light"] .pm-custom-options {
    background: rgba(244, 247, 250, 0.98);
    border-color: rgba(101, 71, 179, 0.24);
    box-shadow: 0 18px 42px rgba(51, 65, 85, 0.18);
}

[data-theme="light"] .pm-opt-item {
    border-bottom-color: rgba(44, 62, 86, 0.08);
}

[data-theme="light"] .pm-opt-item:hover {
    background: rgba(101, 71, 179, 0.1);
}

[data-theme="light"] .pm-opt-placeholder,
[data-theme="light"] .pm-opt-meta,
[data-theme="light"] .pm-opt-dur {
    color: #65758a;
}

/* Exercise detail modal */
[data-theme="light"] .ex-modal-overlay {
    background: rgba(55, 65, 81, 0.48);
}

[data-theme="light"] .ex-modal-window {
    background: #e9eef3;
    border-color: rgba(44, 62, 86, 0.14);
    box-shadow: 0 -18px 50px rgba(51, 65, 85, 0.24);
}

[data-theme="light"] .exm-header {
    background: rgba(239, 243, 247, 0.96);
    border-bottom-color: rgba(44, 62, 86, 0.1);
}

[data-theme="light"] .exm-title,
[data-theme="light"] .hud-val,
[data-theme="light"] .exm-tab-btn.active,
[data-theme="light"] .exm-text-content,
[data-theme="light"] .exm-pdf-link,
[data-theme="light"] .exm-cyber-input,
[data-theme="light"] .kpi-val,
[data-theme="light"] .mini-val {
    color: var(--c-text-main);
    text-shadow: none;
}

[data-theme="light"] .exm-close {
    background: rgba(220, 226, 233, 0.95);
    border-color: rgba(44, 62, 86, 0.14);
    color: var(--c-text-main);
}

[data-theme="light"] .exm-scroll-content {
    background: #e9eef3;
}

[data-theme="light"] .exm-hero-wrapper {
    background: #d7dee6;
    border: 1px solid rgba(44, 62, 86, 0.1);
}

[data-theme="light"] .exm-hero-blur {
    opacity: 0.32;
}

[data-theme="light"] .exm-hud-box,
[data-theme="light"] .exm-stat-kpi,
[data-theme="light"] .exm-maximize-stats,
[data-theme="light"] .exm-et-goal,
[data-theme="light"] .exm-free-info {
    background: rgba(239, 243, 247, 0.92);
    border-color: rgba(44, 62, 86, 0.1);
}

[data-theme="light"] :is(
    .hud-label,
    .kpi-lbl,
    .exm-stat-section-label,
    .exm-stat-day,
    .mini-lbl,
    .exm-et-goal-item,
    .et-num,
    .exm-free-info,
    .avg-lbl
) {
    color: #58697e;
}

[data-theme="light"] .exm-tab-switch,
[data-theme="light"] .exm-avg-display {
    border-color: rgba(44, 62, 86, 0.14);
}

[data-theme="light"] .exm-tab-btn {
    color: #65758a;
}

[data-theme="light"] .exm-text-content p {
    color: var(--c-text-sec) !important;
}

[data-theme="light"] .exm-pdf-link {
    background: rgba(220, 38, 38, 0.07);
    border-color: rgba(220, 38, 38, 0.2);
}

[data-theme="light"] .exm-footer {
    background: #dfe6ed;
    border-top-color: rgba(44, 62, 86, 0.14);
    box-shadow: 0 -10px 26px rgba(51, 65, 85, 0.13);
}

[data-theme="light"] .exm-cell {
    background: rgba(218, 225, 233, 0.92);
    border-color: rgba(44, 62, 86, 0.13);
    color: #718096;
}

[data-theme="light"] .exm-cell.filled {
    background: rgba(7, 130, 98, 0.13);
    border-color: var(--c-primary);
    color: #05694f;
    text-shadow: none;
}

[data-theme="light"] .exm-input-wrapper {
    background: rgba(244, 247, 250, 0.96);
    border-color: rgba(44, 62, 86, 0.15);
}

[data-theme="light"] .exm-cyber-input:focus {
    background: #ffffff;
}

[data-theme="light"] .exm-stat-bar {
    background: rgba(71, 85, 105, 0.15);
}

[data-theme="light"] .exm-et-attempt {
    color: var(--c-text-sec);
    border-color: rgba(44, 62, 86, 0.1);
}

[data-theme="light"] .exm-et-attempt.passed {
    background: rgba(7, 130, 98, 0.09);
}

[data-theme="light"] .exm-et-attempt.failed {
    background: rgba(220, 38, 38, 0.07);
}

[data-theme="light"] .toast-popup {
    background: rgba(235, 240, 245, 0.97);
    box-shadow: 0 12px 35px rgba(51, 65, 85, 0.2);
}

[data-theme="light"] .toast-message { color: var(--c-text-main); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(71, 85, 105, 0.2); }

[data-theme="light"] {
    --st-bg-dark: #dfe6ed;
    --st-bg-panel: #edf1f5;
    --st-bg-panel-glass: rgba(237, 241, 245, 0.94);
    --vs-bg-card: #edf1f5;
    --vs-bg-surface: #fff7ed;
}

[data-theme="light"] :is(
    .com-val,
    .com-res-name,
    .com-feed-user,
    .ex-card-title,
    .pt-today-day,
    .pt-ex-title,
    .pm-active-title,
    .pm-ex-item-title,
    .pm-opt-title,
    .lsc-badge-text,
    .lsc-value,
    .st-mh-title,
    .st-sum-val,
    .st-gauge-big,
    .st-di-title,
    .st-di-val,
    .vs-dashboard-header,
    .vs-ex-name,
    .vs-res-avg
) {
    color: var(--c-text-main);
    text-shadow: none;
}

[data-theme="light"] :is(
    .com-dashboard,
    .com-feed-item,
    .com-user-result,
    .friend-req-item,
    .member-list-item,
    .ex-tactical-card,
    .plan-day-card,
    .plan-ex-entry,
    .pt-today-header,
    .pt-ex-card,
    .level-stat-card,
    .st-modal-card,
    .st-summary-box,
    .st-drill-item,
    .vs-battle-card
) {
    background: rgba(237, 241, 245, 0.92);
    border-color: rgba(15, 23, 42, 0.09);
    box-shadow: 0 12px 30px rgba(51, 65, 85, 0.1);
}

[data-theme="light"] :is(
    .com-tab-btn,
    .com-icon-btn,
    .plan-nav-btn,
    .plan-toggle-btn,
    .btn-open-detail,
    .st-btn-close
) {
    background: rgba(232, 237, 242, 0.9);
    border-color: rgba(15, 23, 42, 0.12);
    color: var(--c-text-sec);
}

[data-theme="light"] .ex-card-image-area::before {
    background: linear-gradient(0deg, rgba(237, 241, 245, 0.97) 0%, rgba(237, 241, 245, 0.05) 100%);
}

[data-theme="light"] .pt-ex-cover::after {
    background: linear-gradient(to bottom, rgba(237, 241, 245, 0.04), rgba(237, 241, 245, 0.95));
}

[data-theme="light"] :is(.ex-card-footer, .vs-card-actions, .vs-results-overview, .st-modal-header) {
    background: rgba(241, 245, 249, 0.85);
    border-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] :is(.stats-section-header, .lsc-footer, .st-summary-container, .st-drill-item, .vs-section-divider) {
    border-color: rgba(15, 23, 42, 0.09);
}

[data-theme="light"] .st-modal-body {
    background: #dfe6ed;
}

[data-theme="light"] .st-modal-overlay {
    background: rgba(71, 85, 105, 0.48);
}

[data-theme="light"] .av-window,
[data-theme="light"] .av-section-title {
    background: #e9eef3;
}

[data-theme="light"] .av-hero-section {
    background: radial-gradient(circle at center, #eefbf5 0%, #e8edf5 75%);
    border-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .av-grid-scroll {
    background: #dfe6ed;
}

[data-theme="light"] .av-card {
    background: #edf1f5;
    border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .vs-player-name,
[data-theme="light"] .vs-mini-cell {
    color: var(--c-text-sec);
}

[data-theme="light"] .vs-mini-cell {
    background: rgba(15, 23, 42, 0.05);
}

/* Exercise flow */
[data-theme="light"] .ex-flow-window {
    background:
        radial-gradient(circle at 50% 0, rgba(7, 130, 98, 0.1), transparent 34%),
        #e8edf2;
}

[data-theme="light"] .ex-swipe-card {
    background: #f4f7fa;
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 24px 55px rgba(51, 65, 85, 0.2);
}

[data-theme="light"] .ex-swipe-meta {
    color: #526176;
}

[data-theme="light"] .ex-flow-btn.secondary,
[data-theme="light"] .ex-flow-back,
[data-theme="light"] .ex-flow-image-btn {
    color: #263449;
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .ex-flow-subhead {
    background: rgba(239, 243, 247, 0.95);
    border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .ex-flow-subhead strong {
    color: var(--c-text-main);
}

[data-theme="light"] .ex-result-summary,
[data-theme="light"] .exm-hud-box {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .ex-result-summary-body p,
[data-theme="light"] .ex-info-reading .exm-text-content,
[data-theme="light"] .ex-detail-intro p {
    color: var(--c-text-sec);
}

[data-theme="light"] .ex-detail-intro {
    background: linear-gradient(135deg, rgba(7, 130, 98, 0.09), rgba(49, 95, 196, 0.05));
    border-color: rgba(7, 130, 98, 0.18);
}

[data-theme="light"] .ex-info-reading {
    background: rgba(255, 255, 255, 0.58);
    border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .ex-info-reading .exm-tab-switch {
    background: rgba(229, 235, 241, 0.88);
    border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .ex-info-reading .exm-tab-btn.active {
    color: #172235;
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(51, 65, 85, 0.1);
}

[data-theme="light"] .ex-detail-section-head small {
    color: #64748b;
}

[data-theme="light"] .ex-info-image {
    background:
        radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.88), transparent 58%),
        #cdd8e0;
    border-color: rgba(30, 41, 59, 0.1);
}

[data-theme="light"] .ex-info-image::after {
    background: linear-gradient(180deg, transparent 55%, rgba(30, 41, 59, 0.24));
}

[data-theme="light"] .ex-reading-block h4 {
    color: var(--c-text-main);
}

[data-theme="light"] .ex-reading-block + .ex-reading-block {
    border-color: rgba(15, 23, 42, 0.09);
}

[data-theme="light"] .ex-detail-bottom-action {
    background: linear-gradient(180deg, transparent, #e8edf2 38%);
}

[data-theme="light"] .ex-flow-actions {
    background: linear-gradient(180deg, transparent, #e8edf2 38%);
}

[data-theme="light"] .ex-flow-view[data-view="overview"] .ex-flow-actions {
    background: rgba(255, 255, 255, 0.62);
    border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .ex-briefing-visual {
    background: #d8e1e8;
    border: 1px solid rgba(30, 41, 59, 0.1);
    box-shadow: 0 18px 38px rgba(51, 65, 85, 0.16);
}

[data-theme="light"] .ex-briefing-backdrop {
    filter: blur(24px) saturate(0.58);
    opacity: 0.42;
}

[data-theme="light"] .ex-briefing-content {
    border-color: rgba(30, 41, 59, 0.09);
    background:
        radial-gradient(circle at 100% 0, rgba(17, 153, 112, 0.1), transparent 44%),
        #ffffff;
    box-shadow: 0 16px 35px rgba(51, 65, 85, 0.12);
}

[data-theme="light"] .ex-briefing-teaser {
    color: #344256;
}

[data-theme="light"] .ex-briefing-rewards span {
    color: #64748b;
    border-color: rgba(30, 41, 59, 0.09);
    background: #f3f6f8;
}

[data-theme="light"] .ex-briefing-rewards strong {
    color: #1e293b;
}

[data-theme="light"] .ex-briefing-btn.secondary {
    color: #263449;
    border-color: rgba(30, 41, 59, 0.1);
    background: #ffffff;
    box-shadow: 0 9px 22px rgba(51, 65, 85, 0.1);
}

[data-theme="light"] .ex-briefing-btn.secondary > i {
    color: #315a72;
    background: #e9f0f4;
}

[data-theme="light"] .ex-briefing-btn.primary {
    color: #073326;
    border-color: rgba(7, 130, 98, 0.28);
    background: linear-gradient(135deg, #55dfad, #32c992);
    box-shadow: 0 10px 24px rgba(24, 153, 112, 0.22);
}

[data-theme="light"] .hud-val {
    color: var(--c-text-main);
}

[data-theme="light"] .ex-result-input {
    background: #e3e9ef;
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 -10px 24px rgba(51, 65, 85, 0.1);
}

[data-theme="light"] .exm-input-wrapper,
[data-theme="light"] .exm-cell {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .exm-cyber-input {
    color: var(--c-text-main);
}

[data-theme="light"] .exm-cell.filled {
    color: var(--c-text-main);
}

/* Avatar selector */
[data-theme="light"] .av-window {
    border-color: rgba(7, 130, 98, 0.28);
    box-shadow: 0 28px 65px rgba(51, 65, 85, 0.24);
}

[data-theme="light"] .av-section-title {
    color: #526176;
    border-color: rgba(15, 23, 42, 0.09);
    box-shadow: 0 7px 15px rgba(51, 65, 85, 0.1);
}

[data-theme="light"] .av-hero-bg-grid {
    background-image:
        linear-gradient(rgba(7, 130, 98, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(7, 130, 98, 0.08) 1px, transparent 1px);
}

[data-theme="light"] #av-preview-img {
    background: #d8e1e9;
    box-shadow: 0 14px 32px rgba(51, 65, 85, 0.22);
}

[data-theme="light"] .av-identity-tag {
    color: #05694f;
    background: rgba(244, 247, 250, 0.92);
    border-color: rgba(7, 130, 98, 0.3);
    box-shadow: 0 5px 14px rgba(51, 65, 85, 0.14);
}

[data-theme="light"] .av-card img {
    opacity: 0.82;
}

[data-theme="light"] .av-card:hover {
    border-color: rgba(15, 23, 42, 0.28);
    background: #f7f9fb;
}

[data-theme="light"] .av-card.selected {
    background: rgba(7, 130, 98, 0.1);
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(7, 130, 98, 0.1);
}

[data-theme="light"] .av-footer {
    background: #e9eef3;
    border-color: rgba(15, 23, 42, 0.1);
}

/* Today overview follows the same card language as plan exercises. */
[data-theme="light"] .pt-today-header {
    background: rgba(237, 241, 245, 0.94);
}

[data-theme="light"] .plan-compact-exercise {
    background: rgba(237, 241, 245, 0.94);
    border-color: rgba(15, 23, 42, 0.09);
    box-shadow: 0 8px 22px rgba(51, 65, 85, 0.1);
}

[data-theme="light"] .plan-compact-exercise:hover {
    background: #f4f7fa;
}

[data-theme="light"] .plan-compact-title {
    color: var(--c-text-main);
}

[data-theme="light"] .plan-compact-logo {
    background-color: #e1e7ed;
    border-color: rgba(44, 62, 86, 0.13);
}

/* Cross-module contrast fixes for legacy hard-coded light text. */
[data-theme="light"] .ex-meta-lvl {
    color: #f4f7fa;
    background: #40546d;
    border-color: #31445d;
    font-weight: 800;
    text-shadow: none;
    box-shadow: 0 2px 7px rgba(39, 55, 76, 0.24);
}

[data-theme="light"] .ex-card-logo {
    background-color: #e1e7ed;
    border-color: rgba(44, 62, 86, 0.13);
}

[data-theme="light"] .ex-xp-pill {
    color: #315fc4;
}

[data-theme="light"] :is(
    .pt-meta-desc,
    .pt-today-date,
    .pt-day-coach-note,
    .pt-ex-comment,
    .pt-ex-xp,
    .plan-day-note
) {
    color: #526176;
}

[data-theme="light"] .pt-day-coach-note {
    background: rgba(49, 95, 196, 0.09);
    border-color: rgba(49, 95, 196, 0.22);
}

[data-theme="light"] .pt-ex-cover {
    background-color: #d7dee6;
}

[data-theme="light"] .pt-ex-dur {
    color: #9a6200;
}

[data-theme="light"] :is(
    .ssh-title,
    .lsc-label,
    .lsc-unit,
    .lsc-footer,
    .st-sum-label,
    .st-sum-sub,
    .st-di-rank,
    .st-di-meta,
    .st-tl-date,
    .st-rep-lbl,
    .st-rep-sub
) {
    color: #526176;
}

[data-theme="light"] .ssh-decor {
    background: rgba(44, 62, 86, 0.18);
}

[data-theme="light"] .stats-section-header {
    border-bottom-color: rgba(44, 62, 86, 0.14);
}

[data-theme="light"] .at-axis-lbl {
    fill: #526176;
}

[data-theme="light"] .at-range-btn {
    color: #526176;
    border-color: rgba(85, 69, 145, 0.3);
}

[data-theme="light"] .at-range-btn.active {
    color: #f4f7fa;
    background: #6547b3;
    border-color: #6547b3;
}

[data-theme="light"] .at-chart-area,
[data-theme="light"] .at-kpi-row,
[data-theme="light"] .at-trend-row {
    border-color: rgba(44, 62, 86, 0.12);
}

[data-theme="light"] .version-tag {
    color: #65758a;
    opacity: 0.8;
}

@media (max-width: 390px) {
    .hud-header { padding-inline: 14px; }
    .theme-toggle { width: 34px; height: 34px; margin-right: 7px; }
    .streak-module { padding-inline: 10px; }
}
