/* v27 (форк v18) — общая часть: цвета, сцены, кинетика. Раскладка телефона — v27-m.css,
   компьютера — v27-d.css (отдельные вёрстки). Сцены с изделием (светлый
   единорог) всегда на тёмном фоне — контраст по яркости изделия в любой теме. */
:root {
  --night: #120f1a;
  --night-2: #1d1830;
  --lilac: #c9b8f0;
  --lilac-2: #9d86d8;
  --gold: #f3c969;
  --ok: #7fd6a4;
  --bad: #ff8a7a;
  --paper: #f6f1ea;
  --paper-2: #ebe3f5;
  --ink: #1b1626;
  --ink-2: #4b4360;
  --on-night: #f4f0fb;
  --on-night-2: #b9b0cc;
  /* светлые сцены (без изделия) — бумага в светлой теме */
  --sc-bg: var(--paper);
  --sc-ink: var(--ink);
  --sc-ink-2: var(--ink-2);
  --sc-card: #fff;
  --sc-line: rgb(27 22 38 / 14%);
  --page: #e9e3f2;
  --page-ink: var(--ink);
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --g: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sc-bg: #17131f; --sc-ink: var(--on-night); --sc-ink-2: var(--on-night-2);
    --sc-card: #231d31; --sc-line: rgb(244 240 251 / 14%);
    --page: #0b0910; --page-ink: var(--on-night);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --sc-bg: #17131f; --sc-ink: var(--on-night); --sc-ink-2: var(--on-night-2);
  --sc-card: #231d31; --sc-line: rgb(244 240 251 / 14%);
  --page: #0b0910; --page-ink: var(--on-night);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--page-ink); font: 16px/1.4 var(--sans); -webkit-font-smoothing: antialiased;
  overflow: hidden; overscroll-behavior: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--gold); color: var(--ink); padding: 8px 12px;
  border-radius: 10px; text-decoration: none; }
.skip:focus { top: 8px; }

/* ---------------------------------------------------------------- шапка */
.top { display: flex; align-items: center; gap: 8px; }
.logo { font: 700 18px/1 var(--display); letter-spacing: -.01em; color: inherit; text-decoration: none; margin-right: auto; }
.tag-demo { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 3px 7px; border-radius: 99px;
  border: 1px solid currentColor; opacity: .75; }
.lang, .pause { min-width: 40px; height: 40px; border-radius: 99px; border: 1px solid rgb(255 255 255 / 22%);
  background: rgb(18 15 26 / 42%); color: var(--on-night); font-weight: 600; font-size: 13px; padding: 0 10px;
  backdrop-filter: blur(8px); }
.pause svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; vertical-align: middle; }
.pause .i-play { display: none; fill: currentColor; stroke: none; }
.is-paused .pause .i-play { display: inline; }
.is-paused .pause .i-pause { display: none; }

/* ---------------------------------------------------------------- лента */
.reel { position: relative; }
.bars { position: absolute; z-index: 6; left: 10px; right: 10px; top: 8px; display: flex; gap: 4px; pointer-events: none; }
.bars i { flex: 1; height: 3px; border-radius: 3px; background: rgb(255 255 255 / 28%); overflow: hidden; }
.bars b { display: block; height: 100%; background: #fff; transform-origin: left; transform: scaleX(var(--p, 0)); }
.frame { position: absolute; inset: 0; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; outline: none; }
.frame input, .frame select { user-select: text; -webkit-user-select: text; }

.sc { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 64px 22px 28px;
  background: var(--sc-bg); color: var(--sc-ink); visibility: hidden; opacity: 0; transform: translateX(14%) scale(.98);
  transition: opacity .45s var(--ease), transform .55s var(--ease), visibility 0s .55s; }
.sc.past { transform: translateX(-10%) scale(.97); }
.sc.cur { visibility: visible; opacity: 1; transform: none; transition: opacity .45s var(--ease), transform .55s var(--ease), visibility 0s; }
.sc-line, .sc-approve { background: radial-gradient(120% 70% at 50% 40%, #2a2244 0%, var(--night) 62%); color: var(--on-night); }
.sc-cta { overflow-y: auto; overscroll-behavior: contain; }

.kt, .line-t { font-family: var(--display); font-weight: 600; letter-spacing: -.015em; margin: 0; text-wrap: balance; }
.kt { font-size: clamp(30px, 9vw, 44px); line-height: 1.06; }
.sc-note { margin: auto 0 0; font-size: 12px; color: var(--sc-ink-2); }
.sc-line .sc-note { color: var(--on-night-2); margin-top: 10px; }
.kicker { margin: 0 0 4px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--lilac); }

/* кинетика: слово в маске с запасом под выносы глифов */
.w { display: inline-block; clip-path: inset(-0.14em -0.2em -0.24em -0.2em); vertical-align: top; }
.wi { display: inline-block; transform: translateY(115%); }
.sc.on .wi { animation: rise .8s var(--ease) both; animation-delay: calc(var(--i) * 85ms + var(--d0, 150ms)); }
@keyframes rise { from { transform: translateY(115%) rotate(4deg); } to { transform: none; } }

/* 1 — сообщения */
.dms { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dm { align-self: flex-start; max-width: 82%; padding: 9px 13px; border-radius: 18px 18px 18px 6px; background: var(--sc-card);
  border: 1px solid var(--sc-line); font-size: 15px; line-height: 1.3; box-shadow: 0 6px 20px rgb(27 22 38 / 8%);
  opacity: 0; transform: translateY(14px) scale(.92); }
.dm b { display: block; font-size: 11px; font-weight: 600; color: var(--lilac-2); margin-bottom: 1px; }
.dm-r { align-self: flex-end; border-radius: 18px 18px 6px 18px; }
.sc-ask.on .dm { animation: pop .5s var(--ease) both; }
.sc-ask.on .dm:nth-child(2) { animation-delay: .35s; }
.sc-ask.on .dm:nth-child(3) { animation-delay: .7s; }
.sc-ask.on .dm:nth-child(4) { animation-delay: 1.05s; }
@keyframes pop { to { opacity: 1; transform: none; } }
.sc-ask { --d0: 1.4s; }
.sc-ask .kt { margin-top: auto; font-size: clamp(38px, 11.5vw, 56px); }
.sc-ask .sc-note { margin-top: 14px; }

/* 2 — линейка */
.line-t { font-size: clamp(38px, 12vw, 58px); line-height: 1.02; color: var(--on-night); }
.ln-x, .ln-by { display: inline-block; }
.ln-by { font-style: italic; font-weight: 400; color: var(--lilac); }
.ln-name { display: inline-block; white-space: nowrap; }
.ch { display: inline-block; color: transparent; -webkit-text-stroke: 1.2px var(--gold); }
.sc-line.on .ln-x { animation: rise .7s var(--ease) both; }
.sc-line.on .ln-by { animation: rise .7s var(--ease) .15s both; }
.sc-line.on .ch, .line-t.on .ch { animation: ink 1s var(--ease) both; animation-delay: calc(.45s + var(--i) * 90ms); }
@keyframes ink {
  0% { opacity: 0; transform: translateY(.3em); color: transparent; }
  45% { opacity: 1; transform: none; color: transparent; }
  100% { opacity: 1; color: var(--gold); -webkit-text-stroke-color: transparent; }
}
.stage { position: relative; flex: 1; min-height: 180px; margin: 10px -22px 0; }
.poster, .gl { position: absolute; inset: 0; width: 100%; height: 100%; }
.poster.gone, .sample-img.gone { visibility: hidden; }
.poster { inset: auto; left: 50%; top: 46%; width: min(64%, 280px); height: auto; aspect-ratio: 1; object-fit: cover;
  border-radius: 22px; transform: translate(-50%, -50%); opacity: .9; transition: opacity .6s; }
.gl { opacity: 0; transition: opacity .6s; cursor: grab; }
.gl.ready { opacity: 1; }
.gl.ready + .pill, .gl.ready ~ .attr { z-index: 1; }
.stage:has(.gl.ready) .poster { opacity: 0; }
.pill { position: absolute; left: 22px; bottom: 26px; margin: 0; display: inline-flex; align-items: center; gap: 7px; max-width: calc(100% - 44px);
  padding: 6px 11px; border-radius: 99px; background: rgb(18 15 26 / 70%); border: 1px solid rgb(255 255 255 / 14%);
  font-size: 12px; line-height: 1.25; color: var(--on-night); backdrop-filter: blur(8px); pointer-events: none; }
.pill i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.pill[data-k="wait"] i { animation: blink 1s infinite alternate; }
.pill[data-k="ok"] i { background: var(--ok); }
.pill[data-k="bad"] i { background: var(--bad); }
@keyframes blink { to { opacity: .25; } }
.attr { position: absolute; left: 22px; right: 22px; bottom: 6px; font-size: 10px; line-height: 1.2; color: var(--on-night-2);
  opacity: .8; }
.name-row { margin-top: 10px; }
.name-f { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--on-night-2); }
.name-f span { flex: none; }
.name-in { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid rgb(255 255 255 / 20%);
  background: rgb(255 255 255 / 7%); color: var(--on-night); font-size: 16px; }

/* 3 — цепочка */
.sc-chain .kt { margin-bottom: 18px; }
.chain { position: relative; padding-left: 40px; flex: 1; display: flex; flex-direction: column; max-height: 420px; }
.chain::before { content: ""; position: absolute; left: 13px; top: 10px; bottom: 10px; width: 2px;
  background: repeating-linear-gradient(var(--sc-line) 0 6px, transparent 6px 11px); }
.parcel { position: absolute; left: 4px; top: 0; width: 20px; height: 20px; border-radius: 5px; background: var(--gold);
  box-shadow: 0 0 0 4px rgb(243 201 105 / 25%); transition: transform .9s var(--ease); }
.parcel::after { content: ""; position: absolute; left: 9px; top: 0; bottom: 0; width: 2px; background: rgb(27 22 38 / 35%); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; flex: 1; justify-content: space-evenly; }
.steps li { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; opacity: .38; transition: opacity .5s, transform .5s var(--ease);
  transform: translateX(6px); }
.steps li.lit { opacity: 1; transform: none; }
.steps i { font: 600 11px/1.9 var(--sans); font-style: normal; color: var(--lilac-2); }
.steps b { font: 600 20px/1.2 var(--display); }
.steps span { grid-column: 2; font-size: 14px; line-height: 1.35; color: var(--sc-ink-2); }
.zero { margin: auto 0 0; display: flex; align-items: baseline; gap: 12px; padding-top: 14px; border-top: 1px solid var(--sc-line); }
.zero span { font-size: 15px; color: var(--sc-ink-2); }
.zero b { font: 700 72px/1 var(--display); color: var(--lilac-2); transform: scale(.6); opacity: 0; transition: transform .6s var(--ease), opacity .4s; }
.zero.lit b { transform: none; opacity: 1; }

/* 4 — образец */
.sc-approve .kt { color: var(--on-night); margin-bottom: 14px; }
.sample { position: relative; display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: center; padding: 12px;
  border-radius: 18px; background: rgb(255 255 255 / 6%); border: 1px solid rgb(255 255 255 / 12%); }
.sample-img { width: 110px; height: 110px; object-fit: cover; border-radius: 12px; background: radial-gradient(#3a3060, #1a1528); }
.sample-t { margin: 0 0 6px; font-weight: 600; font-size: 14px; }
.sample-n { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 13px; }
.sample-n dt { color: var(--on-night-2); }
.sample-n dd { margin: 0; font-variant-numeric: tabular-nums; }
.sample-w { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--on-night-2); }
.stamp { position: absolute; right: 14px; bottom: 8px; margin: 0; padding: 4px 12px; border: 3px solid; border-radius: 8px;
  font: 800 20px/1.1 var(--sans); text-transform: uppercase; letter-spacing: .06em; transform: rotate(-9deg); opacity: 0; pointer-events: none; }
.stamp[data-k="ok"] { color: var(--ok); }
.stamp[data-k="veto"] { color: var(--bad); }
.stamp.on { animation: stamp .45s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes stamp { from { opacity: 0; transform: rotate(-9deg) scale(2.2); } to { opacity: 1; transform: rotate(-9deg); } }
.adv { margin: 14px 0 0; padding: 0 0 0 18px; font-size: 13px; line-height: 1.35; color: var(--on-night-2); }
.adv li + li { margin-top: 3px; }
.vote { display: flex; gap: 10px; margin-top: 14px; }
.btn { min-height: 48px; padding: 0 18px; border-radius: 14px; border: 0; font-weight: 700; font-size: 16px; }
.btn-ok { background: var(--gold); color: var(--ink); }
.btn-veto { background: transparent; color: var(--on-night); border: 1.5px solid rgb(255 255 255 / 35%); }
.vote .btn { flex: 1; }
.vote .btn[aria-pressed="true"] { box-shadow: 0 0 0 3px rgb(255 255 255 / 30%); }
.ask { margin-top: 22px; padding-top: 14px; border-top: 1px solid rgb(255 255 255 / 12%); }
.ask-k { margin: 0 0 8px; font-size: 13px; color: var(--on-night-2); }
.chip { min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1px dashed rgb(255 255 255 / 40%); background: none;
  color: inherit; font-size: 14px; }
.ask-r { margin: 8px 0 0; font-size: 13px; line-height: 1.35; min-height: 1.35em; }
.ask-r[data-k="bad"] { color: var(--bad); }
.ask-r[data-k="ok"] { color: var(--ok); }
.ask-r[data-k="wait"] { color: var(--on-night-2); }

/* 5 — журнал */
.sc-ledger .kt { margin-bottom: 8px; }
.demo-badge { align-self: flex-start; margin: 0 0 14px; padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; background: var(--gold); color: var(--ink); }
.cnt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cnt p { margin: 0; padding: 10px; border-radius: 14px; background: var(--sc-card); border: 1px solid var(--sc-line); }
.cnt .n { display: block; font: 700 30px/1 var(--display); font-variant-numeric: tabular-nums; }
.cnt .n.on { animation: bump .4s var(--ease); }
@keyframes bump { 40% { transform: translateY(-4px); color: var(--lilac-2); } }
.cnt span { font-size: 12px; color: var(--sc-ink-2); }
.feed { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.feed li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px;
  background: var(--sc-card); border: 1px solid var(--sc-line); font-size: 13px; }
.feed li.new { animation: slide .45s var(--ease) both; }
.feed li:nth-child(n+4) { opacity: .7; }
@keyframes slide { from { opacity: 0; transform: translateY(-10px); } }
.feed b { font-variant-numeric: tabular-nums; color: var(--sc-ink-2); font-weight: 600; }
.f-item { min-width: 0; }
.feed em { font-style: normal; font-size: 11px; padding: 2px 7px; border-radius: 99px; background: rgb(243 201 105 / 30%); }
.feed em[data-k="make"] { background: rgb(157 134 216 / 25%); }
.feed em[data-k="sent"] { background: rgb(127 214 164 / 30%); }
.share { margin-top: auto; padding: 12px; border-radius: 14px; border: 1.5px dashed var(--lilac-2); }
.share-t { margin: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; }
.share-t b { font: 700 28px/1 var(--display); color: var(--lilac-2); }
.share-n { margin: 4px 0 0; font-size: 12px; color: var(--sc-ink-2); }

/* 6 — заявка */
.sc-cta .kt { margin-bottom: 10px; }
.ticks { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.ticks li::before { content: "✓"; color: var(--lilac-2); font-weight: 800; margin-right: 8px; }
.apply { display: flex; flex-direction: column; gap: 9px; }
.apply label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--sc-ink-2); }
.apply input, .apply select { height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--sc-line);
  background: var(--sc-card); color: var(--sc-ink); font-size: 16px; }
.btn-wide { width: 100%; margin-top: 4px; }
.sc-cta .btn-ok { background: var(--ink); color: #fff; }
:root[data-theme="dark"] .sc-cta .btn-ok { background: var(--gold); color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sc-cta .btn-ok { background: var(--gold); color: var(--ink); } }
.f-err { margin: 0; min-height: 0; color: #c2412d; font-size: 13px; }
.f-err:empty { display: none; }
.f-fine { margin: 0; font-size: 12px; color: var(--sc-ink-2); }
.done { margin-top: 10px; }
.done-t { font: 600 28px/1.1 var(--display); margin: 0 0 6px; outline: none; }
.done-s { margin: 0 0 12px; color: var(--sc-ink-2); }
.sc-cta .chip { border-color: var(--sc-line); }

/* края-кнопки и подсказка */
.edge { position: absolute; z-index: 5; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgb(255 255 255 / 25%);
  background: rgb(18 15 26 / 55%); color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); }
.edge svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.edge:disabled { opacity: 0; pointer-events: none; }
.hint { position: absolute; z-index: 4; left: 0; right: 0; bottom: 10px; margin: 0; text-align: center; font-size: 12px;
  color: var(--sc-ink-2); pointer-events: none; opacity: 0; }
body[data-scene="1"] .hint { animation: hint 4s 2.6s both; }
@keyframes hint { 10%, 80% { opacity: .9; } }
.is-held .sc.cur { filter: brightness(.92); }

/* reduced-motion: без кинетики и автопрокрутки, всё сразу на месте */
@media (prefers-reduced-motion: reduce) {
  .wi, .dm, .ch, .ln-x, .ln-by { animation: none !important; transform: none !important; opacity: 1 !important; }
  .ch { color: var(--gold); -webkit-text-stroke: 0; }
  .sc, .sc.cur, .sc.past { transition: none; transform: none; }
}
.rm .wi, .rm .dm, .rm .ch, .rm .ln-x, .rm .ln-by { animation: none !important; transform: none !important; opacity: 1 !important; }
.rm .ch { color: var(--gold); -webkit-text-stroke: 0; }
.rm .sc, .rm .sc.cur, .rm .sc.past { transition: none; transform: none; }
.rm .steps li, .rm .zero b, .rm .parcel { transition: none; }
.rm .stamp.on, .rm .feed li, .rm .cnt .n.on { animation: none; opacity: 1; }
.rm .hint { display: none; }
/* штамп — в своей полосе под числами образца, не поверх текста */
.sample:has(.stamp.on) { padding-bottom: 50px; }
/* сцена 4: блок образца — по центру свободного места под заголовком */
.sc-approve .sample { margin-top: auto; }
.sc-approve .ask { margin-bottom: auto; }
/* до запуска скрипта (медленная сеть) первая сцена уже видна: текст не ждёт JS */
body:not([data-scene]) .sc-ask { visibility: visible; opacity: 1; transform: none; }
body:not([data-scene]) .sc-ask .wi, body:not([data-scene]) .sc-ask .dm { transform: none; opacity: 1; }
/* v27: позиции линейки (мыло — первое) и пометка под именем */
.prods { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.prod-b { min-height: 36px; padding: 0 12px; font-size: 13px; border-style: solid; border-color: rgb(255 255 255 / 25%); color: var(--on-night-2); }
.prod-b[aria-pressed="true"] { background: var(--lilac); border-color: var(--lilac); color: var(--ink); font-weight: 600; }
.name-n { margin: 6px 0 0; font-size: 12px; color: var(--on-night-2); }
.name-n:empty { display: none; }
.name-n.bad { color: var(--bad); font-size: 13px; line-height: 1.35; }
.gl.ready.stale { opacity: .35; }
