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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Quicksand', sans-serif;
}

/* --- тема по вайбу (body[data-vibe]); кофейная — базовая, «Дом у моря» --- */
:root {
  --bg-l: #EDE3DB;
  --bg-d: #DDCEC7;
  --paper: #F3E9D7;
  --paper-2: #F7F0E6;
  --paper-3: #FBF6EE;
  --accent: #A0713C;
  --accent-rgb: 160, 113, 60;
}

/* фон/бумага везде остаются кофейными (:root); вайб меняет только тёплый акцент */
body[data-vibe="sky"]   { --accent: #6F8A93; --accent-rgb: 111, 138, 147; }  /* пыльно-синий */
body[data-vibe="grass"] { --accent: #7D9071; --accent-rgb: 125, 144, 113; }  /* шалфей */
body[data-vibe="city"]  { --accent: #9B8188; --accent-rgb: 155, 129, 136; }  /* мокко-лиловый */

/* --- мини-роутер: сцена с перспективой --- */
.stage {
  position: relative;
  height: 100dvh;
  perspective: 1200px;
  perspective-origin: 50% 30%;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
  will-change: transform, opacity, filter;
  visibility: hidden;
  overflow-y: auto;
}

.screen.active {
  visibility: visible;
  z-index: 2;
}

.screen.leaving {
  visibility: visible;
  z-index: 1;
  transform: translateZ(-260px) translateY(-6%) rotateX(10deg) scale(.92);
  opacity: 0;
  filter: blur(6px) brightness(.85);
  /* !important — чтобы слайд не перебивался transition'ами отдельных секций (#vibe, #quiz5) */
  transition:
    transform 1s cubic-bezier(.4, 0, .2, 1),
    opacity 1s ease,
    filter 1s ease !important;
  pointer-events: none;
}

.screen.entering {
  transform: translateZ(-80px) translateY(14%) scale(.96);
  opacity: 0;
}

.screen.entering.go {
  transform: translateZ(0) translateY(0) scale(1);
  opacity: 1;
  transition:
    transform .9s cubic-bezier(.22, 1, .36, 1) .2s,
    opacity .7s ease .2s !important;
}

/* --- hero (прототип: линии → раскраска пальцем) --- */
#hero {
  padding: 0;
  overflow: hidden;
  background: #DDCEC7;
}

.hero-live {
  position: absolute;
  inset: 0;
}

.hero-live__reveal,
.hero-live__lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-live {
  touch-action: none;
  cursor: pointer;
}

.hero-live__reveal {
  z-index: 0;
  display: block;
}

.hero-live__lines {
  z-index: 2;
  pointer-events: none;
}

.hero-live__lines svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.hero-live__lines.draw svg path {
  animation: hero-draw 4s cubic-bezier(.45, 0, .25, 1) forwards;
}

@keyframes hero-draw {
  to { stroke-dashoffset: 0; }
}

.hero-live__lines.fade {
  opacity: 0;
  transition: opacity 2.2s ease-in .3s;
}

.hero-live__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8%;
  z-index: 3;
  text-align: center;
  font-family: 'Rubik', sans-serif;
  font-weight: 500;
  font-size: clamp(17px, 4.6vw, 26px);
  color: #3E332A;
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s ease;
  animation: hero-hint-pulse 2.4s ease-in-out infinite;
}

.hero-live__hint::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(78vw, 320px);
  height: 2.4em;
  border-radius: 999px;
  background: rgba(247, 240, 230, .92);
  border: 1.5px solid rgba(62, 51, 42, .25);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .1);
  z-index: -1;
}

.hero-live__hint.show {
  opacity: 1;
}

@keyframes hero-hint-pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* надпись пером после покраски */
.hero-title {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(env(safe-area-inset-top, 0px) + 20%);
  z-index: 3;
  text-align: center;
  pointer-events: none;
  visibility: hidden;
}

.hero-title.show {
  visibility: visible;
}

.hero-title__line {
  margin: 0;
  font-family: 'Marck Script', cursive;
  color: #2F2A25;
  text-shadow:
    0 1px 0 rgba(255, 250, 240, .8),
    0 0 10px rgba(255, 250, 240, .95),
    0 0 26px rgba(255, 250, 240, .85);
  line-height: 1.1;
}

.hero-title__hb {
  font-weight: 400;
  font-size: clamp(28px, 8vw, 46px);
  letter-spacing: .02em;
}

.hero-title__name {
  font-weight: 400;
  font-size: clamp(60px, 18vw, 112px);
  letter-spacing: .03em;
  margin-top: -.1em;
}

.hero-title .ch {
  display: inline-block;
  opacity: 0;
  clip-path: inset(-20% 100% -20% -10%);
}

.hero-title .w {
  display: inline-block;
  white-space: nowrap;
}

.hero-title.show .ch {
  animation: hero-write .3s ease forwards;
  animation-delay: calc(var(--i) * .075s);
}

@keyframes hero-write {
  from { opacity: 0; clip-path: inset(-20% 100% -20% -10%); }
  40%  { opacity: 1; }
  to   { opacity: 1; clip-path: inset(-20% -10% -20% -10%); }
}

.hero-live__open {
  position: absolute;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%) translateY(14px);
  z-index: 4;
  opacity: 0;
  visibility: hidden;
  transition: opacity .6s ease, transform .6s cubic-bezier(.22, 1, .36, 1), visibility .6s;
}

.hero-live__open.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.hero-live__open.show:hover {
  transform: translateX(-50%) translateY(-3px);
}

.parallax-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  perspective: 1400px;
  perspective-origin: 50% 50%;
}

.scene {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

.layer {
  position: absolute;
  top: -15%;
  left: -15%;
  width: 130%;
  height: 130%;
  object-fit: cover;
  will-change: transform;
  backface-visibility: hidden;
}

.far { z-index: 1; }
.clouds { z-index: 2; }
.near { z-index: 3; }

.hero__content {
  position: absolute;
  inset: 0;
  bottom: 20%;
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  will-change: transform, opacity;
}

.hero__caption {
  font-family: 'Quicksand', sans-serif;
  font-size: clamp(15px, 1.5vw, 28px);
  font-weight: 500;
  letter-spacing: .06em;
  color: #06532c;
  text-shadow: 0 1px 14px rgba(255, 255, 255, .6);
}

.hero__name {
  font-family: 'Cormorant Garamond', Garamond, 'Times New Roman', serif;
  font-weight: 600;
  font-size: clamp(90px, 12.5vw, 180px);
  line-height: normal;
  letter-spacing: 0;
  /* стеклянная заливка — как у кнопки, чуть темнее (сквозь буквы просвечивает небо) */
  color: rgba(2, 58, 138, 0.32);
  /* белая обводка */
  -webkit-text-stroke: clamp(1.2px, 0.4vw, 3px) rgba(255, 255, 255, 0.92);
  paint-order: stroke fill;
  text-shadow:
    0 2px 10px rgba(0, 40, 110, 0.18),
    0 0 1px rgba(255, 255, 255, 0.5);
}

/* тёплое «бумажное» стекло — читается на воде */
.open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 200px;
  height: 58px;
  padding: 0 48px;
  font-family: 'Quicksand', sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #3E332A;
  background: rgba(247, 240, 230, .78);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  backdrop-filter: blur(14px) saturate(130%);
  border: 2px solid rgba(160, 113, 60, .85);
  border-radius: 50px;
  cursor: pointer;
  box-shadow:
    0 10px 28px rgba(30, 24, 18, .35),
    0 0 0 6px rgba(247, 240, 230, .22),
    inset 0 1px 0 rgba(255, 255, 255, .9);
  transition: transform .2s, box-shadow .2s, background .2s;
}

.open-btn:hover {
  transform: translateY(-3px);
  background: rgba(247, 240, 230, .92);
  box-shadow:
    0 14px 34px rgba(30, 24, 18, .4),
    0 0 0 8px rgba(247, 240, 230, .26),
    inset 0 1px 0 rgba(255, 255, 255, .9);
}

/* --- birthday --- */
#birthday {
  background: #DDCEC7;
  gap: 0;
  overflow: hidden;
  justify-content: flex-start;
  padding-top: calc(env(safe-area-inset-top, 0px) + 11dvh);
}

/* контент поверх фона */
.birthday__subtitle,
.bd-portrait,
.birthday__btn {
  position: relative;
  z-index: 1;
}

.birthday__subtitle {
  font-family: 'Rubik', sans-serif;
  font-weight: 500;
  font-weight: 400;
  font-size: clamp(26px, 7.4vw, 52px);
  color: #3A342C;
  text-align: center;
  max-width: 640px;
  line-height: 1.4;
  margin-bottom: 28px;
  padding: 0 12px;
}

/* --- хореография появления секции (класс .play) --- */
#birthday .birthday__btn {
  opacity: 0;
}

#birthday.ready .birthday__btn {
  animation: bd-rise .9s cubic-bezier(.22, 1, .36, 1) forwards;
}

@keyframes bd-rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* подзаголовок — прорисовка по буквам «от руки» */
.birthday__subtitle .ch {
  display: inline-block;
  opacity: 0;
  clip-path: inset(0 100% -15% 0);
}

.birthday__subtitle .w {
  display: inline-block;
  white-space: nowrap;
}

#birthday.play .birthday__subtitle .ch {
  animation: bd-write .26s ease forwards;
  animation-delay: calc(.3s + var(--i) * .03s);   /* печатается быстрее, чтобы допечататься до прорисовки */
}

/* когда началась прорисовка лица — подзаголовок уходит на второй план, фокус на портрете */
#birthday.bd-drawing .birthday__subtitle {
  opacity: .5;
  transform: scale(.95);
  transition: opacity .7s ease, transform .7s ease;
}

@keyframes bd-write {
  from { opacity: 0; clip-path: inset(0 100% -15% 0); }
  45%  { opacity: 1; }
  to   { opacity: 1; clip-path: inset(0 0 -15% 0); }
}

/* портрет: контуры → акварельное пятно → цветной рисунок */
.bd-portrait {
  width: min(82vw, 440px);
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
}

.bd-portrait__reveal,
.bd-portrait__lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.bd-portrait__reveal {
  display: block;
  overflow: visible;
}

.bd-portrait__img {
  opacity: 0;
}

.bd-portrait.color .bd-portrait__img {
  opacity: 1;
}

.bd-portrait__lines {
  z-index: 1;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 76%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 76%, transparent 100%);
}

.bd-portrait__lines svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* штрихи в экранных пикселях (иначе при уменьшении портрета линии почти исчезают) */
.bd-portrait__lines svg path { vector-effect: non-scaling-stroke; stroke: #4A3A2A; stroke-width: 1.3; }  /* мягче, не слишком тёмные */

.bd-portrait__lines .f path {
  fill-opacity: 0;
}

.bd-portrait__lines.draw svg path {
  animation: hero-draw 2s cubic-bezier(.45, 0, .25, 1) forwards;
}

.bd-portrait__lines.draw svg .f path {
  animation-name: bd-draw-fill;
}

@keyframes bd-draw-fill {
  to { stroke-dashoffset: 0; fill-opacity: 1; }
}

.bd-portrait__lines.fade {
  opacity: 0;
  transition: opacity 1.1s ease-in .1s;
}

/* подпись художника — прописывается пером после покраски */
.bd-portrait__sign {
  position: absolute;
  right: 6%;
  bottom: -4%;
  margin: 0;
  font-family: 'Marck Script', cursive;
  font-size: clamp(22px, 6vw, 40px);
  color: #5C4A38;
  white-space: nowrap;
  transform: rotate(-4deg);
  z-index: 2;
  visibility: hidden;
}

.bd-portrait.signed .bd-portrait__sign {
  visibility: visible;
}

.bd-portrait__sign .ch {
  display: inline-block;
  opacity: 0;
  clip-path: inset(-20% 100% -20% -10%);
}

.bd-portrait__sign .w {
  display: inline-block;
  white-space: nowrap;
}

.bd-portrait.signed .bd-portrait__sign .ch {
  animation: hero-write .3s ease forwards;
  animation-delay: calc(var(--i) * .08s);
}

.birthday__btn {
  width: 350px;
  max-width: 85vw;
  height: 60px;
  font-family: 'Manrope', sans-serif;
  font-size: clamp(16px, 2.2vw, 20px);
  font-weight: 400;
  color: #F7F0E6;
  background: #A0713C;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(160, 113, 60, .50);
  transition: transform .2s, box-shadow .2s;
  margin-top: 36px;
}

.birthday__btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(160, 113, 60, .60);
}

/* --- vibe квест --- */
#vibe {
  background: var(--bg-l);
  transition: background-color .8s ease;
  gap: 0;
  overflow-y: auto;
  padding-top: 24px;
  padding-bottom: 24px;
}

/* --- quiz (desktop-first) --- */
#quiz,
#quiz2,
#quiz3,
#quiz4,
#quiz5 {
  justify-content: flex-start;
  padding: 80px 24px 0;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

#quiz { background: var(--bg-d); }
#quiz2 { background: var(--bg-l); }
#quiz3 { background: var(--bg-d); }
#quiz4 { background: var(--bg-d); }
#quiz5 { background: var(--bg-l); }

.quiz__card {
  background: var(--paper);
  border-radius: 29px;
  padding: 29px;
  border: 2px solid #5C4A38;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
  width: 391px;
  height: 180px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz__question {
  font-family: 'Rubik', 'Inter', sans-serif;
  font-weight: 500;
  font-size: 22px;
  color: #3A342C;
  text-align: center;
  line-height: 1.4;
}

/* --- «оживление» блока вопроса: декор + плавание + параллакс + проявление по словам --- */
.quiz__card {
  position: relative;
  overflow: hidden;
  animation: qcard-float 6.5s ease-in-out infinite;
}

.quiz__question {
  position: relative;
  z-index: 2;
  transform: translate(calc(var(--px, 0) * 6px), calc(var(--py, 0) * 5px));
  transition: transform .25s ease-out;
}

.quiz__question .qw { display: inline-block; opacity: 0; transform: translateY(10px); }
.quiz__question.reveal .qw {
  animation: qw-in .5s cubic-bezier(.22, 1, .36, 1) forwards;
  animation-delay: calc(var(--i, 0) * 65ms);
}
@keyframes qw-in { to { opacity: 1; transform: translateY(0); } }

.card-decor {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  transform: translate(calc(var(--px, 0) * 14px), calc(var(--py, 0) * 10px));
  transition: transform .25s ease-out;
}
.card-decor img {
  position: absolute;
  opacity: .5;
  filter: drop-shadow(0 2px 5px rgba(90, 74, 56, .2));
  animation: decor-float var(--d, 5s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform;
}

@keyframes decor-float {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50%      { transform: translateY(-7px) rotate(calc(var(--rot, 0deg) + 3deg)); }
}
@keyframes qcard-float {
  0%, 100% { transform: translateY(0) rotate(-.35deg); }
  50%      { transform: translateY(-5px) rotate(.35deg); }
}

@media (prefers-reduced-motion: reduce) {
  .quiz__card, .card-decor img { animation: none; }
  .quiz__question .qw { opacity: 1; transform: none; }
}

.quiz__options {
  display: flex;
  flex-direction: column;
  gap: 40px;
  width: 100%;
  max-width: 391px;
  margin-top: 80px;
 
}

.quiz__option {
  height: 62px;
  width: 100%;
  border-radius: 31px;
  background: var(--paper-2);
   border: 1.5px solid #5C4A38;
  font-family: 'Rubik', 'Inter', sans-serif;
  font-weight: 400;
  font-size: 25px;
  color: #3E332A;
  cursor: pointer;
  transition: transform .2s, border .2s, background .2s;
}

.quiz__option.selected {
  border: 2.5px solid var(--accent);
  background: #fff;
  transform: scale(1.02);
}

.quiz__next {
  margin-top: auto;
  width: 100%;
  max-width: 326px;
  height: 56px;
  border-radius: 28px;
  background: var(--accent);
  color: var(--paper-2);
  font-family: 'Inter', 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 16px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(var(--accent-rgb), .3);
  transition: transform .2s, opacity .2s;
}

.quiz__next:disabled {
  background: #BCA98C;   /* приглушённый, но непрозрачный — читается поверх арта */
  color: #F5EEE2;
  box-shadow: 0 4px 12px rgba(90, 74, 56, .2);
  cursor: default;
  pointer-events: none;
}

.quiz__next:not(:disabled):hover {
  transform: translateY(-2px);
}

@media (max-width: 767px) {
  #quiz {
    padding: 60px 24px 0;
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
  }
  .quiz__card {
    max-width: 326px;
    padding: 24px;
    border-radius: 24px;
  }

  .quiz__options {
    max-width: 326px;
    margin-top: 40px;
  }
  .quiz__option {
    height: 52px;
    border-radius: 26px;
  }
}

/* --- result --- */
/* --- финал: загадай желание --- */
#result {
  background: var(--bg-d);
  justify-content: flex-start;
  gap: 0;
  padding: 56px 24px 0;
  padding-bottom: calc(36px + env(safe-area-inset-bottom));
}
/* фон-видео финала: луг с одуванчиками (тёплый золотой час) */
.wish__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
/* лёгкая тёплая вуаль сверху — заголовок читается на любом кадре */
#result::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(237, 227, 219, .34), rgba(237, 227, 219, .08) 28%, rgba(237, 227, 219, 0) 52%);
  z-index: 1;
}
#result > .wish__title,
#result > .wish__subtitle,
#result > .wish__input,
#result > .wish__send,
#result > .wish__skip { position: relative; z-index: 2; }

.wish__title {
  font-family: 'Cormorant Garamond', Garamond, serif;
  font-weight: 600;
  font-size: clamp(28px, 4.6vw, 44px);
  color: #3A342C;
  text-align: center;
  line-height: 1.15;
  max-width: 560px;
  margin-bottom: 18px;
}

.wish__subtitle {
  font-family: 'Cormorant', serif;
  font-weight: 600;
  font-size: clamp(15px, 2.2vw, 22px);
  color: #3A342C;
  text-align: center;
  line-height: 1.35;
  max-width: 520px;
  margin-bottom: 26px;
}

.wish__subtitle em {
  font-style: italic;
  font-weight: 700;
  color: #5C4A38;
}

.wish__input {
  width: 100%;
  max-width: 420px;
  height: 150px;
  background: #FFFBF5;
  border: 2px solid #5C4A38;
  border-radius: 20px;
  padding: 18px 20px;
  font-family: 'Cormorant', serif;
  font-weight: 600;
  font-size: 18px;
  color: #3A342C;
  resize: none;
  outline: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .06);
}

.wish__input::placeholder {
  font-family: 'Lobster', cursive;
  font-weight: 400;
  color: rgba(58, 52, 44, .5);
  font-size: 18px;
}

.wish__send {
  margin-top: auto;
  width: 100%;
  max-width: 300px;
  height: 45px;
  border-radius: 28px;
  background: var(--accent);
  color: var(--paper-2);
  font-family: 'Inter', 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 16px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(var(--accent-rgb), .3);
  transition: transform .2s;
}

.wish__send:hover {
  transform: translateY(-2px);
}

.wish__skip {
  margin-top: 16px;
  width: 100%;
  max-width: 300px;
  height: 45px;
  border-radius: 26px;
  background: rgba(247, 240, 230, .5);        /* матовая подложка — не теряется на траве */
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1.5px solid #5C4A38;
  color: #3A342C;
  font-family: 'Inter', 'Manrope', sans-serif;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(92, 74, 56, .18);
  transition: transform .2s, background .2s;
}

.wish__skip:hover {
  transform: translateY(-2px);
  background: rgba(247, 240, 230, .68);
}

.wish__done {
  font-family: 'Cormorant Garamond', Garamond, serif;
  font-weight: 600;
  font-size: clamp(24px, 4vw, 38px);
  color: #3A342C;
  text-align: center;
  margin: auto 0;
  line-height: 1.25;
}

/* --- финальная секция (основное поздравление) --- */
#final {
  background: #EDE3DB;
  gap: 0;
  padding: 40px 20px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

.final__caption {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Quicksand', sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .03em;
  color: #3A342C;
  margin-bottom: 20px;
}

.final__caption-icon {
  width: 34px;
  height: auto;
  object-fit: contain;
}

/* карточка-поздравление: художественная рамка (Тоторо, шары, гирлянда) как фон */
.final__card {
  position: relative;
  width: min(92vw, 360px);
  aspect-ratio: 816 / 1281;
  background: transparent;
  border-radius: 24px;              /* под дизайн-систему */
  overflow: hidden;                 /* углы рамки скругляются (немного обрежется — ок) */
  flex-shrink: 0;
  box-shadow: 0 10px 26px rgba(60, 40, 20, .2);
}

/* сама рамка-картинка (отдельным слоем — чтобы плавно проявлять после кино) */
.final__card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("img/photo-anime/frame-final.webp?v=2") center / 100% 100% no-repeat;
  pointer-events: none;
  z-index: 0;
}

.final__card-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  /* безопасная зона внутри декора: сверху гирлянда, снизу Тоторо/подарки */
  padding: 13% 15% 28%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.final__card-frame::before { display: none; }   /* старая внутренняя рамка не нужна */

.final__head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.final__photo {
  width: 118px;
  height: 118px;
  object-fit: cover;
  border: 4px solid #FBF6EE;
  border-bottom-width: 16px;
  border-radius: 3px;
  box-shadow: 0 4px 12px rgba(60, 40, 20, .25);
  transform: rotate(-3deg);
  flex-shrink: 0;
}

.final__head-text {
  flex: 1;
  text-align: right;
  padding-top: 6px;
}

.final__hbd {
  font-family: 'Marck Script', cursive;
  font-size: 30px;
  color: #A0713C;
  line-height: 1.05;
  margin-bottom: 10px;
}

.final__sign {
  font-family: 'Rubik', sans-serif;
  font-weight: 500;
  font-size: 12.5px;
  color: #3A342C;
  line-height: 1.2;
  text-align: center;
  margin: 10% 0 6px;        /* зазор после фото — текст ниже */
}

.final__text {
  margin-top: 4px;
}

/* --- рукописная прорисовка (по букве) --- */
.final__text .w,
.final__hbd .w,
.final__sign .w {
  display: inline-block;
  white-space: nowrap;
}

.final__text .ch,
.final__hbd .ch,
.final__sign .ch {
  display: inline-block;
  opacity: 0;
  clip-path: inset(0 100% -15% 0);
}
/* прописывание запускается отдельным классом — чтобы буквы были скрыты, пока проявляется карточка */
#final.final--writing .final__text .ch,
#final.final--writing .final__hbd .ch,
#final.final--writing .final__sign .ch {
  animation: handwrite .2s ease forwards;
  animation-delay: calc(var(--i) * 25ms);
}

@keyframes handwrite {
  from { opacity: 0; clip-path: inset(0 100% -15% 0); }
  40%  { opacity: 1; }
  to   { opacity: 1; clip-path: inset(0 0 -15% 0); }
}

@media (prefers-reduced-motion: reduce) {
  .final__text .ch,
  .final__hbd .ch,
  .final__sign .ch {
    animation: none;
    opacity: 1;
    clip-path: none;
  }
}

.final__text p {
  font-family: 'Rubik', sans-serif;
  font-size: 12.5px;
  color: #3A342C;
  line-height: 1.32;
  text-align: center;
  margin-bottom: 6px;
}

/* ─────────── финал: торт-шапка (прорисовка → акварель → посадка в слот) ─────────── */

/* пустое место в шапке карточки, куда сядет торт */
/* торт в полароид-рамке (шапка карточки) */
.final__cake-slot {
  width: 82%;
  aspect-ratio: 1.5;        /* пропорция полароида (фото + широкий низ рамки) */
  margin: 0 auto 12px;
}

/* сам торт — абсолютный сиблинг карточки (вне zoom карточки) */
.final__cake {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;                 /* геометрия проставляется из JS по слоту */
  height: 0;
  opacity: 0;               /* до старта кино скрыт */
  z-index: 5;
  background: #FBF6EE;                    /* подложка полароида */
  border: 4px solid #FBF6EE;             /* белая рамка */
  border-bottom-width: 16px;             /* широкий низ — как у полароида */
  border-radius: 3px;
  overflow: hidden;
  transform: rotate(-2deg);              /* лёгкий наклон полароида */
  transform-origin: 50% 50%;
  box-shadow: 0 6px 16px rgba(60, 40, 20, .28);
  transition: transform 1.1s cubic-bezier(.22, 1, .36, 1), opacity .6s ease;   /* плавная посадка */
  will-change: transform, opacity;
}
.final__cake.is-live { opacity: 1; }
.final__cake--lift { z-index: 20; }
.final__cake.is-docked { box-shadow: 0 4px 14px rgba(60, 40, 20, .22); }

.final__cake-reveal,
.final__cake-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.final__cake-reveal { display: block; }
.final__cake-img { opacity: 1; }                        /* видимость через маску-акварель */
.final__cake.instant .final__cake-img { -webkit-mask: none; mask: none; }
.final__cake.instant .final__cake-lines { opacity: 0; }

.final__cake-lines { pointer-events: none; }
.final__cake-lines svg { width: 100%; height: 100%; display: block; }
.final__cake-lines svg path { stroke: #5C4A38; fill: none; }
.final__cake-lines.draw svg path {
  animation: hero-draw 1.5s cubic-bezier(.45, 0, .25, 1) forwards;
}
.final__cake-lines.fade {
  opacity: 0;
  transition: opacity 1.2s ease-in .3s;
}

/* карточка «собирается» вокруг торта: пока идёт рисование — рамка, подпись и текст спрятаны */
.final__card { transition: box-shadow .6s ease; }
.final__card::before { transition: opacity .6s ease; }
.final__sign,
.final__text { transition: opacity .7s ease; }

#final.final--intro .final__card,
#final.final--paint .final__card { box-shadow: none; }
#final.final--intro .final__card::before,
#final.final--paint .final__card::before { opacity: 0; }
#final.final--intro .final__sign,
#final.final--paint .final__sign,
#final.final--intro .final__text,
#final.final--paint .final__text { opacity: 0; }

/* мгновенная сборка (повтор / reduced-motion): текст без побуквенной анимации */
#final.final--assembled .final__text .ch,
#final.final--assembled .final__sign .ch {
  animation: none;
  opacity: 1;
  clip-path: none;
}

@media (prefers-reduced-motion: reduce) {
  .final__cake { transition: opacity .4s ease; }
}

.final__credits {
  margin: 20px auto 0;
  max-width: 320px;
  text-align: center;
  font-family: 'Rubik', sans-serif;
  font-size: 11px;
  line-height: 1.5;
  color: #8A7A66;
  opacity: .8;
  flex-shrink: 0;
}

.final__finish {
  margin-top: 28px;
  width: 100%;
  max-width: 320px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 28px;
  background: #A0713C;
  color: #F7F0E6;
  font-family: 'Inter', 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 16px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(160, 113, 60, .3);
  transition: transform .2s;
}

.final__finish:hover {
  transform: translateY(-2px);
}

.final__restart {
  margin-top: 16px;
  width: 100%;
  max-width: 320px;
  height: 50px;
  flex-shrink: 0;
  border-radius: 26px;
  background: transparent;
  border: 1.5px solid #5C4A38;
  color: #3A342C;
  font-family: 'Inter', 'Manrope', sans-serif;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(92, 74, 56, .15);
  transition: transform .2s, background .2s;
}

.final__restart:hover {
  transform: translateY(-2px);
  background: rgba(160, 113, 60, .06);
}

.vibe__step {
  font-family: 'Quicksand', sans-serif;
  font-size: clamp(11px, 1.2vw, 14px);
  font-weight: 500;
  color: #8A7B6C;
  letter-spacing: .04em;
  position: absolute;
  top: 20px;
  left: 24px;
}

.vibe__title {
  font-family: 'Cormorant Garamond', Garamond, serif;
  font-weight: 600;
  font-size: clamp(28px, 7vw, 70px);
  color: #3A342C;
  text-align: center;
  line-height: 1.1;
  margin-bottom: 8px;
}

.vibe__subtitle {
  font-family: 'Cormorant', serif;
  font-weight: 600;
  font-size: clamp(13px, 4vw, 35px);
  color: #3A342C;
  text-align: center;
  max-width: 700px;
  line-height: 1.3;
  padding: 0 24px;
}

.vibe__grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 15px;
  margin-top: 24px;
  justify-content: center;
}

.vibe__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(170px, 44vw, 257px);
  border-radius: 14px;
  border: 2px solid #5C4A38;
  padding: 4px;
  background: #F3E9D7;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}

.vibe__card-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  border: 1.3px solid #5C4A38;
  border-radius: 14px;
  padding: clamp(6px, 1vw, 8px);
  padding-bottom: clamp(4px, 1vw, 6px);
}

.vibe__card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(92, 74, 56, .18);
}

.vibe__card.selected {
  box-shadow: 0 0 0 3px #A0713C, 0 6px 18px rgba(92, 74, 56, .22);
  transform: scale(1.03);
}

.vibe__card-inner {
  width: 100%;
  border-radius: 9px;
  border: 1px solid #5C4A38;
  overflow: hidden;
  margin-top: 2px;
}

.vibe__card-img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.1;
  object-fit: cover;
}

.vibe__card-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-top: 2px;
}

.vibe__card-icon {
  width: clamp(30px, 5vw, 30px);
  height: clamp(30px, 5vw, 30px);
  object-fit: contain;
}

.vibe__card-label span {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(14px, 1.4vw, 18px);
  font-weight: 500;
  color: #3E332A;
}

/* --- polaroid modal --- */
.polaroid-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(62, 51, 42, .45);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}

.polaroid-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.polaroid {
  position: relative;
  width: 400px;
  height: 366px;
  background: var(--paper);
  border-radius: 24px;
  border: 2px solid #5C4A38;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
  padding: 7px;
  display: flex;
  flex-direction: column;
  transform: scale(.8) translateY(40px) rotate(-3deg);
  opacity: 0;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1), opacity .5s ease;
}

.polaroid-overlay.visible .polaroid {
  transform: scale(1) translateY(0) rotate(-1deg);
  opacity: 1;
}

.polaroid__frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 3px;                 /* внутренняя рамка убрана — обводит вся внешняя */
  min-height: 0;
}

.polaroid__photo-wrap {
  flex: 1;
  min-height: 0;
  background: var(--paper-3);
  padding: 6px;
  border-radius: 4px;
  position: relative;
}

.polaroid__photo-wrap::before {
  content: '';
  position: absolute;
  inset: -2px;
  z-index: 1;
  pointer-events: none;
  filter: url(#torn);
  border: 8px solid var(--paper-3);
  border-radius: 6px;
}

.polaroid__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
}

.polaroid__bottom {
  padding: 9px 14px 2px;
  flex-shrink: 0;
}

.polaroid__caption {
  font-family: 'Rubik', sans-serif;
  font-size: 14px;
  color: #3A342C;
  text-align: center;
  line-height: 1.34;
  max-width: 300px;
  margin: 0 auto;
}

/* ведьмочка прижата к нижнему-правому углу карточки, внутри внешнего border */
.polaroid__kiki {
  position: absolute;
  right: 8px;
  bottom: 15px;
  width: 90px;
  height: auto;
  object-fit: contain;
  opacity: 1;
}

/* --- hint card (неправильный ответ) --- */
.hint-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(62, 51, 42, .45);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}

.hint-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.hint-card {
  position: relative;
  width: 360px;
  height: 340px;
  background: var(--paper);
  border-radius: 20px;
  border: 2px solid #5C4A38;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transform: scale(.85) translateY(30px);
  opacity: 0;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1), opacity .5s ease;
}

/* чередование цвета карточек по шагам: нечёт → F3E9D7, чёт → F2E0C0 */
#hintOverlay2 .hint-card,
#polaroidOverlay2 .polaroid,
#hintOverlay4 .hint-card,
#polaroidOverlay4 .polaroid {
  background: #F2E0C0;
}

.hint-overlay.visible .hint-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.hint-books {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 130px;
  height: auto;
  z-index: 2;
}

.hint-flame {
  width: 20px;
  height: auto;
  flex-shrink: 0;
  margin-bottom: 12px;
  z-index: 2;
}

/* живой огонёк в карточках-подсказках — оживляем ту же картинку (lighthub.webp) */
.fireimg {
  position: relative;
  display: inline-flex;
  justify-content: center;
  margin-bottom: 12px;
  flex-shrink: 0;
  z-index: 2;
}
.fireimg .flame-img {
  width: 22px;
  height: auto;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 0 4px rgba(220, 150, 95, .45));
  will-change: transform, filter, opacity;
  animation: fa-flicker 1.15s ease-in-out infinite alternate;
}
.fireimg .spark {
  position: absolute;
  bottom: 58%; left: 50%;
  width: 2px; height: 2px; border-radius: 50%;
  background: rgba(190, 130, 85, .6);   /* тёплый уголёк — в тон заливке огонька */
  z-index: 3;
  animation: fa-fly1 6s linear infinite .4s;
}
.fireimg .spark:nth-of-type(2n) { animation-name: fa-fly2; animation-duration: 8.4s; animation-delay: 1s; left: 44%; }
.fireimg .spark:nth-of-type(3n) { left: 58%; animation-delay: 1.9s; animation-duration: 8s; }
.fireimg .spark:nth-of-type(4n) { left: 38%; animation-delay: 2.6s; animation-duration: 7s; }
.fireimg .spark:nth-of-type(5n) { left: 64%; animation-delay: 1.4s; animation-duration: 7s; }
.fireimg .spark:nth-of-type(6n) { left: 46%; animation-delay: 3.2s; }

@keyframes fa-flicker {
  0%   { transform: scale(1, 1)      skewX(0deg);    opacity: .93; filter: drop-shadow(0 0 3px rgba(220, 150, 95, .35)); }
  25%  { transform: scale(1.03, 1.06) skewX(1.5deg); }
  50%  { transform: scale(.99, 1.02) skewX(-1deg);   opacity: 1;   filter: drop-shadow(0 0 6px rgba(220, 150, 95, .55)); }
  75%  { transform: scale(1.02, 1.04) skewX(1deg); }
  100% { transform: scale(1, .98)    skewX(-1.5deg); opacity: .96; filter: drop-shadow(0 0 4px rgba(220, 150, 95, .4)); }
}
@keyframes fa-fly1 {
  0%   { transform: translate(0, 0); opacity: 1; }
  33%  { transform: translate(3px, -16px); }
  66%  { transform: translate(0, -32px); opacity: .6; }
  100% { transform: translate(2px, -46px); opacity: 0; }
}
@keyframes fa-fly2 {
  0%   { transform: translate(0, 0); opacity: 1; }
  50%  { transform: translate(-3px, -18px); }
  80%  { transform: translate(-1px, -32px); opacity: .6; }
  100% { transform: translate(-2px, -40px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .fireimg .flame-img { animation: none; }
  .fireimg .spark { animation: none; opacity: 0; }
}

.hint-soot {
  position: absolute;
  bottom: 104px;
  left: 12px;
  width: 64px;
  height: auto;
  z-index: 2;
}

/* --- декор подсказки шага 2 --- */
.hint-soot2 {
  position: absolute;
  top: 12px;
  left: 20px;
  width: 92px;
  height: auto;
  z-index: 2;
}

.hint-fire {
  position: absolute;
  bottom: 96px;
  right: 8px;
  width: 90px;
  height: auto;
  z-index: 2;
}

/* --- декор подсказки шага 3 --- */
.hint-witch {
  position: absolute;
  top: 6px;
  right: 4px;
  width: 118px;
  height: auto;
  z-index: 2;
}

.hint-bakery {
  position: absolute;
  bottom: 84px;
  left: 4px;
  width: 150px;
  height: auto;
  z-index: 2;
}

/* --- декор подсказки шага 4 --- */
.hint-fire-tl {
  position: absolute;
  top: 10px;
  left: 6px;
  width: 92px;
  height: auto;
  z-index: 2;
}

.hint-books-br {
  position: absolute;
  bottom: 92px;
  right: 6px;
  width: 130px;
  height: auto;
  z-index: 2;
}

/* --- декор подсказки шага 5 --- */
.hint-witch-tl {
  position: absolute;
  top: 6px;
  left: 4px;
  width: 118px;
  height: auto;
  z-index: 2;
  transform: scaleX(-1);
}

.hint-bakery-br {
  position: absolute;
  bottom: 84px;
  right: 4px;
  width: 150px;
  height: auto;
  z-index: 2;
}

/* --- декор карточки «Загадано» --- */
.wish-witch {
  position: absolute;
  top: 2px;
  left: 42px;
  width: 118px;
  height: auto;
  z-index: 2;
}

.wish-totoro {
  position: absolute;
  bottom: 68px;
  right: 10px;
  width: 150px;
  height: auto;
  z-index: 2;
}

.wish-tyk {
  width: 120px;
}

.hint-frame {
  position: relative;
  width: 320px;
  height: 190px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-image: url("img/photo-anime/card-decor/card-ram 1.webp");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.hint-text {
  font-family: 'Rubik', sans-serif;
  font-size: 16px;
  color: #3A342C;
  text-align: center;
  line-height: 1.4;
  max-width: 180px;
}

.hint-retry {
  margin-top: 50px;
  width: 150px;
  height: 30px;
  border-radius: 15px;
  background: var(--accent);
  color: var(--paper-2);
  font-family: 'Quicksand', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), .35);
  transition: transform .2s;
}

.hint-retry:hover {
  transform: translateY(-2px);
}

.hint-giveup {
  margin-top: 10px;
  background: none;
  border: none;
  font-family: 'Quicksand', sans-serif;
  font-size: 13px;
  color: #8A7B6C;
  text-decoration: underline;
  cursor: pointer;
}

/* --- отвлекалочка: разложи по полочкам --- */
#shelf {
  background: var(--bg-l);
  gap: 0;
  padding: 60px 24px 40px;
}

.shelf__label {
  font-family: 'Quicksand', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .12em;
  color: #8A7B6C;
  margin-bottom: 10px;
}

.shelf__title {
  font-family: 'Cormorant Garamond', Garamond, serif;
  font-weight: 600;
  font-size: clamp(30px, 6vw, 48px);
  color: #3A342C;
  text-align: center;
  letter-spacing: 1.9px;
  margin-bottom: 90px;
}

.shelf__slots {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 26px;
  margin-bottom: 56px;
}

.shelf__slot {
  width: 192px;
  height: 237px;
  border-radius: 20px;
  background: var(--paper);
  border: 1.5px solid rgba(92, 74, 56, .28);
  box-shadow: 0 6px 16px rgba(92, 74, 56, .12);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  overflow: hidden;
  flex-shrink: 0;
}

.shelf__slot--mid {
  width: 222px;
  height: 273px;
  margin-top: -36px;
}

.shelf__slot:empty:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(var(--accent-rgb), .22);
}

.shelf__tray {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.shelf__photo {
  width: 162px;
  height: 207px;
  object-fit: cover;
  border-radius: 14px;
  border: 2px solid #5C4A38;
  box-shadow: 0 6px 16px rgba(60, 40, 20, .2);
  cursor: grab;
  touch-action: none;                 /* чтобы тач-драг не прокручивал страницу */
  transition: transform .2s, box-shadow .2s;
}

.shelf__photo.picked {
  transform: translateY(-10px) scale(1.05);
  box-shadow: 0 12px 24px rgba(var(--accent-rgb), .35);
  border-color: var(--accent);
}

/* фото во время перетаскивания */
.shelf__photo.dragging {
  cursor: grabbing;
  transition: none;
  transform: scale(1.06) rotate(-2deg);
  box-shadow: 0 16px 32px rgba(60, 40, 20, .35);
  border-color: var(--accent);
}

/* полочка под курсором при перетаскивании */
.shelf__slot.over {
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(var(--accent-rgb), .3);
  transform: translateY(-2px);
}

/* фото, вложенное в полочку — заполняет её */
.shelf__slot .shelf__photo {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 14px;
  box-shadow: none;
  cursor: default;
}

@keyframes shelfDrop {
  0% { transform: scale(.6); opacity: .3; }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}

.shelf__photo.dropping {
  animation: shelfDrop .4s cubic-bezier(.22, 1, .36, 1);
}

.shelf__next {
  margin-top: 40px;
  width: 300px;
  max-width: 85vw;
  height: 56px;
  border-radius: 28px;
  background: var(--accent);
  color: var(--paper-2);
  font-family: 'Inter', 'Manrope', sans-serif;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(var(--accent-rgb), .3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .4s ease, transform .4s ease, visibility .4s;
}

.shelf__next.ready {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.shelf__next:hover {
  transform: translateY(-2px);
}

/* ===========================================
   АДАПТИВ — мобильный (max-width: 767px)
   =========================================== */
@media (max-width: 600px) {
  /* hero: широкие мобильные слои — заполнение по высоте + запас под параллакс */
  .layer {
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    object-fit: cover;
    object-position: center;
  }
  /* облака подняты выше — не перекрывают Кики */
  .clouds {
    top: -16%;
  }

  /* quiz */
  #quiz,
  #quiz2,
  #quiz3,
  #quiz4,
  #quiz5 {
    padding: 60px 24px 0;
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
  }
  .quiz__card {
    max-width: 326px;
    padding: 24px;
    border-radius: 24px;
  }
  .quiz__options {
    max-width: 326px;
    margin-top: 40px;
  }
  .quiz__option {
    height: 52px;
    border-radius: 26px;
  }

  /* polaroid */

  .polaroid {
    width: 350px;
    height: 330px;
  }

  .polaroid__frame {
    padding: 3px;
  }

  .polaroid__caption {
    font-size: 14px;
    max-width: 270px;
  }

  .polaroid__bottom {
    padding: 8px 12px 2px;
  }
  .polaroid__kiki {
    width: 82px;
    right: 15px;
    bottom: 12px;
  }

  /* shelf (отвлекалочка) */
  #shelf {
    padding: 50px 12px 32px;
  }
  .shelf__title {
    margin-bottom: 36px;
  }
  .shelf__slots {
    gap: 8px;
    margin-bottom: 44px;
  }
  .shelf__slot {
    width: 110px;
    height: 162px;
  }
  .shelf__slot--mid {
    width: 128px;
    height: 190px;
    margin-top: -22px;
  }
  .shelf__tray {
    gap: 8px;
    flex-wrap: nowrap;
  }
  .shelf__photo {
    width: 104px;
    height: 150px;
  }
  .shelf__next {
    margin-top: 32px;
  }
}

/* фоновые изображения секций — только на мобильных; на десктопе остаётся сплошной тон */
@media (max-width: 600px) {
  #vibe, #quiz, #quiz2, #quiz3, #quiz4, #quiz5 {
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: 100% auto;
  }
  /* лёгкий параллакс фона (сдвиг от наклона/курсора) */
  #quiz, #quiz2, #quiz3, #quiz4, #quiz5 {
    background-size: 106% auto;
    background-position: calc(50% + var(--px, 0) * -9px) bottom;
    transition: background-position .25s ease-out;
  }
  #vibe  {
    background-image: url("img/photo-anime/vibe-bg.png?v=2");
    justify-content: flex-start;   /* контент к верху → снизу видно больше фона */
    padding-top: 40px;
  }
  #quiz  { background-image: url("img/photo-anime/bg-questions-1.png?v=2"); }
  #quiz2 { background-image: url("img/photo-anime/bg-questions-2.png?v=2"); }
  #quiz3 { background-image: url("img/photo-anime/bg-questions-3.png?v=2"); }
  #quiz4 { background-image: url("img/photo-anime/bg-questions-4.png?v=2"); }
  #quiz5 { background-image: url("img/photo-anime/bg-questions-5.png?v=2"); }

  /* отвлекалочка — чистое изображение на весь фон, без заливки */
  #shelf {
    background-image: url("img/photo-anime/bg-distraction.png?v=2");
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: cover;
  }
}

/* ======== КВЕСТ: отклик, акварельные варианты, прогресс ======== */

/* варианты — акварельная заливка слева направо */
.quiz__options { position: relative; }
.quiz__option {
  background-image: linear-gradient(90deg, rgba(224,208,178,.95), rgba(236,224,199,.95));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  transition: background-size .4s ease, transform .2s, border .2s, box-shadow .2s;
}
.quiz__option:hover { background-size: 100% 100%; transform: translateY(-1px); }
.quiz__option.selected { background-size: 100% 100%; background-color: #fff; }

/* рисованный кружок вокруг выбранного варианта */
.opt-circle { position: absolute; pointer-events: none; z-index: 3; opacity: 0; overflow: visible; }
.opt-circle path {
  fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round;
}
.opt-circle.draw { opacity: 1; }
/* обводка запускается через Web Animations API в drawOptCircle (перезапуск на каждом выборе) */

/* карточка: верный / неверный ответ */
.quiz__card.correct { animation: card-pop .6s ease; }
@keyframes card-pop {
  0% { transform: scale(1); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
  30% { transform: scale(1.045); box-shadow: 0 0 0 6px rgba(255,205,110,.4), 0 12px 28px rgba(160,113,60,.28); }
  100% { transform: scale(1); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
}
.quiz__card.wrong { animation: card-shake .5s ease; }
@keyframes card-shake {
  0%,100% { transform: translateX(0); }
  15% { transform: translateX(-8px) rotate(-1deg); }
  30% { transform: translateX(7px) rotate(1deg); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

/* реакции вырезанного декора */
.card-decor img.hop { animation: decor-hop .6s ease; }
@keyframes decor-hop {
  0%,100% { transform: translateY(0) rotate(var(--rot,0deg)); }
  40% { transform: translateY(-15px) rotate(calc(var(--rot,0deg) - 8deg)); }
}
.card-decor img.wobble { animation: decor-wobble .5s ease; }
@keyframes decor-wobble {
  0%,100% { transform: rotate(var(--rot,0deg)); }
  25% { transform: rotate(calc(var(--rot,0deg) - 13deg)); }
  75% { transform: rotate(calc(var(--rot,0deg) + 13deg)); }
}

/* золотые искры */
.spark {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, #fffbe9 0%, #ffd166 45%, rgba(255,159,52,0) 70%);
  pointer-events: none; z-index: 6; will-change: transform, opacity;
}

/* холст конфетти финального «хлопка» (canvas-confetti) */
#confetti-canvas {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  pointer-events: none; z-index: 999;
}

/* холст искр-взрыва при нажатии на кнопки */
#fx-canvas {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  pointer-events: none; z-index: 998;
}

/* кнопка фоновой музыки */
.bgm-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 12px;
  z-index: 1000;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(92, 74, 56, .35);
  background: rgba(247, 240, 230, .8);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #5C4A38;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(60, 40, 20, .18);
  transition: transform .2s, background .2s, opacity .2s;
}
/* переключатель языка RU/EN */
.lang-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 60px;
  z-index: 1000;
  height: 40px;
  min-width: 40px;
  padding: 0 11px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 20px;
  border: 1.5px solid rgba(92, 74, 56, .35);
  background: rgba(247, 240, 230, .8);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #5C4A38;
  font-family: 'Rubik', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(60, 40, 20, .18);
  transition: transform .2s, background .2s;
}
.lang-toggle:hover { transform: translateY(-1px); background: rgba(247, 240, 230, .95); }
.lang-toggle:active { transform: scale(.94); }

.bgm-toggle:hover { transform: translateY(-1px); background: rgba(247, 240, 230, .95); }
.bgm-toggle:active { transform: scale(.94); }
.bgm-toggle .bgm-slash { display: none; }
.bgm-toggle.muted { opacity: .72; }
.bgm-toggle.muted .bgm-wave { opacity: .2; }
.bgm-toggle.muted .bgm-slash { display: block; }

/* индикатор прогресса */
.quiz__progress {
  position: absolute; top: 26px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 10px; z-index: 3; pointer-events: none;
}
.quiz__progress .pd {
  width: 9px; height: 9px; border-radius: 50%;
  background: #C9B79E; opacity: .5; transition: all .3s ease;
}
.quiz__progress .pd.done { background: var(--accent); opacity: 1; }
.quiz__progress .pd.current { background: #C58A3D; opacity: 1; transform: scale(1.5); box-shadow: 0 0 0 3px rgba(197,138,61,.22); }

@media (prefers-reduced-motion: reduce) {
  .quiz__card.correct, .quiz__card.wrong, .card-decor img.hop, .card-decor img.wobble { animation: none; }
}

/* ======== harden: доступность + управление модалками/полкой ======== */

/* полароид — явная кнопка «далее →» (не только тап по фону) */
.polaroid__next {
  display: block;
  margin: 8px auto 2px;
  padding: 10px 28px;
  border: none;
  border-radius: 22px;
  background: var(--accent);
  color: var(--paper-2);
  font-family: 'Inter', 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(var(--accent-rgb), .3);
  transition: transform .2s, box-shadow .2s;
}
.polaroid__next:hover { transform: translateY(-2px); box-shadow: 0 9px 20px rgba(var(--accent-rgb), .34); }

/* полка — подсказка и пульс пустых ячеек после выбора фото */
.shelf__hint {
  font-family: 'Quicksand', sans-serif;
  font-size: 13px;
  color: #8A7B6C;
  text-align: center;
  margin: 6px 0 30px;
}
.shelf__hint #shelfCount { font-weight: 700; color: #6E5B47; }
.shelf__slot.pulse { animation: shelf-pulse 1.4s ease-in-out infinite; }
@keyframes shelf-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(197, 138, 61, 0); }
  50%      { box-shadow: 0 0 0 6px rgba(197, 138, 61, .28); }
}

/* тап не выделяет текст */
.quiz__option, .vibe__card, .shelf__photo, .shelf__slot, .hero-live,
.quiz__next, .shelf__next, .birthday__btn, .open-btn, .wish__send, .wish__skip,
.hint-retry, .hint-giveup, .polaroid__next, .final__finish, .final__restart {
  -webkit-user-select: none;
  user-select: none;
}

/* видимый фокус с клавиатуры — в тон палитре */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}
.vibe__card:focus-visible, .quiz__option:focus-visible, .shelf__photo:focus-visible {
  outline-offset: 4px;
}
