/* Additive day mode for the Studio entry/editor only. Native nesting keeps the
   boundary explicit; no artwork, canvas, footage or animation colors change. */
html[data-ui-theme="light"] body:has(.editor-workspace):not(.is-landing):not(.product-app) {
  color-scheme: light;
  --ui-bg: #f7f7f5; --ui-canvas: #f0f0ee; --ui-surface: #fff; --ui-raised: #f3f3f5;
  --ui-hover: #ececf0; --ui-border: #dddfe5; --ui-divider: #ececf0;
  --ui-text: #25252c; --ui-secondary: #555762; --ui-muted: #70737f; --ui-disabled: #9698a2;
  --ui-accent: #756294; --ui-primary: #29292f; --ui-primary-hover: #42424b;
  --ui-primary-border: #29292f; --ui-primary-fill: #29292f; --ui-primary-hover-fill: #42424b;
  --ui-on-primary: #fff; --ui-selected: #f0edf7; --ui-selected-border: #b7a8cf;
  --ui-focus: #8b76b3; --ui-scrollbar: #c8c9d0;
  --panel: var(--ui-surface); --studio-bg: var(--ui-bg); --studio-surface: var(--ui-surface);
  --studio-raised: var(--ui-raised); --studio-border: var(--ui-divider);
  --studio-text: var(--ui-text); --studio-muted: var(--ui-muted); --studio-accent: var(--ui-accent);
  --bg: var(--ui-bg); --surface: var(--ui-surface); --raised: var(--ui-raised);
  --border: var(--ui-border); --line: var(--ui-divider); --text: var(--ui-text); --ink: var(--ui-text);
  --muted: var(--ui-muted); --accent: var(--ui-accent); --purple: var(--ui-accent);
  --clay: var(--ui-primary); --clay-hover: var(--ui-primary-hover); --clay-soft: var(--ui-selected);
  background: var(--ui-bg); color: var(--ui-text); accent-color: var(--ui-accent);

  :is(.app-shell, .editor-workspace) { background: var(--ui-bg) !important; }
  .topbar { background: #fbfbfa !important; border-color: var(--ui-border) !important; }
  :is(.brand, .brand-wordmark, .brand-wordmark > span) { color: var(--ui-text) !important; }
  .brand-symbol { stroke: var(--ui-text) !important; }
  .topbar .project-title { border-color: var(--ui-border); }
  #edit-project-name { color: var(--ui-text); }
  #edit-project-name:hover { background: var(--ui-raised); border-color: var(--ui-border); }
  #edit-project-name:focus { background: var(--ui-surface); border-color: var(--ui-focus); }
  :is(.project-save-status, .edit-project-resume, .brand-tag, .brand small, .entry-workspace-link,
      .entry-subtitle, .entry-eyebrow, .generation-hint, .entry-project-row small,
      .smart-launch p, .ratio-label, .time-display span) { color: var(--ui-muted) !important; }
  :is(.project-save-status[data-phase="error"], .mobile-pair-error) { color: #ac3c43 !important; }
  :is(.entry-workspace-link, .edit-project-resume):hover { color: var(--ui-text) !important; }
  :is(.entry-intro h1, .entry-intro h1 span, .panel-header h2, .ai-panel-heading h2,
      .timeline-heading h2, .time-display, .entry-project-row, #entry-projects) { color: var(--ui-text) !important; }
  :is(.entry-project-row, .entry-preferences-bar, .ai-panel-heading, .smart-preferences-heading,
      #smart-preferences-dialog > footer, .resource-filter, .resource-kind-tabs) { border-color: var(--ui-divider) !important; }

  /* Charcoal actions, quiet secondary controls, lavender only for selection. */
  :is(.button.accent, .jelly-control.jelly-primary, #export-button, #generate-button,
      .clip-selection-primary, .clip-content-apply, .clip-fx-primary):not(:disabled):not([aria-disabled="true"]) {
    background: var(--ui-primary) !important; border-color: var(--ui-primary-border) !important;
    color: var(--ui-on-primary) !important; box-shadow: none !important; text-shadow: none !important;
  }
  :is(.button.accent, .jelly-control.jelly-primary, #export-button, #generate-button,
      .clip-selection-primary, .clip-content-apply, .clip-fx-primary):hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--ui-primary-hover) !important; border-color: var(--ui-primary-hover) !important;
  }
  .button.secondary:not(:disabled) {
    background: var(--ui-surface) !important; border-color: var(--ui-border) !important;
    color: var(--ui-text) !important; box-shadow: none !important;
  }
  :is(.button, #generate-button, .clip-selection-primary):disabled {
    background: var(--ui-raised) !important; color: var(--ui-disabled) !important;
    border-color: var(--ui-border) !important; box-shadow: none !important;
  }
  :is(.compact-icon-button, .icon-button, .track-tool, .text-button, .quiet-button,
      .entry-attach, #entry-preferences-open, .voice-button, #app-menu > summary,
      .edit-settings > summary, .remove-media, .resource-mg-footer button) {
    color: var(--ui-secondary) !important;
  }
  :is(.compact-icon-button, .icon-button, .track-tool, .text-button, .quiet-button,
      .entry-attach, #entry-preferences-open, .voice-button, #app-menu > summary):not(:disabled) {
    background: transparent !important;
  }
  :is(.button.secondary, .compact-icon-button, .icon-button, .track-tool, .text-button,
      .quiet-button, .entry-attach, #entry-preferences-open, .voice-button,
      #app-menu > summary):hover:not(:disabled) {
    background: var(--ui-hover) !important; color: var(--ui-text) !important;
  }
  :is(.compact-icon-button, .icon-button, .track-tool, .text-button, .voice-button,
      #clip-effects-open):disabled { color: var(--ui-disabled) !important; }
  :is(button, a, summary, input, textarea, select, [tabindex]):focus-visible {
    outline-color: var(--ui-focus) !important;
  }
  :is(input, textarea, select) { color-scheme: light; }
  :is(input[type="checkbox"], input[type="radio"], input[type="range"]) { accent-color: var(--ui-accent) !important; }
  ::selection { background: #e2d9f0; color: var(--ui-text); }
  ::-webkit-scrollbar-thumb { background: var(--ui-scrollbar); }
  :is(.edit-messages, .media-list, .timeline-scroll, .mg-resource-grid,
      .resource-sound-list, .clip-content-scroll) { scrollbar-color: var(--ui-scrollbar) transparent; }
  .app-language-toggle { background: var(--ui-raised) !important; border-color: var(--ui-border) !important; }
  .app-language-toggle .app-language-option { color: var(--ui-muted) !important; }
  .app-language-toggle .app-language-thumb { background: var(--ui-text) !important; }
  :is(.app-language-toggle[data-locale="zh"] [data-lang="zh"],
      .app-language-toggle[data-locale="en"] [data-lang="en"]) { color: #fff !important; }

  /* Shared entry/editor composer and conversation. */
  .creation-bar { background: transparent !important; }
  .edit-form { background: var(--ui-surface) !important; border-color: var(--ui-border) !important; box-shadow: 0 8px 30px #25252c05 !important; }
  .edit-form:focus-within { border-color: var(--ui-selected-border) !important; box-shadow: 0 0 0 3px #9a83bd12 !important; }
  #edit-instruction { color: var(--ui-text) !important; }
  #edit-instruction::placeholder { color: var(--ui-muted) !important; }
  :is(.edit-message.user, .edit-message.user .edit-message-text, .entry-bubble.user) {
    background: var(--ui-raised) !important; color: var(--ui-text) !important; border-color: var(--ui-border) !important;
  }
  :is(.edit-message.assistant, .edit-message.assistant .edit-message-text,
      .entry-answer, .entry-bubble.ai) { color: var(--ui-secondary) !important; }
  .edit-message.assistant .edit-message-text { background: transparent !important; }
  :is(.entry-answer, .entry-bubble.ai, .chart-review) { background: var(--ui-surface); border-color: var(--ui-border); }
  :is(.edit-context, .entry-image, .music-asset, .smart-effect-choice) {
    background: var(--ui-raised) !important; border-color: var(--ui-border) !important; color: var(--ui-secondary) !important;
  }
  :is(.smart-edit-settings, .smart-effects-card) { border-color: var(--ui-divider) !important; }
  .smart-effect-choice:has(input:checked) { background: var(--ui-selected) !important; border-color: var(--ui-selected-border) !important; }
  :is(.smart-effect-choice span, .smart-effects-heading label, .smart-edit-settings summary,
      .smart-effects-options summary, .smart-edit-body label, .smart-edit-body p,
      .chart-review summary, .smart-result-summary) { color: var(--ui-secondary) !important; }
  :is(.smart-effects-summary, .smart-effects-level, .smart-effects-options > p,
      .smart-effects-options > small, .smart-preferences-heading p,
      #smart-preferences-dialog > footer span, .music-asset small) { color: var(--ui-muted) !important; }
  #smart-effects-enabled { background: #d6d7de !important; border-color: #d6d7de !important; }
  #smart-effects-enabled::after { background: #fff !important; }
  #smart-effects-enabled:checked { background: var(--ui-text) !important; border-color: var(--ui-text) !important; }
  #smart-effects-enabled:checked::after { background: #fff !important; }
  .voice-button.is-recording { background: #fcebed !important; color: #ac3c43 !important; }
  .entry-dragging .edit-form { border-color: var(--ui-focus) !important; box-shadow: 0 0 0 4px #9a83bd18 !important; }

  /* Panels remain neutral so the preview retains its own visual identity. */
  .editor-workspace > :is(.sidebar, .resource-panel, .timeline-panel) {
    background: var(--ui-surface) !important; border-color: var(--ui-border) !important;
  }
  .editor-workspace > .preview-panel { background: var(--ui-canvas) !important; border-color: var(--ui-border) !important; }
  :is(.panel-header, .player-bar, .timeline-heading, .track-headers, .track-label-ruler,
      .timeline-ruler, .resource-panel-header, .resource-sound-footer, .resource-mg-footer,
      .workspace-mobile-nav) { background: var(--ui-surface) !important; border-color: var(--ui-divider) !important; }
  :is(.workspace-view-controls, #preview-tag, .resource-search, .clip-selection-bar,
      .track-inspector, .clip-content-panel) { background: var(--ui-surface) !important; border-color: var(--ui-border) !important; color: var(--ui-secondary); }
  :is(.workspace-view-toggle, .resource-tabs [role="tab"], .resource-kind-tabs [role="tab"]) { color: var(--ui-muted) !important; }
  :is(.workspace-view-toggle[aria-pressed="true"], .compact-icon-button[aria-pressed="true"]) {
    background: var(--ui-selected) !important; border-color: var(--ui-selected-border) !important; color: var(--ui-text) !important;
  }
  :is(.resource-tabs, .resource-kind-tabs) [aria-selected="true"] { color: var(--ui-text) !important; }
  :is(.resource-tabs, .resource-kind-tabs) [aria-selected="true"]::after { background: var(--ui-accent) !important; }
  :is(.media-card, .media-select) { background: var(--ui-surface) !important; border-color: var(--ui-border) !important; }
  .media-card.is-active .media-select { background: var(--ui-selected) !important; border-color: var(--ui-selected-border) !important; }
  :is(.media-select small, .mg-card-label, .sound-resource-row, .music-library-track small,
      .music-library-row-actions a, .music-library-row-actions button) { color: var(--ui-secondary) !important; }
  .insert-media { background: var(--ui-surface) !important; color: var(--ui-text) !important; border-color: var(--ui-border) !important; }
  :is(.sound-resource-row, .music-library-row, .resource-sound-categories button, .music-library-groups button) {
    background: var(--ui-raised); border-color: var(--ui-border); color: var(--ui-secondary);
  }
  :is(.sound-resource-row, .music-library-row):hover { background: var(--ui-hover); }
  :is(.resource-sound-categories button, .music-library-groups button)[aria-pressed="true"] {
    background: var(--ui-selected); border-color: var(--ui-selected-border); color: var(--ui-text);
  }
  :is(.music-library-license, .music-library-empty, .music-library-heading [data-count],
      .mobile-pair-empty) { color: var(--ui-muted); }
  .music-play-symbol { background: #e2ebe6; color: #365e4b; }
  .music-library-wave { fill: #8a9c93; }
  .music-library-preview[aria-pressed="true"] .music-library-wave { fill: #4c775f; }
  .connection-dot { background: #a7a9b2 !important; }
  .is-connected .connection-dot { background: #658c76 !important; }

  /* Timeline tints are UI labels, never the rendered caption/MG artwork. */
  :is(.track-label, .track-label-ruler, .timeline-tick) { color: var(--ui-muted); border-color: var(--ui-divider); }
  .timeline-tick { border-color: #d9dae1; }
  .timeline-tick.major { border-color: #b5b7c2; }
  :is(.layer-lane, .track-lane) { border-color: var(--ui-divider); }
  .timeline-panel .empty-track { border-color: var(--ui-border); color: var(--ui-muted); }
  .timeline-panel :is(.timeline-clip, .layer-clip) { background: #e7edf2; border-color: #c2cfdb; color: #3e566c; }
  .timeline-panel .timeline-clip small { color: #3e566c; }
  .timeline-panel .layer-clip.kind-captions { background: #e5eef5; border-color: #bacddd; color: #38566d; }
  .timeline-panel :is(.kind-motions, .kind-graphics, .kind-focus, .kind-transitions) {
    background: #eee7f5 !important; border-color: #ccbfdb !important; color: #604f78 !important;
  }
  .timeline-panel .kind-sounds { background: #e3eee7 !important; border-color: #b8d0c2 !important; color: #416452 !important; }
  .timeline-panel .kind-charts { background: #f4eddf; border-color: #d8c9aa; color: #756341; }
  .timeline-panel :is(.timeline-clip.is-selected, .layer-clip.is-selected) { border-color: #827093 !important; box-shadow: inset 0 0 0 1px #82709333; }
  .track-label i { background: #7891aa !important; }
  .track-label.lane-captions i { background: #86a6c0 !important; }
  .track-label.lane-graphics i { background: #a28bb9 !important; }
  .track-label.lane-sounds i { background: #82a58e !important; }
  :is(.workspace-timeline-resize, .workspace-column-resize) { background: var(--ui-bg) !important; border-color: var(--ui-border) !important; }
  :is(.timeline-resize-grip, .workspace-column-resize > span, .workspace-timeline-resize span) { background: #bdc0c9 !important; border-color: #aeb2bd !important; }
  .workspace-column-resize::before { background: var(--ui-focus); }
  .workspace-column-resize::after { background: var(--ui-text); color: #fff; box-shadow: 0 5px 20px #25252c18; }
  :is(#clip-effects-open, #selection-full-source, .clip-selection-actions button) {
    background: transparent !important; color: var(--ui-secondary) !important; border-color: var(--ui-border) !important;
  }
  :is(#clip-effects-open, #selection-full-source, .clip-selection-actions button):hover:not(:disabled) { background: var(--ui-hover) !important; color: var(--ui-text) !important; }
  .clip-selection-actions button[aria-pressed="true"] { background: var(--ui-selected) !important; border-color: var(--ui-selected-border) !important; }
  :is(.clip-selection-range > label, .clip-selection-summary, #selection-source-summary) { color: var(--ui-muted); border-color: var(--ui-border); }
  :is(.clip-selection-number, .clip-selection-source select) { background: var(--ui-surface); border-color: var(--ui-border); color: var(--ui-text); }
  .clip-selection-number:focus-within { outline-color: var(--ui-focus); }
  .clip-selection-number input { color: var(--ui-text); }
  #timeline-playhead { background: #565061; box-shadow: 0 0 0 1px #ffffff88; }
  #timeline-playhead::before { background: #565061; }
  #timeline-playhead:is(:hover, :focus-visible, .is-scrubbing),
  #timeline-playhead:is(:hover, :focus-visible, .is-scrubbing)::before { background: #756294; }
  .timeline-playhead-time { background: var(--ui-surface); color: var(--ui-text); border-color: var(--ui-selected-border); }
  #timeline-selection { background: #9c85c01c; border-color: var(--ui-focus); }
  .timeline-selection-handle::before { background: var(--ui-focus); border-color: var(--ui-selected-border); box-shadow: 0 1px 3px #25252c18; }
  .timeline-selection-handle::after { background: #fff; }
  .player-bar input[type="range"] { background: var(--ui-border); }
  .player-bar input::-webkit-slider-thumb { background: var(--ui-secondary); }
  .player-bar input::-moz-range-thumb { background: var(--ui-secondary); }

  /* Menus, settings and content tools share the same light surface system. */
  :is(dialog, .menu-dropdown, .edit-settings-body) {
    color-scheme: light; background: var(--ui-surface) !important; color: var(--ui-text) !important;
    border-color: var(--ui-border) !important; box-shadow: 0 24px 80px #25252c22 !important;
  }
  dialog::backdrop { background: #34323d55 !important; }
  dialog :is(h2, h3) { color: var(--ui-text); }
  .menu-dropdown .menu-item { color: var(--ui-text) !important; }
  .menu-dropdown .menu-item:hover:not(:disabled) { background: var(--ui-raised) !important; }
  :is(dialog, .smart-edit-body, .smart-effects-level, .edit-settings-body, .track-inspector,
      .music-library-panel, .resource-mg-footer) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea),
  .resource-search input {
    background: var(--ui-raised) !important; border-color: var(--ui-border) !important; color: var(--ui-text) !important;
  }
  :is(input, textarea)::placeholder { color: var(--ui-muted); }
  .resource-search input { background: transparent !important; }
  :is(.clip-content-target, .clip-content-modes button, .clip-content-project-import,
      .clip-content-library-heading button, .clip-content-media-card, .clip-content-source-range label,
      .clip-content-preview-button, .clip-content-effects button, .clip-content-cost-badge,
      .clip-content-status:not(.is-error), .clip-project-icon, .clip-project-footer,
      .clip-project-dialog button, .clip-content-preview > header button) {
    background: var(--ui-raised) !important; border-color: var(--ui-border) !important; color: var(--ui-secondary) !important;
  }
  :is(.clip-content-modes button, .clip-content-media-card)[aria-pressed="true"] {
    background: var(--ui-selected) !important; border-color: var(--ui-selected-border) !important; color: var(--ui-text) !important;
  }
  .clip-content-source-range input { background: transparent !important; color: var(--ui-text); }
  :is(.clip-content-modes .editor-icon, .clip-content-target small, .clip-content-media-origin,
      .clip-content-empty, .clip-content-loading, .clip-content-section-title > span,
      .clip-content-result-info > p, .clip-content-audio, .clip-content-effects small,
      .clip-content-compare figcaption, .clip-content-preview > p, .clip-project-meta,
      .clip-project-status, .clip-project-eyebrow, .clip-project-empty span) { color: var(--ui-muted) !important; }
  :is(.clip-content-source, .clip-content-result, .clip-content-effects, .clip-project-header,
      .clip-project-row, .clip-project-empty, .clip-content-preview figure) { border-color: var(--ui-border) !important; }
  :is(.clip-content-preview figure, .clip-project-dialog article) { background: var(--ui-surface) !important; }
  :is(.clip-project-info strong, .clip-content-compare figcaption strong) { color: var(--ui-text); }
  .clip-project-version { color: var(--ui-secondary) !important; background: var(--ui-raised); }
  .clip-project-version.is-stale { color: #886726 !important; background: #faf0d9; }
  :is(.clip-content-status.is-error, .clip-project-error, .toast.error) {
    background: #fceff0 !important; border-color: #edc8cc !important; color: #a33c47 !important;
  }
  :is(.clip-content-result-info > p.is-error, .clip-content-source-range input[aria-invalid="true"]) { color: #a33c47 !important; }
  :is(.toast:not(.error), .import-queue-status, .billing-balance, .billing-trial-shortcut, .mobile-pair-devices li) {
    background: var(--ui-surface) !important; color: var(--ui-secondary) !important; border-color: var(--ui-border) !important;
    box-shadow: 0 6px 24px #25252c12;
  }
  .file-drop-overlay { background: #f5f4f1d9; }
  .file-drop-card { background: var(--ui-surface); border-color: var(--ui-focus); box-shadow: 0 24px 70px #25252c16; }

  /* The effects modal owns its tokens; source/comparison players stay intact. */
  dialog.clip-effects-panel {
    --fx-bg: #fff; --fx-surface: #f5f5f7; --fx-raised: #efebf5; --fx-border: #dddfe5;
    --fx-text: #25252c; --fx-secondary: #555762; --fx-muted: #70737f;
  }
  .clip-effects-panel button:not(:disabled):hover { color: var(--ui-text); border-color: var(--ui-selected-border); }
  .clip-effects-panel :is(.clip-fx-template-card[aria-pressed="true"], .clip-fx-intents button[aria-pressed="true"]) {
    background: var(--ui-selected); color: var(--ui-text); border-color: var(--ui-selected-border);
  }
  .clip-fx-intents { background: var(--ui-raised); }
  :is(.clip-fx-template-art, .clip-fx-cost-note small) { color: var(--ui-secondary); }
  :is(.clip-fx-cost-note, .clip-fx-notice.is-unavailable) { border-color: var(--ui-border); color: var(--ui-secondary); }
  .clip-fx-notice a { color: var(--ui-accent); }
  .clip-fx-error { border-color: #edc8cc; color: #a33c47; background: #fceff0; }
  .clip-fx-error-text { color: #a33c47 !important; }
  .clip-effects-panel [data-range-note].clip-fx-error-text { border-color: #c76b76; }
  .clip-effects-panel .clip-fx-range input { background: transparent !important; border: 0 !important; }

  @media (forced-colors: active) {
    :is(button, a, input, textarea, select, summary) { forced-color-adjust: auto; }
    :is(.compact-icon-button, .workspace-view-toggle, .track-tool) { color: ButtonText !important; }
    :is(.compact-icon-button, .workspace-view-toggle)[aria-pressed="true"] { border-color: Highlight !important; }
    #timeline-playhead, #timeline-playhead::before { background: Highlight !important; }
  }
}
