/* StyleMatch AI — пастельный fashion-editorial
   розовый → лаванда → персик · Prata (display) + Inter (text) */

/* --- Шрифты (локально, не с Google Fonts) --- */
@font-face {
  font-family: 'Prata';
  src: url('fonts/Prata-Cyrillic.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Prata';
  src: url('fonts/Prata-Latin.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2018-201A, U+2013-2014, U+2026;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-Regular-Latin.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2018-201A, U+2013-2014, U+2026;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-SemiBold-Latin.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2018-201A, U+2013-2014, U+2026;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-Bold-Latin.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2018-201A, U+2013-2014, U+2026;
}

:root {
  --ink: #43304f;
  --ink-soft: #86739a;
  --white: #ffffff;
  --accent: #9d5be8;
  --rose: #ffb8d9;
  --lilac: #cfaefc;
  --peach: #ffcfae;
  --card-grad: linear-gradient(150deg, #ff8fc2 0%, #ae7bfa 52%, #ffab7e 100%);
  --shadow-soft: 0 10px 34px rgba(122, 74, 160, 0.18);
  --shadow-btn: 0 12px 30px rgba(158, 84, 220, 0.35);
  --r-lg: 26px;
  --r-md: 20px;
  --display: 'Prata', 'Inter', serif;
  --text: 'Inter', -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--text);
  color: var(--ink);
  background: #f6ecf9;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* --- Живой градиентный фон: три плывущих пятна + зерно --- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
/* мягкие пятна без filter: blur — быстро даже на слабых WebView */
.blob {
  position: absolute;
  width: 140vw;
  aspect-ratio: 1;
  border-radius: 50%;
  will-change: transform;
}
.blob-rose {
  background: radial-gradient(circle, var(--rose) 0%, rgba(255,184,217,0.4) 35%, transparent 68%);
  top: -50%; left: -45%;
  animation: drift1 22s ease-in-out infinite alternate;
}
.blob-lilac {
  background: radial-gradient(circle, var(--lilac) 0%, rgba(207,174,252,0.4) 35%, transparent 68%);
  top: 0%; right: -60%;
  animation: drift2 27s ease-in-out infinite alternate;
}
.blob-peach {
  background: radial-gradient(circle, var(--peach) 0%, rgba(255,207,174,0.4) 35%, transparent 68%);
  bottom: -55%; left: -25%;
  animation: drift3 24s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(12vw, 10vh) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-14vw, 14vh) scale(0.94); } }
@keyframes drift3 { to { transform: translate(10vw, -12vh) scale(1.08); } }

.grain {
  position: absolute;
  inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.05;
  mix-blend-mode: multiply;
}

#app {
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* --- Экраны --- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.screen.active { opacity: 1; pointer-events: auto; }

/* стаггер-появление элементов активного экрана */
.screen .rise {
  opacity: 0;
  transform: translateY(18px);
}
.screen.active .rise {
  animation: rise 640ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--i, 0) * 90ms);
}
@keyframes rise {
  to { opacity: 1; transform: none; }
}

/* --- Онбординг --- */
.onboard-mark {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 26px;
}
.onboard-mark::before,
.onboard-mark::after {
  content: '·';
  color: var(--accent);
  margin: 0 10px;
}

h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.22;
  text-align: center;
  margin-bottom: 16px;
  text-wrap: balance;
}
h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #e0529c, #9d5be8, #f08a4b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sub {
  font-size: 16px;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 14px;
}

.social-proof {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  padding: 9px 18px;
  margin-bottom: 40px;
  backdrop-filter: blur(6px);
}
.social-proof::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e0529c;
  animation: pulse-dot 1.6s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.55; }
}

.last-result {
  font-size: 14px;
  color: var(--ink-soft);
  background: rgba(255,255,255,0.6);
  border-radius: 14px;
  padding: 10px 16px;
  margin-bottom: 20px;
}
.last-result b { color: var(--ink); }

/* --- Кнопки (тап-зоны 80px+ у ответов, 64px у CTA) --- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 60px;
  border: none;
  border-radius: var(--r-md);
  font-family: var(--text);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.btn:active { transform: scale(0.965); }

.btn-primary {
  position: relative;
  overflow: hidden;
  background: var(--card-grad);
  background-size: 160% 160%;
  color: var(--white);
  min-height: 64px;
  box-shadow: var(--shadow-btn);
  animation: grad-shift 5s ease infinite;
}
@keyframes grad-shift {
  0%, 100% { background-position: 0% 40%; }
  50% { background-position: 100% 60%; }
}
/* пробегающий блик */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 46%;
  left: -60%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,0.5), transparent);
  animation: sheen 3.2s ease-in-out infinite;
}
@keyframes sheen {
  0%, 55% { left: -60%; }
  85%, 100% { left: 130%; }
}

.btn-secondary {
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,255,255,0.9);
  color: var(--ink);
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(122, 74, 160, 0.10);
}

/* --- Квиз --- */
.progress-wrap {
  position: absolute;
  top: 18px;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-track {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.65);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--card-grad);
  border-radius: 3px;
  transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
.progress-label {
  font-family: var(--display);
  font-size: 13px;
  color: var(--ink-soft);
  min-width: 34px;
  text-align: right;
  letter-spacing: 0.08em;
}

.quiz-kicker {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.quiz-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 29px;
  line-height: 1.2;
  text-align: center;
  margin-bottom: 30px;
  text-wrap: balance;
}

/* 6 ответов — экран квиза скроллится на низких вьюпортах */
#screen-quiz {
  justify-content: flex-start;
  padding-top: 56px;
  padding-bottom: 30px;
  overflow-y: auto;
}
#screen-quiz > * { flex-shrink: 0; }

.answers {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.answer {
  display: flex;
  align-items: center;
  gap: 15px;
  text-align: left;
  padding: 0 20px;
  min-height: 80px; /* тап-зона 80px+ */
  background: rgba(255,255,255,0.78);
  border: 1.5px solid rgba(255,255,255,0.95);
  border-radius: var(--r-lg);
  font-family: var(--text);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 5px 18px rgba(122, 74, 160, 0.10);
  backdrop-filter: blur(6px);
  transition: transform 130ms ease, border-color 130ms ease, box-shadow 130ms ease;
}
.answer .chip {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--accent);
  background: linear-gradient(140deg, rgba(255,184,217,0.4), rgba(207,174,252,0.4));
}
.answer .chip svg { width: 24px; height: 24px; }
.answer .dots {
  display: flex;
  align-items: center;
}
.answer .dots i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.9);
  margin-left: -4px;
}
.answer .dots i:first-child { margin-left: 0; }
.answer:active {
  transform: scale(0.97);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(158, 84, 220, 0.22);
}

/* --- Генерация --- */
.gen-stage {
  position: relative;
  width: 150px;
  height: 150px;
  margin-bottom: 38px;
}
.gen-orb {
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: var(--card-grad);
  filter: blur(2px);
  animation: orb-pulse 1.5s ease-in-out infinite;
}
.gen-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 70%, rgba(255,255,255,0.95) 92%, transparent 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  animation: spin 1.3s linear infinite;
}
@keyframes orb-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.1); opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.gen-text {
  font-family: var(--display);
  font-size: 19px;
  text-align: center;
  color: var(--ink);
  min-height: 52px;
  transition: opacity 300ms ease;
}

/* --- Результат --- */
.screen-result {
  justify-content: flex-start;
  padding-top: 34px;
  padding-bottom: 44px;
  overflow-y: auto;
}
.result-card {
  position: relative;
  overflow: hidden;
  flex-shrink: 0; /* иначе flex сжимает карточку и текст обрезается */
  width: 100%;
  background: var(--card-grad);
  border-radius: 28px;
  padding: 30px 26px 26px;
  color: var(--white);
  text-align: center;
  box-shadow: var(--shadow-soft);
  margin-bottom: 20px;
}
/* деликатная рамка внутри — как у пригласительного */
.result-card::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 20px;
  pointer-events: none;
}
.result-label {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 10px;
}
.result-dna {
  font-family: var(--display);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.15;
  text-wrap: balance;
  margin-bottom: 14px;
}
.result-medallion {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin: 2px auto 16px;
  border-radius: 50%;
  color: var(--white);
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow: inset 0 0 24px rgba(255,255,255,0.25);
}
.result-medallion svg { width: 38px; height: 38px; }
.result-desc {
  font-size: 15px;
  line-height: 1.55;
  opacity: 0.96;
  margin-bottom: 16px;
  text-align: left;
}
.rarity {
  display: inline-block;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
}

.result-actions {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 11px;
  width: 100%;
}
.result-actions .btn { flex-shrink: 0; }

.channel-block {
  margin-top: 18px;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--ink-soft);
  text-align: center;
}
.channel-block a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* --- Toast --- */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(67, 48, 79, 0.94);
  color: var(--white);
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  max-width: 90%;
  text-align: center;
  z-index: 10;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .blob, .btn-primary, .btn-primary::after, .social-proof::before { animation: none; }
}
