/* Shared palette for the atlas and the author workshop. Illustrations stay intact. */
:root { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121c1b;
  --surface: #1b2926;
  --ink: #e2e5d9;
  --muted: #b2bbae;
  --gold: #d1af74;
  --line: #3b4b43;
}
.theme-toggle {
  border: 1px solid #73877a;
  border-radius: 5px;
  background: #183e3a;
  color: #f3e5c8;
  padding: 8px 12px;
  font: 12px/1.5 var(--sans);
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}
.theme-toggle:hover { background: #28534d; }
.theme-toggle:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.sidebar > .theme-toggle { margin: 18px 12px 0; }
.atelier-actions { display: flex; align-items: center; gap: 20px; }

:root[data-theme="dark"] :is(.sidebar,.atelier-topbar) { background: #102b28; }
:root[data-theme="dark"] :is(.topbar,.menu-button) { background: #182522; }
:root[data-theme="dark"] :is(.search,input) { background: #14211f; border-color: var(--line); }
:root[data-theme="dark"] :is(.search input,input) { color: var(--ink); }
:root[data-theme="dark"] input::placeholder { color: #abb5a8; opacity: 1; }
:root[data-theme="dark"] :is(.notice,.test-notice,.local-badge,.eyebrow,.home-intro .eyebrow,.home-section .eyebrow,.proposal-label,.prompt-number,.article-aside h2,.unavailable) { color: #d1af74; }
:root[data-theme="dark"] :is(.card-description,.card-meta,.card-meta a,.page-footer,.filter,.prose,.article-aside a,.home-intro p,.section-intro,.prompt-theme,.prompt-card>p,.prompt-card details p,.reading-feature blockquote,.place-copy>p,.place-copy .writing-question,.workshop-note p,.welcome>p,.form-intro,.form-note,.help,.milestones,.account-header p,.future-grid p,.session-note,.atelier-page footer) { color: var(--muted); }
:root[data-theme="dark"] :is(.prompt-card,.place-feature,.login-panel,.future-grid article) { background: var(--surface); }
:root[data-theme="dark"] :is(.reading-feature,.hero,.hero-copy) { background: #22332d; border-color: var(--line); }
:root[data-theme="dark"] :is(.card-meta,.proposal-label,.local-badge,kbd,.empty-state,.milestones,.planned,.password-field button) { border-color: var(--line); }
:root[data-theme="dark"] :is(.card-visual,.card-visual.pattern,.card:nth-child(3n) .pattern) { background: #263930; }
:root[data-theme="dark"] .creature-visual { background: #10252b; }
:root[data-theme="dark"] :is(.card-type,.card-version,.prompt-links a,.prose th) { background: #2c4035; color: #dfcfaa; }
:root[data-theme="dark"] :is(.favorite-button,.filter:hover:not(.active)) { background: #293b32; color: #d4d9c8; border-color: #72816d; }
:root[data-theme="dark"] .favorite-button[aria-pressed=true] { color: #f3d191; background: #4a3f25; border-color: #b49a61; }
:root[data-theme="dark"] :is(.prose strong,label,.milestones .current) { color: var(--ink); }
:root[data-theme="dark"] :is(.prose a,.text-link,.prompt-card summary,.secondary-button,.icon-button,.password-field button) { color: #c2d5b5; }
:root[data-theme="dark"] :is(.secondary-button,.icon-button) { border-color: #71866b; }
:root[data-theme="dark"] :is(.prompt-card .prompt-disclaimer,.planned) { color: #d1bd95; }
:root[data-theme="dark"] .verified { background: #243a2b; border-color: #64815a; }
:root[data-theme="dark"] .verified p { color: #c0cfb6; }
:root[data-theme="dark"] .connection-status:not(:empty) { background: #302e22; color: #e0d1ac; border-color: #89764f; }
:root[data-theme="dark"] .connection-status.error { background: #3a2522; color: #f1c3b2; border-color: #b77965; }
:root[data-theme="dark"] .connection-status.success { background: #243a2b; color: #c6dfb7; border-color: #64815a; }

@media(max-width:600px) {
  .atelier-topbar { flex-wrap: wrap; }
  .atelier-actions { flex-wrap: wrap; gap: 12px; }
  .atelier-actions .back-atlas { max-width: none; }
}
@media print {
  .theme-toggle { display: none !important; }
  :root[data-theme] { color-scheme: light; --paper: white; --surface: white; --ink: #263b38; --muted: #4d574c; --line: #ccc; }
  :root[data-theme="dark"] .article :is(.prose,.prose strong,.prose a,.prose th,.article-aside a) { color: #263b38; }
  :root[data-theme="dark"] .prose th { background: #eee; }
}
