/* Global Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Nunito Sans', ui-sans-serif, system-ui;
  background: var(--bg-primary);
  color: var(--neutral-200);
  line-height: 1.75;
}

/* CSS Variables - Design System */
:root {
  --card-ar: 2/3;
  
  /* Color Palette */
  --primary-50: #F1E9FF;
  --primary-100: #E3D3FF;
  --primary-200: #C2A9FF;
  --primary-300: #A481FF;
  --primary-400: #875DFF;
  --primary-500: #6C3BFF;
  --primary-600: #5A32E4;
  --primary-700: #4929C4;
  --primary-800: #3821A2;
  --primary-900: #291A82;
  
  --secondary-50: #FFE6F0;
  --secondary-100: #FFCFE3;
  --secondary-200: #FFA6CB;
  --secondary-300: #FF7AB2;
  --secondary-400: #FF4D99;
  --secondary-500: #FF237F;
  --secondary-600: #E01C70;
  --secondary-700: #BF165E;
  --secondary-800: #9E104D;
  --secondary-900: #7D0B3E;
  
  --neutral-50: #F9FAFB;
  --neutral-100: #F3F4F6;
  --neutral-200: #E5E7EB;
  --neutral-300: #D1D5DB;
  --neutral-400: #9CA3AF;
  --neutral-500: #6B7280;
  --neutral-600: #4B5563;
  --neutral-700: #374151;
  --neutral-800: #1F2937;
  --neutral-900: #0B0D13;
  
  --bg-primary: #0A0B0F;
  --bg-secondary: #0F1117;
  --bg-surface: #141824;
  
  /* Gradients */
  --gradient-hero: linear-gradient(135deg, #6C3BFF 0%, #FF237F 55%, #0D8BFF 100%);
  --gradient-cta: linear-gradient(90deg, #6C3BFF 0%, #FF237F 100%);
  --gradient-chip-selected: linear-gradient(90deg, rgba(108,59,255,0.25), rgba(255,35,127,0.25));
  
  /* Component Variables */
  --card-bg: #141824;
  --card-border: rgba(255,255,255,0.06);
  --card-shadow: 0 12px 32px rgba(0,0,0,0.45);
  --card-shadow-hover: 0 20px 60px rgba(0,0,0,0.6);
  --selected-border: #6C3BFF;
  --selected-shadow: rgba(108,59,255,0.35);
}

@media (min-width: 961px) {
  :root { --card-ar: 3/4; }
}

/* Viewport Container */
.viewport {
  height: 100dvh;
  width: 100vw;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg-primary);
}

@supports (height: 100svh) {
  .viewport {
    height: 100svh;
  }
}

/* Header Styles - Design System */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
  padding: 0 32px;
  background: rgba(10, 11, 15, 0.6);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: 'Raleway', ui-sans-serif, system-ui;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #FFFFFF;
}

.logo img {
  height: 32px;
  filter: brightness(1.2);
}

.sign-up {
  background: var(--gradient-cta);
  color: #FFFFFF;
  border: none;
  padding: 0 24px;
  min-height: 52px;
  font-family: 'Nunito Sans', ui-sans-serif, system-ui;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
}

.sign-up:hover {
  filter: brightness(1.06);
}

.sign-up:active {
  filter: brightness(0.95);
  transform: translateY(1px);
}

.sign-up:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(108,59,255,0.45);
}

/* Main Content */
main {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.quiz-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 2vh, 24px) clamp(16px, 3vw, 32px);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Title and Progress - Design System */
h1 {
  font-family: 'Raleway', ui-sans-serif, system-ui;
  font-size: clamp(36px, 6vh, 60px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  margin-bottom: clamp(16px, 2vh, 24px);
  text-align: center;
}

.progress-container {
  display: grid;
  gap: 8px;
  align-content: start;
  margin-bottom: clamp(16px, 2vh, 24px);
}

.progress-text {
  font-family: 'Nunito Sans', ui-sans-serif, system-ui;
  font-size: clamp(14px, 2vh, 16px);
  font-weight: 600;
  color: var(--primary-200);
  text-align: center;
}

.progress-bar {
  height: 8px;
  border-radius: 9999px;
  background: var(--bg-secondary);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--gradient-cta);
  transition: width 300ms ease;
}

/* Quiz Sections */
.quiz-section {
  display: none;
}

.quiz-section.active {
  display: grid;
  grid-template-rows: auto 1fr auto; /* h2 / grid / nav */
  gap: clamp(8px, 1.5vh, 16px);
  padding: clamp(8px, 2vh, 16px) clamp(10px, 2vw, 20px);
  min-height: 0; /* Important: middle zone can shrink */
  background: var(--bg-surface);
  border-radius: 16px;
  backdrop-filter: saturate(115%) blur(2px);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
}

.quiz-section h2 {
  font-family: 'Raleway', ui-sans-serif, system-ui;
  font-size: clamp(24px, 4vh, 36px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  text-align: center;
  margin: 0;
}

/* Middle zone must shrink and prevent height overflow */
.options, .style-options, .kinks-options {
  min-height: 0;          /* Key to prevent scroll */
  padding: 0;             /* No extra internal height needed */
  align-content: stretch; /* Cells evenly occupy height */
  display: grid;
  gap: clamp(6px, 1.2vh, 12px);
}

/* Card Styles - Design System */
.card {
  position: relative;
  border-radius: 16px;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  backdrop-filter: saturate(115%) blur(2px);
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
  transition: transform 200ms cubic-bezier(0.4,0,0.2,1),
              box-shadow 200ms cubic-bezier(0.4,0,0.2,1),
              filter 200ms cubic-bezier(0.4,0,0.2,1);
  cursor: pointer;
  min-height: 44px; /* Accessibility minimum touch target */
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
}

.card input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.card.selected {
  border: 1px solid var(--primary-500);
  box-shadow: 0 0 0 3px rgba(108,59,255,0.15), 0 20px 60px rgba(0,0,0,0.6);
}

/* Kink card selection styles */
.kink-option.selected {
  border: 2px solid #FF7E55 !important;
  box-shadow: 0 0 0 3px rgba(255,126,85,0.15), 0 20px 60px rgba(0,0,0,0.6) !important;
  transform: none !important;
}

.kink-option.selected:hover {
  transform: none !important;
}

.card-media {
  position: relative;
  aspect-ratio: var(--card-ar);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.card-media video, .card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain !important;
  object-position: center;
  display: block;
  background: #000;
}

.card-caption {
  padding: clamp(6px, 1.2vh, 8px) clamp(8px, 1.6vh, 10px);
  font-family: 'Nunito Sans', ui-sans-serif, system-ui;
  font-size: clamp(11px, 1.6vh, 13px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--neutral-200);
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Unified caption style - overlay on video with gradient */
.card-caption{
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  padding: 12px 14px;
  background: linear-gradient(to top, rgba(0,0,0,.65), rgba(0,0,0,0));
  color: #fff;
  font-weight: 800;
  font-size: clamp(16px, 2.6vh, 23px);
  line-height: 1.1;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* Navigation Buttons */
.nav-buttons {
  display: grid;
  grid-auto-flow: column;
  gap: 8px;
  align-items: center;
  grid-template-columns: 1fr 1fr;
  margin-top: 0;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  padding: 0 20px;
  min-height: 44px;
  font-family: 'Nunito Sans', ui-sans-serif, system-ui;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  transition: all 200ms cubic-bezier(0.4,0,0.2,1);
  cursor: pointer;
}

.nav-btn.prev {
  background-color: #1A1F2D;
  color: var(--neutral-200);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.nav-btn.prev:hover {
  background-color: #202639;
}

.nav-btn.prev:active {
  background-color: #1A2031;
  transform: translateY(1px);
}

.nav-btn.next {
  background: var(--gradient-cta);
  color: #FFFFFF;
  border: none;
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
}

.nav-btn.next:hover {
  filter: brightness(1.06);
}

.nav-btn.next:active {
  filter: brightness(0.95);
  transform: translateY(1px);
}

.nav-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(108,59,255,0.45);
}

.nav-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Summary Section - Design System */
#summary {
  background: var(--bg-surface);
  border: 1px solid rgba(108,59,255,0.35);
  box-shadow: 0 0 0 3px rgba(108,59,255,0.15), 0 12px 32px rgba(0,0,0,0.45);
}

.character-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: clamp(12px, 2vh, 20px);
  margin: clamp(16px, 2vh, 24px) 0;
  text-align: left;
}

.summary-item {
  padding: clamp(12px, 2vh, 16px);
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
}

.summary-item strong {
  color: var(--primary-200);
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

/* Footer - Design System */
footer {
  text-align: center;
  padding: clamp(16px, 2vh, 24px);
  background: var(--bg-primary);
  border-top: 1px solid rgba(255,255,255,0.06);
}

footer p {
  font-family: 'Nunito Sans', ui-sans-serif, system-ui;
  font-size: clamp(12px, 1.8vh, 14px);
  color: var(--neutral-500);
  line-height: 1.6;
}

/* Success Popup Styles - Design System */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 300ms ease;
}

.popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

.popup {
  background: var(--bg-surface);
  padding: clamp(24px, 4vh, 40px);
  border-radius: 16px;
  text-align: center;
  border: 1px solid rgba(108,59,255,0.35);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
  backdrop-filter: saturate(115%) blur(2px);
  transform: scale(0.8);
  transition: transform 300ms ease;
  margin: clamp(16px, 3vh, 24px);
  max-width: 90vw;
}

.popup-overlay.active .popup {
  transform: scale(1);
}

.popup h3 {
  font-family: 'Raleway', ui-sans-serif, system-ui;
  font-size: clamp(24px, 4vh, 36px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  margin-bottom: clamp(12px, 2vh, 20px);
}

.popup p {
  font-family: 'Nunito Sans', ui-sans-serif, system-ui;
  font-size: clamp(14px, 2vh, 18px);
  font-weight: 400;
  line-height: 1.75;
  color: var(--neutral-200);
  margin-bottom: clamp(16px, 2vh, 24px);
}

.popup-btn {
  background: var(--gradient-cta);
  color: #FFFFFF;
  border: none;
  padding: 0 24px;
  min-height: 52px;
  font-family: 'Nunito Sans', ui-sans-serif, system-ui;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
}

.popup-btn:hover {
  filter: brightness(1.06);
}

.popup-btn:active {
  filter: brightness(0.95);
  transform: translateY(1px);
}

/* Animations */
@keyframes fadeIn {
  from {
  opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Responsiveness */
@media (max-width: 960px) {
  :root {
    --card-ar: 2/3;
  }
}

@media (max-width: 640px) {
  .quiz-section h2 {
    font-size: clamp(16px, 2.2vh, 22px);
  }
  
  .card-caption {
    font-size: 12px;
  }
  
  .nav-buttons {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, rgba(11, 11, 15, 0.95), transparent);
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    margin-top: clamp(8px, 1vh, 12px);
  }
  
  .options, .style-options, .kinks-options {
    padding-bottom: 0 !important; /* Remove mobile sticky-nav padding */
  }
  
}

/* Focus and Accessibility - Design System */
.card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(108,59,255,0.45);
}

.nav-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(108,59,255,0.45);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --card-border: rgba(255,255,255,0.2);
    --selected-border: #FFFFFF;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Сетка по умолчанию, чтобы до инициализации JS не было «одной гигантской карточки» */
.style-options,
.options,
.kinks-options {
  display: grid;
  gap: clamp(6px, 1.2vh, 12px);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* <= безопасный дефолт */
  align-content: stretch;
  min-height: 0;
}

/* ВКЛЮЧАЕТ внутренний скролл у сетки, когда высоты не хватает */
.style-options.scrollable,
.options.scrollable,
.kinks-options.scrollable{
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Минимальная ширина карточки как последний рубеж безопасности */
.card{
  min-width: 120px; /* чтобы даже при ошибке в JS не было 1px */
}

/* Масштабируемая сетка */
.grid-scale {
  transform-origin: top center;
  transform: scale(var(--grid-scale, 1));
  will-change: transform;
}

/* Когда высоты мало и мы упёрлись в минимальный масштаб — включаем внутренний скролл */
.grid-scale.scrollable {
  overflow: auto;
}


/* Глушилка анимаций на время пересчёта (вкл/выкл в JS) */
.no-anim, .no-anim * {
  transition: none !important;
  animation: none !important;
}

/* Карточка не должна «раздувать» строку */
.card { min-height: 0; }
.card-media { aspect-ratio: var(--card-ar, 2/3); }

/* === Header as grid: logo | title | cta === */
header{
  display: grid !important;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(8px, 2vw, 24px);
  /* вместо фиксированной высоты используем минимальную:
     заголовок может переноситься на 2 строки и хедер увеличится */
  min-height: 64px;
  height: auto; /* переопределяем текущее height:64px */
  padding: 0 clamp(16px, 3vw, 32px);
}

/* На мобильных - заголовок под логотипом и кнопкой */
@media (max-width: 640px){
  header{
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: clamp(8px, 1.5vh, 12px);
    padding: clamp(8px, 1.5vh, 12px) clamp(16px, 3vw, 32px);
  }
  
  /* Верхняя строка: логотип и кнопка */
  .logo{
    grid-row: 1;
    grid-column: 1;
    justify-self: start;
  }
  
  .sign-up{
    grid-row: 1;
    grid-column: 2;
    justify-self: end;
  }
  
  /* Заголовок внизу на всю ширину */
  .header-title{
    grid-row: 2;
    grid-column: 1 / -1; /* занимает обе колонки */
    justify-self: center;
    margin-top: clamp(4px, 1vh, 8px);
  }
}

/* Центрированный адаптивный заголовок */
.header-title{
  justify-self: center;
  text-align: center;
  font-family: 'Raleway', ui-sans-serif, system-ui;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  /* плавный масштаб на всех экранах */
  font-size: clamp(18px, 2.6vh, 28px);
  color: #fff;
  /* ограничиваем ширину, чтобы не наползала на кнопку справа */
  max-width: min(70ch, 70vw);
  /* аккуратные переносы на 2 строки максимум */
  overflow-wrap: break-word;
  word-wrap: break-word;
  white-space: normal;
  margin: 0;
}

/* На десктопе заголовок остается в центре между логотипом и кнопкой */
@media (min-width: 641px){
  .header-title{
    grid-column: 2;
  }
}

/* Лого и кнопка остаются по краям */
.logo{ justify-self: start; }
.sign-up{ justify-self: end; }

/* Дополнительные мобильные стили для заголовка */
@media (max-width: 640px){
  .header-title{
    font-size: clamp(32px, 4.4vh, 40px); /* в 2 раза больше */
    max-width: 100%; /* теперь заголовок может занимать всю ширину */
    line-height: 1.1;
    white-space: normal;
    word-break: break-word;
    hyphens: auto;
  }
}

/* Так как хедер стал выше на маленьких экранах — нижняя часть должна корректно вписываться */
.viewport{
  grid-template-rows: auto 1fr auto; /* уже есть, оставляем для ясности */
}

/* Фиксированные строки для «идеальной сетки» (без растягивания одной карточки) */
.fixed-rows {
  /* говорим гриду, что высота строк фиксируется инлайном из JS */
  display: grid;
}
.fixed-rows .card {
  /* две строки: медиа фиксированной высоты + подпись */
  grid-template-rows: var(--media-h) auto;
}
.fixed-rows .card-media {
  height: var(--media-h);
  /* при фиксированной высоте aspect-ratio не нужен */
    aspect-ratio: auto;
  }
  
/* Контейнер квиза должен раздавать 1fr под АКТИВНЫЙ шаг */
.quiz-container{
  display:grid;                      /* было flex → теперь grid */
  grid-template-rows:auto auto 1fr;  /* h1 / progress / section-area */
  min-height:0;                      /* обязательно, иначе «вытягивает» */
}

/* Активный шаг занимает всю выделенную область */
.quiz-section.active{
  height:100%;       /* ключ: теперь getBoundingClientRect даст реальную высоту */
  min-height:0;
}

/* Сетка до инициализации JS — НЕ растягиваем карточку на всю строку */
.style-options,
.options{
  grid-template-columns: repeat(2, 1fr); /* безопасный дефолт, пока не посчитали */
  grid-auto-rows: 1fr;                   /* клетки изначально одинаковые */
}

/* Kinks: сетка 3+2 (3 в первой строке, 2 во второй) */
.kinks-options{
  grid-template-columns: repeat(3, max-content); /* колонки по содержимому, как в JS */
  grid-template-rows: repeat(2, 1fr);            /* 2 строки */
  gap: clamp(6px, 1.2vh, 12px);                  /* общий gap как у всех шагов */
  justify-content: center;                        /* центрируем всю группу колонок */
  justify-items: center;                          /* каждая карточка центрируется в своём треке */
}

/* === Kinks: доверяем автоскейлеру, убираем хардкод ширины === */
.kinks-options .card{
  width: var(--card-w) !important; /* вместо clamp(...) - используем ширину от JS */
}


/* На очень узких экранах (430px и меньше) - тоже только var(--card-w) */
@media (max-width: 430px){
  .kinks-options .card{
    width: var(--card-w) !important; /* используем ширину от JS */
  }
  
  /* Исправляем ::after для card-caption на узких экранах */
  .kinks-options .card-caption::after{
    height: clamp(40px, 20%, 80px) !important; /* меньше высота градиента */
  }
}

/* На десктопе дефолтом позволим 3 колонки (JS всё равно переопределит) */
@media (min-width: 961px){
  .style-options,
  .options{
    grid-template-columns: repeat(3, 1fr);
  }
  /* Kinks на десктопе тоже использует max-content */
  .kinks-options{
    grid-template-columns: repeat(3, max-content);
  }
}

/* Режим фиксированных строк, которым управляет JS */
.fixed-rows{ 
  /* только маркер */
  display: grid;
}
.fixed-rows .card{
  grid-template-rows: var(--media-h) auto; /* медиа фикс высоты + подпись */
}
.fixed-rows .card-media{
  height: var(--media-h);
  aspect-ratio: auto; /* при фикс-высоте аспект уже не нужен */
}

/* === No-crop video: contain instead of cover === */
.card-media {
  /* контейнер управляется через переменную --card-ar (зададим из JS для каждого видео) */
  aspect-ratio: var(--card-ar, 9/16) !important; /* дефолт 9:16 */
  background: #000; /* безопасный фон для «письма» */
}

/* КЛЮЧ: не обрезаем видео */
.card-media video, .card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain !important;   /* было cover → теперь contain */
  object-position: center;
  display: block;
}

/* Оверлей подписи остаётся внутри, но делаем его компактнее,
   чтобы меньше «съедал» высоту строки */
.card-caption {
  padding: 6px 10px !important;
  font-size: 12px !important;
  line-height: 1.15;
  background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
}

/* --- Center clusters in each row --- */
.style-options,
.options,
.kinks-options{
  justify-content: center;   /* центрируем всю группу колонок */
  justify-items: center;     /* каждая карточка центрируется в своём треке */
}


/* Ширина карточки задаётся из JS (по высоте медиа и AR) */
.card{
  width: var(--card-w, auto);
}

/* На фикс-строках медиавысота уже задана; содержимое по центру */
.fixed-rows .card-media{
  display: grid;
  place-items: center;
}

/* === [3] Шаг = 3 строки: title / grid / nav; навигация не накладывается === */
.quiz-section.active{
  display: grid !important;
  grid-template-rows: auto minmax(0,1fr) auto !important; /* середина может сжиматься */
  height: 100% !important;
  min-height: 0 !important;
}

/* Сетка карточек: сжимаемая серединка, без «вытягивания» */
.style-options, .options, .kinks-options{
  min-height: 0 !important;
  align-content: stretch !important;
}

/* Кнопки навигации всегда в своей третьей строке, без sticky/absolute */
.nav-buttons{
  position: static !important;
  margin-top: clamp(8px,1vh,12px);
  z-index: 0;
}

/* === [4] Убираем фон у активной секции === */
.quiz-section.active{
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

/* === [5] Бренд-цвет → оранжевый FF7E55 === */
:root{
  --brand: #FF7E55;
  --brand-weak: rgba(255,126,85,0.35);
  --brand-weak-2: rgba(255,126,85,0.15);
  --gradient-cta: linear-gradient(90deg, #FF7E55 0%, #FF7E55 100%);
}

/* Кнопка Next / CTA / прогресс */
.nav-btn.next,
.popup-btn,
.progress-fill{
  background: var(--gradient-cta) !important;
  border: 0 !important;
}
.nav-btn:hover{
  filter: brightness(1.05);
}
.card.selected{
  border: 1px solid var(--brand) !important;
  box-shadow: 0 0 0 3px var(--brand-weak-2), 0 20px 60px rgba(0,0,0,0.6) !important;
}
.nav-btn:focus-visible,
.card:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-weak) !important;
}

/* === [6] Подписи внутри карточки, поверх видео === */
.card{ display: grid; grid-template-rows: 1fr; overflow: hidden; }
.card-media{ position: relative; }
.card-caption{
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px 10px;
  background: linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,0));
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.15;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;            /* клик проходит к видео/инпуту */
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Видео остаётся без обрезки (если уже сделали contain) — оставляем как есть */
.card-media video{
  display: block;
}

/* --- On-video captions overlay --- */
.card{ display:grid; grid-template-rows: 1fr; overflow:hidden; }

.card-media{
  position: relative;
}

/* Ключ: подпись строго поверх видео, не влияет на расклад */
.card-caption{
  position: absolute !important;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  display: block;
  padding: 12px 14px; /* немного больше паддинги под крупный текст */
  /* 2× от прежнего ~14px → 28px, с адаптивом */
  font-weight: 800;
  font-size: clamp(16px, 2.6vh, 23px) !important;
  line-height: 1.1;
  color: #fff;
  white-space: normal; /* разрешаем перенос слов */
  word-wrap: break-word; /* перенос длинных слов */
  overflow-wrap: break-word; /* современный аналог word-wrap */
  hyphens: auto; /* автоматические переносы */
  pointer-events: none; /* клики проходят к input/label */
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* Градиентный фон под подписью: чёрный → прозрачный */
.card-media::after{
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: clamp(60px, 25%, 120px); /* больше высота для многострочного текста */
  z-index: 1;
  background: linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0));
}

/* На очень узких экранах чуть компактнее, но всё равно крупно */
@media (max-width: 420px){
  .card-caption{
    font-size: clamp(12px, 2vh, 16px) !important;
    padding: 10px 12px;
  }
}

/* Страховка: видео остаётся под оверлеем и не обрезается (если уже включён contain) */
.card-media video{
  position: relative;
  z-index: 0;
}

/* --- FIX: remove empty bottom row in cards --- */
.card {
  display: grid;
  grid-template-rows: 1fr !important; /* только одна строка */
  overflow: hidden;
}

/* Медиа занимает всю карточку */
.card-media {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Подпись остаётся оверлеем поверх видео */
.card-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  padding: 12px 14px;
  font-size: clamp(16px, 2.6vh, 23px);
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  background: linear-gradient(to top, rgba(0,0,0,0.65), transparent);
  pointer-events: none;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Уменьшенный шрифт для card-caption на очень узких экранах (325-375px) */
@media (min-width: 320px) and (max-width: 375px){
  .card-caption{
    font-size: clamp(6px, 1.6vh, 13px) !important; /* уменьшаем на 1px от базового */
  }
}

/* Padding 6px и уменьшенный шрифт для card-caption на узких экранах (375-425px) */
@media (min-width: 375px) and (max-width: 425px){
  .card-caption{
    padding: 6px !important; /* 6px по всем краям */
    font-size: clamp(10px, 2.0vh, 17px) !important; /* уменьшаем на 1px: 16→15, 2.6→2.5, 23→22 */
  }
}

/* Уменьшаем шрифт на карточках для средних разрешений (426-768px) */
@media (min-width: 426px) and (max-width: 768px){
  .card-caption{
    font-size: clamp(9px, 1.7vh, 15px) !important; /* уменьшаем на ~15% */
    padding: 10px 12px !important; /* немного меньше padding */
  }
}

/* Градиент под текст остаётся */
.card-media::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: clamp(60px, 25%, 120px);
  z-index: 1;
  background: linear-gradient(to top, rgba(0,0,0,0.65), transparent);
}

/* Неактивные секции всегда скрыты (страховка) */
.quiz-section:not(.active){
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* --- Summary как карточный шаг, ТОЛЬКО когда он активен --- */
#summary.active{
  display: grid !important;
  grid-template-rows: auto minmax(0,1fr) auto !important; /* h2 / контент / nav */
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Внутренняя сетка контента Summary (влезает без скролла) */
#summary.active .summary-layout{
  display: grid;
  grid-template-columns: 1fr 1fr; /* равные колонки для видео и текста */
  gap: clamp(12px, 2vh, 20px);
  min-height: 0;
  align-items: start; /* выравнивание по верху */
}
@media (max-width: 960px){
  #summary.active .summary-layout{ 
    grid-template-columns: 1fr;
    gap: clamp(8px, 1.5vh, 12px);
  }
}

/* Сетка превью-видео выбранных пунктов (только в активном Summary) */
#summary.active .summary-media-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  grid-auto-rows: clamp(100px, 20vh, 160px); /* фикс высоты рядов -> без прокрутки */
  gap: clamp(6px, 1.2vh, 10px);
  align-content: start;
  min-height: 0;
  margin-bottom: clamp(12px, 2vh, 16px);
}

/* Мобильная адаптация для превью-видео */
@media (max-width: 640px) {
  #summary.active .summary-media-grid{
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    grid-auto-rows: clamp(90px, 18vh, 140px);
    gap: clamp(4px, 1vh, 8px);
  }
}

#summary.active .summary-thumb{
  display: grid;
  grid-template-rows: 1fr auto;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  background: #0f1117;
  position: relative;
  aspect-ratio: var(--card-ar, 9/16); /* используем тот же aspect-ratio что и на других шагах */
}
#summary.active .summary-thumb video{
  width: 100%; 
  height: 100%;
  object-fit: cover; /* как на других шагах - с обрезкой для заполнения */
  background: #000;
  display: block;
}
#summary.active .summary-thumb .label{
  padding: 6px 8px;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  background: rgba(0,0,0,.6);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Мобильная адаптация для лейблов */
@media (max-width: 640px) {
  #summary.active .summary-thumb .label{
    font-size: 11px;
    padding: 4px 6px;
  }
}

/* Текстовый столбец Summary не выталкивает вниз */
#summary.active .character-summary{
  min-height: 0;
  overflow: hidden;
}

/* Summary items стилизация */
#summary.active .summary-item{
  background: rgba(0,0,0,0.2);
  padding: clamp(6px, 1vh, 8px) clamp(8px, 1.5vw, 12px);
  border-radius: 8px;
  margin-bottom: 0;
  border: 1px solid rgba(255,255,255,0.1);
}

/* Общая мобильная адаптация для Summary */
@media (max-width: 640px) {
  #summary.active {
    padding: clamp(8px, 1.5vh, 12px) clamp(12px, 3vw, 16px) !important;
  }
  
  #summary.active h2 {
    font-size: clamp(18px, 2.5vh, 22px) !important;
    margin-bottom: clamp(6px, 1vh, 8px) !important;
  }
  
  #summary.active p {
    font-size: clamp(14px, 2vh, 16px) !important;
    margin-bottom: clamp(8px, 1.5vh, 12px) !important;
  }
  
  #summary.active .character-summary {
    font-size: 14px;
  }
  
  #summary.active .summary-item {
    margin-bottom: 0;
    padding: clamp(4px, 0.8vh, 6px) 0;
  }
  
  #summary.active .summary-item strong {
    font-size: 13px;
  }
  
  #summary.active .summary-item span {
    font-size: 13px;
  }
}

/* === SUMMARY: стек из двух зон (влезает в экран) === */
#summary.active .summary-stack{
  display: grid;
  grid-template-rows: auto 1fr;      /* сверху превью-видео, ниже summary-item */
  row-gap: clamp(12px, 2vh, 20px);
  min-height: 0;
}

/* --- Верхняя сетка превью-видео --- */
/* Десктоп: 1 строка из 4 карточек */
#summary.active .summary-media-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(120px, 22vh);   /* фикс высоты ряда, чтобы всё влезало */
  gap: clamp(8px, 1.6vh, 12px);
  align-content: start;
  min-height: 0;
}

/* На низких разрешениях: 2 строки по 2 карточки */
@media (max-width: 960px){
  #summary.active .summary-media-grid{
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(110px, 20vh);
  }
}

#summary.active .summary-thumb{
  display: grid;
  grid-template-rows: 1fr auto;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  background: #0f1117;
}
#summary.active .summary-thumb video{
  width: 100%; height: 100%;
  object-fit: contain;                 /* не режем видео */
  background: #000; display: block;
}
#summary.active .summary-thumb .label{
  padding: 8px 10px;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  background: rgba(0,0,0,.35);
}

/* --- Нижняя сетка: summary-item --- */
/* Десктоп: 2 строки по 3 карточки (итого 6) */
#summary.active #character-summary{
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(90px, 1fr);
  gap: clamp(12px, 2vh, 16px) !important;
  margin: 0 !important;
  min-height: 0;
}

/* На низких разрешениях: 3 строки по 2 карточки */
@media (max-width: 960px){
  #summary.active #character-summary{
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(80px, 1fr);
  }
}

#summary.active .summary-item{
  padding: 6px 8px;
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  display: grid;
  align-content: start;
  min-height: 0;
  overflow: hidden;
  margin: 0;
}

/* Навигация — никогда не перекрывает контент */
#summary.active .nav-buttons{
  position: relative;
  z-index: 2;
  margin-top: clamp(10px, 1.6vh, 16px) !important;
}

/* ===== SUMMARY (только когда активен) — всё влезает и не накладывается ===== */
#summary.active{
  display: grid !important;
  grid-template-rows: auto minmax(0,1fr) auto !important; /* h2 / content / nav */
  gap: clamp(10px, 1.6vh, 16px);
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Контент делим на 2 строки: верх-видео, низ-айтемы. Используем фракции,
   но с жёстким минимумом высоты у каждого блока, чтобы ничего не лезло друг на друга */
#summary.active .summary-stack{
  display: grid;
  grid-template-rows:
    minmax(140px, 0.40fr)  /* верх — не ниже 140px на десктопе */
    minmax(180px, 0.60fr); /* низ — не ниже 180px на десктопе */
  row-gap: clamp(10px, 1.6vh, 16px);
  min-height: 0;
}
@media (max-width: 960px){
  #summary.active .summary-stack{
    grid-template-rows:
      minmax(140px, 0.46fr)
      minmax(200px, 0.54fr);
  }
}

/* ===== ВЕРХ: 4 превью в ряд (2×2 на узких), БЕЗ наложений ===== */
#summary.active .summary-media-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;          /* плитки делят высоту строки поровну */
  gap: clamp(8px, 1.4vh, 12px);
  align-content: stretch;
    justify-items: center;
  min-height: 0;
}
@media (max-width: 960px){
  #summary.active .summary-media-grid{
    grid-template-columns: repeat(2, 1fr); /* 2×2 */
  }
}

/* Каждая плитка — явная рамка, видео вписывается, НИЧЕГО абсолютного */
#summary.active .summary-thumb{
  display: grid;
  grid-template-rows: 1fr auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: #0f1117;
}
#summary.active .summary-thumb video{
  min-height: 0; min-width: 0;
  width: 100%; height: 100%;
  max-width: 100%; max-height: 100%;
  object-fit: contain; /* НИЧЕГО не режем */
  display: block;
  background: #000;
}
#summary.active .summary-thumb .label{
  padding: 6px 8px;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  background: rgba(0,0,0,.35);
}

/* ===== НИЗ: summary-item — 2 строки × 3 (десктоп) / 3 строки × 2 (мобайл) ===== */
#summary.active #character-summary{
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  /* ВАЖНО: равновысокие строки, чтобы всё равномерно влезло */
  grid-auto-rows: 1fr;
  gap: clamp(8px, 1.4vh, 12px) !important;
  margin: 0 !important;
  min-height: 0;
  align-content: stretch;
  justify-items: stretch;
}
@media (max-width: 960px){
  #summary.active #character-summary{
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Содержимое карточки — 2 строки текста максимум, без обрезаний сверху/снизу */
#summary.active .summary-item{
  display: grid;
  grid-template-rows: auto 1fr; /* заголовок + содержимое */
  min-height: 0;                /* позволяет ужиматься по высоте */
  overflow: hidden;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
}
#summary.active .summary-item strong{
  color: var(--brand);
  margin-bottom: 4px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#summary.active .summary-item span{
  min-height: 0;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;   /* показываем до 2 строк */
  line-clamp: 2;           /* стандартное свойство для совместимости */
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* На Summary выключаем любой sticky/absolute у навигации */
#summary.active .nav-buttons{
  position: static !important;
  margin-top: clamp(8px, 1.2vh, 12px) !important;
}

/* ==== SUMMARY: sandbox / cleanup / predictable layout (только когда активен) ==== */
#summary.active{
  /* изоляция слоя: всё внутри живёт в отдельном стек-контексте */
  isolation: isolate;
  position: relative;
  z-index: 0;

  display: grid !important;
  grid-template-rows: auto minmax(0,1fr) auto !important; /* h2 / content / nav */
  gap: clamp(10px, 1.6vh, 16px);
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

/* 1) отключаем любые «прилипшие» навигации и тени внутри Summary */
#summary.active .nav-buttons{
  position: static !important;
  z-index: 1; /* кнопки над контентом, но не перекрывают его, т.к. свой ряд */
  margin-top: clamp(8px, 1.2vh, 12px) !important;
  background: none !important;
  padding-bottom: 0 !important;
}

/* 2) sandbox для контентной части: ничего не должно выпадать за строки */
#summary.active .summary-stack{
  display: grid;
  grid-template-rows: minmax(140px, 0.42fr) minmax(200px, 0.58fr); /* desktop доли */
  row-gap: clamp(10px, 1.6vh, 16px);
  min-height: 0;       /* критично: даём гриду сжиматься */
  overflow: hidden;    /* ничего не «вытекает» */
  position: relative;
  z-index: 0;
}
@media (max-width: 960px){
  #summary.active .summary-stack{
    grid-template-rows: minmax(140px, 0.48fr) minmax(220px, 0.52fr); /* mobile доли */
  }
}

/* 3) верх: превью-видео — чистый grid, без абсолютов */
#summary.active .summary-media-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);   /* 1 строка × 4 */
  grid-auto-rows: 1fr;
  gap: clamp(8px, 1.4vh, 12px);
  min-height: 0;
  align-content: stretch;
    justify-items: center;
  position: relative;
  z-index: 0;
  overflow: hidden;     /* ничего не налезает вниз */
}
@media (max-width: 960px){
  #summary.active .summary-media-grid{
    grid-template-columns: repeat(2, 1fr); /* 2×2 */
  }
}

/* плитка превью — без абсолютов и без z-index */
#summary.active .summary-thumb{
  display: grid;
  grid-template-rows: 1fr auto;
  width: 100%;
  min-height: 0; overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: #0f1117;
}
#summary.active .summary-thumb video{
  width: 100%; height: 100%;
  max-width: 100%; max-height: 100%;
  object-fit: contain;        /* без обрезки */
  display: block;
  background: #000;
}
#summary.active .summary-thumb .label{
  padding: 6px 8px;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  background: rgba(0,0,0,.35);
  line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 4) низ: summary-item — 2 строки × 3 (desktop) / 3×2 (mobile) */
#summary.active #character-summary{
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;                 /* равновысокие строки */
  gap: clamp(8px, 1.4vh, 12px) !important;
  margin: 0 !important;
  min-height: 0;
  align-content: stretch;
  justify-items: stretch;
  position: relative;
  z-index: 0;
}
@media (max-width: 960px){
  #summary.active #character-summary{
    grid-template-columns: repeat(2, 1fr);
  }
}

/* карточки summary: допускаем 2 строки текста и убираем наложения */
#summary.active .summary-item{
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  overflow: hidden;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
}
#summary.active .summary-item strong{
  color: var(--brand);
  margin-bottom: 4px;
  line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#summary.active .summary-item span{
  min-height: 0;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;         /* до двух строк */
  line-clamp: 2;                 /* стандартное свойство для совместимости */
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* 5) страховки от «просачивания» чужих правил внутрь Summary */
#summary.active .summary-media-grid *,
#summary.active #character-summary *{
  position: static !important;    /* гасим случайные absolute */
  z-index: auto !important;       /* и сторонние z-index */
  min-width: 0; min-height: 0;    /* grid children могут сжиматься */
}

/* моб. sticky из базовых стилей отключаем в Summary */
@media (max-width: 640px){
  #summary.active .nav-buttons{
    position: static !important;
    background: none !important;
    padding-bottom: 0 !important;
  }
}

/* === Summary активен: секция = 3 строки, без прокрутки внутри === */
#summary.active{
  display:grid !important;
  grid-template-rows:auto minmax(0,1fr) auto !important; /* h2 / content / nav */
  gap: clamp(10px, 1.6vh, 16px);
  overflow:hidden; /* всё внутри вписываем масштабом */
  background:transparent !important; border:none !important; box-shadow:none !important;
}

/* Рамка, которую масштабирем */
#summary.active .summary-fit{
  /* Центрируем масштабированный контент */
  display:flex; align-items:flex-start; justify-content:center;
  /* Масштаб как CSS-переменная */
  --summary-scale: 1;
  transform: scale(var(--summary-scale));
  transform-origin: top center;        /* сжимается к верху */
  /* Чтобы интерактивность оставалась нормальной на scale<1 */
  width: max-content; height: max-content;
  margin: 0 auto;
}

/* Натуральный контент (без абсолютов, без z-index) */
#summary.active .summary-content{
  display:grid;
  grid-template-rows:auto auto;        /* верх: превью, низ: итемы */
  row-gap: clamp(12px, 2vh, 20px);
  position:relative; z-index:0; min-height:0;
}

/* ===== Верх: превью-видео (динамично, но без наложений) ===== */
#summary.active .summary-media-grid{
  display:grid;
  gap: clamp(8px, 1.4vh, 12px);
  grid-template-columns: repeat(4, minmax(120px, 1fr)); /* desktop дефолт */
}
@media (max-width: 960px){
  #summary.active .summary-media-grid{
    grid-template-columns: repeat(2, minmax(120px, 1fr)); /* мобильный */
  }
}
#summary.active .summary-thumb{
  display:grid; grid-template-rows: 1fr auto;
  border-radius:12px; overflow:hidden;
  border:1px solid rgba(255,255,255,.08); background:#0f1117;
  width: min(19vw, 260px);              /* ограничиваем ширину превью */
}
@media (max-width: 960px){
  #summary.active .summary-thumb{ width: min(40vw, 220px); }
}

/* Видеорамка 9:16 (или своя) с no-crop */
#summary.active .summary-thumb .frame{
  aspect-ratio: 9/16; background:#000; display:flex; align-items:center; justify-content:center;
}
#summary.active .summary-thumb video{
  width:100%; height:100%; object-fit:contain; display:block;
}
#summary.active .summary-thumb .label{
  padding: 6px 8px; font-weight:700; font-size:13px; color:#fff; background:rgba(0,0,0,.35);
}

/* ===== Низ: summary-item — без наложений, 2 строки × 3 / 3×2 ===== */
#summary.active #character-summary{
  display:grid !important;
  gap: clamp(10px, 1.6vh, 16px) !important;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}
@media (max-width: 960px){
  #summary.active #character-summary{
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

#summary.active .summary-item{
  display:grid; grid-template-rows:auto 1fr;
  align-content:start; min-height:0; overflow:hidden;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius:12px;
}
#summary.active .summary-item strong{
  color: var(--brand); margin-bottom:4px; line-height:1.2;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
#summary.active .summary-item span{
  min-height:0; line-height:1.25; overflow:hidden;
  display:-webkit-box; -webkit-line-clamp:2; line-clamp:2; -webkit-box-orient:vertical; word-break:break-word;
}

/* Кнопки – отдельной строкой, не липкие */
#summary.active .nav-buttons{ position:static !important; margin-top: clamp(8px,1.2vh,12px) !important; }

/* Страховка: внутри не допускаем абсолютов и внешних z-index */
#summary.active .summary-content *{ position:static !important; z-index:auto !important; min-width:0; min-height:0; }

/* 1) Спрятать подписи-лейблы под видео на шаге Summary */
#summary.active .summary-thumb .label{
  display: none !important;
}

/* 2) Центрирование масштабируемого блока на 320–380px и вообще без горизонтального скролла */
#summary.active{
  overflow: hidden;                    /* не даём уехать за край */
}
#summary.active .summary-fit{
  width: 100% !important;              /* вместо max-content */
  display: grid !important;
  place-items: start center;           /* по центру горизонтально */
  overflow: hidden;                    /* обрезаем возможные подтеки */
  margin: 0;                           /* убираем паразитные отступы */
}

/* ВАЖНО: переносим сам transform на ВНУТРЕННИЙ блок,
   чтобы контейнер не «выпирал» по ширине на узких экранах */
#summary.active .summary-fit > .summary-content{
  display: inline-block;               /* чтобы scale не растягивал на 100% */
  transform: scale(var(--summary-scale));
  transform-origin: top center;
}

/* 3) Фиксированный не-масштабируемый зазор над кнопками */
#summary.active .summary-fit{
  margin-bottom: clamp(10px, 1.6vh, 16px);  /* отступ под контентом, не участвует в scale */
}

/* Небольшой «усушающий» предел ширины превью, чтобы они легче влезали и не налезали */
#summary.active .summary-thumb{
  width: min(40vw, 220px);             /* мобайл; на десктопе впишется масштабом */
}
@media (min-width: 961px){
  #summary.active .summary-thumb{
    width: min(19vw, 260px);
  }
}

/* На всякий случай: ни у кого внутри Summary нет абсолютов/слоёв,
   чтобы исключить наложения поверх итемов */
#summary.active .summary-content *{
  position: static !important;
  z-index: auto !important;
  min-width: 0; min-height: 0;
}

/* === SUMMARY (mobile fix): истинный scale только на .summary-content === */

/* 1) .summary-fit — контейнер во всю ширину, БЕЗ transform */
#summary.active .summary-fit{
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;

  /* центрируем внутренний блок */
  display: flex !important;
  justify-content: center !important;
  align-items: flex-start !important;

  /* гасим любой наследованный/старый scale */
  transform: none !important;
  transform-origin: initial !important;

  /* фиксированный отступ под контентом (не масштабируется) */
  margin-bottom: clamp(12px, 2vh, 20px) !important;

  /* на мобильных исключаем горизонтальный скролл */
  overflow: hidden !important;
}

/* 2) Сам масштаб применяем к ВНУТРЕННЕМУ .summary-content */
#summary.active .summary-fit > .summary-content{
  display: inline-block !important;     /* чтобы scale работал как коробка */
  transform: scale(var(--summary-scale)) !important;
  transform-origin: top center !important;
  will-change: transform;
}

/* 3) Страховки от «съезда вправо» на 320–380px */
#summary.active{
  overflow: hidden !important;
}
#summary.active .summary-content,
#summary.active .summary-media-grid,
#summary.active #character-summary{
  position: static !important;
  z-index: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

/* 4) Увеличим «воздух» над кнопками на узких */
@media (max-width: 960px){
  #summary.active .nav-buttons{
    position: static !important;
    background: none !important;
    padding-bottom: 0 !important;
    margin-top: clamp(12px, 2vh, 20px) !important; /* +зазор */
  }
}

/* 5) На всякий случай полностью скрываем подпись у превью (если вдруг осталась) */
#summary.active .summary-thumb .label{ display: none !important; }

/* === SUMMARY: динамическая сетка без transform/масштабирования === */

/* Секция: шапка / контент / навигация */
#summary.active{
  display:grid !important;
  grid-template-rows:auto minmax(0,1fr) auto !important;
  gap: clamp(10px, 1.6vh, 16px);
  overflow:hidden !important;
  background:transparent !important; border:none !important; box-shadow:none !important;
}

/* Контентный контейнер: НИКАКОГО transform */
#summary.active .summary-fit{
  width:100% !important; max-width:100% !important; min-width:0 !important;
  margin:0 !important; padding:0 !important;
  display:flex !important; justify-content:center !important; align-items:flex-start !important;
  transform:none !important; transform-origin: initial !important;
  overflow: hidden !important;
}
#summary.active .summary-fit > .summary-content{
  display:block !important;              /* убираем inline-block+scale */
  transform:none !important;
  max-width:100%;
}

/* Параметры сетки — JS будет ставить значения */
#summary.active{
  --gap: 10px;
  --tileW: 140px;        /* ширина одной видеоплитки (автоподбор JS) */
  --mediaCols: 4;
  --mediaRows: 1;        /* на мобиле будет 2 */
  --itemsCols: 3;
  --itemsRows: 2;        /* на мобиле будет 3 */
  --itemRowH: 96px;      /* высота строки summary-item (JS может поджать) */
}

/* Верх: превью-видео — без чёрных полей (cover), AR 3:4 рамка */
#summary.active .summary-media-grid{
  display:grid;
  grid-template-columns: repeat(var(--mediaCols), var(--tileW));
  grid-auto-rows: calc(var(--tileW) * 4 / 3); /* AR 3:4 → высота = W*4/3 */
  gap: var(--gap);
  justify-content:center; align-content:start;
  min-height:0;
}
#summary.active .summary-thumb{
  width: var(--tileW);
  height: calc(var(--tileW) * 4 / 3);
  border-radius: 12px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  background:#000;
  display:grid; grid-template-rows: 1fr; /* без подписи */
}
#summary.active .summary-thumb .frame{
  width:100%; height:100%;
}
#summary.active .summary-thumb video{
  width:100%; height:100%;
  object-fit: cover !important;    /* НЕТ чёрных рамок */
  object-position: center;
  display:block;
}

/* Низ: summary-item — ровные строки */
#summary.active #character-summary{
  display:grid !important;
  grid-template-columns: repeat(var(--itemsCols), 1fr);
  grid-auto-rows: var(--itemRowH);
  gap: var(--gap) !important;
  margin:0 !important;
  min-height:0; align-content:start;
}
#summary.active .summary-item{
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  display:grid; grid-template-rows:auto 1fr;
  min-height:0; overflow:hidden;
}
#summary.active .summary-item strong{
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--brand);
  margin: 0;
  display: inline;
}
#summary.active .summary-item span{
  min-height:0; line-height:1.25; overflow:hidden;
  display:-webkit-box; -webkit-line-clamp:2; line-clamp:2; -webkit-box-orient:vertical;
  word-break: break-word;
  margin: 0;
}

/* Кнопки — отдельной строкой, зазор сверху */
#summary.active .nav-buttons{
  position: static !important;
  margin-top: clamp(12px, 2vh, 20px) !important;
  background:none !important; padding-bottom:0 !important;
}

/* Мобильные колонки: 2×2 видео и 3×2 итемы */
@media (max-width: 960px){
  #summary.active{ --mediaCols: 2; --mediaRows: 2; --itemsCols: 2; --itemsRows: 3; }
}

/* Десктоп: убираем margin у summary-item */
@media (min-width: 961px){
  #summary.active .summary-item{
    margin: 0 !important;
  }
}

/* Очень узкие экраны - еще более компактные размеры */
@media (max-width: 500px){
  #summary.active{ 
    --gap: 6px;
    --tileW: 60px;
    --itemRowH: 70px;
  }
}


/* === REGWALL MODAL (EroPlay style) === */
:root{
  --brand:#FF7E55;
  --bg:#0E0F13; --bg-2:#13151B; --text:#ffffff; --muted:#A8B0C0;
  --rad:16px; --gap:16px; --shadow:0 20px 60px rgba(0,0,0,.6);
}

.regwall{ position:fixed; inset:0; display:none; z-index:9990; }
.regwall.is-open{ display:block !important; }

/* Debug: make regwall visible for testing */
.regwall{ 
  background: rgba(255,0,0,0.1); /* red tint for debugging */
}
.regwall__backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.7); backdrop-filter:saturate(110%) blur(4px); }

.regwall__dialog{
  position:fixed; z-index:1;
  width:min(960px, 92vw);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background:linear-gradient(180deg, #12141A, #0C0D11);
  border:1px solid rgba(255,255,255,.06);
  border-radius:24px;
  box-shadow: var(--shadow);
  color:var(--text);
  /* Поддержка безопасной зоны для устройств с вырезами */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow:hidden;
  max-height: 90vh;
  min-height: 500px;
}

.regwall__close{
  position:absolute; top:12px; right:12px;
  width:36px; height:36px; border-radius:999px;
  background:#1C1F27; color:#fff; border:1px solid rgba(255,255,255,.08);
  font-size:22px; line-height:1; cursor:pointer;
}
.regwall__close:hover{ filter:brightness(1.08); }

.regwall__grid{
  display:grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap:0;
}
@media (max-width: 960px){
  .regwall__grid{ grid-template-columns: 1fr; }
  .regwall__pane--visual{ display:none; }
  
  /* Скрываем постер на мобильных устройствах */
  .regwall__poster{ display: none !important; }
  
  .regwall__dialog{
    max-height: 95vh;
    min-height: 400px;
    /* Исправляем позиционирование для мобильных устройств */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Добавляем отступы от краев экрана */
    margin: 2vh 0;
  }
  
  .regwall__pane{
    min-height: 400px;
  }
  
  /* На мобиле офферы показываем под формой */
  .regwall__offers--mobile{
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 22px;
  }
  
  .regwall__offers--mobile .offers-grid{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  
  .regwall__offers--mobile .offer--featured{
    grid-column: 1 / -1;
    background: rgba(255,126,85,0.2);
    border: 1px solid rgba(255,126,85,0.4);
    padding: 18px 20px;
  }
  
  .regwall__offers--mobile .offer__title{
    line-height: 1.2;
  }
  
  .regwall__offers--mobile .offer__icon svg{
    width: 18px;
    height: 18px;
  }
  
  /* Скрываем офферы в правой панели на мобиле */
  .regwall__pane--visual .regwall__offers{
    display: none;
  }
}

@media (max-width: 436px){
  .regwall__dialog{
    width: 98vw;
    max-height: 90vh; /* Уменьшаем максимальную высоту */
    min-height: 350px;
    margin: 5vh 1vw; /* Добавляем отступы сверху и снизу */
    /* Принудительно центрируем с учетом безопасной зоны */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  .regwall__pane{
    min-height: 350px;
    padding: 12px;
  }
  
  /* Уменьшаем размеры шрифтов для узких экранов */
  .regwall__title{
    font-size: clamp(18px, 3vh, 24px);
  }
  
  .regwall__subtitle{
    font-size: clamp(12px, 2vh, 16px);
  }
  
  /* Уменьшаем отступы и размеры элементов */
  .regwall__tabs{
    gap: 16px;
    margin: 16px 0 8px;
  }
  
  .regwall__form{
    gap: 10px;
    margin-top: 12px;
  }
  
  .regwall__field input{
    padding: 12px 12px;
    font-size: 14px;
  }
  
  .regwall__primary{
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .regwall__legal{
    font-size: 11px;
  }
  
  .regwall__adult-confirmation{
    font-size: 10px;
    margin-top: 6px;
  }
  
  /* Уменьшаем размеры офферов */
  .regwall__offers--mobile .offer{
    padding: 12px 14px;
  }
  
  .regwall__offers--mobile .offer__title{
    font-size: 13px;
  }
  
  .regwall__offers--mobile .offer__icon svg{
    width: 16px;
    height: 16px;
  }
}

/* Дополнительные стили для очень узких экранов (320-375px) */
@media (max-width: 375px){
  .regwall__dialog{
    width: 99vw;
    margin: 6vh 0.5vw; /* Увеличиваем отступы для очень маленьких экранов */
    max-height: 88vh; /* Еще больше уменьшаем высоту */
    /* Принудительно центрируем */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  .regwall__pane{
    padding: 10px;
  }
  
  /* Еще больше уменьшаем шрифты */
  .regwall__title{
    font-size: clamp(16px, 2.8vh, 20px);
  }
  
  .regwall__subtitle{
    font-size: clamp(11px, 1.8vh, 14px);
  }
  
  /* Компактные отступы */
  .regwall__tabs{
    gap: 12px;
    margin: 12px 0 6px;
  }
  
  .regwall__form{
    gap: 8px;
    margin-top: 10px;
  }
  
  .regwall__field input{
    padding: 10px 10px;
    font-size: 13px;
  }
  
  .regwall__primary{
    padding: 10px 14px;
    font-size: 13px;
  }
  
  .regwall__legal{
    font-size: 10px;
  }
  
  .regwall__adult-confirmation{
    font-size: 9px;
    margin-top: 4px;
  }
  
  /* Компактные офферы */
  .regwall__offers--mobile .offer{
    padding: 10px 12px;
  }
  
  .regwall__offers--mobile .offer__title{
    font-size: 12px;
  }
  
  .regwall__offers--mobile .offer__icon svg{
    width: 14px;
    height: 14px;
  }
}

/* Дополнительная защита для экранов с малой высотой */
@media (max-height: 600px) {
  .regwall__dialog{
    max-height: 85vh;
    margin: 7vh 0;
    /* Принудительно центрируем */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  .regwall__pane{
    min-height: 300px;
    padding: 12px;
  }
  
  .regwall__title{
    font-size: clamp(18px, 3vh, 24px);
  }
  
  .regwall__subtitle{
    font-size: clamp(12px, 2vh, 16px);
  }
}

/* === КРИТИЧЕСКИ ВАЖНО: Исправление ширины для шагов 2 и 5 на узких экранах === */
/* Очень узкие экраны 320-420px - карточки должны быть значительно меньше */
@media (max-width: 420px) {
  /* Шаг 2 (ethnic-background) - 3 колонки */
  #ethnic-background .options {
    grid-template-columns: repeat(3, max-content) !important;
    justify-content: center !important;
    gap: 4px !important; /* уменьшаем gap */
  }
  
  #ethnic-background .card {
    width: 90px !important; /* сильно уменьшаем ширину */
    min-width: 90px !important;
  }
  
  /* Шаг 5 (kinks) - 3 колонки */
  #kinks .kinks-options {
    grid-template-columns: repeat(3, max-content) !important;
    justify-content: center !important;
    gap: 4px !important; /* уменьшаем gap */
  }
  
  #kinks .card {
    width: 90px !important; /* сильно уменьшаем ширину */
    min-width: 90px !important;
  }
  
  /* Уменьшаем шрифт подписей на карточках */
  .card-caption {
    font-size: 10px !important;
    padding: 4px 6px !important;
    line-height: 1.1 !important;
  }
  
  /* Уменьшаем высоту градиента под текстом */
  .card-media::after {
    height: 30px !important;
  }
}

/* Еще более узкие экраны 320-375px - еще меньше */
@media (max-width: 375px) {
  /* Шаг 2 (ethnic-background) */
  #ethnic-background .card {
    width: 80px !important;
    min-width: 80px !important;
  }
  
  /* Шаг 5 (kinks) */
  #kinks .card {
    width: 80px !important;
    min-width: 80px !important;
  }
  
  /* Еще меньше gap */
  #ethnic-background .options,
  #kinks .kinks-options {
    gap: 3px !important;
  }
  
  /* Еще меньше шрифт */
  .card-caption {
    font-size: 9px !important;
    padding: 3px 4px !important;
  }
  
  /* Еще меньше градиент */
  .card-media::after {
    height: 25px !important;
  }
}

/* === ДОПОЛНИТЕЛЬНАЯ ЗАЩИТА: принудительное ограничение ширины контейнеров === */
/* Убеждаемся, что контент не выходит за границы экрана на узких устройствах */
@media (max-width: 420px) {
  /* Ограничиваем максимальную ширину контейнеров */
  #ethnic-background .options,
  #kinks .kinks-options {
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  
  /* Дополнительная защита от переполнения */
  .quiz-section {
    overflow-x: hidden !important;
  }
  
  /* Убеждаемся, что карточки не растягиваются */
  #ethnic-background .card,
  #kinks .card {
    max-width: 90px !important;
    flex-shrink: 0 !important;
  }
}

@media (max-width: 375px) {
  #ethnic-background .card,
  #kinks .card {
    max-width: 80px !important;
  }
}

.regwall__pane{ 
  padding: clamp(18px, 3.2vh, 28px); 
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 500px;
}

.regwall__title{
  font-size: clamp(22px, 3.6vh, 34px);
  line-height:1.1; font-weight:900; letter-spacing:.02em;
}
.regwall__subtitle{
  color:#1EEE9E; font-weight:800;
  font-size: clamp(14px, 2.2vh, 18px);
  margin-top:6px;
}

.regwall__tabs{ display:flex; gap:24px; margin: 22px 0 10px; color:var(--muted); }
.regwall__tab{
  background:none; border:none; color:inherit; font-weight:700; cursor:pointer;
  padding:8px 0; position:relative;
}
.regwall__tab.is-active{ color:#fff; }
.regwall__tab.is-active::after{
  content:""; position:absolute; left:0; right:0; bottom:-6px; height:2px; border-radius:2px;
  background:#fff;
}

.regwall__form{ display:grid; gap:12px; margin-top:16px; }
.regwall__or{ display:flex; align-items:center; gap:12px; color:var(--muted); margin:4px 0 8px; }
.regwall__or::before,.regwall__or::after{ content:""; flex:1; height:1px; background:rgba(255,255,255,.08); }

.regwall__field{ display:grid; gap:6px; }
.regwall__label{ color:var(--muted); font-size:13px; }
.regwall__field input{
  width:100%; padding:14px 14px;
  border-radius:12px; background:#141821; color:#fff;
  border:1px solid rgba(255,255,255,.08);
  outline:none;
}
.regwall__field input:focus{ border-color: var(--brand); box-shadow:0 0 0 3px rgba(255,126,85,.2); }

.regwall__primary{
  margin-top:6px;
  border:none; cursor:pointer; color:#fff; font-weight:900; letter-spacing:.02em;
  padding:14px 18px; border-radius:14px;
  background: linear-gradient(180deg, #FF7E55, #FF7E55);
  box-shadow: 0 10px 30px rgba(255,126,85,.35);
}
.regwall__primary:hover{ filter: brightness(1.05); }

.regwall__legal{ color:var(--muted); font-size:12px; }
.regwall__legal a{ color:#fff; text-decoration:underline; }

.regwall__adult-confirmation{
  color: var(--muted);
  font-size: 11px;
  margin-top: 8px;
  text-align: center;
  font-weight: 500;
}

.regwall__saved{
  display:flex; align-items:center; gap:8px; color:#0FD36A;
  padding:10px 12px; background:transparent;
  border:none; border-radius:10px; margin-top:6px;
}
.regwall__saved-badge{ font-weight:900; }

.regwall__offers{
  display:grid; gap:12px; margin-top:22px;
    grid-template-columns: 1fr;
  }
.offer{
  display:grid; grid-template-columns: auto 1fr auto; align-items:center; gap:10px;
  background:#131722; border:1px solid rgba(255,255,255,.08);
  border-radius:14px; padding:12px 14px;
}
.offer__icon{ font-size:18px; }
.offer__title{ font-weight:800; }
.offer__pill{ font-size:11px; font-weight:800; color:#111; background:#F9C93A; padding:4px 6px; border-radius:999px; }

/* Выделение ключевых слов в офферах */
.offer--featured .offer__title .highlight-video {
  color: #FF7E55;
  font-weight: 900;
}

.offer__icon--wand + .offer__title .highlight-wand {
  color: #8B5CF6;
  font-weight: 900;
}

.offer__icon--chili + .offer__title .highlight-chili {
  color: #DC2626;
  font-weight: 900;
}

.offer__icon--cuffs + .offer__title .highlight-cuffs {
  color: #16A34A;
  font-weight: 900;
}

.offer__icon--chat + .offer__title .highlight-chat {
  color: #38BDF8;
  font-weight: 900;
}

.regwall__pane--visual{ 
  position: relative;
  display: flex;
    flex-direction: column;
  justify-content: flex-end;
  padding: 0;
  background: #0B0F15;
  overflow: hidden;
  height: 600px;
  min-height: 500px;
}

.regwall__poster{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

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

.regwall__poster-brand{
  position: absolute;
  left: 16px;
  top: 16px;
  font-weight: 900;
  letter-spacing: .12em;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.6);
  z-index: 3;
}

/* Офферы поверх постера */
.regwall__offers{
  position: relative;
  z-index: 2;
  background: linear-gradient(to top, rgba(0,0,0,1), transparent);
  padding: 24px;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 50%;
  justify-content: flex-end;
}

/* Сетка 2x2 для остальных офферов */
.offers-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Скрываем мобильные офферы на десктопе */
@media (min-width: 961px){
  .regwall__offers--mobile{
    display: none;
  }
}

/* Улучшенные стили для офферов на постере */
.regwall__pane--visual .offer{
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 14px 16px;
  transition: all 0.2s ease;
}

.regwall__pane--visual .offer:hover{
  background: rgba(255,255,255,0.15);
  transform: translateY(-2px);
}

.regwall__pane--visual .offer__title{
  color: #fff;
  font-weight: 700;
    font-size: 14px;
  line-height: 1.2;
}

.regwall__pane--visual .offer__icon{
  font-size: 20px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.regwall__pane--visual .offer__icon svg{
  width: 20px;
  height: 20px;
}

/* Стили для новых иконок */
.offer__icon--video{
  color: #FF7E55; /* оранжевый */
}

.offer__icon--wand{
  color: #8A5BFF; /* фиолетовый */
}

.offer__icon--chat{
  color: #00BFFF; /* голубой */
}

.offer__icon--chili{
  color: #FF4444; /* красный */
}

.offer__icon--cuffs{
  color: #00CC66; /* зеленый */
}

/* Featured оффер (самый длинный) */
.regwall__pane--visual .offer--featured{
  grid-column: 1 / -1;
  background: rgba(255,126,85,0.2);
  border: 1px solid rgba(255,126,85,0.4);
  padding: 18px 20px;
}

.regwall__pane--visual .offer--featured .offer__title{
  font-size: 16px;
  font-weight: 800;
}

/* Выделение для мобильной версии */
.regwall__offers--mobile .offer__title .highlight-video {
  color: #FF7E55;
  font-weight: 900;
}

.regwall__offers--mobile .offer__title .highlight-wand {
  color: #8B5CF6;
  font-weight: 900;
}

.regwall__offers--mobile .offer__title .highlight-chili {
  color: #DC2626;
  font-weight: 900;
}

.regwall__offers--mobile .offer__title .highlight-cuffs {
  color: #16A34A;
  font-weight: 900;
}

.regwall__offers--mobile .offer__title .highlight-chat {
  color: #38BDF8;
  font-weight: 900;
}

.regwall__pane--visual .offer--featured .offer__icon{
  font-size: 24px;
}

/* KILL legacy bottom padding under sticky-nav (мы больше не используем sticky) */
@media (max-width: 640px){
  .options,
  .style-options,
  .kinks-options{
    padding-bottom: 0 !important;
  }
}

/* Kinks: всегда 3 колонки, как у Ethnic Background */
#kinks .kinks-options{
  grid-template-columns: repeat(3, max-content) !important;
}

/* Карточки берут ширину только из --card-w, которую считает JS */
#kinks .kinks-options .card{
  width: var(--card-w) !important;
}

/* На мобиле никаких «подкладочных» отступов снизу */
@media (max-width: 640px){
  #kinks .kinks-options{ padding-bottom: 0 !important; }
}

/* Временное отключение всех анимаций/переходов при перестройке лэйаута */
.quiz-section.no-anim, 
.quiz-section.no-anim * {
  transition: none !important;
  animation: none !important;
}

/* Kinks использует стандартные transition из .card */

/* === Video poster → video swap === */
.card-media{ 
  position: relative; 
}

/* Видео скрыто до готовности */
.card-media video {
  opacity: 0;
  transition: opacity .25s ease;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

/* Когда видео готово — показываем */
.card-media video.is-ready {
  opacity: 1;
}

/* Постер поверх до готовности видео */
.card-media .poster{
  position: absolute;
  inset: 0;
  width: 100%; 
  height: 100%;
  object-fit: contain;      /* постер отображается в оригинальном размере без растягивания */
  display: block;
  opacity: 1;
  transition: opacity .25s ease;
  z-index: 2;              /* выше видео */
}

/* Как только видео готово — постер убираем */
.card-media video.is-ready ~ .poster {
  opacity: 0; 
  pointer-events: none;
}

/* Ограничение ширины для гридов */
.style-options,
.options,
.kinks-options{
  box-sizing: border-box;
  max-width: 100%;
}

/* Включение паттерна "hug to center" — прижимаем к центральной оси */
.hug-to-center {
  justify-items: center;  /* дефолт для средней колонки */
  --hug-pad: 10px;        /* можно подкрутить отступы к центру */
}

/* --- Для 2 колонок --- */
.hug-to-center.h2c {
  grid-template-columns: repeat(2, max-content) !important;
}
.hug-to-center.h2c > *:nth-child(2n+1) { /* левая колонка */
  justify-self: end;
  padding-right: var(--hug-pad);
}
.hug-to-center.h2c > *:nth-child(2n) {   /* правая колонка */
  justify-self: start;
  padding-left: var(--hug-pad);
}

/* --- Для 3 колонок --- */
.hug-to-center.h3c {
  grid-template-columns: repeat(3, max-content) !important;
}
.hug-to-center.h3c > *:nth-child(3n+1) { /* левая колонка */
  justify-self: end;
  padding-right: var(--hug-pad);
}
.hug-to-center.h3c > *:nth-child(3n+2) { /* средняя колонка */
  justify-self: center;
  padding: 0 6px; /* слегка уплотняем к центру */
}
.hug-to-center.h3c > *:nth-child(3n) {   /* правая колонка */
  justify-self: start;
  padding-left: var(--hug-pad);
}

/* Remove padding from card image-option elements */
.card.image-option {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Remove padding from all card elements in hug-to-center containers */
.hug-to-center .card {
  padding-left: 0 !important;
  padding-right: 0 !important;
  padding: 0 !important;
}

/* Specifically target the middle column padding in 3-column layout */
.hug-to-center.h3c > .card:nth-child(3n+2) {
  padding: 0 !important;
}

/* --- Video poster layering & reveal --- */
.card-media { position: relative; }
.card-media .poster{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background:#000;
  transition: opacity .25s ease;
  z-index: 1; /* поверх видео, пока оно не готово */
  opacity: 1;
}
.card-media video{
  position: relative;
  z-index: 0;
}
.card-media video.is-ready + .poster{
  opacity: 0;
  pointer-events: none;
}


