/* Shared appearance tokens. Artwork and style samples retain their original colors. */
@media(max-width:800px){html{height:100%;overflow:hidden}body{position:fixed;left:0;right:0;top:0;width:100%;overscroll-behavior:none}}
:root {
  color-scheme:light;
  --surface:#fff;
  --surface-soft:#f5f5f1;
  --text-primary:#252723;
  --text-secondary:#62675c;
  --control-border:#e0e3da;
  --control-hover:#eef0e9;
  --edit-surface:#f0f2e9;
  --edit-text:#45543a;
}
:root[data-theme="dark"] {
  color-scheme:dark;
  color:#eeeae4;
  background:#181818;
  --surface:#222222;
  --surface-soft:#2b2b2b;
  --text-primary:#eeeae4;
  --text-secondary:#b2afa8;
  --control-border:#41413e;
  --control-hover:#353533;
  --edit-surface:#352b25;
  --edit-text:#f0b99a;
  --line:#353533;
  --accent:#eea17f;
  --dark-page:#1d1d1d;
  --dark-sidebar:#181818;
  --dark-muted:#aaa79f;
  --dark-success:#bdcfae;
  --dark-error:#ffb49e;
  --dark-selection:#3b2c24;
}

#theme-toggle{border-radius:50%;border-color:transparent;color:var(--text-secondary)}
#theme-toggle:hover{background:var(--control-hover);color:var(--text-primary)}
#sidebar-theme-toggle{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;margin-top:10px;padding:8px 10px;border:0;border-radius:9px;background:transparent;color:var(--text-secondary);font-size:12px;text-align:left}
#sidebar-theme-toggle:hover{background:var(--control-hover);color:var(--text-primary)}
#sidebar-theme-toggle .icon{width:17px;height:17px}
.theme-switch{position:relative;flex:0 0 30px;height:18px;margin-left:auto;border:1px solid var(--control-border);border-radius:20px;background:var(--surface-soft)}
.theme-switch::after{content:'';position:absolute;top:3px;left:3px;width:10px;height:10px;border-radius:50%;background:#85897d;transition:transform .15s}
[aria-pressed=true]>.theme-switch{background:#eea17f;border-color:#eea17f}
[aria-pressed=true]>.theme-switch::after{background:#2b211a;transform:translateX(12px)}

/* Two equal-height actions; narrow galleries stack them without reducing touch targets. */
.result-grid .result-actions{gap:8px;margin-top:10px}
.result-grid:not(.single) .result-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin-top:9px}
.result-grid .result-actions > :is(a,button),
.result-grid:not(.single) .result-actions > :is(a,button),
.result-grid:not(.single) .result-actions > :is(a,button):last-child {
  display:inline-flex;align-items:center;justify-content:center;gap:7px;flex:0 1 auto;
  min-width:0;min-height:44px;padding:10px 14px;border:1px solid var(--control-border);
  border-radius:10px;background:var(--surface);color:var(--text-secondary);
  font-size:12px;font-weight:500;line-height:1.4;text-decoration:none;white-space:nowrap;
}
.result-grid:not(.single) .result-actions > :is(a,button),
.result-grid:not(.single) .result-actions > :is(a,button):last-child{padding:9px 7px;gap:5px;font-size:11px}
.result-grid .result-actions > .result-edit,
.result-grid:not(.single) .result-actions > .result-edit:last-child{background:var(--edit-surface);color:var(--edit-text);border-color:transparent}
.result-grid .result-actions .icon{width:16px;height:16px;stroke-width:1.7}
.result-grid:not(.single) .result-actions .icon{width:14px;height:14px}
.result-grid .result-actions > :is(a,button):hover:not(:disabled){background:var(--control-hover);border-color:var(--control-border);color:var(--text-primary)}
.result-grid .result-actions > :is(a,button):focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media(max-width:800px){
  .result-grid:not(.single) .result-actions{grid-template-columns:minmax(0,1fr);gap:5px;margin-top:7px}
  .result-grid .result-actions > :is(a,button){font-size:12px}
  .result-grid:not(.single) .result-actions > :is(a,button),
  .result-grid:not(.single) .result-actions > :is(a,button):last-child{font-size:11px;padding:8px 4px}
}

/* Dark surfaces, separate from the original light palette. */
:root[data-theme=dark] :is(.app-header,.sidebar){background:var(--dark-sidebar)}
:root[data-theme=dark] .conversation{background:var(--dark-page)}
:root[data-theme=dark] :is(.conversation-head,.mode-tabs){border-color:var(--line)}
:root[data-theme=dark] :is(.sidebar,#messages,#chats,#preview-thumbs){scrollbar-color:#50504b transparent}
:root[data-theme=dark] :is(.model-badge,select,input,.inspiration-card,.composer,dialog,#login-dialog,#style-dialog,#style-dialog .preview-head,#image-preview){background:var(--surface);border-color:var(--line);color:var(--text-primary)}
:root[data-theme=dark] select:disabled{background:var(--surface-soft);color:var(--dark-muted)}
:root[data-theme=dark] .composer{border-color:#43433e;box-shadow:0 3px 18px #00000015}
:root[data-theme=dark] .composer:focus-within{border-color:#77736b}
:root[data-theme=dark] .composer.dragging{background:var(--dark-selection);border-color:var(--accent)}
:root[data-theme=dark] .composer textarea{color:var(--text-primary)}
:root[data-theme=dark] :is(.composer textarea,input)::placeholder{color:#a4a198}
:root[data-theme=dark] :is(.primary,.brand-mark){background:#b44d31;color:#fff}
:root[data-theme=dark] .primary:hover{background:#c85c3d}
:root[data-theme=dark] :is(.new-chat,#create-user-form .primary,.composer-actions #submit,.composer-actions #submit[data-state=running]){background:#e7e3dc;color:#242321}
:root[data-theme=dark] :is(.new-chat,#create-user-form .primary,.composer-actions #submit):hover{background:#fff8ed}
:root[data-theme=dark] .new-shortcut{color:#5d5a52}
:root[data-theme=dark] :is(.brand small,.header-caption,.sidebar-heading,.section-label,.section-label span,label,.hint,#summary,#key-status,.sidebar-note,.breadcrumb,#context-info,.eyebrow,.welcome-heading>p:last-child,.inspiration-head>span,.card-caption small,.card-arrow,.composer-footnote,.composer-footnote.has-batch,.message small,.batch-tip,.followup-heading,.account-identity small,.account-identity>button,.users-list-heading span,.users-empty,.user-state.disabled,.task-elapsed,.task-progress p,.next-steps-heading,.next-steps-heading strong,.next-steps-waiting,.preview-footer,#preview-caption,#preview-loading){color:var(--dark-muted)}
:root[data-theme=dark] :is(dialog p,#style-help,.style-options small,#style-dialog .style-footnote,#chats button,.mode-tabs button,#reference>span,#undo-prompt,.followup-heading strong,#preview-counter){color:var(--text-secondary)}
:root[data-theme=dark] :is(.breadcrumb span:last-child,#reference button,.batch-heading a){color:var(--accent)}
:root[data-theme=dark] :is(#chats button:hover,.subtle:hover,.icon-button:hover,.mode-tabs button:hover,#mobile-menu:hover,#mobile-new-chat:hover,#undo-prompt:hover){background:var(--control-hover);color:var(--text-primary)}
:root[data-theme=dark] :is(#chats button.selected,.message.user,#format,#batch-count,#manage-users,#create-user-form){background:var(--surface-soft);color:var(--text-primary);border-color:var(--line)}
:root[data-theme=dark] .green .sticker-art{background:#29362c}
:root[data-theme=dark] .peach .sticker-art{background:#3c3027}
:root[data-theme=dark] .blue .sticker-art{background:#29333f}
:root[data-theme=dark] .sample-label{color:#d4d5cc}
:root[data-theme=dark] :is(.quick-prompts button,#style-picker-button,.style-options button,.task-progress .subtle,.issued-code-row button){background:var(--surface);color:var(--text-secondary);border-color:var(--control-border)}
:root[data-theme=dark] :is(.quick-prompts button:hover,#style-picker-button:hover,.style-options button:hover){background:var(--control-hover);color:var(--text-primary);border-color:#76766b}
:root[data-theme=dark] :is(.mode-tabs button[aria-pressed=true],#style-picker-button.has-style,.style-options button[aria-pressed=true]){background:var(--dark-selection);color:#f0b99a;border-color:#986a50}
:root[data-theme=dark] .style-options button[aria-pressed=true]::after{color:#f0b99a}
:root[data-theme=dark] .swatch-doodle{border-color:#d8d9ce}
:root[data-theme=dark] :is(#status,.account-avatar,#issued-code-panel){background:#293126;color:var(--dark-success);border-color:#45523b}
:root[data-theme=dark] :is(.user-state,#users-status,#issued-code-panel p,#issued-code,.message.assistant.editing-source>small){color:var(--dark-success)}
:root[data-theme=dark] .message.assistant.editing-source>small::after{background:#293126}
:root[data-theme=dark] :is(#status.error,.batch-warning){background:#3c2a23;color:var(--dark-error)}
:root[data-theme=dark] :is(#login-error,#users-status.error){color:var(--dark-error)}
:root[data-theme=dark] :is(.task-progress,.task-progress.active){background:var(--surface);border-color:var(--control-border);color:var(--text-primary)}
:root[data-theme=dark] .task-progress:not(.active){background:#302b23;color:#e1c49b}
:root[data-theme=dark] :is(.task-progress.active strong:before,#status.busy:before){border-color:#51594c;border-top-color:#b1c5a1}
:root[data-theme=dark] .result-grid:not(.single) .message{border-color:var(--line)}
:root[data-theme=dark] .generated{background:repeating-conic-gradient(#292929 0% 25%,#303030 0% 50%) 50%/18px 18px}
:root[data-theme=dark] .next-steps{--suggestion-surface:var(--surface)}
:root[data-theme=dark] .next-step{border-color:var(--control-border);color:var(--text-primary);box-shadow:none}
:root[data-theme=dark] .next-steps-heading>span{border-color:var(--control-border)}
:root[data-theme=dark] :is(.next-step .next-step-leading,.next-step .next-step-trailing){color:var(--dark-muted)}
:root[data-theme=dark] .next-step>strong small{background:#383833;color:#cccbbf}
:root[data-theme=dark] .next-step:hover{--suggestion-surface:var(--control-hover);border-color:#68685f}
:root[data-theme=dark] .next-step.is-applied{--suggestion-surface:var(--dark-selection);border-color:#986a50;color:#f0b99a}
:root[data-theme=dark] :is(.next-step.is-applied .next-step-leading,.next-step.is-applied .next-step-trailing){color:#f0b99a}
:root[data-theme=dark] .next-step.is-applied>strong small{background:#523c2e;color:#f0c7ae}
:root[data-theme=dark] :is(#draft-feedback,#scroll-latest){background:#2c2c2cf5;border-color:#494940;color:var(--text-secondary);box-shadow:0 3px 14px #0003}
:root[data-theme=dark] #draft-feedback .feedback-check{color:var(--dark-success)}
:root[data-theme=dark] #scroll-latest:hover{background:var(--control-hover)}
:root[data-theme=dark] dialog::backdrop,:root[data-theme=dark] #image-preview::backdrop{background:#0009}
:root[data-theme=dark] #menu-backdrop{background:#0009}
:root[data-theme=dark] #close-preview{background:var(--surface-soft);color:var(--text-primary)}
:root[data-theme=dark] #close-preview:hover{background:var(--control-hover)}
:root[data-theme=dark] #preview-stage{border-color:var(--line);background:repeating-conic-gradient(#262626 0% 25%,#2b2b2b 0% 50%) 0 0/20px 20px}
:root[data-theme=dark] .preview-nav{background:#333333eb;color:var(--text-primary);border-color:#55554c;box-shadow:0 2px 8px #0003}
:root[data-theme=dark] .preview-nav:hover:not(:disabled){background:#484844;color:#fff;border-color:#7e7b6e}
:root[data-theme=dark] .preview-thumb{background:var(--surface-soft);border-color:var(--control-border)}
:root[data-theme=dark] .preview-thumb span{background:#30302ee8;color:#eeeae4}
:root[data-theme=dark] .preview-thumb[aria-current=true]{border-color:var(--accent);background:var(--dark-selection)}
:root[data-theme=dark] .preview-thumb[aria-current=true] span{background:#eea17f;color:#291f19}
@media(max-width:800px){:root[data-theme=dark] .task-progress.active{background:transparent}}
@media(prefers-reduced-motion:reduce){.theme-switch::after{transition:none}}
@media(max-width:800px){body{max-height:100dvh}}
