/* Replay Scope only. Media pixels and canvas analysis never receive a filter. */
.replay-shell-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; }

:root[data-theme="light"] {
  color-scheme: light;
  /* MatchRecord's light palette: bright cyan fills, dark ink on light surfaces. */
  --bg: #f3f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafb;
  --line: #dde3e8;
  --line-bright: #c9d1d7;
  --text: #0f1418;
  --muted: #5d6872;
  --accent: #3dd6f0;
  --accent-fg: #04141a;
  --cyan: #0b7d93;
  --cyan-deep: #e8fafc;
  --detail-process: #6650b8;
  --red: #b63545;
  --shadow: 0 4px 16px rgba(15, 20, 24, .04);
  --theme-danger: #aa3042;
  --theme-warning: #805b16;
}
:root[data-theme="light"] body { background: var(--bg); }
:root[data-theme="light"] .vfp-shell-footer { background: var(--bg); border-color: var(--line); }
:root[data-theme="light"] .vfp-shell-footer a:hover { color: #045b65; }
:root[data-theme="light"] .function-tutorial-open { color: var(--muted); }

/* Surfaces, including panels that are populated after a recording is opened. */
:root[data-theme="light"] :is(.drop-zone, .recording-library, .note-context-library, .recording-library-card, .note-context-card, .note-inline-player, .note-context-details > div, .source-player-disclosure, .source-info, .match-index-card, .analysis-panel, .steam-raw-panel, .progressive-harvest, .selected-export-progress, .development-debug, .development-code-fingerprint, .display-metadata-regeneration, .raw-boundary-review, .ground-truth-builder, .accuracy-timeline, .failure-card, .debug-selected-match-editor, .match-viewer-metadata-editor) { background: var(--panel); border-color: var(--line); box-shadow: var(--shadow); }
:root[data-theme="light"] .drop-zone.is-dragging { background: var(--cyan-deep); border-color: var(--cyan); }
:root[data-theme="light"] .drop-zone { border-color: var(--line-bright); box-shadow: none; }
:root[data-theme="light"] :is(.drop-icon, .home-view-switch, .home-view-switch button, .note-inline-controls, .strategy-notes-device-row, .source-info-body dl, .steam-codecs p, .progressive-preflight dl, .character-harvest-metrics dl, .ring-name-metrics dl, .refinement-metrics dl, .raw-scan-metrics dl, .steam-raw-diagnostics dl, .ground-truth-actions > p, .ground-truth-item, .capture-step p, .virtual-empty, .virtual-track, .timeline-segment, .match-card:hover, .match-index-card[data-status="rough"] .match-index-info) { background: var(--panel-soft); border-color: var(--line); }
:root[data-theme="light"] .source-info-body { background: var(--line); }
:root[data-theme="light"] .recording-library-thumb-empty { background: var(--panel-soft); color: var(--muted); }
:root[data-theme="light"] .home-view-switch button { color: var(--muted); }
:root[data-theme="light"] .home-view-switch button[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: inset 0 -4px 0 var(--accent); }
:root[data-theme="light"] #home-view-notes[aria-selected="true"] .home-view-notes-count { background: var(--panel); }
:root[data-theme="light"] #home-view-notes[aria-selected="false"] { animation: none; }
:root[data-theme="light"] #home-view-notes[aria-selected="false"]::after { display: none; }
:root[data-theme="light"] .match-index-card.is-active { border-color: var(--accent); }
:root[data-theme="light"] :is(.match-index-card[data-status="ready"] .match-index-info, .harvest-ready, .match-viewer-actions .is-complete, .mode-badge.is-steam-raw, .mode-badge.is-virtual) { background: var(--cyan-deep); border-color: var(--cyan); }
:root[data-theme="light"] :is(.analysis-meter, .harvest-progress, .recording-process-meter, .raw-scan-progress > div, .selected-export-progress-meter, .accuracy-timeline-track) { background: #dce5e8; border-color: var(--line-bright); }
:root[data-theme="light"] .accuracy-timeline-block { background: var(--muted); }
:root[data-theme="light"] .recording-background-status { background: var(--panel-soft); color: var(--muted); }
:root[data-theme="light"] .recording-background-status[data-state="complete"] { --background-state-color: #15725c; }
:root[data-theme="light"] .recording-background-status[data-state="stopped"] { --background-state-color: var(--theme-danger); }
:root[data-theme="light"] .recording-process-status { background: var(--panel-soft); }
:root[data-theme="light"] .recording-process-status > footer { color: var(--muted); }
:root[data-theme="light"] .selected-match-status { color: var(--theme-warning); }
:root[data-theme="light"] .recording-process-status[data-stage="error"] { --process-color: var(--theme-danger); }

/* Readable text on white; status colors are restored below. */
:root[data-theme="light"] :is(.note-context-text, .note-context-derived, .note-context-vs, .note-context-details > div code, .note-context-details > div strong, .note-inline-player > header strong, .session-summary strong, .recording-process-status > header strong, .recording-process-status > footer strong, .harvest-ready > p span, .ground-truth-actions > p strong, .steam-raw-diagnostics dd, .steam-codecs code, .source-player-disclosure > summary strong, .source-info-body dd, .match-index-label .match-index-character, .match-index-winner strong, .annotation-card-context b, .annotation-card-text, .recording-delete-target, .selected-export-progress-copy, .selected-export-progress-footer strong, .development-code-fingerprint > strong, .display-metadata-regeneration strong, .raw-boundary-review > header strong, .strategy-notes-device-management > h3, .strategy-notes-pairing-code, .strategy-notes-pairing-request p, .note-signal-data-modal h2, .note-signal-data-modal dd) { color: var(--text); }
:root[data-theme="light"] :is(.recording-library-info p, .recording-library-info span, .recording-title-edit, .note-context-date, .note-context-text.is-empty, .note-context-details > div, .note-inline-status, .note-inline-controls > span, .note-inline-offline p, .session-summary, .source-details, .source-time > span:first-child, .source-time small, .source-time > span:last-child, .source-player-disclosure > summary, .manual-tools summary, .mode-badge, .analysis-copy span, .analysis-copy small, .analysis-panel > strong, .steam-raw-heading span, .steam-raw-detail, .steam-codecs span, .progressive-preflight dt, .self-ring-name-setting label, .self-ring-name-setting span, .harvest-live > p, .harvest-countdown span, .harvest-ready > p strong, .character-harvest-panel > header span, .character-harvest-panel > p, .character-harvest-metrics dt, .ring-name-metrics dt, .refinement-metrics dt, .raw-scan-metrics dt, .steam-raw-diagnostics dt, .ground-truth-builder header span, .ground-truth-help, .ground-truth-item span, .ground-truth-item button, .refinement-panel header span, .accuracy-panel header span, .accuracy-timeline-row > span, .accuracy-timeline-scale, .accuracy-sweep summary, .failure-card p, .raw-scan-heading span, .raw-scan-progress p, .raw-scan-table th, .raw-scan-extrapolation, .capture-step p span, .capture-step p strong, .source-footnote > p:not(.error-message), .development-debug > summary, .development-debug > summary small, .development-code-fingerprint dt, .development-code-fingerprint dd, .display-metadata-regeneration output, .raw-boundary-review > header span, .raw-boundary-review > header p, .raw-boundary-review-actions label, .raw-boundary-review-controls > p, .raw-boundary-review-presets > span, .virtual-empty p, .virtual-time-row > span, .virtual-time-row small, .timeline-segment span, .match-status, .match-status.is-rough, .match-media-source, .match-media-source.is-steam-raw, .match-index-label > small, .match-index-winner, .selected-metadata-editor label, .debug-selected-match-editor > header span, .debug-boundary-fields label, .annotation-empty, .annotation-card-context span, .annotation-card-text.is-empty, .annotation-capture-meta > span, .annotation-text-label, .steam-recording-help-intro, .steam-recording-help-note, .steam-recording-path-example b, .recording-delete-scope, .export-priority-copy, .strategy-notes-pairing-status, .strategy-notes-pairing-qr-panel p, .strategy-notes-pairing-or, .strategy-notes-mobile-pairing > p, .strategy-notes-mobile-code-entry label, .strategy-notes-device-management > p, .strategy-notes-device-row, .strategy-notes-device-row strong, .note-signals-help, .note-signals-preview::before, .note-signal-data-modal dt) { color: var(--muted); }
:root[data-theme="light"] .strategy-notes-mobile-context-note { color: var(--muted) !important; }
:root[data-theme="light"] :is(.recording-process-stages, .recording-process-stage-separator, .session-summary > span:nth-child(even), .recording-title-line > span) { color: var(--muted); }
:root[data-theme="light"] :is(.recording-process-stage.is-active, .match-index-label .match-index-character.is-winner, .note-context-character.is-winner, .development-code-fingerprint dd[data-state="success"], .display-metadata-regeneration output[data-state="success"]) { color: var(--cyan); text-shadow: none; }

/* Use MatchRecord's cyan with dark text for filled actions; ink for links. */
:root[data-theme="light"] :is(input:not([type="range"]):not([type="checkbox"]), select, textarea) { background-color: var(--panel); border-color: var(--line-bright); color: var(--text); }
:root[data-theme="light"] :is(input:not([type="range"]):not([type="checkbox"]), select, textarea):is(.is-invalid, [aria-invalid="true"]) { border-color: var(--red); }
:root[data-theme="light"] :is(input, textarea)::placeholder { color: var(--muted); }
:root[data-theme="light"] :is(.button-secondary, .recording-title-form button, .note-inline-controls button, .raw-boundary-review-controls button, .raw-boundary-review-presets button) { background: var(--panel-soft); color: var(--text); border-color: var(--line-bright); }
:root[data-theme="light"] :is(.button-primary, .button-accent, .steam-recording-info, .recording-title-form button[type="submit"], .recording-process-actions button) { background: var(--accent); color: var(--accent-fg); }
:root[data-theme="light"] :is(.text-button, .quiet-button, .delete-match, .note-context-edit-button, .note-context-edit-actions button, .note-context-details summary, .annotation-card-actions button, .annotation-close, .note-inline-close, .strategy-notes-pairing-open, .note-signal-data-modal header button) { color: var(--muted); }
:root[data-theme="light"] :is(.note-context-watch, .note-context-edit-actions .note-context-edit-save, .annotation-card-actions .collect-annotation) { color: var(--cyan); }
:root[data-theme="light"] .note-context-watch:hover { background: var(--accent); color: var(--accent-fg); }
:root[data-theme="light"] .note-context-watch.is-source-unavailable { background: #e5eaec; color: #667982; border-color: var(--line); }
:root[data-theme="light"] :is(.note-context-delete-button, .recording-delete-button, .strategy-notes-device-row button) { background: #fff3f4; color: var(--theme-danger); border-color: #c3919a; }
:root[data-theme="light"] :is(.note-context-delete-button:hover, .recording-delete-button:hover) { background: #f9e5e8; color: var(--theme-danger); }
:root[data-theme="light"] :is(.error-message, .steam-codecs strong, .analysis-panel[data-state="error"] .analysis-copy strong, .steam-raw-panel[data-state="error"] .raw-phase, .steam-raw-panel[data-state="error"] .steam-raw-heading strong, .development-code-fingerprint dd[data-state="failure"], .display-metadata-regeneration output[data-state="failure"], .match-media-source.is-offline) { color: var(--theme-danger); }
:root[data-theme="light"] :is(.button, .steam-recording-info):hover { filter: brightness(.96); }
:root[data-theme="light"] :focus-visible { outline-color: var(--cyan); }

/* Warning and completion meanings survive the theme change. */
:root[data-theme="light"] :is(.source-offline, .annotation-card.is-out-of-range, .strategy-notes-conflict-notice, .match-index-card.is-review-open .match-index-info, .match-index-card[data-status="refining"] .match-index-info) { background: #fff5df; border-color: #b39559; }
:root[data-theme="light"] :is(.source-offline span, .source-offline strong, .source-offline p, .workspace.is-source-offline:not(.is-source-reconnecting) .recording-reconnect-status, .note-context-conflict, .strategy-notes-conflict-notice, .annotation-boundary-status, .match-status.is-refining, .match-index-winner.is-review-open, .failure-card strong) { color: var(--theme-warning); }
:root[data-theme="light"] .timeline-segment[data-review-open="true"] { background: #efe0ba; }
:root[data-theme="light"] .steam-raw-error { background: #fff0f1; color: var(--theme-danger); }
:root[data-theme="light"] .annotation-card-actions .collect-annotation.is-collected { color: #15725c; }
:root[data-theme="light"] .match-note-count { color: var(--cyan); border-color: var(--cyan); background: var(--cyan-deep); }

/* Dialogs, Note Signals and device linking. */
:root[data-theme="light"] :is(dialog, .function-tutorial, .note-signal-data-modal) { background: var(--panel); border-color: var(--line-bright); color: var(--text); box-shadow: 0 20px 65px rgba(30,60,70,.2); color-scheme: light; }
:root[data-theme="light"] dialog::backdrop { background: rgba(30,50,60,.38); }
:root[data-theme="light"] .function-tutorial-scrim { background: rgba(30,50,60,.28); }
:root[data-theme="light"] :is(.function-tutorial-copy > p:not(.function-tutorial-number), .function-tutorial-footer > strong, .function-tutorial-skip) { color: var(--muted); }
:root[data-theme="light"] .function-tutorial-footer { background: var(--panel-soft); }
:root[data-theme="light"] .function-tutorial-copy h3 { color: var(--text); }
:root[data-theme="light"] :is(.steam-recording-help li, .note-signals-preview) { background: var(--panel-soft); color: var(--text); border-color: var(--line); }
:root[data-theme="light"] .note-signal-chip { background: #e8eef0; color: var(--text); border-color: var(--line-bright); }
:root[data-theme="light"] .note-signal-chip:hover { background: var(--cyan-deep); }
:root[data-theme="light"] .note-signals-toggle { background: var(--panel); color: var(--muted); border-color: var(--line-bright); }
:root[data-theme="light"] .note-signals-toggle[aria-pressed="true"] { background: var(--cyan-deep); color: var(--cyan); border-color: var(--cyan); }
:root[data-theme="light"] :is(.note-signal-data-modal header p, .note-signal-data-modal header code) { color: var(--cyan); }
:root[data-theme="light"] .note-signal-data-modal :is(dl, dl > div, header button) { border-color: var(--line); }
:root[data-theme="light"] .note-signal-mark.is-self { color: var(--cyan); }
:root[data-theme="light"] .note-signal-mark.is-opp { color: #506b13; }
:root[data-theme="light"] .note-signal-mark.is-mark-self { background: #d8eef1; }
:root[data-theme="light"] .note-signal-mark.is-mark-opp { background: #e7efce; }
:root[data-theme="light"] .note-signal-chip.is-role-self { border-color: var(--cyan); }
:root[data-theme="light"] .note-signal-chip.is-role-opp { border-color: #627d22; }
:root[data-theme="light"] .strategy-notes-sync-status { color: var(--muted); border-color: var(--line); }
:root[data-theme="light"] .strategy-notes-sync-status :is(strong, button) { color: var(--text); }
:root[data-theme="light"] .strategy-notes-sync-status [data-sync-last] { color: var(--muted); }
:root[data-theme="light"] .strategy-notes-sync-status:is([data-state="paused"], [data-state="failed"]) { background: #fff5df; border-color: #b39559; }
:root[data-theme="light"] .strategy-notes-sync-status:is([data-state="paused"], [data-state="failed"]) strong { color: var(--theme-warning); }

/* Shared Steam picker / match confirmation are themed only inside Replay Scope. */
:root[data-theme="light"] :is(.steam-picker-head h2, .steam-picker-result h2, .steam-picker-confirmation p) { color: var(--text); }
:root[data-theme="light"] :is(.steam-picker-info b, .steam-picker-count, .steam-picker-guide, .steam-picker-status, .steam-picker-meta > span, .steam-picker-name, .steam-picker-size, .steam-picker-foot, .steam-picker-result p, .vf-confirm-context, .vf-confirm-detected, .vf-confirm-help) { color: var(--muted); }
:root[data-theme="light"] :is(.steam-picker-actions button, .steam-picker-foot button, .steam-picker-entry, .steam-recording-picker .steam-picker-card, .vf-confirm-later) { background: var(--panel-soft); border-color: var(--line); color: var(--text); }
:root[data-theme="light"] .steam-recording-picker .steam-picker-card:hover:not(:disabled) { background: var(--cyan-deep); }
:root[data-theme="light"] :is(.steam-picker-card-action, .steam-picker-head p, .vf-confirm-video, .replay-confirmed) { color: var(--cyan); }
:root[data-theme="light"] .steam-picker-controls button { color: var(--text); border-color: var(--line-bright); }
:root[data-theme="light"] .steam-picker-controls .steam-picker-delete { color: var(--theme-danger); border-color: #c3919a; }
:root[data-theme="light"] .steam-picker-controls button:hover:not(:disabled) { background: #e1e9ec; }
:root[data-theme="light"] :is(.steam-picker-confirmation, .vf-confirm-error) { background: #fff0ee; color: var(--theme-danger); }
:root[data-theme="light"] :is(.steam-picker-result button, .vf-confirm-save) { background: var(--accent); color: var(--accent-fg); }
:root[data-theme="light"] .vf-confirm-open { background: var(--cyan-deep); color: var(--cyan); border-color: var(--cyan); }
:root[data-theme="light"] .steam-picker-count.is-capacity-updated { background-image: none; color: var(--cyan); }

/* Video wells and text badges over thumbnails keep their dark contrast. */
:root[data-theme="light"] :is(.match-viewer, .match-browser) { background: var(--panel); border-color: var(--line); }
:root[data-theme="light"] :is(.match-range, .match-characters, .match-ring-names, .keep-video, .match-time-group label, .match-metadata-editor label, .match-editor > span, .edit-match) { color: var(--muted); }
:root[data-theme="light"] .keep-video { background: var(--panel-soft); }
:root[data-theme="light"] :is(.keep-video-status.is-error, .match-outcome.is-loss) { color: var(--theme-danger); }
:root[data-theme="light"] .recording-reconnect-status { color: var(--cyan); }
:root[data-theme="light"] :is(.match-player-controls, .match-timeline, .match-timeline-track, .match-player-mute, .match-player-step, .match-player-speed, .match-player-speed button, .annotation-composer) { background: var(--panel-soft); border-color: var(--line); }
:root[data-theme="light"] :is(.match-player-step, .match-player-speed button) { color: var(--muted); }
:root[data-theme="light"] .match-player-speed button[aria-checked="true"] { background: var(--cyan-deep); color: var(--cyan); }
:root[data-theme="light"] :is(.match-player-controls > span, .match-timeline-summary, .match-timeline-axis, .match-timeline-labels, .match-timeline-empty, .keep-video-status, .perspective-once-note, .export-mode-dialog p, .export-priority-dialog p, .output-privacy-dialog p) { color: var(--muted); }
:root[data-theme="light"] .match-player-play { background: var(--accent); color: var(--accent-fg); }
:root[data-theme="light"] .match-timeline-labels > span:first-child { color: #176fa5; }
:root[data-theme="light"] .match-timeline-labels > span:last-child { color: #7251ad; }
:root[data-theme="light"] .match-timeline-marker.is-damage { background: #217cae; box-shadow: 0 0 0 1px #fff; }
:root[data-theme="light"] .match-timeline-marker.is-damage[data-attacker-side="right"] { background: #7857b5; }
:root[data-theme="light"] .match-timeline-marker.is-damage:hover { background: var(--text); }
:root[data-theme="light"] .match-timeline-marker.is-note { border-color: #fff; box-shadow: 0 0 0 2px var(--cyan); }
:root[data-theme="light"] :is(.perspective-choices button, .output-privacy-check, .export-mode-choices > button) { background: var(--panel-soft); color: var(--text); border-color: var(--line-bright); }
:root[data-theme="light"] .export-mode-choices > button:hover { background: var(--cyan-deep); }
:root[data-theme="light"] .export-mode-heading strong { color: var(--text); }
:root[data-theme="light"] .export-mode-recommended { background: var(--accent); color: var(--accent-fg); }
:root[data-theme="light"] .export-mode-choices small { color: var(--theme-warning); }
:root[data-theme="light"] .perspective-choices button:hover { background: var(--accent); color: var(--accent-fg); }
:root[data-theme="light"] .output-privacy-check:has(input:checked) { background: var(--cyan-deep); }
:root[data-theme="light"] :is(.video-frame, .match-viewer-video, .note-inline-video-wrap, .note-inline-video-wrap video) { background: #020304; color-scheme: dark; }
:root[data-theme="light"] .match-index-note { background: var(--accent); color: var(--accent-fg); }
:root[data-theme="light"] .match-index-status { background: rgba(8,10,12,.88); color: #ffe4a2; }

@media (max-width: 520px) {
  .replay-shell-actions { gap: 8px; }
}
