:root {
  --bg: #000000;
  --gold: #e4c27a;
  --cream: #f7f1e6;
  --muted: #cbbfaa;
  --red: #b4333a;
  --red-deep: #8c242c;
  --line: rgba(228, 194, 122, 0.28);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: Manrope, "Segoe UI", sans-serif;
  color: var(--cream);
  background: #000;
}

button, a { font: inherit; }

button { cursor: pointer; }

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.stage {
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 0;
  background: #000;
}

.app {
  width: min(480px, 100%);
  height: 100vh;
  height: 100dvh;
  max-height: 960px;
  position: relative;
  overflow: hidden;
  background: #000;
}

/* Рамка: растянута вверх, чтобы не было пустого чёрного над Дедом Морозом */
.frame-art {
  position: absolute;
  left: 50%;
  top: 0;
  width: 112%;
  height: 120%;
  transform: translateX(-50%) translateY(-9.5%);
  object-fit: cover;
  object-position: center top;
  pointer-events: none;
  z-index: 0;
  user-select: none;
  -webkit-user-drag: none;
}

.frame-twinkles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.twinkle {
  position: absolute;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff7c8 0%, #ffd56a 42%, transparent 72%);
  box-shadow: 0 0 8px 2px rgba(255, 214, 110, 0.75);
  animation: twinkle var(--dur, 1.8s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0.35;
}

@keyframes twinkle {
  0%, 100% {
    opacity: 0.18;
    transform: scale(0.7);
    filter: brightness(0.75);
  }
  40% {
    opacity: 1;
    transform: scale(1.25);
    filter: brightness(1.45);
  }
  70% {
    opacity: 0.45;
    transform: scale(0.9);
    filter: brightness(0.95);
  }
}

.panel {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  /* Окно внутри ёлочной рамки — ниже Деда Мороза */
  padding:
    max(22%, calc(env(safe-area-inset-top) + 6px))
    11%
    max(4%, calc(env(safe-area-inset-bottom) + 2px))
    11%;
}

.header {
  flex: none;
  text-align: center;
  padding: 0 8px 2px;
}

.candy-title {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.14em 0.3em;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: clamp(24px, 3.8vh, 34px);
  line-height: 0.95;
  letter-spacing: 0.02em;
}

.candy-word {
  display: inline-block;
  background-image:
    repeating-linear-gradient(
      -28deg,
      #fff6ea 0 0.22em,
      #e23b45 0.22em 0.44em
    );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 244, 220, 0.55);
  filter:
    drop-shadow(0 1px 0 #7a1820)
    drop-shadow(0 3px 8px rgba(0, 0, 0, 0.55));
  transform: rotate(-2deg);
}

.candy-word:last-child {
  transform: rotate(2deg);
}

.main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.drum {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.drum-head {
  flex: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
  margin-bottom: -2px;
}

.drum-label {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.counter {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.reel {
  position: relative;
  flex: 1;
  min-height: 0;
}

.viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  perspective: 900px;
  user-select: none;
}

.viewport.is-dragging { cursor: grabbing; }

.viewport::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4%;
  width: 36%;
  height: 12px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.38), transparent 70%);
  pointer-events: none;
}

.card {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 62%;
  height: 98%;
  transform-style: preserve-3d;
  will-change: transform;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: none;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.32);
}

#spices-drum .card {
  width: auto;
  height: 98%;
  max-width: 62%;
  aspect-ratio: 765 / 1024;
}

#tinctures-drum .card {
  width: auto;
  height: 98%;
  max-width: 62%;
  aspect-ratio: 819 / 1024;
}

.arrow {
  position: absolute;
  top: 42%;
  z-index: 5;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(8, 22, 16, 0.55);
  color: #f6e6c4;
}

.arrow.prev { left: 2px; }
.arrow.next { right: 2px; }

.arrow:hover { background: rgba(20, 46, 36, 0.9); }

.product-name {
  flex: none;
  margin: 0;
  min-height: 1.5em;
  padding: 0 8px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: inherit;
  text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(16px, 2.4vh, 22px);
  line-height: 1.05;
  cursor: pointer;
}

.product-name:hover {
  color: #ffe7b0;
}

.garland {
  position: relative;
  flex: none;
  height: 14px;
  margin: 0;
}

.wire {
  position: absolute;
  left: 2%;
  right: 2%;
  top: 5px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #8eab98, #d7e6da 50%, #8eab98, transparent);
}

.bulbs {
  position: absolute;
  left: 3%;
  right: 3%;
  top: 4px;
  display: flex;
  justify-content: space-between;
}

.bulb {
  width: 6px;
  height: 8px;
  border-radius: 40% 40% 46% 46%;
  position: relative;
  transform-origin: center top;
  animation: glow 1.55s ease-in-out infinite;
}

.bulb::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 1px;
  width: 4px;
  height: 2px;
  border-radius: 1px;
  background: #e7d3a4;
}

.bulb:nth-child(5n + 1) { background: #ff5d5d; color: #ff5d5d; animation-delay: 0s; }
.bulb:nth-child(5n + 2) { background: #ffd36a; color: #ffd36a; animation-delay: 0.28s; }
.bulb:nth-child(5n + 3) { background: #8dffc0; color: #8dffc0; animation-delay: 0.55s; }
.bulb:nth-child(5n + 4) { background: #fff1c9; color: #fff1c9; animation-delay: 0.82s; }
.bulb:nth-child(5n + 5) { background: #ff9a4a; color: #ff9a4a; animation-delay: 0.18s; }

.bulb { box-shadow: 0 0 7px currentColor; }

@keyframes glow {
  0%, 100% { opacity: 0.35; filter: brightness(0.7); transform: scale(0.92); }
  50% { opacity: 1; filter: brightness(1.45); transform: scale(1.08); }
}

.footer {
  flex: none;
  position: relative;
  padding-top: 0;
  margin-top: 0;
  transform: translateY(6px);
}

.footer-tools {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  margin: 0;
  z-index: 3;
}

.faq-launch {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: rgba(26, 51, 41, 0.85);
  color: #f6e6c4;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.faq-launch:hover { background: #234536; }

.contact {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(180deg, #c8454c, var(--red-deep));
  color: white;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 22px rgba(142, 36, 44, 0.35);
}

.contact:hover { filter: brightness(1.06); }

.modal {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--cream);
  width: min(420px, calc(100vw - 28px));
  max-height: min(82dvh, 680px);
  overflow: auto;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.lightbox {
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.94);
  color: var(--cream);
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  display: none;
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.92);
}

.lightbox-photo {
  max-width: min(100vw, 100%);
  max-height: calc(100dvh - 72px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  margin: 0;
  text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 22px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.lightbox-close {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: 12px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 28px;
  line-height: 1;
}

.sheet {
  position: relative;
  padding: 22px 20px 16px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 90px),
    #163028;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.sheet h2 {
  margin: 8px 0 8px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: 32px;
  line-height: 1;
  text-align: center;
}

.icon-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--cream);
  font-size: 22px;
  line-height: 1;
}

.sheet-photo {
  display: block;
  width: min(220px, 58vw);
  height: auto;
  max-height: 42vh;
  margin: 8px auto 0;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.35);
}

.sheet-text {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  text-align: center;
}

.text-close {
  display: block;
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--cream);
  font-weight: 600;
}

.sheet-faq { padding-top: 18px; }

.sheet-faq h2 { margin-bottom: 4px; }

.faq-list { margin: 4px 0 16px; }

.qa + .qa { border-top: 1px solid rgba(228, 194, 122, 0.16); }

.q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border: 0;
  background: none;
  color: var(--cream);
  text-align: left;
  font-weight: 600;
  font-size: 15px;
}

.mark {
  flex: none;
  width: 18px;
  color: var(--gold);
  font-size: 18px;
  line-height: 1;
}

.a {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}

.qa.open .a { grid-template-rows: 1fr; }

.a-inner {
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.qa.open .a-inner { padding-bottom: 12px; }

@media (max-width: 560px) {
  .app {
    width: 100%;
    max-height: none;
  }
}

@media (max-height: 720px) {
  .frame-art {
    top: -10%;
    height: 118%;
  }
  .panel {
    padding-top: max(20%, calc(env(safe-area-inset-top) + 4px));
    padding-bottom: max(3%, calc(env(safe-area-inset-bottom) + 2px));
  }
  .candy-title { font-size: 22px; }
  .footer { transform: translateY(4px); }
  .contact { height: 40px; }
  .product-name { min-height: 1.4em; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .bulb,
  .twinkle { animation: none; opacity: 0.85; }
  .a { transition: none; }
}
