/* Mobile-first, чистый CSS */
:root {
  --bg: #0f1115;
  --card: #151922;
  --card-2: #1b2030;
  --text: #e9ecf1;
  --muted: #a9b1bd;
  --primary: #ff3366;
  --primary-2: #ff648b;
  --accent: #6c8cff;
  --success: #22c55e;
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 24px rgba(0,0,0,.25);
  --container: 1100px;
  --header-h: 56px; /* dynamic override from JS */
}

* { box-sizing: border-box }

html, body { height: 100% }

/* Global smooth scroll and offset for sticky header */
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 6px); }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

main { display: flex; flex-direction: column; flex: 1 0 auto }

img { max-width: 100%; display: block }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15,17,21,.8);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.header .container {
  /* More breathing room from screen edges with safe-area support */
  padding-left: calc(clamp(20px, 5vw, 24px) + env(safe-area-inset-left));
  padding-right: calc(clamp(20px, 5vw, 24px) + env(safe-area-inset-right));
}
.header__row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--text); text-decoration: none }
.brand:hover { opacity: .9; cursor: pointer }
.logo { font-size: 22px; color: var(--primary) }
.brand__name { font-size: 16px; letter-spacing: .3px }

/* Hero */
.hero { padding: 36px 0 18px }
.hero__inner { text-align: center }
.hero__title { font-size: 28px; margin: 0 0 8px }
.hero__subtitle { margin: 0 0 16px; color: var(--muted) }
.hero__cta { display: flex; flex-direction: column; gap: 10px; align-items: center }
.hero .divider { margin: 16px 0 12px }

/* Buttons */
.btn { appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font-weight: 600; border-radius: 999px; transition: .2s ease; white-space: nowrap; padding: 12px 16px; font-size: 14px; min-height: 44px; line-height: 1 }
.btn-lg { padding: 14px 22px; font-size: 16px; min-height: 48px }
.btn-sm { padding: 10px 14px; font-size: 13px; min-height: 40px }
.btn-primary { background: linear-gradient(180deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 6px 18px rgba(255, 51, 102, .35); animation: ctaPulse 2.4s ease-in-out infinite; transform-origin: center center }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(255, 51, 102, .4); animation: none }
.btn-secondary { background: #2a3347; color: #fff }
.btn-secondary:hover { background: #323b50 }
.btn-light { background: #eef1f6; color: #0f1115 }
.btn-light:hover { background: #fff }
.btn-link { background: rgba(108,140,255,.10); color: var(--accent); padding: 8px 12px; font-weight: 700; border-radius: 999px }
.btn-link:hover { background: rgba(108,140,255,.16) }
.btn[disabled] { opacity: .6; cursor: not-allowed }

/* Sections */
.section__title { font-size: 20px; margin: 12px 0 16px; scroll-margin-top: calc(var(--header-h) + 8px) }

/* Profiles grid */
.profiles { padding: 12px 0 8px }
.profiles__more { margin: 12px 0 6px; background: #1b2232; border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius); padding: 12px }
.profiles__more strong { display: block; margin-bottom: 4px }
.profiles__more .text { color: var(--muted) }
.grid { display: grid; grid-template-columns: 1fr; gap: 12px }
.card { background: linear-gradient(180deg, var(--card), var(--card-2)); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; height: 100% }
.card__img { position: relative; aspect-ratio: 4 / 5; overflow: hidden }
.card__img img { width: 100%; height: 100%; object-fit: cover; filter: saturate(1.05) contrast(1.05) }
.card--daria .card__img img { object-position: 50% 22% }
.badge { position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,.55); color: #fff; padding: 6px 10px; border-radius: 999px; font-size: 12px; backdrop-filter: blur(4px) }
.card__body { padding: 12px; display: flex; flex-direction: column; flex: 1 1 auto }
/* Flex spacer to push bottom group (Ищу + CTA) down */
.card__body::after { content: ""; display: block; flex: 1 1 auto; order: 1 }
/* Place the Ищу-блок and CTA after the spacer */
.card__body .tags.looking { order: 2; margin-bottom: 10px }
.card__body .view-card { order: 2; margin-top: 10px }
.card h3 { margin: 0 0 6px; font-size: 16px }
.tags { color: var(--muted); margin: 0 0 12px; font-size: 13px }
.tags.looking { color: #ffb0c2; font-weight: 600; background: rgba(255,51,102,.08); border: 1px solid rgba(255,51,102,.22); padding: 8px 10px; border-radius: 10px }

/* CTA button style (used on cards and in pre-step) */
.view-card {
  width: 100%;
  min-height: 44px; /* comfortable touch target */
  padding: 12px 16px;
  font-size: 15px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 8px 22px rgba(255,51,102,.35);
  border: 0;
  animation: ctaPulse 2.4s ease-in-out infinite;
  transform-origin: center center;
}
.view-card:hover { transform: translateY(-1px) scale(1.02); box-shadow: 0 10px 26px rgba(255,51,102,.45); background: linear-gradient(180deg, var(--primary), var(--primary-2)) }
.view-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }

@keyframes ctaPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 22px rgba(255,51,102,.35) }
  50% { transform: scale(1.035); box-shadow: 0 12px 30px rgba(255,51,102,.48) }
}
@media (hover:hover) {
  .view-card:hover { animation: none }
  .btn-primary:hover { animation: none }
}
@media (prefers-reduced-motion: reduce) {
  .view-card { animation: none }
  .btn-primary { animation: none }
  .steps { animation: none }
}

/* Quiz */
.quiz { padding: 18px 0 16px; margin-top: 4px }
.steps { 
  background: #1b2232; 
  border-radius: var(--radius); 
  border: 1px solid rgba(255,255,255,.06); 
  box-shadow: var(--shadow); 
  padding: 14px; 
  margin-bottom: 16px; 
  animation: pulseOutline 2.2s ease-in-out infinite;
  transition: transform .25s ease, box-shadow .25s ease;
  will-change: transform;
}
.quiz .section__title { margin-top: 6px }
.steps.highlight { animation: pulseOutline 1.1s ease-out, pulseOutline 2.2s ease-in-out infinite }
@keyframes pulseOutline {
  0%   { box-shadow: 0 0 0 0 rgba(108,140,255,.55), var(--shadow) }
  60%  { box-shadow: 0 0 0 10px rgba(108,140,255,.18), var(--shadow) }
  100% { box-shadow: 0 0 0 0 rgba(108,140,255,0), var(--shadow) }
}
.progress { display: none }
.progress__bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), #9aaeff) }
.step { padding: 4px 4px 2px }
.step__title { margin: 8px 0 14px; font-size: 18px }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap }
/* Smoothly dim profiles and emphasize quiz on arrival */
.profiles { transition: opacity .3s ease, filter .3s ease }
body.quiz-focus .profiles { opacity: .45; filter: saturate(.9); pointer-events: none }
body.quiz-focus .quiz .steps { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(108,140,255,.16), var(--shadow) }
body.quiz-focus .quiz .section__title { text-shadow: 0 2px 24px rgba(108,140,255,.25) }
.step .btn-row .btn { flex: 1 1 0 } /* make primary/secondary buttons larger and easier to hit */
.step .btn-row .btn.btn-link { flex: 0 0 auto } /* keep link buttons natural width */
.steps [hidden],
[hidden] { display: none !important }
.note { color: var(--muted) }
.pre-cta { margin-top: 10px }
.pre-confirm { margin-top: 10px }
.pre-tg { margin-top: 10px }
.pre-tg .small { margin-bottom: 21px }
.no-telegram { margin-top: 10px; background: #1b2232; border-radius: var(--radius-sm); padding: 12px; border: 1px solid rgba(255,255,255,.06) }
.no-telegram .btn-row { flex-direction: column; align-items: stretch }
.no-telegram .btn-row .btn { width: 100% }
.no-telegram .btn-row .btn.btn-link { flex: 1 1 auto }
.no-telegram #btnAlreadyHave { text-align: center }
.options { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 8px }
.option { display: flex; align-items: center; gap: 10px; background: #1b2232; padding: 12px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer }
.option:hover { border-color: rgba(255,255,255,.1) }
.option input { width: 18px; height: 18px }

.age-input input, .username-input input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid #2b3450; background: #121725; color: var(--text); font-size: 16px; outline: none }
.age-input input:focus, .username-input input:focus { border-color: var(--accent) }
.small { font-size: 12px; color: var(--muted); margin-top: 6px }
.age-input + .small { margin-top: 6px; margin-bottom: 12px }
#step-4 #finalText { margin-bottom: 12px }
.success { margin-top: 12px; background: #122416; border: 1px solid rgba(34,197,94,.35); color: #cff4d6; padding: 12px; border-radius: 10px }

.disclaimer { color: var(--muted); font-size: 12px; padding: 8px 0 16px }
.disclaimer .container { background: transparent; border: 0; border-radius: 0; padding: 0 16px }
.footer { border-top: 1px solid rgba(255,255,255,.06); background: rgba(15,17,21,.7); flex-shrink: 0 }
.footer .container { padding-left: 20px; padding-right: 20px }
.footer__row { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; gap: 14px; padding-bottom: calc(16px + env(safe-area-inset-bottom)) }
.to-top { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; background: rgba(108,140,255,.12); color: #e9ecf1; text-decoration: none; font-weight: 700; border-radius: 999px; border: 1px solid rgba(108,140,255,.26) }
.to-top::before { content: '↑'; font-size: 14px }
.to-top:hover { background: rgba(108,140,255,.2) }
.legal { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 12px }
.legal span { padding-left: 8px; border-left: 1px solid rgba(255,255,255,.1) }
.legal a { color: var(--muted) }

/* Responsive */
@media (min-width: 480px) {
  .hero { padding: 48px 0 24px }
  .grid { grid-template-columns: repeat(2, 1fr) }
}
@media (min-width: 768px) {
  .hero__title { font-size: 40px }
  .hero__subtitle { font-size: 18px }
  .grid { grid-template-columns: repeat(3, 1fr) }
  .steps { padding: 18px }
  .quiz { margin-top: 40px }
}

/* Visual divider for section separation (monotone) */
.divider { height: 2px; border-radius: 999px; background: rgba(255,255,255,.10); margin: 4px 0 8px }
/* Slightly larger gap after the quiz */
.quiz > .container > .divider:last-child { margin: 8px 0 18px }
/* Extra space below profiles grid before info blocks */
#profiles .container > .divider { margin: 16px 0 12px }
@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(4, 1fr) }
}
