:root{
  --theme-bg:#f5f7f6;--theme-panel:#fff;--theme-raised:#f0f6f2;--theme-input:#fff;
  --theme-text:#243c32;--theme-muted:#617269;--theme-line:#d8e4dc;--theme-accent:#247a5b;
  --theme-primary:#247a5b;--theme-primary-text:#fff;--theme-focus:#73bc9b;
}
.theme-switcher{display:inline-flex;align-items:center;flex:none;gap:2px;padding:3px;border:1px solid var(--theme-line);border-radius:10px;background:var(--theme-raised)}
.theme-switcher button{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:32px;margin:0;padding:5px 8px;border:1px solid transparent;border-radius:7px;background:transparent;color:var(--theme-muted);font:inherit;font-size:12px;font-weight:600;line-height:1.4;white-space:nowrap;cursor:pointer}
.theme-switcher button[aria-pressed="true"]{background:var(--theme-panel);color:var(--theme-accent);border-color:var(--theme-line);box-shadow:0 1px 3px #1634240a}
.theme-switcher button:hover{color:var(--theme-accent)}
.theme-switcher button:focus-visible{outline:3px solid var(--theme-focus);outline-offset:2px}
.theme-switcher svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none}
.guide-toolbar-actions{display:flex;align-items:center;gap:18px;flex-wrap:wrap;justify-content:flex-end}
@media(max-width:850px){.header-actions{flex-wrap:wrap;justify-content:flex-end}}
@media(max-width:520px){
  .header-actions #open-library{grid-column:1;grid-row:1}
  .header-actions #open-guide{grid-column:2;grid-row:1}
  .header-actions .save-status{grid-column:1;grid-row:2;align-self:center}
  .header-actions .theme-switcher{grid-column:2;grid-row:2;justify-self:end}
  .header-actions .theme-switcher button{font-size:11px;padding:5px 7px}
  .guide-toolbar{flex-wrap:wrap}
  .guide-toolbar-actions{width:100%;justify-content:space-between;gap:10px}
}
@media screen{
  html[data-theme="dark"]{
    color-scheme:dark;
    --theme-bg:#111b16;--theme-panel:#19271f;--theme-raised:#22352a;--theme-input:#142219;
    --theme-text:#e5eee7;--theme-muted:#b0c2b5;--theme-line:#3b5545;--theme-accent:#91d8ad;
    --theme-primary:#29744e;--theme-primary-text:#f6fff8;--theme-focus:#8ed8ac;
    --green:var(--theme-accent);--ink:var(--theme-text);--muted:var(--theme-muted);--line:var(--theme-line);--surface:var(--theme-raised);
  }
  html[data-theme="dark"] body{background:var(--theme-bg);color:var(--theme-text)}
  html[data-theme="dark"] :is(.site-header,.mode-bar,.input-panel,.result-toolbar,.import-strip,.teacher-panel,.modal,.quick-sheet,.guide-section,.guide-detail,.usage-guide-card){background:var(--theme-panel);color:var(--theme-text);border-color:var(--theme-line)}
  html[data-theme="dark"] :is(.panel-section,.creation-panel,.guide-detail,.guide-toc .toc-secondary,.saved-row,.detail-control,.advanced-settings[open]>summary){border-color:var(--theme-line)}
  html[data-theme="dark"] :is(.brand p,.save-status,.mode-button small,.segmented button,.level-note,.level-total,.preview-meta,.empty-preview p,.style-note .small,.style-note>span,.site-footer,.muted,.optional-label,.advanced-heading small,.guide-brand small,.reading-tools p,.print-actions button,.guide-toc p,.section-lead,.source-list span,.instruction-steps p,.inline-note p,.guide-section .small-note,.teacher-panel summary .small,.result-footer,.upload-zone small,.saved-row p,#generation-summary){color:var(--theme-muted)}
  html[data-theme="dark"] :is(.workflow-steps,.page-row .page-name){color:var(--theme-text)}
  html[data-theme="dark"] :is(.mode-button,.level-option,.custom-question-form,.custom-question-row,.example-copy,.advanced-body,.creation-panel,.saved-row,.page-row,.empty-preview){background:var(--theme-panel);color:var(--theme-text);border-color:var(--theme-line);box-shadow:none}
  html[data-theme="dark"] :is(.mode-button.selected,.level-option.chosen,.page-row.active,.standard-detail,.curriculum-label,.quick-path,.guide-toc a:hover){background:var(--theme-raised);border-color:#618c70}
  html[data-theme="dark"] :is(.segmented,.style-note,.preview-stage,.question-card,.custom-question-form,.teacher-example,.teacher-example ol,.teacher-example .example-copy,.guide-detail>summary:hover,.usage-guide-tip,.tip){background:var(--theme-raised);color:var(--theme-text);border-color:var(--theme-line)}
  html[data-theme="dark"] :is(input,textarea,select,.field input,.field textarea,.field select,.level-option select,.type-count-row select,.zoom-control select,.question-header select,.page-row select,#prompt-dialog>#prompt-text){background:var(--theme-input);color:var(--theme-text);border-color:#587561}
  html[data-theme="dark"] :is(input,textarea)::placeholder{color:#92aa99}
  html[data-theme="dark"] :is(input[type="checkbox"],input[type="radio"]){accent-color:var(--theme-accent)}
  html[data-theme="dark"] :is(.mode-check,.level-total,.visit-summary strong,.empty-guide,.text-link,.standard-detail a,.workspace-nav a,.detail-control>summary::before,.teacher-example>summary::after,.guide-detail>summary::after,.guide-toc a,.step-number,.usage-guide-header p,.eyebrow,.upload-zone>span,.save-status::before,#generation-status){color:var(--theme-accent)}
  html[data-theme="dark"] :is(.step,.advanced-icon,.brand-symbol,.button.primary,.primary){background:var(--theme-primary);color:var(--theme-primary-text);border-color:var(--theme-primary)}
  html[data-theme="dark"] :is(.button.primary,.primary):hover:not(:disabled){background:#32835a;border-color:#32835a}
  html[data-theme="dark"] :is(.button.secondary,.advanced-toggle,.icon-button,.guide-toolbar .button){background:var(--theme-panel);color:var(--theme-accent);border-color:#64846f}
  html[data-theme="dark"] :is(.button.secondary,.button.subtle,.icon-button,.advanced-toggle):hover:not(:disabled){background:var(--theme-raised);color:var(--theme-accent)}
  html[data-theme="dark"] .button.subtle{color:var(--theme-muted)}
  html[data-theme="dark"] :is(.segmented button.active,.workflow-steps li span,.mode-icon,.step-number){background:#2c4937;color:var(--theme-accent);box-shadow:none}
  html[data-theme="dark"] .upload-zone{background:var(--theme-input);color:var(--theme-muted);border-color:#64846f}
  html[data-theme="dark"] .upload-zone:hover{background:var(--theme-raised);border-color:var(--theme-accent)}
  html[data-theme="dark"] :is(.detail-control>summary,.teacher-example>summary){background:var(--theme-raised);color:var(--theme-text);border-color:var(--theme-line)}
  html[data-theme="dark"] :is(.detail-control>summary:hover,.teacher-example>summary:hover){background:#2b4534}
  html[data-theme="dark"] :is(.advanced-settings,.advanced-settings>summary,.cost-notice,.cost-note,.notice){background:#39331e;color:#eddda7;border-color:#756739}
  html[data-theme="dark"] .advanced-settings>summary:hover{background:#443c23}
  html[data-theme="dark"] :is(.advanced-heading small,.detail-control>summary span,.cost-copy){color:#c5c3a1}
  html[data-theme="dark"] .required{background:#47361d;color:#ffdb99;border-color:#98703c}
  html[data-theme="dark"] .error-text{background:#42251f;color:#ffc4b5;border:1px solid #8d584b}
  html[data-theme="dark"] .workspace-nav{background:#111b16f2;border-color:var(--theme-line)}
  html[data-theme="dark"] :is(.preview-placeholder,.empty-badge){color:#b1cab9}
  html[data-theme="dark"] .empty-badge{background:var(--theme-raised)}
  html[data-theme="dark"] :is(.quick-steps b,.section-lead b,.guide-brand,.usage-guide-description strong,.usage-guide-tip strong){color:var(--theme-text)}
  html[data-theme="dark"] :is(.usage-guide-description,.usage-guide-tip,.usage-guide-stop,.usage-guide-more,.usage-guide-more a,.usage-guide-close){color:var(--theme-muted)}
  html[data-theme="dark"] .usage-guide-meter{background:#3a5142}
  html[data-theme="dark"] .usage-guide-meter span{background:var(--theme-accent)}
  html[data-theme="dark"] .usage-guide-more{border-color:var(--theme-line)}
  html[data-theme="dark"] .usage-guide-pointer{background:var(--theme-panel);border-color:var(--theme-line)}
  html[data-theme="dark"] .usage-guide-navigation #usage-guide-start-here{background:var(--theme-panel);color:var(--theme-accent);border-color:#64846f}
  html[data-theme="dark"] .usage-guide-close:hover{background:var(--theme-raised);color:var(--theme-text)}
  html[data-theme="dark"] .usage-guide-spotlight>rect[mask]{fill:#020805;fill-opacity:.7}
  html[data-theme="dark"] #usage-guide-halo{stroke:#506a48}
  html[data-theme="dark"] :is(button,a,input,select,textarea,summary):focus-visible{outline-color:var(--theme-focus)}
  html[data-theme="dark"] .skip-link{background:var(--theme-panel);color:var(--theme-text)}
  html[data-theme="dark"] .modal::backdrop{background:#0009}
}
@media print{
  html[data-theme]{color-scheme:light!important}
  .theme-switcher{display:none!important}
}
