/* Appearance is a surface treatment: artwork, player geometry and animation
   remain owned by their existing stylesheets. Loaded after the page styles. */
:root {
  color-scheme: light;
  /* Shared with the full-page IPTV and torrent workspaces. These inherit the
     library's appearance choice, including dialogs mounted under body. */
  --media-color-scheme: light;
  --media-bg: var(--paper);
  --media-panel: #f8f8fa;
  --media-surface: var(--surface);
  --media-raised: #f0f0f4;
  --media-hover: #eeeef2;
  --media-input: #ffffff;
  --media-line: var(--line);
  --media-border-strong: #cccbd2;
  --media-text: var(--ink);
  --media-muted: var(--muted);
  --media-faint: #707078;
  --media-accent: #c91839;
  --media-accent-soft: #ffe6eb;
  --media-accent-border: #e9a1b0;
  --media-primary: linear-gradient(112deg, #d31635, #e21c39);
  --media-primary-hover: linear-gradient(112deg, #bd1732, #cf1434);
  --media-on-primary: #ffffff;
  --media-focus: #d31635;
  --media-success: #237744;
  --media-success-soft: #e7f3eb;
  --media-warning: #8a560b;
  --media-warning-soft: #fff1d9;
  --media-error: #b4233f;
  --media-error-soft: #ffe9ee;
  --media-backdrop: #1b12208c;
  --media-shadow: var(--shadow-float);
  --media-artwork: radial-gradient(ellipse at 72% 20%, #fff8fa 0, transparent 48%), linear-gradient(145deg, #f7dfe6, #eaddec 56%, #dce1f0);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f2f2f5;
  --muted: #b0b0b9;
  --line: #38383f;
  --paper: #171719;
  --surface: #232326;
  --shadow: 0 18px 50px #0000002b;
  --shadow-float: 0 25px 70px #00000066;
  --theme-raised: #2c2c30;
  --theme-hover: #34343a;
  --theme-accent: #ff7188;
  --theme-accent-soft: #43252d;
  --theme-accent-border: #74404d;
  --media-color-scheme: dark;
  --media-panel: #1e1e21;
  --media-raised: var(--theme-raised);
  --media-hover: var(--theme-hover);
  --media-input: var(--theme-raised);
  --media-border-strong: #53535d;
  --media-faint: #a0a0ab;
  --media-accent: #ff93a4;
  --media-accent-soft: var(--theme-accent-soft);
  --media-accent-border: var(--theme-accent-border);
  --media-focus: #ff91a7;
  --media-success: #8ed5b2;
  --media-success-soft: #24392e;
  --media-warning: #f0d49f;
  --media-warning-soft: #3d3324;
  --media-error: #ff9eaf;
  --media-error-soft: #492831;
  --media-backdrop: #060608bf;
  --media-artwork: linear-gradient(145deg, #3b2b35, #302e3c 58%, #2a3340);
}

/* This preference is device-local, so it remains available before signing in. */
.appearance-setting { min-width: 0; margin: 22px 0 0; padding: 0; border: 0; }
.appearance-setting > legend { margin: 0 0 14px; padding: 0; color: var(--ink); font-size: 14px; font-weight: 650; }
.appearance-setting > h3 { margin: 0 0 7px; font-size: 16px; }
.appearance-setting > .muted { margin: 13px 0 0; font-size: 12px; line-height: 1.55; }
.appearance-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.appearance-options label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.appearance-options label:hover { border-color: #c78a97; }
.appearance-options label[data-selected="true"] { border-color: #de526b; box-shadow: inset 0 0 0 1px #de526b; }
.appearance-options input[type="radio"] { flex: none; width: 16px; height: 16px; margin: 1px 0 0; accent-color: #e42b49; }
.appearance-options label > span { display: grid; min-width: 0; gap: 5px; }
.appearance-option-title { display: block; color: var(--ink); font-size: 13px; font-weight: 650; line-height: 1.35; }
.appearance-option-note { display: block; color: var(--muted); font-size: 11px; line-height: 1.45; }
.appearance-options input:checked + span .appearance-option-title { color: #c51f3f; }
.appearance-options input:focus-visible { outline: 2px solid #d83e5a; outline-offset: 3px; }
@media (max-width: 560px) {
  .appearance-options { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .appearance-options label { padding: 12px; }
  .appearance-options label > span { gap: 3px; }
}
@media (min-width: 850px) {
  body.tv-mode .appearance-options label { min-height: 90px; padding: 17px; gap: 12px; }
  body.tv-mode .appearance-option-title { font-size: 17px; }
  body.tv-mode .appearance-option-note { font-size: 14px; }
  body.tv-mode .appearance-options input[type="radio"] { width: 21px; height: 21px; }
}

/* Navigation and the main page. No filters are applied to images. */
:root[data-theme="dark"] body.authenticated { --paper: #171719; }
:root[data-theme="dark"] .sidebar { background: #1e1e21; border-color: var(--line); }
:root[data-theme="dark"] .topbar { background: #1e1e21ed; border-color: var(--line); }
:root[data-theme="dark"] .sidebar-rule { background: var(--line); }
:root[data-theme="dark"] .breadcrumb,
:root[data-theme="dark"] .nav-item,
:root[data-theme="dark"] .settings-tab,
:root[data-theme="dark"] .mobile-bottom-nav button,
:root[data-theme="dark"] .filter-chip,
:root[data-theme="dark"] .sort-button { color: var(--muted); }
:root[data-theme="dark"] .breadcrumb span { color: #73737e; }
:root[data-theme="dark"] .breadcrumb b { color: var(--ink); }
:root[data-theme="dark"] .nav-label,
:root[data-theme="dark"] .page:not(.youtube-page) .eyebrow,
:root[data-theme="dark"] .login-panel .eyebrow { color: #b0a3ac; }
:root[data-theme="dark"] .nav-item:hover,
:root[data-theme="dark"] .settings-tab:hover { background: var(--theme-hover); color: var(--ink); }
:root[data-theme="dark"] .nav-item.active,
:root[data-theme="dark"] .mobile-bottom-nav button.active,
:root[data-theme="dark"] .settings-tab.active { background: var(--theme-accent-soft); color: #ff93a4; }
:root[data-theme="dark"] #main-view .settings-tab.active { box-shadow: inset 0 0 0 1px #74404d; }
:root[data-theme="dark"] .nav-icon,
:root[data-theme="dark"] .nav-item.active .nav-icon { color: var(--theme-accent); }
:root[data-theme="dark"] .avatar,
:root[data-theme="dark"] .top-avatar { background: #492731; color: #ffb2c0; }
:root[data-theme="dark"] .search-box { border-color: #414148; background: var(--theme-raised); color: var(--muted); }
:root[data-theme="dark"] .search-box kbd { border-color: #4b4b54; color: #b6b6c0; }
:root[data-theme="dark"] .search-box input::placeholder { color: #a6a6b0; }
:root[data-theme="dark"] .search-box:focus-within { border-color: #d9657a; box-shadow: 0 0 0 3px #ff71881c; }
:root[data-theme="dark"] .sidebar .icon-button,
:root[data-theme="dark"] .topbar .icon-button { color: var(--muted); }
:root[data-theme="dark"] .sidebar .icon-button:hover,
:root[data-theme="dark"] .topbar .icon-button:hover { background: var(--theme-hover); color: var(--ink); }
:root[data-theme="dark"] .mobile-bottom-nav { background: #202024f2; border-color: #414148; }
:root[data-theme="dark"] .site-footer { color: #a0a0ab; }
:root[data-theme="dark"] .site-footer i { color: #8c8c98; }
:root[data-theme="dark"] #main-view .settings-nav { border-color: var(--line); scrollbar-color: #595960 transparent; }
:root[data-theme="dark"] #main-view .settings-nav::-webkit-scrollbar-thumb { background: #595960; }

/* Landing cards, empty states and local library. */
:root[data-theme="dark"] .collection-card,
:root[data-theme="dark"] .playlist-card,
:root[data-theme="dark"] .video-category-card,
:root[data-theme="dark"] .video-episode-card,
:root[data-theme="dark"] .video-category-admin-card { background: var(--surface); border-color: var(--line); color: var(--ink); }
:root[data-theme="dark"] .collection-card { box-shadow: 0 12px 32px #00000026, inset 0 1px 0 #ffffff05; }
:root[data-theme="dark"] .collection-card:hover { box-shadow: 0 22px 45px #00000040, inset 0 1px 0 #ffffff08; }
:root[data-theme="dark"] .collection-info p,
:root[data-theme="dark"] .item-card p,
:root[data-theme="dark"] .music-detail-count,
:root[data-theme="dark"] .music-detail-track-meta small,
:root[data-theme="dark"] .music-detail-track-duration,
:root[data-theme="dark"] .music-detail-track-number,
:root[data-theme="dark"] .video-category-card-meta small,
:root[data-theme="dark"] .video-category-admin-meta small,
:root[data-theme="dark"] .video-episode-copy small,
:root[data-theme="dark"] .video-episode-duration,
:root[data-theme="dark"] .video-season-chip small { color: var(--muted); }
:root[data-theme="dark"] .round-arrow,
:root[data-theme="dark"] .collection-card:hover .round-arrow,
:root[data-theme="dark"] .playlist-card-icon:not(.has-cover),
:root[data-theme="dark"] .video-category-icon,
:root[data-theme="dark"] .video-series-art,
:root[data-theme="dark"] .video-episode-art { background: #352931; border-color: #4b3942; color: #f191a5; }
:root[data-theme="dark"] .playlist-card-arrow,
:root[data-theme="dark"] .video-category-arrow { color: var(--theme-accent); }
:root[data-theme="dark"] .item-cover { background-color: #333239; box-shadow: 0 8px 24px #00000029; }
:root[data-theme="dark"] .cover-placeholder { background: linear-gradient(145deg, #3b2b35, #302e3c 58%, #2a3340); color: #d0a5bc; }
:root[data-theme="dark"] #films-grid .cover-placeholder,
:root[data-theme="dark"] .folder-card .cover-placeholder { color: #c4b0cf; }
:root[data-theme="dark"] .folder-card .item-cover { background: linear-gradient(135deg, #3c303e, #303644); }
:root[data-theme="dark"] .empty-mark,
:root[data-theme="dark"] #main-view .empty-state[data-state="loading"] .empty-mark { background: #352831; color: #ee9bad; }
:root[data-theme="dark"] #main-view .empty-state[data-state="error"] .empty-mark { background: #492831; color: #ffb0bf; }
:root[data-theme="dark"] .empty-state.compact { background: #212124; border-color: #515159; }
:root[data-theme="dark"] #main-view .empty-state p { color: var(--muted); }
:root[data-theme="dark"] .count-badge { background: var(--theme-accent-soft); color: #ffacbc; }
:root[data-theme="dark"] .filter-chip.active { color: #ff91a4; }
:root[data-theme="dark"] .music-detail-hero,
:root[data-theme="dark"] .video-series-hero { background: linear-gradient(125deg, #2d2730, #24242b 65%, #30262b); border-color: #424047; }
:root[data-theme="dark"] .music-detail-copy .eyebrow { color: #d0a3b5; }
:root[data-theme="dark"] .music-detail-track,
:root[data-theme="dark"] .music-track-shell-row,
:root[data-theme="dark"] #main-view .playlist-view .music-detail-tracks > :is(.music-track-shell-row, .playlist-track-row) { border-top-color: var(--line); }
:root[data-theme="dark"] .music-detail-track:hover,
:root[data-theme="dark"] .music-detail-track:focus-visible,
:root[data-theme="dark"] .video-episode-card:hover { background: var(--theme-hover); }
:root[data-theme="dark"] #main-view .playlist-view .playlist-track-row .music-detail-track-meta small,
:root[data-theme="dark"] #main-view .playlist-view .playlist-track-row .music-detail-track-duration,
:root[data-theme="dark"] #main-view .playlist-view .music-track-shell-row > .music-track-more { color: var(--muted); }
:root[data-theme="dark"] #main-view .playlist-view .music-track-shell-row > .music-track-more:hover,
:root[data-theme="dark"] #main-view .playlist-view .music-track-shell-row > .music-track-more:focus-visible { background: var(--theme-hover); color: var(--ink); }
:root[data-theme="dark"] .video-season-chip { background: var(--surface); border-color: #4d4751; color: var(--ink); }
:root[data-theme="dark"] .video-season-chip[aria-pressed="true"] { background: #57313d; border-color: #a65b70; color: #fff; }
:root[data-theme="dark"] .video-season-chip[aria-pressed="true"] small { color: #f5ccd7; }
:root[data-theme="dark"] .offline-plan-item { background: #24392e; color: #bce0c9; }
:root[data-theme="dark"] .offline-plan-item.downloading,
:root[data-theme="dark"] .offline-plan-item.pending { background: #3d3324; color: #f0d49f; }
:root[data-theme="dark"] .offline-plan-item.error { background: #492b2c; color: #ffb8b8; }

/* Settings, account and source management. */
:root[data-theme="dark"] .settings-panel,
:root[data-theme="dark"] #main-view .settings-panel,
:root[data-theme="dark"] .account-card,
:root[data-theme="dark"] .library-row,
:root[data-theme="dark"] .managed-account,
:root[data-theme="dark"] .account-form { background: var(--surface); border-color: var(--line); }
:root[data-theme="dark"] .account-management,
:root[data-theme="dark"] .preference-row,
:root[data-theme="dark"] .source-files,
:root[data-theme="dark"] .addon-card,
:root[data-theme="dark"] .video-category-admin { border-color: var(--line); }
:root[data-theme="dark"] .settings-note { background: #35272d; color: #ed9eaf; }
:root[data-theme="dark"] #main-view .settings-section > .muted,
:root[data-theme="dark"] #main-view .settings-note p,
:root[data-theme="dark"] #main-view .account-card p,
:root[data-theme="dark"] #main-view .account-source-toggle-meta small,
:root[data-theme="dark"] #main-view .library-row small,
:root[data-theme="dark"] #main-view .addon-card-details small,
:root[data-theme="dark"] #main-view .addon-card-details p,
:root[data-theme="dark"] #main-view .music-offline-status,
:root[data-theme="dark"] .managed-account-head small,
:root[data-theme="dark"] .access-options > small,
:root[data-theme="dark"] .source-files #source-files-status,
:root[data-theme="dark"] .account-source-path,
:root[data-theme="dark"] .source-file-row small,
:root[data-theme="dark"] .mac-folder-status { color: var(--muted); }
:root[data-theme="dark"] .settings-note > span,
:root[data-theme="dark"] .settings-note a,
:root[data-theme="dark"] .page:not(.youtube-page) .text-button,
:root[data-theme="dark"] dialog .text-button,
:root[data-theme="dark"] .music-detail-back,
:root[data-theme="dark"] .access-options > strong,
:root[data-theme="dark"] #main-view .account-source-group > strong,
:root[data-theme="dark"] #main-view .library-source-group h3,
:root[data-theme="dark"] .source-files-breadcrumbs button,
:root[data-theme="dark"] .source-files-progress-head button,
:root[data-theme="dark"] .account-source-folder.back,
:root[data-theme="dark"] .tv-server-link,
:root[data-theme="dark"] .share-result { color: var(--theme-accent); }
:root[data-theme="dark"] .library-icon,
:root[data-theme="dark"] .extension-symbol,
:root[data-theme="dark"] .addon-card-icon,
:root[data-theme="dark"] .dialog-icon,
:root[data-theme="dark"] .track-mark,
:root[data-theme="dark"] .source-file-icon { background: #402b35; color: #f6a2b5; }
:root[data-theme="dark"] .account-source-group,
:root[data-theme="dark"] .video-category-form,
:root[data-theme="dark"] .source-files-progress { background: #29262c; border-color: var(--line); }
:root[data-theme="dark"] .account-source-choice,
:root[data-theme="dark"] .account-source-toggle,
:root[data-theme="dark"] .source-files-chip,
:root[data-theme="dark"] .mac-folder-location,
:root[data-theme="dark"] .video-category-source-option,
:root[data-theme="dark"] .video-category-types label { background: var(--theme-raised); border-color: #45434b; color: var(--ink); }
:root[data-theme="dark"] .source-files-chip.active,
:root[data-theme="dark"] .mac-folder-location.active { background: var(--theme-accent-soft); border-color: #a8586b; color: #ffb1c0; }
:root[data-theme="dark"] .source-files-chip-open { color: var(--ink); }
:root[data-theme="dark"] .source-files-chip-remove { color: #f799ad; border-color: var(--line); }
:root[data-theme="dark"] .source-files-list,
:root[data-theme="dark"] .account-source-list,
:root[data-theme="dark"] .access-option,
:root[data-theme="dark"] .video-category-form fieldset,
:root[data-theme="dark"] .extension-card,
:root[data-theme="dark"] .tv-server-link,
:root[data-theme="dark"] .share-result { border-color: #45434b; }
:root[data-theme="dark"] .source-file-row,
:root[data-theme="dark"] .account-source-folder { border-bottom-color: var(--line); }
:root[data-theme="dark"] .account-source-folder { background: transparent; color: var(--ink); }
:root[data-theme="dark"] .source-file-folder:hover,
:root[data-theme="dark"] .source-file-folder:focus-visible,
:root[data-theme="dark"] .account-source-folder:hover { background: var(--theme-hover); }
:root[data-theme="dark"] .source-files-breadcrumbs button:disabled { color: var(--muted); }
:root[data-theme="dark"] .account-fields label,
:root[data-theme="dark"] .source-files-label { color: #d0cbd2; }
:root[data-theme="dark"] .account-fields input,
:root[data-theme="dark"] .account-fields select,
:root[data-theme="dark"] .source-files select,
:root[data-theme="dark"] .account-source-dialog select,
:root[data-theme="dark"] .video-category-form input[name="name"],
:root[data-theme="dark"] .youtube-destination-dialog select,
:root[data-theme="dark"] #external-vlc-buffer { background: var(--theme-raised); border-color: #53515a; color: var(--ink); }
:root[data-theme="dark"] .managed-account-confirm { background: #38262d; border-color: #855060; }
:root[data-theme="dark"] .managed-account-confirm p,
:root[data-theme="dark"] .managed-account-confirm label { color: #f4c9d3; }
:root[data-theme="dark"] .managed-account-confirm input { background: #2b2228; border-color: #986274; color: var(--ink); }
:root[data-theme="dark"] .managed-account-remove { color: #ff9bb0; border-color: #885364; }
:root[data-theme="dark"] .coming-badge { background: #33372e; color: #c0ceb0; }
:root[data-theme="dark"] .account-source-switch,
:root[data-theme="dark"] .transfer-sftp-switch-track { background: #66616c; }
:root[data-theme="dark"] .appearance-options input:checked + span .appearance-option-title { color: #ff9aac; }

/* Buttons on light pages gain dark surfaces. Existing white playback controls
   and the already-dark online player keep their current appearance. */
:root[data-theme="dark"] .page:not(.youtube-page) .button-outline,
:root[data-theme="dark"] .login-panel .button-outline,
:root[data-theme="dark"] dialog .button-outline { background: var(--theme-raised); border-color: #5c414b; color: #ff9cb0; }
:root[data-theme="dark"] .page:not(.youtube-page) .button-outline:hover,
:root[data-theme="dark"] .login-panel .button-outline:hover,
:root[data-theme="dark"] dialog .button-outline:hover { background: #443039; }
:root[data-theme="dark"] .track-action,
:root[data-theme="dark"] .account-source-choice button { background: #4a2b36; color: #ffb1c2; }
:root[data-theme="dark"] .track-action:hover { background: #603747; }

/* Transfer queues and download management are the same layout in both themes. */
:root[data-theme="dark"] .transfer-pane,
:root[data-theme="dark"] .transfer-queue,
:root[data-theme="dark"] .transfer-sftp,
:root[data-theme="dark"] .download-service-card,
:root[data-theme="dark"] .download-help,
:root[data-theme="dark"] .download-torrent-row,
:root[data-theme="dark"] .youtube-music-tool { background: var(--theme-raised); border-color: #46434b; color: var(--ink); box-shadow: 0 7px 20px #0000001a; }
:root[data-theme="dark"] .transfer-local-drop,
:root[data-theme="dark"] .transfer-queue-row { background: #242327; border-color: #51444c; }
:root[data-theme="dark"] .transfer-local-drop.drag-over { background: #3d2932; border-color: #e96b85; }
:root[data-theme="dark"] .transfer-local-folder { color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] .transfer-local-folder:hover { background: var(--theme-hover); }
:root[data-theme="dark"] .transfer-local-breadcrumbs button,
:root[data-theme="dark"] .transfer-step { color: #f28ea6; }
:root[data-theme="dark"] .transfer-local-breadcrumbs button:disabled,
:root[data-theme="dark"] #main-view .transfer-pane-copy,
:root[data-theme="dark"] #main-view .transfer-queue-hint,
:root[data-theme="dark"] #main-view .transfer-file-details small,
:root[data-theme="dark"] .transfer-queue-details small,
:root[data-theme="dark"] .transfer-empty,
:root[data-theme="dark"] .transfer-more,
:root[data-theme="dark"] .transfer-sftp-addresses span,
:root[data-theme="dark"] .download-service-card small,
:root[data-theme="dark"] .download-service-card em,
:root[data-theme="dark"] .download-service-arrow,
:root[data-theme="dark"] .download-help p,
:root[data-theme="dark"] .download-torrent-row span { color: var(--muted); }
:root[data-theme="dark"] .download-help summary { color: #d7c5d1; }
:root[data-theme="dark"] .transfer-pane-symbol,
:root[data-theme="dark"] .transfer-file-icon,
:root[data-theme="dark"] .download-service-icon { background: #422b36; color: #f5a2ba; }
:root[data-theme="dark"] .transfer-file-row,
:root[data-theme="dark"] .transfer-download-destination { border-color: var(--line); }
:root[data-theme="dark"] .transfer-file-remove,
:root[data-theme="dark"] .source-file-download,
:root[data-theme="dark"] .transfer-queue-action,
:root[data-theme="dark"] .source-file-delete,
:root[data-theme="dark"] .transfer-sftp-addresses > div,
:root[data-theme="dark"] .transfer-sftp-uri { background: #242327; border-color: #51444c; color: #f8b0c0; }
:root[data-theme="dark"] .transfer-sftp-addresses strong,
:root[data-theme="dark"] .transfer-sftp-uri code { color: var(--ink); }
:root[data-theme="dark"] .transfer-file-remove:hover,
:root[data-theme="dark"] .source-file-download:hover,
:root[data-theme="dark"] .transfer-queue-action:hover,
:root[data-theme="dark"] .source-file-delete:hover { background: #443039; }
:root[data-theme="dark"] .transfer-queue-row.is-failed { border-color: #b86678; }
:root[data-theme="dark"] .transfer-queue-row.is-done { background: #243329; border-color: #3b5645; }
:root[data-theme="dark"] .download-service-card em.online { color: #8ed5b2; }
:root[data-theme="dark"] .download-service-card:hover,
:root[data-theme="dark"] .download-service-card:focus-visible { border-color: #b57287; box-shadow: 0 13px 28px #00000040; }
:root[data-theme="dark"] .download-tool-panel:not([hidden]),
:root[data-theme="dark"] .download-tool-head { background: var(--surface); border-color: var(--line); }

/* The online browsing area is already dark. Only the home entry and dialogs
   outside it need new surfaces; no override targets .youtube-page's contents. */
:root[data-theme="dark"] .youtube-home-entry { background: linear-gradient(110deg, #34272f, #27262e); border-color: #55404a; color: var(--ink); }
:root[data-theme="dark"] .youtube-home-entry small { color: var(--muted); }
:root[data-theme="dark"] .youtube-home-arrow { color: var(--theme-accent); }
:root[data-theme="dark"] .youtube-music-heading h3 { color: var(--ink); }
:root[data-theme="dark"] .youtube-music-tool .youtube-preview-form > label { color: #d0cbd2; }
:root[data-theme="dark"] .youtube-music-tool .youtube-search-row input { background: #242327; border-color: #53515a; color: var(--ink); }
:root[data-theme="dark"] .youtube-music-tool .youtube-preview-card:not([hidden]) { background: #242327; border-color: var(--line); }
:root[data-theme="dark"] .youtube-music-tool .youtube-preview-info strong { color: var(--ink); }
:root[data-theme="dark"] .youtube-music-tool .youtube-preview-info span,
:root[data-theme="dark"] .youtube-music-tool .youtube-preview-info small { color: var(--muted); }
:root[data-theme="dark"] .youtube-music-tool .youtube-download-progress:not([hidden]) { background: #38262f; border-color: #68505d; color: var(--ink); }
:root[data-theme="dark"] .youtube-audio-badge { background: #3e2932; border-color: #68404f; color: #ffafc2; }

/* App-owned dialogs, including the legacy inline-styled video chooser. */
:root[data-theme="dark"] .music-collection-dialog,
:root[data-theme="dark"] .confirm-dialog,
:root[data-theme="dark"] .account-source-dialog,
:root[data-theme="dark"] .music-track-menu,
:root[data-theme="dark"] .youtube-destination-dialog { background: #29292d; border-color: #4c4850; color: var(--ink); box-shadow: 0 34px 110px #00000070; }
:root[data-theme="dark"] #external-player-dialog { background: #29292d; color: var(--ink); border-color: #4c4850; }
:root[data-theme="dark"] #external-player-dialog > form { background: #29292d !important; color: var(--ink) !important; }
:root[data-theme="dark"] .music-collection-dialog::backdrop,
:root[data-theme="dark"] .confirm-dialog::backdrop,
:root[data-theme="dark"] .account-source-dialog::backdrop,
:root[data-theme="dark"] .music-track-menu::backdrop,
:root[data-theme="dark"] .youtube-destination-dialog::backdrop,
:root[data-theme="dark"] #external-player-dialog::backdrop { background: #060608bf; }
:root[data-theme="dark"] .music-collection-dialog .dialog-close,
:root[data-theme="dark"] .account-source-close { background: #414148; color: #e6dde7; }
:root[data-theme="dark"] .music-collection-dialog .eyebrow { color: #f39eb2; }
:root[data-theme="dark"] .music-track-row { border-color: var(--line); }
:root[data-theme="dark"] .track-meta small,
:root[data-theme="dark"] .music-track-menu p:not(.eyebrow) { color: var(--muted); }
:root[data-theme="dark"] .youtube-destination-dialog label { color: #ddd3dd; }
:root[data-theme="dark"] .youtube-destination-dialog #youtube-destination-help.youtube-destination-warning { background: #453322; border-color: #a67b48; color: #ffe0b2; }

/* Sign-in uses the same neutral page surface without altering its illustration. */
:root[data-theme="dark"] .login-view { background: #1b1b1e; }
:root[data-theme="dark"] .login-form input { background: #2b2b30; border-color: #4a4a53; color: var(--ink); }
:root[data-theme="dark"] .login-form input::placeholder { color: #a6a6b0; }
:root[data-theme="dark"] .login-copy h1 em { color: #ff8ba1; }
:root[data-theme="dark"] .form-error,
:root[data-theme="dark"] .source-files #source-files-status.error { color: #ff9eaf; }
:root[data-theme="dark"] .welcome-orbit { background: linear-gradient(145deg, #452a33, #352a32); box-shadow: inset 0 1px 0 #ffffff09, 0 12px 28px #00000026; }
:root[data-theme="dark"] .welcome-orbit:before { border-color: #7c4756; }
:root[data-theme="dark"] .welcome-orbit:after { border-color: #633844; }
:root[data-theme="dark"] .welcome-orbit span { color: #ff9eb2; }

/* Keyboard and remote focus stay clearly visible on dark page surfaces. */
:root[data-theme="dark"] body:not(.tv-mode) #main-view :is(button, a, input, select, textarea):focus-visible { outline-color: #ff91a7; }
:root[data-theme="dark"] body.tv-mode .page-content :is(button, a, input, select, [role="button"], [tabindex="0"]):focus-visible { outline-color: #ff7892; box-shadow: 0 0 0 9px #202024, 0 0 0 14px #ff7892b3; }
