/* ==========================================================================
   ATELIER PAPER & BOTANICAL LETTERPRESS — СТИЛИ ПОДАРКА
   ========================================================================== */

:root {
  --paper-base: #F8F3EC;
  --paper-warm: #F2EAE0;
  --paper-card: #FDFBF7;
  --paper-tint: #F6ECE6;
  --ink-primary: #2C1B1E;
  --ink-secondary: #6D5458;
  --ink-muted: #988084;
  --carmine: #A83E54;
  --carmine-hover: #963448;
  --burgundy: #7E253A;
  --rose-wash: #E7B3BC;
  --gold: #C59B6D;
  --gold-light: #E3C79E;
  --sage: #7F9279;
  --hairline: rgba(112, 74, 80, 0.16);
  --hairline-gold: rgba(197, 155, 109, 0.38);
  --shadow-paper: 0 18px 44px rgba(56, 30, 35, 0.09), 0 2px 8px rgba(56, 30, 35, 0.05);
  --shadow-card: 0 12px 30px rgba(56, 30, 35, 0.08), 0 1px 4px rgba(56, 30, 35, 0.04);
  --shadow-btn: 0 10px 24px rgba(126, 37, 58, 0.22);
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease-atelier: cubic-bezier(0.19, 1, 0.22, 1);
  --quest-warmth: 0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: linear-gradient(160deg, var(--paper-base) 0%, var(--paper-warm) 100%);
  color: var(--ink-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

/* ==========================================================================
   ФОН: БУМАГА АТЕЛЬЕ И МЯГКИЕ АКВАРЕЛЬНЫЕ ОТМЫВКИ (БЕЗ BLUR-ФИЛЬТРОВ)
   ========================================================================== */

.atelier-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.paper-wash {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}

.wash-1 {
  width: min(78vw, 760px);
  height: min(78vw, 760px);
  top: -18%;
  left: -14%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(231, 179, 188, 0.32) 0%,
    rgba(231, 179, 188, 0.14) 38%,
    rgba(231, 179, 188, 0) 72%
  );
  animation: washDriftA 26s ease-in-out infinite alternate;
}

.wash-2 {
  width: min(72vw, 700px);
  height: min(72vw, 700px);
  top: 8%;
  right: -16%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(227, 199, 158, 0.28) 0%,
    rgba(227, 199, 158, 0.11) 42%,
    rgba(227, 199, 158, 0) 72%
  );
  animation: washDriftB 31s ease-in-out infinite alternate;
}

.wash-3 {
  width: min(76vw, 740px);
  height: min(76vw, 740px);
  bottom: -24%;
  left: 14%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(197, 155, 109, 0.16) 0%,
    rgba(231, 179, 188, 0.12) 38%,
    rgba(231, 179, 188, 0) 72%
  );
  animation: washDriftA 34s ease-in-out infinite alternate-reverse;
}

.paper-warmth-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 45%,
    rgba(227, 199, 158, 0.42) 0%,
    rgba(231, 179, 188, 0.24) 48%,
    rgba(168, 62, 84, 0.08) 100%
  );
  opacity: calc(var(--quest-warmth, 0) * 0.65);
  transition: opacity 0.6s ease;
}

.paper-grain {
  position: absolute;
  inset: 0;
  opacity: 0.24;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.16'/%3E%3C/svg%3E");
}

.paper-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(44, 27, 30, 0) 58%,
    rgba(88, 52, 58, 0.07) 100%
  );
}

@keyframes washDriftA {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(34px, -22px, 0) scale(1.06);
  }
}

@keyframes washDriftB {
  0% {
    transform: translate3d(0, 0, 0) scale(1.03);
  }
  100% {
    transform: translate3d(-28px, 26px, 0) scale(0.97);
  }
}

#petals-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ==========================================================================
   ВЕРХНЯЯ ПАНЕЛЬ: РЕДАКЦИОННАЯ НАВИГАЦИЯ ПО ГЛАВАМ И ЗВУК
   ========================================================================== */

.top-bar {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 40;
}

.stage-dots {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(253, 251, 247, 0.92);
  border: 1px solid var(--hairline);
  box-shadow: 0 6px 20px rgba(44, 27, 30, 0.06);
}

.dot-rail {
  width: 12px;
  height: 1px;
  background: var(--hairline);
  flex-shrink: 0;
}

.stage-dot {
  position: relative;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.25s ease, background-color 0.25s ease, transform 0.22s var(--ease-atelier);
}

.stage-dot:disabled {
  cursor: default;
  opacity: 0.4;
}

.stage-dot.is-unlocked:not(:disabled):hover {
  color: var(--carmine);
  transform: translate3d(0, -1px, 0);
}

.stage-dot.is-active {
  background: var(--carmine);
  color: var(--paper-card);
  box-shadow: 0 3px 10px rgba(168, 62, 84, 0.28);
}

.icon-btn {
  pointer-events: auto;
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: rgba(253, 251, 247, 0.92);
  color: var(--ink-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(44, 27, 30, 0.06);
  transition: transform 0.25s var(--ease-atelier), border-color 0.25s ease, color 0.25s ease;
}

.icon-btn:hover {
  transform: translate3d(0, -1px, 0);
  border-color: var(--hairline-gold);
  color: var(--carmine);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn .icon-sound-off {
  display: none;
}

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

.icon-btn.is-muted .icon-sound-off {
  display: block;
  color: var(--ink-muted);
}

.audio-bars {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 4px;
  opacity: 0.75;
}

.audio-bars span {
  width: 1.5px;
  height: 3px;
  border-radius: 1px;
  background: var(--carmine);
  animation: barPulse 1.1s ease-in-out infinite;
}

.audio-bars span:nth-child(2) {
  animation-delay: 0.2s;
  height: 4px;
}

.audio-bars span:nth-child(3) {
  animation-delay: 0.4s;
}

.icon-btn.is-muted .audio-bars {
  display: none;
}

@keyframes barPulse {
  0%, 100% {
    transform: scaleY(0.45);
  }
  50% {
    transform: scaleY(1);
  }
}

/* ==========================================================================
   БАЗОВЫЕ ЭКРАНЫ И ТИПОГРАФИКА
   ========================================================================== */

#app {
  position: relative;
  width: 100%;
  height: 100dvh;
  z-index: 2;
}

.stage {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 14px, 0) scale(0.992);
  will-change: opacity, transform;
  transition: opacity 0.6s var(--ease-atelier),
              transform 0.65s var(--ease-atelier),
              visibility 0.6s;
}

.stage.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

.stage-scrollable {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(74px + env(safe-area-inset-top)) 18px calc(40px + env(safe-area-inset-bottom));
}

.paper-card {
  position: relative;
  background: var(--paper-card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  box-shadow: var(--shadow-paper);
}

.paper-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 11px;
  border: 1px solid rgba(197, 155, 109, 0.26);
  pointer-events: none;
}

.editorial-eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 100%;
}

.eyebrow-line {
  width: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
  flex-shrink: 0;
}

.editorial-eyebrow .eyebrow-line:last-child {
  background: linear-gradient(90deg, var(--gold), transparent);
}

.eyebrow-text {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--carmine);
}

.display-title {
  margin: 10px 0 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 4.8vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--ink-primary);
}

.subtitle-text {
  margin: 0;
  font-size: clamp(0.92rem, 2.1vw, 1.02rem);
  line-height: 1.55;
  color: var(--ink-secondary);
}

/* Тактильные кнопки в стиле ателье */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 12px 24px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  user-select: none;
  transition: transform 0.28s var(--ease-atelier),
              box-shadow 0.28s ease,
              background-color 0.25s ease,
              border-color 0.25s ease,
              opacity 0.25s ease;
}

.btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 75%;
  height: 100%;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 245, 232, 0.26) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translate3d(0, 0, 0);
  transition: transform 0.65s var(--ease-atelier);
  pointer-events: none;
}

.btn:hover:not(:disabled)::after {
  transform: translate3d(290%, 0, 0);
}

.btn:focus-visible,
.stage-dot:focus-visible,
.icon-btn:focus-visible,
.envelope:focus-visible {
  outline: 2px solid var(--carmine);
  outline-offset: 3px;
}

.btn:active:not(:disabled) {
  transform: translate3d(0, 1px, 0) scale(0.985);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-lg {
  min-height: 50px;
  padding: 13px 32px;
  font-size: 0.98rem;
}

.btn-primary {
  background: linear-gradient(160deg, var(--carmine) 0%, var(--burgundy) 100%);
  border-color: rgba(255, 236, 224, 0.22);
  color: #FDFBF7;
  box-shadow: var(--shadow-btn), inset 0 1px 0 rgba(255, 244, 234, 0.22);
}

.btn-primary:hover:not(:disabled) {
  transform: translate3d(0, -2px, 0);
  box-shadow: 0 14px 28px rgba(126, 37, 58, 0.28), inset 0 1px 0 rgba(255, 244, 234, 0.26);
}

.btn-accent {
  background: var(--paper-card);
  border-color: rgba(168, 62, 84, 0.34);
  color: var(--carmine);
  box-shadow: 0 6px 18px rgba(44, 27, 30, 0.06);
}

.btn-accent:hover:not(:disabled) {
  background: #FFFFFF;
  border-color: var(--carmine);
  transform: translate3d(0, -2px, 0);
}

.btn-soft {
  background: var(--paper-card);
  border-color: var(--hairline);
  color: var(--ink-primary);
  box-shadow: 0 4px 12px rgba(44, 27, 30, 0.04);
}

.btn-soft:hover:not(:disabled) {
  background: #FFFFFF;
  border-color: var(--hairline-gold);
  transform: translate3d(0, -1px, 0);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(168, 62, 84, 0.06);
  color: var(--carmine);
}

.btn-pulse {
  border-color: var(--gold-light);
  box-shadow: 0 12px 28px rgba(168, 62, 84, 0.3), 0 0 0 1px rgba(197, 155, 109, 0.42);
}

.is-hidden {
  display: none !important;
}

/* ==========================================================================
   ЭТАП 0: МИНИ-КВЕСТ «СОГРЕЙ ЭКРАН»
   ========================================================================== */

.quest-layout {
  position: relative;
  width: 100%;
  height: 100%;
  padding: calc(74px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
}

.quest-header {
  width: 100%;
  max-width: 520px;
  padding: 6px 12px 10px;
  text-align: center;
  z-index: 4;
}

.quest-progress-wrap {
  margin: 18px auto 0;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.quest-progress-track {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(112, 74, 80, 0.14);
  overflow: hidden;
}

.quest-progress-fill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--carmine) 100%);
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
  transition: transform 0.48s var(--ease-atelier);
}

.quest-counter {
  min-width: 46px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--carmine);
  text-align: right;
  transition: transform 0.25s var(--ease-atelier);
}

.quest-counter.is-popping {
  animation: counterPop 0.36s var(--ease-atelier);
}

@keyframes counterPop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.26);
  }
  100% {
    transform: scale(1);
  }
}

.quest-arena {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 980px;
  min-height: 240px;
  margin-top: 6px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.quest-fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.quest-word-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.quest-complete-banner {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate3d(-50%, -50%, 0) scale(0.86);
  width: min(88vw, 480px);
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(2rem, 5.8vw, 3.1rem);
  font-weight: 600;
  line-height: 1.12;
  color: var(--burgundy);
  text-shadow: 0 4px 24px rgba(248, 243, 236, 0.98), 0 0 36px rgba(253, 251, 247, 0.95);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.55s ease, transform 0.65s var(--ease-atelier);
}

.quest-complete-banner.is-visible {
  opacity: 1;
  transform: translate3d(-50%, -50%, 0) scale(1);
}

.quest-heart {
  position: absolute;
  left: 0;
  top: 0;
  width: 74px;
  height: 74px;
  padding: 11px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform, opacity;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  z-index: 2;
}

.quest-heart svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 14px rgba(126, 37, 58, 0.18));
  transition: filter 0.22s ease;
}

.quest-heart.is-charging svg {
  filter: drop-shadow(0 0 18px rgba(197, 155, 109, 0.72)) drop-shadow(0 8px 18px rgba(168, 62, 84, 0.36));
}

.quest-heart.is-caught {
  pointer-events: none;
}

.floating-hint {
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-secondary);
  text-shadow: 0 2px 10px rgba(248, 243, 236, 0.96);
  white-space: nowrap;
  pointer-events: none;
  will-change: transform, opacity;
  animation: hintRise 1.05s var(--ease-atelier) forwards;
}

@keyframes hintRise {
  0% {
    opacity: 0;
    transform: translate3d(-50%, -25%, 0) scale(0.92);
  }
  20% {
    opacity: 1;
    transform: translate3d(-50%, -60%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate3d(-50%, -115%, 0) scale(0.98);
  }
}

.floating-word {
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.5rem, 4vw, 2.05rem);
  font-weight: 500;
  color: var(--burgundy);
  text-shadow: 0 2px 14px rgba(248, 243, 236, 0.96);
  white-space: nowrap;
  pointer-events: none;
  will-change: transform, opacity;
  animation: wordRise 1.35s var(--ease-atelier) forwards;
}

@keyframes wordRise {
  0% {
    opacity: 0;
    transform: translate3d(-50%, -18%, 0) scale(0.84);
  }
  22% {
    opacity: 1;
    transform: translate3d(-50%, -62%, 0) scale(1.03);
  }
  100% {
    opacity: 0;
    transform: translate3d(-50%, -145%, 0) scale(0.98);
  }
}

/* ==========================================================================
   ЭТАП 1: ЖИВОЙ АКВАРЕЛЬНЫЙ ХОЛСТ
   ========================================================================== */

#stage-canvas {
  overflow: hidden;
}

#love-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.parchment-ribbon {
  position: absolute;
  top: calc(74px + env(safe-area-inset-top));
  left: 50%;
  transform: translate3d(-50%, 0, 0);
  max-width: min(90vw, 520px);
  padding: 8px 20px;
  border-radius: 999px;
  background: rgba(253, 251, 247, 0.92);
  border: 1px solid var(--hairline);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-secondary);
  text-align: center;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(44, 27, 30, 0.06);
  transition: opacity 0.45s ease, transform 0.45s var(--ease-atelier);
  z-index: 5;
}

.parchment-ribbon.is-faded {
  opacity: 0;
  transform: translate3d(-50%, -10px, 0);
}

.heart-message {
  position: absolute;
  top: 47%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0) scale(0.9);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  width: min(76vw, 350px);
  transition: opacity 1s ease, transform 1s var(--ease-atelier);
  z-index: 5;
}

.heart-message.is-visible {
  opacity: 1;
  transform: translate3d(-50%, -50%, 0) scale(1);
}

.heart-name {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(2.25rem, 6.2vw, 3.35rem);
  font-weight: 600;
  line-height: 1.05;
  color: var(--burgundy);
  text-shadow: 0 2px 22px rgba(248, 243, 236, 0.98), 0 0 32px rgba(253, 251, 247, 0.95);
}

.heart-filigree {
  display: block;
  width: 112px;
  height: 14px;
  margin: 6px auto 4px;
  color: var(--gold);
}

.heart-sub {
  margin: 0;
  font-size: clamp(0.88rem, 2.2vw, 1rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-primary);
  text-shadow: 0 1px 14px rgba(248, 243, 236, 0.98);
}

.canvas-controls {
  position: absolute;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translate3d(-50%, 0, 0);
  width: min(94vw, 560px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  z-index: 6;
}

/* ==========================================================================
   ЭТАП 2: СКРЕТЧ-КАРТОЧКИ
   ========================================================================== */

.scratch-fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 25;
}

.section-shell {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.section-header {
  text-align: center;
  max-width: 560px;
  margin-bottom: 24px;
}

.progress-chip {
  display: inline-block;
  margin-top: 14px;
  padding: 5px 16px;
  border-radius: 999px;
  background: var(--paper-card);
  border: 1px solid var(--hairline);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--carmine);
  box-shadow: 0 4px 12px rgba(44, 27, 30, 0.04);
}

.scratch-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 74px;
  margin-top: 46px;
  perspective: 900px;
}

.scratch-card-wrap {
  position: relative;
  display: flex;
}

.scratch-card {
  position: relative;
  width: 100%;
  z-index: 2;
  min-height: 255px;
  border-radius: 14px;
  background: var(--paper-card);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  transform-style: preserve-3d;
  will-change: transform;
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
}

.scratch-card.is-revealed {
  border-color: var(--hairline-gold);
  box-shadow: 0 18px 36px rgba(126, 37, 58, 0.11), 0 2px 8px rgba(44, 27, 30, 0.05);
}

.scratch-underneath {
  position: relative;
  width: 100%;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  background:
    radial-gradient(circle at 90% 10%, rgba(231, 179, 188, 0.16), transparent 55%),
    radial-gradient(circle at 10% 92%, rgba(227, 199, 158, 0.16), transparent 52%),
    var(--paper-card);
}

.scratch-underneath::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 9px;
  border: 1px solid rgba(112, 74, 80, 0.1);
  pointer-events: none;
}

/* Купоны в виде винтажных билетов с перфорацией */
.scratch-card.is-coupon {
  background: #FBF6EF;
}

.scratch-card.is-coupon .scratch-underneath {
  margin: 8px;
  border-radius: 10px;
  border: 1.25px dashed rgba(197, 155, 109, 0.68);
  background: linear-gradient(155deg, #FDF9F3 0%, #F7EDE6 100%);
}

.scratch-card.is-coupon .scratch-underneath::before {
  inset: 4px;
  border-radius: 6px;
  border: 1px solid rgba(197, 155, 109, 0.22);
}

.coupon-serial {
  position: absolute;
  top: 10px;
  right: 13px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--gold);
  letter-spacing: 0.06em;
}

.card-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--carmine);
  border-bottom: 1px solid rgba(197, 155, 109, 0.45);
  padding-bottom: 3px;
}

.card-emblem {
  width: 48px;
  height: 48px;
  margin-top: 2px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFFDF9 0%, #F4E9DF 100%);
  border: 1px solid var(--hairline-gold);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.9), 0 4px 10px rgba(44, 27, 30, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
}

.card-title {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 1.48rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink-primary);
}

.card-text {
  margin: 0;
  font-size: 0.89rem;
  line-height: 1.52;
  color: var(--ink-secondary);
}

.card-photo-wrap {
  width: 100%;
  max-width: 168px;
  padding: 6px 6px 14px;
  background: #FFFFFF;
  border: 1px solid rgba(112, 74, 80, 0.12);
  border-radius: 4px;
  box-shadow: 0 8px 18px rgba(44, 27, 30, 0.1);
  transform: rotate(-1.5deg);
}

.card-photo-wrap img {
  display: block;
  width: 100%;
  height: 102px;
  object-fit: cover;
  border-radius: 2px;
}

.coupon-claim-btn {
  margin-top: 6px;
  padding: 6px 15px;
  border-radius: 999px;
  border: 1px solid rgba(197, 155, 109, 0.65);
  background: #FFFDF9;
  color: var(--carmine);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.22s var(--ease-atelier), border-color 0.25s ease;
}

.coupon-claim-btn:hover:not(:disabled) {
  background: var(--carmine);
  border-color: var(--carmine);
  color: #FFFDF9;
  transform: translate3d(0, -1px, 0);
}

.coupon-claim-btn:disabled {
  cursor: default;
  background: rgba(168, 62, 84, 0.08);
  border-color: rgba(168, 62, 84, 0.28);
  color: var(--burgundy);
}

.coupon-stamp {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 5px 9px;
  border: 1.8px solid rgba(168, 62, 84, 0.78);
  border-radius: 6px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.05;
  text-align: center;
  white-space: pre-line;
  color: rgba(168, 62, 84, 0.86);
  background: rgba(253, 251, 247, 0.72);
  pointer-events: none;
  opacity: 0;
  transform: rotate(-12deg) scale(1.8);
}

.scratch-card.is-claimed .coupon-stamp {
  animation: stampSlam 0.44s var(--ease-atelier) forwards;
}

@keyframes stampSlam {
  0% {
    opacity: 0;
    transform: rotate(-18deg) scale(2);
  }
  70% {
    opacity: 0.95;
    transform: rotate(-9deg) scale(0.95);
  }
  100% {
    opacity: 0.88;
    transform: rotate(-11deg) scale(1);
  }
}

.scratch-foil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  transition: opacity 0.55s var(--ease-atelier), transform 0.55s var(--ease-atelier);
  z-index: 2;
}

.scratch-foil:active {
  cursor: grabbing;
}

.scratch-card.is-revealed .scratch-foil {
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}

.section-footer {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.scratch-lock-hint {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.96rem;
  color: var(--ink-muted);
  transition: opacity 0.35s ease;
}

/* ==========================================================================
   ЭТАП 3: ШУТОЧНЫЙ ВОПРОС С ПРУЖИННОЙ КНОПКОЙ
   ========================================================================== */

#stage-question {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(74px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom));
}

.question-card {
  width: 100%;
  max-width: 540px;
  padding: 30px 28px 26px;
  text-align: center;
}

.question-art {
  width: 176px;
  margin: 0 auto 8px;
}

.botanical-hearts-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.botanical-heart-l {
  transform-origin: 90px 60px;
  animation: botanicalSwayL 3.6s ease-in-out infinite;
}

.botanical-heart-r {
  transform-origin: 130px 60px;
  animation: botanicalSwayR 3.6s ease-in-out infinite;
}

.sparkle {
  transform-box: fill-box;
  transform-origin: center;
  animation: sparkleTwinkle 2.6s ease-in-out infinite;
}

.sparkle.s2 {
  animation-delay: 0.8s;
}

.sparkle.s3 {
  animation-delay: 1.5s;
}

@keyframes botanicalSwayL {
  0%, 100% {
    transform: rotate(-2.5deg) translate3d(0, 0, 0);
  }
  50% {
    transform: rotate(1.8deg) translate3d(0, -2.5px, 0);
  }
}

@keyframes botanicalSwayR {
  0%, 100% {
    transform: rotate(2.5deg) translate3d(0, 0, 0);
  }
  50% {
    transform: rotate(-1.5deg) translate3d(0, -2.5px, 0);
  }
}

@keyframes sparkleTwinkle {
  0%, 100% {
    opacity: 0.35;
    transform: scale(0.78);
  }
  50% {
    opacity: 1;
    transform: scale(1.18);
  }
}

.question-title {
  font-size: clamp(1.7rem, 4.2vw, 2.35rem);
}

.question-reaction {
  min-height: 24px;
  margin: 14px 0 4px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--carmine);
  transition: opacity 0.25s ease;
}

.question-arena {
  position: relative;
  width: 100%;
  min-height: 185px;
  margin-top: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16px;
}

.btn-yes {
  position: relative;
  z-index: 2;
  will-change: transform;
  transition: transform 0.38s var(--ease-atelier), box-shadow 0.3s ease;
}

.btn-no {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  min-width: 104px;
  white-space: nowrap;
  will-change: transform;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* ==========================================================================
   ЭТАП 4: ФИНАЛ — ЛЬНЯНОЙ КОНВЕРТ, СУРГУЧ, ПИСЬМО И САЛЮТ
   ========================================================================== */

#finale-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.finale-shell {
  position: relative;
  z-index: 12;
  width: 100%;
  max-width: 650px;
  min-height: calc(100dvh - 120px - env(safe-area-inset-top));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.envelope-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  perspective: 1100px;
  transition: opacity 0.55s ease, transform 0.55s var(--ease-atelier);
}

.envelope-wrapper.is-fading {
  opacity: 0;
  transform: translate3d(0, -16px, 0) scale(0.95);
  pointer-events: none;
}

.envelope {
  position: relative;
  width: min(84vw, 326px);
  height: min(55vw, 214px);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transform-style: preserve-3d;
  will-change: transform;
  filter: drop-shadow(0 22px 34px rgba(56, 30, 35, 0.16));
}

.envelope-back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(160deg, #EDE0D2 0%, #E4D2C1 100%);
  border: 1px solid rgba(112, 74, 80, 0.2);
}

.envelope-liner {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 6px;
  height: 55%;
  border-radius: 6px 6px 0 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(197, 155, 109, 0.25) 1px, transparent 1.5px) 0 0 / 16px 16px,
    linear-gradient(180deg, #9C3A4E 0%, #7E253A 100%);
  opacity: 0.92;
  z-index: 1;
}

.envelope-letter-peek {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 14%;
  bottom: 10%;
  border-radius: 6px;
  background: var(--paper-card);
  border: 1px solid rgba(197, 155, 109, 0.35);
  box-shadow: 0 4px 14px rgba(44, 27, 30, 0.08);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: transform 0.78s var(--ease-atelier) 0.18s;
  z-index: 2;
}

.peek-monogram {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--gold);
  line-height: 1;
}

.peek-line {
  display: block;
  width: 78%;
  height: 2px;
  border-radius: 999px;
  background: rgba(168, 62, 84, 0.18);
}

.peek-line.short {
  width: 48%;
}

.envelope-pocket-left,
.envelope-pocket-right,
.envelope-pocket-bottom {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.envelope-pocket-left {
  background: linear-gradient(115deg, #F6EDE3 0%, #EFE2D4 100%);
  clip-path: polygon(0 0, 52% 52%, 0 100%);
  border-radius: 10px;
}

.envelope-pocket-right {
  background: linear-gradient(245deg, #F3E8DC 0%, #EADACC 100%);
  clip-path: polygon(100% 0, 48% 52%, 100% 100%);
  border-radius: 10px;
}

.envelope-pocket-bottom {
  background: linear-gradient(180deg, #FAF3EB 0%, #EFE2D5 100%);
  clip-path: polygon(0 100%, 50% 45%, 100% 100%);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 59%;
  background: linear-gradient(180deg, #F9F2EA 0%, #EDE0D2 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 10px 10px 0 0;
  transform-origin: top center;
  transition: transform 0.72s var(--ease-atelier);
  z-index: 4;
}

.wax-seal {
  position: absolute;
  left: 50%;
  top: 53%;
  transform: translate3d(-50%, -50%, 0);
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  filter: drop-shadow(0 6px 12px rgba(94, 25, 41, 0.34));
  transition: transform 0.45s var(--ease-atelier), opacity 0.38s ease;
}

.wax-seal-svg {
  width: 100%;
  height: 100%;
}

.envelope.is-open .envelope-flap {
  transform: rotateX(178deg);
  z-index: 1;
}

.envelope.is-open .wax-seal {
  transform: translate3d(-50%, -50%, 0) scale(0.55) rotate(-14deg);
  opacity: 0;
}

.envelope.is-open .envelope-letter-peek {
  transform: translate3d(0, -54px, 0);
}

.envelope-hint {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.12rem;
  font-weight: 500;
  color: var(--ink-secondary);
  text-align: center;
}

/* Раскрытое письмо на хлопковой бумаге */
.letter-card {
  position: relative;
  width: 100%;
  padding: 36px 34px 30px;
  border-radius: 14px;
  background: linear-gradient(175deg, #FFFDF9 0%, #FAF4EC 100%);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-paper);
  animation: letterReveal 0.8s var(--ease-atelier) both;
}

.letter-card::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 8px;
  border: 1px solid rgba(197, 155, 109, 0.32);
  pointer-events: none;
}

@keyframes letterReveal {
  0% {
    opacity: 0;
    transform: translate3d(0, 26px, 0) scale(0.965);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.letter-ornament {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.flower-divider {
  width: 164px;
  height: auto;
}

.letter-greeting {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.9rem, 4.6vw, 2.5rem);
  font-weight: 500;
  color: var(--burgundy);
}

.letter-body p {
  margin: 0 0 16px;
  font-size: clamp(0.96rem, 2.2vw, 1.05rem);
  line-height: 1.76;
  color: var(--ink-primary);
  opacity: 0;
  animation: paragraphFade 0.7s var(--ease-atelier) forwards;
  animation-delay: calc(0.24s + var(--p-index, 0) * 0.14s);
}

@keyframes paragraphFade {
  0% {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.letter-photos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin: 26px 0 10px;
}

.polaroid-frame {
  position: relative;
  width: 172px;
  padding: 8px 8px 15px;
  background: #FFFFFF;
  border: 1px solid rgba(112, 74, 80, 0.12);
  border-radius: 4px;
  box-shadow: 0 12px 26px rgba(44, 27, 30, 0.11);
  transform: rotate(-2deg);
  transition: transform 0.35s var(--ease-atelier), box-shadow 0.35s ease;
}

.polaroid-frame::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(-1.5deg);
  width: 54px;
  height: 16px;
  background: rgba(227, 199, 158, 0.56);
  border: 1px solid rgba(197, 155, 109, 0.25);
  border-radius: 1px;
}

.polaroid-frame:nth-child(even) {
  transform: rotate(2.2deg);
}

.polaroid-frame:hover {
  transform: rotate(0deg) scale(1.03);
  box-shadow: 0 16px 32px rgba(44, 27, 30, 0.15);
}

.polaroid-frame img {
  display: block;
  width: 100%;
  height: 145px;
  object-fit: cover;
  border-radius: 2px;
}

.polaroid-caption {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-secondary);
  text-align: center;
}

/* Церемония со свечой и счётчик дней вместе */
.candle-ceremony {
  width: 100%;
  max-width: 470px;
  padding: 28px 24px 26px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.55s ease, transform 0.55s var(--ease-atelier);
}

.candle-ceremony.is-fading {
  opacity: 0;
  transform: translate3d(0, -16px, 0) scale(0.96);
  pointer-events: none;
}

.candle-title {
  font-size: clamp(1.75rem, 4.2vw, 2.3rem);
}

.candle-trigger {
  margin: 10px 0 12px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.cake-svg {
  width: 196px;
  height: auto;
  overflow: visible;
}

.candle-flame {
  transform-origin: 110px 58px;
  animation: flameFlicker 1.3s ease-in-out infinite alternate;
  transition: opacity 0.35s ease, transform 0.25s ease;
}

.candle-flame.is-blowing {
  animation: none;
  transform: skewX(-18deg) scale(0.88, 0.78);
}

.candle-flame.is-blown {
  animation: none;
  opacity: 0;
  transform: scale(0.3) translate3d(6px, -8px, 0);
}

@keyframes flameFlicker {
  0% {
    transform: scale(0.96, 1.03) rotate(-1.5deg);
  }
  50% {
    transform: scale(1.04, 0.96) rotate(1.5deg);
  }
  100% {
    transform: scale(0.98, 1.05) rotate(-0.8deg);
  }
}

.candle-wish-msg {
  min-height: 24px;
  margin: 14px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--carmine);
  opacity: 0;
  transform: translate3d(0, 6px, 0);
  transition: opacity 0.45s ease, transform 0.45s var(--ease-atelier);
}

.candle-wish-msg.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.together-counter {
  margin: 20px auto 4px;
  padding: 12px 18px;
  border-top: 1px solid rgba(197, 155, 109, 0.3);
  border-bottom: 1px solid rgba(197, 155, 109, 0.3);
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.08rem, 2.5vw, 1.25rem);
  line-height: 1.45;
  color: var(--ink-primary);
}

.together-counter strong {
  font-weight: 600;
  color: var(--burgundy);
}

.together-counter-date {
  display: block;
  margin-top: 2px;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.letter-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(197, 155, 109, 0.36);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.letter-signature {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.52rem;
  font-weight: 600;
  color: var(--burgundy);
}

.letter-date {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.finale-actions {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.hug-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  width: clamp(200px, 50vw, 290px);
  pointer-events: none;
  z-index: 60;
  opacity: 0;
  transform: translate3d(-50%, -44%, 0) scale(0.68);
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  transition: opacity 0.34s ease, transform 0.56s var(--ease-atelier);
}

.hug-popup img {
  display: block;
  width: 100%;
  max-height: 46dvh;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 30px rgba(44, 27, 30, 0.28));
  transform-origin: 50% 50%;
  will-change: transform;
}

.hug-popup.is-visible {
  opacity: 1;
  transform: translate3d(-50%, -50%, 0) scale(1);
}

.hug-popup.is-visible img {
  animation: hugCuddle 1.35s ease-in-out infinite alternate;
}

@keyframes hugCuddle {
  0% {
    transform: translate3d(0, 0, 0) rotate(-2.2deg) scale(1);
  }
  100% {
    transform: translate3d(0, -5px, 0) rotate(2.2deg) scale(1.035);
  }
}

.hug-toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translate3d(-50%, 16px, 0);
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--ink-primary);
  border: 1px solid rgba(227, 199, 158, 0.32);
  color: var(--paper-card);
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 12px 28px rgba(44, 27, 30, 0.25);
  transition: opacity 0.32s ease, transform 0.32s var(--ease-atelier);
  z-index: 61;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hug-toast.is-visible {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
}

/* ==========================================================================
   MILK & MOCHA — ФОНОВЫЕ И КАМЕО-АНИМАЦИИ НА БУМАГЕ
   ========================================================================== */

.mm-hidden {
  display: none !important;
}

.mm-ambient {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  width: clamp(104px, 13vw, 152px);
  opacity: 0.54;
  will-change: transform, opacity;
  animation: mmFloat 7.5s ease-in-out infinite alternate;
  transition: opacity 0.6s ease, transform 0.6s var(--ease-atelier);
}

.mm-ambient img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  mix-blend-mode: multiply;
  -webkit-mask-image: radial-gradient(ellipse 84% 84% at 50% 50%, #000 72%, transparent 100%);
  mask-image: radial-gradient(ellipse 84% 84% at 50% 50%, #000 72%, transparent 100%);
}

@keyframes mmFloat {
  0% {
    transform: translate3d(0, 0, 0) rotate(-1.5deg);
  }
  100% {
    transform: translate3d(0, -8px, 0) rotate(1.5deg);
  }
}

.mm-quest-left {
  left: max(18px, 4vw);
  bottom: max(18px, env(safe-area-inset-bottom));
}

.mm-quest-right {
  right: max(18px, 4vw);
  bottom: max(22px, env(safe-area-inset-bottom));
  animation-delay: -3.2s;
}

.mm-canvas-corner-left {
  left: max(18px, 3vw);
  top: calc(74px + env(safe-area-inset-top));
  width: clamp(88px, 10.5vw, 128px);
  opacity: 0.3;
  animation-delay: -2.1s;
}

.mm-canvas-corner {
  right: max(18px, 3vw);
  top: calc(74px + env(safe-area-inset-top));
  width: clamp(92px, 11vw, 134px);
  opacity: 0.34;
}

.mm-canvas-corner.is-heart-mode,
.mm-canvas-corner-left.is-heart-mode {
  opacity: 0.64;
}

/* Выглядывающие из-за карточек и конверта Milk & Mocha (чёткие прозрачные PNG поверх рамки) */
.mm-peek,
.mm-card-peek {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

.mm-peek img,
.mm-card-peek img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(44, 27, 30, 0.14));
}

.mm-card-peek {
  bottom: calc(100% - 10px);
  width: 108px;
  opacity: 1;
  transform: translate3d(0, 6px, 0);
  transition: transform 0.6s var(--ease-atelier);
}

.mm-peek-tr {
  right: 16px;
}

.mm-peek-tl {
  left: 16px;
}

.scratch-card-wrap.is-revealed .mm-card-peek {
  transform: translate3d(0, -4px, 0) scale(1.05);
}

.question-stage-wrap {
  position: relative;
  width: 100%;
  max-width: 540px;
  margin-top: 38px;
}

.question-stage-wrap .question-card {
  position: relative;
  z-index: 2;
}

.mm-peek-question {
  bottom: calc(100% - 10px);
  right: 24px;
  width: 112px;
  transition: transform 0.35s var(--ease-atelier);
}

.mm-peek-question.is-hopping {
  animation: mmPeekHop 0.42s var(--ease-atelier);
}

.mm-peek-quest {
  bottom: -4px;
  left: 50%;
  width: 118px;
  z-index: 4;
  transform: translate3d(-50%, 0, 0);
}

.mm-peek-quest.is-hopping {
  animation: mmQuestHop 0.48s var(--ease-atelier);
}

@keyframes mmQuestHop {
  0%, 100% {
    transform: translate3d(-50%, 0, 0) scale(1);
  }
  45% {
    transform: translate3d(-50%, -12px, 0) scale(1.06);
  }
}

@keyframes mmPeekHop {
  0%, 100% {
    transform: translate3d(0, 0, 0);
  }
  45% {
    transform: translate3d(0, -11px, 0) rotate(-4deg);
  }
}

.envelope-wrapper {
  position: relative;
  margin-top: 42px;
}

.envelope {
  position: relative;
  z-index: 2;
}

.mm-peek-envelope {
  bottom: calc(100% - 12px);
  left: 50%;
  width: 118px;
  z-index: 6;
  transform: translate3d(-50%, 0, 0);
}

.letter-stage {
  position: relative;
  width: 100%;
  margin-top: 56px;
}

.letter-stage .letter-card {
  position: relative;
  z-index: 2;
}

.mm-peek-letter {
  bottom: calc(100% - 10px);
  right: 26px;
  width: 116px;
}

.mm-peek-letter-left {
  bottom: calc(100% - 10px);
  left: 26px;
  width: 116px;
}

#letter-card.is-hidden ~ .mm-peek {
  display: none;
}

.mm-scratch-left {
  left: max(16px, 2.5vw);
  top: 220px;
  position: fixed;
  opacity: 0.46;
}

.mm-scratch-right {
  right: max(16px, 2.5vw);
  bottom: 90px;
  position: fixed;
  opacity: 0.48;
  animation-delay: -2.4s;
}

.mm-question-left {
  left: max(20px, 4vw);
  bottom: max(26px, 6vh);
  opacity: 0.5;
}

.mm-question-right {
  right: max(20px, 4vw);
  top: max(96px, 14vh);
  opacity: 0.48;
  animation-delay: -3.6s;
}

.mm-finale-left {
  left: max(16px, 3vw);
  bottom: max(24px, 5vh);
  position: fixed;
  opacity: 0.48;
}

.mm-finale-right {
  right: max(16px, 3vw);
  top: max(92px, 12vh);
  position: fixed;
  opacity: 0.48;
  animation-delay: -2.9s;
}

.question-art {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: auto;
  max-width: 290px;
  margin: 0 auto 10px;
}

.botanical-hearts-svg {
  width: 158px;
  flex-shrink: 0;
}

.mm-question-cameo {
  width: 82px;
  height: 82px;
  padding: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFFDF9 0%, #F4E9DF 100%);
  border: 1px solid var(--hairline-gold);
  box-shadow: 0 8px 18px rgba(44, 27, 30, 0.08);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mm-question-cameo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  mix-blend-mode: multiply;
}

.mm-keepsake {
  margin: 18px auto 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.mm-keepsake img {
  width: 112px;
  height: auto;
  border-radius: 14px;
  mix-blend-mode: multiply;
  -webkit-mask-image: radial-gradient(ellipse 86% 86% at 50% 50%, #000 76%, transparent 100%);
  mask-image: radial-gradient(ellipse 86% 86% at 50% 50%, #000 76%, transparent 100%);
}

.mm-keepsake-caption {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.96rem;
  letter-spacing: 0.03em;
  color: var(--ink-secondary);
}

@media (max-width: 1120px) {
  .mm-scratch-left,
  .mm-scratch-right,
  .mm-question-left,
  .mm-question-right,
  .mm-finale-left,
  .mm-finale-right {
    display: none;
  }
}

@media (max-width: 640px) {
  .mm-quest-left,
  .mm-quest-right {
    width: 82px;
    opacity: 0.34;
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .mm-canvas-corner,
  .mm-canvas-corner-left {
    width: 74px;
    top: calc(68px + env(safe-area-inset-top));
    opacity: 0.28;
  }

  .mm-canvas-corner {
    right: 10px;
  }

  .mm-canvas-corner-left {
    left: 10px;
  }

  .mm-card-peek {
    bottom: calc(100% - 9px);
    width: 92px;
  }

  .mm-peek-question {
    bottom: calc(100% - 9px);
    right: 16px;
    width: 94px;
  }

  .mm-peek-envelope {
    width: 100px;
  }

  .mm-peek-quest {
    width: 94px;
    bottom: -2px;
  }

  .mm-peek-letter,
  .mm-peek-letter-left {
    bottom: calc(100% - 9px);
    width: 94px;
  }

  .mm-peek-letter {
    right: 14px;
  }

  .mm-peek-letter-left {
    left: 14px;
  }

  .botanical-hearts-svg {
    width: 136px;
  }

  .mm-question-cameo {
    width: 70px;
    height: 70px;
  }
}

/* ==========================================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ И REDUCED MOTION
   ========================================================================== */

@media (max-width: 640px) {
  .stage-dots {
    gap: 2px;
    padding: 5px 9px;
  }

  .dot-rail {
    width: 8px;
  }

  .stage-dot {
    min-width: 24px;
    height: 24px;
    font-size: 0.84rem;
  }

  .quest-header {
    padding: 4px 6px 8px;
  }

  .quest-heart {
    width: 62px;
    height: 62px;
  }

  .scratch-grid {
    grid-template-columns: 1fr;
    row-gap: 68px;
    margin-top: 38px;
  }

  .scratch-card {
    min-height: 225px;
  }

  .question-card {
    padding: 24px 18px 20px;
  }

  .question-arena {
    min-height: 210px;
  }

  .letter-card {
    padding: 26px 20px 24px;
  }

  .canvas-controls .btn {
    padding: 10px 16px;
    font-size: 0.86rem;
  }

  .hug-popup {
    width: clamp(190px, 58vw, 250px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .paper-wash,
  .botanical-heart-l,
  .botanical-heart-r,
  .sparkle,
  .audio-bars span,
  .letter-body p,
  .mm-ambient,
  .candle-flame,
  .hug-popup.is-visible img {
    animation: none !important;
    opacity: 1 !important;
  }
}
