/* Klappkarten-Studio: baut auf ../shared/werkstatt.css auf.
   Drei Spalten auf breiten Bildschirmen: Karte & Ebenen | Raum + Schnittbogen | Flächeneigenschaften & Export. */

/* Grundlagen */
button,a,input,select,summary,label{touch-action:manipulation}
a{color:var(--ws-green)}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
noscript.noscript{display:block;padding:16px 20px;margin-bottom:12px;border-radius:var(--ws-radius);background:var(--ws-danger-soft);color:var(--ws-danger)}
svg:focus-visible,canvas:focus-visible{outline:3px solid var(--ws-focus);outline-offset:-3px}

/* Schaltflächen (nur im Studio, nicht im Studio-Umschalter) */
button,.button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:36px;padding:7px 12px;border:1px solid var(--ws-line-strong);border-radius:var(--ws-radius-sm);background:var(--ws-surface);color:var(--ws-green);font-size:var(--ws-text-sm);font-weight:600;line-height:1.3;text-decoration:none;white-space:nowrap;cursor:pointer;transition:background .15s,border-color .15s,box-shadow .15s}
button:hover:not(:disabled),.button:hover{background:var(--ws-green-tint);border-color:var(--ws-green)}
button:disabled{cursor:not-allowed;opacity:.45}
.primary{border-color:var(--ws-green);background:var(--ws-green);color:#fff;box-shadow:0 6px 16px -8px #173d3399}
.primary:hover:not(:disabled){background:var(--ws-green-strong);border-color:var(--ws-green-strong)}
.quiet{background:transparent;border-style:dashed}
.text-button{min-height:28px;padding:2px 6px;border:0;background:transparent;color:var(--ws-green);font-size:var(--ws-text-sm);font-weight:600}
.text-button:hover:not(:disabled){background:var(--ws-green-tint)}
.full-width{width:100%;white-space:normal}
.workspace .button{display:flex;margin-top:0;color:var(--ws-green);font-size:var(--ws-text-sm);font-weight:600}
.upload{position:relative;overflow:hidden}
.upload input{position:absolute;left:0;bottom:0;width:1px;height:1px;opacity:0}
.upload:focus-within{outline:3px solid var(--ws-focus);outline-offset:2px}
.icon-button{flex:0 0 40px;padding:0;font-size:20px;line-height:1;color:var(--ws-danger)}

/* Segment-Gruppen: gewählte Werkzeuge sind weiße Kacheln */
.segmented{display:inline-flex;flex-wrap:wrap;gap:2px;padding:3px;border-radius:var(--ws-radius);background:var(--ws-surface-sunk)}
.segmented button{min-height:34px;padding:6px 12px;border:0;border-radius:8px;background:transparent;color:var(--ws-muted)}
.segmented button:hover:not(:disabled){background:#ffffff99;color:var(--ws-ink)}
.segmented button[aria-pressed=true]{background:var(--ws-surface);color:var(--ws-green);box-shadow:var(--ws-shadow-sm),inset 0 0 0 1px var(--ws-line)}

/* Kopfleiste: Speicherstand und Projektaktionen */
.project-bar{display:flex;align-items:center;gap:6px;min-width:0}
.project-bar .ws-local{min-width:0;max-width:300px;overflow:hidden;text-overflow:ellipsis}
.project-bar .ws-local::before{flex:none}
.project-actions{display:flex;align-items:center;gap:6px}
.project-actions>*{gap:0;min-height:36px;padding:7px 12px}
.pa-extra{white-space:pre}

/* Seitenrahmen und kompakter Einstieg */
.studio{padding:0 clamp(12px,2vw,24px)}
.ws-studio-intro{padding:16px 4px 14px}
.ws-studio-intro .eyebrow{margin:0}
.project-metrics{display:flex;flex:none;gap:6px;margin:0}
.project-metrics>div{display:flex;flex-direction:column-reverse;justify-content:flex-end;min-width:74px;padding:6px 12px;border:1px solid var(--ws-line);border-radius:var(--ws-radius);background:var(--ws-surface-soft);text-align:right}
.project-metrics dd{margin:0;color:var(--ws-accent-ink);font-size:17px;font-weight:650;line-height:1.25;letter-spacing:-.01em;font-variant-numeric:tabular-nums;white-space:nowrap}
.project-metrics dt{color:var(--ws-muted);font-size:var(--ws-text-xs);line-height:1.4;white-space:nowrap}

/* Hinweis auf ältere Projekte */
.legacy-notice{margin:0 0 14px;padding:16px 18px;border:1px solid color-mix(in srgb,var(--ws-warn) 25%,transparent);border-radius:var(--ws-radius-lg);background:var(--ws-warn-soft);color:var(--ws-warn);font-size:14px;overflow-wrap:anywhere}
.legacy-notice h2{margin:0 0 4px;font-size:15px;font-weight:650;color:var(--ws-ink)}
.legacy-notice p{margin:0 0 12px}
.legacy-actions{display:flex;flex-wrap:wrap;gap:8px}
.legacy-actions button{white-space:normal;text-align:left}

/* Werkbank: eine Karte mit drei Bereichen */
.workspace{display:grid;grid-template-columns:252px minmax(0,1fr) 252px;border:1px solid var(--ws-line);border-radius:var(--ws-radius-lg);background:var(--ws-surface);box-shadow:var(--ws-shadow);overflow:hidden;outline:0}
.project-slot{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:10px 14px;border-bottom:1px solid var(--ws-line);background:var(--ws-surface-soft)}
.panel{min-width:0;background:var(--ws-surface-soft);scrollbar-width:thin;scrollbar-color:var(--ws-line-strong) transparent}
.settings-panel{border-right:1px solid var(--ws-line)}
.tools-panel{border-left:1px solid var(--ws-line)}
.workbench{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--ws-surface);container-type:inline-size}

/* Räumlicher Arbeitsplatz: nur die Werkzeuge für Flächen im Raum */
body.surface-mode :is(#legacyDrawingActions,#figureSettings,#structureSettings,.compact-help,#motifTools,#spiralControls,#cardTools){display:none!important}
body.surface-mode .view-tabs :is([data-view=card],[data-view=kirigami],[data-view=design],[data-view=motion]){display:none}

/* Einstellungsabschnitte */
.panel-section{padding:20px 20px;border-bottom:1px solid var(--ws-line)}
.panel-section:last-child{border-bottom:0}
.section-heading{display:flex;align-items:center;gap:10px;margin:0 0 14px}
.section-heading h2{margin:0;font-size:15px;font-weight:650;letter-spacing:-.01em}
.step-number{display:inline-grid;flex:none;place-items:center;width:24px;height:24px;border-radius:7px;background:var(--ws-accent-soft);color:var(--ws-accent-ink);font:600 12px var(--ws-mono)}
.surface-list-heading{margin-top:24px}
.section-copy{margin:-4px 0 12px;color:var(--ws-muted);font-size:var(--ws-text-xs);line-height:1.6}
.hint{margin:8px 0 0;color:var(--ws-muted);font-size:var(--ws-text-xs);line-height:1.6}
.mechanism-label{margin:16px 0 0;color:var(--ws-accent-ink);font-size:var(--ws-text-sm);font-weight:650}
.panel-section>.full-width+.full-width{margin-top:8px}

/* Aufklappbare Abschnitte als Karte ohne Systemmarker */
.panel-section>summary{list-style:none;cursor:pointer;user-select:none}
.panel-section>summary::-webkit-details-marker{display:none}
.panel-section>summary::after{content:'';flex:none;width:8px;height:8px;margin-left:auto;border-right:2px solid var(--ws-faint);border-bottom:2px solid var(--ws-faint);transform:rotate(45deg) translateY(-2px);transition:transform .2s var(--ws-ease)}
.panel-section[open]>summary::after{transform:rotate(-135deg) translateY(-2px)}
details.panel-section:not([open])>summary{margin-bottom:0}
.export-settings>summary{display:flex;align-items:center;gap:10px;font-size:15px;font-weight:650}
.export-settings[open]>summary{margin-bottom:6px}

/* Felder */
.workspace label{display:block;margin-top:12px;color:var(--ws-ink-soft);font-size:var(--ws-text-sm);font-weight:500}
.workspace label:not(.button)>span{color:var(--ws-faint);font:12px var(--ws-mono)}
.workspace label:not(.button)>.field-name{color:inherit;font:inherit}
.workspace :is(input:not([type]),input[type=text],input[type=number],select){display:block;width:100%;min-width:0;min-height:40px;margin:0;padding:8px 10px;border:1px solid var(--ws-line-strong);border-radius:var(--ws-radius-sm);background:var(--ws-surface);color:var(--ws-ink);font-size:15px;transition:border-color .15s,box-shadow .15s}
.workspace label>:is(input,select){margin-top:6px}
.workspace :is(input,select):hover:not(:disabled){border-color:var(--ws-faint)}
.workspace :is(input:not([type]),input[type=text],input[type=number],select):focus-visible{outline:0;border-color:var(--ws-green);box-shadow:0 0 0 3px var(--ws-green-soft)}
.workspace :is(input,select):disabled{background:var(--ws-surface-sunk);color:var(--ws-faint)}
.workspace input[type=number]{font-variant-numeric:tabular-nums}
.workspace input:invalid{border-color:var(--ws-danger);background:var(--ws-danger-soft);color:var(--ws-danger)}
input[type=checkbox],input[type=range]{accent-color:var(--ws-green)}
input[type=range]{display:block;width:100%;margin:10px 0 0;cursor:pointer}
input[type=color]{width:36px;height:36px;padding:3px;border:1px solid var(--ws-line-strong);border-radius:var(--ws-radius-sm);background:var(--ws-surface);cursor:pointer}
.field-grid{display:grid;grid-template-columns:1fr 1fr;align-items:end;gap:0 12px}
.inline-field{display:flex;align-items:center;gap:6px;margin-top:6px}
.inline-field select{flex:1}
.inline-field button{min-height:40px}
.inline-label{display:flex!important;align-items:center;gap:6px;margin:0!important}
.inline-label input{width:70px!important;margin:0!important}
.color-field{display:flex!important;align-items:center;justify-content:space-between;gap:8px}
.color-field input{margin:0}
.color-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 16px;margin-top:4px}
.button-row{display:flex;gap:6px;margin-top:8px}
.button-row button{flex:1;min-width:0;padding-inline:8px}

/* Auswahllisten (Flächen, Figuren, Kirigami-Formen) */
#surfaceList,#figureList,#structureList{height:auto;min-height:124px;padding:4px;background:var(--ws-surface)}
:is(#surfaceList,#figureList,#structureList) option{padding:7px 9px;margin:1px 0;border-radius:5px;font-size:14px}
:is(#surfaceList,#figureList,#structureList) option:checked{background:var(--ws-green) linear-gradient(var(--ws-green),var(--ws-green));color:#fff}

/* Motivwerkzeuge */
.tool-group{margin:20px 0}
.tool-group h3{margin:0 0 4px;font-size:var(--ws-text-sm);font-weight:650}
.tool-group>input{margin-top:8px!important}
.tool-group .inline-field{margin-top:8px}
.boolean-tools{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-top:10px}
.boolean-tools button{flex-direction:column;gap:4px;padding:8px 2px;font-size:var(--ws-text-xs);font-weight:550}
.boolean-tools button span{font-size:20px;line-height:1;color:var(--ws-accent)}
.tools-panel #applyMotif{margin-top:14px}
.card-action-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:16px}
.card-action-grid button{padding-inline:6px;white-space:normal}
#spiralControls>label{margin-top:14px}

/* Kurzhilfe in der Einstellungsspalte */
.compact-help{display:flex;gap:10px;background:var(--ws-accent-soft);color:var(--ws-accent-ink)}
.compact-help>span{font-size:20px;line-height:1.2}
.compact-help p{margin:0;font-size:var(--ws-text-xs);line-height:1.6}

/* Arbeitsfläche: Ansichten, Werkzeugleisten, Vorschauen */
.workbench-header{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px;border-bottom:1px solid var(--ws-line)}
.view-tabs{display:flex;flex-wrap:wrap;gap:2px;min-width:0;padding:3px;border-radius:var(--ws-radius);background:var(--ws-surface-sunk)}
.view-tabs button{min-height:34px;padding:6px 12px;border:0;border-radius:8px;background:transparent;color:var(--ws-muted)}
.view-tabs button:hover:not(:disabled){background:#ffffff99;color:var(--ws-ink)}
.view-tabs button[aria-selected=true]{background:var(--ws-surface);color:var(--ws-green);box-shadow:var(--ws-shadow-sm),inset 0 0 0 1px var(--ws-line)}
.history-actions{display:flex;flex:none;gap:4px}
.history-actions button{width:38px;min-height:38px;padding:0;font-size:19px;color:var(--ws-ink-soft)}
.view-panel{display:flex;flex-direction:column;min-height:0}
.canvas-caption{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:42px;padding:8px 16px;border-bottom:1px solid var(--ws-line);color:var(--ws-muted);font-size:var(--ws-text-xs)}
.canvas-caption>span:first-child{display:flex;align-items:center;gap:8px;color:var(--ws-ink-soft);font-weight:550}
.status-dot{flex:none;width:7px;height:7px;border-radius:50%;background:var(--ws-lime);box-shadow:0 0 0 3px var(--ws-lime-soft)}
.surface-toolbar,.card-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:8px 14px;border-bottom:1px solid var(--ws-line)}
.card-toolbar select{width:auto!important;max-width:150px;min-height:40px}
.card-mode-note{margin:0;padding:10px 16px;border-bottom:1px solid color-mix(in srgb,var(--ws-warn) 20%,transparent);background:var(--ws-warn-soft);color:var(--ws-warn);font-size:var(--ws-text-sm)}
.view-note{margin:0;padding:4px 16px 14px;color:var(--ws-muted);font-size:var(--ws-text-xs);line-height:1.6}
.canvas-footer{display:flex;justify-content:space-between;gap:10px;padding:10px 16px;border-top:1px solid var(--ws-line);color:var(--ws-muted);font-size:var(--ws-text-xs)}

/* Gepunkteter Werkstattgrund für alle Vorschauen */
.surface-space,.scene-host,.layout-host,.card-plan,.surface-net,.card-preview{background-color:var(--ws-surface-sunk);background-image:radial-gradient(#c9cfc0 .8px,transparent .8px);background-size:16px 16px}

/* 3D-Raum und Schnittbogen nebeneinander */
.surface-workspace{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(240px,1fr);min-height:0}
.surface-space{display:flex;flex-direction:column;min-width:0;border-right:1px solid var(--ws-line)}
.surface-canvas{position:relative;flex:1 1 auto;height:520px;min-height:300px;overflow:hidden}
.surface-canvas canvas{position:absolute;inset:0;display:block;width:100%;height:100%;touch-action:none}
.surface-space>.hint{min-height:42px;margin:0;padding:8px 14px;border-top:1px solid var(--ws-line);background:var(--ws-surface)}
.surface-net-panel{display:flex;flex-direction:column;min-width:0;background:var(--ws-surface-soft)}
.surface-net-heading{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 8px;padding:10px 14px;border-bottom:1px solid var(--ws-line);font-size:var(--ws-text-sm)}
.surface-net-heading span{color:var(--ws-muted);font-size:var(--ws-text-xs)}
.surface-net{position:relative;flex:1 1 auto;display:grid;place-items:center;min-height:200px;padding:14px}
/* Der Bogen passt sich in beide Richtungen ein und behält sein Seitenverhältnis. */
.surface-net svg{display:block;width:auto;height:auto;max-width:100%;max-height:100%;background:var(--ws-surface);box-shadow:0 2px 15px #2336240d}
.surface-net [data-surface]{cursor:pointer;pointer-events:stroke}
.surface-net [data-selected=true]{stroke:#8d3d92!important;stroke-width:.7!important}
.surface-net-panel .hint{margin:0;padding:0 14px 14px}

/* Klappbewegung, Kartenwinkel */
.motion-controls{display:flex;align-items:center;gap:12px;padding:12px 16px;border-top:1px solid color-mix(in srgb,var(--ws-accent) 22%,transparent);background:var(--ws-accent-soft)}
.motion-controls label{margin:0;color:var(--ws-accent-ink);font-size:var(--ws-text-sm);font-weight:550;white-space:nowrap}
.motion-controls input[type=range]{flex:1;min-width:60px;margin:0}
.motion-controls output{min-width:40px;color:var(--ws-accent-ink);font:600 12px var(--ws-mono);font-variant-numeric:tabular-nums}
.motion-controls button{flex:none}
.motion-controls>button:first-child{background:var(--ws-green);border-color:var(--ws-green);color:#fff}
.motion-controls>button:first-child:hover:not(:disabled){background:var(--ws-green-strong)}

/* Ansicht „Aufklappen“ und Schnittbogen */
.scene-host{position:relative;flex:1 1 auto;height:560px;min-height:320px;overflow:hidden}
.scene-host canvas{position:absolute;inset:0;display:block;width:100%;height:100%;touch-action:none}
.layout-host{position:relative;flex:1 1 auto;display:grid;place-items:center;min-height:420px;padding:24px;overflow:hidden}
.layout-host svg{display:block;width:auto!important;height:auto;max-width:100%;max-height:100%;background:var(--ws-surface);box-shadow:0 5px 25px #23362413}
.layout-host p{color:var(--ws-muted)}
.line-legend{display:flex;flex-wrap:wrap;justify-content:center;gap:8px 18px;padding:12px 14px;color:var(--ws-muted);font-size:var(--ws-text-xs)}
.line-legend span{display:flex;align-items:center;gap:6px}
/* Laserfarben: fachliche Legende, Werte setzt app.mjs aus dem Projekt */
.line-legend i{display:inline-block;width:20px;border-top:2px solid #ff0000}
.line-legend .mountain-line{border-color:#0000ff;border-top-style:dashed}
.line-legend .valley-line{border-color:#00a060;border-top-style:dashed}
.line-legend .engrave-line{border-color:#000}

/* SVG-Motiveditor */
.editor-host{position:relative;flex:1 1 auto;height:680px;min-height:560px;background:var(--ws-surface-sunk)}
.editor-host iframe{position:absolute;inset:0;display:block;width:100%;height:100%;border:0}

/* Freie Kartenlinien */
.card-workspace{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(240px,.9fr);min-width:0;min-height:0}
.card-plan{display:flex;flex-direction:column;min-width:0;border-right:1px solid var(--ws-line)}
.card-zoom{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:6px;padding:8px 10px;border-bottom:1px solid var(--ws-line);background:var(--ws-surface)}
.card-zoom>label{display:flex!important;align-items:center;gap:6px;margin:0!important}
.card-zoom select{width:96px!important;margin:0!important}
.card-zoom button{min-width:40px;min-height:40px}
.card-canvas{position:relative;flex:1 1 auto;width:100%;height:600px;min-height:360px;overflow:hidden}
.card-canvas svg{position:absolute;inset:0;display:block;width:100%;height:100%;touch-action:none}
.card-gesture-help{margin:0;padding:8px 14px 12px;border-top:1px solid var(--ws-line);background:var(--ws-surface)}
.card-preview-panel{display:flex;flex-direction:column;min-width:0;padding-bottom:14px;background:var(--ws-surface-soft)}
.card-preview{position:relative;flex:1 1 auto;height:380px;min-height:240px;overflow:hidden}
.card-preview canvas{position:absolute;inset:0;display:block;width:100%;height:100%;touch-action:none}
.card-preview-panel>label,.card-preview-panel>input,.card-preview-panel>p{width:auto;margin:12px 14px 0}
.card-preview-panel output{float:right;color:var(--ws-accent-ink);font:600 12px var(--ws-mono)}
.pose-error{color:var(--ws-danger)!important}

/* Kirigami-Formen */
.kirigami-editor{padding:22px 24px}
.kirigami-editor h2{margin:0 0 8px;font-size:22px;font-weight:650;letter-spacing:-.02em}
.kirigami-editor>p{color:var(--ws-muted);font-size:14px;line-height:1.65}
.profile-host{min-height:200px;margin:18px 0;padding:12px;border:1px solid var(--ws-line);border-radius:var(--ws-radius);background:var(--ws-surface-soft)}
.profile-host svg{display:block;width:100%;max-height:340px}
.profile-host svg[data-spiral-net]{min-height:280px;max-height:440px}
.profile-host p{padding:24px;color:var(--ws-muted);font-size:14px}
.spiral-net-legend{padding:2px 8px;color:var(--ws-muted);font-size:var(--ws-text-xs);line-height:1.7}
.step-table-wrap{overflow:auto;margin-bottom:12px}
.step-table{width:100%;border-collapse:collapse;font-size:14px;font-variant-numeric:tabular-nums}
.step-table caption{padding:8px 0;color:var(--ws-muted);font-size:var(--ws-text-xs);text-align:left}
.step-table th,.step-table td{padding:6px 8px;border-bottom:1px solid var(--ws-line);text-align:left}
.step-table th{font-size:var(--ws-text-sm);font-weight:600}
.step-table input{min-width:72px}
.step-table td:last-child{width:48px}
.step-table button{min-width:40px;min-height:40px;padding:0;font-size:18px}
.structure-summary{color:var(--ws-ok)!important;font-variant-numeric:tabular-nums}
#previewStructure{margin-top:18px}

/* Faltanleitung */
.assembly-host{padding:24px 28px;line-height:1.7}
.assembly-host h2{margin:0 0 8px;font-size:22px;font-weight:650;line-height:1.3;letter-spacing:-.02em}
.assembly-host h3{margin-top:22px;font-size:15px}
.assembly-host p,.assembly-host li{color:var(--ws-muted);font-size:14px}
.assembly-host li{padding:4px 0}
.assembly-host svg{max-width:100%;height:auto}

/* Meldungen und Statuszeile */
.notice{flex:none;margin:10px 14px 0;padding:10px 14px;border-radius:var(--ws-radius-sm);font-size:var(--ws-text-sm);line-height:1.55}
.notice ul{margin:2px 0;padding-left:18px}
.notice.error{border:1px solid color-mix(in srgb,var(--ws-danger) 25%,transparent);background:var(--ws-danger-soft);color:var(--ws-danger)}
.notice.warning{border:1px solid color-mix(in srgb,var(--ws-warn) 25%,transparent);background:var(--ws-warn-soft);color:var(--ws-warn)}
.statusbar{display:flex;flex:none;align-items:center;justify-content:space-between;gap:12px;min-height:40px;margin-top:10px;padding:8px 16px;border-top:1px solid var(--ws-green-soft);background:var(--ws-green-tint);color:var(--ws-ok);font-size:var(--ws-text-sm)}
.local-badge{flex:none;color:var(--ws-green);font-size:var(--ws-text-xs);font-weight:600;white-space:nowrap}

/* Anleitung */
.howto{margin:56px 4px 40px}
.howto>.eyebrow{font:650 var(--ws-text-xs)/1.4 var(--ws-font);letter-spacing:.12em;text-transform:uppercase;color:var(--ws-accent-ink)}
.howto-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;margin-top:18px}
.howto article{padding:22px;border:1px solid var(--ws-line);border-radius:var(--ws-radius-lg);background:var(--ws-surface-soft)}
.howto article>span{font:600 12px var(--ws-mono);letter-spacing:.08em;color:var(--ws-accent-ink)}
.howto h3{margin:8px 0;font-size:18px;font-weight:650;letter-spacing:-.015em}
.howto p{margin:0;color:var(--ws-muted);font-size:14px;line-height:1.65}
#anleitung details{margin-top:20px;padding:0 20px;border:1px solid var(--ws-line);border-radius:var(--ws-radius-lg);background:var(--ws-surface)}
#anleitung summary{padding:16px 0;color:var(--ws-green);font-size:15px;font-weight:600;cursor:pointer}
#anleitung details p{max-width:80ch;margin:0 0 18px}

/* Breite Bildschirme: großzügigere Seitenspalten */
@media (min-width:1400px){
  .workspace{grid-template-columns:272px minmax(0,1fr) 272px}
}
@media (min-width:1600px){
  .workspace{grid-template-columns:300px minmax(0,1fr) 300px}
}

/* Desktop: die Werkbank füllt den Bildschirm, Seitenspalten und Ansichten scrollen für sich. */
@media (min-width:1024px) and (min-height:640px){
  .studio-app{display:flex;flex-direction:column;height:calc(100dvh - var(--ws-bar-h));min-height:620px;padding-bottom:16px}
  .studio-app>.ws-studio-intro,.studio-app>.legacy-notice{flex:none}
  .workspace{flex:1;min-height:0}
  .panel{overflow-y:auto;overscroll-behavior:contain}
  .workbench{overflow:hidden}
  .view-panel{flex:1 1 0;overflow-y:auto;overscroll-behavior:contain}
  .notice{max-height:30%;overflow-y:auto}
  .surface-workspace,.card-workspace{flex:1 0 auto}
  .surface-net,.layout-host{flex:1 1 0}
  .surface-canvas,.scene-host,.card-canvas,.card-preview,.editor-host{height:auto}
  .layout-host{min-height:360px}
}

/* Mittlere Desktopbreite: Einstellungen und Werkzeuge teilen sich die linke Spalte. */
@media (min-width:1024px) and (max-width:1279px){
  .workspace{grid-template-columns:280px minmax(0,1fr);grid-template-rows:minmax(0,3fr) minmax(0,2fr)}
  .settings-panel{grid-column:1;grid-row:1}
  .tools-panel{grid-column:1;grid-row:2;border-left:0;border-right:1px solid var(--ws-line);border-top:2px solid var(--ws-line)}
  .workbench{grid-column:2;grid-row:1/3}
  .ws-bar-actions .ws-link{display:none}
  .pa-extra{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
  .pa-word{display:inline-block;text-transform:capitalize}
}
@media (min-width:1024px) and (min-height:640px) and (max-height:820px){
  .ws-studio-intro{padding-block:10px 10px}
  .ws-studio-intro [data-hero-subline]{display:none}
}
@media (min-width:1024px) and (max-height:639px){
  .workspace{grid-template-columns:260px minmax(0,1fr) 260px}
}

/* Innere Aufteilung nach verfügbarer Breite der Arbeitsfläche */
@container (max-width:700px){
  .surface-workspace{grid-template-columns:1fr}
  .surface-space{border-right:0;border-bottom:1px solid var(--ws-line)}
  .surface-canvas{min-height:360px}
  .surface-net svg{max-height:340px}
  .card-workspace{grid-template-columns:1fr}
  .card-plan{border-right:0;border-bottom:1px solid var(--ws-line)}
  .card-canvas{min-height:440px}
  .card-preview{min-height:300px}
}
@container (max-width:520px){
  .motion-controls{flex-wrap:wrap}
  .motion-controls input[type=range]{flex-basis:calc(100% - 64px)}
  .canvas-caption{flex-wrap:wrap}
}

/* Tablet und Mobil: natürlicher Fluss, Arbeitsfläche zuerst, dann Einstellungen. */
@media (max-width:1023px){
  .workspace{display:flex;flex-direction:column}
  .project-slot{order:-2}
  .workbench{order:-1;border-bottom:1px solid var(--ws-line)}
  .settings-panel{border-right:0}
  .tools-panel{border-left:0;border-top:1px solid var(--ws-line)}
  .panel{display:grid;grid-template-columns:1fr 1fr}
  .panel>.panel-section{border-bottom:1px solid var(--ws-line)}
  .surface-canvas{height:480px}
  .scene-host{height:clamp(340px,60vh,540px)}
  .editor-host{height:660px}
  .card-canvas{height:520px}
  .card-preview{height:320px}
  /* Projektaktionen in der Werkbank */
  .project-slot .project-bar{flex-wrap:wrap;width:100%;gap:8px 10px}
  .project-slot .ws-local{display:inline-flex;flex:1 1 200px;max-width:none;padding:0}
  .project-slot .project-actions{flex-wrap:wrap}
  .project-slot .project-actions>*{min-height:40px}
  .howto-grid{gap:14px}
}
@media (max-width:1279px){
  .ws-studio-intro{flex-wrap:wrap;align-items:flex-start;gap:12px 24px}
}
@media (max-width:760px){
  .ws-studio-intro h1{font-size:24px}
  .ws-studio-intro{padding-top:12px}
  .project-metrics{flex-wrap:wrap;width:100%}
  .project-metrics>div{flex:1 1 0;min-width:0;padding:6px 10px;text-align:left}
  .project-metrics dd{font-size:15px}
  .panel{display:block}
  .panel-section{padding:18px 16px}
  .workbench-header{flex-wrap:wrap;padding:10px 12px}
  .view-tabs{flex:1 1 auto}
  .view-tabs button{flex:1 1 auto;min-height:40px;padding-inline:10px}
  .history-actions{margin-left:auto}
  .history-actions button{width:44px;min-height:44px}
  .surface-toolbar,.card-toolbar{padding:8px 12px}
  .segmented button{min-height:40px}
  .surface-canvas{height:400px}
  .card-canvas{height:470px}
  .kirigami-editor{padding:18px 14px}
  .profile-host{padding:4px}
  .assembly-host{padding:20px 16px}
  .howto{margin-top:36px}
  .howto-grid{grid-template-columns:1fr}
  /* Touch-Ziele */
  button,.button,.workspace :is(input:not([type]),input[type=text],input[type=number],select){min-height:44px}
  .text-button{min-height:40px}
  .project-slot .project-actions{width:100%}
  .project-slot .project-actions>*{flex:1 1 auto;min-height:44px}
  .pa-extra{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
  .pa-word{display:inline-block;text-transform:capitalize}
}
@media (max-width:420px){
  .surface-canvas{height:360px}
  .card-canvas{height:440px}
  .project-slot .project-actions>.primary{flex-basis:100%}
  .canvas-caption>span:last-child{max-width:50%;text-align:right}
}
@media (prefers-reduced-motion:reduce){
  .panel-section>summary::after{transition:none}
}
@media print{.workspace{display:block;box-shadow:none}.panel{display:none}}
