/* v19 «Збери свою лінійку» — общие стили; телефон — v19-m.css, компьютер — v19-d.css */

:root {
  --brand: #b7a6cf;
  --bg: #f5efe6;
  --ink: #221c18;
  --muted: #6a5f56;
  --card: #fffaf3;
  --line: #e2d6c6;
  --soft: #ece3d6;
  --ok: #2c7a4d;
  --bad: #b2452c;
  --down: #8a6a1a;
  --stage-mid: #e9e1d5;
  --stage-dark: #1d1916;
  --stage-light: #f7f2ea;
  --shadow: 0 10px 30px rgb(40 28 18 / 0.08);
  --r: 18px;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #15120f; --ink: #f2eade; --muted: #b3a798; --card: #201b17; --line: #3a3129; --soft: #2a231d;
  --ok: #73c895; --bad: #f08e70; --down: #e2c06a; --stage-mid: #2a241f; --stage-dark: #0f0d0b; --stage-light: #efe8dd;
  --shadow: 0 10px 30px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #15120f; --ink: #f2eade; --muted: #b3a798; --card: #201b17; --line: #3a3129; --soft: #2a231d;
    --ok: #73c895; --bad: #f08e70; --down: #e2c06a; --stage-mid: #2a241f; --stage-dark: #0f0d0b; --stage-light: #efe8dd;
    --shadow: 0 10px 30px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); overflow-x: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h2 { font: 600 1.35rem/1.2 var(--serif); margin: 0 0 6px; }
h3 { font-size: 1rem; }
p { margin: 0 0 10px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.fatal { padding: 24px; }
.boot { display: grid; place-items: center; min-height: 60vh; }
.spinner, .spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--ink); animation: rot 0.9s linear infinite; display: inline-block; }
.spin { width: 14px; height: 14px; border-width: 2px; vertical-align: -2px; margin-right: 8px; }
@keyframes rot { to { transform: rotate(1turn); } }

/* шапка */
.top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.logo { font: 700 1.1rem var(--serif); color: var(--ink); text-decoration: none; }
.lab-tag { font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; }
.top-act { margin-left: auto; display: flex; gap: 6px; }
.pill-btn { display: inline-grid; place-items: center; min-width: 40px; height: 36px; padding: 0 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-size: 0.85rem; font-weight: 600; }
.sun { width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); border: 2px solid var(--ink); }

/* кинетический заголовок: слова выезжают из масок, «лінійку» заливается фирменным цветом */
.kicker { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.kinetic { font: 600 clamp(2rem, 4.2vw, 3.6rem)/1.05 var(--serif); letter-spacing: -0.01em; }
.kinetic .w { display: inline-block; margin-right: 0.24em; clip-path: inset(-0.12em -0.2em -0.25em -0.2em); vertical-align: top; }
.kinetic .wi { display: inline-block; animation: rise 0.8s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 110ms + 120ms); }
.kinetic .accent .wi { background: linear-gradient(transparent 58%, var(--brand) 58%, var(--brand) 92%, transparent 92%) no-repeat;
  background-size: 0% 100%; animation: rise 0.8s cubic-bezier(.2,.8,.2,1) both, swipe 0.7s ease-out both;
  animation-delay: calc(var(--i) * 110ms + 120ms), 900ms; transition: background-color 0.3s; padding: 0 0.06em; }
@keyframes rise { from { transform: translateY(115%); } to { transform: none; } }
@keyframes swipe { to { background-size: 100% 100%; } }
.lead { color: var(--muted); max-width: 46ch; margin-top: 10px; }

/* сцена */
.stage { position: relative; border-radius: var(--r); overflow: hidden; background: var(--stage-mid); touch-action: none;
  transition: background-color 0.5s, height 0.35s ease; }
.stage[data-tone='dark'] { background: radial-gradient(120% 90% at 50% 30%, #2b2520, var(--stage-dark)); }
.stage[data-tone='light'] { background: radial-gradient(120% 90% at 50% 30%, #fffdf9, var(--stage-light)); }
.stage.drop { outline: 3px dashed var(--brand); outline-offset: -6px; }
.stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.stage-canvas:active { cursor: grabbing; }
.status-pill { position: absolute; left: 10px; top: 10px; margin: 0; display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 20px);
  padding: 6px 12px; border-radius: 99px; font-size: 0.8rem; font-weight: 600; background: rgb(255 255 255 / 0.86); color: #221c18;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.12); pointer-events: none; }
.status-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: #9a8f84; flex: none; }
.status-pill[data-st='ok'] .dot { background: #2c9a5c; }
.status-pill[data-st='bad'] .dot { background: #d0532f; }
.status-pill[data-st='down'] .dot { background: #c99a1d; }
.status-pill[data-st='wait'] .dot { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.fallback { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 6px; padding: 48px 8px 10px; }
.fallback[hidden] { display: none; }
.fallback .no3d { grid-column: 1 / -1; align-self: start; font-size: 0.85rem; color: var(--muted); }
.fallback .fb { display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: rgb(255 255 255 / 0.4); }
.fallback .fb img { width: 100%; height: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.attr { font-size: 0.7rem; color: var(--muted); margin: 4px 2px 0; overflow-wrap: anywhere; }

/* полка: имя линейки и три места */
.shelf-bar { margin-top: 8px; }
.line-name { margin: 0 0 6px; font: 600 1.15rem/1.2 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; }
.line-name span { display: inline-block; white-space: pre; animation: pop 0.45s cubic-bezier(.2,.9,.3,1.3) both; animation-delay: calc(var(--i) * 28ms);
  border-bottom: 3px solid var(--brand); }
@keyframes pop { from { transform: translateY(0.4em); opacity: 0; } }
.slots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.slot { position: relative; }
.slot-b { width: 100%; display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'no st' 'pic pic' 't t'; align-items: center; gap: 4px;
  text-align: left; padding: 6px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); min-height: 44px; }
.slot.sel .slot-b { border-color: var(--ink); box-shadow: 0 0 0 2px var(--brand); }
.slot.drop .slot-b { border-style: dashed; border-color: var(--brand); }
.slot .no { grid-area: no; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; font-size: 0.72rem; font-weight: 700; background: var(--soft); }
.slot img, .slot .ph, .slot .plus { grid-area: pic; width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; object-fit: cover; display: block; background: var(--soft); }
.slot .plus { display: grid; place-items: center; border: 1.5px dashed var(--line); background: transparent; }
.slot .plus::before { content: '+'; font-size: 1.6rem; color: var(--muted); }
.slot .s-t { grid-area: t; font-size: 0.78rem; line-height: 1.25; overflow-wrap: anywhere; }
.slot.empty .s-t { color: var(--muted); }
.slot .st { grid-area: st; justify-self: end; }
.slot .rm { position: absolute; right: -4px; top: -6px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); padding: 0; }
.slot .rm::before { content: '×'; font-size: 1rem; line-height: 24px; display: block; }
.st { font-size: 0.68rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; white-space: nowrap; background: var(--soft); color: var(--muted); }
.st-ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.st-bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.st-down { background: color-mix(in srgb, var(--down) 16%, transparent); color: var(--down); }
.ph { display: block; background: var(--soft); }
.ph.k-candle { background: radial-gradient(circle at 50% 30%, #f6d48a 0 8%, transparent 9%), linear-gradient(transparent 35%, var(--brand) 35% 90%, transparent 90%) center / 50% 100% no-repeat, var(--soft); }
.ph.k-soap { background: linear-gradient(var(--brand), var(--brand)) center / 70% 40% no-repeat, var(--soft); }
.ph.k-figure { background: radial-gradient(circle at 50% 55%, var(--brand) 0 30%, transparent 31%), var(--soft); }
.ph.k-cast { background: radial-gradient(ellipse at 50% 60%, var(--brand) 0 34%, transparent 35%), var(--soft); }

/* вкладки и панели */
.tabs-row { display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; border: 0; background: transparent; padding: 8px 12px; border-radius: 99px; font-weight: 600; font-size: 0.9rem; color: var(--muted); }
.tab[aria-selected='true'] { background: var(--ink); color: var(--bg); }
.share-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--ink); background: var(--card); border-radius: 99px; padding: 7px 12px; font-weight: 600; font-size: 0.85rem; }
.share-ic { width: 14px; height: 14px; border: 2px solid currentColor; border-top: 0; position: relative; }
.share-ic::before { content: ''; position: absolute; left: 3px; top: -7px; width: 4px; height: 4px; border-left: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(45deg); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.panel h2 + .muted { margin-bottom: 12px; }
.label { font-weight: 600; font-size: 0.9rem; margin: 12px 0 6px; display: block; }

/* каталог */
.ideas { background: var(--soft); border-radius: 14px; padding: 14px; margin-bottom: 18px; }
.ideas h2 { font-size: 1.1rem; }
.sets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.set { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 7px 12px; font-size: 0.85rem; font-weight: 600; }
.set-dots { display: inline-flex; gap: 2px; }
.set-dots i { width: 6px; height: 10px; border-radius: 2px; background: var(--brand); }
.set-dots i:nth-child(2) { height: 13px; }
.dice { width: 12px; height: 12px; border-radius: 3px; border: 2px solid currentColor; background: radial-gradient(circle, currentColor 0 1.5px, transparent 2px); }
.shuffle { border-color: var(--ink); }
.demo-who { font-size: 0.8rem; color: var(--muted); margin: 6px 0 0; }
.demo { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; background: var(--ink); color: var(--bg); border-radius: 4px; padding: 1px 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 99px; padding: 6px 12px; font-size: 0.85rem; min-height: 36px; }
.chip[aria-pressed='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.card { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 6px; border: 1.5px solid var(--line);
  border-radius: 14px; background: var(--bg); transition: transform 0.15s, border-color 0.15s; }
.card:hover { border-color: var(--ink); }
.card:active { transform: scale(0.97); }
.card.on { border-color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
.card img, .card .ph { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.c-t { font-size: 0.82rem; line-height: 1.25; overflow-wrap: anywhere; }
.c-tag { font-size: 0.68rem; color: var(--muted); }
.c-tag.yes { color: var(--ink); font-weight: 600; }
.c-tag.yes::before { content: 'Aa '; font-family: var(--serif); }

/* цвет и имя */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line); background: var(--c); padding: 0; transition: transform 0.15s; }
.sw[aria-checked='true'] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ink); transform: scale(1.06); }
input[type=text], input[type=url], input:not([type]), select, textarea { width: 100%; padding: 11px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); min-height: 44px; }
#nm { font: 600 1.15rem var(--serif); }
#nm[aria-invalid='true'] { border-color: var(--bad); }
.err { color: var(--bad); font-size: 0.85rem; margin: 6px 0 0; min-height: 0; }
.err:empty { display: none; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 6px; font-size: 0.9rem; }
.check input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--ink); }

/* протокол */
.proto { display: grid; gap: 10px; }
.pcard { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; background: var(--bg); }
.pcard.sel { border-color: var(--ink); }
.pcard.ps-bad { border-color: var(--bad); }
.pcard header { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.pcard .no { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: 0.75rem; font-weight: 700; background: var(--soft); }
.pcard h3 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pcard h3 small { display: block; font-weight: 400; color: var(--muted); font-size: 0.78rem; }
.pcard dl { margin: 0; display: grid; gap: 4px; }
.pr { display: grid; grid-template-columns: minmax(84px, 34%) 1fr; gap: 8px; font-size: 0.88rem; }
.pr dt { color: var(--muted); }
.pr dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.pr.note dd { color: var(--muted); font-style: italic; }
.cc { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cc i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 1px solid var(--line); flex: none; }
.gate { display: flex; gap: 8px; align-items: flex-start; font-size: 0.85rem; margin: 10px 0 4px; }
.ok-ic { width: 16px; height: 16px; flex: none; border-radius: 50%; background: var(--ok); position: relative; margin-top: 2px; }
.ok-ic::after { content: ''; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.adv { margin: 4px 0 0; padding-left: 18px; font-size: 0.8rem; color: var(--muted); }
.adv li { margin: 2px 0; }
.fail { margin-top: 10px; font-size: 0.88rem; }
.fail b { color: var(--bad); }
.fail ul { margin: 4px 0 0; padding-left: 18px; }
.fail.down p { color: var(--down); }
.pcard.ps-bad .fail { animation: shake 0.4s ease-out; }
@keyframes shake { 20% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 80% { transform: translateX(-2px); } }
.wait-line { font-size: 0.85rem; color: var(--muted); margin: 10px 0 0; }
.ghost { border: 1.5px solid var(--ink); background: transparent; border-radius: 99px; padding: 8px 14px; font-weight: 600; font-size: 0.85rem; min-height: 40px; }

/* партия */
.moq { display: flex; gap: 10px; align-items: flex-start; background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: 0.88rem; }
.moq .q { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--ink); color: var(--bg); }
.flow { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 6px; counter-reset: f; }
.flow li { display: flex; gap: 10px; align-items: center; font-size: 0.88rem; opacity: 0; animation: flowin 0.5s ease-out forwards; animation-delay: calc(var(--i) * 160ms + 200ms); }
.flow b { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--brand); font-size: 0.8rem; }
@keyframes flowin { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.range { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 8px; font-weight: 600; font-size: 0.9rem; }
.n-out { font: 600 1.4rem var(--serif); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--ink); height: 32px; touch-action: pan-y; }
.batch-out { display: grid; gap: 10px; margin-top: 8px; }
.big { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bn { font: 600 2.2rem/1 var(--serif); font-variant-numeric: tabular-nums; }
.mats .label { margin-top: 0; }
.mat { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding: 4px 0; margin: 0; font-size: 0.9rem; }
.meter { position: relative; height: 12px; border-radius: 99px; background: var(--soft); margin: 6px 22px 6px 0; }
.meter .fill { position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 100%); border-radius: 99px; background: var(--brand); transition: width 0.3s; }
.moq-mark { position: absolute; right: -22px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 700; border: 2px dashed var(--ink); background: var(--card); }
.roles { margin-top: 18px; }
.roles h3 { margin-bottom: 8px; }
.tag { font-weight: 600; font-size: 0.7rem; border: 1px solid var(--line); border-radius: 99px; padding: 1px 7px; color: var(--muted); white-space: nowrap; }
.roles dl { margin: 0; display: grid; gap: 6px; }
.roles dt { font-weight: 700; font-size: 0.9rem; }
.roles dd { margin: 0 0 4px; color: var(--muted); font-size: 0.88rem; }

/* заявка */
.apply { display: grid; gap: 10px; }
.field label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.link-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
#f-link { font-size: 0.78rem; color: var(--muted); }
.cta { border: 0; border-radius: 99px; padding: 14px 18px; font-weight: 700; font-size: 1rem; background: var(--ink); color: var(--bg); min-height: 50px; }
.done { background: var(--soft); border-radius: 14px; padding: 14px; }
.done[hidden], .apply[hidden] { display: none; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 30; max-width: calc(100vw - 32px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-size: 0.88rem; font-weight: 600; transition: 0.25s; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.foot { font-size: 0.78rem; color: var(--muted); padding: 16px 4px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; transition-duration: 0.001ms !important; }
  .kinetic .accent .wi { background-size: 100% 100%; }
  .flow li { opacity: 1; }
}
