/* dtftool – Gestaltung */
@font-face { font-family: "Anton"; src: url("../assets/fonts/anton-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("../assets/fonts/archivo-latin-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../assets/fonts/inter-latin-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --neon: #C8FF2E;
  --neon-dim: rgba(200, 255, 46, .14);
  --ground: #2B2E33;
  --surface: #33363C;
  --surface-2: #3B3F46;
  --sunk: #222428;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #FFFFFF;
  --text-2: #C3C7CE;
  --text-3: #A3A8B0;
  --ok: #6EE7B0;
  --warn: #FFB54A;
  --bad: #FF6B86;
  --mark: #FF3EA5;

  --f-logo: "Anton", Impact, sans-serif;
  --f-head: "Archivo", system-ui, sans-serif;
  --f-ui: "Inter", system-ui, sans-serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --t1: 160ms; --t2: 280ms; --t3: 560ms;
  --bar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground); color: var(--text);
  font: 400 15px/1.5 var(--f-ui);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  display: flex; flex-direction: column; min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--neon); color: #111; padding: 8px 12px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }

/* ---------- Kopfzeile ---------- */
.bar, .foot { flex: none; }
.bar {
  position: sticky; top: 0; z-index: 20; height: var(--bar-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s4);
  padding: 0 var(--s5);
  background: rgba(43, 46, 51, .78); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.logo { font: 400 34px/1 var(--f-logo); text-decoration: none; letter-spacing: .005em; justify-self: start; }
.logo-dtf { color: var(--neon); text-shadow: 0 0 6px rgba(200,255,46,.55), 0 0 18px rgba(200,255,46,.28); }
.logo-tool { color: var(--text); }
.bar-nav { justify-self: end; display: flex; gap: 2px; }
.bar-nav a, .bar-cta { justify-self: end; color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 14px; padding: 8px 12px; border-radius: var(--r-sm); transition: color var(--t1) var(--ease), background var(--t1) var(--ease); }
.bar-nav a:hover, .bar-cta:hover { color: var(--text); background: var(--line); }

/* ---------- Segmentierte Schalter ---------- */
.seg { position: relative; display: inline-flex; padding: 4px; gap: 2px; background: var(--sunk); border-radius: 999px; border: 1px solid var(--line); isolation: isolate; }
.seg button { position: relative; z-index: 1; border: 0; background: none; padding: 8px 18px; border-radius: 999px; color: var(--text-3); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; transition: color var(--t2) var(--ease); white-space: nowrap; }
.seg button[aria-selected="true"], .seg button[aria-checked="true"] { color: #15170F; }
.seg button:not([aria-selected="true"]):not([aria-checked="true"]):hover { color: var(--text); }
.seg-ind { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 999px; background: var(--neon); box-shadow: 0 0 18px rgba(200,255,46,.25); transition: transform var(--t2) var(--ease), width var(--t2) var(--ease); }
.seg .num { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; background: rgba(255,255,255,.08); }
.seg button[aria-selected="true"] .num { background: rgba(0,0,0,.14); }
.seg-sm button { padding: 6px 12px; font-size: 13px; }
.seg-full { display: flex; width: 100%; }
.seg-full button { flex: 1; justify-content: center; }

/* ---------- Ansichten ---------- */
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; animation: viewIn var(--t3) var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Startzustand ---------- */
.empty { flex: 1; display: grid; place-items: center; padding: var(--s8) var(--s5); }
.empty-inner { width: min(760px, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s5); }
.hero-title { font: 800 clamp(36px, 6vw, 68px)/1.02 var(--f-head); letter-spacing: -.025em; margin: 0; text-wrap: balance; }
.hero-title .hl { color: var(--neon); }
.hero-sub { margin: 0; max-width: 56ch; color: var(--text-2); font-size: 17px; text-wrap: pretty; }
.empty-inner > * { animation: rise var(--t3) var(--ease) both; }
.empty-inner > :nth-child(2) { animation-delay: 70ms; }
.empty-inner > :nth-child(3) { animation-delay: 140ms; }
.empty-inner > :nth-child(4) { animation-delay: 210ms; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.drop {
  margin-top: var(--s3); width: 100%; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2);
  border-radius: var(--r-lg); border: 1.5px dashed var(--line-2); background: var(--sunk); cursor: pointer;
  transition: border-color var(--t2) var(--ease), background var(--t2) var(--ease), transform var(--t2) var(--ease), box-shadow var(--t2) var(--ease);
}
.drop:hover, .drop.is-over { border-color: var(--neon); background: #25282C; box-shadow: 0 0 0 6px var(--neon-dim); }
.drop.is-over { transform: scale(1.01); }
.drop-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--neon-dim); color: var(--neon); transition: transform var(--t2) var(--ease); }
.drop:hover .drop-icon, .drop.is-over .drop-icon { transform: translateY(-3px); }
.drop-title { font: 700 20px/1.2 var(--f-head); }
.drop-sub { color: var(--text-3); font-size: 14px; }
.facts { list-style: none; padding: 0; margin: var(--s2) 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2) var(--s5); color: var(--text-3); font-size: 14px; }
.facts b { color: var(--text); font-weight: 600; }

/* ---------- Arbeitsbereich ---------- */
.work { flex: 1; display: grid; grid-template-columns: 240px minmax(0, 1fr) 340px; min-height: 0; height: calc(100vh - var(--bar-h) - 49px); }
.rail { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.rail-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s4) var(--s4) var(--s2); }
.h-small { font: 700 12px/1 var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin: 0; }
.motifs { list-style: none; margin: 0; padding: var(--s2); overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.motif { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--s3); align-items: center; padding: 8px; border-radius: var(--r); border: 1px solid transparent; background: none; text-align: left; width: 100%; transition: background var(--t1) var(--ease), border-color var(--t1) var(--ease); animation: rise var(--t2) var(--ease) both; }
.motif:hover { background: var(--surface); }
.motif[aria-current="true"] { background: var(--surface); border-color: var(--line-2); }
.motif .thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: contain; background: var(--checker); background-size: 10px 10px; }
.motif > span { min-width: 0; display: flex; flex-direction: column; }
.motif .m-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.motif .m-state { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }

:root { --checker: conic-gradient(#3a3d43 25%, #2f3237 0 50%, #3a3d43 0 75%, #2f3237 0); }

.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.stage-tools, .stage-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); flex-wrap: wrap; }
.canvas-wrap { position: relative; flex: 1; min-height: 280px; margin: 0 var(--s4); border-radius: var(--r-lg); overflow: hidden; background: var(--sunk); border: 1px solid var(--line); touch-action: none; }
.canvas-wrap.is-pan { cursor: grab; } .canvas-wrap.is-panning { cursor: grabbing; } .canvas-wrap.is-pick { cursor: crosshair; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scan { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: var(--neon); box-shadow: 0 0 12px 2px rgba(200,255,46,.6), 0 0 48px 8px rgba(200,255,46,.18); opacity: 0; pointer-events: none; }
.scan.run { animation: scan 900ms var(--ease) both; }
@keyframes scan { 0% { opacity: 0; transform: translateX(0); } 12% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateX(var(--scan-w, 600px)); } }
.pick-hint { position: absolute; left: 50%; top: var(--s4); transform: translateX(-50%); background: rgba(20,22,25,.86); padding: 8px 14px; border-radius: 999px; font-size: 13px; border: 1px solid var(--line-2); animation: rise var(--t2) var(--ease) both; }
.legend { font-size: 13px; color: var(--text-3); display: inline-flex; align-items: center; gap: 8px; min-height: 20px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--mark); display: inline-block; transition: background var(--t2) var(--ease); }
.foot-left { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.marks { display: flex; gap: 6px; padding-left: var(--s3); border-left: 1px solid var(--line); animation: rise var(--t2) var(--ease) both; }
.marks button { width: 20px; height: 20px; border-radius: 50%; padding: 0; border: 2px solid var(--ground); background: var(--c); box-shadow: 0 0 0 1px var(--line-2); transition: transform var(--t1) var(--ease), box-shadow var(--t1) var(--ease); }
.marks button:hover { transform: scale(1.12); }
.marks button[aria-checked="true"] { box-shadow: 0 0 0 2px var(--text); }
.zoom { display: flex; align-items: center; gap: 4px; }
.zoom-val { border: 0; background: none; color: var(--text-2); font-size: 13px; min-width: 76px; padding: 6px 8px; border-radius: var(--r-sm); font-variant-numeric: tabular-nums; }
.zoom-val:hover { background: var(--line); color: var(--text); }

.swatches { display: flex; gap: 6px; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-2); padding: 0; transition: transform var(--t1) var(--ease), border-color var(--t1) var(--ease); }
.sw:hover { transform: scale(1.08); }
.sw[aria-checked="true"] { border-color: var(--neon); }
.sw-checker { background: var(--checker); background-size: 8px 8px; }
.tools-right { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.sim-toggle { display: flex; align-items: center; gap: var(--s2); font-size: 13px; color: var(--text-2); transition: opacity var(--t2) var(--ease); }
.sim-toggle.is-off { opacity: .45; }
.sw-navy { background: #1B2A4A; }
.sw-dark { background: #111214; } .sw-light { background: #F4F4F2; } .sw-red { background: #B3122E; }

/* ---------- Inspektor ---------- */
.inspector { border-left: 1px solid var(--line); overflow: auto; padding: var(--s3); display: flex; flex-direction: column; gap: var(--s3); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.inspector .card { animation: rise var(--t3) var(--ease) both; }
.inspector .card:nth-child(2) { animation-delay: 50ms; } .inspector .card:nth-child(3) { animation-delay: 100ms; } .inspector .card:nth-child(4) { animation-delay: 150ms; }

.diag { display: flex; flex-direction: column; gap: var(--s2); }
.d-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s3); align-items: baseline; padding: 10px 12px; border-radius: var(--r); background: var(--sunk); }
.d-row .d-k { font-size: 13px; color: var(--text-2); }
.d-row .d-v { font: 700 18px/1.1 var(--f-head); font-variant-numeric: tabular-nums; text-align: right; }
.d-row .d-note { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.badge { display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1 var(--f-ui); padding: 5px 8px; border-radius: 999px; background: rgba(255,255,255,.06); white-space: nowrap; }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.bad { color: var(--bad); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.quick { margin-top: 4px; justify-self: start; grid-column: 1 / -1; }

.size-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: var(--s2); }
.link { color: var(--text-3); padding-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.input-unit { position: relative; display: flex; }
.input-unit input { width: 100%; background: var(--sunk); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 34px 10px 12px; font-size: 15px; font-variant-numeric: tabular-nums; transition: border-color var(--t1) var(--ease), box-shadow var(--t1) var(--ease); -moz-appearance: textfield; }
.input-unit input::-webkit-inner-spin-button { -webkit-appearance: none; }
.input-unit input:focus { outline: none; border-color: var(--neon); box-shadow: 0 0 0 4px var(--neon-dim); }
.input-unit i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--text-3); font-size: 13px; pointer-events: none; }
.trim-row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.btn-link { border: 0; background: none; padding: 6px 2px; color: var(--text-3); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.btn-link:hover { color: var(--text); }
.trim-meta { color: var(--ok); }
.sl-size { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--text-3); }
.sl-size input { width: 64px; background: var(--ground); border: 1px solid var(--line-2); border-radius: 6px; padding: 4px 6px; font-size: 13px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; transition: border-color var(--t1) var(--ease), box-shadow var(--t1) var(--ease); }
.sl-size input::-webkit-inner-spin-button { -webkit-appearance: none; }
.sl-size input:focus { outline: none; border-color: var(--neon); box-shadow: 0 0 0 3px var(--neon-dim); }
.meta, .hint { margin: 0; font-size: 12.5px; color: var(--text-3); }

.reveal { display: grid; grid-template-rows: 0fr; opacity: 0; margin-top: calc(var(--s3) * -1); transition: grid-template-rows var(--t2) var(--ease), opacity var(--t2) var(--ease), margin-top var(--t2) var(--ease); }
.reveal.open { grid-template-rows: 1fr; opacity: 1; margin-top: 0; }
.reveal-in { overflow: hidden; min-height: 0; display: flex; flex-direction: column; gap: var(--s3); }

.range { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-2); }
.range > span { display: flex; justify-content: space-between; }
.range output { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: none; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(var(--neon), var(--neon)) 0 / var(--p, 50%) 100% no-repeat, var(--sunk); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--sunk); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--neon); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 6px rgba(0,0,0,.4); transition: transform var(--t1) var(--ease); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 6px rgba(0,0,0,.4); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }

.divider { height: 1px; background: var(--line); margin: 2px 0; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); font-size: 14px; font-weight: 500; }
.toggle-row.small { font-size: 13px; font-weight: 400; color: var(--text-2); }
.switch { width: 42px; height: 24px; border-radius: 999px; border: 0; padding: 0; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line-2); position: relative; transition: background var(--t2) var(--ease); flex: none; }
.switch span { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform var(--t2) var(--ease); }
.switch[aria-checked="true"] { background: var(--neon); }
.switch[aria-checked="true"] span { transform: translateX(18px); background: #15170F; }
.pick-row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.color-chip { width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--checker); background-size: 8px 8px; flex: none; transition: background var(--t2) var(--ease); }

.qty-row { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 500; }
.stepper { display: inline-flex; align-items: center; background: var(--sunk); border-radius: 999px; border: 1px solid var(--line); }
.stepper button { width: 36px; height: 36px; border: 0; background: none; border-radius: 50%; font-size: 18px; color: var(--text-2); transition: background var(--t1) var(--ease), color var(--t1) var(--ease); }
.stepper button:hover { background: var(--line); color: var(--text); }
.stepper output { min-width: 32px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.inspector > .card-cta { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -16px 24px -12px rgba(43,46,51,.9); }
.cta-row { display: grid; grid-template-columns: auto 1fr; gap: var(--s2); }

/* ---------- Knöpfe ---------- */
.btn-primary, .btn-ghost { border-radius: var(--r); padding: 12px 18px; font-weight: 700; font-size: 14px; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform var(--t1) var(--ease), background var(--t1) var(--ease), box-shadow var(--t2) var(--ease), color var(--t1) var(--ease); }
.btn-primary { background: var(--neon); color: #15170F; box-shadow: 0 0 0 0 rgba(200,255,46,0); }
.btn-primary:hover { box-shadow: 0 6px 28px -6px rgba(200,255,46,.55); }
.btn-primary:active, .btn-ghost:active { transform: scale(.98); }
.btn-primary small { font-weight: 600; opacity: .7; }
.btn-primary:disabled { opacity: .4; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { background: #454952; }
.btn-ghost.is-active { box-shadow: inset 0 0 0 1.5px var(--neon); color: var(--neon); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-full { width: 100%; }
.btn-icon { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 0; background: none; color: var(--text-2); cursor: pointer; transition: background var(--t1) var(--ease), color var(--t1) var(--ease); }
.btn-icon:hover { background: var(--line); color: var(--text); }

/* ---------- Bogen ---------- */
.sheet-layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 0; height: calc(100vh - var(--bar-h) - 49px); }
.sheet-scroll { overflow: auto; padding: var(--s6) var(--s5) var(--s8); display: flex; justify-content: center; gap: var(--s2); }
.ruler { position: relative; width: 34px; flex: none; }
.ruler span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ruler span::after { content: ""; position: absolute; right: -6px; top: 50%; width: 4px; height: 1px; background: var(--text-3); }
.sheet {
  position: relative; flex: none; border-radius: 6px;
  background-color: #26292D;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: var(--cm10) var(--cm10);
  box-shadow: 0 0 0 1px var(--line-2), 0 24px 60px -24px rgba(0,0,0,.6);
}
.used-line { position: absolute; left: -8px; right: -8px; height: 0; border-top: 1.5px dashed var(--neon); transition: top var(--t2) var(--ease), opacity var(--t2) var(--ease); pointer-events: none; z-index: 5; }
.used-line span { position: absolute; right: 0; top: 4px; font-size: 11px; font-weight: 600; color: var(--neon); background: var(--ground); padding: 2px 6px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.piece { position: absolute; cursor: grab; touch-action: none; border-radius: 2px; transition: left var(--t2) var(--ease), top var(--t2) var(--ease), width var(--t2) var(--ease), height var(--t2) var(--ease), box-shadow var(--t1) var(--ease); animation: pieceIn var(--t3) var(--ease) both; }
@keyframes pieceIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
.piece img { position: absolute; left: 50%; top: 50%; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.piece:hover { box-shadow: 0 0 0 1px var(--line-2); }
.piece.is-sel { box-shadow: 0 0 0 1.5px var(--neon); z-index: 3; }
.piece.is-drag { transition: none; cursor: grabbing; z-index: 4; box-shadow: 0 0 0 1.5px var(--neon), 0 12px 30px -8px rgba(0,0,0,.7); }
.piece.is-clash { box-shadow: 0 0 0 1.5px var(--bad); }
.piece-tools { position: absolute; top: -40px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; background: rgba(20,22,25,.92); padding: 4px; border-radius: 10px; border: 1px solid var(--line-2); animation: rise var(--t2) var(--ease) both; z-index: 6; }
.piece-tools button { width: 30px; height: 30px; border: 0; background: none; border-radius: 7px; color: var(--text-2); display: grid; place-items: center; }
.piece-tools button:hover { background: var(--line); color: var(--text); }

.len-num { font: 800 40px/1 var(--f-head); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.len-num small { font: 500 15px/1 var(--f-ui); color: var(--text-3); letter-spacing: 0; }
.len-bar { height: 6px; border-radius: 6px; background: var(--sunk); overflow: hidden; margin: var(--s3) 0 var(--s2); }
.len-bar span { display: block; height: 100%; width: 0; background: var(--neon); border-radius: 6px; transition: width var(--t3) var(--ease); }
.len-bar span.full { background: var(--bad); }
.sheet-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.sheet-list li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: 6px; border-radius: var(--r); background: var(--sunk); }
.sheet-list img { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; background: var(--checker); background-size: 8px 8px; }
.sheet-list li > span { display: flex; flex-direction: column; min-width: 0; }
.sheet-list .sl-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-list .sl-meta { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sheet-list .stepper button { width: 30px; height: 30px; font-size: 16px; }
.sheet-list .stepper output { min-width: 24px; font-size: 13px; }
.warn-box { font-size: 13px; color: var(--warn); background: rgba(255,181,74,.08); border: 1px solid rgba(255,181,74,.25); border-radius: var(--r); padding: 10px 12px; line-height: 1.45; }
.after-cta { display: block; text-align: center; color: var(--text-2); text-decoration: none; font-size: 14px; padding: var(--s2); border-radius: var(--r); animation: rise var(--t3) var(--ease) both; }
.after-cta b { color: var(--neon); }
.after-cta:hover { background: var(--line); }

/* ---------- Fuß, Hinweise ---------- */
.foot { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); padding: 14px var(--s5); border-top: 1px solid var(--line); font-size: 13px; color: var(--text-3); flex-wrap: wrap; }
.foot nav { display: flex; gap: var(--s4); }
.foot a { color: var(--text-2); text-decoration: none; }
.foot a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #17191C; border: 1px solid var(--line-2); color: var(--text); padding: 12px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity var(--t2) var(--ease), transform var(--t2) var(--ease); z-index: 50; box-shadow: 0 16px 40px -12px rgba(0,0,0,.6); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.busy { position: fixed; inset: 0; background: rgba(24,26,29,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 60; animation: fade var(--t2) var(--ease) both; }
@keyframes fade { from { opacity: 0; } }
.busy-card { display: flex; align-items: center; gap: var(--s3); background: var(--surface); border: 1px solid var(--line-2); padding: 16px 22px; border-radius: var(--r-lg); font-weight: 600; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--neon); animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal { border: 1px solid var(--line-2); background: var(--surface); color: var(--text); border-radius: var(--r-lg); padding: var(--s5); max-width: 420px; }
.modal::backdrop { background: rgba(20,22,25,.6); backdrop-filter: blur(4px); }
.modal[open] { animation: rise var(--t2) var(--ease) both; }
.modal h2 { font: 700 20px/1.2 var(--f-head); margin: 0 0 var(--s2); }
.modal p { color: var(--text-2); margin: 0 0 var(--s4); }

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 1100px) {
  .work { grid-template-columns: 200px minmax(0, 1fr) 300px; }
  .sheet-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 860px) {
  .bar { grid-template-columns: auto 1fr; padding: 0 var(--s4); }
  .bar .steps { justify-self: end; }
  .bar-cta, .bar-nav { display: none; }
  .work, .sheet-layout { display: flex; flex-direction: column; height: auto; }
  main, .view { min-height: auto; flex: none; }
  .work > *, .sheet-layout > * { flex: none; }
  .stage { min-height: 60vh; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .motifs { flex-direction: row; overflow-x: auto; }
  .motif { width: 200px; flex: none; }
  .canvas-wrap { min-height: 52vh; }
  .inspector { border-left: 0; overflow: visible; }
  .sheet-scroll { padding: var(--s4); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
  .scan { display: none; }
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hero-more { margin: 0; font-size: 14px; color: var(--text-3); }
.hero-more a { color: var(--text-2); text-underline-offset: 3px; transition: color var(--t1) var(--ease); }
.hero-more a:hover { color: var(--neon); }
.empty-inner > :nth-child(5) { animation-delay: 280ms; }
