/* ==========================================================================
   Nani Zani — կախարդական հեքիաթներ · дизайн «волшебная новогодняя ночь»
   ========================================================================== */

:root {
  --ink: #331A6B;
  --ink-2: #6B5596;
  --paper: #FFFBF4;

  --pink: #FF4F9A;   --pink-d: #C42A72;
  --purple: #8B5CF6; --purple-d: #5B2FC9;
  --sky: #38A6F5;    --sky-d: #1C78C2;
  --mint: #22C78C;   --mint-d: #0F8F61;
  --gold: #FFC21A;   --gold-d: #C98200;

  --bounce: cubic-bezier(.34, 1.56, .64, 1);
  --soft: cubic-bezier(.22, 1, .36, 1);
  --font: "Noto Sans Armenian", "Fredoka", system-ui, sans-serif;
  --round: "Fredoka", "Noto Sans Armenian", system-ui, sans-serif;

  --snowcap: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 46'%3E%3Cpath transform='translate(0 4)' fill='%23D5DBFF' d='M0 10C10 2 22 2 30 8C40 0 54 2 62 8C72 0 86 2 94 9C104 1 118 2 126 8C136 0 150 2 160 10V22C152 22 150 32 143 32C136 32 134 24 126 24C118 24 117 40 107 40C97 40 98 26 88 26C80 26 79 31 70 31C61 31 60 22 52 22C44 22 44 34 36 34C28 34 28 24 20 24C12 24 10 29 4 28C1 27 0 24 0 22Z'/%3E%3Cpath fill='white' d='M0 10C10 2 22 2 30 8C40 0 54 2 62 8C72 0 86 2 94 9C104 1 118 2 126 8C136 0 150 2 160 10V22C152 22 150 32 143 32C136 32 134 24 126 24C118 24 117 40 107 40C97 40 98 26 88 26C80 26 79 31 70 31C61 31 60 22 52 22C44 22 44 34 36 34C28 34 28 24 20 24C12 24 10 29 4 28C1 27 0 24 0 22Z'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: #2A1870;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; }
[hidden] { display: none !important; }

/* ===================================================== мультяшный текст с обводкой */
.toon {
  --o: #3A1585;
  --x: #1E0752;
  position: relative;
  color: var(--o);
  text-shadow:
    5px 0 var(--o), -5px 0 var(--o), 0 5px var(--o), 0 -5px var(--o),
    3.5px 3.5px var(--o), -3.5px 3.5px var(--o), 3.5px -3.5px var(--o), -3.5px -3.5px var(--o),
    4.6px 1.9px var(--o), -4.6px 1.9px var(--o), 4.6px -1.9px var(--o), -4.6px -1.9px var(--o),
    1.9px 4.6px var(--o), -1.9px 4.6px var(--o), 1.9px -4.6px var(--o), -1.9px -4.6px var(--o),
    0 10px var(--x), 4px 9px var(--x), -4px 9px var(--x), 0 12px var(--x),
    0 18px 30px rgba(8, 0, 40, .45);
}
.toon::after {
  content: attr(data-text);
  position: absolute; left: 0; right: 0; top: 0;
  color: transparent; text-shadow: none; pointer-events: none;
  background: var(--fill, linear-gradient(180deg, #FFFFFF 40%, #E9DCFF 100%));
  -webkit-background-clip: text; background-clip: text;
}

/* ===================================================== небо */
.sky {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(120% 60% at 50% 110%, rgba(255, 150, 210, .55), transparent 60%),
    linear-gradient(180deg, #160B45 0%, #2B1876 30%, #5A2DB3 62%, #A64BC9 84%, #E58BCB 100%);
}
.aurora {
  position: absolute; width: 90vw; height: 50vh; border-radius: 50%;
  opacity: .45; mix-blend-mode: screen;
}
.aurora.a1 {
  left: -20vw; top: -14vh;
  background: radial-gradient(closest-side, rgba(70, 230, 200, .75), rgba(70, 230, 200, 0));
  animation: auroraA 18s ease-in-out infinite alternate;
}
.aurora.a2 {
  right: -25vw; top: -6vh;
  background: radial-gradient(closest-side, rgba(255, 110, 210, .7), rgba(255, 110, 210, 0));
  animation: auroraB 22s ease-in-out infinite alternate;
}
.twinkles i {
  position: absolute; color: #fff; font-style: normal; line-height: 1;
  animation: twinkle 3s ease-in-out infinite;
  text-shadow: 0 0 8px rgba(255, 255, 255, .95);
}
.twinkles i.dot { width: 3px; height: 3px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px #fff; }

.moon {
  position: absolute; top: 96px; right: 6%; width: 110px; height: 110px;
  animation: floaty 7s ease-in-out infinite;
}
.moon::before {
  content: ""; position: absolute; inset: -40%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 238, 160, .45), rgba(255, 238, 160, 0));
  animation: glowPulse 4s ease-in-out infinite;
}
.moon svg { position: relative; width: 100%; height: 100%; }

.shooting {
  position: absolute; width: 160px; height: 3px; border-radius: 3px; opacity: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff);
  transform: rotate(-24deg);
  filter: drop-shadow(0 0 6px #fff);
}
.shooting.s1 { top: 14%; left: 62%; animation: shoot 9s ease-in infinite 2s; }
.shooting.s2 { top: 26%; left: 22%; animation: shoot 13s ease-in infinite 7s; }

.sleigh {
  position: absolute; top: 18%; left: 0; width: 170px;
  animation: sleighFly 34s linear infinite 3s;
  transform: translateX(110vw);
  filter: drop-shadow(0 0 8px rgba(255, 224, 138, .9));
}
.sleigh svg { width: 100%; display: block; animation: bob 1.4s ease-in-out infinite; }
.sleigh::after {
  content: ""; position: absolute; left: 92%; top: 72%; width: 170px; height: 8px;
  background: radial-gradient(circle, #FFF1B8 2px, transparent 3px) 0 0 / 14px 8px repeat-x;
  -webkit-mask-image: linear-gradient(90deg, #000, transparent);
  mask-image: linear-gradient(90deg, #000, transparent);
}

.cloud {
  position: absolute; left: -240px; width: 180px; height: 56px;
  background: rgba(220, 205, 255, .22); border-radius: 999px;
  animation: drift linear infinite;
}
.cloud::before, .cloud::after { content: ""; position: absolute; background: inherit; border-radius: 50%; }
.cloud::before { width: 82px; height: 82px; left: 26px; top: -40px; }
.cloud::after  { width: 60px; height: 60px; left: 92px; top: -28px; }
.cloud.c1 { top: 22%; animation-duration: 90s; animation-delay: -20s; }
.cloud.c2 { top: 42%; animation-duration: 120s; animation-delay: -75s; transform: scale(.7); }
.cloud.c3 { top: 9%;  animation-duration: 150s; animation-delay: -110s; transform: scale(.55); }

#snow { position: fixed; inset: 0; z-index: 1; pointer-events: none; }

.scene {
  position: fixed; left: 0; bottom: 0; width: 100%; height: min(28vh, 260px);
  z-index: 0; pointer-events: none;
}
.scene .window { animation: windowGlow 3s ease-in-out infinite; filter: drop-shadow(0 0 6px #FFD66B); }
.scene .w2 { animation-delay: -1.3s; }
.scene .lamp { animation: lampBlink 1.6s ease-in-out infinite; }
.scene .l2 { animation-delay: -.4s; }
.scene .l3 { animation-delay: -.8s; }
.scene .l4 { animation-delay: -1.2s; }
.scene .tree-star { animation: twinkle 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.scene .smoke { animation: smoke 4.5s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.scene .smoke.s2 { animation-delay: -1.5s; }
.scene .smoke.s3 { animation-delay: -3s; }

/* гирлянда */
.garland { position: absolute; top: 0; left: 0; width: 100%; height: 64px; z-index: 6; pointer-events: none; overflow: visible; }
.garland .bulb { animation: bulbBlink 1.8s ease-in-out infinite; animation-delay: var(--d); filter: drop-shadow(0 0 6px currentColor); }

/* ===================================================== шапка */
.topbar {
  position: relative; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  max-width: 1240px; margin: 0 auto; padding: 30px 18px 10px;
}
.logo {
  position: relative; display: inline-flex; align-items: flex-end;
  font: 700 2.4rem/1 var(--round); text-decoration: none; letter-spacing: .5px;
  padding: 6px 4px 4px;
}
.logo .lt {
  display: inline-block; color: var(--c);
  text-shadow:
    3px 0 #fff, -3px 0 #fff, 0 3px #fff, 0 -3px #fff, 2.2px 2.2px #fff, -2.2px -2.2px #fff, 2.2px -2.2px #fff, -2.2px 2.2px #fff,
    0 7px 0 #3A1585, 0 10px 18px rgba(8, 0, 40, .45);
  animation: letterBob 2.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * .12s);
}
.logo .gap { width: .32em; }
.logo:hover .lt { animation: letterJump .6s var(--bounce); animation-delay: calc(var(--i) * .04s); }
.logo-hat {
  position: absolute; left: -16px; top: -14px; width: 46px; z-index: 2;
  transform: rotate(-22deg); transform-origin: 70% 90%;
  filter: drop-shadow(0 3px 0 rgba(30, 7, 82, .4));
  animation: hatWiggle 3.5s ease-in-out infinite;
}

/* кнопки меню-конфеты */
.menu { display: flex; gap: 12px; align-items: center; }
.nav-btn {
  --t: #FF9CCB; --m: #FF4F9A; --b: #E0307F; --sh: #A81F5E; --ic: #FF4F9A;
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 18px 6px 6px; border-radius: 999px;
  background: linear-gradient(180deg, var(--t) 0%, var(--m) 52%, var(--b) 100%);
  border: 3px solid #fff;
  color: #fff; font-weight: 800; font-size: .98rem; text-decoration: none; white-space: nowrap;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .2);
  box-shadow: 0 6px 0 var(--sh), 0 14px 22px -8px rgba(8, 0, 40, .7), inset 0 -4px 0 rgba(0, 0, 0, .1);
  transition: transform .4s var(--bounce), box-shadow .2s, filter .2s;
}
.nav-btn::before { /* глянец */
  content: ""; position: absolute; z-index: -1; left: 10px; right: 10px; top: 3px; height: 42%;
  border-radius: 999px; background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .05));
}
.nav-btn::after { /* блик */
  content: ""; position: absolute; z-index: -1; top: 0; left: -70%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .7), transparent);
  transform: skewX(-20deg); transition: left .7s var(--soft);
}
.nav-btn:hover { transform: translateY(-5px) rotate(-2deg) scale(1.05); filter: brightness(1.06); }
.nav-btn:nth-child(even):hover { transform: translateY(-5px) rotate(2deg) scale(1.05); }
.nav-btn:hover::after { left: 140%; }
.nav-btn:active { transform: translateY(5px) scale(.97); box-shadow: 0 1px 0 var(--sh), 0 5px 10px -4px rgba(8, 0, 40, .6); transition-duration: .08s; }
.nav-btn:focus-visible { outline: 3px solid #FFE27A; outline-offset: 3px; }
.nb-ico {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
  background: #fff; color: var(--ic);
  box-shadow: inset 0 -3px 0 rgba(58, 21, 133, .12), 0 2px 0 rgba(0, 0, 0, .12);
}
.nb-ico svg { width: 21px; height: 21px; }
.nav-btn:hover .nb-ico { animation: wiggle .6s ease-in-out; }
.nb-gold  { --t: #FFEB94; --m: #FFC21A; --b: #F59A00; --sh: #B86E00; --ic: #F08C00; text-shadow: 0 2px 0 rgba(150, 80, 0, .45); }
.nb-insta { --t: #FF8A7A; --m: #E1306C; --b: #A92DB5; --sh: #6E1F86; }
.nb-insta { background: linear-gradient(120deg, #FEC053 0%, #F2203E 38%, #C92B8E 68%, #6A3BE0 100%); }
.nb-yt    { --t: #FF8A8A; --m: #FF2D2D; --b: #D41515; --sh: #8F0C0C; --ic: #FF2D2D; }

.topbar-right { display: flex; gap: 10px; align-items: center; }
.icon-btn {
  --t: #C3A6FF; --m: #8B5CF6; --b: #6A3BE0; --sh: #42209E;
  position: relative; width: 52px; height: 52px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, var(--t), var(--m) 55%, var(--b));
  border: 3px solid #fff;
  box-shadow: 0 6px 0 var(--sh), 0 14px 22px -8px rgba(8, 0, 40, .7);
  transition: transform .4s var(--bounce), box-shadow .2s;
}
.icon-btn::before {
  content: ""; position: absolute; left: 9px; right: 9px; top: 4px; height: 38%; border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0));
}
.icon-btn svg { position: relative; width: 24px; height: 24px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .2)); }
.icon-btn:hover { transform: translateY(-4px) rotate(-8deg) scale(1.06); }
.icon-btn:active { transform: translateY(5px) scale(.95); box-shadow: 0 1px 0 var(--sh); }
.ib-pink { --t: #FF9CCB; --m: #FF4F9A; --b: #E0307F; --sh: #A81F5E; }
#soundBtn .ico-off { display: none; }
#soundBtn.muted .ico-on { display: none; }
#soundBtn.muted .ico-off { display: block; }
#soundBtn.muted { --t: #D8D0EC; --m: #A99BC9; --b: #8B7CB0; --sh: #5E5180; }
#soundBtn.bump { animation: jelly .6s; }

.burger { display: none; }
.burger span {
  position: absolute; left: 13px; width: 20px; height: 3.5px; border-radius: 3px; background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .2);
  transition: transform .45s var(--bounce), opacity .2s, top .3s var(--soft);
}
.burger span:nth-child(1) { top: 14px; }
.burger span:nth-child(2) { top: 21px; }
.burger span:nth-child(3) { top: 28px; }
.burger.open span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger.open span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

/* ===================================================== кнопки-конфеты */
.btn {
  --t: #C3A6FF; --m: #8B5CF6; --b: #6A3BE0; --sh: #42209E;
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  padding: 15px 28px; border-radius: 999px; cursor: pointer;
  border: 3px solid #fff;
  font: 800 1.08rem/1.1 var(--font); color: #fff; text-decoration: none;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .22);
  background: linear-gradient(180deg, var(--t) 0%, var(--m) 52%, var(--b) 100%);
  box-shadow: 0 7px 0 var(--sh), 0 18px 26px -10px rgba(8, 0, 40, .55), inset 0 -4px 0 rgba(0, 0, 0, .1);
  transition: transform .4s var(--bounce), box-shadow .2s, filter .2s;
  user-select: none;
}
.btn::before { /* глянец */
  content: ""; position: absolute; z-index: -1; left: 12%; right: 12%; top: 4px; height: 40%;
  border-radius: 999px; background: linear-gradient(180deg, rgba(255, 255, 255, .6), rgba(255, 255, 255, .05));
  pointer-events: none;
}
.btn::after { /* блик */
  content: ""; position: absolute; z-index: -1; top: 0; left: -70%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .65), transparent);
  transform: skewX(-20deg); transition: left .7s var(--soft);
}
.btn:hover { transform: translateY(-4px) scale(1.04); filter: brightness(1.05); }
.btn:hover::after { left: 140%; }
.btn:active { transform: translateY(6px) scale(.97); box-shadow: 0 1px 0 var(--sh), 0 6px 12px -6px rgba(8, 0, 40, .5); transition-duration: .08s; }
.btn:focus-visible { outline: 4px solid #FFE27A; outline-offset: 3px; }
.btn[disabled] { filter: grayscale(.6) opacity(.6); pointer-events: none; }

.btn-pink   { --t: #FF9CCB; --m: #FF4F9A; --b: #E0307F; --sh: #A81F5E; }
.btn-purple { --t: #C3A6FF; --m: #8B5CF6; --b: #6A3BE0; --sh: #42209E; }
.btn-sky    { --t: #9AD6FF; --m: #38A6F5; --b: #1F86D1; --sh: #135C99; }
.btn-mint   { --t: #8AF2C8; --m: #22C78C; --b: #12A06C; --sh: #0A7049; }
.btn-gold   { --t: #FFEB94; --m: #FFC21A; --b: #F59A00; --sh: #B86E00; text-shadow: 0 2px 0 rgba(150, 80, 0, .45); }
.btn-ghost  { --t: #FFFFFF; --m: #FBF8FF; --b: #EFE7FF; --sh: #C9B8F2; color: var(--ink); text-shadow: none; border-color: #EDE4FF; }
.btn-big  { font-size: 1.2rem; padding: 17px 34px; }
.btn-huge { font-size: 1.45rem; padding: 20px 44px; }
.btn-emoji { display: inline-block; animation: wiggle 1.8s ease-in-out infinite; }
.btn .arrow { display: inline-block; transition: transform .35s var(--bounce); }
.btn:hover .arrow { transform: translateX(5px); }
.btn .arrow.back { transform: scaleX(-1); }
.btn:hover .arrow.back { transform: scaleX(-1) translateX(5px); }

.pulse { animation: pulseScale 2.2s ease-in-out infinite; }
.pulse:hover { animation-play-state: paused; }

.ripple {
  position: absolute; z-index: -1; border-radius: 50%; pointer-events: none;
  background: rgba(255, 255, 255, .55); transform: scale(0);
  animation: ripple .65s var(--soft) forwards;
}

/* ===================================================== экраны */
main { position: relative; z-index: 5; max-width: 1240px; margin: 0 auto; padding: 8px 18px 40px; }
.screen { display: none; }
.screen.is-active { display: block; animation: screenIn .7s var(--bounce) both; }
.screen.is-leaving { display: block; animation: screenOut .3s ease-in both; }

/* карточка со снежной шапкой и «строчкой» */
.card {
  position: relative;
  background:
    radial-gradient(circle at 20% 30%, rgba(139, 92, 246, .06) 0 2px, transparent 3px) 0 0 / 34px 34px,
    var(--paper);
  border-radius: 38px;
  border: 5px solid #fff;
  box-shadow:
    0 0 0 5px rgba(255, 214, 110, .55),
    0 16px 0 rgba(20, 5, 70, .35),
    0 40px 80px -20px rgba(5, 0, 30, .75);
}
.card::before {
  content: ""; position: absolute; z-index: 3; top: -17px; left: 22px; right: 22px; height: 46px;
  background: var(--snowcap) repeat-x 0 0 / 160px 46px;
  border-radius: 22px 22px 0 0; pointer-events: none;
  filter: drop-shadow(0 -2px 3px rgba(255, 255, 255, .5));
}
.card::after {
  content: ""; position: absolute; inset: 9px; border-radius: 30px; pointer-events: none;
  border: 2.5px dashed rgba(139, 92, 246, .22);
}

/* ===================================================== главная */
.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 30px;
  min-height: calc(100vh - 190px); padding: 0 0 70px;
}
.hero-art { position: relative; width: 100%; max-width: 560px; aspect-ratio: 1 / .96; margin: 0 auto; }
.art-rays {
  position: absolute; left: 50%; top: 58%; width: 118%; aspect-ratio: 1; translate: -50% -50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 226, 122, .32) 0deg 9deg, rgba(255, 226, 122, 0) 9deg 22deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent 75%);
  mask-image: radial-gradient(closest-side, #000 30%, transparent 75%);
  border-radius: 50%;
  animation: spinPlain 40s linear infinite;
}
.art-glow {
  position: absolute; left: 50%; bottom: 18%; width: 70%; height: 40%; translate: -50% 0;
  background: radial-gradient(closest-side, rgba(255, 236, 160, .75), rgba(255, 200, 120, 0));
  animation: glowPulse 3s ease-in-out infinite;
}
.art-book { position: absolute; left: 7%; right: 7%; bottom: 2%; animation: floaty 5s ease-in-out infinite; }
.art-book svg { width: 100%; display: block; filter: drop-shadow(0 16px 0 rgba(20, 5, 70, .3)); }

.bauble {
  position: absolute; top: calc(var(--len) + 18px); width: 31%;
  transform-origin: 50% calc(-18px - var(--len));
  animation: swing 4.2s ease-in-out infinite;
  z-index: 2;
}
.bauble.b-girl { left: 4%; }
.bauble.b-boy  { right: 5%; width: 29%; animation-duration: 5s; animation-delay: -1.3s; }
.b-string {
  position: absolute; left: 50%; bottom: calc(100% + 16px); width: 2px; height: calc(var(--len) + 60px);
  translate: -50% 0; background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .85));
}
.b-cap {
  position: absolute; left: 50%; top: -18px; width: 28%; height: 22px; translate: -50% 0;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(90deg, #C98200, #FFE27A 40%, #FFC21A 60%, #B86E00);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}
.b-cap::before {
  content: ""; position: absolute; left: 50%; top: -10px; width: 12px; height: 12px; translate: -50% 0;
  border: 3px solid #FFD84A; border-radius: 50%;
}
.b-ball {
  display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 38%, #fff, var(--tint) 70%);
  border: 7px solid var(--ring);
  box-shadow: 0 0 0 5px #fff, 0 16px 30px rgba(5, 0, 30, .5), 0 0 50px color-mix(in srgb, var(--ring) 70%, transparent);
}
.b-ball svg { width: 100%; height: 100%; display: block; }
.b-shine {
  position: absolute; left: 15%; top: 9%; width: 26%; height: 15%; border-radius: 50%;
  background: rgba(255, 255, 255, .6); rotate: -32deg; pointer-events: none;
}
.gift { position: absolute; z-index: 3; }
.gift svg { width: 100%; display: block; filter: drop-shadow(0 8px 0 rgba(20, 5, 70, .3)); }
.gift.g1 { right: 3%; bottom: 0; width: 18%; animation: giftHop 2.8s ease-in-out infinite; }
.gift.g2 { left: 2%; bottom: 2%; width: 13%; animation: giftHop 3.4s ease-in-out infinite -1.2s; }
.spark {
  position: absolute; left: 50%; top: 52%; font-size: 26px; color: #FFE45C; z-index: 3;
  text-shadow: 0 0 12px rgba(255, 228, 92, .9);
  animation: sparkUp 3.2s ease-out infinite; opacity: 0;
}
.spark.s1 { --x: -110px; animation-delay: 0s; }
.spark.s2 { --x: 80px;   animation-delay: .5s; color: #fff; }
.spark.s3 { --x: -30px;  animation-delay: 1.1s; color: #FF9ECF; }
.spark.s4 { --x: 130px;  animation-delay: 1.6s; color: #fff; }
.spark.s5 { --x: -140px; animation-delay: 2.1s; }
.spark.s6 { --x: 20px;   animation-delay: 2.6s; color: #B9F3FF; }

.hero-text { text-align: left; }
.ribbon {
  position: relative; display: inline-block; margin-left: 18px;
  animation: popIn .7s var(--bounce) both .1s;
}
.ribbon > span {
  position: relative; z-index: 1; display: inline-block; padding: 9px 22px;
  background: linear-gradient(180deg, #FFEB94, #FFC21A 60%, #F5A300);
  color: #6B3A00; font-weight: 900; font-size: .98rem; border-radius: 8px;
  box-shadow: 0 4px 0 #B86E00, inset 0 2px 0 rgba(255, 255, 255, .6);
}
.ribbon::before, .ribbon::after {
  content: ""; position: absolute; top: 9px; width: 34px; height: 100%;
  background: #E08A00;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 30% 50%);
}
.ribbon::before { left: -20px; }
.ribbon::after  { right: -20px; transform: scaleX(-1); }

.hero-title {
  margin: 18px 0 14px; padding-left: 4px;
  font-weight: 900; font-size: clamp(2.3rem, 5.4vw, 4rem); line-height: 1.16;
}
.hero-title .line { display: block; animation: lineIn .8s var(--bounce) both; }
.hero-title .line:nth-child(1) { animation-delay: .15s; }
.hero-title .line:nth-child(2) { animation-delay: .28s; }
.hero-title .line:nth-child(3) { animation-delay: .41s; }
.hero-title .hl {
  --o: #8A1F55; --x: #4E0A2E;
  --fill: linear-gradient(110deg, #FFB21A 0%, #FFE47A 22%, #FFFBE0 30%, #FFE47A 38%, #FFB21A 58%, #FF8A1E 100%);
}
.hero-title .hl::after { background-size: 260% 100%; animation: shimmer 4.5s linear infinite; }

.hero-sub {
  display: table; margin: 0 0 26px; padding: 12px 22px; max-width: 560px;
  color: #fff; font-weight: 700; font-size: 1.15rem; line-height: 1.5;
  background: linear-gradient(180deg, rgba(60, 25, 150, .55), rgba(40, 12, 110, .6));
  border: 2px solid rgba(255, 255, 255, .35); border-radius: 26px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px -10px rgba(5, 0, 30, .5);
  text-shadow: 0 1px 2px rgba(20, 0, 60, .35);
  animation: popIn .7s var(--bounce) both .55s;
}

.cta-wrap { position: relative; display: inline-block; animation: popIn .7s var(--bounce) both .75s; }
.cta-wrap::before {
  content: ""; position: absolute; inset: -22px -30px; z-index: -1; border-radius: 999px;
  background: radial-gradient(closest-side, rgba(255, 110, 180, .65), rgba(255, 110, 180, 0));
  animation: glowPulse 2.2s ease-in-out infinite;
}
.cta { animation: pulseScale 2.2s ease-in-out 1.5s infinite; }
.cta-ico {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--pink); font-size: .95rem; text-shadow: none; padding-left: 3px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .1);
}
.cta:hover .cta-ico { animation: wiggle .6s; }
.orbit { position: absolute; color: #FFE45C; font-size: 22px; text-shadow: 0 0 10px rgba(255, 228, 92, .9); animation: twinkle 2.2s ease-in-out infinite; pointer-events: none; }
.orbit.o1 { left: -18px; top: -14px; }
.orbit.o2 { right: -14px; top: -18px; color: #fff; animation-delay: -.6s; }
.orbit.o3 { right: -22px; bottom: -4px; color: #FF9ECF; animation-delay: -1.2s; }
.orbit.o4 { left: -10px; bottom: -12px; animation-delay: -1.7s; font-size: 16px; }

/* ===================================================== мастер */
.wizard { max-width: 800px; margin: 22px auto 0; padding: 40px 30px 24px; }

.stars-progress { display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.sp-star { position: relative; width: 52px; height: 52px; display: grid; place-items: center; }
.sp-star svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: #EEE7FF; transition: fill .4s; }
.sp-star b { position: relative; font: 700 1rem/1 var(--round); color: #B4A2DD; transition: color .3s; padding-top: 3px; }
.sp-star.done svg { fill: var(--gold); filter: drop-shadow(0 3px 0 var(--gold-d)); }
.sp-star.done b { color: #fff; }
.sp-star.current svg { fill: #FFD84A; filter: drop-shadow(0 3px 0 var(--gold-d)) drop-shadow(0 0 10px rgba(255, 216, 74, .9)); }
.sp-star.current { animation: starPulse 1.6s ease-in-out infinite; }
.sp-star.current b { color: #7A4B00; }
.sp-star.pop { animation: starPop .7s var(--bounce); }
.sp-line { width: 36px; height: 7px; border-radius: 7px; background: #EEE7FF; position: relative; overflow: hidden; margin: 0 2px; }
.sp-line::after { content: ""; position: absolute; inset: 0; width: 0; background: linear-gradient(90deg, #FFD84A, var(--gold)); border-radius: 7px; transition: width .6s var(--soft); }
.sp-line.done::after { width: 100%; }

.step { animation: stepIn .55s var(--bounce) both; }
.step.leave-left  { animation: stepOutLeft .25s ease-in both; }
.step.leave-right { animation: stepOutRight .25s ease-in both; }
.step.enter-right { animation: stepInRight .6s var(--bounce) both; }
.step.enter-left  { animation: stepInLeft .6s var(--bounce) both; }

.step-title {
  margin: 6px 0 4px; text-align: center; font-weight: 900; font-size: clamp(1.5rem, 3.8vw, 2.25rem); line-height: 1.2;
  background: linear-gradient(90deg, #6A2CD8, #C42A9A 60%, #FF4F9A);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(106, 44, 216, .15));
}
.step-sub { margin: 0 0 24px; text-align: center; color: var(--ink-2); font-weight: 700; }
.step-sub b { color: var(--pink); }

.choices.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 480px; margin: 0 auto; }
.choice {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit;
  padding: 20px 12px 22px; border-radius: 32px; cursor: pointer;
  background: radial-gradient(circle at 50% 30%, #fff 0%, var(--tint) 70%);
  border: 4px solid #fff; color: var(--ink);
  box-shadow: 0 8px 0 color-mix(in srgb, var(--accent) 30%, #fff), 0 18px 30px -14px rgba(40, 10, 100, .4);
  transition: transform .45s var(--bounce), box-shadow .3s, border-color .3s, opacity .3s;
  outline: none;
}
.choice:hover { transform: translateY(-8px) rotate(-1.5deg); }
.choice:nth-child(2):hover { transform: translateY(-8px) rotate(1.5deg); }
.choice:active { transform: translateY(2px) scale(.97); }
.choice:focus-visible { border-color: var(--accent); }
.choice.selected {
  border-color: var(--accent);
  box-shadow: 0 8px 0 var(--accent-d), 0 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent), 0 20px 40px -10px color-mix(in srgb, var(--accent) 60%, transparent);
  animation: jelly .7s;
}
.choice.dim { opacity: .6; transform: scale(.95); }
.choice-stage { position: relative; display: grid; place-items: center; width: 160px; aspect-ratio: 1; }
.choice-rays {
  position: absolute; inset: -22px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--accent) 40%, transparent) 0deg 10deg, transparent 10deg 24deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 45%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 45%, transparent 100%);
  opacity: 0; transform: scale(.6); transition: opacity .4s, transform .6s var(--bounce);
  animation: spinPlain 14s linear infinite;
}
.choice:hover .choice-rays { opacity: .6; transform: scale(1); }
.choice.selected .choice-rays { opacity: 1; transform: scale(1); }
.choice-art {
  position: relative; width: 100%; aspect-ratio: 1; display: block; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #fff 0%, var(--tint) 75%);
  border: 6px solid #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 55%, #fff), 0 10px 20px -8px rgba(40, 10, 100, .45);
}
.choice-art svg { width: 100%; height: 100%; display: block; animation: bob 3s ease-in-out infinite; }
.choice:nth-child(2) .choice-art svg { animation-delay: -1.4s; }
.choice.selected .choice-art svg { animation: happyJump .8s var(--bounce), bob 3s ease-in-out .8s infinite; }
.choice-label {
  position: relative; z-index: 1; margin-top: -16px;
  padding: 7px 26px; border-radius: 999px; border: 3px solid #fff;
  font-weight: 900; font-size: 1.45rem; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .2);
  background: linear-gradient(180deg, var(--accent-l), var(--accent) 55%, var(--accent-d));
  box-shadow: 0 5px 0 var(--accent-d), 0 10px 16px -6px rgba(40, 10, 100, .45);
}
.choice-note { font-weight: 700; font-size: .95rem; color: var(--ink-2); margin-top: 6px; }
.choice-check {
  position: absolute; z-index: 2; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 900; color: #fff; font-size: 1.1rem;
  background: linear-gradient(180deg, var(--accent-l), var(--accent));
  border: 3px solid #fff; box-shadow: 0 4px 0 var(--accent-d);
  transform: scale(0) rotate(-90deg); transition: transform .5s var(--bounce);
}
.choice.selected .choice-check { transform: scale(1) rotate(0); }

.sample-btn {
  position: relative; overflow: hidden; isolation: isolate;
  margin-top: 12px; display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 999px; border: 3px solid color-mix(in srgb, var(--accent) 40%, #fff); cursor: pointer;
  background: #fff; color: var(--accent-d); font-weight: 800; font-size: .95rem;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 45%, #fff);
  transition: transform .35s var(--bounce), box-shadow .2s, background .2s, color .2s;
}
.sample-btn:hover { transform: translateY(-3px) scale(1.06); }
.sample-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 45%, #fff); }
.sample-btn.playing { background: linear-gradient(180deg, var(--accent-l), var(--accent)); color: #fff; border-color: #fff; }
.sample-btn.playing .sb-ico { animation: beat .6s ease-in-out infinite; }
.sample-btn.loading .sb-ico { animation: spinPlain 1s linear infinite; }
.sb-ico { display: inline-block; }

/* шарики-возраст */
.balloons {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 30px;
  max-width: 500px; margin: 0 auto; padding: 10px 0 6px;
}
.balloons.many { grid-template-columns: repeat(4, 1fr); gap: 4px 24px; max-width: 640px; }
.balloon {
  position: relative; border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--bc); aspect-ratio: 80 / 122;
  transform-origin: 50% 100%;
  animation: sway 3.2s ease-in-out infinite alternate, popIn .6s var(--bounce) both;
  animation-delay: var(--d), var(--d2);
  transition: opacity .3s, filter .3s;
}
.balloon svg { width: 100%; height: 100%; display: block; overflow: visible; transition: transform .4s var(--bounce); filter: drop-shadow(0 6px 0 rgba(58, 21, 133, .14)); }
.balloon .num, .balloon .age-word {
  position: absolute; left: 0; right: 0; text-align: center; color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .18); transition: transform .4s var(--bounce); pointer-events: none;
}
.balloon .num { top: 21%; font: 700 clamp(1.5rem, 5.5vw, 2.3rem)/1 var(--round); }
.balloon .age-word { top: 44%; font-weight: 800; font-size: clamp(.72rem, 2.4vw, .95rem); }
.balloon:hover svg, .balloon:focus-visible svg,
.balloon:hover .num, .balloon:focus-visible .num,
.balloon:hover .age-word, .balloon:focus-visible .age-word { transform: translateY(-8px) scale(1.08); }
.balloon:focus-visible { outline: none; }
.balloon.picked svg { transform: translateY(-14px) scale(1.18); filter: drop-shadow(0 0 18px color-mix(in srgb, var(--bc) 80%, #fff)); }
.balloon.picked .num, .balloon.picked .age-word { transform: translateY(-14px) scale(1.2); }
.balloon.picked { animation: balloonWobble .8s var(--bounce); z-index: 2; }
.balloon.dim { opacity: .4; filter: saturate(.6); }

/* выбор сказки */
.tales { max-width: 680px; margin: 0 auto; }
.tale-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 14px; }
.tale {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 92px;
  padding: 14px 44px 14px 14px; border-radius: 26px; cursor: pointer; text-align: left;
  font: inherit; color: var(--ink);
  background: radial-gradient(circle at 15% 30%, #fff 0%, var(--tint) 85%);
  border: 4px solid #fff; outline: none;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 30%, #fff), 0 14px 24px -14px rgba(40, 10, 100, .45);
  transition: transform .45s var(--bounce), box-shadow .3s, border-color .3s, opacity .3s;
  animation: popIn .55s var(--bounce) both; animation-delay: calc(var(--i) * .06s);
}
.tale:hover { transform: translateY(-5px) rotate(-.8deg); }
.tale:active { transform: translateY(2px) scale(.98); }
.tale:focus-visible { border-color: var(--accent); }
.tale.selected {
  border-color: var(--accent);
  box-shadow: 0 6px 0 var(--accent-d), 0 0 0 7px color-mix(in srgb, var(--accent) 25%, transparent), 0 18px 34px -12px color-mix(in srgb, var(--accent) 60%, transparent);
  animation: jelly .7s;
}
.tale.dim { opacity: .6; }
.tale-ico {
  flex: 0 0 auto; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.9rem; background: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, #fff), 0 6px 12px -6px rgba(40, 10, 100, .45);
}
.tale:hover .tale-ico, .tale.selected .tale-ico { animation: wiggle .6s; }
.tale-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px; }
.tale-name { font-weight: 800; font-size: 1.02rem; line-height: 1.3; }
.tale-for { font-weight: 700; font-size: .85rem; color: var(--accent-d); }
.tale-tag {
  position: absolute; left: 82px; bottom: -11px; padding: 2px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 800; color: #fff; white-space: nowrap;
  background: linear-gradient(180deg, #6CC2FF, #2E8BE0); border: 2px solid #fff; box-shadow: 0 2px 0 #1C6FB8;
}
.tale .choice-check { top: 50%; right: 10px; width: 30px; height: 30px; font-size: .9rem; margin-top: -15px; }
.tale.selected .choice-check { transform: scale(1) rotate(0); }
.tales-empty { text-align: center; font-weight: 700; color: var(--ink-2); }

/* имя */
.name-field { position: relative; max-width: 540px; margin: 0 auto; }
.name-pencil { position: absolute; left: 22px; top: 50%; font-size: 1.7rem; transform: translateY(-50%); pointer-events: none; z-index: 1; }
.name-field.typing .name-pencil { animation: write .35s ease-in-out infinite alternate; }
#nameInput {
  width: 100%; padding: 18px 26px 18px 68px;
  font: 800 clamp(1.5rem, 4.2vw, 2rem)/1.2 var(--font); color: var(--ink);
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(90deg, #FF4F9A, #8B5CF6, #38A6F5) border-box;
  border: 5px solid transparent; border-radius: 999px; outline: none;
  box-shadow: 0 7px 0 rgba(139, 92, 246, .25);
  transition: box-shadow .3s, transform .4s var(--bounce);
}
#nameInput::placeholder { color: #C6B8E6; font-weight: 700; }
#nameInput:focus { box-shadow: 0 7px 0 rgba(139, 92, 246, .25), 0 0 0 9px rgba(139, 92, 246, .16); transform: scale(1.02); }
.name-field.shake { animation: shake .5s; }
.name-field.shake #nameInput { background: linear-gradient(#fff, #fff) padding-box, linear-gradient(90deg, #FF4F9A, #FF4F9A) border-box; }
.name-hint { min-height: 1.5em; margin: 12px 0 0; text-align: center; font-weight: 700; font-size: .98rem; color: var(--purple); }
.name-hint.err { color: var(--pink-d); animation: popIn .4s var(--bounce); }

.greeting {
  display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 10px;
  margin: 12px 0 6px; min-height: 74px;
  font-weight: 900; font-size: clamp(1.8rem, 5vw, 2.7rem);
}
.greeting .wave { display: inline-block; transform-origin: 70% 80%; animation: handWave 2s ease-in-out infinite; }
.greet-word { color: var(--ink); }
.greet-name { display: inline-flex; }
.greet-name .dots { font-style: normal; color: #C6B8E6; animation: blinkDots 1.2s steps(2) infinite; }
.gl {
  display: inline-block; white-space: pre;
  animation: letterWave 1.8s ease-in-out infinite; animation-delay: calc(var(--i) * .09s);
  text-shadow: 0 4px 0 rgba(58, 21, 133, .16);
}
.gl.new { animation: letterPop .5s var(--bounce), letterWave 1.8s ease-in-out .5s infinite; }
.gl:nth-child(5n+1) { color: var(--pink); }
.gl:nth-child(5n+2) { color: var(--purple); }
.gl:nth-child(5n+3) { color: var(--sky); }
.gl:nth-child(5n+4) { color: var(--mint); }
.gl:nth-child(5n+5) { color: var(--gold-d); }

.step-actions { display: flex; justify-content: center; margin-top: 14px; }

/* диктор на шаге с именем */
.voices { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 12px; margin: 14px 0 0; }
.voices-label { flex: 0 0 100%; text-align: center; font-weight: 800; color: var(--ink-2); }
.voice-opt {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 5px; border-radius: 999px; cursor: pointer;
  background: var(--tint); border: 3px solid #fff; outline: none;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 30%, #fff);
  transition: transform .35s var(--bounce), box-shadow .3s, border-color .3s, opacity .3s;
  opacity: .7;
}
.voice-opt:hover { transform: translateY(-3px); opacity: 1; }
.voice-opt:focus-visible { border-color: var(--accent); }
.voice-opt.selected {
  opacity: 1; border-color: var(--accent);
  box-shadow: 0 4px 0 var(--accent-d), 0 0 0 5px color-mix(in srgb, var(--accent) 22%, transparent);
}
.vo-art {
  width: 42px; height: 42px; border-radius: 50%; overflow: hidden; display: block; background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, #fff);
}
.vo-art svg { width: 100%; height: 100%; display: block; }
.vo-name { font-weight: 900; font-size: 1.05rem; color: var(--accent-d); }
.voice-opt.selected .vo-name::after { content: " ✓"; }
.vo-sample { margin: 0; width: 38px; height: 38px; padding: 0; justify-content: center; border-width: 2px; font-size: .85rem; }

.summary { margin-top: 24px; text-align: center; animation: popIn .6s var(--bounce) both; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px; border-radius: 999px;
  background: #fff; border: 3px solid #EEE6FF; font-weight: 800;
  box-shadow: 0 4px 0 #E4D9FF;
  animation: popIn .5s var(--bounce) both; animation-delay: calc(var(--i) * .08s);
}

.wizard-nav { display: flex; justify-content: flex-start; margin-top: 24px; }

/* ===================================================== загрузка */
.loading { max-width: 620px; margin: 40px auto 0; padding: 50px 30px 36px; text-align: center; }
.magic-book { position: relative; width: 240px; height: 156px; margin: 14px auto 40px; perspective: 1000px; animation: floaty 2.6s ease-in-out infinite; }
.mb-halo {
  position: absolute; inset: -60px -80px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 200, 60, .25) 0deg 8deg, transparent 8deg 20deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 35%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 35%, transparent 100%);
  animation: spinPlain 16s linear infinite;
}
.mb-cover {
  position: absolute; inset: -12px -14px -16px; border-radius: 20px;
  background: linear-gradient(135deg, #A57BFF, #5F2CD1); box-shadow: 0 10px 0 #3E1A99, 0 0 0 4px #FFC93C;
}
.mb-page, .mb-flip {
  position: absolute; top: 0; bottom: 0; width: 50%;
  background:
    repeating-linear-gradient(180deg, transparent 0 20px, #EFE7FF 20px 24px) 14px 26px / calc(100% - 28px) calc(100% - 40px) no-repeat,
    #fff;
}
.mb-page.left { left: 0; border-radius: 14px 4px 4px 14px; }
.mb-page.right { right: 0; border-radius: 4px 14px 14px 4px; }
.mb-flip {
  right: 0; border-radius: 4px 14px 14px 4px; transform-origin: left center;
  background:
    repeating-linear-gradient(180deg, transparent 0 20px, #FFE0EF 20px 24px) 14px 26px / calc(100% - 28px) calc(100% - 40px) no-repeat,
    linear-gradient(90deg, #F4ECFF, #fff 40%);
  animation: pageFlip 2.4s cubic-bezier(.45, .05, .55, .95) infinite;
}
.mb-flip.f2 { animation-delay: .8s; }
.mb-flip.f3 { animation-delay: 1.6s; }
.mb-sparks i { position: absolute; left: 50%; top: 40%; width: 0; height: 0; animation: sparkFly 2.2s ease-out infinite; opacity: 0; }
.mb-sparks i::before {
  content: "✦"; position: absolute; transform: translate(-50%, -50%);
  font-style: normal; font-size: 22px; color: #FFD84A; text-shadow: 0 0 10px rgba(255, 216, 74, .9);
}
.mb-sparks i:nth-child(1) { --x: -110px; --y: -120px; animation-delay: 0s; }
.mb-sparks i:nth-child(2) { --x: 90px;   --y: -140px; animation-delay: .3s; }
.mb-sparks i:nth-child(3) { --x: -40px;  --y: -160px; animation-delay: .6s; }
.mb-sparks i:nth-child(4) { --x: 130px;  --y: -90px;  animation-delay: .9s; }
.mb-sparks i:nth-child(5) { --x: -140px; --y: -70px;  animation-delay: 1.2s; }
.mb-sparks i:nth-child(6) { --x: 30px;   --y: -170px; animation-delay: 1.5s; }
.mb-sparks i:nth-child(7) { --x: 60px;   --y: -110px; animation-delay: 1.8s; }
.mb-sparks i:nth-child(8) { --x: -80px;  --y: -150px; animation-delay: 2.0s; }
.mb-sparks i:nth-child(3n)::before { content: "❄"; color: #9FD8FF; }
.mb-sparks i:nth-child(4n)::before { content: "★"; color: #FF9ECF; }

.loading-title {
  margin: 0 0 8px; font-weight: 900; font-size: 1.9rem;
  background: linear-gradient(90deg, #6A2CD8, #FF4F9A);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.loading-msg { margin: 0 0 24px; min-height: 1.6em; font-weight: 700; color: var(--ink-2); }
.loading-msg.swap { animation: msgSwap .5s var(--bounce); }
.pbar { height: 30px; padding: 4px; border-radius: 999px; background: #F1EAFF; border: 3px solid #fff; box-shadow: 0 0 0 3px #E8DCFF, inset 0 3px 0 rgba(58, 21, 133, .08); }
.pbar-fill {
  position: relative; height: 100%; width: 3%; min-width: 22px; border-radius: 999px;
  background: repeating-linear-gradient(-45deg, var(--pink) 0 12px, #FF8CC0 12px 24px);
  background-size: 34px 34px;
  animation: stripes .9s linear infinite;
  transition: width .5s var(--soft);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35);
}
.pbar-star {
  position: absolute; right: -14px; top: 50%; font-size: 36px; line-height: 1; color: var(--gold);
  text-shadow: 0 3px 0 var(--gold-d), 0 0 14px rgba(255, 216, 74, .9);
  transform: translateY(-52%); animation: spin 2.4s linear infinite;
}
.pbar-pct { margin-top: 12px; font: 700 1.3rem/1 var(--round); color: var(--pink-d); }

.error-box { margin-top: 18px; animation: popIn .6s var(--bounce) both; }
.err-face { font-size: 3.4rem; animation: wiggle 1.6s ease-in-out infinite; }
.error-box p { font-weight: 700; font-size: 1.08rem; }
.err-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.loading.has-error .magic-book, .loading.has-error .pbar, .loading.has-error .pbar-pct,
.loading.has-error .loading-msg, .loading.has-error .loading-title { display: none; }

/* ===================================================== результат */
.result { max-width: 880px; margin: 0 auto; }
.result-title { margin: 10px 0 30px; text-align: center; font-weight: 900; font-size: clamp(1.9rem, 5vw, 3.1rem); line-height: 1.2; }
.result-title > .toon { display: inline-block; animation: lineIn .8s var(--bounce) both; }
.party { display: inline-block; animation: partyPop 1s var(--bounce) both .3s, wiggle 2s ease-in-out 1.3s infinite; }

.player { padding: 30px 22px 22px; animation: popIn .7s var(--bounce) both .15s; }
.cover {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center;
  padding: 22px; border-radius: 28px; color: #fff;
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 255, 255, .7) 0 1.5px, transparent 2.5px) 0 0 / 46px 46px,
    radial-gradient(circle at 60% 70%, rgba(255, 255, 255, .5) 0 1px, transparent 2px) 0 0 / 30px 30px,
    radial-gradient(90% 120% at 100% 100%, rgba(255, 120, 200, .55), transparent 60%),
    linear-gradient(135deg, #2B1876 0%, #5A2DB3 55%, #A64BC9 100%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25);
  animation: coverStars 14s linear infinite;
}
.cover-art {
  width: 128px; height: 128px; border-radius: 50%; overflow: hidden; background: #fff;
  border: 6px solid #FFC93C; box-shadow: 0 0 0 5px #fff, 0 0 40px rgba(255, 214, 110, .7);
  animation: floaty 4s ease-in-out infinite;
}
.cover-art svg { width: 100%; height: 100%; display: block; }
.cover-name {
  --o: #3A1585; --x: #1E0752;
  --fill: linear-gradient(180deg, #FFFBE0 0%, #FFE47A 45%, #FFB21A 100%);
  font-weight: 900; font-size: clamp(2rem, 5.4vw, 2.8rem); line-height: 1.15;
}
.cover-meta { margin-top: 10px; font-weight: 800; color: #fff; opacity: .95; }
.cover-title { margin-top: 4px; font-weight: 700; font-size: .98rem; color: #F3E8FF; opacity: .85; }
.demo-badge {
  position: absolute; top: 14px; right: -36px; transform: rotate(35deg);
  padding: 4px 42px; background: var(--gold); color: #5A3500; font: 700 .8rem/1.3 var(--round);
}

.controls { display: flex; align-items: center; gap: 20px; margin: 22px 6px 20px; }
.play-btn {
  position: relative; flex: 0 0 auto; width: 92px; height: 92px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, #FF9CCB, #FF4F9A 55%, #E0307F);
  border: 5px solid #fff;
  box-shadow: 0 8px 0 #A81F5E, 0 18px 28px -8px rgba(196, 42, 114, .7);
  transition: transform .4s var(--bounce), box-shadow .2s;
}
.play-btn::before {
  content: ""; position: absolute; left: 16px; right: 16px; top: 6px; height: 36%; border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .6), rgba(255, 255, 255, 0));
}
.play-btn svg { width: 40px; height: 40px; grid-area: 1 / 1; transition: transform .4s var(--bounce), opacity .2s; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .2)); }
.play-btn .i-play { transform: translateX(2px); }
.play-btn .i-pause, .mini-play .i-pause { opacity: 0; transform: scale(.3) rotate(-90deg); }
.playing .play-btn .i-play, .mini.playing .i-play { opacity: 0; transform: scale(.3) rotate(90deg); }
.playing .play-btn .i-pause, .mini.playing .i-pause { opacity: 1; transform: none; }
.play-btn:hover { transform: scale(1.08) rotate(-4deg); }
.play-btn:active { transform: translateY(6px) scale(.96); box-shadow: 0 2px 0 #A81F5E; }
.play-ring {
  position: absolute; inset: -10px; border-radius: 50%; border: 5px solid var(--pink); opacity: 0;
  animation: ringPulse 1.8s ease-out infinite; pointer-events: none;
}
.playing .play-ring { animation: none; }
.playing .play-btn { animation: breathe 1.4s ease-in-out infinite; }

.track-wrap { flex: 1; min-width: 0; }
.eq { display: flex; align-items: flex-end; gap: 5px; height: 28px; margin-bottom: 8px; }
.eq i { width: 8px; height: 100%; border-radius: 4px; transform: scaleY(.18); transform-origin: bottom; transition: transform .3s; }
.eq i:nth-child(1) { background: var(--pink); }
.eq i:nth-child(2) { background: var(--purple); }
.eq i:nth-child(3) { background: var(--sky); }
.eq i:nth-child(4) { background: var(--mint); }
.eq i:nth-child(5) { background: var(--gold); }
.eq i:nth-child(6) { background: var(--pink); }
.eq i:nth-child(7) { background: var(--purple); }
.playing .eq i { animation: eq .8s ease-in-out infinite alternate; }
.playing .eq i:nth-child(2) { animation-delay: -.3s; animation-duration: .7s; }
.playing .eq i:nth-child(3) { animation-delay: -.6s; animation-duration: .9s; }
.playing .eq i:nth-child(4) { animation-delay: -.2s; animation-duration: .65s; }
.playing .eq i:nth-child(5) { animation-delay: -.5s; animation-duration: .85s; }
.playing .eq i:nth-child(6) { animation-delay: -.1s; animation-duration: .75s; }
.playing .eq i:nth-child(7) { animation-delay: -.4s; animation-duration: .95s; }

.seek {
  position: relative; height: 20px; border-radius: 999px; cursor: pointer; touch-action: none;
  background: #F1EAFF; border: 3px solid #fff; box-shadow: 0 0 0 3px #E8DCFF, inset 0 3px 0 rgba(58, 21, 133, .08); outline: none;
}
.seek:focus-visible { box-shadow: 0 0 0 4px rgba(139, 92, 246, .45); }
.seek-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px;
  background: repeating-linear-gradient(-45deg, var(--pink) 0 10px, #FF8CC0 10px 20px);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35);
}
.seek-thumb {
  position: absolute; top: 50%; left: 0; width: 38px; height: 38px; margin: -19px 0 0 -19px;
  display: grid; place-items: center;
  font-size: 34px; line-height: 1; color: var(--gold); pointer-events: none;
  text-shadow: 0 3px 0 var(--gold-d), 0 0 10px rgba(255, 216, 74, .8);
  transition: scale .3s var(--bounce);
}
.playing .seek-thumb { animation: thumbSpin 3s linear infinite; }
.seek.dragging .seek-thumb, .seek:hover .seek-thumb { scale: 1.3; }
.times { display: flex; justify-content: space-between; margin-top: 10px; font: 600 .95rem/1 var(--round); color: var(--ink-2); }

.actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; padding: 8px 0 6px; }
.actions .btn { font-size: 1rem; padding: 14px 24px; }

.book { margin-top: 34px; padding: 34px 30px 34px; animation: popIn .7s var(--bounce) both .35s; }
.book-head { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.book-ico { font-size: 1.9rem; animation: wiggle 3s ease-in-out infinite; }
.follow { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: .95rem; cursor: pointer; user-select: none; }
.follow input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 54px; height: 32px; border-radius: 999px; background: #E3D8FF; transition: background .3s; box-shadow: inset 0 3px 0 rgba(0, 0, 0, .08); }
.switch i { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 3px 0 rgba(58, 21, 133, .2); transition: transform .45s var(--bounce); }
.follow input:checked + .switch { background: var(--mint); }
.follow input:checked + .switch i { transform: translateX(22px); }
.follow input:focus-visible + .switch { outline: 3px solid var(--purple); outline-offset: 2px; }

.book-body { position: relative; z-index: 1; font-size: 1.13rem; line-height: 1.8; }
.story-title {
  margin: 6px 0 4px; text-align: center; font-weight: 900; font-size: clamp(1.5rem, 4vw, 2.2rem); line-height: 1.25;
  background: linear-gradient(90deg, #6A2CD8, #C42A9A 60%, #FF4F9A);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.story-sub { margin: 0 0 18px; text-align: center; font-weight: 700; color: var(--ink-2); }
.chapter {
  display: flex; align-items: center; gap: 10px;
  margin: 28px 0 10px; font-weight: 900; font-size: 1.3rem; color: var(--pink-d);
}
.chapter::before {
  content: "★"; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  color: #fff; font-size: 1.1rem; background: linear-gradient(180deg, #FFE27A, var(--gold)); box-shadow: 0 3px 0 var(--gold-d);
}
.para {
  position: relative; margin: 2px -12px; padding: 6px 12px; border-radius: 16px; font-weight: 600;
  cursor: pointer; transition: background .35s, transform .45s var(--bounce), box-shadow .35s;
}
.para:hover { background: #FFF6E2; }
.reading {
  background: linear-gradient(90deg, #FFF2B3, #FFE1F0) !important;
  box-shadow: 0 5px 0 #FFD48A;
  transform: scale(1.015);
}
.para.reading::before {
  content: "🔊"; position: absolute; left: -32px; top: 8px; font-size: 1.1rem; animation: beat .7s ease-in-out infinite;
}
.chapter.reading, .story-title.reading, .story-sub.reading { position: relative; border-radius: 14px; }
.the-end {
  margin: 30px 0 0; text-align: center; font-weight: 900; font-size: 2rem; letter-spacing: 4px; color: var(--pink);
  text-shadow: 0 4px 0 rgba(196, 42, 114, .25);
}
.the-end::before, .the-end::after { content: "✦"; color: var(--gold); margin: 0 12px; display: inline-block; animation: spinPlain 4s linear infinite; }
.moral {
  margin: 26px 0 0; padding: 16px 20px; border-radius: 22px; cursor: pointer;
  font-weight: 700; line-height: 1.7; color: var(--ink);
  background: linear-gradient(180deg, #F3EDFF, #FFF1F8); border: 3px dashed rgba(139, 92, 246, .35);
  transition: background .35s, box-shadow .35s;
}
.moral-label { display: block; margin-bottom: 4px; color: var(--purple-d); font-weight: 900; }

/* мини-плеер */
.mini {
  position: fixed; z-index: 30; left: 50%; bottom: 14px;
  width: min(580px, calc(100% - 24px));
  display: flex; align-items: center; gap: 12px; padding: 8px 20px 8px 8px;
  background: #fff; border-radius: 999px; border: 4px solid #fff;
  box-shadow: 0 0 0 4px rgba(255, 214, 110, .6), 0 8px 0 rgba(20, 5, 70, .3), 0 24px 40px -10px rgba(5, 0, 30, .6);
  transform: translate(-50%, 170%); transition: transform .6s var(--bounce);
}
.mini.show { transform: translate(-50%, 0); }
.mini-play {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: 50%; cursor: pointer; color: #fff;
  display: grid; place-items: center; border: 3px solid #fff;
  background: linear-gradient(180deg, #FF9CCB, #FF4F9A 55%, #E0307F); box-shadow: 0 4px 0 #A81F5E;
  transition: transform .35s var(--bounce);
}
.mini-play svg { width: 26px; height: 26px; grid-area: 1 / 1; transition: transform .4s var(--bounce), opacity .2s; }
.mini-play:active { transform: scale(.92); }
.mini-info { flex: 1; min-width: 0; }
.mini-title { font-weight: 800; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-bar { margin-top: 6px; height: 9px; border-radius: 9px; background: #F1EAFF; overflow: hidden; }
.mini-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--purple)); border-radius: 9px; }
.mini-time { font: 600 .9rem/1 var(--round); color: var(--ink-2); }

.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 100px; max-width: calc(100% - 32px);
  padding: 14px 24px; border-radius: 999px; color: #fff; font-weight: 800;
  background: linear-gradient(180deg, #5A2DB3, #3A1585); border: 3px solid #fff;
  box-shadow: 0 10px 30px rgba(5, 0, 30, .5);
  transform: translate(-50%, 30px) scale(.6); opacity: 0; pointer-events: none;
  transition: transform .5s var(--bounce), opacity .25s;
}
.toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; }

#confetti { position: fixed; inset: 0; z-index: 50; pointer-events: none; }

.foot {
  position: relative; z-index: 5; width: fit-content; margin: 0 auto 26px; padding: 9px 20px;
  font-weight: 800; color: #fff; border-radius: 999px;
  background: rgba(40, 12, 110, .55); border: 2px solid rgba(255, 255, 255, .3);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.foot b { font-family: var(--round); color: #FFB3D6; }
.heart { display: inline-block; color: var(--pink); animation: beat 1s ease-in-out infinite; }
body.has-mini .foot { margin-bottom: 104px; }

/* персонажи и эффекты */
.blink { animation: blink 4.5s infinite; transform-box: fill-box; transform-origin: center; }
.burst-p {
  position: fixed; z-index: 55; pointer-events: none; line-height: 1;
  transform: translate(-50%, -50%);
  animation: burstFly .85s cubic-bezier(.2, .7, .3, 1) forwards;
  text-shadow: 0 2px 0 rgba(58, 21, 133, .15);
}

/* ===================================================== анимации */
@keyframes screenIn { from { opacity: 0; transform: translateY(40px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes screenOut { to { opacity: 0; transform: translateY(-20px) scale(.97); } }
@keyframes stepIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@keyframes stepInRight { from { opacity: 0; transform: translateX(70px) rotate(2deg); } to { opacity: 1; transform: none; } }
@keyframes stepInLeft { from { opacity: 0; transform: translateX(-70px) rotate(-2deg); } to { opacity: 1; transform: none; } }
@keyframes stepOutLeft { to { opacity: 0; transform: translateX(-60px) rotate(-2deg); } }
@keyframes stepOutRight { to { opacity: 0; transform: translateX(60px) rotate(2deg); } }
/* через свойство scale, чтобы не мешать transform при наведении */
@keyframes popIn { 0% { opacity: 0; scale: .5; } 100% { opacity: 1; scale: 1; } }
@keyframes sway { from { transform: rotate(-4deg) translateY(0); } to { transform: rotate(4deg) translateY(-8px); } }
@keyframes balloonWobble { 0% { transform: scale(1); } 30% { transform: scale(1.18, .86); } 55% { transform: scale(.9, 1.12); } 80% { transform: scale(1.04, .97); } 100% { transform: scale(1); } }
@keyframes lineIn { 0% { opacity: 0; transform: translateY(30px) rotate(-4deg) scale(.9); } 100% { opacity: 1; transform: none; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(-2deg); } }
@keyframes swing { 0%, 100% { rotate: -5deg; } 50% { rotate: 5deg; } }
@keyframes letterBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes letterJump { 0% { transform: translateY(0); } 40% { transform: translateY(-14px) rotate(-8deg); } 100% { transform: translateY(0); } }
@keyframes hatWiggle { 0%, 100% { transform: rotate(-22deg); } 50% { transform: rotate(-12deg) translateY(-2px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(5deg); } }
@keyframes jelly {
  0% { transform: scale(1, 1); } 30% { transform: scale(1.12, .88); } 45% { transform: scale(.92, 1.08); }
  60% { transform: scale(1.05, .95); } 75% { transform: scale(.98, 1.02); } 100% { transform: scale(1, 1); }
}
@keyframes happyJump { 0% { transform: translateY(0); } 35% { transform: translateY(-22px) rotate(-6deg) scale(1.08); } 65% { transform: translateY(0) scale(1.04, .94); } 100% { transform: none; } }
@keyframes pulseScale { 0%, 100% { scale: 1; } 50% { scale: 1.06; } }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
@keyframes drift { from { left: -260px; } to { left: calc(100% + 60px); } }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.6) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(25deg); } }
@keyframes glowPulse { 0%, 100% { opacity: .7; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes auroraA { from { transform: translate(0, 0) rotate(-8deg); } to { transform: translate(18vw, 6vh) rotate(6deg); } }
@keyframes auroraB { from { transform: translate(0, 0) rotate(6deg); } to { transform: translate(-16vw, 8vh) rotate(-6deg); } }
@keyframes shoot {
  0%, 88% { opacity: 0; transform: translate(0, 0) rotate(-24deg); }
  90% { opacity: 1; }
  100% { opacity: 0; transform: translate(-340px, 150px) rotate(-24deg); }
}
@keyframes sleighFly {
  0% { transform: translate(110vw, 40px); }
  40% { transform: translate(-260px, -30px); }
  100% { transform: translate(-260px, -30px); }
}
@keyframes windowGlow { 0%, 100% { fill: #FFD66B; } 50% { fill: #FFF3B0; } }
@keyframes lampBlink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes bulbBlink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes smoke {
  0% { opacity: 0; transform: translate(0, 0) scale(.6); }
  20% { opacity: .75; }
  100% { opacity: 0; transform: translate(14px, -46px) scale(1.8); }
}
@keyframes sparkUp {
  0% { opacity: 0; transform: translate(-50%, 20px) scale(.4); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), -170px) scale(1.2) rotate(90deg); }
}
@keyframes giftHop { 0%, 60%, 100% { transform: translateY(0) rotate(0); } 70% { transform: translateY(-18px) rotate(-8deg); } 80% { transform: translateY(0) rotate(4deg) scale(1.06, .94); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -160% 0; } }
@keyframes starPulse { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.14) rotate(10deg); } }
@keyframes starPop { 0% { transform: scale(.4) rotate(-90deg); } 70% { transform: scale(1.3) rotate(10deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes write { from { transform: translateY(-50%) rotate(-10deg) translateX(-2px); } to { transform: translateY(-60%) rotate(8deg) translateX(3px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-12px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-7px); } 80% { transform: translateX(4px); } }
@keyframes handWave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(18deg); } 20%, 40% { transform: rotate(-10deg); } }
@keyframes letterWave { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes letterPop { 0% { transform: scale(0) rotate(-30deg); } 70% { transform: scale(1.4) rotate(8deg); } 100% { transform: scale(1); } }
@keyframes blinkDots { 50% { opacity: .2; } }
@keyframes pageFlip { 0% { transform: rotateY(0); } 55%, 100% { transform: rotateY(-180deg); } }
@keyframes sparkFly {
  0% { opacity: 0; transform: translate(0, 0) scale(.3); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1.3) rotate(160deg); }
}
@keyframes msgSwap { 0% { opacity: 0; transform: translateY(14px) scale(.9); } 100% { opacity: 1; transform: none; } }
@keyframes stripes { to { background-position: 34px 0; } }
@keyframes spin { to { transform: translateY(-52%) rotate(360deg); } }
@keyframes spinPlain { to { transform: rotate(360deg); } }
@keyframes partyPop { 0% { transform: scale(0) rotate(-60deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes coverStars { to { background-position: 0 460px, 0 300px, 0 0, 0 0; } }
@keyframes ringPulse { 0% { opacity: .7; transform: scale(.95); } 100% { opacity: 0; transform: scale(1.35); } }
@keyframes breathe { 0%, 100% { scale: 1; } 50% { scale: 1.05; } }
@keyframes eq { from { transform: scaleY(.2); } to { transform: scaleY(1); } }
@keyframes thumbSpin { to { rotate: 360deg; } }
@keyframes beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes burstFly {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(.3); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(var(--rot)); }
}

/* ===================================================== адаптив */
@media (max-width: 1000px) {
  .burger { display: grid; }
  .menu {
    position: absolute; top: 96px; right: 18px; flex-direction: column; align-items: stretch; gap: 12px;
    padding: 30px 16px 18px; width: min(290px, calc(100vw - 36px));
    background: var(--paper); border-radius: 30px; border: 5px solid #fff;
    box-shadow: 0 0 0 5px rgba(255, 214, 110, .6), 0 14px 0 rgba(20, 5, 70, .3), 0 30px 60px -10px rgba(5, 0, 30, .7);
    transform-origin: calc(100% - 30px) 0;
    transform: scale(.4) translateY(-20px); opacity: 0; pointer-events: none;
    transition: transform .5s var(--bounce), opacity .2s;
  }
  .menu::before {
    content: ""; position: absolute; top: -17px; left: 18px; right: 18px; height: 46px;
    background: var(--snowcap) repeat-x 0 0 / 160px 46px; border-radius: 20px 20px 0 0;
  }
  .menu.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav-btn { font-size: 1.08rem; padding: 8px 18px 8px 8px; opacity: 0; translate: 24px 0; transition: transform .4s var(--bounce), translate .45s var(--bounce), opacity .25s; }
  .menu.open .nav-btn { opacity: 1; translate: 0 0; transition-delay: calc(.08s + var(--i) * .07s); }
  .menu.open .nav-btn:hover { transition-delay: 0s; }
  .hero { grid-template-columns: 1fr; min-height: 0; gap: 0; padding-top: 0; }
  /* на планшете и телефоне — сначала заголовок и кнопка «Սկսել», картинка ниже */
  .hero-art { max-width: 420px; margin-top: 30px; }
  .hero-text { order: -1; text-align: center; padding-top: 4px; }
  .hero-sub { margin-left: auto; margin-right: auto; }
  .ribbon { margin-left: 0; }
}

@media (max-width: 640px) {
  .topbar { padding: 26px 14px 6px; }
  .logo { font-size: 1.9rem; }
  .logo-hat { width: 36px; left: -12px; top: -11px; }
  .icon-btn { width: 46px; height: 46px; }
  .burger span { left: 10px; width: 20px; }
  .burger span:nth-child(1) { top: 12px; }
  .burger span:nth-child(2), .burger.open span:nth-child(1), .burger.open span:nth-child(3) { top: 18.5px; }
  .burger span:nth-child(3) { top: 25px; }
  .menu { top: 84px; right: 14px; }
  .moon { width: 70px; height: 70px; top: 92px; right: 4%; }
  .sleigh { width: 120px; top: 12%; }
  main { padding: 4px 14px 30px; }
  .hero-art { max-width: 320px; margin-top: 24px; }
  .hero-title { font-size: 2.2rem; margin: 14px 0 12px; }
  .toon {
    text-shadow:
      4px 0 var(--o), -4px 0 var(--o), 0 4px var(--o), 0 -4px var(--o),
      2.8px 2.8px var(--o), -2.8px 2.8px var(--o), 2.8px -2.8px var(--o), -2.8px -2.8px var(--o),
      3.7px 1.5px var(--o), -3.7px 1.5px var(--o), 3.7px -1.5px var(--o), -3.7px -1.5px var(--o),
      1.5px 3.7px var(--o), -1.5px 3.7px var(--o), 1.5px -3.7px var(--o), -1.5px -3.7px var(--o),
      0 8px var(--x), 3px 7px var(--x), -3px 7px var(--x),
      0 12px 22px rgba(8, 0, 40, .45);
  }
  .hero-sub { font-size: 1rem; padding: 10px 16px; margin-bottom: 22px; }
  .balloons { gap: 2px 16px; max-width: 360px; }
  .balloons.many { gap: 2px 8px; max-width: 420px; }
  .balloons.many .num { font-size: clamp(1.05rem, 5vw, 1.6rem); }
  .balloons.many .age-word { font-size: clamp(.58rem, 2.3vw, .8rem); }
  .voice-opt { padding-right: 5px; }
  .tale-grid { grid-template-columns: 1fr; gap: 20px; }
  .tale { min-height: 76px; padding: 12px 42px 12px 12px; border-radius: 22px; }
  .tale-ico { width: 52px; height: 52px; font-size: 1.6rem; }
  .tale-tag { left: 72px; }
  .btn-huge { font-size: 1.3rem; padding: 18px 34px; }
  .card { border-radius: 30px; }
  .card::after { border-radius: 23px; }
  .wizard { padding: 36px 14px 18px; }
  .sp-star { width: 42px; height: 42px; }
  .sp-line { width: 18px; }
  .choices.two { gap: 12px; }
  .choice { padding: 14px 6px 16px; border-radius: 26px; }
  .choice-stage { width: 112px; }
  .choice-rays { inset: -14px; }
  .choice-label { font-size: 1.15rem; padding: 6px 16px; margin-top: -14px; }
  .choice-note { font-size: .82rem; }
  .choice-check { width: 32px; height: 32px; top: 8px; right: 8px; font-size: .95rem; }
  .sample-btn { padding: 8px 12px; font-size: .9rem; }
  #nameInput { padding: 16px 18px 16px 56px; }
  .name-pencil { left: 18px; font-size: 1.4rem; }
  .loading { padding: 44px 18px 28px; }
  .magic-book { width: 196px; height: 128px; }
  .result-title { font-size: 1.7rem; margin-top: 4px; }
  .player { padding: 28px 14px 18px; }
  .cover { grid-template-columns: 1fr; text-align: center; justify-items: center; gap: 12px; }
  .cover-art { width: 108px; height: 108px; }
  .controls { gap: 14px; margin: 18px 0 16px; }
  .play-btn { width: 76px; height: 76px; }
  .play-btn svg { width: 34px; height: 34px; }
  .actions .btn { flex: 1 1 100%; }
  .book { padding: 30px 16px 26px; }
  .book-body { font-size: 1.05rem; }
  .para { margin: 2px -8px; padding: 6px 8px; }
  .para.reading::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  #snow, .sleigh, .shooting { display: none; }
}
