/* Curated theme tokens. Teacher-chosen content colors are deliberately untouched. */
:root{--button-fill:#245bc4;--button-ink:#fff;--button-hover:#17479e;--muted:#5f6f85;--danger:#b33b4b}
:root[data-theme=dark]{--muted:#a9b7ca;--danger:#ffa6b0}
:root[data-palette=sage],.theme-swatch[data-palette=sage]{--page:#e6eee2;--surface:#f1f6ef;--glass:#f1f6eff5;--ink:#2b3d32;--muted:#596e5c;--line:#c6d5c3;--accent:#466c50;--selected:#dce9d7;--button-fill:#466c50;--button-ink:#ffffff;--button-hover:#2b3d32;--shadow:0 14px 45px #263e6420;}
:root[data-palette=lavender],.theme-swatch[data-palette=lavender]{--page:#ebe4f3;--surface:#f5f1fa;--glass:#f5f1faf5;--ink:#3b314b;--muted:#706079;--line:#d4c7df;--accent:#72558e;--selected:#e6dbf1;--button-fill:#72558e;--button-ink:#ffffff;--button-hover:#3b314b;--shadow:0 14px 45px #263e6420;}
:root[data-palette=peach],.theme-swatch[data-palette=peach]{--page:#f3e8de;--surface:#fff4eb;--glass:#fff4ebf5;--ink:#47372d;--muted:#7c6655;--line:#ddc9b7;--accent:#995936;--selected:#f2dfcc;--button-fill:#995936;--button-ink:#ffffff;--button-hover:#47372d;--shadow:0 14px 45px #263e6420;}
:root[data-palette=forest],.theme-swatch[data-palette=forest]{--page:#17271f;--surface:#22372f;--glass:#22372ff5;--ink:#e8f2eb;--muted:#b0c7b6;--line:#49665a;--accent:#acd3b4;--selected:#365443;--button-fill:#acd3b4;--button-ink:#17271f;--button-hover:#365443;--shadow:0 14px 45px #0004;}
:root[data-palette=plum],.theme-swatch[data-palette=plum]{--page:#251d2e;--surface:#34283d;--glass:#34283df5;--ink:#f0e9f5;--muted:#c5b5cf;--line:#64516f;--accent:#d1b6e5;--selected:#513c60;--button-fill:#d1b6e5;--button-ink:#251d2e;--button-hover:#513c60;--shadow:0 14px 45px #0004;}
:root[data-palette=cocoa],.theme-swatch[data-palette=cocoa]{--page:#29221d;--surface:#382e29;--glass:#382e29f5;--ink:#f6eee6;--muted:#ccbcaf;--line:#705c4c;--accent:#e4bc96;--selected:#554438;--button-fill:#e4bc96;--button-ink:#29221d;--button-hover:#554438;--shadow:0 14px 45px #0004;}

.theme-swatch[data-palette=light]{--surface:#f9fbff;--ink:#233449;--accent:#245bc4}.theme-swatch[data-palette=dark]{--surface:#1e2b3e;--ink:#e7eefb;--accent:#aac7ff}
.primary,.widget-controls button.primary,.widget-resize,.calculator-equals{background:var(--button-fill);color:var(--button-ink);border-color:var(--button-fill)}
.primary:hover,.widget-controls button.primary:hover,.calculator-equals:hover{background:var(--button-hover);color:var(--button-ink)}
:root[data-theme=dark][data-palette]:not([data-palette=dark]){--button-hover:var(--ink)}
.widget{background:var(--surface);color:var(--ink)}
.widget.selected{outline-color:var(--accent)}
.widget-handle:hover,.widget-focus:hover{background:var(--selected)}
.widget-resize{border-color:var(--page)}
.media-placeholder{color:var(--muted)}
.danger{color:var(--danger)}
#main-toolbar{border-color:var(--line)}
#toast{background:var(--ink);color:var(--surface)}
.theme-picker{left:50%;transform:translateX(-50%);padding:10px;display:grid;grid-template-columns:repeat(10,44px);gap:4px;max-width:calc(100vw - 16px);border-radius:18px;z-index:1000020;}
.theme-swatch{width:44px;height:44px;min-height:44px;padding:5px;border:2px solid transparent;background:transparent;border-radius:50%;color:var(--ink)}
.theme-swatch:hover{background:var(--selected)}
.theme-swatch[aria-pressed=true]{border-color:var(--accent);box-shadow:0 0 0 1px var(--surface)}
.theme-swatch svg{background:var(--surface);border-radius:50%;width:30px;height:30px;padding:4px;color:var(--ink)}
.theme-preview{display:block;width:30px;height:30px;border:1px solid var(--line);border-radius:50%;background:linear-gradient(145deg,var(--surface) 0 47%,var(--ink) 47% 59%,var(--surface) 59% 70%,var(--accent) 70% 82%,var(--surface) 82%)}
@media(max-width:560px){.theme-picker{grid-template-columns:repeat(5,44px)}}

:root[data-palette=rose],.theme-swatch[data-palette=rose]{--page:#f4e5ec;--surface:#fff3f8;--glass:#fff3f8f5;--ink:#4b2c3c;--muted:#795566;--line:#dfc1cf;--accent:#995272;--selected:#f2dbe6;--button-fill:#995272;--button-ink:#ffffff;--button-hover:#71364f;--shadow:0 14px 45px #49233720}
:root[data-palette=oled],.theme-swatch[data-palette=oled]{--page:#000000;--surface:#080808;--glass:#080808f5;--ink:#f1f1f1;--muted:#b4b4b4;--line:#383838;--accent:#b9ceef;--selected:#202733;--button-fill:#b9ceef;--button-ink:#000000;--button-hover:#f1f1f1;--shadow:0 14px 45px #0008}
.theme-picker{grid-template-columns:repeat(11,44px)}
.theme-editor-launch{border-radius:12px;color:var(--accent)}
@media(max-width:700px){.theme-picker{grid-template-columns:repeat(7,44px)}}
@media(max-width:390px){.theme-picker{grid-template-columns:repeat(5,44px)}}

.theme-editor{width:min(1060px,calc(100vw - 24px));max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);padding:22px;overflow:auto}
.theme-editor>header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.theme-editor h2{margin:0;font-size:22px}.theme-editor>header button{width:44px;height:44px;padding:10px}
.theme-editor-body{display:grid;grid-template-columns:clamp(220px,28vw,300px) minmax(0,1fr);gap:22px}.theme-editor-sidebar{display:flex;flex-direction:column;gap:12px;border-right:1px solid var(--line);padding-right:20px;min-width:0}.theme-editor-sidebar>input{width:100%}.theme-editor-list{overflow:auto;max-height:500px;flex:1;min-height:140px}
.theme-editor-pane{min-width:0}.theme-editor-details{display:flex;gap:10px;margin-bottom:14px}.theme-editor-details input{flex:1;width:0}.theme-editor-details select{max-width:110px}.theme-editor-colors{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.theme-editor label.theme-color-field{display:flex;flex-direction:row;align-items:center;gap:8px;min-height:48px;border:1px solid var(--line);padding:5px;border-radius:10px;font-size:12px}.theme-color-field input{width:36px;min-width:36px;height:36px;min-height:36px;padding:2px;border-radius:7px;cursor:pointer}.theme-editor p{font-size:12px;margin:10px 0;line-height:1.5}.theme-editor-status{min-height:18px}.theme-editor footer{display:flex;gap:8px;flex-wrap:wrap}.theme-editor footer .primary{margin-left:auto}.theme-contrast-note.low-contrast{font-weight:600}.theme-editor-empty{padding:8px}.theme-editor button,.theme-editor input:not([type=color]),.theme-editor select{min-height:44px}
.theme-wall-preview{background:var(--page);color:var(--ink);border:1px solid var(--line);border-radius:14px;padding:16px;overflow:hidden}.theme-demo-heading{display:flex;justify-content:space-between;gap:10px;font-weight:700;margin-bottom:14px;font-size:12px}.theme-demo-heading span{color:var(--muted);font-weight:400}.theme-demo-widgets{display:grid;grid-template-columns:1.2fr 1fr;gap:12px}.theme-demo-card{border:1px solid var(--line);border-radius:10px;background:var(--surface);min-width:0;overflow:hidden}.theme-demo-card header{display:flex;align-items:center;gap:6px;border-bottom:1px solid var(--line);padding:8px;font-size:10px;font-weight:700}.theme-demo-card svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.7}.theme-demo-content{padding:12px;font-size:13px}.theme-demo-content p{color:var(--muted);font-size:11px}.theme-demo-selection{display:block;padding:8px;border-radius:6px;background:var(--selected);color:var(--accent);font-size:11px}.theme-demo-timer{text-align:center}.theme-demo-timer small{color:var(--muted);font-size:9px}.theme-demo-timer strong{display:block;font-size:36px;line-height:1.4}.theme-demo-timer>div{display:flex;gap:6px;justify-content:center}.theme-demo-primary,.theme-demo-secondary{display:inline-block;border-radius:6px;padding:6px 8px;font-size:10px}.theme-demo-primary{background:var(--button-fill);color:var(--button-ink)}.theme-demo-secondary{background:var(--selected);color:var(--ink)}.theme-demo-toolbar{display:flex;gap:16px;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:10px 18px;width:fit-content;margin:14px auto 0}.theme-demo-toolbar svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7}
@media(max-width:680px){.theme-editor{padding:14px}.theme-editor-body{grid-template-columns:150px minmax(0,1fr);gap:12px}.theme-editor-sidebar{padding-right:10px}.theme-editor-colors{grid-template-columns:repeat(2,minmax(0,1fr))}.theme-demo-widgets{grid-template-columns:1fr}.theme-demo-widgets>section:first-child{display:none}}
@media(max-width:460px){.theme-editor-body{grid-template-columns:1fr}.theme-editor-sidebar{border-right:0;padding-right:0}.theme-editor-list{min-height:0;max-height:130px}.theme-editor-colors{grid-template-columns:repeat(2,minmax(0,1fr))}.theme-demo-widgets{grid-template-columns:1fr 1fr}.theme-demo-widgets>section:first-child{display:block}.theme-wall-preview{padding:10px}.theme-demo-content{padding:8px}.theme-demo-timer strong{font-size:28px}}



/* Reuse Data Sources list, action and footer controls. */
.theme-source-row>button:first-child{text-align:left}.theme-source-row .theme-preview{width:20px;height:20px;flex-shrink:0}.theme-source-name{min-width:0;overflow-wrap:anywhere}.theme-editor .source-actions{margin-top:auto}.theme-editor .data-editor-footer .theme-editor-status{flex:1;margin:0}.theme-editor .data-editor-footer{flex-wrap:wrap}.theme-editor .data-editor-footer .primary{margin-left:0}
