/* Dark kit keeps fixed surfaces; light kit uses a soft tint of the selected color. */
:root[data-studio-theme]{color-scheme:dark;--bg:#07100c;--surface-base:#0a1510;--surface-raised:#111e17;--panel:var(--surface-base);--panel2:var(--surface-raised);--text:#edf6f0;--muted:#a5b6aa;--surface-muted:var(--muted);--theme-primary:#03ed98;--theme-secondary:#16cccd;--brand-mint:var(--theme-primary);--brand-teal:var(--theme-secondary);--surface-border:#ffffff25;--surface-hover:#ffffff50;--surface-focus:var(--brand-mint);--line:var(--surface-border);--accent:var(--brand-mint);--green:var(--brand-mint);--focus-ring:var(--brand-mint);--art-opacity:.6;--red:#ff9ba9;--amber:#f0ce84;--on-accent:#07120c}
:root[data-studio-theme=sunset]{--theme-primary:#ffab63;--theme-secondary:#f5df72}
:root[data-studio-theme=fuchsia]{--theme-primary:#f08adf;--theme-secondary:#beafff}
:root[data-studio-theme=paper]{--theme-primary:#ffffff;--theme-secondary:#a3a3a3}
:root[data-studio-theme=ocean]{--theme-primary:#8abfff;--theme-secondary:#78f5d2}
:root[data-studio-theme=electric]{--theme-primary:#acff57;--theme-secondary:#ff74bd}
:root[data-studio-theme][data-studio-mode=light]{color-scheme:light;--bg:color-mix(in srgb,var(--theme-primary) 7%,white);--surface-base:color-mix(in srgb,var(--theme-primary) 3%,white);--surface-raised:#fff;--text:#101512;--muted:#37443c;--brand-mint:#101512;--brand-teal:#3d5147;--on-accent:#fff;--surface-border:#10151224;--surface-hover:#10151260;--art-opacity:.16;--red:#9f1239;--amber:#704200;--brand-muted:#244634;--brand-highlight:#101512;--brand-wash:#ffffff80;--brand-edge:#10151238;--brand-line:#101512;--brand-line-dim:#10151260;--brand-glow-faint:#10151209;--brand-glow-strong:#10151218}
html[data-studio-theme],html[data-studio-theme] #studio{background:var(--bg);color:var(--text)}
html[data-studio-theme] #studio .main{position:relative;isolation:isolate;background:var(--bg);background-image:none}
/* Diagonal halftone light inspired by the reference; no motion or external images. */
html[data-studio-theme] #studio .main:has(:is(.workflow-workspace,.content-research))::before{content:"";position:absolute;z-index:-1;pointer-events:none;inset:0;opacity:var(--art-opacity);background:radial-gradient(ellipse at 12% 82%,color-mix(in srgb,var(--brand-mint) 35%,transparent),transparent 38%),radial-gradient(ellipse at 65% 30%,color-mix(in srgb,var(--brand-teal) 17%,transparent),transparent 42%)}
html[data-studio-theme] #studio .main:has(:is(.workflow-workspace,.content-research))::after{content:"";position:absolute;z-index:-1;pointer-events:none;inset:0;opacity:var(--art-opacity);background:linear-gradient(135deg,var(--brand-mint),var(--brand-teal) 46%,var(--brand-mint));mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14'%3E%3Cpath fill='white' d='M7 4l3 3-3 3-3-3z'/%3E%3C/svg%3E"),radial-gradient(ellipse 64% 48% at 28% 60%,#0008,transparent 85%);mask-composite:intersect;mask-size:14px 14px,100% 100%}
html[data-studio-theme] #studio :is(.workflow-canvas,.canvas-stage,.canvas-viewport,.content-research,.research-chat,.youtube-studio){background-color:transparent;--research-line:var(--line);--yt-line:var(--line)}
html[data-studio-theme] #studio :is(.sidebar,.sidebar:hover,.sidebar:focus-within,.topbar,.modal,.task-dock,#runtime-notice,#toast,.canvas-left-rail,.canvas-checklist,.canvas-engine,.canvas-tip){background:var(--surface-base);border-color:var(--line);color:var(--text)}
html[data-studio-theme] #studio :is(.workflow-node,.workflow-node.settings-node,.settings-section,.panel,.clip-card,.empty-stack-front,.empty-stack-card,.research-composer,.research-rail,.research-sidebar,.research-message,.yt-connection-details,.youtube-publishing){background:color-mix(in srgb,var(--surface-base) 96%,transparent);border-color:var(--line);color:var(--text)}
html[data-studio-theme] #studio :is(.btn,.icon-btn,.tabs button,.link-btn,label,.field label,.label,.clip-setting>summary,.node-heading,.stack-caption h3,.research-composer textarea,.nav-group>summary){color:var(--text)}
html[data-studio-theme] #studio :is(.btn,.icon-btn,.tabs button,.link-btn):hover{color:var(--text);background:var(--surface-raised)}
html[data-studio-theme] #studio :is(.btn.primary,.youtube-studio .btn.primary,.research-send){color:var(--on-accent);background:var(--brand-mint);border-color:var(--brand-mint)}
html[data-studio-theme] #studio :is(.nav a.active,.nav-group.is-active>summary){color:var(--brand-mint);background:color-mix(in srgb,var(--brand-mint) 9%,var(--surface-base))}
html[data-studio-theme] #studio :is(input,select,textarea){background:var(--surface-base);color:var(--text);border-color:var(--line)}
html[data-studio-theme] #studio :is(input,textarea)::placeholder{color:var(--muted);opacity:1}
html[data-studio-theme] #studio :is(.help,.small,small,.muted,.node-run-status,.node-tags,.stack-caption .small,.canvas-activity p,.canvas-activity small,.clip-setting output,.pipeline-footer,.back-link,.quote,.rationale,.banner p,.notice p){color:var(--muted)}
html[data-studio-theme] #studio :is(.btn.danger,.inline-error,.notice.error){color:var(--red)}
html[data-studio-theme] #studio .appearance-section{scroll-margin-top:24px}
html[data-studio-theme] #studio .theme-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-top:24px}
html[data-studio-theme] #studio .theme-option{display:grid;gap:12px;text-align:left;border:1px solid var(--line);border-radius:12px;background:var(--surface-base);color:var(--text);padding:10px;min-width:0;cursor:pointer;font:inherit}
html[data-studio-theme] #studio .theme-option:hover{border-color:var(--surface-hover)}
html[data-studio-theme] #studio .theme-option[aria-pressed=true]{outline:2px solid var(--brand-mint);outline-offset:2px;border-color:transparent}
.theme-preview{height:88px;display:block;position:relative;overflow:hidden;border-radius:7px;background:radial-gradient(ellipse at 20% 100%,color-mix(in srgb,var(--swatch-a) 22%,transparent),transparent 70%),var(--swatch-bg);border:1px solid #8883}
.theme-preview::before{content:"";position:absolute;inset:0;background:radial-gradient(var(--swatch-a) .9px,transparent 1px);background-size:9px 9px;mask-image:linear-gradient(135deg,#0008,transparent)}
.theme-preview i{position:absolute;left:15px;top:20px;width:50%;height:4px;border-radius:4px;background:var(--swatch-a)}
.theme-preview i+i{top:31px;width:32%;opacity:.45}
.theme-preview>span{position:absolute;bottom:16px;left:15px;width:40px;height:14px;border-radius:4px;background:linear-gradient(110deg,var(--swatch-a),var(--swatch-b))}
.theme-option-label{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:1.4;padding:0 3px 3px}
.theme-selected{visibility:hidden;color:var(--brand-mint)}
[aria-pressed=true] .theme-selected{visibility:visible}
.theme-feedback{min-height:1.5em;margin:18px 0 0}
@media(max-width:760px){html[data-studio-theme] #studio .theme-options{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(forced-colors:active){.theme-preview{forced-color-adjust:none}html[data-studio-theme] #studio .main::before,html[data-studio-theme] #studio .main::after{display:none}}

/* Cloud-only chrome follows the selected palette too. */
html[data-studio-theme] .cloud-account{background:var(--surface-base);color:var(--muted);border-color:var(--line)}
html[data-studio-theme] .cloud-account button{color:var(--brand-mint)}
html[data-studio-theme] #studio .sidebar .nav a .count{background:var(--brand-mint);color:var(--on-accent);border-color:var(--surface-base)}
html[data-studio-theme] #studio :is(.avatar,.workspace-avatar){background:var(--surface-raised);color:var(--text)}

/* Kit previews keep both choices visible; palette previews follow the active kit. */
html[data-studio-theme] #studio .theme-group-title{font-size:12px;margin:24px 0 12px;color:var(--muted)}
html[data-studio-theme] #studio .theme-kits{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
html[data-studio-theme] #studio .theme-kit{display:grid;gap:10px;padding:10px;text-align:left;min-width:0;background:var(--surface-base);color:var(--text);border:1px solid var(--line);border-radius:12px;font:inherit;cursor:pointer}
html[data-studio-theme] #studio .theme-kit small{padding:0 3px 4px;font-size:11px;line-height:1.5}
html[data-studio-theme] #studio .theme-kit:hover{border-color:var(--surface-hover)}
html[data-studio-theme] #studio .theme-kit[aria-pressed=true]{outline:2px solid var(--brand-mint);outline-offset:2px;border-color:transparent}
html[data-studio-theme] #studio .theme-group-title+.theme-options{margin-top:0}
.kit-preview{position:relative;display:block;height:88px;border-radius:7px;overflow:hidden;border:1px solid #8883;background:#07100c;--kit-ink:var(--theme-primary);--kit-card:#16271e;--kit-detail:var(--theme-primary)}
.kit-preview-light{background:color-mix(in srgb,var(--theme-primary) 7%,white);--kit-ink:#101512;--kit-card:#fff;--kit-detail:#101512}
.kit-preview i{position:absolute;inset:0 auto 0 0;width:20%;background:var(--kit-card);border-right:1px solid #8883}
.kit-preview>span{position:absolute;left:27%;top:19px;width:43%;height:5px;border-radius:3px;background:var(--kit-ink);box-shadow:0 12px 0 var(--kit-ink)}
.kit-preview b{position:absolute;left:27%;bottom:14px;width:26%;height:16px;border-radius:4px;background:var(--kit-card);border:1px solid var(--kit-detail)}
html[data-studio-mode=light] .theme-preview{background:color-mix(in srgb,var(--swatch-a) 7%,white)}
html[data-studio-mode=light] .theme-preview::before{opacity:.15;background:radial-gradient(#101512 .9px,transparent 1px);background-size:9px 9px}
html[data-studio-mode=light] .theme-preview i{background:#101512}
html[data-studio-mode=light] .theme-preview>span{background:#fff;border:1px solid #10151280}
/* Legacy component fills and light-on-dark labels use the light kit's tokens.
   Media players and image overlays retain their own black/white contrast. */
html[data-studio-mode=light] #studio :is(.review-more-actions,.review-queue,.review-details,.research-results,.yt-card,.youtube-clip,.canvas-activity,.settings-metrics article,.caption-preview,.member-onboarding,.message-bubble,.edit-overlay-copy,.process-step,.canvas-toolbar,.settings-nav,.yt-publish-item){background:var(--surface-base);color:var(--text);border-color:var(--line)}
html[data-studio-mode=light] #studio :is(.btn:not(.primary),.icon-btn,.tabs button,.link-btn){background:var(--surface-raised)}
html[data-studio-mode=light] #studio :is(.nav a,.side-control,.settings-nav button,.canvas-activity strong,.canvas-tip strong,.message-text,.message-identity strong,.research-starters button,.research-idea summary,.research-options>summary,.yt-options>summary,.yt-upload-details>summary>span,.tag,.provider-mark,.credential-icon,.tool-logo,code){color:var(--text)}
html[data-studio-mode=light] #studio :is(.eyebrow,.canvas-source-summary p,.canvas-source-summary .eyebrow,.stack-caption .eyebrow,.empty-stack-front p,.message-detail,.message-step,.message-identity>span,.message-footer,.checklist-title,.research-idea>p,.research-source-stats,.member-intro,.member-help,.member-status,.member-row small,.member-empty,.timeline-summary,.pipeline-status,.banner p,.notice p,.yt-publish-steps li.done){color:var(--muted)}
html[data-studio-mode=light] #studio .workflow-node :is(input,textarea):disabled{-webkit-text-fill-color:var(--muted)}
/* One continuous chat canvas; never paint a saturated rectangle around the composer. */
html[data-studio-mode=light] #studio .content-research .research-rail{background:var(--surface-base)}
html[data-studio-mode=light] #studio .research-chat{background:var(--bg)}
html[data-studio-mode=light] #studio :is(.research-thread,.research-chat-header,.research-composer-wrap,.research-composer-note){background:transparent}
html[data-studio-mode=light] #studio .content-research :is(.research-composer,.research-options-body){background:var(--surface-raised);box-shadow:0 2px 8px #10151208}
html[data-studio-mode=light] #studio .research-request{background:color-mix(in srgb,var(--theme-primary) 13%,white);color:var(--text)}
html[data-studio-mode=light] #studio .research-starters button{background:var(--surface-raised);border-color:var(--line)}
html[data-studio-mode=light] #studio .research-starters button:hover{background:var(--surface-base);border-color:var(--surface-hover)}
html[data-studio-mode=light] #studio .review-queue-item[aria-current]{background:#1015120d;border-color:var(--surface-hover)}
html[data-studio-mode=light] #studio :is(.research-orb,.yt-create-icon){background:#fff;color:var(--text);border-color:var(--line)}
html[data-studio-mode=light] #studio :is(.brand img,.brand-mark){filter:grayscale(1) brightness(.2)}
html[data-studio-mode=light] #studio :is(.progress-track,.message-progress){background:#10151220}
html[data-studio-mode=light] #studio :is(.notice.warn,.yt-publishing-notice,#youtube-publishing-message:not(:empty),[data-publish-state=blocked],[data-publish-state=failed]){color:var(--amber)}
html[data-studio-mode=light] #studio :is(.notice.error,.inline-error,.research-status.failed b,[data-state=error] .node-run-status){color:var(--red)}
html[data-studio-mode=light] #studio .canvas-controls{background:var(--surface-base);border-color:var(--line);box-shadow:0 6px 24px #10151220}
html[data-studio-mode=light] #studio :is(.canvas-controls button,.node-tags>span,.node-tags>a,.canvas-zoom-help){color:var(--muted)}
html[data-studio-mode=light] #studio .canvas-control-divider{background:var(--line)}
html[data-studio-mode=light] #studio :is(input[type=checkbox],input[type=radio],input[type=range],progress){accent-color:var(--brand-mint)}
html[data-studio-mode=light] #studio #youtube-create-form{background:var(--surface-base);border-color:var(--line)}
