/* Theme miniatures share the actual theme selectors; reset inherited user overrides. */
.cz-mini {
  --bg: #313338;
  --bg-2: #2b2d31;
  --bg-3: #383a40;
  --bg-4: #404249;
  --bg-input: #1e1f22;
  --bg-rail: #1e1f22;
  --bg-floating: #111214;
  --border: #232428;
  --border-strong: #3f4147;
  --text: #dbdee1;
  --text-bright: #f2f3f5;
  --muted: #949ba4;
  --muted-2: #80848e;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --accent-press: #3c45a5;
  --accent-soft: rgba(88, 101, 242, 0.15);
  --accent-2: #00a8fc;
  --shadow-sm: 0 1px 0 rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(4,4,5,0.55);
  --theme-gradient: none;
}
:is(body, .cz-mini).theme-ember {
  --bg: #291b1c;
  --bg-2: #211719;
  --bg-3: #332123;
  --bg-4: #3c2828;
  --bg-input: #211719;
  --bg-rail: #211719;
  --bg-floating: #291b1c;
  --text: #f4e5de;
  --text-bright: #f4e5de;
  --muted: #cdb6ad;
  --muted-2: #cdb6ad;
  --border: #332123;
  --border-strong: #cdb6ad66;
  --accent: #a6432d;
  --accent-hover: #a6432d;
  --accent-press: #a6432d;
  --accent-soft: #a6432d26;
  --accent-2: #f1b39b;
  --theme-gradient: linear-gradient(125deg, #34231c 0%, #2e1e26 52%, #20191e 100%);
}
:is(body, .cz-mini).theme-deepsea {
  --bg: #14262d;
  --bg-2: #102027;
  --bg-3: #1b3038;
  --bg-4: #233b43;
  --bg-input: #102027;
  --bg-rail: #102027;
  --bg-floating: #14262d;
  --text: #dfedf0;
  --text-bright: #dfedf0;
  --muted: #a8c6cb;
  --muted-2: #a8c6cb;
  --border: #1b3038;
  --border-strong: #a8c6cb66;
  --accent: #177c85;
  --accent-hover: #177c85;
  --accent-press: #177c85;
  --accent-soft: #177c8526;
  --accent-2: #83cdd0;
  --theme-gradient: linear-gradient(125deg, #123238 0%, #1a2939 52%, #122329 100%);
}
:is(body, .cz-mini).theme-moss {
  --bg: #23291e;
  --bg-2: #1b2119;
  --bg-3: #2c3425;
  --bg-4: #353e2c;
  --bg-input: #1b2119;
  --bg-rail: #1b2119;
  --bg-floating: #23291e;
  --text: #e8eddf;
  --text-bright: #e8eddf;
  --muted: #bec9ad;
  --muted-2: #bec9ad;
  --border: #2c3425;
  --border-strong: #bec9ad66;
  --accent: #527237;
  --accent-hover: #527237;
  --accent-press: #527237;
  --accent-soft: #52723726;
  --accent-2: #b9d499;
  --theme-gradient: linear-gradient(125deg, #303823 0%, #223026 52%, #2e3020 100%);
}
:is(body, .cz-mini).theme-wine {
  --bg: #2a1d29;
  --bg-2: #221822;
  --bg-3: #352533;
  --bg-4: #402c3b;
  --bg-input: #221822;
  --bg-rail: #221822;
  --bg-floating: #2a1d29;
  --text: #f2e3ed;
  --text-bright: #f2e3ed;
  --muted: #cfb5c7;
  --muted-2: #cfb5c7;
  --border: #352533;
  --border-strong: #cfb5c766;
  --accent: #a43e6a;
  --accent-hover: #a43e6a;
  --accent-press: #a43e6a;
  --accent-soft: #a43e6a26;
  --accent-2: #e4a8c4;
  --theme-gradient: linear-gradient(125deg, #382335 0%, #30202a 52%, #261f30 100%);
}
:is(body, .cz-mini).theme-dune {
  --bg: #f2ebdc;
  --bg-2: #e7dfcf;
  --bg-3: #e0d7c4;
  --bg-4: #d5cbb7;
  --bg-input: #e7dfcf;
  --bg-rail: #e7dfcf;
  --bg-floating: #f2ebdc;
  --text: #332e26;
  --text-bright: #332e26;
  --muted: #5c513f;
  --muted-2: #5c513f;
  --border: #e0d7c4;
  --border-strong: #5c513f66;
  --accent: #94602b;
  --accent-hover: #94602b;
  --accent-press: #94602b;
  --accent-soft: #94602b26;
  --accent-2: #704a20;
  --theme-gradient: linear-gradient(125deg, #f4e8d6 0%, #e5e5d3 52%, #f0dfd5 100%);
}
:is(body, .cz-mini).theme-tide {
  --bg: #182b28;
  --bg-2: #142320;
  --bg-3: #213831;
  --bg-4: #294139;
  --bg-input: #142320;
  --bg-rail: #142320;
  --bg-floating: #182b28;
  --text: #e2f0e8;
  --text-bright: #e2f0e8;
  --muted: #b1cdc0;
  --muted-2: #b1cdc0;
  --border: #213831;
  --border-strong: #b1cdc066;
  --accent: #287d63;
  --accent-hover: #287d63;
  --accent-press: #287d63;
  --accent-soft: #287d6326;
  --accent-2: #91d7b5;
  --theme-gradient: linear-gradient(125deg, #203b2d 0%, #173432 52%, #26392c 100%);
}
/* One stationary layer: no animated paint, attachment scrolling, or backdrop filter. */
body.gradient-theme { isolation:isolate; }
body.gradient-theme::before { content:''; position:fixed; inset:0; z-index:-1; pointer-events:none; background:var(--theme-gradient); }
body.gradient-theme :is(.app,.app-layout) { background:transparent; }
body.gradient-theme :is(.main,.sidebar,.server-rail,.settings-content,.settings-sidebar) { background:color-mix(in srgb,var(--bg) 76%,transparent); }
.cz-section { border:0; padding-top:0; margin-top:20px; }
.cz-section > summary,.cz-advanced > summary { min-height:44px; cursor:pointer; padding:10px 0; }
.cz-row { grid-template-columns:minmax(120px,1fr) minmax(0,340px); min-height:44px; }
.cz-row input[type=color] { border-radius:8px; }
.cz-theme-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; }
.cz-theme-picker h4 { margin:14px 0 10px; font-size:13px; color:var(--muted); }
.cz-theme-choice { display:flex; flex-direction:column; gap:7px; padding:0 0 5px; min-width:0; color:var(--text); background:transparent; border:0; border-radius:8px; font-size:12px; text-align:left; }
.cz-theme-choice > span:last-child { padding-inline:5px; }
.cz-theme-choice[aria-checked=true] { outline:2px solid var(--accent); outline-offset:3px; }
.cz-theme-choice:focus-visible { outline:2px solid var(--text-bright); outline-offset:3px; }
.cz-mini { display:grid; grid-template-columns:12% 25% 1fr; width:100%; height:65px; overflow:hidden; border-radius:6px; background:var(--theme-gradient),var(--bg); color:var(--text); }
.cz-mini-rail { background:color-mix(in srgb,var(--bg-rail) 80%,transparent); }
.cz-mini-side { padding:12px 4px; background:color-mix(in srgb,var(--bg-2) 76%,transparent); }
.cz-mini i { display:block; height:3px; margin-bottom:7px; background:var(--muted); border-radius:1px; }
.cz-mini-side i:first-child { background:var(--accent); }
.cz-mini-chat { padding:14px 8px 6px; background:color-mix(in srgb,var(--bg) 65%,transparent); }
.cz-mini-chat i:nth-child(2) { width:70%; }
.cz-mini-composer { display:block; height:10px; margin-top:12px; background:var(--bg-input); border-radius:3px; }
.cz-preview { display:grid; grid-template-columns:24px minmax(65px,18%) minmax(0,1fr); padding:0; border:0; overflow:hidden; background:var(--theme-gradient,var(--bg)); }
.cz-sample-rail { padding:12px 5px; background:color-mix(in srgb,var(--bg-rail) 80%,transparent); color:var(--accent-2); }
.cz-sample-side { padding:14px 8px; background:color-mix(in srgb,var(--bg-2) 76%,transparent); font-size:12px; overflow-wrap:anywhere; }
.cz-sample-chat { min-width:0; padding:12px; background:color-mix(in srgb,var(--bg) 76%,transparent); }
.cz-sample-message.msg { display:flex; gap:9px; padding:var(--cz-spacing,7px) 0; }
.cz-sample-message .avatar { width:var(--cz-avatar,28px); height:var(--cz-avatar,28px); flex:none; background:var(--bg-4); color:var(--text); font-size:12px; }
.cz-sample-message .body { min-width:0; }
.cz-sample-message strong { font-size:13px; }
.cz-sample-message p { font-size:14px; margin:3px 0 0; }
.cz-sample-message blockquote { margin:5px 0; padding-left:8px; border-left:2px solid var(--accent); color:var(--muted); font-size:12px; }
.cz-sample-composer { display:flex; justify-content:space-between; align-items:center; gap:8px; background:var(--bg-input); padding:8px 10px; margin-top:10px; border-radius:var(--radius); color:var(--muted); font-size:12px; }
.cz-sample-send { padding:2px 8px; background:var(--accent); color:white; border-radius:6px; }
.cz-sample-link,.cz-sample-reactions { margin:6px 0 0 37px; font-size:12px; color:var(--accent-2); }
body[data-cz-links=false] .cz-sample-link,body[data-cz-reactions=false] .cz-sample-reactions { display:none; }
body[data-cz-density=compact] .cz-preview .cz-sample-message { padding:2px 0; }
body[data-cz-density=bubbles] .cz-preview .body { padding:8px; background:var(--bg-2); border-radius:var(--radius); }
body[data-cz-sidebar] .cz-preview { grid-template-columns:24px minmax(65px,calc(var(--cz-sidebar) * .42)) minmax(0,1fr); }
body[data-cz-rail] .cz-preview { grid-template-columns:calc(var(--cz-rail) * .4) minmax(65px,18%) minmax(0,1fr); }
@media(max-width:800px) {
 .cz-theme-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
 .cz-row { grid-template-columns:1fr; }
 .cz-row:has(input[type=checkbox]) { grid-template-columns:1fr auto; }
 .cz-row input[type=range],.cz-row:has(input[type=checkbox]) label { min-height:44px; }
 .cz-preview { grid-template-columns:16px 52px minmax(0,1fr); }
 .cz-sample-chat { padding:8px; }
 .cz-sample-side { font-size:10px; padding:10px 5px; }
 .cz-sample-message .avatar { width:24px; height:24px; }
 .cz-sample-message small { margin-left:5px; font-size:10px; }
 .cz-tools > * { max-width:100%; }
}
.cz-sample-chat { position:relative; isolation:isolate; }
body:not([data-cz-wallpaper=none]) .cz-sample-chat::before { content:''; position:absolute; inset:0; z-index:-1; pointer-events:none; background-position:center; background-size:cover; opacity:calc(1 - var(--cz-dim)); filter:blur(var(--cz-blur)); }
body[data-cz-wallpaper=dots] .cz-sample-chat::before { background-image:radial-gradient(var(--text) 1px,transparent 1px); background-size:18px 18px; }
body[data-cz-wallpaper=grid] .cz-sample-chat::before { background-image:linear-gradient(var(--muted) 1px,transparent 1px),linear-gradient(90deg,var(--muted) 1px,transparent 1px); background-size:28px 28px; }
body[data-cz-wallpaper=image] .cz-sample-chat::before { background-image:var(--cz-image); }
.cz-preview .cz-sample-message { animation:none; }
.cz-preview.cz-motion-demo .cz-sample-message { animation:panel-in var(--dur-ui) var(--ease-out); }
body.reduce-motion .cz-preview.cz-motion-demo .cz-sample-message { animation:none; }
@media(prefers-reduced-motion:reduce) { .cz-preview.cz-motion-demo .cz-sample-message { animation:none; } }

body.gradient-theme .settings-fullscreen { background:var(--theme-gradient); }
/* Filled actions use --accent/white; text accents use the legible companion token. */
body.gradient-theme :is(.link-preview .lp-title,.pinned-bar .pin-bar-author,.fm-vol-val.hot,.call-more-menu .fm-on,.send-failed-note .retry-send,.upload-pct,.density-preview .dp-mention,.msg .text .role-mention,.attach-preview .reply-chip .reply-ping-toggle,.hd-actions .icon-btn.accent,.mobile-tab.active,.ac-slash) { color:var(--accent-2); }
body.gradient-theme .msg .text .mention { color:var(--accent-2); background:var(--bg-3); }
body.gradient-theme .msg .text .mention:hover,
body.gradient-theme .attach-preview .reply-chip .reply-ping-toggle:hover { background:var(--accent); color:white; }
body.theme-dune { --warn:#795515; --danger:#ac2830; --ok:#32633e; }
.cz-theme-grid:last-child { grid-template-columns:repeat(3,minmax(0,1fr)); }
.cz-status { margin:8px 0; }
@media(max-width:800px) {
 .cz-sample-side { font-size:0; }
 .cz-sample-side::after { content:''; display:block; height:4px; margin-top:7px; background:var(--muted); box-shadow:0 12px var(--bg-4),0 24px var(--bg-4); }
}
