/* GlebaTeam — светлая тема, стиль «модерн хайтек».
   Фирменный фиолетовый и красный сохранены из example.jpg, добавлен электрик-голубой для градиентов. */
:root {
  --bg: #f4f5fb;          /* фон страницы */
  --surface: #ffffff;     /* карточки */
  --border: #e4e6f0;      /* тонкие обводки */
  --grid: rgba(113, 50, 245, 0.06); /* техно-сетка на фоне */
  --primary: #7132f5;     /* фирменный фиолетовый */
  --accent: #00b4ff;      /* электрик-голубой */
  --danger: #f5385e;      /* фирменный красный */
  --text: #0e0f1a;
  --muted: #5b5f76;       /* второстепенный текст */

  --gradient: linear-gradient(120deg, var(--primary) 0%, var(--accent) 100%);
  --shadow: 0 1px 2px rgba(16, 18, 40, 0.04), 0 10px 30px rgba(16, 18, 40, 0.07);
  --glow: 0 8px 24px rgba(113, 50, 245, 0.28);

  --radius: 20px;
  --gap: 12px;

  --font-body: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Unbounded", var(--font-body);
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* Фон: тонкая сетка + мягкие цветные пятна сверху, сетка растворяется книзу */
body {
  min-height: 100vh;
  background:
    radial-gradient(600px 300px at 15% -5%, rgba(113, 50, 245, 0.14), transparent 70%),
    radial-gradient(500px 280px at 100% 0%, rgba(0, 180, 255, 0.12), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--bg);
  background-attachment: fixed;
}

.page {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Мелкие моноширинные подписи — «технический» акцент */
.eyebrow,
.label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #12b886;
  box-shadow: 0 0 0 0 rgba(18, 184, 134, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 7px rgba(18, 184, 134, 0); }
  100% { box-shadow: 0 0 0 0 rgba(18, 184, 134, 0); }
}

/* ---------- Приветствие ---------- */
.hero {
  padding: 8px 0 20px;
}

.hero h1 {
  margin-top: 14px;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
}

.hero-subtitle {
  margin: 10px 0 0;
  font-size: 17px;
  line-height: 1.45;
  color: var(--muted);
}

/* ---------- Карточки и текстовые блоки ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.text-block {
  margin-top: 20px;
}

.text-block .label {
  color: var(--primary);
}

.text-block h2 {
  margin: 8px 0 12px;
  font-size: 22px;
  font-weight: 600;
}

.text-block p {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
}

.photo {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 16px;
  border-radius: 14px;
}

.video-wrap {
  position: relative;
  margin-top: 16px;
}

.video-wrap .photo {
  margin-top: 0;
  aspect-ratio: 1 / 1; /* место под видео занято сразу — страница не «прыгает» при загрузке */
  object-fit: cover;
  background: #0e0f1a;
}

.sound-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(14, 15, 26, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, background 0.2s ease;
}

.sound-btn:active {
  transform: scale(0.92);
}

.sound-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-btn .icon-sound,
.sound-btn.is-on .icon-muted {
  display: none;
}

.sound-btn.is-on .icon-sound {
  display: block;
}

/* ---------- Карусель (размеры по slide.jpg: карточка 429×101, промежуток 10px, соседи выглядывают по краям) ---------- */
.carousel {
  margin: 0 -16px; /* на всю ширину экрана, поверх отступов .page */
}

.carousel-track {
  position: relative; /* offsetLeft слайдов считается от ленты */
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.slide {
  flex: 0 0 calc(100% - 52px); /* по центру; слева и справа выглядывает ~16px соседей (+10px промежуток) */
  aspect-ratio: 429 / 101;
  border-radius: 18px;
  overflow: hidden;
  scroll-snap-align: center;
  scroll-snap-stop: always; /* один свайп — один слайд */
  background: var(--surface);
  border: 1px solid var(--border);
}

.slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-stub {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.35) 100%), var(--stub);
  color: #fff;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 12px 0 4px;
}

/* Точки: активная вытягивается в градиентную «капсулу» */
.carousel-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #cfd2e2;
  cursor: pointer;
  transition: width 0.3s ease, background 0.3s ease;
}

.carousel-dot.active {
  width: 20px;
  background: var(--gradient);
}

/* ---------- Анкета ---------- */
.quiz {
  margin-top: 16px;
}

.quiz .label {
  color: var(--primary);
}

.quiz h2 {
  margin: 8px 0 6px;
  font-size: 22px;
  font-weight: 600;
}

.quiz-lead {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.quiz-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 6px;
}

.quiz-progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: #eceef6;
  overflow: hidden;
}

.quiz-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gradient);
  transition: width 0.35s ease;
}

.quiz-progress-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* Отступ — margin, а не padding: у fieldset padding-top уходит под legend */
.question {
  min-width: 0;
  margin: 26px 0 0;
  padding: 0;
  border: 0;
}

.question:first-child {
  margin-top: 20px;
}

.question legend {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-bottom: 10px;
  padding: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}

.q-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--primary);
}

.q-hint {
  flex-basis: 100%;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  font-size: 15px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.option:active {
  transform: scale(0.99);
}

/* Нативный input скрыт, но остаётся доступным с клавиатуры */
.option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check {
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid #c9ccdc;
  border-radius: 50%; /* один ответ — круг */
  transition: background 0.2s ease, border-color 0.2s ease;
}

.option input[type="checkbox"] + .check {
  border-radius: 7px; /* несколько ответов — квадрат */
}

.check svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 22;
  stroke-dashoffset: 22; /* галочка «прорисовывается» при выборе */
  transition: stroke-dashoffset 0.25s ease;
}

.option:has(input:checked) {
  border-color: var(--primary);
  background: rgba(113, 50, 245, 0.05);
  box-shadow: 0 0 0 3px rgba(113, 50, 245, 0.1);
}

.option input:checked + .check {
  border-color: transparent;
  background: var(--gradient);
}

.option input:checked + .check svg {
  stroke-dashoffset: 0;
}

.option input:focus-visible + .check {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.quiz-submit {
  margin-top: 22px;
}

/* ---------- Экран после отправки: загрузка → галочка → перенаправление ---------- */
body.locked {
  overflow: hidden;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: inherit; /* тот же фон с сеткой, что у страницы */
  background-color: var(--bg);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.overlay.visible {
  opacity: 1;
}

.panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.panel.is-hidden {
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
}

.panel-status.is-hidden {
  transform: scale(0.92);
}

.loader {
  width: 92px;
  height: 92px;
  overflow: visible;
}

.loader circle,
.loader path {
  transform-box: fill-box;
  transform-origin: center;
}

.loader-track {
  fill: none;
  stroke: #e4e6f0;
  stroke-width: 5;
  transition: opacity 0.3s ease;
}

.loader-ring {
  fill: none;
  stroke: url(#loader-gradient);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 60 214; /* дуга; длина окружности r=34 ≈ 214 */
  animation: spin 0.9s linear infinite;
  transition: stroke-dasharray 0.45s ease, stroke 0.5s ease;
}

.loader-fill {
  fill: url(#loader-gradient);
  transform: scale(0);
  transition: transform 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) 0.15s, fill 0.5s ease;
}

/* Крестик: стирается без задержки, рисуется — с задержкой (см. .is-fail) */
.loader-cross {
  fill: none;
  stroke: #fff;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  transition: stroke-dashoffset 0.3s ease;
}

.loader-check {
  fill: none;
  stroke: #fff;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  transition: stroke-dashoffset 0.4s ease 0.45s;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Результат: дуга замыкается в круг и круг заливается.
   is-done — градиент + галочка; is-fail — красный + крестик; is-offer — зелёный + галочка */
.overlay:is(.is-done, .is-fail, .is-offer) .loader-ring {
  stroke-dasharray: 214 0;
  animation-play-state: paused;
}

.overlay:is(.is-done, .is-fail, .is-offer) .loader-track {
  opacity: 0;
}

.overlay:is(.is-done, .is-fail, .is-offer) .loader-fill {
  transform: scale(1);
}

.overlay:is(.is-done, .is-offer) .loader-check {
  stroke-dashoffset: 0;
}

/* Кольцо лежит поверх заливки — красим его в тот же цвет, чтобы не было градиентной обводки */
.overlay.is-fail .loader-ring {
  stroke: var(--danger);
}

.overlay.is-offer .loader-ring {
  stroke: #12b886;
}

.overlay.is-fail .loader-fill {
  fill: var(--danger);
}

.overlay.is-fail .loader-cross {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.3s ease 0.45s;
}

.overlay.is-fail .loader-cross + .loader-cross {
  transition-delay: 0.65s;
}

/* Крестик → галочка: круг перекрашивается из красного в зелёный и слегка «подпрыгивает» */
.overlay.is-offer .loader-fill {
  fill: #12b886;
  animation: pop 0.5s ease 0.1s;
}

@keyframes pop {
  50% { transform: scale(1.1); }
}

.status-text {
  max-width: 320px;
  margin: 22px 0 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  transition: opacity 0.2s ease;
}

.status-text.is-fading {
  opacity: 0;
}

.redirect-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 24px;
  background: var(--gradient);
  box-shadow: var(--glow);
}

.redirect-icon svg {
  width: 32px;
  height: 32px;
  fill: #fff;
}

.redirect-title {
  max-width: 320px;
  margin: 24px 0 10px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
}

.redirect-text {
  max-width: 300px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.redirect-progress {
  width: 180px;
  height: 4px;
  margin: 26px 0 28px;
  border-radius: 999px;
  background: #e4e6f0;
  overflow: hidden;
}

.redirect-progress div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gradient);
}

/* Полоска заполняется за время до перехода (длительность задаёт JS) */
.overlay.is-redirect .redirect-progress div {
  width: 100%;
  transition: width var(--redirect-delay, 2.5s) linear;
}

.btn.redirect-btn {
  width: auto;
  padding: 12px 22px;
  text-decoration: none;
}

/* ---------- Кнопки ---------- */
.btn {
  display: block;
  width: 100%;
  padding: 14px 18px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
  filter: brightness(0.95);
}

.btn-primary {
  background: var(--gradient);
  box-shadow: var(--glow);
}

.btn:disabled {
  opacity: 0.4;
  box-shadow: none;
  cursor: default;
  transform: none;
}

.btn-danger {
  background: var(--danger);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
