/* Workspace shell derived from TakeOff_GUI_Prototyp.zip; functional widgets stay in workspace.css. */
:root {
    --primary: #0073bf;
    --primary-dark: #004778;
    --selection: #e0e8ef;
    --surface: #f4f7fa;
    --muted: #435e78;
    --border: #dce5ed;
    --control-border: #657d93;
    --accent: var(--primary);
    --coral: #c4473a;
    --left: 220px;
    --right: 330px;
    --output: 164px;
    --code-size: 14px;
    color: var(--primary-dark);
    background: var(--surface);
    font: 16px/1.5 "Segoe UI", Arial, sans-serif;
}
html, body { height:100%; overflow:hidden; }
body { height:100dvh; display:flex; flex-direction:column; }
button, select { border-radius:8px; }
button:hover:not(:disabled) { background:var(--selection); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline:3px solid var(--primary); outline-offset:2px; }
button[aria-selected=true] { background:transparent; color:var(--primary); border-color:var(--primary); }
button[aria-pressed=true] { background:var(--selection); color:var(--primary-dark); }
select, input:not([type=file]), textarea { border-color:var(--control-border); }
.brandbar { min-height:43px; flex-shrink:0; padding:6px 18px; background:var(--primary); color:white; gap:16px; }
.brandbar .brand { color:white; font-size:20px; white-space:nowrap; }
/* Same paper-plane silhouette as the landing page, reversed for the blue header. */
.brandbar .brand-mark { width:24px; height:24px; vertical-align:-.2em; }
.brandbar h1 { font-size:14px; font-weight:700; margin:0; padding-left:16px; border-left:1px solid #ffffff80; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.shell-footer #save-status { color:inherit; font-size:inherit; overflow-wrap:anywhere; }
.brandbar a:focus-visible, .gallery:focus-visible, #run:focus-visible { outline:3px solid var(--primary-dark); box-shadow:0 0 0 2px white; }
.menubar { display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:65px; padding:10px 16px; flex-shrink:0; background:#fbfcfd; border-bottom:1px solid var(--border); }
.menu-left, .menu-right { display:flex; gap:10px; align-items:center; }
.menu-left button { padding:10px 16px; background:var(--selection); border:0; border-radius:12px; }
.menubar .gallery { background:var(--coral); color:white; font-weight:700; border:0; border-radius:25px; padding:11px 19px; box-shadow:0 3px 8px #a9362c22; }
.menubar .gallery:hover:not(:disabled), .menubar .gallery:active { background:#a9362c; }
#help-open { background:transparent; border:0; }
.workbench { flex:1; min-height:0; display:grid; grid-template-columns:var(--left) 7px minmax(280px,1fr) 7px var(--right); grid-template-areas:none; gap:0; padding:10px 10px 0; overflow:hidden; }
.project-panel, .center-panel, .inspector { grid-area:auto; background:white; border:1px solid var(--border); border-radius:12px; min-width:0; min-height:0; overflow:hidden; }
.project-panel { display:flex; flex-direction:column; padding:14px 10px 10px; background:#f8fafc; }
.panel-heading { display:flex; align-items:center; justify-content:space-between; margin:0 6px 14px; }
.panel-heading h2 { margin:0; font-size:15px; color:var(--primary-dark); text-transform:none; letter-spacing:normal; }
.add { background:var(--selection); color:var(--primary-dark); border:0; border-radius:24px; min-height:40px; margin:0 4px 12px; }
.tree-choice { display:flex; align-items:center; gap:7px; font-size:14px; }
#tree-mode { min-width:0; width:auto; flex:1; font-size:14px; }
#project-tree { overflow:auto; flex:1; min-height:0; }
#project-tree .selected { background:var(--selection); color:var(--primary-dark); border-radius:6px; }
#project-tree summary { padding:8px 0; font-size:14px; }
#project-tree button { font-size:14px; }
.file-actions { display:block; text-align:left; width:100%; margin:12px 0 0; font-size:14px; border-color:var(--control-border); }
.center-panel { display:flex; flex-direction:column; }
.run-toolbar { padding:10px 12px; gap:7px; flex-shrink:0; background:white; align-items:center; }
.run-toolbar #run { background:var(--primary); color:white; border:0; border-radius:24px; padding:10px 18px; }
.run-toolbar #run:hover:not(:disabled) { background:var(--primary-dark); }
#debug { border:0; color:var(--primary); }
.run-toolbar label { font-size:14px; display:flex; align-items:center; gap:6px; min-width:0; }
.start-choice { flex:1 1 220px; }
.start-choice select { flex:1; width:100%; min-width:0; max-width:none; }
.mode-choice { flex:0 1 205px; }
.mode-choice select { min-width:0; width:100%; }
.run-toolbar select { font-size:14px; }
#execution-show { font-size:14px; }
#execution-show:disabled { display:none; }
#release-link { font-size:14px; }
.document-panel { grid-area:auto; flex:1; min-height:95px; display:flex; flex-direction:column; border:0; border-radius:0; }
#document-tabs { min-height:36px; flex-shrink:0; background:var(--surface); }
#document-tabs button { border:0; font-size:14px; max-width:260px; overflow:hidden; text-overflow:ellipsis; }
/* Titel und Schließen bilden optisch einen gemeinsamen aktiven Dokument-Tab. */
#document-tabs [aria-selected=true],
#document-tabs [aria-selected=true] + button { background:white; box-shadow:inset 0 2px var(--primary); }
#document-tabs [aria-selected=true] { border-radius:8px 0 0 0; }
#document-tabs [aria-selected=true] + button { border-radius:0 8px 0 0; }
.editor-tools { display:flex; flex-wrap:nowrap; gap:3px; align-items:center; border-bottom:1px solid var(--border); padding:0 7px; flex-shrink:0; }
.view-tabs { border:0; padding:0; min-width:0; overflow-x:auto; flex:1; }
.view-tabs button, .inspector-tabs button, .results-heading [role=tab] { border:0; border-bottom:3px solid transparent; border-radius:0; font-size:14px; padding:9px 8px; white-space:nowrap; }
.view-tabs [aria-selected=true], .inspector-tabs [aria-selected=true], .results-heading [aria-selected=true] { border-bottom-color:var(--primary); color:var(--primary); }
#input-help { flex-shrink:0; font-size:14px; padding:4px 7px; min-height:30px; white-space:nowrap; }
#editor-menu-button { flex-shrink:0; margin:0; border:0; padding:3px 7px; }
.editor-area { flex:1; min-height:0; overflow:hidden; position:relative; }
#editor, #plain-editor, #preview-panel, #image-panel, #photos-panel, #design-panel { width:100%; height:100%; min-height:0; max-height:none; }
#plain-editor { resize:none; font-size:var(--code-size); padding:12px; }
#photos-panel, #image-panel { overflow:auto; }
#design-panel { display:flex; flex-direction:column; }
#design-frame { min-height:0; height:0; flex:1; }
#preview-frame { min-height:0; height:0; flex:1; }
#preview-message { overflow-wrap:anywhere; overflow:auto; flex-shrink:0; max-height:60%; }
.preview-toolbar { flex-shrink:0; }
.preview-toolbar span { max-height:42px; overflow:auto; }
.shell-splitter { touch-action:none; position:relative; }
.shell-splitter:hover, .shell-splitter:focus-visible { background:var(--selection); }
.shell-splitter.vertical { cursor:col-resize; }
.shell-splitter.horizontal { height:7px; flex:0 0 7px; cursor:row-resize; background:var(--surface); }
.shell-splitter.horizontal:after { content:""; position:absolute; width:28px; height:2px; background:var(--control-border); top:2px; left:calc(50% - 14px); }
.results { grid-area:auto; display:flex; flex-direction:column; flex:0 0 var(--output); height:var(--output); min-height:96px; max-height:42%; padding:0; border:0; border-radius:0; overflow:hidden; }
.results-heading { display:flex; align-items:center; justify-content:space-between; padding:0 8px; flex-shrink:0; }
.results-heading [role=tablist] { display:flex; }
#error-count { color:var(--muted); margin-left:4px; }
#clear-output { border:0; padding:3px 8px; }
#output, #errors { flex:1; min-height:0; overflow:auto; padding:6px 14px; font-size:14px; }
/* Code und Programmausgabe folgen derselben gespeicherten Schriftgröße. */
#output { font-size:var(--code-size); line-height:1.5; }
#errors { overflow-wrap:anywhere; }
.workbench.is-active .results.show-errors #errors { flex:0 1 42%; }
#status { margin:0; padding:3px 12px; font-size:14px; font-weight:400; color:var(--muted); border-top:1px solid var(--border); flex-shrink:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.inspector { display:flex; flex-direction:column; padding:0; max-height:none; }
.inspector-tabs { padding:4px 8px 0; flex-shrink:0; overflow-x:auto; }
#debug-controls { flex-shrink:0; grid-column:1 / -1; border-bottom:1px solid var(--border); padding:5px 8px; }
#debug-status { margin:2px 5px 6px; font-size:14px; color:var(--muted); overflow-wrap:anywhere; }
.workbench.is-paused #debug-status { color:#765000; }
#debug-controls > div { display:flex; gap:6px; }
#debug-controls > div + div { display:grid; grid-template-columns:minmax(0,1fr); gap:6px; border-top:1px solid var(--border); padding-top:8px; margin-top:8px; }
#debug-controls button { flex:1; min-width:0; border:1px solid var(--control-border); font-size:16px; padding:8px 6px; min-height:40px; white-space:normal; }
#debug-controls > div + div button { text-align:left; padding-inline:12px; }
#properties, #debugger, #language-help { flex:1; min-height:0; overflow:auto; padding:14px; }
#debugger h2 { color:var(--primary-dark); text-transform:none; letter-spacing:normal; }
#variables { font-size:14px; }
.variable { padding:4px 6px; border-bottom:1px solid var(--border); }
.variable.changed { background:var(--selection); border-left:3px solid var(--primary); }
.variable-change { font:14px "Segoe UI",sans-serif; color:var(--primary-dark); margin-left:8px; }
.takeoff-breakpoint { background:#a43131; }
.takeoff-current-line { background:#fff4d6; }
.takeoff-current-arrow:before { content:"\f138"; font-family:bootstrap-icons!important; color:#765000; }
.shell-menu { position:fixed; z-index:500; min-width:235px; max-width:calc(100vw - 16px); max-height:calc(100dvh - 110px); overflow:auto; padding:7px; background:white; border:1px solid var(--border); border-radius:12px; box-shadow:0 12px 40px #00477830; }
.shell-menu button { display:block; width:100%; text-align:left; border:0; padding:10px; }
.shell-menu hr { border:0; border-top:1px solid var(--border); margin:6px 0; }
.shell-menu label { display:flex; align-items:center; justify-content:space-between; padding:7px; gap:8px; }
.shell-menu [aria-pressed] { border-radius:8px; margin:3px 0; }
.shell-footer { min-height:24px; height:auto; flex-shrink:0; display:flex; flex-wrap:wrap; justify-content:space-between; gap:10px; padding:3px 12px; font-size:14px; color:var(--muted); }
#shell-notice { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mobile-only { display:none; }
.workbench.no-project { grid-template-columns:0 0 minmax(280px,1fr) 7px var(--right); }
.workbench.no-inspector { grid-template-columns:var(--left) 7px minmax(280px,1fr) 0 0; }
.workbench.no-project.no-inspector { grid-template-columns:0 0 minmax(280px,1fr) 0 0; }
.workbench.no-project .project-panel, .workbench.no-project #left-splitter, .workbench.no-inspector .inspector, .workbench.no-inspector #right-splitter { visibility:hidden; }
body.resizing iframe { pointer-events:none; }
#chooser-items { grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr)); }
#chooser-items > h3 { grid-column:1 / -1; }
#chooser-items article { border-radius:12px; padding:16px; background:#fbfcfd; }
#chooser-items button { margin:4px 4px 4px 0; }
#chooser-items pre { white-space:pre-wrap; overflow-wrap:anywhere; }
#chooser-tools { display:flex; flex-wrap:wrap; gap:8px; }

/* Modal frame: title and close actions remain visible; only content scrolls. */
dialog.ide-modal { width:min(820px,calc(100vw - 24px)); max-width:calc(100vw - 24px); max-height:calc(100vh - 24px); max-height:calc(100dvh - 24px); padding:0; overflow:hidden; box-sizing:border-box; background:#fff; box-shadow:0 16px 60px #172d4740; }
dialog.ide-modal[open], .input-dialog form { display:flex; flex-direction:column; min-height:0; }
.ide-modal-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:16px 20px; border-bottom:1px solid var(--border); flex:none; }
.ide-modal-header h2 { margin:0; overflow-wrap:anywhere; }
.ide-modal-close { flex:none; width:44px; height:44px; padding:0; font-size:28px; line-height:1; }
.ide-modal-body { min-height:0; overflow:auto; overscroll-behavior:contain; padding:16px 20px; }
.ide-modal-footer { display:flex; justify-content:center; gap:12px; flex-wrap:wrap; flex:none; padding:12px 20px; border-top:1px solid var(--border); background:#f4f7fb; }
.ide-modal-footer button { min-height:44px; }
dialog.input-dialog { width:min(520px,calc(100vw - 24px)); }
.input-dialog label { display:grid; gap:10px; font-weight:600; }
.input-dialog input { width:100%; min-width:0; padding:10px; font:inherit; border:1px solid #687e97; border-radius:6px; }
.input-dialog .primary { color:#fff; background:#174f8c; }
@media (min-width:901px) and (max-width:1120px) {
    :root { --left:180px; --right:310px; }
    .run-toolbar { gap:4px; padding:7px; }
    .start-choice { flex-basis:100%; order:2; }
}
@media (max-width:900px) {
    .brandbar { min-height:36px; padding:4px 10px; gap:8px; flex-wrap:wrap; }
    .brandbar .brand { font-size:17px; }
    .brandbar h1 { font-size:14px; padding-left:8px; }
    .menubar { min-height:48px; padding:6px 8px; gap:4px; }
    .menu-left, .menu-right { gap:4px; }
    .menu-left button { padding:8px; font-size:14px; }
    .menu-left button .bi { display:none; }
    .menu-left button { white-space:nowrap; }
    .menubar .gallery { padding:9px; font-size:14px; }
    .gallery .gallery-arrow { display:none; }
    #help-open { font-size:0; padding:7px; }
    #help-open .bi { font-size:20px; }
    .workbench, .workbench.no-project, .workbench.no-inspector, .workbench.no-project.no-inspector { display:flex; flex-direction:column; padding:5px 5px 0; gap:5px; }
    .center-panel { flex:1 0 420px; min-height:420px; border-radius:9px; }
    /* Wrapped navigation and run controls must leave room for the form itself. */
    .center-panel:has(#preview-panel:not([hidden])), .center-panel:has(#design-panel:not([hidden])) { flex-basis:660px; min-height:660px; }
    .project-panel { position:fixed; left:0; top:0; bottom:0; width:min(285px,90vw); z-index:450; border-radius:0 12px 12px 0; max-height:none; transform:translateX(-105%); visibility:hidden!important; }
    .project-panel.open { transform:translateX(0); visibility:visible!important; }
    #drawer-backdrop { position:fixed; inset:0; background:#00477855; z-index:440; }
    .mobile-only { display:inline-flex; }
    .shell-splitter.vertical { display:none; }
    .run-toolbar { padding:5px 7px; gap:4px; }
    .run-toolbar #run { padding:8px 12px; font-size:14px; }
    #debug { padding:7px; font-size:14px; }
    .start-choice { flex:1 1 100%; order:3; }
    .mode-choice { flex:1 1 100px; }
    .mode-choice { font-size:0!important; }
    .mode-choice select { font-size:14px; padding:4px; }
    .start-choice select { min-height:29px; }
    #execution-show, #release-link { order:4; }
    #document-tabs { min-height:31px; }
    #document-tabs button { font-size:14px; min-height:31px; padding:4px 7px; }
    .editor-tools { padding:0 4px; }
    .view-tabs button { font-size:14px; padding:7px; min-height:34px; }
    #input-help { flex-shrink:0; font-size:14px; padding:4px; }
    .document-panel { min-height:120px; }
    .results { flex-basis:110px; height:110px; min-height:84px; max-height:34%; }
    .results-heading [role=tab] { font-size:14px; padding:6px; }
    #output, #errors { padding:4px 9px; }
    #status { font-size:14px; padding:2px 8px; }
    .inspector { flex:0 0 260px; height:260px; min-height:0; max-height:none; border-radius:9px; }
    .inspector-tabs { padding:0 7px; }
    .inspector-tabs button { padding:7px; font-size:14px; }
    #debug-controls { padding:2px 5px; }
    #debug-controls button { min-height:38px; font-size:14px; }
    #debug-status { margin:2px 4px; font-size:14px; }
    #debugger, #properties, #language-help { padding:7px 10px; }
    #debugger { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.4fr); gap:8px; align-content:start; }
    #debugger section { min-width:0; }
    #debugger h2 { margin:0 0 4px; font-size:14px; }
    #debugger select { width:100%; min-width:0; font-size:14px; }
    .debug-values { grid-column:2; grid-row:1 / span 2; }
    .debug-breakpoints { grid-column:1; }
    #variables { font-size:14px; }
    .variable-change { display:block; margin-left:0; }
    .workbench.no-inspector .inspector { display:none; }
    .shell-footer { min-height:20px; font-size:14px; }
}
@media (max-width:900px) and (max-height:710px) {
    .inspector { flex-basis:240px; height:240px; }
    #debug-controls button { min-height:32px; }
    .results { flex-basis:88px; height:88px; min-height:78px; }
    .run-toolbar { gap:2px; }
    .brandbar { gap:3px 8px; }
}
/* At narrow widths the step controls use a compact, labelled row. */
@media (max-width:900px) {
    #debug-controls > div + div { grid-template-columns:repeat(3,minmax(0,1fr)); margin-top:4px; padding-top:4px; gap:4px; }
    #debug-controls > div + div button { text-align:center; padding:4px 2px; overflow-wrap:anywhere; }
    #debug-controls > div + div .bi { display:block; margin:0 auto 2px; }
    .workbench { overflow:auto; }
    .shell-footer { min-height:26px; height:auto; }
}
/* With a software keyboard or large text, retain a compact control strip instead of clipping it. */
@media (max-height:540px) {
    .inspector { flex-basis:144px; height:144px; max-height:none; }
    .workbench { overflow:auto; }
    .center-panel { min-height:245px; }
}
/* In a shallow phone/landscape window the active run owns the available space.
   Keep the inspector tabs available; their contents scroll within the pane. */
@media (max-width:900px) and (max-height:540px) {
    body:has(.workbench.is-active) .brandbar,
    body:has(.workbench.is-active) .shell-footer,
    .workbench.is-active .run-toolbar { display:none; }
    .workbench.is-active { overflow:auto; }
    .workbench.is-active .center-panel { flex:1 0 280px; min-height:280px; }
    .workbench.is-active .document-panel { min-height:0; }
    .workbench.is-active .inspector { flex:0 0 200px; height:200px; }
    .workbench.is-active #debug-controls button { min-height:28px; padding:3px 2px; }
}
@media (prefers-reduced-motion:reduce) { *, *:before, *:after { transition:none!important; scroll-behavior:auto!important; } }

/* Readable workspace controls. Monaco's independently configurable code size is unchanged. */
.bi { display:inline-block; font-size:1.1em; line-height:1; vertical-align:-.125em; }
button .bi, a .bi { margin-right:.2em; }
button[aria-label] > .bi:only-child { margin-right:0; }
button, select { min-height:36px; }
dialog h2 { font-size:18px; color:var(--primary-dark); text-transform:none; letter-spacing:normal; }
.future, #breakpoints button, #photo-list button, #photo-list figcaption,
.preview-toolbar button, .preview-toolbar span, #chooser-items pre { font-size:14px; }
.future, .preview-toolbar span { color:var(--muted); }
.editor-context-menu .shortcut { font-size:max(14px,.85em); }
/* Keep disabled toolbar and form controls readable, including hover states. */
body button:disabled, body select:disabled, body input:disabled {
    opacity:1!important; color:#526171!important; background:#edf1f5!important; border:1px dashed #657d93!important;
    -webkit-text-fill-color:#526171!important; box-shadow:none; cursor:not-allowed;
}
/* Inaktive Menübefehle treten nur durch graue Schrift zurück.
   Die gemeinsame Menüfläche bleibt auch beim Darüberfahren unverändert. */
body .editor-context-menu button:disabled {
    color:#78838e!important;
    -webkit-text-fill-color:#78838e!important;
    background:transparent!important;
    border:0!important;
    outline:none;
    box-shadow:none;
    cursor:default;
}
@media (min-width:901px) {
    .tree-choice, #tree-mode, #project-tree summary, #project-tree button, .file-actions,
    .run-toolbar label, .run-toolbar select, #execution-show, #release-link,
    #document-tabs button, .view-tabs button, .inspector-tabs button,
    .results-heading [role=tab], #input-help, .preview-toolbar button, #breakpoints button { font-size:16px; }
    #errors, #variables, #debug-status { font-size:15px; }
    .brandbar h1 { font-size:16px; }
    .panel-heading h2, #debugger h2 { font-size:16px; }
    .tree-choice { flex-wrap:wrap; }
    #tree-mode { flex-basis:100%; }
    .inspector-tabs { flex-wrap:wrap; }
    .shell-footer { min-height:28px; }
}
@media (forced-colors:active) {
    body button:disabled, body select:disabled, body input:disabled { color:GrayText!important; -webkit-text-fill-color:GrayText!important; border-color:GrayText!important; }
    body .editor-context-menu button:disabled { color:GrayText!important; -webkit-text-fill-color:GrayText!important; }
    button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline-color:Highlight; }
    button[aria-selected=true], button[aria-pressed=true] { outline:2px solid Highlight; outline-offset:-2px; }
}
