/* The html marker is shared; each application keeps its own palette and layout. */
html[data-zh-theme="light"] { color-scheme: light; }
html[data-zh-theme="dark"] { color-scheme: dark; }

/* Codex · quiet green. */
html[data-zh-app="codex"][data-zh-theme="dark"] body { background:#151b18; color:#e1e9e0; }
html[data-zh-app="codex"][data-zh-theme="dark"] aside { background:#1d2620; border-color:#344238; }
html[data-zh-app="codex"][data-zh-theme="dark"] button { background:#253128; color:#d1dfcd; border-color:#40513f; }
html[data-zh-app="codex"][data-zh-theme="dark"] button:hover { background:#314232; }
html[data-zh-app="codex"][data-zh-theme="dark"] nav button { background:transparent; }
html[data-zh-app="codex"][data-zh-theme="dark"] nav button.active { background:#334132; box-shadow:0 5px 20px #0002; }
html[data-zh-app="codex"][data-zh-theme="dark"] header { border-color:#303d33; }
html[data-zh-app="codex"][data-zh-theme="dark"] :is(.brand span,.muted,h5,nav small,.aside-bottom small,header small,.eyebrow,.welcome p,.speaker,.compose-bottom span,footer>small,dialog p) { color:#a0af98; }
html[data-zh-app="codex"][data-zh-theme="dark"] .orb { background:#31432d; color:#c2d8b5; }
html[data-zh-app="codex"][data-zh-theme="dark"] .suggestions button { background:transparent; }
html[data-zh-app="codex"][data-zh-theme="dark"] .bubble { background:#202b23; border-color:#344238; }
html[data-zh-app="codex"][data-zh-theme="dark"] .user { background:#30402e; }
html[data-zh-app="codex"][data-zh-theme="dark"] #chat { background:#202b23; border-color:#42533e; box-shadow:0 8px 35px #0002; }
html[data-zh-app="codex"][data-zh-theme="dark"] #input { color:#e1e9e0; }
html[data-zh-app="codex"][data-zh-theme="dark"] #input::placeholder { color:#91a089; }
html[data-zh-app="codex"][data-zh-theme="dark"] :is(#send,.actions button:last-child) { background:#97ba86; color:#162315; }
html[data-zh-app="codex"][data-zh-theme="dark"] dialog { color:#e1e9e0; background:#1d2720; border-color:#41533e; box-shadow:0 20px 80px #0007; }
html[data-zh-app="codex"][data-zh-theme="dark"] dialog::backdrop { background:#07150eaa; }
html[data-zh-app="codex"][data-zh-theme="dark"] :is(label input,label textarea) { background:#151e18; color:#e1e9e0; border-color:#42513f; }
html[data-zh-app="codex"][data-zh-theme="dark"] #error { color:#f0a593; }

/* Qwen and AutoClaw already use the data-theme alias maintained by the script. */
html[data-zh-app="qwen"][data-zh-theme="dark"] {
  --bg:#0f0e17; --surface:#171623; --surface-2:#1c1b2a; --surface-3:#232233;
  --line:#2c2a3f; --line-strong:#3a3752; --text:#eceaf6; --text-2:#b3aecb; --text-3:#a29bbd;
  --brand:#a291ff; --brand-2:#8caeff; --brand-ink:#0f0e17;
}
html[data-zh-app="autoclaw"][data-zh-theme="dark"] {
  --bg:#141519; --panel:#1d1f25; --panel-2:#22242c; --border:#2d3038; --border-strong:#3c404b;
  --text:#e9e6df; --muted:#b0aba0; --accent:#e08770; --accent-hover:#f29c84; --accent-weak:#35261f;
  --user-bubble:#8c4634; --user-text:#fff3ee;
}

/* WorkBuddy · blue and violet, in both appearances. */
html[data-zh-app="workbuddy"][data-zh-theme="light"] {
  --bg:#f6f7fc; --bg-soft:#eef1f9; --bg-panel:#fff; --bg-hover:#e6eafa;
  --border:#d8deee; --text:#252b40; --text-dim:#59647c; --text-faint:#6b7590;
  --accent:#4b64cb; --accent-2:#8051c5; --accent-grad:linear-gradient(135deg,#516bd4,#8755cb);
  --danger:#b53a50; --shadow:0 8px 32px #28344f1c;
}
html[data-zh-app="workbuddy"][data-zh-theme="dark"] {
  --bg:#0e1116; --bg-soft:#151a22; --bg-panel:#1a212c; --bg-hover:#222b38;
  --border:#344052; --text:#e8edf4; --text-dim:#a8b5c7; --text-faint:#96a4b8;
  --accent:#8ba5ff; --accent-2:#b18bff; --accent-grad:linear-gradient(135deg,#637fdf,#9263d4);
  --danger:#ff8a97; --shadow:0 8px 32px #0007;
}
html[data-zh-app="workbuddy"][data-zh-theme="light"] .chat-header { background:#f6f7fceF; }
html[data-zh-app="workbuddy"][data-zh-theme="dark"] .chat-header { background:#0e1116ed; }
html[data-zh-app="workbuddy"] .msg.user .msg-bubble { color:#fff; }
html[data-zh-app="workbuddy"] :is(input,textarea)::placeholder { color:var(--text-faint); opacity:1; }

/* Kimi · keep the editorial paper style and red accent. */
html[data-zh-app="kimi"][data-zh-theme="dark"] {
  --paper:#1c1c1a; --paper-deep:#242522; --ink:#e6e5dc; --muted:#aaa99e;
  --line:#42443b; --accent:#ef8a97; --accent-dark:#f2a2ac; --sage:#a5b99b;
  background:var(--paper); color:var(--ink);
}
html[data-zh-app="kimi"][data-zh-theme="dark"] body { background:var(--paper); color:var(--ink); }
html[data-zh-app="kimi"][data-zh-theme="dark"] :is(.settings-button,.history-item,.suggestions button) { color:var(--ink); }
html[data-zh-app="kimi"][data-zh-theme="dark"] .persona-item:hover { background:#30312b; }
html[data-zh-app="kimi"][data-zh-theme="dark"] .persona-item.active { background:var(--paper); }
html[data-zh-app="kimi"][data-zh-theme="dark"] .composer-area { background:linear-gradient(to bottom,#1c1c1abf,var(--paper) 20%); }
html[data-zh-app="kimi"][data-zh-theme="dark"] .composer:focus-within { box-shadow:4px 4px 0 #b0b4a316; }
html[data-zh-app="kimi"][data-zh-theme="dark"] :is(.settings-form input:not([type="range"]),.persona-form input,.persona-form textarea) { background:#161714; color:var(--ink); }
html[data-zh-app="kimi"][data-zh-theme="dark"] .composer textarea::placeholder { color:#a0a091; }
html[data-zh-app="kimi"][data-zh-theme="dark"] .persona-avatar { color:color-mix(in srgb,var(--persona),white 30%); }
html[data-zh-app="kimi"][data-zh-theme="dark"] :is(.history-popover,.modal) { box-shadow:7px 7px 0 #0005; }
html[data-zh-app="kimi"][data-zh-theme="dark"] .connection-status.connected i { background:#a5b99b; }
html[data-zh-app="kimi"][data-zh-theme="dark"] ::selection { background:#74424b; color:#fff; }

/* Antigravity · native dark palette plus a complete light palette. */
html[data-zh-app="antigravity"][data-zh-theme="dark"] {
  --bg:#101119; --panel:#171922; --surface:#1e202d; --line:#373b51;
  --muted:#a2a9c3; --text:#e6e8f4; --accent:#bba8ff;
}
html[data-zh-app="antigravity"][data-zh-theme="dark"] :is(.eyebrow,.sidebar-footer small,.message-meta time,.compose-actions small,.privacy-note) { color:#969fba; }
html[data-zh-app="antigravity"][data-zh-theme="light"] {
  --bg:#f6f5fb; --panel:#eeedf6; --surface:#fff; --line:#dad7e9;
  --muted:#6d6782; --text:#292639; --accent:#6e50bc;
}
html[data-zh-app="antigravity"][data-zh-theme="light"] button:hover { background:#e7e2f4; border-color:#9f8dc2; }
html[data-zh-app="antigravity"][data-zh-theme="light"] .primary { background:#7054bf; color:#fff; border-color:#7054bf; }
html[data-zh-app="antigravity"][data-zh-theme="light"] .primary:hover { background:#6042ac; }
html[data-zh-app="antigravity"][data-zh-theme="light"] .secondary { background:#fff; }
html[data-zh-app="antigravity"][data-zh-theme="light"] .brand-icon { border-color:#cec3e6; color:#7556b2; background:#e6ddf6; }
html[data-zh-app="antigravity"][data-zh-theme="light"] nav button.active { background:#e3dcf1; border-color:#c2b3db; }
html[data-zh-app="antigravity"][data-zh-theme="light"] .nav-avatar { background:#ffffff75; }
html[data-zh-app="antigravity"][data-zh-theme="light"] .avatar { background:#e9e5f3; border-color:#cdc4df; }
html[data-zh-app="antigravity"][data-zh-theme="light"] .context-strip { background:#efedf7; }
html[data-zh-app="antigravity"][data-zh-theme="light"] .simulated { border-color:#c6bed7; }
html[data-zh-app="antigravity"][data-zh-theme="light"] .quick-prompts button { color:#5d5574; background:#fff; }
html[data-zh-app="antigravity"][data-zh-theme="light"] .message-body { background:#fff; }
html[data-zh-app="antigravity"][data-zh-theme="light"] .message.user .message-body { background:#eae3f5; border-color:#d3c4e5; }
html[data-zh-app="antigravity"][data-zh-theme="light"] .message.error .message-body { color:#a34346; border-color:#d9b2b6; }
html[data-zh-app="antigravity"][data-zh-theme="light"] #chat-form { background:#fff; border-color:#c7bfd9; }
html[data-zh-app="antigravity"][data-zh-theme="light"] :is(textarea,input) { background:#fbfaff; border-color:#c8bfdc; color:#292639; }
html[data-zh-app="antigravity"][data-zh-theme="light"] #message-input { background:transparent; }
html[data-zh-app="antigravity"][data-zh-theme="light"] :is(textarea,input):focus { border-color:#8062bb; }
html[data-zh-app="antigravity"][data-zh-theme="light"] dialog { background:#f9f8fd; border-color:#c6bdd8; box-shadow:0 20px 100px #28203e26; }
html[data-zh-app="antigravity"][data-zh-theme="light"] dialog::backdrop { background:#34304770; }
html[data-zh-app="antigravity"][data-zh-theme="light"] .history-item { background:#eeebf6; }
html[data-zh-app="antigravity"][data-zh-theme="light"] :is(.eyebrow,.sidebar-footer small,.message-meta time,.compose-actions small,.privacy-note) { color:#776d8a; }
html[data-zh-app="antigravity"][data-zh-theme="light"] #notice { color:#72569e; }

/* Gallery has the same preference and its own green introduction palette. */
html[data-zh-app="gallery"] #gallery-theme { font:inherit;font-size:12px;cursor:pointer;padding:7px 13px;border:1px solid #cbd8c5;border-radius:9px;color:#355544;background:#fff; }
html[data-zh-app="gallery"] #gallery-theme:focus-visible { outline:3px solid #9dbd8e;outline-offset:3px; }
html[data-zh-app="gallery"][data-zh-theme="dark"] body { background:#151d18; color:#dce8dc; }
html[data-zh-app="gallery"][data-zh-theme="dark"] header { border-color:#344436; }
html[data-zh-app="gallery"][data-zh-theme="dark"] .tag { background:#2c3d2a; color:#bed0b5; }
html[data-zh-app="gallery"][data-zh-theme="dark"] :is(.label,.intro p,.card p,footer) { color:#a8b79f; }
html[data-zh-app="gallery"][data-zh-theme="dark"] .card { background:#202b22; border-color:#3a4b38; }
html[data-zh-app="gallery"][data-zh-theme="dark"] .card.pending { background:transparent; }
html[data-zh-app="gallery"][data-zh-theme="dark"] .status { color:#b0ca9e; }
html[data-zh-app="gallery"][data-zh-theme="dark"] .card a { background:#8eaf7d; color:#152210; }
html[data-zh-app="gallery"][data-zh-theme="dark"] .card a:hover { background:#a5c392; }
html[data-zh-app="gallery"][data-zh-theme="dark"] .info { background:#273625; color:#afc0a6; }
html[data-zh-app="gallery"][data-zh-theme="dark"] .info strong { color:#d0e2c3; }
html[data-zh-app="gallery"][data-zh-theme="dark"] #gallery-theme { background:#253524; border-color:#536b48; color:#d4e5ca; }
@media(max-width:560px) { html[data-zh-app="gallery"] header { flex-wrap:wrap; gap:12px; } }
