/* Warm plush night palette. Light mode and asset pixels retain their original colors. */
body:not(.theme-light) {
  color-scheme: dark;
  --mat-surface: #392f3b;
  --mat-surface-top: #453744;
  --mat-paper: #3c303c;
  --mat-field: #2d252f;
  --mat-line: #8c7285;
  --mat-line-soft: #625060;
  --mat-copy: #fff3e8;
  --mat-muted: #d3bdc8;
  --mat-accent: #b8d6c6;
  --mat-accent-soft: #34443e;
  --mat-shine: #ffefde12;
  --mat-shadow: 0 3px 6px #160f181c, 0 16px 38px #160f1838;
  --mat-card-shadow: 0 2px 4px #190f181f, 0 8px 20px #190f1824;
  --mat-focus-shadow: 0 0 0 3px #edb5cb2b;
  --mat-cta: linear-gradient(145deg, #f2b8c9, #e8c5ab);
  --mat-cta-copy: #493142;
  --mat-cta-line: #efc6cb;
  --mat-cta-shadow: 0 3px 0 #ad768c45, 0 7px 18px #160f1824;
  --glass-bg: #3c303aef;
  --glass-line: #c6a1b653;
  --glass-shine: #fff2df15;
  --glass-shadow: var(--mat-shadow);
  --polish-copy: var(--mat-copy);
  --polish-muted: var(--mat-muted);
  --polish-accent: #edbdce;
  --polish-field: var(--mat-field);
  --polish-soft: #554150;
  --polish-border: var(--mat-line);
  --ui-surface: var(--mat-surface);
  --ui-surface-raised: var(--mat-paper);
  --ui-field: var(--mat-field);
  --ui-border: var(--mat-line);
  --ui-border-soft: var(--mat-line-soft);
  --ui-copy: var(--mat-copy);
  --ui-muted: var(--mat-muted);
  --ui-faint: #c8b3bf;
  --ui-link: #f0bfd0;
  --ui-link-hover: #ffdfeb;
  --ui-tint: #34443e;
  --ui-tint-copy: #c2ddcf;
  --ui-tag: #503c4a;
  --ui-tag-copy: #e4ced9;
  --ui-success: #b8d6c6;
  --ui-warning: #ebcca0;
  --ui-checker-a: #3c373b;
  --ui-checker-b: #302c30;
  --ui-shadow: var(--mat-shadow);
  --ui-focus: #f2bbcf;
  --cat-coral: #ecc3a7;
  --cat-pink: #edb5cb;
  --cat-mint: #b8d6c6;
  --cat-violet: #c6b4dc;
  --cat-ink: #2a222d;
  --cat-panel: var(--mat-surface);
  --cat-panel-hi: var(--mat-surface-top);
  --cat-soft: var(--mat-muted);
  --bg: #2a222d;
  --panel: var(--mat-surface);
  --panel2: var(--mat-surface-top);
  --line: var(--mat-line-soft);
  --text: var(--mat-copy);
  --muted: var(--mat-muted);
  --accent: #edb5cb;
  --green: var(--mat-accent);
  --good: var(--mat-accent);
  --warn: var(--ui-warning);
  --danger: #f1b3bf;
  --shadow: var(--mat-shadow);
  color: var(--mat-copy);
  background-color: #3b2e3c;
  background-image: linear-gradient(180deg,#392d3ba3,#2a222d92 48%,#2a222db8),url('ui-assets/atelier-bg-night-v3.png');
  background-blend-mode: normal, luminosity;
}

/* Warm the decorative scene, never the actual cat or asset thumbnails. */
body:not(.theme-light) .hero-showcase {
  background-color: #57414e;
  background-image: linear-gradient(90deg,#312632f2 0%,#392d3ce8 38%,#67465060 73%,#79574418 100%),url('ui-assets/atelier-night-v1.png');
  background-blend-mode: normal, luminosity;
  border-color: #80677b;
}
body:not(.theme-light) .hero-showcase::before { background: linear-gradient(115deg,#f3c3cc00 25%,#e6abc10c 70%,#e5bf8d18); }
body:not(.theme-light) .hero-showcase::after { border-color: #efc6cf16; box-shadow: 0 0 0 34px #efc6cf05,0 0 0 68px #efc6cf03; }
body:not(.theme-light) :is(.brand-copy h1,.tool-brand h1,.project-brand h1,.showcase-copy h2,.showcase-mini-stats b) { color: var(--mat-copy); text-shadow: none; }
body:not(.theme-light) .showcase-copy h2 em { color: #f0bfd0; text-shadow: none; }
body:not(.theme-light) :is(.brand-mark,.tool-brand .brand-mark,.project-brand .brand-mark) { background: linear-gradient(145deg,#6d5061,#4a394a); border-color: #aa8298; box-shadow: inset 0 1px 0 #ffead62b,0 5px 14px #1b10192e; }
body:not(.theme-light) :is(.tool-brand p,.project-brand p,.cat-nav a,.showcase-link) { color: var(--mat-muted); }
body:not(.theme-light) .cat-nav :is(a:hover,.cat-nav-active) { color: #ffe8ec; border-color: #edb5cb; }
body:not(.theme-light) .eyebrow { color: #d0c5df; }
body:not(.theme-light) :is(.search-icon,.collection-mint .collection-icon) { color: var(--cat-mint); }
body:not(.theme-light) .collection-violet .collection-icon { color: #d0bee4; background: #cab5dc20; }
body:not(.theme-light) .collection-gold .collection-icon { color: #ecd0a9; background: #eccba720; }
body:not(.theme-light) .collection-card .collection-icon { border-radius: 12px; }
body:not(.theme-light) .art-sticker { background: #e9c4b1; color: #503841; box-shadow: 0 5px 14px #28182155; }
body:not(.theme-light) :is(.search-title kbd,.cat-note,.badge) { color: var(--mat-muted); background: #4c3949; border-color: var(--mat-line-soft); }
body:not(.theme-light) :is(.ghost,.button) { color: #edd4df; background: #4b3948; border-color: #96748a; }
body:not(.theme-light) :is(.ghost,.button):hover { background: #604556; border-color: #d1a0b9; }
body:not(.theme-light) .green { color: #d1e6da; background: #3b4c44; border-color: #789e8b; }
body:not(.theme-light) .companion-bubble { box-shadow: inset 0 1px 0 #ffe5d51c,0 6px 18px #24182130; }

/* Secondary pages use the same matte fabric palette, including their controls. */
body.cat-tool-page:not(.theme-light) :is(.tool-card h2,.panel h2,.panel h3,.section-title h2,.toolbar-title,.result-card b) { color: var(--mat-copy); }
body.cat-tool-page:not(.theme-light) :is(.tool-card p,.hint,.dim,.result-card small,.toolbar-summary,.footer,.processing-state) { color: var(--mat-muted); }
body.cat-tool-page:not(.theme-light) :is(.tool-state,.dropzone) { color: #c2ddcf; background: #35453f; border-color: #789e8b; }
body.cat-tool-page:not(.theme-light) .dropzone:hover { background: #41534a; border-color: #b8d6c6; }
body.cat-tool-page:not(.theme-light) :is(.empty,.queue-item,.qa-table th,.qa-table td,.section-title,.result-toolbar) { border-color: var(--mat-line-soft); }
body.cat-tool-page:not(.theme-light) :is(.empty,.check,.qa-table) { color: var(--mat-muted); }
body.cat-tool-page:not(.theme-light) :is(.qa-table th,.pass) { color: var(--mat-accent); }
body.cat-tool-page:not(.theme-light) .warn { color: var(--ui-warning); }
body.cat-tool-page:not(.theme-light) .fail { color: #f1b3bf; }
body.cat-tool-page:not(.theme-light) :is(.sprite-cell,.queue-item,.progress) { background: var(--mat-field); border-color: var(--mat-line); color: var(--mat-copy); }
body.cat-tool-page:not(.theme-light) .sprite-cell.selected { border-color: var(--mat-accent); box-shadow: 0 0 0 2px #b8d6c629; }
body.cat-tool-page:not(.theme-light) .progress i { background: linear-gradient(90deg,#c6b4dc,#b8d6c6); }
body.cat-tool-page:not(.theme-light) .processing-state.busy { color: var(--mat-accent); }
body.cat-tool-page:not(.theme-light) .processing-state.busy::before { background: var(--mat-accent); box-shadow: 0 0 0 4px #b8d6c622; }
body.cat-tool-page:not(.theme-light) .processing-state.idle::before { background: #a28b9c; }
body.cat-tool-page:not(.theme-light) .green:hover { background: #465c51; border-color: #b8d6c6; }
body.cat-project-page:not(.theme-light) .card b { color: var(--mat-copy); }
body.cat-project-page:not(.theme-light) .card span { color: var(--mat-muted); }
body.cat-project-page:not(.theme-light) :is(.card small,.card::after) { color: var(--mat-accent); }

/* Keep transparency inspection neutral; custom solid preview colors still win inline. */
body.cat-tool-page:not(.theme-light) :is(.sprite-preview,.anim-box,.sprite-cell img,.queue-item img,.result-card img),
body.cat-project-page:not(.theme-light) :is(.card img,.card .empty) {
  border-color: var(--mat-line-soft);
  background: repeating-conic-gradient(var(--ui-checker-a) 0 25%,var(--ui-checker-b) 0 50%) 50% / 22px 22px;
}
body:not(.theme-light) #imageViewer.image-viewer { background: #21172280; }
body:not(.theme-light) #imageViewer .viewer-dialog { background: var(--mat-surface); border-color: #b990aa66; box-shadow: 0 30px 90px #160f1966,inset 0 1px 0 #fff2df1c; }
body:not(.theme-light) #imageViewer .viewer-toolbar { background: linear-gradient(135deg,#4b3948,#3e303e); border-color: var(--mat-line-soft); }
body:not(.theme-light) #imageViewer .viewer-footer { background: #3a2d39; border-color: var(--mat-line-soft); }
body:not(.theme-light) #imageViewer .viewer-stage { background: repeating-conic-gradient(var(--ui-checker-a) 0 25%,var(--ui-checker-b) 0 50%) 50% / 24px 24px; }
body:not(.theme-light) #imageViewer :is(.viewer-controls button,.viewer-controls a,.viewer-close) { background: #4b3948; color: var(--mat-copy); border-color: var(--mat-line); }
body:not(.theme-light) #imageViewer :is(.viewer-controls button,.viewer-controls a,.viewer-close):hover { border-color: #efbfd2; }
body:not(.theme-light) #imageViewer .viewer-admin { background: #3b4c44 !important; color: #d1e6da !important; border-color: #789e8b !important; }
body:not(.theme-light) #imageViewer :is(.viewer-hint,.viewer-zoom) { color: var(--mat-muted); }
body:not(.theme-light) .admin-modal-backdrop { background: #211722b3; }
body:not(.theme-light) .admin-controls input[type=range] { accent-color: #bf9aad; }
body:not(.theme-light) :focus-visible { outline-color: #edb5cb; }
