/* Токены названы как в shadcn/ui, цвета редактора отдельно */
:root {
  --background: #1e1e1e;
  --card: #2c2c2c;
  --foreground: #f5f5f5;
  --muted-foreground: #a8a8a8;
  --border: #444;
  --hover: #3a3a3a;
  --dot: #3d3d3d;
  --ring: #0d99ff;
  --radius: 8px;
  --accent: #0d99ff;
  --component: #9747ff;
  --left: 232px;
  --right: 256px;
  --top: 48px;
  --display: "Unbounded", "Arial Black", sans-serif;
  --body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
}
[data-ui="light"] {
  --background: #e6e6e6;
  --card: #fff;
  --foreground: #1e1e1e;
  --muted-foreground: #5e5e5e;
  --border: #d9d9d9;
  --hover: #efefef;
  --dot: #c4c4c4;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 40px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; position: relative; color: var(--foreground);
  font: 400 16px/1.5 var(--body);
  background-color: var(--background);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  overflow-x: clip;
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: #fff; color: #000; padding: 8px 12px; border-radius: 6px; }
.skip:focus { top: 8px; }
html:not(.js) .chrome, html:not(.js) #overlay, html:not(.js) #draw { display: none; }

/* Интерфейс редактора */
.topbar {
  position: fixed; inset: 0 0 auto; height: var(--top); z-index: 40;
  display: flex; align-items: center; gap: 12px; padding: 0 12px;
  background: var(--card); border-bottom: 1px solid var(--border); font-size: 13px;
}
.brand { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; }
.brand:hover { background: var(--hover); }
.file { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-dim { color: var(--muted-foreground); }
.progress { margin-inline: auto; color: var(--muted-foreground); white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress b { color: var(--foreground); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.ghost-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; background: none; border: 0; border-radius: 6px; }
.ghost-btn:hover, .ghost-btn[aria-pressed="true"] { background: var(--hover); }
.login-link { text-decoration: none; }
.share { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 6px; background: var(--accent); color: #000; font-weight: 600; text-decoration: none; }
.scrollbar { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; }

.panel {
  position: fixed; top: var(--top); bottom: 0; z-index: 30; overflow-y: auto;
  background: var(--card); font-size: 12px; scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.panel.left { left: 0; width: var(--left); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.panel.right { right: 0; width: var(--right); border-left: 1px solid var(--border); }
.panel-title { margin: 0; font: 600 12px/1.3 var(--body); letter-spacing: 0; padding: 14px 14px 8px; }
.layers { flex: 1; min-height: 120px; overflow-y: auto; padding-bottom: 8px; }
.layers button {
  display: flex; align-items: center; gap: 7px; width: 100%; height: 26px; padding: 0 14px;
  background: none; border: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.layers .sub button { padding-left: 32px; color: var(--muted-foreground); }
.layers button:hover { background: var(--hover); }
.layers button.on { background: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--foreground); }
.layers svg { flex: none; width: 12px; height: 12px; }
.layer-new { animation: layer-in .3s ease-out; }
@keyframes layer-in { from { opacity: 0; transform: translateX(-8px); } }
.history { border-top: 0; padding: 0 14px 14px; min-height: 76px; color: var(--muted-foreground); }
.history li { padding: 3px 0; animation: hist-in .35s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes hist-in { from { opacity: 0; transform: scale(.9) translateY(10px); } }

.group { padding: 12px 14px; border-top: 1px solid var(--border); }
.group h3 { font: 600 12px/1.3 var(--body); margin-bottom: 10px; }
.props { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.props div { display: flex; gap: 8px; padding: 5px 8px; border-radius: 5px; background: var(--hover); font-variant-numeric: tabular-nums; }
.props dt { color: var(--muted-foreground); }
.fill-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 5px; background: var(--hover); cursor: pointer; }
.fill-row input { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px; background: none; cursor: pointer; }
.fill-row input::-webkit-color-swatch-wrapper { padding: 0; }
.fill-row input::-webkit-color-swatch { border: 1px solid rgb(128 128 128 / .5); border-radius: 4px; }
.hint { margin-top: 8px; color: var(--muted-foreground); }
.type-val { color: var(--muted-foreground); }
.variant-set {
  display: grid; gap: 6px; padding: 8px; margin-bottom: 10px;
  border: 1px dashed var(--component); border-radius: 6px;
}
.variant-set button {
  display: flex; align-items: center; gap: 8px; padding: 6px; background: none;
  border: 1px solid transparent; border-radius: 5px; text-align: left;
}
.variant-set button:hover { background: var(--hover); }
.variant-set button[aria-checked="true"] { border-color: var(--component); }
.swatches { display: flex; flex: none; }
.swatches i { width: 14px; height: 14px; margin-right: -4px; border-radius: 50%; border: 1px solid var(--card); }
.swatches + span { margin-left: 6px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 2px; border-radius: 6px; background: var(--hover); }
.seg button { padding: 5px; background: none; border: 0; border-radius: 5px; }
.seg button[aria-checked="true"] { background: var(--card); box-shadow: 0 0 0 1px var(--border); }

.toolbar {
  position: fixed; left: calc(50% + (var(--left) - var(--right)) / 2); bottom: 16px; z-index: 35; translate: -50% 0;
  display: flex; align-items: center; gap: 2px; padding: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 24px rgb(0 0 0 / .35);
}
.toolbar button { display: grid; place-items: center; width: 36px; height: 36px; background: none; border: 0; border-radius: 8px; }
.toolbar svg { width: 18px; height: 18px; }
.toolbar button:hover:not(:disabled) { background: var(--hover); }
.toolbar button[aria-pressed="true"] { background: var(--accent); color: #000; }
.toolbar button:disabled { cursor: default; }
.toolbar button:disabled:not([aria-pressed="true"]) { opacity: .55; }
.toolbar i { width: 1px; height: 20px; margin: 0 4px; background: var(--border); }

/* Появление редактора при открытии */
.anim .topbar { animation: from-top .5s cubic-bezier(.2, .8, .2, 1) both; }
.anim .panel.left { animation: from-left .5s .12s cubic-bezier(.2, .8, .2, 1) both; }
.anim .panel.right { animation: from-right .5s .12s cubic-bezier(.2, .8, .2, 1) both; }
.anim .toolbar { animation: from-bottom .5s .24s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes from-top { from { transform: translateY(-100%); } }
@keyframes from-left { from { transform: translateX(-100%); } }
@keyframes from-right { from { transform: translateX(100%); } }
@keyframes from-bottom { from { transform: translateY(90px); } }

/* Слой выделения */
#overlay { position: absolute; inset: 0; z-index: 20; overflow: clip; pointer-events: none; }
#sel, #hov { position: absolute; left: 0; top: 0; display: none; }
#hov { border: 1.5px solid var(--accent); }
#sel { border: 1.5px solid var(--accent); z-index: 2; }
#sel b { position: absolute; width: 8px; height: 8px; background: #fff; border: 1.5px solid var(--accent); }
#sel b:nth-child(1) { left: -4.5px; top: -4.5px; }
#sel b:nth-child(2) { right: -4.5px; top: -4.5px; }
#sel b:nth-child(3) { left: -4.5px; bottom: -4.5px; }
#sel b:nth-child(4) { right: -4.5px; bottom: -4.5px; }
#sel-size {
  position: absolute; left: 50%; top: calc(100% + 8px); translate: -50% 0; padding: 1px 6px;
  border-radius: 3px; background: var(--accent); color: #000;
  font: 600 11px/1.5 var(--body); white-space: nowrap; font-variant-numeric: tabular-nums;
}
#cursor { position: absolute; left: 0; top: 0; z-index: 3; opacity: 0; transition: opacity .25s; will-change: transform; }
#cursor span {
  position: absolute; left: 14px; top: 16px; padding: 2px 7px; border-radius: 4px 10px 10px 10px;
  background: #a259ff; color: #000; font: 600 11px/1.5 var(--body); white-space: nowrap;
}
#draw { position: absolute; inset: 0; z-index: 25; display: none; cursor: crosshair; touch-action: none; }
.drawing #draw { display: block; }
.shape { position: absolute; pointer-events: auto; cursor: move; touch-action: none; }
.shape.ellipse { border-radius: 50%; }
.shape.on { outline: 1.5px solid var(--accent); outline-offset: 1px; }

/* Холст */
.stage {
  display: grid; gap: 88px; margin: 0 var(--right) 0 var(--left);
  padding: calc(var(--top) + 48px) clamp(16px, 4vw, 56px) 120px;
}
.frame {
  --fill: #f5f5f5; --ink: #000;
  position: relative; container-type: inline-size; width: 100%; max-width: 1040px; margin-inline: auto;
  padding: clamp(24px, 5vw, 56px); background: var(--fill); color: var(--ink);
}
.about { --fill: #a259ff; }
.services { --fill: #ffcd29; }
.process { --fill: #0acf83; }
.work { --fill: #1abcfe; }
.contact { --fill: #f24e1e; }
.switching .frame { transition: background-color .5s, color .5s; }
.frame-label { position: absolute; left: 0; top: -24px; color: var(--muted-foreground); font-size: 12px; }

/* Скрытое состояние: всё ждёт, пока курсор это нарисует */
.anim .frame:not(.is-built) { background: transparent; }
.anim .frame:not(.is-built) .frame-label { visibility: hidden; }
.anim [data-el]:not(.is-built):not(.is-building) { visibility: hidden; }
.anim [data-el]:not(.is-built):not(.is-building) * { visibility: hidden; }
.ch { visibility: hidden; }
.ch.on { visibility: visible; }

h1, h2 { font-family: var(--display); font-weight: 700; text-wrap: balance; }
h1 { font-size: clamp(2rem, 8.800cqw, 5.2rem); line-height: 1.08; letter-spacing: -.02em; margin-block: 14px 32px; }
h2 { font-size: clamp(1.7rem, 6cqw, 3.2rem); line-height: 1.12; letter-spacing: -.015em; margin-bottom: 28px; }
h3 { font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
.big { font-size: clamp(1.15rem, 2.600cqw, 1.5rem); line-height: 1.4; max-width: 34em; font-weight: 500; }

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
  padding: 0 22px; border: 1.5px solid currentColor; border-radius: var(--radius);
  background: none; font-weight: 600; text-decoration: none; overflow: hidden;
  transition: background-color .15s, color .15s;
}
.btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.btn.primary { background: var(--ink); color: var(--fill); border-color: var(--ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 82%, var(--fill)); }
/* Бегущий блик по краю, идея border-beam из Magic UI */
.btn.primary::after {
  content: ""; position: absolute; width: 36px; height: 3px; left: 0; top: 0; background: var(--accent); border-radius: 3px;
  offset-path: rect(0 auto auto 0 round 8px); offset-anchor: 100% 50%; animation: beam 4s linear infinite;
}
@keyframes beam { from { offset-distance: 0%; } to { offset-distance: 100%; } }

.tag { font-weight: 600; }
.hero-row { display: grid; grid-template-columns: 1.300fr 1fr; gap: 32px; align-items: end; }
.lead { font-size: 1.15rem; line-height: 1.45; max-width: 30em; margin-bottom: 24px; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
.shapes { position: relative; aspect-ratio: 1.100; min-height: 180px; }
.s { position: absolute; display: block; transition: translate .4s cubic-bezier(.2, .8, .2, 1); }
.s-rect { left: 2%; top: 26%; width: 52%; height: 60%; background: #f24e1e; border-radius: 6px; }
.s-ell { right: 4%; top: 2%; width: 50%; aspect-ratio: 1; background: #1abcfe; border-radius: 50%; mix-blend-mode: multiply; }
.s-tri { right: 0; bottom: 0; width: 46%; aspect-ratio: 1; background: #0acf83; clip-path: polygon(50% 0, 100% 100%, 0 100%); mix-blend-mode: multiply; }
.s-star { left: 0; top: 0; width: 26%; aspect-ratio: 1; background: #a259ff; clip-path: polygon(50% 0, 62% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 38% 35%); }
.note {
  display: flex; gap: 10px; align-items: flex-start; max-width: 28em; margin-top: 32px; padding: 10px 14px 10px 10px;
  background: #fff; color: #000; border-radius: 4px 14px 14px 14px; font-size: .9rem; line-height: 1.4;
  box-shadow: 0 4px 16px rgb(0 0 0 / .14);
}
.pin { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #a259ff; font-weight: 700; font-size: .8rem; }

.about-grid { display: grid; grid-template-columns: 1.150fr 1fr; gap: 32px; }
.reasons { display: grid; gap: 18px; }
.reasons p { margin-top: 2px; }
.marquee { margin: 36px calc(-1 * clamp(24px, 5vw, 56px)) -12px; overflow: hidden; border-block: 1.5px solid currentColor; }
.track { display: flex; width: max-content; animation: marquee 26s linear infinite; }
.track span { padding: 10px 22px; font: 500 1rem/1.4 var(--display); white-space: nowrap; }
.marquee:hover .track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

.set { position: relative; padding: 16px; border: 1.5px dashed var(--component); border-radius: 8px; }
.set-label { position: absolute; left: 12px; top: -11px; padding: 0 6px; background: var(--fill); color: #5b1fb0; font-size: 13px; font-weight: 600; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tabs button {
  min-height: 40px; padding: 0 13px; border: 1.5px solid currentColor; border-radius: var(--radius);
  background: none; color: inherit; font-weight: 600; font-size: .92rem; transition: background-color .15s;
}
.tabs button:hover { background: rgb(0 0 0 / .08); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--fill); border-color: var(--ink); }
.set-body { display: grid; grid-template-columns: 1.150fr 1fr; gap: 24px; align-items: start; }
.device { position: relative; aspect-ratio: 1.300; border-radius: 6px; background: #fff; overflow: hidden; box-shadow: 0 0 0 1.5px #000; }
.device i { position: absolute; border-radius: 3px; transition: left .55s, top .55s, width .55s, height .55s, background-color .55s, border-radius .55s; transition-timing-function: cubic-bezier(.3, 1.2, .4, 1); }
.set-text p { margin-block: 6px 12px; }
.set-text li { position: relative; padding-left: 16px; }
.set-text li::before { content: ""; position: absolute; left: 0; top: .55em; width: 7px; height: 7px; background: currentColor; rotate: 45deg; }
.is-swap { animation: swap .35s ease-out; }
@keyframes swap { from { opacity: 0; transform: translateY(6px); } }

.flow { position: relative; }
.flow ol { display: grid; grid-template-columns: 1fr 1fr; gap: 44px 56px; }
.flow li { position: relative; z-index: 1; padding: 16px 18px; background: #fff; color: #000; border-radius: var(--radius); }
.flow li:nth-child(even) { grid-column: 2; }
.flow li:nth-child(odd) { grid-column: 1; }
.flow h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.flow h3 span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #000; color: #fff; font-size: .8rem; }
.noodles { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.noodles path { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .5s ease-out; }
.noodles path.on { stroke-dashoffset: 0; }

.work .big { margin-bottom: 28px; }
.cases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.case { padding: 10px 10px 14px; background: #fff; color: #000; border-radius: var(--radius); transition: transform .2s ease-out; transform-style: preserve-3d; }
.case h3, .case p { padding-inline: 6px; }
.case p { font-size: .92rem; line-height: 1.4; margin-top: 2px; }
.mock { display: flex; flex-direction: column; gap: 6px; aspect-ratio: .95; padding: 14px; margin-bottom: 12px; border-radius: 4px; font-size: .78rem; overflow: hidden; }
.mock b { font: 700 .95rem/1.2 var(--display); }
.mock em { align-self: flex-start; margin-top: auto; padding: 5px 11px; border-radius: 99px; font-style: normal; font-weight: 600; }
.m-menu { background: #2b1a12; color: #f8e5cf; }
.m-menu b { margin-bottom: 6px; }
.m-menu span { display: flex; justify-content: space-between; padding-bottom: 5px; border-bottom: 1px solid rgb(248 229 207 / .25); }
.m-menu u { text-decoration: none; }
.m-shop { background: #eef0ff; color: #1b1d63; }
.m-shop div { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.m-shop i { background: #fff; border-radius: 4px; position: relative; }
.m-shop i::after { content: ""; position: absolute; inset: 42% 16% 26%; background: #4b3cf0; border-radius: 40% 60% 10px 10px; }
.m-shop em { background: #1b1d63; color: #fff; }
.m-land { background: linear-gradient(#bfe8d9, #e9f7c9); color: #0c3b2e; }
.m-land b { font-size: 1.25rem; margin-top: 16px; }
.mock.m-land p { padding: 0; margin: 0; font-size: .78rem; }
.m-land em { background: #0c3b2e; color: #e9f7c9; }

.contact .big { margin-bottom: 28px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wide { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 4px; font-weight: 600; font-size: .92rem; }
.field input, .field textarea {
  display: block; width: 100%; min-height: 46px; padding: 10px 12px; color: #000; background: #fff;
  border: 1.5px solid #000; border-radius: var(--radius); resize: vertical;
}
.field [aria-invalid="true"] { box-shadow: 0 0 0 2px #000; }
.field input:focus-visible, .field textarea:focus-visible { outline-color: #000; }
.form-end { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
#f-status { font-weight: 600; }
.trap { position: absolute; left: -9999px; }
.consent { display: flex; align-items: flex-start; gap: 10px; font-size: .92rem; line-height: 1.4; cursor: pointer; }
.consent input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: #000; }
.socials { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 36px; }
.socials a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 13px; border: 1.5px solid currentColor; border-radius: var(--radius); font-weight: 600; font-size: .92rem; text-decoration: none; }
.socials a:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.foot { margin-top: 24px; font-size: .9rem; }
.btn:focus-visible, .tabs button:focus-visible { outline-color: currentColor; }

.confetti { position: fixed; z-index: 60; pointer-events: none; width: 12px; height: 12px; }

/* Режим просмотра без панелей */
.present .panel, .present .toolbar { display: none; }
.present .stage { margin-inline: 0; }

@media (max-width: 1180px) {
  :root { --right: 0px; }
  .panel.right { display: none; }
}
@media (max-width: 820px) {
  :root { --left: 0px; --top: 44px; }
  .panel.left, .file-dim, #play span { display: none; }
  .stage { gap: 64px; padding-bottom: 96px; }
  .progress { margin-inline: auto 0; }
  .topbar { gap: 8px; padding-inline: 8px; }
  .file { flex: 1; min-width: 0; }
}
@media (max-width: 480px) { .file { display: none; } .progress { margin-inline: 0 auto; } }

@container (max-width: 640px) {
  .hero-row, .about-grid, .set-body, .cases { grid-template-columns: 1fr; }
  .shapes { width: 70%; justify-self: end; }
  .flow ol { grid-template-columns: 1fr; gap: 28px; }
  .flow li:nth-child(n) { grid-column: 1; }
}
@container (max-width: 520px) { .form { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
