:root{font:14px/1.5 system-ui,sans-serif;color:#25354a;background:#f3f6f9;--accent:#136b61;--border:#d5dee7}
*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button,select{min-height:34px;max-width:100%;border:1px solid var(--border);border-radius:5px;background:white;color:inherit;padding:5px 10px}button{cursor:pointer}button:hover{background:#e9f3f1}button:disabled{opacity:.45;cursor:default}button[aria-selected=true]{background:#e2f1ed;color:#07584f;border-color:#9cc9bf}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #6baca3;outline-offset:2px}[hidden]{display:none!important}
header{display:flex;align-items:center;justify-content:space-between;padding:14px 22px;background:white;border-bottom:1px solid var(--border);gap:1rem}.brand{color:var(--accent);font-size:23px;font-weight:700;text-decoration:none}.brand small{font-size:13px;color:#617389;margin-left:10px;font-weight:400}#save-status{color:#617389;font-size:12px}
.menu,.run-toolbar{display:flex;gap:7px;align-items:center;flex-wrap:wrap;padding:10px 18px;border-bottom:1px solid var(--border);background:white}.menu .gallery{margin-left:auto;border:2px solid #a17d35;background:#fff6df;color:#65480e;font-weight:700}.run-toolbar{background:#f8fafb}.run-toolbar select{max-width:290px}#run{background:var(--accent);color:white}#status{margin-left:auto;font-size:12px}
.workbench{display:grid;grid-template-columns:230px minmax(0,1fr) 280px;grid-template-areas:'project document inspector' 'project results inspector';gap:12px;padding:12px}.project-panel,.document-panel,.inspector,.results{background:white;border:1px solid var(--border);border-radius:7px;min-width:0}.project-panel{grid-area:project;padding:14px;overflow:auto}.document-panel{grid-area:document;overflow:hidden}.inspector{grid-area:inspector;padding:10px;overflow:auto}.results{grid-area:results;padding:12px;max-height:340px;overflow:auto}h1{font-size:17px;margin:0 0 12px;overflow-wrap:anywhere}h2{font-size:13px;color:#65768a;margin:10px 0;text-transform:uppercase;letter-spacing:.05em}.file-actions{display:grid;gap:6px;margin-top:20px}#tree-mode{width:100%;margin:5px 0 12px}#project-tree details{padding-left:8px}#project-tree summary{padding:5px 0;cursor:pointer}#project-tree button{display:block;border:0;text-align:left;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}#project-tree .selected{background:#e2f1ed;font-weight:600}.future{color:#8491a0;font-size:12px;padding:8px}#document-tabs{display:flex;overflow:auto;gap:2px;background:#f5f8fa;min-height:38px}#document-tabs button{white-space:nowrap;border-radius:0}.view-tabs,.inspector-tabs{display:flex;gap:4px;border-bottom:1px solid var(--border);padding:6px}.view-tabs button,.inspector-tabs button{border:0;font-size:13px}#editor,#plain-editor,#preview-panel{height:480px;width:100%}#plain-editor{resize:vertical;padding:16px;border:0;font:14px/1.65 Consolas,monospace;white-space:pre;tab-size:4}#preview-frame{width:100%;height:100%;border:0}#preview-message{padding:20px}#photos-panel{padding:15px;min-height:480px;max-height:650px;overflow:auto}#photos-panel label{display:block;margin-bottom:12px}#photo-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px}#photo-list figure{margin:0;padding:8px;border:1px solid var(--border)}#photo-list img{width:100%;height:150px;object-fit:contain}#photo-list figcaption{overflow-wrap:anywhere;font-size:12px}#photo-list button{margin:2px;font-size:12px}#output{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;font:13px/1.6 Consolas,monospace}#errors button{display:block;color:#a43131;text-align:left;margin:4px 0}#properties{padding:8px}#properties label{display:block;margin:8px 0}#properties input{width:100%;border:1px solid var(--border);padding:6px}#variables{font:12px/1.6 Consolas,monospace;overflow-wrap:anywhere}#frames{width:100%}#breakpoints button{display:block;font-size:12px;margin:3px 0}dialog{max-width:min(740px,94vw);max-height:85vh;overflow:auto;border:1px solid var(--border);border-radius:10px;padding:22px;color:inherit}dialog::backdrop{background:#15253870}#chooser-items{display:grid;gap:10px;margin:12px 0}#chooser-items article{border:1px solid var(--border);border-radius:6px;padding:12px}#chooser-items h3{margin:0;font-size:16px}#chooser-items p{margin:6px 0}#chooser-items pre{max-height:160px;overflow:auto;font-size:12px}.basic-dialog{width:440px}.basic-dialog input{display:block;width:100%;padding:8px;margin:12px 0}.dialog-actions{display:flex;gap:8px;margin:12px 0}.basic-dialog .primary{background:var(--accent);color:white}
@media(max-width:1100px){.workbench{grid-template-columns:180px minmax(0,1fr);grid-template-areas:'project document' 'project inspector' 'project results'}.inspector{max-height:320px}}
@media(max-width:650px){header{padding:12px}.brand small{display:none}.menu,.run-toolbar{padding:8px}.menu button,.run-toolbar button{font-size:12px}.menu .gallery{margin-left:0}.workbench{padding:6px;gap:8px;grid-template-columns:minmax(0,1fr);grid-template-areas:'project' 'document' 'inspector' 'results'}.project-panel{max-height:220px}.project-panel h1{display:inline-block;margin-right:12px}.file-actions{display:flex;margin-top:8px}#tree-mode{width:auto}.run-toolbar select{max-width:calc(100vw - 100px)}#editor,#plain-editor,#preview-panel{height:410px}.view-tabs button{min-height:38px}.results{min-height:180px}.inspector{max-height:320px}}

.takeoff-breakpoint{background:#b44949;border-radius:50%;width:10px!important;height:10px!important;margin-top:5px;margin-left:4px}.takeoff-current-line{background:#fff0be}

#properties select{width:100%}#properties input[type=checkbox]{width:auto}#properties button{margin:3px 2px 3px 0}#properties p{overflow-wrap:anywhere}

#preview-panel{display:flex;flex-direction:column}#preview-frame{flex:1;min-height:0}.preview-toolbar{display:flex;gap:4px;flex-wrap:wrap;padding:6px;border-bottom:1px solid var(--border)}.preview-toolbar button{font-size:12px}.preview-toolbar span{flex-basis:100%;font-size:11px;overflow-wrap:anywhere;color:#617389}.variable-children{padding:5px 0 5px 12px;border-left:2px solid var(--border)}#chooser label{display:block}#chooser input:not([type=checkbox]),#chooser select{display:block;width:100%;padding:6px}

#photo-translation{margin-top:16px;border-top:1px solid var(--border);padding-top:12px}#photo-translation button{margin:4px}#photo-code{display:block;width:100%;height:260px;font:13px/1.5 Consolas,monospace}#photo-translation pre{white-space:pre-wrap;overflow-wrap:anywhere}

#document-tabs > span{display:flex;flex-shrink:0}#image-panel{height:480px;padding:16px;overflow:auto}#project-image{display:block;max-width:100%;max-height:100%;object-fit:contain;margin:auto}#properties input[type=checkbox]{width:auto}

#assistance-dialog { width: min(760px, 94vw); max-height: 90vh; }
#assistance-search { width: 100%; box-sizing: border-box; }
#assistance-items { max-height: 60vh; overflow-y: auto; }
#assistance-items article { padding: 1rem 0; border-bottom: 1px solid #dde4e9; }
#assistance-items h3 { margin: 0 0 .5rem; }
#assistance-items pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #f5f7fa; padding: .75rem; }
/* One menu surface on desktop and touch screens; submenus never overflow sideways. */
.editor-context-menu { position:fixed; z-index:10000; min-width:280px; max-width:calc(100vw - 8px); max-height:calc(100dvh - 8px); overflow:auto; padding:5px; background:#fff; color:#172b3a; border:1px solid #9aabb8; border-radius:6px; box-shadow:0 5px 22px #0003; }
.editor-context-menu[hidden] { display:none; }
.editor-context-menu button { display:flex; justify-content:space-between; gap:20px; width:100%; border:0; background:transparent; text-align:left; padding:8px; color:inherit; }
.editor-context-menu button:hover:not(:disabled),.editor-context-menu button:focus-visible { background:#e5f1ff; outline:2px solid #1762a0; outline-offset:-2px; }
.editor-context-menu button:disabled { opacity:.45; }
.editor-context-menu .shortcut { font-size:.85em; white-space:nowrap; }
.editor-context-menu hr { border:0; border-top:1px solid #ddd; margin:4px; }
#editor-menu-button { justify-self:end; margin:3px 6px; }
#rename-symbol-dialog label { display:grid; gap:8px; }
#rename-symbol-dialog button { margin:10px 8px 0 0; }
#language-help { padding:10px; overflow:auto; }
#chooser-error { padding:12px; border:2px solid #a43131; border-radius:6px; background:#fff2f0; color:#802323; overflow-wrap:anywhere; }
#chooser-error:focus { outline:2px solid #802323; outline-offset:2px; }
/* Keep start errors prominent and usable with keyboard, touch and long messages. */
#start-error-dialog { width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-sizing: border-box; padding: 20px; border: 2px solid #a43131; border-radius: 8px; color: #172b3a; background: #fff; overflow: auto; }
#start-error-dialog::backdrop { background: #172b3a99; }
#start-error-title { margin-top: 0; color: #802323; }
#start-error-list { max-height: 45vh; overflow: auto; padding: 8px 8px 8px 28px; background: #fff2f0; overflow-wrap: anywhere; }
#start-error-list li { margin: 8px 0; white-space: pre-wrap; }
#start-error-list button { width: 100%; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 44px; }
#start-error-close { min-height: 44px; }
#start-error-dialog button:focus-visible { outline: 2px solid #1762a0; outline-offset: 2px; }
#start-target-notice { padding: 10px; border-left: 4px solid #996300; background: #fff4d6; color: #573900; overflow-wrap: anywhere; }
#reset-dialog { width: min(620px, calc(100vw - 32px)); }
#reset-dialog p { overflow-wrap: anywhere; }
#reset-dialog h2 { color: #802323; font-size: 1.2rem; }
#reset-confirm { background: #a43131; color: white; }
#reset-status { padding: 10px; background: #fff4d6; }
#read-only-dialog { width: min(620px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-sizing: border-box; overflow: auto; border: 2px solid #996300; }
#read-only-dialog::backdrop { background: #172b3a99; }
#read-only-dialog h2 { margin-top: 0; color: #573900; }
#read-only-dialog p { overflow-wrap: anywhere; }
#read-only-confirm { min-height: 44px; }
/* Execution is a separate, non-modal surface. The IDE/debugger remains reachable. */
#execution-dialog { position:fixed; inset:12vh 3vw auto; margin:0 auto; width:94vw; max-width:1200px; height:82vh; height:82dvh; max-height:86dvh; padding:0; border:1px solid #6e8599; border-radius:8px; box-shadow:0 12px 60px #0007; z-index:2000; background:white; color:#172b3a; }
#execution-dialog[open] { display:flex; flex-direction:column; }
.execution-heading { display:flex; align-items:center; flex-wrap:wrap; gap:8px; padding:10px; background:#e5f1ff; }
.execution-heading h2 { flex:1; margin:0; font-size:1.1rem; }
#execution-frame { flex:1; min-height:0; width:100%; border:0; background:white; }
#execution-address { overflow-wrap:anywhere; font-size:.8rem; }
#execution-paused { margin:0; padding:8px; background:#fff3cd; }
@media(max-width:600px) { #execution-dialog { inset:2dvh 2vw auto; width:96vw; height:94dvh; max-height:94dvh; } .execution-heading button { min-height:40px; } }
#language-help pre { white-space:pre-wrap; overflow-wrap:anywhere; background:#eef3f7; padding:8px; }
@media(max-width:480px) { .editor-context-menu { min-width:0; width:calc(100vw - 8px); font-size:13px; } .editor-context-menu button { min-height:40px; gap:6px; } }

#design-panel { flex: 1; min-height: 450px; display: flex; flex-direction: column; }
#design-panel[hidden] { display: none; }
#design-message { margin: 5px 10px; }
#design-frame { flex: 1; width: 100%; min-height: 420px; border: 0; }
@media(max-width:650px) { #design-frame { min-height:650px; } }
