/* Palette and theme toggle shared with Tinycut. Document pixels stay unchanged. */
:root {
  color-scheme:light;
  --theme-bg:#ffffff; --theme-panel:#fafbf7; --theme-raised:#f1f4ec;
  --theme-text:#24272b; --theme-muted:#65725b; --theme-border:#dce2d4;
  --theme-accent:#557438; --theme-selected:#e7f2d7;
}
.theme-toggle { flex:0 0 auto; width:32px; height:32px; color:var(--theme-muted); }
.theme-toggle:hover:not(:disabled) { background:var(--theme-raised); color:var(--theme-accent); }
@media(max-width:520px){.theme-toggle{width:26px;min-width:26px}}
:root[data-theme='dark'] {
  color-scheme:dark; color:var(--theme-text); background:var(--theme-bg);
  --green:#c5ee89; --line:#333b43; --muted:#a4afba; --panel:#20262e; --ink:#e4e9ef;
  --theme-bg:#1b2027; --theme-panel:#20262e; --theme-raised:#2b333d;
  --theme-text:#e4e9ef; --theme-muted:#abb6c2; --theme-border:#414c58;
  --theme-accent:#c5ee89; --theme-selected:#34462d;
}
:root[data-theme='dark'] body { background:var(--theme-bg); color:var(--theme-text); }
:root[data-theme='dark'] :is(.editor,.editor-top,.options-bar,.right-panel,.tools-panel) { background:var(--theme-bg); color:var(--theme-text); border-color:var(--line); }
:root[data-theme='dark'] :is(.document-tab,.canvas-footer,.layers-panel,.panel-footer) { background:var(--theme-panel); color:var(--theme-muted); border-color:var(--line); }
:root[data-theme='dark'] .viewport { background-color:#181e24; background-image:radial-gradient(#3c4752 .6px,transparent .6px); }
:root[data-theme='dark'] .ruler { background:#242d34ed; color:#a1b197; }
:root[data-theme='dark'] .document-wrap { background-color:#252b32; background-image:conic-gradient(#353e48 25%,transparent 0 50%,#353e48 0 75%,transparent 0); box-shadow:0 8px 38px #0005,0 0 0 1px #53616c55; }
:root[data-theme='dark'] .project-info input { color:var(--theme-text)!important; }
:root[data-theme='dark'] .project-info input:hover { border-color:var(--theme-border)!important; }
:root[data-theme='dark'] :is(h2,.section-heading h2,.welcome h1,.gradient-heading strong,.paint-panel-header h2,.help-grid strong) { color:var(--theme-text); }
:root[data-theme='dark'] :is(label,.local-label,.tool-name,.tool-options,.text-button,.icon-button,.tool-button,.hint,.subheading,.range-label,.range-label output,.layer-label small,.object-row .layer-label small,.object-kind>span,.empty-layers,.history-entry,.history-entry span,.document-tab #documentMeta,.zoom-controls button,.panel-tabs>button:not(.icon-button),.shape-paint-row,.context-paint,.context-group label>span:not(.sr-only):not(.mixed-marker),#selectionSummary,.paint-immediate-note,.gradient-more,.gradient-more summary,#gradientStopCount,.gradient-tip) { color:var(--theme-muted); }
:root[data-theme='dark'] :is(.button,.preset-row button,.format-presets button,.paint-button,.art-pencil) { background:var(--theme-raised); color:var(--theme-text); border-color:var(--theme-border); }
:root[data-theme='dark'] button:hover:not(:disabled) { background-color:#35404b; }
:root[data-theme='dark'] .button.primary { background:var(--green); color:#25321b; border-color:var(--green); }
:root[data-theme='dark'] .button.primary:hover:not(:disabled) { background:#b5e371; }
:root[data-theme='dark'] :is(.brand-icon,.show-panel,.recovery-icon) { color:#25321b; }
:root[data-theme='dark'] .show-panel { background:var(--green); }
:root[data-theme='dark'] .text-button:hover:not(:disabled) { background:transparent; color:var(--theme-accent); }
:root[data-theme='dark'] :is(input:not([type='range']):not([type='checkbox']):not([type='color']),select,textarea,.input-unit) { background:var(--theme-panel); color:var(--theme-text); border-color:var(--theme-border); }
:root[data-theme='dark'] .input-unit { color:var(--theme-muted); }
:root[data-theme='dark'] input::placeholder,:root[data-theme='dark'] textarea::placeholder { color:#95a2af; }
:root[data-theme='dark'] input[type='range'] { accent-color:#a4cd75; }
:root[data-theme='dark'] :is(.document-badges span,.count,kbd,.context-color .mixed-marker) { background:var(--theme-raised); color:var(--theme-muted); border-color:var(--theme-border); }
:root[data-theme='dark'] :is(.tool-button[aria-pressed='true'],.selection-toolbar .text-button[aria-pressed='true'],.history-entry.current,.format-presets button.selected,.paint-trigger[aria-expanded='true']) { background:var(--theme-selected); color:var(--green); border-color:#66834b; }
:root[data-theme='dark'] .panel-tabs>button.active { color:var(--theme-accent); border-bottom-color:#98bb74; }
:root[data-theme='dark'] :is(.utility-rail,.utility-popover) { background:var(--theme-panel); color:var(--theme-text); border-color:var(--line); }
:root[data-theme='dark'] :is(.sidebar-heading,.utility-popover-heading) { border-color:var(--line); }
:root[data-theme='dark'] .utility-rail .icon-button.active { background:var(--theme-selected); color:var(--green); box-shadow:inset 3px 0 #c5ee89; }
:root[data-theme='dark'] .layer-row { border-color:var(--line); }
:root[data-theme='dark'] .layer-row:hover { background:var(--theme-raised); }
:root[data-theme='dark'] .layer-row.selected { background:var(--theme-selected); box-shadow:inset 3px 0 #c5ee89; }
:root[data-theme='dark'] .layer-label strong { color:#deebcf; }
:root[data-theme='dark'] :is(.layer-thumb,.checker,.paint-swatch) { background-color:#252b32; background-image:conic-gradient(#353e48 25%,transparent 0 50%,#353e48 0 75%,transparent 0); border-color:var(--theme-border); }
:root[data-theme='dark'] .paint-swatch.mixed::before { background:#20262ed9; color:var(--theme-text); }
:root[data-theme='dark'] :is(.layers-list,.properties-scroll,.tool-options,.paint-panel,.context-menu) { scrollbar-color:#53616c transparent; }
:root[data-theme='dark'] .welcome { background:#181e24; }
:root[data-theme='dark'] :is(.welcome h1 span,.welcome>p,.eyebrow,.demo-button,.privacy-note,.format-presets small,.shortcut-list>span) { color:var(--theme-muted); }
:root[data-theme='dark'] .art-card.back { background:#34462d; border-color:#53644a; }
:root[data-theme='dark'] .drop-overlay { background:#253622ed; color:#deebcf; border-color:#9dbf78; }
:root[data-theme='dark'] .drop-overlay>span:last-child { color:#abbfa0; }
:root[data-theme='dark'] dialog { background:var(--theme-bg); color:var(--theme-text); border-color:var(--theme-border); box-shadow:0 20px 80px #0007; }
:root[data-theme='dark'] dialog::backdrop { background:#0d1116d9; }
:root[data-theme='dark'] dialog p { color:var(--theme-muted); }
:root[data-theme='dark'] .toast { background:#d8edbb; color:#213019; }
:root[data-theme='dark'] :is(.paint-panel,.paint-panel.paint-popover,.context-menu) { background:var(--theme-panel); color:var(--theme-text); border-color:var(--theme-border); box-shadow:0 8px 32px #0006; }
:root[data-theme='dark'] :is(.paint-modes,.paint-targets) { background:#171e25; }
:root[data-theme='dark'] :is(.paint-modes button,.paint-targets button) { color:var(--theme-muted); }
:root[data-theme='dark'] :is(.paint-modes button[aria-pressed='true'],.paint-targets button[aria-pressed='true']) { background:var(--theme-selected); color:var(--theme-accent); box-shadow:none; }
:root[data-theme='dark'] :is(.paint-preview,.gradient-track,.gradient-preset,.solid-color-preset) { border-color:#617154; }
:root[data-theme='dark'] .gradient-stop.selected { border-color:#c5ee89; box-shadow:0 0 0 2px #6e904b; }
:root[data-theme='dark'] .context-menu-title { color:var(--theme-muted); }
:root[data-theme='dark'] .context-menu-item { color:var(--theme-text); }
:root[data-theme='dark'] :is(.context-menu-icon,.context-menu-shortcut,.context-menu-arrow) { color:var(--theme-muted); }
:root[data-theme='dark'] :is(.context-menu-item:hover:not(:disabled),.context-menu-item:focus-visible) { background:var(--theme-selected); color:var(--theme-accent); }
:root[data-theme='dark'] .context-menu-divider { background:var(--theme-border); }
:root[data-theme='dark'] :is(.danger,.context-menu-item.danger) { color:#e9a69b; }
:root[data-theme='dark'] .danger:hover:not(:disabled) { background:#4b302e; color:#efac97; }
:root[data-theme='dark'] .context-menu-item.danger:hover:not(:disabled) { background:#4b302e; color:#efac97; }
:root[data-theme='dark'] :is(.font-picker,.font-picker-trigger){background:var(--theme-panel);color:var(--theme-text);border-color:var(--theme-border)}
:root[data-theme='dark'] .font-picker{box-shadow:0 8px 32px #0006}
:root[data-theme='dark'] :is(.font-picker-filters>span,.font-result-category){color:var(--theme-muted)}
:root[data-theme='dark'] .font-result{color:var(--theme-text)}
:root[data-theme='dark'] .font-result[aria-selected=true]{background:var(--theme-selected);box-shadow:inset 3px 0 #c5ee89}
:root[data-theme='dark'] .font-picker-results{scrollbar-color:#53616c transparent}

:root[data-theme='dark'] .group-row{background:var(--theme-panel);color:var(--theme-accent);border-color:var(--theme-border)}
:root[data-theme='dark'] .group-row.editing{background:var(--theme-selected)}
