/* Layout: workbench. Showcase of ready designs on top; controls column left, the reel on a cutting mat (drawing) or in a light box (3D) right. */
:root {
  /* magnetic tape and the cutting mat: tape brown for actions, mat green for sections, a pale sage page */
  --bg: #eef0ec;
  --head-h: 64px;   /* the sticky site header (pages.css): what sticks under it starts below */
  --panel: #fbfcfa;
  --fg: #18201c;
  --muted: #56625b;
  --line: #d3d9d4;
  --accent: #6a3b1f;
  --accent-fg: #ffffff;
  --mat: #2c5a4d;
  --mat-line: rgba(255,255,255,.13);
  --mat-line-strong: rgba(255,255,255,.26);
  --studio: #eef0ee;
  --studio-2: #d8ddd9;
  --ok: #2f7a4a;
  --warn: #a8610b;
  --bad: #b3261e;
  --foot-bg: #18211d; --foot-fg: #dfe6e1; --foot-muted: #9fb0a6;
  --font-display: "Oswald", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Golos Text", "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614; --panel: #1a1f1c; --fg: #e3e8e5; --muted: #9aa69f; --line: #2c3430;
    --accent: #d6a27a; --accent-fg: #1d120a; --mat: #1f4239; --mat-line: rgba(255,255,255,.09); --mat-line-strong: rgba(255,255,255,.2);
    --studio: #2a2f2c; --studio-2: #1c211e; --foot-bg: #0c0f0d; --foot-fg: #d5ddd8; --foot-muted: #8d9b93;
    --ok: #6cc28a; --warn: #e3a54a; --bad: #f2827a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121614; --panel: #1a1f1c; --fg: #e3e8e5; --muted: #9aa69f; --line: #2c3430;
  --accent: #d6a27a; --accent-fg: #1d120a; --mat: #1f4239; --mat-line: rgba(255,255,255,.09); --mat-line-strong: rgba(255,255,255,.2);
  --studio: #2a2f2c; --studio-2: #1c211e; --foot-bg: #0c0f0d; --foot-fg: #d5ddd8; --foot-muted: #8d9b93;
  --ok: #6cc28a; --warn: #e3a54a; --bad: #f2827a; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px; line-height: 1.45; margin: 0; }
.wrap { max-width: 1320px; margin: 0 auto; padding-inline: 16px; padding-block: 20px 40px; display: grid; gap: 18px; }
header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; }
h1 { font-family: var(--font-display); font-weight: 600; font-size: 34px; letter-spacing: .01em; margin: 0; line-height: 1.05; text-wrap: balance; text-transform: uppercase; }
h2 { font-family: var(--font-display); font-size: 15px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; }
.spec { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.spec b { color: var(--fg); font-weight: 500; }

.showcase { display: grid; gap: 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (max-width: 600px) { .cards { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 44%; overflow-x: auto; padding-bottom: 4px; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 0 0 10px; cursor: pointer; text-align: left; color: var(--fg); font: inherit; display: grid; gap: 6px; overflow: hidden; }
.card:hover, .card:focus-visible { border-color: var(--accent); outline: none; }
.card canvas { width: 100%; aspect-ratio: 4 / 3; display: block; background: linear-gradient(160deg, var(--studio), var(--studio-2)); }
.card b { font-size: 13.5px; font-weight: 600; padding-inline: 10px; }
.card small { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); padding-inline: 10px; }

.main { display: grid; grid-template-columns: 350px minmax(0,1fr); gap: 18px; align-items: start; }
@media (max-width: 880px) { .main { grid-template-columns: minmax(0,1fr); } .stage { order: -1; } }
.controls { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; display: grid; }
fieldset { border: 0; border-bottom: 1px solid var(--line); margin: 0; padding: 14px 16px 16px; display: grid; gap: 10px; min-width: 0; }
fieldset:last-child { border-bottom: 0; }
legend { float: left; width: 100%; padding: 0; font-family: var(--font-display); font-size: 13.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.sub { font-size: 12px; font-weight: 600; color: var(--muted); margin: 4px 0 -4px; }
.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.seg label { flex: 1 1 auto; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.views button { flex: 1 1 auto; border: 0; border-right: 1px solid var(--line); background: none; color: inherit; font: inherit; font-size: 13px; padding: 7px 10px; cursor: pointer; white-space: nowrap; }
.views button:last-child { border-right: 0; }
.views button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.mat.v3d canvas { cursor: grab; touch-action: none; }
.mat.v3d.dragging canvas { cursor: grabbing; }
.seg span { display: block; text-align: center; padding: 7px 8px; font-size: 13px; cursor: pointer; border-right: 1px solid var(--line); user-select: none; white-space: nowrap; }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }
.seg input:disabled + span { opacity: .45; cursor: not-allowed; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { font: 600 13px var(--font-body); background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 6px 10px; cursor: pointer; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.row { display: grid; grid-template-columns: minmax(0,1fr) 78px; gap: 4px 10px; align-items: center; }
.row > label { grid-column: 1 / -1; font-size: 13px; color: var(--fg); display: flex; justify-content: space-between; gap: 8px; }
.row > label small { color: var(--muted); font-size: 12px; }
input[type=range] { width: 100%; accent-color: var(--accent); margin: 0; }
input[type=number], select { width: 100%; font: 500 13px var(--font-mono); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 5px 6px; font-variant-numeric: tabular-nums; }
select { font-family: var(--font-body); }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.note { font-size: 12.5px; color: var(--muted); margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.palette { display: grid; gap: 6px; }
.palette .name { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; }
.palette .name b { color: var(--fg); font-weight: 500; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); cursor: pointer; padding: 0; }
.swatches button[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }

.stage { display: grid; gap: 12px; min-width: 0; align-content: start; align-self: stretch; }   /* as tall as the settings: the top part sticks all the way down */
/* Ivan, 2026-11-20: the view switch, the check result, the price and the picture stay on the screen while the settings
   scroll, and so do undo / redo / share (a click on them must not need a scroll up); only the facts scroll under them. The site header is sticky too: start below it. */
.stage-top { display: grid; gap: 12px; min-width: 0; position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--head-h, 64px) + 10px); z-index: 4; background: var(--bg); padding-bottom: 4px; }
.stage-top > .mat { max-height: min(70vh, calc(100vh - var(--head-h, 64px) - 225px)); }
/* 3D: the zoom and camera buttons take a second line in the view bar */
.stage-top:has(#camWrap:not([hidden])) > .mat { max-height: min(70vh, calc(100vh - var(--head-h, 64px) - 275px)); }
.stage-top > .mat.deckview { max-height: calc(100vh - var(--head-h, 64px) - 285px); }
@media (max-width: 880px) { .stage-top { position: static; } }
.viewbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.viewbar .seg { min-width: 300px; }
.viewbar .tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.zoom { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.zoom input[type=range] { width: 130px; }
.zoom output { font: 500 12.5px var(--font-mono); color: var(--fg); min-width: 3.5em; }
.mat.deckview { background: radial-gradient(circle at 50% 30%, var(--studio), var(--studio-2)); max-height: none; }
.deckbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.deckbar .seg { min-width: 0; }
.mat { background: var(--mat); border-radius: 6px; overflow: hidden; aspect-ratio: 1 / 1; max-height: 70vh; width: 100%; max-width: 100%; display: grid; place-items: center; }
.mat.studio { background: radial-gradient(circle at 40% 35%, var(--studio), var(--studio-2)); }
.mat svg, .mat canvas { width: 100%; height: 100%; display: block; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.bar .left { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { font: 600 13px var(--font-body); padding: 8px 14px; border-radius: 5px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg); cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.inline { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.inline select { width: auto; }
.status { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid currentColor; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); }
.toast { font-size: 12.5px; color: var(--muted); }
input[type=text] { width: 100%; font: 500 14px var(--font-body); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; }
.model { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; display: grid; gap: 8px; }
.model-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 14px; }
.parts { display: grid; }
.part { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.part:first-child { border-top: 0; }
.part b { font-weight: 600; font-size: 13.5px; }
.part small { display: block; color: var(--muted); font-size: 12.5px; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
@media (prefers-reduced-motion: no-preference) { .seg span, .card, .btn { transition: background .12s, border-color .12s; } }

/* 2026-11-16: shape icons, fonts with previews, foldable sections, slider limits, status above the picture */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.seg.shapes { display: grid; grid-template-columns: repeat(4, 1fr); }
.seg.shapes span { display: grid; place-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.seg.shapes label:nth-child(4n) span { border-right: 0; }
.seg.shapes label:nth-last-child(-n+4) span { border-bottom: 0; }
.seg.shapes svg { width: 24px; height: 24px; fill: currentColor; }
#shapeName { margin-top: -4px; }
.fontpick { display: grid; gap: 4px; }
.fontpick .lbl { font-size: 13px; }
.fontsel { position: relative; }
#textFontBtn { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--fg); cursor: pointer; }
#textFontBtn::after { content: "▾"; font-size: 12px; color: var(--muted); }
#textFontBtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fonts { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); display: grid; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 22px rgba(0,0,0,.18); max-height: 320px; overflow: auto; }
.fonts button { all: unset; box-sizing: border-box; display: flex; align-items: center; min-height: 40px; padding: 6px 10px; border-radius: 4px; color: var(--fg); cursor: pointer; font: 13px var(--font-body); }
.fonts button:hover, .fonts button:focus-visible { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.fonts button[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--accent); }
.fontsel small { color: var(--muted); font-size: 12px; margin-left: 10px; margin-right: auto; }
.fontsel svg { height: 22px; max-width: 100%; fill: currentColor; overflow: visible; display: block; }
fieldset > legend .fold { all: unset; cursor: pointer; display: flex; justify-content: space-between; align-items: center; width: 100%; }
fieldset > legend .fold::after { content: "▾"; font-size: 12px; transition: transform .12s; }
fieldset > legend .fold:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
fieldset.folded > legend .fold::after { transform: rotate(-90deg); }
fieldset.folded > :not(legend) { display: none !important; }
.rng { position: relative; display: block; min-width: 0; --trk-off: color-mix(in srgb, var(--fg) 28%, var(--panel)); }
.rng .lim { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.rng .lim i { position: absolute; top: 50%; }
.rng .lim .ok { height: 8px; margin-top: -4px; border-radius: 4px; background: color-mix(in srgb, var(--fg) 6%, var(--panel)); box-shadow: inset 0 0 0 1px var(--accent); }
.rng .lim .fill { height: 8px; margin-top: -4px; border-radius: 4px; background: var(--accent); }
.rng .lim .off { height: 2px; margin-top: -1px; border-radius: 1px; background: var(--trk-off); }
.rng input[type=range] { position: relative; z-index: 1; display: block; -webkit-appearance: none; appearance: none; height: 18px; background: transparent; cursor: pointer; }
.rng input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: var(--trk, var(--trk-off)); }
.rng input[type=range]::-moz-range-track { height: 8px; border-radius: 4px; background: var(--trk, var(--trk-off)); }
.rng input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -4px; border: 0; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--panel), 0 1px 3px rgba(0,0,0,.4); }
.rng input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--panel), 0 1px 3px rgba(0,0,0,.4); }
.rng input[type=range]:focus-visible { outline: none; }
.rng input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.rng input[type=range]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.rng input[type=range]:disabled { cursor: default; opacity: .5; }
#status { border: 0; padding: 0; font-weight: 400; font-size: inherit; border-radius: 0; justify-self: stretch; }
.mat.dragtext canvas { cursor: grabbing; }
.mat canvas.v2.cantext { cursor: grab; }
@media (max-width: 880px) {
  /* phone: the picture stays on screen while the settings scroll under it */
  .stage, .stage-top { display: contents; }
  .stage > *, .stage-top > * { order: 1; }
  .stage-top > .viewbar { order: -6; }
  .stage-top > #editBar { order: -5; }
  .stage-top > .mat { order: -4; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 60px); z-index: 5; aspect-ratio: auto; height: 40vh; max-height: none; box-shadow: 0 6px 14px rgba(0,0,0,.18); }
  /* the check result and the price ride just under the picture, so they are seen while the settings are changed */
  .stage-top > #statusBar { order: -3; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 60px + 40vh); z-index: 5; background: var(--bg); padding: 6px 0; }
  .stage-top > #deckbar { order: -2; }
  .stage-top > .bar.buy { order: -1; }
  .stage-top > .mat.deckview { position: static; height: auto; max-height: none; aspect-ratio: 16 / 10; }
  .stage-top:has(> .mat.deckview) > #statusBar { position: static; }
}

/* 2026-11-17: price in the line with the check result, limits under a slider, «Дополнительно» for the text, a note while
   the reel changes, bigger targets for a finger */
.statusbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.statusbar .status { flex: 1 1 220px; min-width: 0; }
.pricebox { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.pricebox .price { text-align: right; }
.pricebox .price small { max-width: 260px; }
.limtxt { grid-column: 1 / -1; font-size: 12px; color: var(--warn); margin-top: -2px; }
.limtxt[hidden] { display: none; }
details.more { border: 1px solid var(--line); border-radius: 5px; }
details.more > summary { display: flex; align-items: baseline; gap: 10px; padding: 8px 10px; cursor: pointer; font-size: 13px; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸"; font-size: 11px; color: var(--muted); transition: transform .12s; }
details.more[open] > summary::before { transform: rotate(90deg); }
details.more > summary small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
details.more > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* several inscriptions, several lines in each (2026-11-19) */
.ttabs { flex-wrap: wrap; }
.ttabs button.add { color: var(--accent); }
.linebox { display: grid; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
/* a long summary under «Дополнительно» or a row of tabs must not widen the panel past the screen */
#textBody, .linebox { grid-template-columns: minmax(0, 1fr); }
#lineDel, #textDel { justify-self: start; }
#textMoreRows { display: grid; gap: 10px; padding: 2px 10px 12px; }
.mat { position: relative; }
.mat[data-busy]::after { content: attr(data-busy); position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center;
  background: rgba(16, 18, 20, .55); color: #fff; font: 600 15px var(--font-body); animation: busy-in .15s ease-out both; }
@keyframes busy-in { from { opacity: 0; } }
@media (max-width: 880px) {
  .statusbar { flex-wrap: nowrap; align-items: center; }
  .statusbar .status { flex: 1 1 auto; }
  .pricebox { gap: 8px; flex: none; }
  .pricebox .price span, .pricebox .price small { display: none; }
  .pricebox .price b { font-size: 18px; white-space: nowrap; }
}
/* a finger needs about 44 px (phones and tablets; a mouse keeps the compact panel) */
@media (max-width: 880px), (pointer: coarse) {
  .seg span { min-height: 44px; display: flex; align-items: center; justify-content: center; box-sizing: border-box; }
  .seg.shapes span { display: grid; }
  .views button, .tabs button, .btn { min-height: 44px; }
  .btn.sq { min-width: 44px; }
  select, input[type=number], input[type=text] { min-height: 44px; font-size: 16px; }   /* 16 px: iPhone does not zoom in on focus */
  .row { grid-template-columns: minmax(0,1fr) 84px; }
  .check { min-height: 44px; }
  .check input { width: 20px; height: 20px; }
  fieldset > legend .fold { min-height: 44px; }
  details.more > summary { min-height: 44px; box-sizing: border-box; align-items: center; }
  #textFontBtn, .fonts button { min-height: 44px; }
  .swatches { gap: 8px; }
  .swatches button { width: 36px; height: 36px; }
  .rng input[type=range] { height: 44px; }
  .rng input[type=range]::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -9px; }
  .rng input[type=range]::-moz-range-thumb { width: 26px; height: 26px; }
}
/* phone: a field brought into view (by focus or a jump) stops below the sticky picture and price line, not under them */
@media (max-width: 880px) {
  #form :is(input, select, button, summary) { scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 60px + 40vh + 64px); }
}
