/* Анфас. Студийный белый, паспортный бордо, разметка как на листе для резки. */

@font-face { font-family: "Anfas Display"; src: url("/static/fonts/InterDisplay-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Anfas Display"; src: url("/static/fonts/InterDisplay-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  --paper: #fafafb;
  --white: #ffffff;
  --fog: #eef0f3;
  --fog-2: #e3e6eb;
  --ink: #15161a;
  --ink-2: #5d616c;
  --line: rgba(21, 22, 26, .1);
  --wine: #7b1e34;          /* цвет обложки паспорта */
  --wine-press: #63172a;
  --wine-soft: rgba(123, 30, 52, .08);
  --ok: #1e8a5a;
  --ok-soft: rgba(30, 138, 90, .12);
  --warn: #b25e00;
  --warn-soft: rgba(230, 140, 20, .14);
  --bad: #c4142c;

  --display: "Anfas Display", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  --text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --lift: 0 1px 1px rgba(21, 22, 26, .04), 0 12px 32px -12px rgba(21, 22, 26, .18);
  --photo-shadow: 0 2px 3px rgba(21, 22, 26, .08), 0 30px 60px -20px rgba(21, 22, 26, .35);
  --ease: cubic-bezier(.22, .9, .26, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --gutter: 20px;
  --maxw: 1180px;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--wine); outline-offset: 3px; border-radius: 6px; }
#app { min-height: 100dvh; }

/* ---------- общая типографика ---------- */
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.02em; }
h1 { font-size: clamp(40px, 5.4vw, 72px); line-height: .98; font-weight: 700; letter-spacing: -.035em; }
h2 { font-size: clamp(30px, 3.6vw, 46px); line-height: 1.05; font-weight: 700; letter-spacing: -.028em; }
h3 { font-size: 20px; line-height: 1.25; font-weight: 600; }
.lead { color: var(--ink-2); font-size: clamp(18px, 1.6vw, 21px); line-height: 1.45; margin: 0; max-width: 34em; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- кнопки ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  min-height: 56px; padding: 0 26px; border-radius: 999px;
  font-size: 17px; font-weight: 600; letter-spacing: -.01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .18s var(--ease), background .2s, box-shadow .2s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--wine); color: #fff; box-shadow: 0 10px 24px -10px rgba(123, 30, 52, .7); }
.btn-primary:hover { background: var(--wine-press); }
.btn-secondary { background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-secondary:hover { box-shadow: inset 0 0 0 1px rgba(21, 22, 26, .25); }
.btn-link { background: transparent; color: var(--wine); min-height: 48px; font-weight: 600; padding: 0 12px; }
.btn-block { width: 100%; }
.stack { display: grid; gap: 10px; }

/* ---------- шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-top) + 10px) var(--gutter) 10px;
  background: rgba(250, 250, 251, .82);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid transparent; transition: border-color .3s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-in { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: 24px; height: 44px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -.02em; text-decoration: none; }
.brand-mark { width: 28px; height: 36px; border-radius: 4px; background: var(--wine); display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px rgba(255, 215, 150, .55); }
.brand-mark svg { width: 16px; height: 16px; color: rgba(255, 220, 160, .95); }
.nav { margin-left: auto; display: none; gap: 4px; }
.nav button { border: 0; background: none; padding: 8px 12px; border-radius: 999px; cursor: pointer; color: var(--ink-2); font-size: 15px; }
.nav button:hover { color: var(--ink); background: var(--fog); }
.topbar .btn { min-height: 40px; padding: 0 18px; font-size: 15px; margin-left: auto; }
@media (min-width: 900px) {
  .nav { display: flex; }
  .topbar .btn { margin-left: 8px; }
}

/* ---------- экраны сценария ---------- */
.screen {
  max-width: 480px; margin: 0 auto; min-height: 100dvh;
  padding: calc(var(--safe-top) + 12px) var(--gutter) calc(var(--safe-bottom) + 24px);
  display: flex; flex-direction: column;
  animation: enter .5s var(--ease) both;
}
.screen.wide { max-width: var(--maxw); }
@keyframes enter { from { opacity: 0; transform: translateY(14px); } }
.bar { display: flex; align-items: center; justify-content: space-between; height: 44px; margin-bottom: 12px; }
.icon-btn { width: 44px; height: 44px; margin-left: -10px; border: 0; border-radius: 22px; background: transparent; display: grid; place-items: center; cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--fog); }
.icon-btn svg { width: 22px; height: 22px; }
.screen h2 { margin: 6px 0 8px; }
.screen .lead { margin-bottom: 22px; }
.footer { margin-top: auto; padding-top: 22px; }

.split { display: grid; gap: 28px; }
@media (min-width: 900px) {
  .screen.wide { padding-top: calc(var(--safe-top) + 24px); }
  /* на широком экране логотип по центру повисал над правой колонкой */
  .screen.wide .bar { justify-content: flex-start; gap: 8px; }
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; align-items: start; }
  .split > :first-child { position: sticky; top: 24px; }
  .split .footer { margin-top: 24px; }
}

.outfits { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; max-width: 420px; margin: 0 auto; }
.outfit { border: 0; background: none; padding: 0; cursor: pointer; display: grid; gap: 8px; justify-items: center; font: inherit; color: var(--ink); }
.outfit-pic { width: 100%; aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: #fff; box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow .2s ease, transform .2s ease; position: relative; }
.outfit-pic img { position: absolute; height: 175%; width: auto; max-width: none; bottom: 0; left: 50%; transform: translateX(-50%); display: block; }
.outfit:hover .outfit-pic { transform: translateY(-2px); }
.outfit[aria-checked="true"] .outfit-pic { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--wine); }
.outfit-title { font-size: 13px; font-weight: 600; text-align: center; line-height: 1.25; }
.outfit[aria-checked="true"] .outfit-title { color: var(--wine); }
.compare.loading::after { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .45); backdrop-filter: blur(2px); }
.compare.loading .knob { animation: spin 1s linear infinite; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 8px; }
.chip { border: 0; box-shadow: inset 0 0 0 1px var(--line); background: var(--white); border-radius: 999px; padding: 10px 16px; font-size: 15px; font-weight: 600; cursor: pointer; }
.chip[aria-checked="true"] { background: var(--ink); color: #fff; box-shadow: none; }

/* требования */
.spec-hero { display: grid; grid-template-columns: 120px 1fr; gap: 20px; align-items: center; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-lg); padding: 20px; margin-bottom: 26px; }
@media (min-width: 900px) { .spec-hero { grid-template-columns: 200px 1fr; padding: 28px; } }
.spec-frame { aspect-ratio: var(--ar, 35 / 45); background: #fff; border-radius: 3px; position: relative; overflow: hidden; box-shadow: var(--photo-shadow); }
.spec-frame svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.spec-facts { display: grid; gap: 10px; font-size: 15px; margin: 0; }
.spec-facts div { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.spec-facts div:first-child { border-top: 0; padding-top: 0; }
.spec-facts dt { color: var(--ink-2); }
.spec-facts dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.rules { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 14px; }
.rules li { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; }
.rules .dot { width: 24px; height: 24px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; flex: none; }
.rules .dot svg { width: 14px; height: 14px; }

/* ---------- камера ---------- */
.camera { position: fixed; inset: 0; background: #000; color: #fff; overflow: hidden; z-index: 50; }
.cam-stage { position: absolute; inset: 0; overflow: hidden; }
/* Камера ноутбука снимает широкий кадр: на весь монитор лицо раздуло бы, поэтому рамка как у телефона. */
@media (min-aspect-ratio: 1/1) and (min-width: 760px) {
  .cam-stage { inset: auto; left: 50%; top: calc(50% - 46px); transform: translate(-50%, -50%);
    height: min(calc(100vh - 200px), 860px); aspect-ratio: 3 / 4; border-radius: 24px; }
}
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.camera .oval {
  position: absolute; left: 50%; transform: translate(-50%, -50%); border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .55);
  transition: border-color .3s, border-width .3s; pointer-events: none;
}
.camera .oval.ok { border-color: #34d27b; border-width: 4px; }
.cam-top { position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--safe-top) + 10px) 14px 0; display: flex; justify-content: space-between; align-items: center; }
.cam-top .icon-btn { margin: 0; color: #fff; background: rgba(0, 0, 0, .35); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.hint {
  position: absolute; left: 50%; top: calc(var(--safe-top) + 66px); transform: translateX(-50%);
  max-width: calc(100% - 40px); padding: 11px 20px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  font-size: 16px; font-weight: 600; text-align: center; transition: background .3s;
}
.hint.ok { background: rgba(30, 138, 90, .9); }
.countdown { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); font-family: var(--display); font-size: 120px; font-weight: 700; text-shadow: 0 4px 30px rgba(0, 0, 0, .4); animation: pop .9s var(--ease) both; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); } 30% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; } }
.flash { position: absolute; inset: 0; background: #fff; animation: flash .55s ease-out both; pointer-events: none; }
@keyframes flash { from { opacity: .95; } to { opacity: 0; } }
.cam-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 24px calc(var(--safe-bottom) + 24px); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.shutter { width: 80px; height: 80px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 4px; cursor: pointer; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform .15s, background .3s; }
.shutter:active span { transform: scale(.9); }
.shutter.auto span { background: #34d27b; }
.cam-side { display: flex; justify-content: center; }
.cam-side .small-btn { border: 0; background: rgba(255, 255, 255, .18); color: #fff; border-radius: 999px; padding: 10px 16px; font-size: 14px; font-weight: 600; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); cursor: pointer; }
.cam-note { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 124px); text-align: center; font-size: 14px; opacity: .85; }

/* ---------- обработка ---------- */
.processing { align-items: center; justify-content: center; text-align: center; }
.proc-photo { width: min(62vw, 260px); aspect-ratio: 35 / 45; border-radius: 4px; overflow: hidden; position: relative; background: var(--fog); box-shadow: var(--photo-shadow); }
.proc-photo img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.7) contrast(.95); }
.proc-photo::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 45%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .7), rgba(255, 255, 255, 0));
  animation: scan 1.5s var(--ease) infinite;
}
@keyframes scan { from { left: -45%; } to { left: 100%; } }
.proc-step { margin-top: 30px; font-family: var(--display); font-size: 22px; font-weight: 600; min-height: 30px; letter-spacing: -.015em; }
.proc-sub { color: var(--ink-2); margin-top: 6px; font-size: 15px; }

/* ---------- результат ---------- */
.compare {
  position: relative; width: 100%; max-width: 380px; margin: 0 auto; aspect-ratio: var(--ar, 35 / 45);
  border-radius: 4px; overflow: hidden; background: var(--fog); box-shadow: var(--photo-shadow);
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: ew-resize;
}
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.compare .after { clip-path: inset(0 0 0 var(--cut, 50%)); }
.compare .handle { position: absolute; top: 0; bottom: 0; left: var(--cut, 50%); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .15); }
.compare .knob { position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 12px rgba(0, 0, 0, .25); display: grid; place-items: center; color: var(--ink); }
.compare .knob svg { width: 18px; height: 18px; }
.compare .tag { position: absolute; top: 10px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(0, 0, 0, .5); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.compare .tag.l { left: 10px; } .compare .tag.r { right: 10px; }
.compare.intro .after, .compare.intro .handle { transition: clip-path 1.3s var(--ease), left 1.3s var(--ease); }

.checks { list-style: none; padding: 0; margin: 0 0 18px; display: grid; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-lg); overflow: hidden; }
.checks li { display: flex; align-items: center; gap: 12px; padding: 13px 16px; font-size: 15px; }
.checks li + li { border-top: 1px solid var(--line); }
.checks .ic { width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.checks .ok .ic { background: var(--ok-soft); color: var(--ok); }
.checks .warn .ic { background: var(--warn-soft); color: var(--warn); }
.checks .ic svg { width: 13px; height: 13px; }
.checks li { opacity: 0; transform: translateY(6px); animation: tick .45s var(--ease) forwards; }
@keyframes tick { to { opacity: 1; transform: none; } }

.buy { background: var(--white); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-lg); padding: 22px; margin-bottom: 12px; }
.buy-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.buy-price { font-family: var(--display); font-size: 40px; font-weight: 700; letter-spacing: -.03em; }
.buy ul { margin: 10px 0 16px; padding: 0; list-style: none; display: grid; gap: 7px; font-size: 15px; color: var(--ink-2); }
.buy li { display: flex; gap: 8px; }
.buy li::before { content: "✓"; color: var(--ok); font-weight: 700; }
.buy .btn { width: 100%; }
.field { width: 100%; height: 52px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--paper); padding: 0 16px; font-size: 16px; margin-bottom: 10px; outline: none; }
.field:focus { border-color: var(--wine); box-shadow: 0 0 0 4px var(--wine-soft); }
.notice { border-radius: var(--r-md); padding: 12px 14px; font-size: 15px; margin-bottom: 14px; background: var(--warn-soft); }
.notice.err { background: rgba(196, 20, 44, .08); color: var(--bad); }

/* ---------- готово ---------- */
.done-check { width: 76px; height: 76px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; margin: 12px auto 12px; animation: popin .6s var(--ease) both; }
.done-check svg { width: 38px; height: 38px; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .5s .3s ease-out forwards; }
@keyframes popin { from { transform: scale(.4); opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.final { width: min(56%, 260px); margin: 12px auto 24px; border-radius: 3px; box-shadow: var(--photo-shadow); background: #fff; aspect-ratio: var(--ar, 35 / 45); object-fit: cover; animation: land .8s .2s var(--ease) both; }
@keyframes land { from { opacity: 0; transform: translateY(-16px) rotate(-3deg); } }
.split .final { width: min(80%, 340px); }
details.howto { background: var(--white); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-lg); padding: 4px 18px; margin-top: 12px; }
details.howto summary { list-style: none; cursor: pointer; padding: 15px 0; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
details.howto summary::-webkit-details-marker { display: none; }
details.howto summary svg { width: 18px; height: 18px; color: var(--ink-2); }
details.howto ol { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 8px; font-size: 15px; color: var(--ink-2); }
.chev { width: 18px; height: 18px; color: var(--ink-2); flex: none; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.legal h1 { font-size: clamp(30px, 3.6vw, 46px); line-height: 1.05; font-weight: 700; letter-spacing: -.028em; margin: 0 0 8px; }
.legal h3 { margin: 24px 0 6px; }
.legal p { margin: 0 0 10px; font-size: 16px; }
.legal a { color: var(--wine); }

@media (prefers-reduced-motion: reduce) {
  .print .wide { display: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .print .done { clip-path: inset(0 0 0 0); }
  .marks, .dim, .stamps li { opacity: 1; transform: none; }
}

/* бонусные документы после оплаты */
.mailbox { margin: 22px 0 6px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-lg); padding: 18px; }
.mailbox h3 { margin: 0 0 4px; font-size: 17px; }
.mailbox p { margin: 0 0 12px; }
.mail-row { display: flex; gap: 10px; }
.mail-row .field { margin: 0; flex: 1; min-width: 0; }
.mail-row .btn { flex: none; min-height: 52px; padding: 0 18px; font-size: 16px; }
.extras { margin: 22px 0 6px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-lg); padding: 18px 18px 8px; }
.extras h3 { margin: 0 0 4px; font-size: 17px; }
.extras ul { list-style: none; margin: 10px 0 0; padding: 0; }
.extras li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.extras-links { display: flex; gap: 14px; }
.extras-links a { color: var(--wine); font-weight: 600; text-decoration: none; font-size: 15px; }

/* ---------- тестовый режим: без настоящей оплаты ---------- */
body.test-mode::before {
  content: "Тестовый режим: оплата не настоящая";
  display: block; padding: calc(var(--safe-top) + 4px) 12px 4px; background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 600; text-align: center;
}
.stage-caption { z-index: 3; }

/* Экран как софтбокс на время серии кадров */
.screen-light { position: absolute; inset: 0; z-index: 60; background: #fff; }
