/* ---------- базовое ---------- */
:root {
  --bg: #0e0a12;
  --bg-2: #150e1c;
  --card: rgba(30, 22, 40, 0.72);
  --card-solid: #1c1526;
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-strong: rgba(255, 255, 255, 0.16);
  --text: #f4eef7;
  --muted: #a99fb6;
  --muted-2: #7d7389;
  --red: #ff3b6b;
  --red-soft: #ff6b8a;
  --pink: #ff4d94;
  --amber: #ffb64d;
  --green: #37d99a;
  --grad: linear-gradient(120deg, #ff4d6d 0%, #ff2d8f 50%, #b14bff 100%);
  --grad-red: linear-gradient(120deg, #ff5a5a, #ff2d6f);
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --radius: 22px;
  font-synthesis: none;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(140% 120% at 50% -10%, #1c1226 0%, var(--bg) 55%, #080509 100%);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

/* фоновые пятна */
.bg-orbs { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; }
.orb-1 { width: 46vw; height: 46vw; background: #ff2d6f; top: -8vw; left: -10vw; animation: float1 16s ease-in-out infinite; }
.orb-2 { width: 40vw; height: 40vw; background: #7b2dff; bottom: -12vw; right: -8vw; animation: float2 19s ease-in-out infinite; }
.orb-3 { width: 30vw; height: 30vw; background: #ff6b3d; top: 40%; left: 55%; opacity: 0.28; animation: float1 22s ease-in-out infinite; }
@keyframes float1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(4vw, 5vw); } }
@keyframes float2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-5vw, -4vw); } }

/* ---------- слой приложения ---------- */
.app {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.screen { display: none; animation: fadeIn 0.45s ease both; }
.screen.is-active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- интро ---------- */
.intro { text-align: center; padding: 8px 4px; }
.intro-badge {
  display: inline-block;
  font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--red-soft);
  background: rgba(255, 59, 107, 0.12);
  border: 1px solid rgba(255, 59, 107, 0.3);
  padding: 7px 14px; border-radius: 999px; margin-bottom: 22px;
}
.intro-title { font-size: clamp(30px, 8.5vw, 44px); font-weight: 820; line-height: 1.08; letter-spacing: -0.02em; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.intro-sub { color: var(--muted); font-size: 16px; margin: 18px auto 24px; max-width: 420px; }

.intro-meta { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 26px; }
.meta-pill {
  font-size: 13.5px; color: var(--text);
  background: var(--card); border: 1px solid var(--stroke);
  padding: 8px 13px; border-radius: 999px; backdrop-filter: blur(8px);
}

.field-label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 9px; padding-left: 4px; text-align: left; }

.gender-field { max-width: 380px; margin: 0 auto 16px; }
.gender-opts { display: flex; gap: 10px; }
.gender-opt {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 16px; font-weight: 650; font-family: inherit; color: var(--text);
  background: var(--card-solid); border: 1.5px solid var(--stroke-strong);
  border-radius: 14px; padding: 14px 10px; cursor: pointer;
  transition: transform 0.12s, border-color 0.18s, background 0.18s; -webkit-tap-highlight-color: transparent;
}
.gender-opt .g-emoji { font-size: 20px; }
.gender-opt:active { transform: scale(0.97); }
.gender-opt.selected { border-color: var(--pink); background: rgba(255, 77, 148, 0.14); box-shadow: 0 0 0 3px rgba(255, 77, 148, 0.12); }

.name-field { display: block; text-align: left; max-width: 380px; margin: 0 auto 18px; }
.name-field em { color: var(--muted-2); font-style: normal; }
.name-field input {
  width: 100%; font-size: 16px; color: var(--text);
  background: var(--card-solid); border: 1px solid var(--stroke-strong);
  border-radius: 14px; padding: 14px 16px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.name-field input::placeholder { color: var(--muted-2); }
.name-field input:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 77, 148, 0.16); }

.intro-hint { color: var(--red-soft); font-size: 13px; margin-top: 12px; min-height: 16px; transition: opacity 0.2s; }
.intro-hint.hidden { opacity: 0; }
.intro-note { color: var(--muted-2); font-size: 13px; margin-top: 12px; }
.btn.disabled { opacity: 0.45; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 17px; font-weight: 700; font-family: inherit;
  border: none; border-radius: 16px; padding: 16px 26px; cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { color: #fff; background: var(--grad); box-shadow: 0 14px 30px -10px rgba(255, 45, 111, 0.6); width: 100%; max-width: 380px; }
.btn-ghost { color: var(--text); background: var(--card); border: 1px solid var(--stroke-strong); }

/* ---------- квиз ---------- */
.quiz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.icon-btn {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--stroke); color: var(--text);
  font-size: 20px; cursor: pointer; transition: background 0.2s, opacity 0.2s; display: grid; place-items: center;
}
.icon-btn:disabled { opacity: 0.32; cursor: default; }
.progress { flex: 1; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.progress-bar { height: 100%; width: 7%; border-radius: 999px; background: var(--grad); transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1); }
.progress-count { flex: none; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

.q-card {
  transition: opacity 0.24s ease, transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}
.q-card.no-anim { transition: none !important; }
.q-card.q-out-left  { opacity: 0; transform: translateX(-26px); }
.q-card.q-out-right { opacity: 0; transform: translateX(26px); }
.q-card.q-in-right  { opacity: 0; transform: translateX(26px); }
.q-card.q-in-left   { opacity: 0; transform: translateX(-26px); }

.q-cat { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--card); border: 1px solid var(--stroke); padding: 6px 12px; border-radius: 999px; margin-bottom: 18px; }
.q-emoji { font-size: 44px; line-height: 1; margin-bottom: 14px; }
.q-text { font-size: clamp(21px, 5.6vw, 26px); font-weight: 750; letter-spacing: -0.01em; margin-bottom: 22px; }

.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  position: relative; text-align: left; width: 100%;
  background: var(--card); border: 1.5px solid var(--stroke); color: var(--text);
  border-radius: 18px; padding: 17px 18px; font-size: 15.5px; font-family: inherit; line-height: 1.4;
  cursor: pointer; transition: transform 0.12s, border-color 0.18s, background 0.18s;
  backdrop-filter: blur(8px); -webkit-tap-highlight-color: transparent;
}
.option:hover { border-color: var(--stroke-strong); }
.option:active { transform: scale(0.985); }
.option .opt-index { font-weight: 800; color: var(--muted-2); margin-right: 9px; }
.option.selected { border-color: var(--pink); background: rgba(255, 77, 148, 0.13); }
.option.selected .opt-index { color: var(--pink); }

/* ---------- результат ---------- */
.result-inner { animation: fadeIn 0.5s ease both; }
.result-hero { text-align: center; padding-top: 6px; }

.gauge { position: relative; width: 220px; height: 220px; margin: 4px auto 6px; }
.gauge svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.gauge-track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 16; }
.gauge-fill { fill: none; stroke: url(#gaugeGrad); stroke-width: 16; stroke-linecap: round; transition: stroke-dashoffset 1.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-num { font-size: 54px; font-weight: 850; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.gauge-cap { font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }

.arch-emoji { font-size: 50px; margin: 8px 0 2px; }
.arch-title { font-size: 27px; font-weight: 820; letter-spacing: -0.01em; }
.arch-tag { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--red-soft); background: rgba(255,59,107,0.12); border: 1px solid rgba(255,59,107,0.28); padding: 5px 13px; border-radius: 999px; }
.arch-text { color: var(--muted); font-size: 15.5px; margin: 18px auto 0; max-width: 440px; }

.result-card { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 20px 18px; margin-top: 22px; backdrop-filter: blur(10px); box-shadow: var(--shadow); }
.result-card h3 { font-size: 15px; font-weight: 700; color: var(--muted); margin-bottom: 16px; letter-spacing: 0.01em; }

.bar-row { margin-bottom: 16px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; gap: 10px; }
.bar-name { font-size: 14.5px; font-weight: 600; }
.bar-name .b-emoji { margin-right: 7px; }
.bar-pct { font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { height: 10px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; width: 0; transition: width 1s cubic-bezier(0.2, 0.8, 0.2, 1); }

.hl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.hl { border-radius: 16px; padding: 15px; border: 1px solid var(--stroke); }
.hl.red { background: rgba(255,59,107,0.1); border-color: rgba(255,59,107,0.25); }
.hl.green { background: rgba(55,217,154,0.09); border-color: rgba(55,217,154,0.22); }
.hl-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.hl-val { font-size: 15px; font-weight: 700; }

.result-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* ---------- разбор ответов ---------- */
.analysis { overflow: hidden; max-height: 0; opacity: 0; transition: max-height 0.4s ease, opacity 0.35s ease, margin 0.3s ease; margin-top: 0; }
.analysis.open { max-height: 20000px; opacity: 1; margin-top: 16px; }
.an-head { margin-bottom: 14px; }
.an-title { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.an-sub { color: var(--muted); font-size: 13.5px; margin-top: 5px; }

.an-item {
  position: relative; background: var(--card); border: 1px solid var(--stroke);
  border-left-width: 4px; border-radius: 16px; padding: 15px 16px; margin-bottom: 11px; backdrop-filter: blur(8px);
}
.an-item.s1 { border-left-color: var(--amber); }
.an-item.s2 { border-left-color: #ff8a4d; }
.an-item.s3 { border-left-color: var(--red); }

.an-cat { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.an-q { font-size: 15px; font-weight: 650; line-height: 1.35; margin-bottom: 10px; }
.an-line { margin-bottom: 8px; }
.an-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.03em; }
.an-badge.s1 { color: var(--amber); background: rgba(255,182,77,0.12); border: 1px solid rgba(255,182,77,0.28); }
.an-badge.s2 { color: #ff8a4d; background: rgba(255,138,77,0.12); border: 1px solid rgba(255,138,77,0.28); }
.an-badge.s3 { color: var(--red); background: rgba(255,59,107,0.12); border: 1px solid rgba(255,59,107,0.28); }
.an-answer { font-size: 14.5px; line-height: 1.4; color: var(--text); margin-bottom: 10px; }
.an-green { font-size: 13.5px; line-height: 1.4; color: var(--muted); background: rgba(55,217,154,0.07); border: 1px solid rgba(55,217,154,0.18); border-radius: 12px; padding: 10px 12px; }
.an-green-tag { display: block; font-size: 11px; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }

@media (max-width: 380px) {
  .hl-grid { grid-template-columns: 1fr; }
  .gauge { width: 190px; height: 190px; }
}
