@font-face { font-family: 'HK Round'; src: url('/fonts/fredoka.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --bg: #f4ece1;
  --paper: #fffaf3;
  --ink: #2f261e;
  --ink-2: #6e5a47;
  --line: #e3d5c2;
  --wood: #cf9f68;
  --wood-dark: #a8763f;
  --plate: #efe0c6;
  --accent: #3d5a40;
  --accent-2: #2f4632;
  --ok: #3d7a4a;
  --bad: #c8412c;
  --warn: #b7791f;
  --radius: 16px;
  --shadow: 0 10px 30px -12px rgba(59, 38, 20, .35);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --toolbar-h: 64px;
  font-family: ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { overscroll-behavior: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
h1, h2, h3, .brand { font-family: 'HK Round', ui-rounded, sans-serif; font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--ink-2); }

.screen { min-height: 100%; }

/* Buttons */
.btn { border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s, background .2s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-primary.is-blocked { background: #9c8b78; }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); }
.btn-soft { background: #efe3d2; }
.btn-danger { background: #f6ddd7; color: var(--bad); }
.btn-lg { padding: 16px 24px; font-size: 1.08rem; width: 100%; }
.btn-sm { padding: 8px 14px; font-size: .92rem; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; display: inline-grid; place-items: center; flex: none; }
.icon-btn:active { background: rgba(0,0,0,.06); }
.icon-btn svg, .toolbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:disabled { opacity: .3; }

.brand { font-size: 1.35rem; color: var(--ink); display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand .logo { height: 40px; width: auto; display: block; }
.brand .logo-lg { height: 64px; }
.brand.small .logo { height: 34px; }
.ed-logo { height: 26px; width: auto; flex: none; margin: 0 2px 0 -2px; }
@media (max-width: 360px) { .ed-logo { display: none; } }

/* Feedback */
.fb-btn { border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.fb-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fb-float { position: fixed; right: 16px; bottom: calc(16px + var(--safe-b)); z-index: 15; background: var(--ink); color: #fff; border-radius: 999px; padding: 11px 16px 11px 13px; box-shadow: var(--shadow); font-size: .9rem; }
.fb-stage { position: absolute; left: 10px; bottom: 10px; z-index: 3; width: 40px; height: 40px; border-radius: 12px; justify-content: center; background: var(--paper); color: var(--ink-2); box-shadow: var(--shadow); transition: opacity .2s; }
.real-btn { position: absolute; top: 10px; right: 10px; z-index: 3; border: 0; border-radius: 999px; padding: 7px 12px 7px 10px; background: rgba(255,250,243,.94); box-shadow: 0 4px 14px -8px rgba(59,38,20,.5); display: inline-flex; gap: 6px; align-items: center; font-weight: 600; font-size: .8rem; color: var(--ink); cursor: pointer; }
.real-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.stage.dragging .real-btn { opacity: 0; pointer-events: none; }
.real-view { border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 3; background: #eee5d8; box-shadow: var(--shadow); }
.real-view svg { width: 100%; height: 100%; display: block; }
.real-scenes { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 6px; }
.real-scenes button { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-weight: 600; font-size: .85rem; cursor: pointer; }
.real-scenes button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.modal-card .preview.real { aspect-ratio: 4 / 3; max-width: 100%; }
.stage.dragging .fb-stage { opacity: 0; pointer-events: none; }
.fb-moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 4px 0 14px; }
.fb-moods button { border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 8px 0 6px; font-size: 1.7rem; line-height: 1.2; display: grid; justify-items: center; gap: 2px; cursor: pointer; }
.fb-moods button small { font-size: .62rem; color: var(--ink-2); }
.fb-moods button.active { border-color: var(--accent); background: #eef3ec; transform: scale(1.04); }
.fb-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.fb-kinds button { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-weight: 600; font-size: .85rem; cursor: pointer; }
.fb-kinds button.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.fb-text { width: 100%; min-height: 110px; border-radius: 14px; border: 1.5px solid var(--line); padding: 12px; font-size: 16px; resize: vertical; background: #fff; }
.fb-text:focus { outline: none; border-color: var(--accent); }
.fb-done { text-align: center; padding: 18px 0 6px; }
.fb-done .big { font-size: 2.6rem; }
.brand span { display: inline-block; margin-left: 6px; font-size: .62em; text-transform: uppercase; letter-spacing: .16em; color: var(--wood-dark); vertical-align: middle; }
.brand.small { font-size: 1.1rem; }

/* Start */
.start { max-width: 460px; margin: 0 auto; padding: 28px 20px calc(32px + var(--safe-b)); }
.start h1 { font-size: clamp(1.7rem, 7vw, 2.3rem); line-height: 1.1; margin: 8px 0 10px; }
.start .lead { color: var(--ink-2); line-height: 1.55; margin: 0 0 22px; }
.start-hero { aspect-ratio: 1.25; margin: 18px -8px 6px; display: grid; place-items: center; }
.start-hero svg { width: 78%; height: auto; filter: drop-shadow(1px 3px 4px rgba(59,38,20,.3)); }
.start-form { display: grid; gap: 12px; background: var(--paper); padding: 20px; border-radius: 22px; box-shadow: var(--shadow); }
.start-form label { font-weight: 600; font-size: .95rem; }
.start-form input[type=email] { width: 100%; padding: 15px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; font-size: 16px; }
.start-form input[type=email]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(61,90,64,.15); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400 !important; font-size: .9rem !important; color: var(--ink-2); }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
.hint { font-size: .86rem; color: var(--ink-2); margin: 0; text-align: center; line-height: 1.45; }
.form-error { color: var(--bad); margin: 0; font-size: .92rem; text-align: center; }

/* Designs */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; padding-top: max(14px, env(safe-area-inset-top)); }
.designs { max-width: 980px; margin: 0 auto; padding: 4px 18px 40px; }
.designs h1 { font-size: 1.8rem; margin: 8px 0 2px; }
.designs > .muted { margin: 0 0 18px; }
.notice { background: #fff4dc; border: 1px solid #f0d9a6; border-radius: 14px; padding: 14px; margin: 0 0 18px; line-height: 1.45; font-size: .95rem; }
.notice button { margin-top: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 14px; }
.card { background: var(--paper); border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 10px -4px rgba(59,38,20,.25); display: flex; flex-direction: column; border: 0; padding: 0; text-align: left; position: relative; }
.card-thumb { aspect-ratio: 1; background: var(--plate); display: grid; place-items: center; }
.card-thumb svg { width: 100%; height: 100%; display: block; }
.card-meta { padding: 10px 12px 12px; }
.card-meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta small { color: var(--ink-2); }
.badge { position: absolute; top: 8px; left: 8px; background: rgba(255,250,243,.92); border-radius: 999px; padding: 3px 9px; font-size: .74rem; font-weight: 600; }
.badge.ok { color: var(--ok); }
.card-menu { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,250,243,.9); border: 0; font-size: 20px; line-height: 1; }
.card-new { border: 2px dashed #cdb89c; background: transparent; box-shadow: none; display: grid; place-items: center; min-height: 200px; color: var(--accent); font-weight: 600; gap: 6px; text-align: center; }
.card-new .plus { font-size: 2.4rem; line-height: 1; font-family: 'HK Round'; }

/* Editor */
.editor { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; grid-template-areas: "top" "stage" "panel" "tools"; height: 100dvh; overflow: hidden; }
.ed-top { grid-area: top; display: flex; align-items: center; gap: 2px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--bg); position: relative; z-index: 5; }
.ed-name { flex: 1; min-width: 0; border: 0; background: transparent; font-family: 'HK Round'; font-size: 1.05rem; padding: 8px 6px; border-radius: 10px; text-overflow: ellipsis; }
.ed-name:focus { outline: none; background: var(--paper); }
.save-state { font-size: .74rem; color: var(--ink-2); white-space: nowrap; margin-right: 2px; }
.ed-buy { margin-left: 6px; white-space: nowrap; }
@media (max-width: 520px) { .save-state { display: none; } .ed-top .icon-btn { width: 36px; } }

.stage { grid-area: stage; position: relative; overflow: hidden; touch-action: none; background:
  radial-gradient(circle at 50% 40%, #f8f1e7 0%, #ebdfcd 100%); }
#canvas { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
#plate { fill: var(--plate); stroke: #dcc6a3; stroke-width: .6; }
#plate-margin { stroke: #c9ad85; stroke-dasharray: 3 3; stroke-width: .5; }
#plate-label { fill: #a98a63; font-family: 'HK Round', sans-serif; }
.piece-part { fill: var(--wood); }
.mat-schwarz .piece-part { fill: #2b2724; }
.mat-schwarz #piece-inner { filter: none; }
.loose-part { fill: url(#hatch); stroke: var(--bad); stroke-width: 1.2; vector-effect: non-scaling-stroke; animation: pulse 1.4s ease-in-out infinite; pointer-events: none; }
@keyframes pulse { 50% { stroke-opacity: .25; } }
.hit { fill: transparent; cursor: grab; }
.hit-shape { fill: transparent; }
.guide { stroke: #3d8bd8; stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; }
.sel-box { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-dasharray: 5 4; pointer-events: none; }
.sel-box.bad { stroke: var(--bad); }
.handle circle { fill: #fff; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.25)); }
.handle path { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.handle.del circle { stroke: var(--bad); }
.handle.del path { stroke: var(--bad); }
.handle { cursor: pointer; }

.status-chip { position: absolute; top: 10px; left: 10px; z-index: 3; border: 0; border-radius: 999px; padding: 6px 12px 6px 8px; font-weight: 600; font-size: .8rem;
  background: rgba(255,250,243,.94); box-shadow: 0 4px 14px -8px rgba(59,38,20,.5); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center;
  max-width: min(62%, 300px); overflow: hidden; transition: max-width .35s ease, padding .35s ease, opacity .2s, background .2s, color .2s; }
.status-chip svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.status-chip span { overflow: hidden; text-overflow: ellipsis; }
.status-chip.ok { color: var(--ok); }
.status-chip.warn { color: var(--warn); }
.status-chip.bad { color: #fff; background: var(--bad); }
.status-chip.mini { max-width: 34px; padding: 6px 8px; }
.status-chip.mini span { opacity: 0; }
.status-chip.busy { opacity: .55; }
.stage.dragging .status-chip { opacity: 0; pointer-events: none; }
.notice-banner { background: #3d5a40; color: #fff; border-radius: 14px; padding: 12px 14px; margin: 0 0 16px; font-size: .92rem; line-height: 1.45; }
.chip-sm { min-width: 0; padding: 7px 12px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.sym-search { font-size: 16px; padding: 11px 14px; margin-bottom: 10px; }
.sym-cats { margin-bottom: 4px; }
.sym-info { margin: 0 0 8px; font-size: .8rem; color: var(--ink-2); min-height: 1em; }
.sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; }
.sym-tile { border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 8px 2px 5px; display: grid; justify-items: center; gap: 3px; min-width: 0; }
.sym-tile span { width: 40px; height: 40px; display: block; }
.sym-tile svg { width: 100%; height: 100%; fill: var(--wood-dark); }
.sym-tile small { font-size: .66rem; color: var(--ink-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 3px; }
.sym-tile.active { border-color: var(--accent); background: #eef3ec; }
.sym-tile:active { transform: scale(.95); }
.sym-more { grid-column: 1 / -1; }
.cur-symbol { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.cur-symbol .cur-icon { width: 44px; height: 44px; background: #f4ece1; border-radius: 12px; padding: 6px; flex: none; }
.cur-symbol .cur-icon svg { width: 100%; height: 100%; fill: var(--wood-dark); }
.cur-symbol b { flex: 1; }
.swap-box { margin-bottom: 14px; padding: 12px; background: #faf4ea; border-radius: 16px; }
.fit-btn { position: absolute; right: 10px; bottom: 10px; background: var(--paper); box-shadow: var(--shadow); }
.empty-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); background: rgba(255,250,243,.92); border-radius: 16px; padding: 14px 18px; text-align: center; width: min(280px, 80%); pointer-events: none; box-shadow: var(--shadow); line-height: 1.45; }
.empty-hint p { margin: 0; }

.toolbar { grid-area: tools; display: grid; grid-template-columns: repeat(6, 1fr); background: var(--paper); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); position: relative; z-index: 6; }
.toolbar button { border: 0; background: transparent; padding: 9px 0 8px; display: grid; justify-items: center; gap: 3px; font-size: .74rem; font-weight: 600; color: var(--ink-2); min-height: var(--toolbar-h); }
.toolbar button.active { color: var(--accent); }
.toolbar button.active svg { stroke-width: 2.2; }

/* Bottom-Sheet */
.sheet { grid-area: panel; min-height: 0; background: var(--paper); border-radius: 22px 22px 0 0; box-shadow: 0 -12px 30px -16px rgba(59,38,20,.45); z-index: 4; max-height: 46dvh; margin-top: -14px; display: flex; flex-direction: column; animation: up .22s cubic-bezier(.2,.9,.3,1); }
.sheet.compact { max-height: 38dvh; }
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
.sheet-grip { padding: 8px 0 2px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.sheet-grip span { width: 40px; height: 5px; border-radius: 3px; background: #dccbb4; }
.sheet-body { overflow-y: auto; padding: 4px 16px 18px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet h3 { margin: 4px 0 12px; font-size: 1.05rem; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet h3 small { font-family: system-ui, sans-serif; font-weight: 400; color: var(--ink-2); font-size: .8rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; }
.tile { border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 4px 6px; display: grid; justify-items: center; gap: 4px; font-size: .74rem; color: var(--ink-2); }
.tile svg { width: 40px; height: 40px; fill: var(--wood-dark); }
.tile.active { border-color: var(--accent); background: #eef3ec; color: var(--accent); }
.tile:active { transform: scale(.96); }

.field { margin: 0 0 14px; }
.field > label, .field-label { display: flex; justify-content: space-between; font-weight: 600; font-size: .88rem; margin: 0 0 6px; }
.field-label output { font-weight: 400; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.text-input { width: 100%; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line); font-size: 18px; background: #fff; }
.text-input:focus { outline: none; border-color: var(--accent); }
input[type=range] { width: 100%; height: 32px; accent-color: var(--accent); margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row .btn { flex: 1; min-width: 110px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; scroll-snap-align: start; border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 8px 14px; display: grid; gap: 2px; text-align: center; min-width: 96px; }
.chip .f { font-size: 1.45rem; line-height: 1.3; white-space: nowrap; }
.chip small { font-size: .68rem; color: var(--ink-2); }
.chip.active { border-color: var(--accent); background: #eef3ec; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #efe3d2; border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; border-radius: 10px; padding: 11px 6px; font-weight: 600; }
.seg button.active { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.12); color: var(--accent); }
.seg button small { display: block; font-weight: 400; font-size: .74rem; color: var(--ink-2); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid #f0e6d8; font-size: .92rem; }
.toggle input { appearance: none; width: 48px; height: 28px; border-radius: 999px; background: #d9cbb8; position: relative; flex: none; transition: background .2s; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(20px); }
.toggle span small { display: block; color: var(--ink-2); font-size: .78rem; }
.issue { background: #fbe7e2; color: #8e2d1e; border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; font-size: .92rem; line-height: 1.45; }
.issue b { display: block; margin-bottom: 2px; }
.issue .btn { margin-top: 10px; width: 100%; }
.issue.warn { background: #fff3da; color: #7a5212; }
.layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.layers li { display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 8px 8px 8px 12px; }
.layers li.active { border-color: var(--accent); }
.layers li.bad { border-color: var(--bad); }
.layers .lname { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layers .lname small { display: block; color: var(--ink-2); font-size: .74rem; }
.layers .icon-btn { width: 34px; height: 34px; }
.layers .ltype { width: 30px; height: 30px; display: grid; place-items: center; background: #f4ece1; border-radius: 9px; flex: none; }
.layers .ltype svg { width: 20px; height: 20px; fill: var(--wood-dark); }

/* Modal & Toast */
.modal { position: fixed; inset: 0; background: rgba(47,38,30,.45); display: grid; place-items: end center; z-index: 20; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { background: var(--paper); width: 100%; max-width: 520px; border-radius: 24px 24px 0 0; padding: 22px 18px calc(22px + var(--safe-b)); max-height: 92dvh; overflow-y: auto; animation: up .25s cubic-bezier(.2,.9,.3,1); }
.modal-card h2 { margin: 0 0 6px; }
.modal-card .preview { background: var(--plate); border-radius: 16px; aspect-ratio: 1; max-width: 260px; margin: 12px auto; overflow: hidden; }
.modal-card .preview svg { width: 100%; height: 100%; display: block; }
.summary { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.summary li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 6px 0; }
.summary li.total { font-weight: 700; border: 0; font-size: 1.1rem; }
.modal-actions { display: grid; gap: 10px; margin-top: 14px; }
.templates { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0 4px; }
.templates .tile { padding: 8px; }
.templates .tile svg { width: 100%; height: auto; aspect-ratio: 1; fill: initial; border-radius: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--toolbar-h) + 20px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; z-index: 30; font-size: .92rem; max-width: calc(100% - 32px); text-align: center; animation: up .2s; }
.menu { display: grid; gap: 4px; }
.menu button { border: 0; background: transparent; text-align: left; padding: 14px 10px; border-radius: 12px; font-size: 1rem; }
.menu button:active { background: #efe3d2; }
.menu button.danger { color: var(--bad); }

@media (min-width: 900px) {
  .editor { grid-template-columns: 84px 1fr 360px; grid-template-rows: auto 1fr; grid-template-areas: "top top top" "tools stage panel"; }
  .toolbar { grid-template-columns: 1fr; grid-auto-rows: 76px; align-content: start; border-top: 0; border-right: 1px solid var(--line); padding-top: 10px; }
  .sheet, .sheet.compact { position: static; grid-area: panel; max-height: none; margin-top: 0; border-radius: 0; box-shadow: none; border-left: 1px solid var(--line); animation: none; }
  .sheet[hidden] { display: flex !important; }
  .sheet-grip { display: none; }
  .sheet-body { padding: 18px 20px; }
  .modal { place-items: center; }
  .modal-card { border-radius: 24px; }
  .toast { bottom: 28px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Gravur */
.engr-part { pointer-events: none; }
#engr-img { mix-blend-mode: multiply; }
.engr-img { pointer-events: none; }
.upl .upl-presets .upl-preset small { display: none; }
.upl .upl-presets .upl-preset { padding: 7px 2px; min-width: 0; }
.upl .upl-presets .upl-preset b { font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mat-schwarz .engr-part { fill: #8a7a68 !important; }
.cur-symbol .cur-icon.img { padding: 3px; overflow: hidden; }
.cur-symbol .cur-icon.img img { width: 100%; height: 100%; object-fit: contain; }
.cur-symbol .cur-icon.img svg path { fill: var(--wood-dark); }

/* Upload */
.modal-card.wide { max-width: 640px; }
@media (max-width: 899px) { .modal-card.wide { max-height: 100dvh; height: 100dvh; border-radius: 0; padding-top: max(14px, env(safe-area-inset-top)); } }
.upl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.upl-head h2 { margin: 0; }
.upl-head .icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.upl-loading { padding: 60px 0; text-align: center; color: var(--ink-2); }
.upl-stage { position: sticky; top: -22px; z-index: 2; background: var(--paper); padding: 4px 0 10px; margin: 0 -4px; text-align: center; }
.upl-canvas { max-width: 100%; max-height: 34dvh; border-radius: 12px; box-shadow: 0 6px 18px -10px rgba(59,38,20,.5); touch-action: none; background: #d9b07a; }
.upl-busy { position: absolute; top: 12px; right: 12px; background: rgba(47,38,30,.75); color: #fff; font-size: .75rem; padding: 4px 8px; border-radius: 999px; }
.upl-before { position: absolute; left: 10px; bottom: 16px; border: 0; background: rgba(255,250,243,.92); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: .8rem; box-shadow: var(--shadow); user-select: none; -webkit-user-select: none; touch-action: none; }
.upl-stats { font-size: .8rem; color: var(--warn); min-height: 1.1em; margin-top: 4px; }
.upl-presets, .upl-start { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.upl-start { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.upl-preset { border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 8px 4px; display: grid; justify-items: center; gap: 2px; text-align: center; cursor: pointer; }
.upl-preset .ic { font-size: 1.4rem; line-height: 1.2; }
.upl-preset b { font-size: .8rem; }
.upl-preset small { font-size: .66rem; color: var(--ink-2); line-height: 1.25; }
.upl-start .upl-preset { padding: 14px 8px; }
.upl-start .upl-preset .ic { font-size: 1.9rem; }
.upl-start .upl-preset b { font-size: .92rem; }
.upl-start .upl-preset small { font-size: .74rem; }
.upl-preset.active { border-color: var(--accent); background: #eef3ec; }
.upl-mode { margin-bottom: 12px; }
.upl-controls .hint, .upl-more .hint { display: block; font-size: .74rem; color: var(--ink-2); margin-top: -2px; }
.upl-more { margin: 4px 0 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.upl-more summary { font-weight: 600; cursor: pointer; padding: 6px 0 10px; color: var(--accent); }
.upl-more .seg { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); }
.upl-tips { background: #faf4ea; border-radius: 14px; padding: 10px 14px; font-size: .85rem; color: var(--ink-2); }
.upl-tips ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.6; }
.upl-controls .seg button, .upl-more .seg button { padding: 9px 4px; font-size: .82rem; }
