/* Full editing has its own blue surface; list editing and the chart keep their themes. */
:root[data-theme] .lesson-workbench .editor{--edit-bg:#f0f5fd;--edit-header:#e1ecfb;--edit-nav:#edf3fc;--edit-edge:#bdd0ed;--edit-heading:#17365e;--edit-accent:#245b9e;--edit-accent-ink:#fff;background:var(--edit-bg);border:2px solid #3168b8;border-radius:8px 8px 0 0;box-shadow:none}
:root[data-theme=dark] .lesson-workbench .editor{--edit-bg:#172435;--edit-header:#223955;--edit-nav:#1b3049;--edit-edge:#456589;--edit-heading:#e0edff;--edit-accent:#9dc9ff;--edit-accent-ink:#11263e;border-color:#709fd7}
:root[data-theme] .editor .editor-head{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:12px;align-items:center;background:var(--edit-header);border-bottom:1px solid var(--edit-edge);padding:10px 14px;color:var(--edit-heading)}
:root[data-theme] .editor .editor-head h2{color:var(--edit-heading);font-size:20px;line-height:1.25;margin:3px 0 0}
:root[data-theme] .editor .editor-head .eyebrow{color:var(--edit-accent);font-size:12px;font-weight:650}
.editor-mode-badge{display:inline-block;padding:2px 7px;background:var(--edit-accent);color:var(--edit-accent-ink);border-radius:3px;margin-right:7px;font-size:11px;vertical-align:middle}
:root[data-theme] .editor .editor-done{background:var(--edit-accent);color:var(--edit-accent-ink);border:0;padding:7px 14px;min-height:34px;font-size:13px;border-radius:4px}
.editor-done-short{display:none}
:root[data-theme] .editor .editor-head>[aria-label="Close exercise editor"]{background:transparent;color:var(--edit-heading);border:0;margin:0}
:root[data-theme] .editor .edit-nav{background:var(--edit-nav);border-bottom:1px solid var(--edit-edge);padding:5px 10px;gap:4px;flex-shrink:0}
:root[data-theme] .editor .edit-nav button{background:transparent;color:var(--edit-heading);padding:5px 10px;font-size:13px;min-height:32px}
:root[data-theme] .editor .edit-nav button[aria-pressed=true]{background:var(--edit-accent);color:var(--edit-accent-ink)}
:root[data-theme] .editor .edit-body{background:var(--edit-bg);padding:12px 16px;min-height:0}
:root[data-theme] .editor .field input,:root[data-theme] .editor .field textarea,:root[data-theme] .editor .field select,:root[data-theme] .editor .sc-surface{background:var(--surface)}
:root[data-theme] .editor .fcl-picker,:root[data-theme] .editor .exercise-tag-picker{background:var(--surface);border-color:var(--edit-edge);margin-bottom:10px;padding:8px 10px}
:root[data-theme] .editor .fcl-option{padding-block:4px}
:root[data-theme] .editor .editor-actions{background:var(--edit-header);border-top:1px solid var(--edit-edge);padding:8px 12px;flex-shrink:0}
:root[data-theme] .editor .editor-actions button{background:transparent}
.editor-content-columns{display:block}
.editor-column-heading{position:sticky;top:0;z-index:2;font-size:13px;line-height:1.4;font-weight:650;color:var(--edit-heading);background:var(--edit-bg);margin:0 0 8px;padding:3px 0 8px}
.editor-title-row{display:flex;align-items:flex-end;gap:12px;margin-bottom:10px;min-width:0}
:root[data-theme] .editor .editor-title-row>.field{flex:1;min-width:0;margin:0}
:root[data-theme] .editor .editor-title-row .title-picker .hint{display:none}
:root[data-theme] .editor .editor-title-row .mandatory-control{flex:none;margin:0;padding:0;border:0;background:transparent;min-height:36px;display:flex;align-items:center}
:root[data-theme] .editor .editor-title-row .mandatory-control .field{margin:0;min-height:36px;gap:6px}
:root[data-theme] .editor .editor-title-row .mandatory-control span{font-size:12px;white-space:nowrap}
:root[data-theme] .editor .editor-title-row input[role=switch],:root[data-theme] .editor .editor-reposition input[role=switch]{width:34px;flex:0 0 34px;height:22px;min-height:22px}
:root[data-theme] .editor .editor-title-row input[role=switch]:before,:root[data-theme] .editor .editor-reposition input[role=switch]:before{width:16px;height:16px;top:2px;left:2px}
:root[data-theme] .editor .editor-title-row input[role=switch]:checked:before,:root[data-theme] .editor .editor-reposition input[role=switch]:checked:before{transform:translateX(12px)}
.editor-script-pair{display:block}
:root[data-theme] .editor .exercise-script-column>.field textarea,:root[data-theme] .editor .editor-script-pair .field textarea{height:98px;min-height:98px;line-height:20px;padding:8px;font-size:14px;box-sizing:border-box;resize:vertical}
:root[data-theme] .editor .exercise-script-column .field{margin-bottom:9px}
:root[data-theme] .editor .exercise-script-column .sc-text-tools{margin-top:1px;gap:0 6px;flex-wrap:wrap}
:root[data-theme] .editor .exercise-script-column .sc-text-tools button{min-height:24px;padding-block:2px}
.editor-timing{padding:10px;background:var(--surface);border:1px solid var(--edit-edge);border-radius:5px;margin-bottom:12px}
.editor-timing h4{font-size:13px;color:var(--edit-heading);margin:0 0 10px}
.editor-timing-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:center;margin-top:6px}
.editor-timing-actions+.editor-timing-grid{margin-top:8px}
.editor-timing-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:start}
:root[data-theme] .editor .editor-profile-field{margin:0;gap:5px;min-width:0}
:root[data-theme] .editor .editor-profile-field>span:first-child{min-height:0;font-size:12px;font-weight:500;line-height:1.3}
.editor-profile-number{display:grid;grid-template-columns:minmax(0,1fr) 23px;gap:0;min-width:0}
:root[data-theme] .editor .editor-profile-number input{min-width:0;width:100%;height:38px;min-height:38px;padding:6px 8px;font-size:14px;appearance:textfield;border-radius:4px 0 0 4px;box-sizing:border-box}
.editor-profile-number input::-webkit-inner-spin-button{appearance:none}
.editor-profile-number>span{display:grid;grid-template-rows:repeat(2,1fr)}
:root[data-theme] .editor .editor-profile-number button{width:23px;min-width:23px;height:19px;min-height:19px;padding:0;line-height:1;font-size:11px;border-radius:0}
:root[data-theme] .editor .editor-maintain{align-self:center;justify-self:start;margin:0;padding:4px 8px;min-height:28px;border:1px solid var(--edit-edge);background:var(--surface);color:var(--edit-accent);font-size:12px}
:root[data-theme] .editor .editor-maintain[aria-pressed=true]{background:var(--edit-nav);font-weight:650}
:root[data-theme] .editor .editor-reposition{display:flex;align-items:center;flex-direction:row;gap:6px;margin:0;padding:0;min-height:32px}
:root[data-theme] .editor .editor-reposition>span{font-size:12px;white-space:nowrap;line-height:1.4}
.editor-reposition-location{font-size:12px;line-height:1.4;color:var(--secondary);padding-top:22px}
.editor .exercise-more{margin-top:12px}
@media(min-width:951px) and (orientation:landscape),(min-width:951px) and (hover:hover) and (pointer:fine){
 :root[data-theme] .lesson-workbench:has(.editor) #profile-wrap{position:fixed;inset:0 8px auto;height:50dvh;z-index:7;margin:0;border-radius:0;box-sizing:border-box}
 :root[data-theme] .lesson-workbench:has(.editor) #profile-wrap #profile-panel[open]{height:100%;max-height:100%;padding:6px 8px;overflow:hidden}
 :root[data-theme] .lesson-workbench:has(.editor) #profile-wrap #profile-panel::details-content{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}
 :root[data-theme] .lesson-workbench:has(.editor) #profile-wrap #profile-panel .profile-body{height:calc(50dvh - 64px);max-height:none;flex:none;display:flex;flex-direction:column;min-height:0;overflow:hidden}
 :root[data-theme] .lesson-workbench:has(.editor) #profile-wrap #profile-panel .profile-chart-scroll{display:flex;height:0;flex:1 1 0;min-height:0;max-height:none;overflow:auto}
 :root[data-theme] .lesson-workbench:has(.editor) #profile-wrap #profile-panel .chart.source-profile{height:100%;min-height:0;max-height:none;width:100%;min-width:0;aspect-ratio:auto;flex:1}
 :root[data-theme] .lesson-workbench:has(.editor) #profile-format-toolbar{height:132px;min-height:132px;max-height:132px;overflow:auto;flex:none}
 :root[data-theme] .lesson-workbench:has(.editor) .profile-body:has(>.profile-label-toolbar:not([hidden])):not(:has(>#profile-format-toolbar))::before{content:'';display:block;height:132px;flex:0 0 132px;margin-bottom:4px}
 :root[data-theme] .lesson-workbench .editor{position:fixed;inset:50dvh 8px 0;z-index:7;width:auto;max-width:none;height:50dvh;max-height:50dvh;box-sizing:border-box;padding:0}
 :root[data-theme]:has(.lesson-workbench .editor) .backdrop{display:none}
 :root[data-theme] .editor[data-editor-tab=Content] .edit-body{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden;padding:10px 10px 0}
 .editor[data-editor-tab=Content] .editor-content-columns{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,3fr);gap:14px;flex:1;min-height:0;overflow:hidden;align-items:stretch}
 .editor .exercise-setup-column,.editor .exercise-script-column{min-height:0;min-width:0;overflow-y:auto;overscroll-behavior:contain;padding:0 8px 16px;scrollbar-gutter:stable;scrollbar-color:#809bbf var(--edit-nav)}
 .editor .exercise-setup-column::-webkit-scrollbar,.editor .exercise-script-column::-webkit-scrollbar{width:9px}
 .editor .exercise-setup-column::-webkit-scrollbar-thumb,.editor .exercise-script-column::-webkit-scrollbar-thumb{background:#809bbf;border:2px solid var(--edit-nav);border-radius:5px}
 .editor .editor-script-pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;align-items:start}
 .editor-script-pair>*{min-width:0}
}
@media(max-width:650px){
 :root[data-theme] .editor .editor-head{padding:8px 10px;gap:6px}
 :root[data-theme] .editor .editor-head h2{font-size:18px}
 .editor-done-wide{display:none}.editor-done-short{display:inline}
 :root[data-theme] .editor .editor-done{padding:6px 10px;min-height:36px}
 :root[data-theme] .editor .edit-body{padding:10px}
 :root[data-theme] .editor .exercise-script-column .field textarea{font-size:16px}
}
@media(any-pointer:coarse){
 :root[data-theme] .editor .editor-title-row .mandatory-control,:root[data-theme] .editor .editor-title-row .mandatory-control .field{min-height:44px}
 :root[data-theme] .editor .editor-profile-number input{min-height:44px;height:44px;font-size:16px}
 :root[data-theme] .editor .editor-profile-number button{height:22px;min-height:22px}
}

/* Editor field surfaces must not override switch tracks. Shape and position show state too. */
:root[data-theme] .editor .field.switch-field input[role=switch]{background:#738294;border-color:#566779}
:root[data-theme] .editor .field.switch-field input[role=switch]:before{background:#fff;box-shadow:none;border:1px solid #566779;box-sizing:border-box}
:root[data-theme] .editor .field.switch-field input[role=switch]:checked{background:var(--edit-accent);border-color:var(--edit-accent)}
:root[data-theme] .editor .field.switch-field input[role=switch]:checked:before{background:var(--edit-accent-ink);border-color:var(--edit-accent-ink)}
@media(any-pointer:coarse){:root[data-theme] .editor .editor-timing-actions .editor-reposition{min-height:44px}}

/* Each parameter owns its label, controls and state. Preserve the approved blue editor shell. */
.editor{--parameter-bg:#f7f9fc;--parameter-edge:#d5dce5;--parameter-ink:#24364b;--group-head:#e5ebf3}
:root[data-theme=dark] .editor{--parameter-bg:#202c3b;--parameter-edge:#526174;--parameter-ink:#e0e8f3;--group-head:#293b50}
:root[data-theme] .editor :is(.exercise-more,.editor-advanced,.editor-condition-card){border:1px solid var(--parameter-edge);border-radius:6px;background:var(--surface);padding:0;overflow:hidden;margin:0 0 12px}
:root[data-theme] .editor :is(.exercise-more,.editor-advanced,.editor-condition-card)>summary{padding:12px;background:var(--group-head);font-size:14px;font-weight:700;color:var(--parameter-ink);margin:0;line-height:1.4}
.editor :is(.editor-advanced,.editor-instructor-controls)>summary>span{display:block;font-size:11px;font-weight:400;margin-top:4px;color:var(--secondary)}
.editor-setting-section{padding:14px;border-bottom:1px solid var(--parameter-edge)}
.editor-setting-section h4{margin:0 0 12px;font-size:14px;color:var(--parameter-ink)}
.editor-settings-grid,.editor-condition-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.editor-settings-wide{grid-column:1/-1;min-width:0}
:root[data-theme] .editor .editor-setting-section .field,:root[data-theme] .editor .condition-parameter{padding:10px;background:var(--parameter-bg);border:1px solid var(--parameter-edge);border-radius:5px;min-width:0;margin:0;display:flex;flex-direction:column;gap:7px}
:root[data-theme] .editor .editor-setting-section .field>span:first-child,:root[data-theme] .editor .condition-parameter .field>span:first-child{font-size:13px;font-weight:650;color:var(--parameter-ink);min-height:0}
.editor .editor-setting-section .field .field{padding:0;border:0;background:none}
:root[data-theme] .editor .editor-setting-section .sc-surface,:root[data-theme] .editor .condition-parameter .sc-surface{background:transparent;margin:0;padding:0;min-width:0}
:root[data-theme] .editor .editor-setting-section .sc-segments button{border:1px solid var(--parameter-edge);background:var(--surface);color:var(--parameter-ink);padding:6px 9px;min-height:34px;margin:0}
:root[data-theme] .editor .editor-setting-section .sc-segments button[aria-pressed=true]{background:var(--edit-accent);border-color:var(--edit-accent);color:var(--edit-accent-ink)}
.editor .editor-setting-section .sc-segments{gap:5px;flex-wrap:wrap}
:root[data-theme] .editor .editor-setting-section .sc-competencies{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
:root[data-theme] .editor .editor-setting-section .sc-competencies button{padding:2px 0;background:none!important;color:var(--parameter-ink)!important;border:0!important;display:flex;align-items:center;gap:7px;min-height:30px;justify-content:flex-start;font-size:12px;font-weight:400}
.editor .sc-competencies button:before{content:'';width:16px;height:16px;border:1px solid #9aabbe;border-radius:3px;background:var(--surface);flex:none;box-sizing:border-box}
.editor .sc-competencies button[aria-pressed=true]:before{content:'✓';background:var(--edit-accent);border-color:var(--edit-accent);color:var(--edit-accent-ink);line-height:14px;text-align:center}
:root[data-theme] .editor .mode-switch{display:flex;gap:6px;margin:0;flex-wrap:wrap}
:root[data-theme] .editor .mode-switch label{margin:0;padding:6px 9px;border:1px solid var(--parameter-edge);border-radius:4px;background:var(--surface);font-size:12px;display:flex;align-items:center;gap:5px}
:root[data-theme] .editor .mode-switch label:has(input:checked){background:var(--edit-accent);color:var(--edit-accent-ink);border-color:var(--edit-accent)}
.editor .mode-switch input{width:15px!important;height:15px!important;min-height:15px!important;accent-color:var(--edit-accent);margin:0}
.editor .editor-instructor-controls{padding:12px;background:var(--parameter-bg)}
.editor .editor-instructor-controls>summary{font-size:13px;font-weight:650;color:var(--parameter-ink)}
.editor .editor-instructor-controls .field{margin-top:10px}
.editor .editor-advanced>.pointcard,.editor .editor-advanced>.notice,.editor .editor-advanced>.hint{margin:12px}
.editor .editor-advanced>button{margin:10px 12px}
:root[data-theme] .editor .editor-timing{background:var(--surface);border-color:var(--parameter-edge);padding:12px}
.editor .editor-timing h4{font-size:14px}
:root[data-theme] .editor .editor-timing .editor-profile-field{background:var(--parameter-bg);border:1px solid var(--parameter-edge);padding:9px;border-radius:5px}
.editor-reposition-destination{margin-top:10px;padding:10px;border:1px solid var(--edit-edge);border-radius:5px;background:var(--parameter-bg)}
.editor .editor-reposition-destination .field{min-width:0;margin:0 0 10px;gap:6px}
.editor .editor-reposition-destination :is(input,select){width:100%;min-width:0;min-height:38px;font-size:14px}
.editor .editor-reposition-destination .field>span:first-child{font-size:13px;font-weight:650}
:root[data-theme] .editor .fcl-dropdown{padding:0;margin:0 0 12px;border:0;background:transparent}
.fcl-field-label{display:block;font-size:13px;margin:0 0 7px;color:var(--parameter-ink)}
:root[data-theme] .editor .fcl-dropdown-trigger{display:flex;width:100%;min-height:42px;align-items:center;justify-content:space-between;gap:8px;border:1px solid #9aafca;background:var(--surface);border-radius:5px;padding:8px;color:var(--parameter-ink)}
.fcl-chips{display:flex;flex-wrap:wrap;gap:5px}.fcl-chip{padding:3px 7px;background:var(--edit-nav);color:var(--edit-heading);border-radius:3px;font-size:12px}
:root[data-theme] .editor .fcl-dropdown-panel{position:fixed;z-index:35;background:var(--surface);border:1px solid #9aafca;border-radius:5px;box-shadow:0 5px 18px #172b4326;padding:10px;overflow:auto;margin:0;box-sizing:border-box}
.fcl-dropdown-panel[hidden]{display:none!important}
:root[data-theme] .editor .fcl-dropdown-panel>input{width:100%;font-size:14px;min-height:40px;margin-bottom:8px}
.fcl-dropdown-meta,.fcl-dropdown-footer{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:12px;color:var(--secondary);padding:5px 0}
:root[data-theme] .editor .fcl-dropdown-meta button{padding:0;min-height:28px;background:none;color:var(--edit-accent);text-decoration:underline;font-size:12px}
:root[data-theme] .editor .fcl-dropdown-footer button{padding:6px 12px;background:var(--edit-accent);color:var(--edit-accent-ink);font-size:12px}
.editor .fcl-dropdown-panel .fcl-options{max-height:none;overflow:visible;margin:0}
.editor .fcl-dropdown-panel .fcl-option{display:grid;grid-template-columns:18px 42px minmax(0,1fr);gap:8px;padding:10px 5px;align-items:start;border-bottom:1px solid var(--parameter-edge);font-size:13px}
.editor .fcl-option:has(input:checked){background:var(--edit-nav)}
.editor .fcl-dropdown-panel .fcl-option input{width:16px;height:16px;min-height:16px;accent-color:var(--edit-accent);margin:1px 0 0}
.editor .fcl-dropdown-panel .fcl-label small{font-size:11px}.editor .fcl-dropdown-panel .fcl-code{font-size:13px}
.editor-conditions-columns{display:grid;gap:14px;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);align-items:start}
.editor-conditions-columns>*{min-width:0}
.editor .editor-condition-fields{padding:12px}
:root[data-theme] .editor .condition-parameter .field{margin:0;min-width:0;gap:7px}
.editor .condition-parameter:has([data-condition-key=wx]),.editor .condition-parameter:has(textarea),.editor .condition-parameter[data-condition-key=wind],.editor .condition-parameter[data-condition-key=surface],.editor .condition-parameter[data-condition-key=cloud],.editor .condition-parameter[data-condition-key=position]{grid-column:1/-1}
:root[data-theme] .editor .condition-parameter.is-override{background:var(--edit-nav);border-color:#85a8d5}
.condition-field-state{display:flex;justify-content:space-between;gap:6px;font-size:11px;color:var(--secondary);line-height:1.4}
.condition-parameter.is-override .condition-field-state>span{font-weight:600;color:var(--edit-accent)}
:root[data-theme] .editor .condition-field-state button{font-size:11px;background:none;color:var(--edit-accent);text-decoration:underline;padding:0;min-height:20px}
.editor .condition-calculated{margin:0 12px 12px;padding:10px;background:var(--parameter-bg);font-size:13px;display:flex;justify-content:space-between;gap:8px}
.editor .editor-condition-card>summary{display:flex;align-items:center;justify-content:space-between;gap:8px}
.editor .editor-condition-card .condition-summary{font-size:11px;font-weight:400;white-space:normal;text-align:right}
@media(max-width:950px){.editor-conditions-columns{grid-template-columns:1fr}}
@media(max-width:650px){.editor .editor-reposition-destination :is(input,select),.editor .fcl-dropdown-panel>input{font-size:16px;min-height:44px}.editor .editor-settings-grid{grid-template-columns:1fr}.editor .fcl-dropdown-panel .fcl-option{padding-block:12px}.editor .editor-condition-fields{grid-template-columns:1fr}.editor .editor-advanced>summary>span{max-width:100%}}
:root[data-theme] .editor .fcl-dropdown-panel:not([hidden]){display:flex;flex-direction:column;gap:4px}
.editor .fcl-dropdown-panel .fcl-options{flex:1;min-height:80px;overflow:auto;overscroll-behavior:contain}
.editor .fcl-dropdown-panel>:not(.fcl-options){flex:none}
:root[data-theme] .editor .fcl-dropdown-meta button{border:0;box-shadow:none}
.editor .fcl-dropdown-footer{background:var(--surface);padding-top:8px;border-top:1px solid var(--parameter-edge)}

/* Short charts return unused space to the full editor; zoomed charts retain the half-screen cap. */
@media(min-width:951px) and (orientation:landscape),(min-width:951px) and (hover:hover) and (pointer:fine){
 :root[data-theme] .lesson-workbench:has(.editor) #profile-wrap{height:var(--profile-editor-height,50dvh)}
 :root[data-theme] .lesson-workbench:has(.editor) #profile-wrap #profile-panel .profile-body{height:auto;flex:1;min-height:0;max-height:none}
 :root[data-theme] .lesson-workbench .editor{top:var(--profile-editor-height,50dvh);height:calc(100dvh - var(--profile-editor-height,50dvh));max-height:calc(100dvh - var(--profile-editor-height,50dvh))}
}

:root[data-theme] .editor [data-condition-key=wx] textarea::placeholder{color:var(--secondary);opacity:.8}
