/* ───────── Шрифты ───────── */
@font-face { font-family: "Manrope"; font-weight: 200 800; font-display: swap;
  src: url(/fonts/manrope-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-weight: 200 800; font-display: swap;
  src: url(/fonts/manrope-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; font-weight: 200 900; font-display: swap;
  src: url(/fonts/unbounded-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-weight: 200 900; font-display: swap;
  src: url(/fonts/unbounded-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ───────── Токены ───────── */
:root {
  --bg: #0d0e13;
  --bg-2: #12141b;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .07);
  --line: rgba(255, 245, 230, .09);
  --line-2: rgba(255, 245, 230, .16);
  --text: #f5f0e8;
  --muted: #9b968d;
  --faint: #6c6861;
  --coral: #ff7a59;
  --amber: #ffc15e;
  --grad: linear-gradient(120deg, var(--coral), var(--amber));
  --ok: #3ddc97;
  --warn: #ffb84d;
  --bad: #ff6b6b;
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --display: "Unbounded", "Manrope", system-ui, sans-serif;
  --ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 500 15px/1.5 var(--ui); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ───────── Фон ───────── */
.aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; background:
  radial-gradient(120% 80% at 50% -10%, #1a1620 0%, var(--bg) 60%); }
.aurora i { position: absolute; width: 56vmax; height: 56vmax; border-radius: 50%; filter: blur(90px); opacity: .5; will-change: transform; }
.aurora i:nth-child(1) { left: -14vmax; top: -18vmax; background: radial-gradient(circle, #ff7a5966, transparent 65%); animation: drift1 26s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { right: -18vmax; top: 8vmax; background: radial-gradient(circle, #7a5cff44, transparent 65%); animation: drift2 32s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { left: 22vmax; bottom: -30vmax; background: radial-gradient(circle, #ffc15e33, transparent 65%); animation: drift3 38s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(12vmax, 10vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-14vmax, 12vmax) scale(.9); } }
@keyframes drift3 { to { transform: translate(-10vmax, -8vmax) scale(1.2); } }
.grain { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ───────── Шапка ───────── */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1320px; margin: 0 auto; padding: 22px clamp(16px, 3vw, 36px) 6px; animation: fadeDown .8s var(--ease) both; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #1a1209; background: var(--grad);
  box-shadow: 0 8px 28px -8px #ff7a5999, inset 0 1px 0 #fff6; transition: transform .5s var(--ease); }
.brand:hover .mark { transform: rotate(-8deg) scale(1.06); }
.brand-name { font: 700 17px/1 var(--display); letter-spacing: -.02em; }
.brand-name em { font-style: normal; color: var(--muted); font-weight: 400; margin-left: 5px; }

.status { display: inline-flex; align-items: center; gap: 10px; padding: 9px 16px 9px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted);
  backdrop-filter: blur(12px); transition: color .4s, border-color .4s, background .4s; }
.status .dot { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.status .dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; background: inherit; opacity: 0; }
.status[data-state="ready"] { color: var(--text); border-color: #3ddc9733; }
.status[data-state="ready"] .dot { background: var(--ok); box-shadow: 0 0 12px var(--ok); }
.status[data-state="ready"] .dot::after { animation: ping 2.4s ease-out infinite; }
.status[data-state="busy"] { color: var(--text); border-color: #ffc15e44; }
.status[data-state="busy"] .dot { background: var(--amber); box-shadow: 0 0 12px var(--amber); }
.status[data-state="busy"] .dot::after { animation: ping 1.2s ease-out infinite; }
.status[data-state="down"] { color: var(--text); border-color: #ff6b6b44; background: #ff6b6b12; }
.status[data-state="down"] .dot { background: var(--bad); }
@keyframes ping { 0% { transform: scale(.4); opacity: .55; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-12px); } }

/* ───────── Раскладка ───────── */
.layout { display: grid; grid-template-columns: minmax(340px, 460px) 1fr; gap: clamp(18px, 2.4vw, 34px);
  max-width: 1320px; margin: 0 auto; padding: 20px clamp(16px, 3vw, 36px) 40px; align-items: start; }

.panel { position: sticky; top: 16px; padding: 28px 26px 24px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line);
  backdrop-filter: blur(22px); box-shadow: 0 30px 80px -40px #000c, inset 0 1px 0 #fff1;
  animation: rise .9s var(--ease) .1s both; max-height: calc(100vh - 32px); overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.985); } }

.eyebrow { margin: 0 0 8px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--amber); font-weight: 700; }
h1 { margin: 0; font: 600 clamp(26px, 2.6vw, 32px)/1.1 var(--display); letter-spacing: -.035em; }
.sub { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

/* ───────── Форма ───────── */
form { display: grid; gap: 22px; margin-top: 26px; }
.field { display: grid; gap: 9px; animation: rise .7s var(--ease) both; animation-delay: calc(.18s + var(--i, 0) * .055s); }
.field > label, .field > .lbl { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; color: var(--muted); }
.field .opt { font-weight: 500; color: var(--faint); }
.field .count { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--faint); transition: color .2s; }
.field .count.hot { color: var(--amber); }

.in { width: 100%; padding: 13px 15px; border-radius: var(--r-md); background: #0000004d; border: 1px solid var(--line);
  color: var(--text); outline: none; transition: border-color .25s, background .25s, box-shadow .25s; }
.in::placeholder { color: var(--faint); }
.in:hover { border-color: var(--line-2); }
.in:focus { border-color: #ffb36b99; background: #00000066; box-shadow: 0 0 0 4px #ff7a5914; }
.in.bad { border-color: var(--bad); animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.lines { display: grid; gap: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: grid; gap: 1px; padding: 10px 15px; border-radius: var(--r-md); background: var(--surface);
  border: 1px solid var(--line); text-align: left; transition: transform .25s var(--ease), border-color .25s, background .25s; }
.chip b { font-weight: 700; font-size: 14px; }
.chip small { font-size: 11px; color: var(--faint); font-weight: 600; }
.chip:hover { border-color: var(--line-2); transform: translateY(-1px); }
.chip:active { transform: scale(.97); }
.chip[aria-checked="true"] { border-color: #ffb36bcc; background: linear-gradient(180deg, #ff7a5922, #ffc15e14); box-shadow: 0 8px 24px -14px #ff7a59; }
.chip[aria-checked="true"] small { color: var(--amber); }

.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.card-opt { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); text-align: left; font-size: 13px; font-weight: 700; line-height: 1.2;
  transition: transform .25s var(--ease), border-color .25s, background .25s; }
.card-opt i { flex: none; width: 30px; height: 30px; border-radius: 9px; box-shadow: inset 0 0 0 1px #fff2; }
.card-opt:hover { border-color: var(--line-2); transform: translateY(-1px); }
.card-opt:active { transform: scale(.97); }
.card-opt[aria-checked="true"] { border-color: #ffb36bcc; background: linear-gradient(180deg, #ff7a5922, #ffc15e14); }
.s-studio i { background: linear-gradient(135deg, #f1e6da, #cfd9e8); }
.s-premium i { background: linear-gradient(135deg, #0a0a0c, #5a4524); }
.s-sale i { background: linear-gradient(135deg, #ff3d6e, #ffb21e); }
.s-eco i { background: linear-gradient(135deg, #c9b48a, #5f8f5a); }
.s-tech i { background: linear-gradient(135deg, #0b1230, #00e0ff); }
.s-cozy i { background: linear-gradient(135deg, #f2b27a, #7a4a3a); }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--c);
  box-shadow: inset 0 0 0 1px #fff3, 0 6px 16px -8px var(--c); transition: transform .3s var(--ease); }
.swatch:hover { transform: scale(1.12); }
.swatch[aria-checked="true"] { transform: scale(1.12); }
.swatch[aria-checked="true"]::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--text); animation: popRing .4s var(--ease); }
@keyframes popRing { from { transform: scale(.7); opacity: 0; } }

/* ───────── Кнопка ───────── */
.actions { margin-top: 26px; }
.go { position: relative; overflow: hidden; width: 100%; padding: 17px 22px; border: 0; border-radius: 16px; color: #1a1006;
  font: 700 16px/1 var(--display); letter-spacing: -.02em; background: var(--grad);
  box-shadow: 0 18px 40px -16px #ff7a59, inset 0 1px 0 #fff7; transition: transform .3s var(--ease), box-shadow .3s, filter .3s, opacity .3s; }
.go:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 24px 48px -16px #ff7a59, inset 0 1px 0 #fff7; }
.go:active:not(:disabled) { transform: translateY(0) scale(.985); }
.go:disabled { cursor: not-allowed; filter: grayscale(.85) brightness(.55); box-shadow: none; }
.go-sheen { position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, #fff9 50%, transparent 65%); transform: translateX(-120%); pointer-events: none; }
.go:not(:disabled) .go-sheen { animation: sheen 4.5s ease-in-out 1.2s infinite; }
@keyframes sheen { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.go-hint { min-height: 20px; margin: 12px 2px 0; font-size: 12.5px; color: var(--muted); }
.go-hint.warn { color: var(--warn); }

/* ───────── Сцена ───────── */
.stage { display: grid; gap: 18px; justify-items: center; animation: rise .9s var(--ease) .2s both; }
.frame-wrap { width: 100%; display: grid; place-items: center; padding: clamp(12px, 2vw, 26px); border-radius: var(--r-lg); min-height: 520px;
  background: radial-gradient(60% 60% at 50% 40%, #ffffff0a, transparent), var(--surface); border: 1px solid var(--line); }
.frame { position: relative; height: min(74vh, 780px); max-width: 100%; aspect-ratio: var(--ar); border-radius: 18px; overflow: hidden;
  background: #0000004d; box-shadow: 0 40px 90px -30px #000, 0 0 0 1px var(--line-2); transition: aspect-ratio .6s var(--ease); }
.layer { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; text-align: center;
  opacity: 0; visibility: hidden; transform: scale(.985); transition: opacity .5s var(--ease), transform .6s var(--ease), visibility 0s .5s; }
.stage[data-view="idle"] .idle, .stage[data-view="working"] .working,
.stage[data-view="done"] .result, .stage[data-view="failed"] .failed { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

.idle { border-radius: inherit; background:
  repeating-linear-gradient(135deg, transparent 0 14px, #ffffff06 14px 15px); }
.idle-art { position: relative; width: 120px; height: 120px; margin-bottom: 8px; }
.idle-art span { position: absolute; inset: 0; border-radius: 28px; border: 1.5px solid var(--line-2); }
.idle-art span:nth-child(1) { transform: rotate(-9deg); animation: float 7s ease-in-out infinite; }
.idle-art span:nth-child(2) { transform: rotate(7deg); border-color: #ffb36b66; animation: float 8s ease-in-out -2s infinite reverse; }
.idle-art span:nth-child(3) { inset: 22px; border: 0; background: var(--grad); opacity: .9; border-radius: 22px; filter: blur(.3px); box-shadow: 0 20px 50px -16px #ff7a59; animation: float 6s ease-in-out -1s infinite; }
@keyframes float { 50% { transform: translateY(-9px) rotate(var(--r, 0deg)); } }
.idle-title { margin: 0; font: 600 20px/1.2 var(--display); letter-spacing: -.03em; }
.idle-sub { margin: 0; max-width: 300px; color: var(--muted); font-size: 14px; }

.working { background: linear-gradient(180deg, #14111a, #0d0e13); overflow: hidden; }
.shimmer { position: absolute; inset: 0; background:
  radial-gradient(60% 40% at 30% 20%, #ff7a5929, transparent 70%),
  radial-gradient(50% 40% at 75% 80%, #7a5cff29, transparent 70%);
  animation: breathe 5s ease-in-out infinite alternate; }
.shimmer::after { content: ""; position: absolute; inset: -40%; background: linear-gradient(100deg, transparent 42%, #ffffff12 50%, transparent 58%); animation: sweep 2.6s linear infinite; }
@keyframes breathe { to { opacity: .55; transform: scale(1.08); } }
@keyframes sweep { from { transform: translateX(-60%); } to { transform: translateX(60%); } }
.work-core { position: relative; width: 150px; height: 150px; display: grid; place-items: center; }
.ring { position: absolute; inset: 0; transform: rotate(-90deg); overflow: visible; }
.ring circle { fill: none; stroke-width: 5; stroke-linecap: round; }
.ring-bg { stroke: #ffffff14; }
.ring-fg { stroke: var(--coral); stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .7s var(--ease); filter: drop-shadow(0 0 8px #ff7a59aa); }
.work-core.spin .ring { animation: spin 2.2s linear infinite; }
.work-core.spin .ring-fg { stroke-dashoffset: 250; transition: none; }
@keyframes spin { to { transform: rotate(270deg); } }
.ring-text { position: relative; display: grid; gap: 2px; }
.ring-text b { font: 700 30px/1 var(--display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.ring-text span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.work-phase { position: relative; margin: 14px 0 0; font: 600 17px/1.2 var(--display); letter-spacing: -.02em; }
.work-note { position: relative; margin: 0; max-width: 300px; color: var(--muted); font-size: 13px; min-height: 20px; }

.result { padding: 0; }
.result img { width: 100%; height: 100%; object-fit: contain; display: block; opacity: 0; filter: blur(22px) saturate(1.4); transform: scale(1.04); }
.stage[data-view="done"] .result img.loaded { opacity: 1; filter: none; transform: none; transition: opacity .9s var(--ease), filter 1.1s var(--ease), transform 1.1s var(--ease); }

.failed { gap: 8px; }
.fail-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; font: 700 26px var(--display); color: var(--bad); background: #ff6b6b1a; border: 1px solid #ff6b6b44; margin-bottom: 6px; }
.fail-title { margin: 0; font: 600 20px/1.2 var(--display); letter-spacing: -.03em; }
.fail-text { margin: 0; max-width: 320px; color: var(--muted); font-size: 14px; }

.stage-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; animation: rise .5s var(--ease) both; }
.btn { display: inline-flex; align-items: center; padding: 12px 20px; border-radius: 14px; border: 1px solid transparent; background: var(--text); color: #15110c;
  font-weight: 700; font-size: 14px; text-decoration: none; transition: transform .25s var(--ease), background .25s, border-color .25s; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface-2); }

/* ───────── История ───────── */
.history { max-width: 1320px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 36px) 30px; }
.history-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.history-head h2 { margin: 0; font: 600 18px var(--display); letter-spacing: -.03em; }
.history-note { color: var(--faint); font-size: 12.5px; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.thumb { position: relative; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface);
  aspect-ratio: 3/4; transition: transform .35s var(--ease), border-color .25s, box-shadow .35s; animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.thumb:hover { transform: translateY(-4px); border-color: #ffb36b99; box-shadow: 0 20px 40px -20px #000; }
.thumb:hover img { transform: scale(1.06); }
.thumb[aria-current="true"] { border-color: var(--amber); box-shadow: 0 0 0 2px #ffc15e55; }

.foot { padding: 10px 0 36px; text-align: center; color: var(--faint); font-size: 12px; }

/* ───────── Адаптив ───────── */
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; }
  .frame { height: auto; width: min(100%, 520px); }
  .frame-wrap { min-height: 0; }
  .history-note { display: none; }
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .brand-name em { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
