/* Draft workshop (pattern editor): src/workshop/editor.js. Uses the workshop tokens from
   style.css (--mat, --mat-line, --chalk, --paper, --pin, --thread) with fallbacks. */
.draft-view { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--mat, #2f5d50); }
.stage.split .draft-view { right: 40%; border-right: 1px solid var(--line); }
.stage.split #three { position: absolute; right: 0; top: 0; width: 40%; height: 100%; visibility: visible !important; }
@media (max-width: 820px) {
  .stage.split .draft-view { right: 0; bottom: 42%; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage.split #three { top: auto; bottom: 0; width: 100%; height: 42%; }
}
.ws-svg { flex: 1; width: 100%; min-height: 0; display: block; touch-action: none; user-select: none; outline: none; cursor: default; }
.ws-svg[data-tool="draw"] { cursor: crosshair; }
.ws-svg[data-tool="sew"] { cursor: cell; }
.ws-mat { fill: var(--mat, #2f5d50); }
.ws-grid1 { stroke: var(--mat-line, rgba(255, 255, 255, .10)); }
.ws-grid10 { stroke: var(--mat-line-strong, rgba(255, 255, 255, .24)); }
.ws-body { opacity: .3; filter: invert(1); }
.ws-landmarks line { stroke: var(--chalk, #f4efe2); opacity: .35; }
.ws-landmarks text { fill: var(--chalk, #f4efe2); opacity: .6; font-family: var(--font); }
.ws-landmarks .ws-centre { stroke: var(--chalk, #f4efe2); opacity: .55; }
.ws-centre-t { fill: var(--chalk, #f4efe2); }
.ws-piece .ws-fill { stroke: #3b2f25; fill-opacity: .88; cursor: move; }
.ws-piece.mirror .ws-fill { fill-opacity: .42; stroke-dasharray: 2 1.5; cursor: default; pointer-events: none; }
.ws-piece.ghost .ws-fill { fill-opacity: .10; stroke: var(--chalk, #f4efe2); stroke-dasharray: 2 1.5; pointer-events: none; }
.ws-piece.ghost .ws-pname, .ws-piece.ghost .ws-elabel { display: none; }
.ws-piece.sel .ws-fill { stroke: var(--pin, #e0443e); }
.ws-fold { stroke: #3b2f25; opacity: .8; }
.ws-seam { pointer-events: none; }
.ws-piece.ghost .ws-seam { opacity: .45; }
.ws-edge-hit { stroke: transparent; cursor: pointer; }
.ws-edge-hit:hover { stroke: rgba(255, 255, 255, .25); }
.ws-svg[data-tool="sew"] .ws-edge-hit:hover { stroke: rgba(255, 220, 120, .55); }
.ws-edge-sel { stroke: var(--pin, #e0443e); pointer-events: none; }
.ws-pt { fill: #fffdf7; stroke: #3b2f25; cursor: grab; }
.ws-pt.formula { fill: #ffe4a8; }
.ws-pt.on { fill: var(--pin, #e0443e); stroke: #fff; }
.ws-pt.first { fill: var(--pin, #e0443e); }
.ws-handle { fill: #fff; stroke: var(--pin, #e0443e); stroke-width: .3; cursor: grab; }
.ws-handle-line { stroke: var(--pin, #e0443e); opacity: .8; }
.ws-grain { stroke: #3b2f25; opacity: .7; pointer-events: none; }
.ws-arrowhead { fill: #3b2f25; opacity: .7; }
.ws-pname { fill: #2a211a; font-family: var(--font-display, Georgia, serif); font-weight: 600; pointer-events: none; }
.ws-elabel { fill: #2a211a; font-family: var(--font); font-style: italic; opacity: .8; pointer-events: none; }
.ws-badge { cursor: pointer; }
.ws-badge text { fill: #fff; font-family: var(--font); font-weight: 700; pointer-events: none; }
.ws-badge circle { stroke: #fff; stroke-width: .25; }
.ws-drawline { stroke: var(--pin, #e0443e); stroke-dasharray: 1.5 1; }
.ws-readout { fill: #fff; font-family: var(--font); font-weight: 600; paint-order: stroke; stroke: rgba(0, 0, 0, .55); stroke-width: .5; pointer-events: none; }

.ws-toolbar {
  position: absolute; top: 10px; left: 10px; right: 10px; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  pointer-events: none;
}
.ws-toolbar > * { pointer-events: auto; }
.ws-tools { display: flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); }
.ws-tool {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink-2); cursor: pointer; font-size: 13px; font-weight: 500;
}
.ws-tool.icon-only { padding: 0 8px; }
.ws-tool:hover { background: var(--surface-2); color: var(--ink); }
.ws-tool.active, .ws-tool.on { background: var(--accent); color: var(--accent-ink); }
.ws-layer { background: var(--surface); box-shadow: var(--shadow-sm); }
.ws-hint {
  position: absolute; right: 12px; bottom: 12px; max-width: min(520px, calc(100% - 200px)); z-index: 2;
  padding: 7px 12px; border-radius: 10px; font-size: 12.5px; color: var(--ink); background: var(--surface); opacity: .94;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); pointer-events: none;
}
.ws-empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.ws-empty p { max-width: 340px; text-align: center; color: var(--chalk, #f4efe2); font-size: 15px; background: rgba(0, 0, 0, .25); padding: 14px 18px; border-radius: 14px; }
@media (max-width: 820px) {
  .ws-tool span { display: none; }
  .ws-tool { padding: 0 9px; }
  .ws-hint { font-size: 12px; bottom: auto; top: 56px; right: 8px; max-width: calc(100% - 16px); }
}

/* side panel */
#draft-panel { display: flex; flex-direction: column; gap: 10px; }
.ws-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius, 12px); padding: 12px 14px; }
.ws-card > summary { cursor: pointer; font-weight: 600; list-style: none; }
.ws-card > summary::-webkit-details-marker { display: none; }
.ws-card > summary::before { content: '▸'; display: inline-block; width: 1em; color: var(--ink-3); transition: transform .15s; }
.ws-card[open] > summary::before { transform: rotate(90deg); }
.ws-card h3 { margin: 0 0 8px; font-size: 15px; font-family: var(--font-display); font-weight: 600; }
.ws-card p { margin: 6px 0; }
.ws-head { display: flex; flex-direction: column; gap: 8px; }
.ws-name { font: 600 17px var(--font-display); border: 1px dashed transparent; background: transparent; padding: 3px 6px; border-radius: 6px; color: var(--ink); }
.ws-name:hover, .ws-name:focus { border-color: var(--line-strong); background: var(--surface-2); }
.ws-head-row, .ws-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.btn.small { height: 30px; padding: 0 10px; font-size: 12.5px; }
.ws-problems { border-color: var(--warn-ink); background: var(--warn-bg); color: var(--warn-ink); font-size: 12.5px; }
.ws-problems ul { margin: 4px 0 0; padding-left: 18px; }
.ws-field { display: flex; flex-direction: column; gap: 3px; margin: 8px 0; font-size: 12.5px; }
.ws-field > span { color: var(--ink-2); font-weight: 500; }
.ws-field input:not([type=range]), .ws-field select { height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font-size: 13px; }
.ws-field input[data-coord] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ws-field input.bad { border-color: #c0392b; }
.ws-field small { color: var(--ink-3); }
.ws-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; margin: 8px 0; }
.ws-seg { margin: 6px 0; display: flex; }
.ws-list { list-style: none; margin: 8px 0 0; padding: 0; }
.ws-list li { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.ws-list li:hover { background: var(--surface-2); }
.ws-list li.on { background: var(--accent-soft); }
.ws-list li > i { width: 14px; height: 14px; border-radius: 4px; flex: none; border: 1px solid rgba(0, 0, 0, .15); }
.ws-list li > i.dot { width: 18px; height: 18px; border-radius: 50%; color: #fff; font: 700 10px/18px var(--font); text-align: center; font-style: normal; }
.ws-list li > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-list li > small { color: var(--ink-3); white-space: nowrap; }
.bad { color: #b3261e; }
:root[data-theme="dark"] .bad { color: #ff8a80; }
.ws-params { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.ws-param { display: grid; grid-template-columns: 1fr 90px 28px; gap: 6px; align-items: center; }
.ws-param input, .ws-newparam { height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.ws-newparam { flex: 1; min-width: 0; font-family: ui-monospace, monospace; }
.ws-names summary { cursor: pointer; color: var(--ink-2); margin-top: 6px; }
.ws-names-grid { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; font-size: 12px; margin-top: 6px; max-height: 220px; overflow: auto; }
.ws-names-grid span { color: var(--ink-3); text-align: right; }
.ws-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.ws-block {
  display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 10px 11px; border-radius: 10px; cursor: pointer;
  background: var(--paper, var(--surface-2)); border: 1.5px dashed var(--line-strong); color: var(--ink);
}
.ws-block:hover:not(:disabled) { border-color: var(--accent); }
.ws-block:disabled { opacity: .55; cursor: not-allowed; }
.ws-block b { font-size: 13.5px; }
.ws-block small { color: var(--ink-2); font-size: 11.5px; line-height: 1.35; }
.ws-howto ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
code { font-size: .92em; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
