/* Give the inspector the available screen; keep a smaller live preview beside it. */
body.editor-open{overflow:hidden}
.editor-open .studio-header{height:48px;max-width:none;padding:0 16px}
.editor-open .studio,.editor-open.clean .studio{display:grid;grid-template-columns:min(24vw,340px,calc((100dvh - 98px)*9/16)) minmax(0,1fr);width:100%;height:calc(100dvh - 48px);max-width:none;margin:0;padding:12px 16px;gap:16px;align-items:start;justify-content:stretch}
.editor-open .preview-column,.editor-open.clean .preview-column{width:100%;min-width:0;margin:0;align-self:center}
.editor-open .director{display:none}
#settings-dialog{position:static;margin:0;padding:0;width:100%;min-width:0;max-width:none;max-height:none;height:100%;min-height:0;border:1px solid #375060;border-radius:12px;background:#122332;color:#d9e5e9;font:13px/1.45 'PW Lilita',sans-serif;box-shadow:0 16px 55px #0003;overflow:hidden;container-type:inline-size}
#settings-dialog[open]{display:flex;flex-direction:column}
#settings-dialog:not([open]){display:none}
#settings-dialog header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;border:0;flex-shrink:0}
#settings-dialog header small{color:#7ea5ae;font-size:9px;letter-spacing:2px}
#settings-dialog h2{margin:2px 0 0;font-size:22px;color:#f7e5ba;font-weight:400}
#settings-dialog button{background:#1d3445;border:1px solid #3a5362;color:#d9e5e9;border-radius:5px;padding:8px 11px;font:inherit;white-space:nowrap}
#settings-dialog button:hover:not(:disabled){background:#294759;border-color:#719195}
#settings-dialog button:disabled{opacity:.35}
#settings-dialog #close-settings{font-size:24px;width:34px;height:34px;line-height:20px;padding:0}
#settings-dialog .editor-toolbar{display:flex;align-items:center;gap:6px;margin-left:auto}
#settings-dialog .editor-toolbar button{font-size:12px;padding:6px 9px}
#config-save-state{margin-left:6px;font-size:10px;color:#95b9ad}
#settings-dialog .editor-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;padding:6px 16px;background:#0f1e2b;border-block:1px solid #2b414f;flex-shrink:0}
#settings-dialog .editor-tabs button{background:transparent;border-color:transparent;padding:7px 4px;color:#92aeba}
#settings-dialog .editor-admin{display:flex;align-items:center;gap:8px;padding:8px 16px;flex-shrink:0;border-bottom:1px solid #304b5b;background:#142b39}
.editor-admin>span{margin-right:auto;font-size:11px;color:#b7cbd1}
#settings-dialog .editor-admin button{font-size:12px;padding:7px 10px;white-space:normal;min-width:0}
#settings-dialog #save-tab-defaults{border-color:#817454;color:#f2d89e}
#settings-dialog .editor-published-admin{flex-wrap:wrap;align-items:center;background:#203034;border-color:#716342}
.editor-published-admin-copy{flex:1 1 220px;min-width:0}
.editor-published-admin-copy>span{display:block;color:#f2d89e;font-size:12px}
.editor-published-admin-copy>small{display:block;color:#b7cbd1;font-size:10px;overflow-wrap:anywhere}
.editor-published-admin-actions{display:flex;flex:1 1 400px;gap:6px;flex-wrap:wrap;align-items:center}
#settings-dialog .editor-published-admin-actions button{flex:1 1 auto}
#settings-dialog #published-admin-save-tab,#settings-dialog #published-admin-save-all{border-color:#817454;color:#f2d89e}
#settings-dialog [aria-pressed=true]{background:#334649!important;color:#ffe5a2!important;border-color:#827857!important}
.editor-scroll{overflow-y:auto;min-height:0;flex:1;padding:16px;scrollbar-color:#436373 #132b3a;scrollbar-width:thin;scrollbar-gutter:stable}
#settings-dialog .editor-section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:4px 0 8px}
#settings-dialog h3{font-size:17px;letter-spacing:0;margin:0;font-weight:400;color:#e5edf0;display:block}
.editor-section-heading>span{font-size:9px;color:#91c8b5;letter-spacing:1px;border:1px solid #36665d;border-radius:4px;padding:2px 5px}
#settings-dialog .editor-help,#settings-dialog .setup-library p{font-size:12px;line-height:1.55;color:#8facb8;margin:0 0 12px}
#settings-dialog input,#settings-dialog select,#settings-dialog textarea{font:inherit;background:#0b1b27;border:1px solid #375263;color:#f2e8d1;border-radius:5px;padding:8px 10px;min-width:0;width:100%;outline-offset:2px;accent-color:#d9be79}
#settings-dialog input:focus,#settings-dialog select:focus,#settings-dialog textarea:focus{outline:1px solid #e7c875}
#settings-dialog label{font-size:12px;color:#a7c0c9;display:flex;flex-direction:column;gap:5px;margin-bottom:12px;min-width:0}
#settings-dialog .editor-field-help{font:11px/1.45 system-ui,sans-serif;color:#9db5c1;display:block;margin-top:-1px}
.editor-field-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 16px}
#settings-dialog .audio-selector{margin-top:16px}
#settings-dialog .editor-check{flex-direction:row;align-items:center;margin:17px 0}
#settings-dialog input[type=checkbox]{width:17px;height:17px;flex:none;margin:0 5px 0 0}
#settings-dialog footer{border-top:1px solid #304b5b;padding:10px 16px;display:block;margin:0;background:#10212e;flex-shrink:0}
#settings-dialog #settings-status{font-size:11px;line-height:1.4;color:#9ab4bd;margin:0 0 4px;overflow-wrap:anywhere}
#config-pending{font-size:11px;color:#83b9a0;margin-bottom:8px}
#config-pending.pending{color:#f0c278}
.editor-actions{display:flex;gap:7px;margin:10px 0;flex-wrap:wrap}
#settings-dialog footer .editor-actions{margin:0;flex-wrap:nowrap}
#settings-dialog footer button{flex:1}
#settings-dialog button.settings-done{background:#e5bb70;color:#152c39;border-color:#f5d89b}
#settings-dialog button.settings-done:hover:not(:disabled){background:#f1ce85;color:#152c39;border-color:#ffe5ac}
.setup-library{border-top:1px solid #304b5b;margin-top:22px;padding-top:15px}
.setup-library summary{color:#d9c792;cursor:pointer;margin-bottom:14px}
#settings-dialog .editor-reset{margin-top:20px;background:transparent;color:#9db5bf}
.enemy-workspace{display:grid;gap:16px;align-items:start}
.enemy-roster,#enemy-fields{min-width:0}
#enemy-fields{container-type:inline-size}
.enemy-layout{display:grid;grid-template-columns:minmax(0,220px) minmax(0,1fr);gap:10px;align-items:start}
#spawn-map{width:100%;height:auto;touch-action:none;cursor:crosshair;user-select:none;display:block}
#spawn-map [data-enemy]{cursor:grab}
.enemy-list{max-height:270px;overflow-y:auto}
#settings-dialog .enemy-list button{width:100%;display:flex;gap:8px;align-items:center;text-align:left;margin-bottom:5px;white-space:normal;padding:8px;font-size:11px}
.enemy-list b{color:#edc67d;font-weight:400}.enemy-list small{font-size:9px;display:block;color:#99b4bd;margin-top:3px}
.upgrade-roadmap{line-height:2.7;color:#b6ced5;background:#0d1f2c;border-radius:6px;padding:8px 14px;margin:12px 0}
.upgrade-roadmap b{display:inline-block;text-align:center;min-width:24px;border-radius:50%;background:#244c60;line-height:24px;margin:0 8px 0 5px;color:#f4d28b}
.editor-open.clean .studio{height:100dvh}
.editor-open.clean .exit-clean{display:none}
.editor-open.public-playtest .studio{height:calc(100dvh - 46px)}
@container(min-width:600px){
  #settings-dialog .editor-tabs{grid-template-columns:repeat(7,minmax(0,1fr))}
  .editor-field-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .editor-footer-content{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 18px;align-items:center}
  .editor-footer-content .editor-actions{grid-column:2;grid-row:1 / 3}
  #config-pending{margin-bottom:0}
}
@container(min-width:860px){
  .enemy-workspace{grid-template-columns:240px minmax(0,1fr);gap:24px}
  .enemy-roster{position:sticky;top:0}
  .enemy-layout{grid-template-columns:minmax(0,1fr)}
  .enemy-list{max-height:220px}
}
@container(min-width:1000px){.editor-field-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
@container(max-width:599px){#config-save-state{display:none}}
@container(max-width:450px){.editor-admin>span{display:none}#settings-dialog .editor-admin button{flex:1}}
@container(max-width:370px){
  .editor-field-grid{grid-template-columns:minmax(0,1fr)}
  #settings-dialog header{gap:6px;padding:8px 12px}
  #settings-dialog h2{font-size:19px}
  #settings-dialog header small{font-size:8px;letter-spacing:1px}
  #settings-dialog button{white-space:normal}
  #settings-dialog .editor-toolbar button{padding:6px}
}
@media(max-width:700px){
  .editor-open .studio-header,.editor-open .preview-column{display:none}
  .editor-open .studio,.editor-open.clean .studio{grid-template-columns:minmax(0,1fr);height:100dvh;padding:8px;gap:0}
  .editor-open.public-playtest .studio{height:calc(100dvh - 46px)}
}
