/* Кинотост — мини-приложение «торт». Сцена своя (не зависит от темы мессенджера). */
@font-face { font-family: "Nunito"; src: url("fonts/nunito.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }
@font-face { font-family: "Oswald"; src: url("fonts/oswald-cyr.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Oswald"; src: url("fonts/oswald-lat.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20BD; }
@font-face { font-family: "Caveat"; src: url("fonts/caveat.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --accent: #d4432a;
  --navy: #1f1b4b;
  --ink: #2a2350;
  --app-h: 100vh;
  --cw: 300px;
  /* Вырезы экрана: системные + те, что сообщает мессенджер в полноэкранном режиме */
  --st: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px));
  --sb: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --ct: var(--tg-content-safe-area-inset-top, 0px);
  --cb: var(--tg-content-safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0e0b24; overscroll-behavior: none; }
html.lit, html.lit body { background: #fff3ea; }
body {
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #fff; -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; }
.app { position: fixed; left: 0; right: 0; top: 0; height: var(--app-h); overflow: hidden; }

/* ---------- фон: «свет выключен» → «свет включили» ---------- */
.bg { position: absolute; inset: 0; pointer-events: none; }
.bg-night { background: radial-gradient(120% 70% at 50% 60%, #2a2163 0%, #171239 50%, #0e0b24 100%); }
.bg-warm {
  opacity: 0; transition: opacity .55s ease-out;
  background:
    radial-gradient(60% 34% at 50% 66%, rgba(255, 196, 206, .75) 0%, rgba(255, 196, 206, 0) 100%),
    radial-gradient(130% 80% at 50% 60%, #ffe6dc 0%, #fff1e8 55%, #fff3ea 100%);
}
.lit .bg-warm { opacity: 1; }
.flash { position: absolute; inset: 0; background: #fff8ec; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .7s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }

.stars { position: absolute; inset: 0; pointer-events: none; transition: opacity .5s; }
.stars i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; opacity: .15; animation: tw 3.2s ease-in-out infinite; }
@keyframes tw { 0%, 100% { opacity: .08; transform: scale(.7); } 50% { opacity: .55; transform: scale(1); } }
.lit .stars { opacity: 0; }

/* Флажки сверху: опускаются, когда «включили свет» */
.bunting { position: absolute; left: 0; right: 0; top: calc(var(--st) + var(--ct) - 4px); height: 80px; pointer-events: none; transform: translateY(-120%); }
.bunting svg { display: block; width: 100%; height: 100%; overflow: visible; }
.lit .bunting { transform: none; transition: transform .9s cubic-bezier(.3, 1.45, .45, 1) .1s; }
.bunting .fs { animation: swing 2.6s ease-in-out infinite alternate; }
@keyframes swing { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }

/* ---------- звук ---------- */
.snd {
  position: absolute; z-index: 6; top: calc(var(--st) + var(--ct) + 10px); right: 12px;
  width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .85); display: grid; place-items: center;
  transition: background .4s, color .4s, opacity .4s;
}
.snd svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.snd .spk { fill: currentColor; }
.snd .x { display: none; }
.snd.off .wv { display: none; }
.snd.off .x { display: inline; }
.lit .snd { background: rgba(31, 27, 75, .07); color: var(--navy); }

/* ---------- экраны ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.screen[hidden] { display: none; }
.screen.fade-out { opacity: 0; transition: opacity .3s; }

.hd { position: relative; z-index: 3; padding: calc(var(--st) + var(--ct) + 62px) 20px 0; text-align: center; min-height: calc(var(--st) + var(--ct) + 172px); }
.title { margin: 0; font-weight: 900; line-height: 1.05; letter-spacing: -.01em; }
.t-name {
  display: block; font-size: 46px; color: #ffd38a;
  text-shadow: 0 0 24px rgba(255, 180, 90, .45);
  opacity: 0; transform: translateY(18px) scale(.6);
  transition: transform .75s cubic-bezier(.2, 1.6, .4, 1), opacity .25s, color .6s, text-shadow .6s;
}
.t-name:empty { display: none; }
.t-name.long { font-size: 36px; }
.t-line {
  display: block; font-size: 29px; margin-top: 4px; color: #fff;
  opacity: 0; transform: translateY(14px);
  transition: transform .6s cubic-bezier(.2, 1.4, .4, 1) .12s, opacity .3s .12s, color .6s;
}
.t-name:empty + .t-line { font-size: 36px; }
.title.show .t-name, .title.show .t-line { opacity: 1; transform: none; }
.sub {
  margin: 12px 0 0; font-size: 17px; font-weight: 700; color: rgba(255, 255, 255, .78);
  opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s, color .6s;
}
.sub.show { opacity: 1; transform: none; }
.lit .t-name { color: var(--accent); text-shadow: none; }
.lit .t-line { color: var(--navy); }
.lit .sub { color: #6d6680; }

.stage {
  position: relative; z-index: 1; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  touch-action: none; cursor: pointer;
}
.cake-slot { position: relative; z-index: 1; transform-origin: 50% 100%; transition: transform 1s cubic-bezier(.3, 1.2, .4, 1); }

/* ---------- торт-персонаж ---------- */
.cake { position: relative; width: var(--cw); height: calc(var(--cw) * 1.1); transition: filter .45s ease-out; }
.cake.mini { --cw: 168px; flex: none; }
.cake > svg, .cake .cj, .cake .ct, .cake .ct > svg, .cake .cj > svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.cake .cj { transform-origin: 50% 90.3%; will-change: transform; }
.cake .ct { transform-origin: 50% 62.7%; will-change: transform; }
.cake .csh {
  position: absolute; left: 11.5%; width: 77%; top: 84.8%; height: 9.4%;
  background: radial-gradient(closest-side, rgba(70, 30, 70, .38), rgba(70, 30, 70, 0));
  will-change: transform, opacity;
}

/* лицо: все варианты глаз и рта лежат друг на друге, показываем нужные */
.cake .e-cl, .cake .e-hp, .cake .e-sq,
.cake .m-sm, .cake .m-sl, .cake .m-o, .cake .m-hp, .cake .m-sq { opacity: 0; transition: opacity .09s, transform .2s cubic-bezier(.3, 1.6, .5, 1); transform: scale(.6); }
/* у открытых глаз transform задаёт скрипт (взгляд, моргание) — здесь только видимость */
.cake .eo { opacity: 0; transition: opacity .06s; }
.cake[data-face="open"] .eo, .cake[data-face="o"] .eo, .cake[data-face="joy"] .eo { opacity: 1; }
.cake[data-face="sleep"] .e-cl, .cake[data-face="sleep"] .m-sl,
.cake[data-face="open"] .m-sm,
.cake[data-face="o"] .m-o,
.cake[data-face="joy"] .m-hp,
.cake[data-face="happy"] .e-hp, .cake[data-face="happy"] .m-hp,
.cake[data-face="squeeze"] .e-sq, .cake[data-face="squeeze"] .m-sq { opacity: 1; transform: none; }
.cake .bl { opacity: .75; transition: opacity .3s, transform .3s; transform-box: fill-box; transform-origin: center; }
.cake[data-face="sleep"] .bl { opacity: .35; }
.cake[data-face="happy"] .bl, .cake[data-face="squeeze"] .bl, .cake[data-face="joy"] .bl { opacity: 1; transform: scale(1.15); }

/* ручки */
/* тонкие ручки с ладошками: видны только в радости («ура!» и «привет!») */
.cake .arm { opacity: 0; transform: rotate(-80deg) scale(.3); transition: opacity .12s, transform .45s cubic-bezier(.3, 1.7, .5, 1); }
.cake[data-arms="up"] .arm { opacity: 1; transform: none; }
.cake[data-arms="wave"] .arm-r { opacity: 1; transform: none; animation: wave .32s ease-in-out infinite alternate; }
@keyframes wave { from { transform: rotate(-28deg); } to { transform: rotate(18deg); } }

/* свечи-персонажи */
.cn .ce-o, .cn .ce-sq, .cn .ce-cl, .cn .cm-s, .cn .cm-o { opacity: 0; transition: opacity .1s; }
.cn.awake .ce-o, .cn.awake .cm-s,
.cn.squint .ce-sq, .cn.squint .cm-o,
.cn.sleep .ce-cl, .cn.sleep .cm-s,
.cn.out .ce-cl, .cn.out .cm-s { opacity: 1; }
.cn .cnb { transform-box: fill-box; transform-origin: 50% 100%; }
.cn.hop .cnb { animation: chop .42s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes chop { 0% { transform: scale(1.12, .82); } 45% { transform: translateY(-6px) scale(.92, 1.1); } 100% { transform: none; } }
.cn.shiver .cnb { animation: shiver .12s linear infinite alternate; }
@keyframes shiver { from { transform: rotate(-2.5deg); } to { transform: rotate(2.5deg); } }

/* подсказка «зажмите пальцем» — кольцо на торте */
.press { position: absolute; left: 50%; top: 73%; width: 72px; height: 72px; margin: -36px 0 0 -36px; pointer-events: none; opacity: 0; }
.press::before, .press i { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.press::before { border: 3px solid rgba(255, 255, 255, .85); }
.press i { inset: 26px; background: rgba(255, 255, 255, .9); }
.press.show { animation: press 1.7s ease-in-out infinite; }
@keyframes press { 0% { opacity: 0; transform: scale(1.25); } 30% { opacity: .9; transform: scale(.9); } 60% { opacity: .9; transform: scale(.82); } 100% { opacity: 0; transform: scale(.82); } }

/* ---------- записка с пожеланием ---------- */
.note {
  position: absolute; z-index: 0; left: 50%; top: var(--note-top, 0px);
  width: min(318px, calc(100vw - 48px)); margin-left: calc(min(318px, calc(100vw - 48px)) / -2);
  padding: 24px 22px 14px; border-radius: 12px; color: var(--ink);
  background:
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(120, 140, 200, .16) 31px 32px) 0 21px / 100% calc(100% - 40px) no-repeat,
    #fffdf6;
  box-shadow: 0 14px 34px rgba(90, 30, 50, .16), 0 2px 5px rgba(90, 30, 50, .08);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(var(--from, 220px)) scale(.18) rotate(8deg);
}
.note.show {
  opacity: 1; visibility: visible; transform: rotate(-2.2deg);
  transition: transform 1s cubic-bezier(.22, 1.3, .36, 1), opacity .2s;
}
.note .tape { position: absolute; top: -11px; left: 50%; width: 88px; height: 24px; margin-left: -44px; background: rgba(255, 140, 170, .62); border-radius: 3px; transform: rotate(-3deg); }
.note-text { margin: 0; font: 600 27px/32px "Caveat", cursive; white-space: pre-line; overflow-wrap: anywhere; }
.note-text.long { font-size: 24px; }
.note-sign { margin: 4px 0 0; font: 700 27px/1.1 "Caveat", cursive; color: var(--accent); text-align: right; }
.note-sign:empty { display: none; }

/* ---------- низ: кнопки ---------- */
.ft { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; padding: 6px 22px calc(var(--sb) + var(--cb) + 12px); }
.ft-main { position: relative; width: 100%; max-width: 340px; height: 96px; }
.ctl { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-direction: column; align-items: center; opacity: 0; transform: translateY(18px); pointer-events: none; transition: opacity .35s, transform .55s cubic-bezier(.2, 1.5, .4, 1); }
.ctl.show { opacity: 1; transform: none; pointer-events: auto; }
.btn {
  appearance: none; border: 0; cursor: pointer; width: 100%; max-width: 340px; height: 58px; padding: 0 24px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font: 800 18px/1 "Nunito", system-ui, sans-serif; letter-spacing: .01em;
  box-shadow: 0 10px 24px rgba(212, 67, 42, .38), inset 0 -3px 0 rgba(0, 0, 0, .13);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .15s, background .3s, box-shadow .3s;
}
.btn:active { transform: scale(.96); }
.btn[hidden] { display: none; }
.btn[disabled] { opacity: .7; cursor: default; }
.btn .lv { display: none; align-items: center; gap: 3px; height: 22px; }
.btn .lv i { display: block; width: 4px; border-radius: 2px; background: currentColor; height: calc(5px + 16px * var(--lv, 0)); transition: height .06s; }
.btn .lv i:nth-child(2) { height: calc(5px + 20px * var(--lv, 0)); }
.btn.listen { background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .45); }
.btn.listen .lv { display: inline-flex; }
.hint { margin: 10px 0 0; font-size: 15px; font-weight: 700; color: rgba(255, 255, 255, .62); text-align: center; }
.hint.big { font-size: 18px; color: rgba(255, 255, 255, .9); margin-top: 22px; }
.logo { margin-top: 2px; font-weight: 900; font-size: 15px; letter-spacing: -.01em; color: rgba(255, 255, 255, .45); transition: color .6s; }
/* логотип — ссылка на главную: место под палец больше надписи, а вёрстка не сдвигается */
a.logo { display: block; width: max-content; margin: -6px auto -8px; padding: 8px 14px; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.logo span { color: #ff7a5f; transition: color .6s; }
.lit .logo { color: rgba(31, 27, 75, .55); }
.lit .logo span { color: var(--accent); }

/* ---------- экраны «Торт для друга» / «Торт отправлен!» ---------- */
.s-panel { overflow-y: auto; -webkit-overflow-scrolling: touch; color: var(--navy); }
.panel-in { min-height: 100%; display: flex; flex-direction: column; align-items: center; text-align: center; padding: calc(var(--st) + var(--ct) + 70px) 22px calc(var(--sb) + var(--cb) + 18px); }
.panel-in > .cake { margin-top: auto; }
.panel-in .cake { margin-bottom: 2px; touch-action: manipulation; cursor: pointer; }
.view { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; }
.view[hidden] { display: none; }
.view > * { animation: rise .55s cubic-bezier(.2, 1.4, .4, 1) both; }
.view > :nth-child(2) { animation-delay: .05s; }
.view > :nth-child(3) { animation-delay: .1s; }
.view > :nth-child(4) { animation-delay: .15s; }
.view > :nth-child(5) { animation-delay: .2s; }
.view > :nth-child(6) { animation-delay: .25s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.view h2 { margin: 4px 0 6px; font-weight: 900; font-size: 31px; line-height: 1.1; letter-spacing: -.01em; }
.v-sent h2 { font-size: 36px; color: var(--accent); }
.lead { margin: 0 0 18px; font-size: 16px; font-weight: 700; color: #6d6680; line-height: 1.35; }
.wish-card {
  position: relative; display: block; width: 100%; margin: 0 0 18px; padding: 18px 20px 30px; border-radius: 16px; text-align: left; cursor: text;
  background: #fffdf6; box-shadow: 0 10px 28px rgba(90, 30, 50, .12), 0 0 0 1.5px rgba(31, 27, 75, .06);
  transform: rotate(-.8deg);
}
.wish-card:focus-within { box-shadow: 0 10px 28px rgba(90, 30, 50, .12), 0 0 0 2.5px rgba(212, 67, 42, .55); }
.wish-card textarea {
  display: block; width: 100%; border: 0; padding: 0; margin: 0; background: transparent; resize: none; outline: none;
  font: 600 26px/31px "Caveat", cursive; color: var(--ink); min-height: 124px;
  -webkit-user-select: text; user-select: text;
}
/* подпись отправителя — только с сайта (?web=1): строка под пожеланием, тем же почерком */
.name-card { display: block; width: 100%; margin: -6px 0 18px; padding: 0 20px; text-align: right; cursor: text; }
.name-card[hidden] { display: none; }
.nc-label { display: block; font-size: 13px; font-weight: 700; color: #8a83a0; }
.nc-line { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; border-bottom: 1.5px dashed rgba(31, 27, 75, .25); }
.name-card:focus-within .nc-line { border-bottom-color: var(--accent); }
.nc-dash { font: 600 28px/1.2 "Caveat", cursive; color: var(--ink); }
.name-card input {
  width: 6ch; max-width: 80%; min-width: 0; border: 0; padding: 0; margin: 0; background: transparent; outline: none; text-align: left;
  font: 600 28px/1.2 "Caveat", cursive; color: var(--ink); -webkit-user-select: text; user-select: text;
}
.name-card input::placeholder { color: #b9b2c8; }
/* «Куда отправить?» — окно снизу, только с сайта */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; background: rgba(20, 16, 40, .45); animation: sh-fade .2s; }
.sheet[hidden] { display: none; }
.sheet-in {
  width: 100%; background: #fff6f0; border-radius: 26px 26px 0 0; text-align: center; animation: sh-up .28s cubic-bezier(.2, 1.1, .4, 1);
  padding: 14px 20px calc(var(--sb) + var(--cb) + 28px); box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
}
.sheet-grip { display: block; width: 44px; height: 5px; border-radius: 3px; background: #d9cfe0; margin: 0 auto 14px; }
.sheet h3 { margin: 0; font-size: 24px; font-weight: 900; color: var(--navy); }
.sheet-lead { margin: 6px 0 6px; font-size: 15px; font-weight: 700; color: #8a83a0; }
.sheet-btn {
  display: flex; align-items: center; gap: 14px; margin-top: 10px; padding: 13px 18px; border-radius: 16px; background: #fff;
  box-shadow: inset 0 0 0 1.5px #eee5f0; color: var(--navy); font-size: 18px; font-weight: 800; text-decoration: none;
}
.sheet-btn[hidden] { display: none; }
.sheet-btn i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-style: normal; font-weight: 900; font-size: 16px; }
.sb-tg { background: #2aabee; }
.sb-vk { background: #0077ff; }
button.sheet-btn { width: 100%; border: 0; font-family: inherit; text-align: left; cursor: pointer; }
.sheet-btn span { text-align: left; }
.sheet-btn small { display: block; margin-top: 2px; font-size: 13px; font-weight: 700; color: #8a83a0; }
@keyframes sh-fade { from { opacity: 0; } }
@keyframes sh-up { from { transform: translateY(100%); } }
.count { position: absolute; right: 16px; bottom: 9px; font-size: 13px; font-weight: 800; color: #a29bb4; }
.count.max { color: var(--accent); }
.err { margin: 10px 0 0; font-size: 15px; font-weight: 700; color: var(--accent); }
.link {
  appearance: none; background: none; border: 0; cursor: pointer; margin-top: 14px; padding: 10px 6px; max-width: 320px;
  font: 700 15px/1.4 "Nunito", system-ui, sans-serif; color: #5b5478;
  text-decoration: underline; text-decoration-color: rgba(91, 84, 120, .35); text-decoration-thickness: 1.5px; text-underline-offset: 4px;
}
.panel-in .logo { margin-top: auto; padding-top: 16px; color: rgba(31, 27, 75, .5); }
.panel-in .logo span { color: var(--accent); }

/* ---------- стартовый экран: коробка с бантом, из-под крышки подглядывают глазки ---------- */
.gift { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.gift[hidden] { display: none; }
.gift::before { content: ""; position: absolute; left: 6%; right: 6%; top: 22%; bottom: 2%; background: radial-gradient(closest-side, rgba(255, 205, 150, .2), rgba(255, 205, 150, 0)); }
.gift svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.gift .gbox { transform-box: fill-box; transform-origin: 50% 100%; animation: ghop 3.6s ease-in-out infinite; }
.gift .glid { transform-box: fill-box; transform-origin: 18% 100%; animation: gpeek 3.6s ease-in-out infinite; }
.gift .gpup { animation: glook 3.6s ease-in-out infinite; }
.gift .geye { transform-box: fill-box; transform-origin: center; animation: gblink 3.6s linear infinite; }
.gift .gstar { transform-box: fill-box; transform-origin: center; animation: tw 2.2s ease-in-out infinite; }
@keyframes gpeek { 0%, 50% { transform: none; } 56% { transform: translateY(-22px) rotate(-7deg); } 60% { transform: translateY(-18px) rotate(-5deg); } 78% { transform: translateY(-19px) rotate(-6deg); } 83%, 100% { transform: none; } }
@keyframes glook { 0%, 57% { transform: none; } 62%, 66% { transform: translateX(-2.6px); } 71%, 76% { transform: translateX(2.6px); } 80%, 100% { transform: none; } }
@keyframes gblink { 0%, 68% { transform: none; } 69.5% { transform: scaleY(.1); } 71%, 100% { transform: none; } }
@keyframes ghop { 0%, 84% { transform: none; } 88% { transform: scale(1.07, .9); } 93% { transform: translateY(-10px) scale(.96, 1.05); } 97% { transform: scale(1.02, .98); } 100% { transform: none; } }
.gift.open .gbox, .gift.open .glid, .gift.open .gpup, .gift.open .geye { animation: none; }
.gift.open .glid { transform: translate(70px, -260px) rotate(48deg); opacity: 0; transition: transform .75s cubic-bezier(.15, .7, .3, 1), opacity .45s .25s; }
.gift.open .gbody, .gift.open .gpeek, .gift.open .gsh { transform-box: fill-box; transform-origin: 50% 100%; transform: scale(1.18, .15); opacity: 0; transition: transform .32s cubic-bezier(.5, 0, .7, .4), opacity .3s .05s; }
.gift.open .gstar { opacity: 0; transition: opacity .2s; }
.gift.open::before { opacity: 0; transition: opacity .4s; }

.tap { margin: 18px 0 0; display: inline-flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 800; color: #fff; animation: tapp 1.6s ease-in-out infinite; }
.tap i { position: relative; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .9); box-shadow: 0 0 0 0 rgba(255, 255, 255, .6); animation: ring 1.6s ease-out infinite; }
@keyframes tapp { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .55); } 100% { box-shadow: 0 0 0 16px rgba(255, 255, 255, 0); } }
.app.gift-on { cursor: pointer; }

/* ---------- режим «картинка» (?demo=1&state=card): квадрат для чата и 640×360 для BotFather ---------- */
#ctl-card .pill { display: inline-flex; align-items: center; height: 58px; padding: 0 34px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 900; font-size: 24px; box-shadow: 0 10px 26px rgba(212, 67, 42, .45), inset 0 -3px 0 rgba(0, 0, 0, .13); }
html.card .snd, html.card .sub { display: none; }
html.card .hd { padding-top: 34px; min-height: 0; }
html.card .t-line { font-size: 60px; color: #ffd38a; text-shadow: 0 0 30px rgba(255, 180, 90, .5); }
html.card .ft-main { height: 70px; }
html.card .logo { font-size: 18px; margin-top: 4px; }
html.card.wide .s-cake { display: grid; grid-template-columns: 54% 46%; grid-template-rows: 1fr auto auto 1fr; }
html.card.wide .stage { grid-column: 1; grid-row: 1 / 5; }
html.card.wide .hd { grid-column: 2; grid-row: 2; padding: 0 18px 0 0; }
html.card.wide .ft { grid-column: 2; grid-row: 3; padding: 14px 18px 0 0; }
html.card.wide .t-line { font-size: 46px; }
html.card.wide #ctl-card .pill { height: 48px; font-size: 20px; padding: 0 26px; }
html.card.wide .ft-main { height: 56px; }

/* частицы — поверх всего, не ловят пальцы */
.fx { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; }

@media (max-height: 640px) {
  .hd { padding-top: calc(var(--st) + var(--ct) + 50px); min-height: calc(var(--st) + var(--ct) + 146px); }
  .t-name { font-size: 40px; }
  .t-line { font-size: 26px; }
  .sub { font-size: 16px; margin-top: 8px; }
  .ft-main { height: 90px; }
}
@media (prefers-reduced-motion: reduce) {
  .stars i, .bunting .fs, .press.show, .cn.shiver .cnb, .gift .gbox, .gift .gstar, .tap, .tap i, .cake[data-arms="wave"] .arm-r { animation: none; }
  .press.show { opacity: .8; }
}

/* =====================================================================
   Бутылка (static/tort/bottle.js): ведёрко со льдом, сабля, пена, карточка-лотерея
   ===================================================================== */
.bottle { position: absolute; left: 0; top: 0; width: var(--cw); height: calc(var(--cw) * 1.1); opacity: 0; }
.bottle:not(.mini) { transform: translateY(var(--by, 0px)) scale(var(--bs, 1)); transform-origin: 50% 96%; transition: transform 1s cubic-bezier(.3, 1.2, .4, 1); }
.bottle.mini { position: relative; --cw: 168px; flex: none; opacity: 1; margin-bottom: 2px; touch-action: manipulation; cursor: pointer; }
.bottle[hidden] { display: none; }
.panel-in > .bottle { margin-top: auto; }
.bottle .bj, .bottle .bj > svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.bottle .bj { transform-origin: 50% 96%; will-change: transform; }
.bottle .bglow { position: absolute; left: -12%; right: -12%; top: -6%; bottom: -4%; background: radial-gradient(closest-side, rgba(150, 190, 255, .2), rgba(150, 190, 255, 0)); transition: opacity .6s; pointer-events: none; }
.lit .bottle .bglow, .bottle.mini .bglow { opacity: 0; }

/* лицо */
.bottle .e-cl, .bottle .e-hp, .bottle .e-sq, .bottle .brw,
.bottle .m-sm, .bottle .m-sl, .bottle .m-o, .bottle .m-hp, .bottle .m-sq, .bottle .m-dt, .bottle .m-br, .bottle .m-pf { opacity: 0; transition: opacity .09s, transform .2s cubic-bezier(.3, 1.6, .5, 1); transform: scale(.6); transform-box: fill-box; transform-origin: center; }
.bottle .eo { opacity: 0; transition: opacity .06s; }
.bottle[data-face="open"] .eo, .bottle[data-face="o"] .eo, .bottle[data-face="det"] .eo, .bottle[data-face="joy"] .eo, .bottle[data-face="brr"] .eo { opacity: 1; }
.bottle[data-face="sleep"] .e-cl, .bottle[data-face="sleep"] .m-sl,
.bottle[data-face="open"] .m-sm, .bottle[data-face="o"] .m-o, .bottle[data-face="joy"] .m-hp,
.bottle[data-face="det"] .m-dt, .bottle[data-face="det"] .brw, .bottle[data-face="brr"] .m-br,
.bottle[data-face="happy"] .e-hp, .bottle[data-face="happy"] .m-hp,
.bottle[data-face="squeeze"] .e-sq, .bottle[data-face="squeeze"] .m-sq,
.bottle[data-face="puff"] .e-sq, .bottle[data-face="puff"] .m-pf { opacity: 1; transform: none; }
.bottle .bl { opacity: .75; transition: opacity .3s, transform .3s; transform-box: fill-box; transform-origin: center; }
.bottle[data-face="sleep"] .bl { opacity: .35; }
.bottle[data-face="happy"] .bl, .bottle[data-face="squeeze"] .bl, .bottle[data-face="joy"] .bl { opacity: 1; transform: scale(1.15); }
.bottle[data-face="puff"] .bl { opacity: 1; transform: scale(1.5); }
/* ручки — как у торта */
.bottle .arm { opacity: 0; transform: rotate(-80deg) scale(.3); transition: opacity .12s, transform .45s cubic-bezier(.3, 1.7, .5, 1); }
.bottle[data-arms="up"] .arm { opacity: 1; transform: none; }
.bottle[data-arms="wave"] .arm-r { opacity: 1; transform: none; animation: wave .32s ease-in-out infinite alternate; }

/* капелька конденсата сползает; льдинка моргает; искорки на льду */
.bottle .drip { animation: bdrip 6.5s ease-in infinite; }
@keyframes bdrip { 0%, 30% { transform: none; opacity: 0; } 34% { opacity: 1; } 80% { transform: translateY(54px); opacity: 1; } 86%, 100% { transform: translateY(60px); opacity: 0; } }
.bottle .icef { transform-box: fill-box; transform-origin: center; animation: iblink 4.2s linear infinite; }
@keyframes iblink { 0%, 90% { transform: none; } 92% { transform: scaleY(.15); } 94%, 100% { transform: none; } }
.bottle .itw { transform-box: fill-box; transform-origin: center; animation: tw 2.4s ease-in-out infinite; }

/* фольгу и уздечку снимают пальцем (бутылка стоит прямо): макушка фольги отскакивает, рукав съезжает вверх и улетает */
.bottle.nofoil .bfoil, .bottle.nowire .bwire, .bottle.opened .bfoil, .bottle.opened .bwire, .bottle.opened .bneck { display: none; }
.bottle.foiloff .ftear, .bottle.foiloff .ftab, .bottle.foiloff .fgap { display: none; }
.bottle .ftop, .bottle .fsl, .bottle .bwire { transform-box: fill-box; transform-origin: 50% 50%; }
.bottle.foiloff .ftop { animation: ftop .55s cubic-bezier(.3, .6, .5, 1) forwards; }
.bottle.foiloff .fsl { animation: fsl .75s cubic-bezier(.45, 0, .6, 1) forwards; }
.bottle.pull .ftab { transform-box: fill-box; transform-origin: 0 50%; animation: tabwig 1.4s ease-in-out infinite; }
@keyframes tabwig { 0%, 60%, 100% { transform: none; } 70% { transform: rotate(14deg); } 80% { transform: rotate(-6deg); } 90% { transform: rotate(8deg); } }
.bottle.wireoff .bwire { animation: wireoff .7s cubic-bezier(.3, .6, .5, 1) forwards; }
@keyframes ftop { 0% { transform: none; } 30% { transform: translate(-4px, -26px) rotate(-14deg); } 100% { opacity: 0; transform: translate(-90px, 50px) rotate(-220deg) scale(.85); } }
@keyframes fsl { 0% { transform: none; } 40% { transform: translate(0, -62px); } 65% { opacity: 1; transform: translate(34px, -84px) rotate(40deg); } 100% { opacity: 0; transform: translate(120px, 30px) rotate(170deg) scale(.85); } }
@keyframes wireoff { 0% { transform: none; } 25% { transform: scale(1.2); } 60% { opacity: 1; transform: translate(24px, -58px) rotate(60deg) scale(1.12); } 100% { opacity: 0; transform: translate(80px, -14px) rotate(220deg) scale(.9); } }
/* давление при тряске: пена под пробкой */
.bottle .bpress { opacity: 0; transition: opacity .2s; }
/* открыли: отбитое горлышко, шапка пены */
.bottle .brim { display: none; }
.bottle.opened .brim { display: inline; }
.bottle.opened .bpress { display: none; }
.bottle .foam { opacity: 0; transform-box: fill-box; transform-origin: 50% 85%; transform: scale(.1); }
.bottle.opened .foam { opacity: 1; transform: none; transition: transform .55s cubic-bezier(.3, 1.8, .5, 1), opacity .1s; }
.bottle .foam-in { transform-box: fill-box; transform-origin: 50% 90%; }
.bottle.opened .foam-in { animation: fbreath 1.8s ease-in-out .6s infinite alternate; }
@keyframes fbreath { from { transform: none; } to { transform: scale(1.05, 1.08); } }
.bottle .fdrip { stroke-dasharray: 1; stroke-dashoffset: 1; }
.bottle.opened .fdrip { stroke-dashoffset: 0; transition: stroke-dashoffset 1.6s cubic-bezier(.3, .6, .4, 1) .3s; }
.bottle.opened .fdrip.f2 { transition-delay: .7s; }

/* реплика бутылки */
.bottle .bubble { position: absolute; left: 61%; top: -5%; max-width: 46%; padding: .5em .8em; border-radius: 1em; background: #fff; color: var(--navy);
  font: 900 calc(var(--cw) * .056)/1.15 "Nunito", system-ui, sans-serif; box-shadow: 0 6px 18px rgba(20, 10, 50, .25); pointer-events: none; opacity: 0; transform-origin: 0 100%; z-index: 2; }
.bottle .bubble::after { content: ""; position: absolute; left: -.35em; bottom: .35em; border: .45em solid transparent; border-right-color: #fff; border-left: 0; }
.bottle .bubble.show { animation: bpop 1.3s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes bpop { 0% { opacity: 0; transform: scale(.3) rotate(-8deg); } 14% { opacity: 1; transform: scale(1.06) rotate(1deg); } 24% { transform: none; } 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px); } }
.bottle.mini .bubble { display: none; }
.bottle.low .bubble { top: 30%; left: 66%; }

/* «ПАХ!» */
.bottle .pah { position: absolute; left: 22%; width: 56%; top: -10%; height: 30%; pointer-events: none; opacity: 0; z-index: 3; }
.bottle .pah svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.bottle .pah b { position: absolute; inset: 0; display: grid; place-items: center; font: 1000 calc(var(--cw) * .12)/1 "Nunito", system-ui, sans-serif; color: #fff; letter-spacing: .02em;
  -webkit-text-stroke: calc(var(--cw) * .011) #d4432a; paint-order: stroke fill; text-shadow: 0 calc(var(--cw) * .012) 0 #d4432a; }
.bottle .pah.go { animation: pah 1.05s cubic-bezier(.2, 1.6, .4, 1) forwards; }
@keyframes pah { 0% { opacity: 0; transform: scale(.2) rotate(-16deg); } 14% { opacity: 1; transform: scale(1.18) rotate(-7deg); } 26% { transform: scale(.96) rotate(-9deg); } 70% { opacity: 1; transform: rotate(-9deg); } 100% { opacity: 0; transform: translateY(-16px) scale(1.08) rotate(-9deg); } }

/* подсказка про саблю */
.saber { margin: 10px 0 0; display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; color: #fff; line-height: 1.25; text-align: left; max-width: 330px; }
.sb-ico { flex: none; width: 36px; height: 36px; }
.sb-ico svg { width: 100%; height: 100%; transform-origin: 20% 80%; animation: swish 1.8s ease-in-out infinite; }
@keyframes swish { 0%, 55%, 100% { transform: none; } 66% { transform: rotate(-30deg); } 76% { transform: rotate(22deg); } 86% { transform: rotate(-4deg); } }
.saber-or { margin: 6px 0 0; font-size: 15px; font-weight: 700; color: rgba(255, 255, 255, .62); opacity: 0; transform: translateY(6px); transition: opacity .5s, transform .5s; }
.saber-or.show { opacity: 1; transform: none; }
/* подсказка шагов «фольга» и «проволока» */
.st-ico { flex: none; width: 36px; height: 36px; }
.st-ico svg { width: 100%; height: 100%; overflow: visible; }
.st-ico .tug { animation: sttug 1.3s ease-in-out infinite; }
.st-ico .spin { transform-origin: 20px 20px; animation: stspin 1.1s linear infinite; }
@keyframes sttug { 0%, 30%, 100% { transform: none; } 60% { transform: translate(6px, 3px); } }
@keyframes stspin { to { transform: rotate(-360deg); } }

/* бокалы «дзынь» */
.glasses { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 4; pointer-events: none; }
.glasses[hidden] { display: none; }
.glasses .gl { position: absolute; left: var(--gx); top: var(--gy); width: 58px; height: 106px; margin: -53px 0 0 -29px; opacity: 0; }
.glasses .gl svg { width: 100%; height: 100%; display: block; overflow: visible; }
.glasses.go .gl-l { animation: gl-l 2.4s cubic-bezier(.3, 1.3, .5, 1) forwards; }
.glasses.go .gl-r { animation: gl-r 2.4s cubic-bezier(.3, 1.3, .5, 1) forwards; }
@keyframes gl-l { 0% { opacity: 0; transform: translate(-150px, 60px) rotate(-30deg); } 18% { opacity: 1; transform: translate(-60px, 0) rotate(-6deg); } 28% { transform: translate(-22px, -6px) rotate(14deg); } 34% { transform: translate(-36px, -2px) rotate(2deg); } 40% { transform: translate(-24px, -6px) rotate(12deg); } 50% { transform: translate(-40px, 0) rotate(-2deg); } 80% { opacity: 1; transform: translate(-44px, 0) rotate(-4deg); } 100% { opacity: 0; transform: translate(-150px, 50px) rotate(-26deg); } }
@keyframes gl-r { 0% { opacity: 0; transform: translate(150px, 60px) rotate(30deg); } 18% { opacity: 1; transform: translate(60px, 0) rotate(6deg); } 28% { transform: translate(22px, -6px) rotate(-14deg); } 34% { transform: translate(36px, -2px) rotate(-2deg); } 40% { transform: translate(24px, -6px) rotate(-12deg); } 50% { transform: translate(40px, 0) rotate(2deg); } 80% { opacity: 1; transform: translate(44px, 0) rotate(4deg); } 100% { opacity: 0; transform: translate(150px, 50px) rotate(26deg); } }

/* карточка-лотерея */
.scratch {
  position: absolute; z-index: 2; left: 50%; top: var(--note-top, 0px);
  width: min(318px, calc(100vw - 48px)); margin-left: calc(min(318px, calc(100vw - 48px)) / -2); min-height: 178px;
  border-radius: 18px; overflow: hidden; color: var(--ink); touch-action: none; cursor: pointer;
  background: radial-gradient(circle at 12% 18%, rgba(255, 143, 171, .18) 0 3px, transparent 4px) 0 0 / 34px 30px, radial-gradient(circle at 70% 60%, rgba(127, 214, 194, .2) 0 2.5px, transparent 3.5px) 0 0 / 40px 36px, #fffdf6;
  border: 3px solid #e3ad45; box-shadow: 0 14px 34px rgba(90, 30, 50, .2), 0 0 0 1px rgba(150, 95, 10, .25), inset 0 0 0 2px #fff3c8;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(var(--from, 220px)) scale(.15) rotate(12deg);
}
.scratch[hidden] { display: none; }
.scratch.show { opacity: 1; visibility: visible; pointer-events: auto; transform: rotate(-1.2deg); transition: transform 1s cubic-bezier(.22, 1.3, .36, 1), opacity .2s; }
.sc-in { position: relative; padding: 22px 22px 14px; min-height: 172px; display: flex; flex-direction: column; justify-content: center; }
.sc-text { margin: 0; font: 600 27px/32px "Caveat", cursive; white-space: pre-line; overflow-wrap: anywhere; text-align: center; }
.sc-text.long { font-size: 24px; line-height: 28px; }
.sc-sign { margin: 6px 0 0; font: 700 27px/1.1 "Caveat", cursive; color: var(--accent); text-align: right; }
.sc-sign:empty { display: none; }
.sc-gold { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sc-shine { position: absolute; top: -20%; bottom: -20%; left: -40%; width: 30%; background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .55), rgba(255, 255, 255, 0)); transform: translateX(0) skewX(-14deg); pointer-events: none; animation: shine 2.6s ease-in-out 1s infinite; }
@keyframes shine { 0% { transform: translateX(0) skewX(-14deg); } 45%, 100% { transform: translateX(560%) skewX(-14deg); } }
.scratch.touched .sc-shine, .scratch.revealed .sc-shine { display: none; }
.scratch.revealed { animation: reveal 1.2s ease-out; }
@keyframes reveal { 0% { box-shadow: 0 0 0 0 rgba(255, 210, 90, .9), 0 14px 34px rgba(90, 30, 50, .2); } 100% { box-shadow: 0 0 0 26px rgba(255, 210, 90, 0), 0 14px 34px rgba(90, 30, 50, .2); } }

/* монетка под пальцем */
.coin { position: absolute; left: 0; top: 0; width: 56px; height: 56px; z-index: 6; pointer-events: none; will-change: transform; }
.coin[hidden] { display: none; }
.coin svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 5px rgba(80, 40, 0, .35)); }
.coin.gone svg { transition: transform .6s cubic-bezier(.4, -.4, .7, 1), opacity .5s .1s; transform: translate(60px, -220px) rotate(540deg) scale(.6); opacity: 0; }

/* выбор «торт / бутылка» на экране «сделать» */
.kinds { display: flex; gap: 10px; margin: 0 0 12px; animation: rise .55s cubic-bezier(.2, 1.4, .4, 1) both; }
.kinds[hidden] { display: none; }
.kind { appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; height: 58px; padding: 0 16px 0 8px; border-radius: 18px;
  background: rgba(31, 27, 75, .05); color: #5b5478; font: 800 16px/1 "Nunito", system-ui, sans-serif; box-shadow: inset 0 0 0 1.5px rgba(31, 27, 75, .08);
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), background .2s, box-shadow .2s, color .2s; }
.kind:active { transform: scale(.95); }
.kind.on { background: #fff; color: var(--accent); box-shadow: 0 6px 16px rgba(212, 67, 42, .18), inset 0 0 0 2.5px var(--accent); transform: scale(1.04); }
.ki { width: 44px; height: 44px; display: block; }
.ki svg { width: 100%; height: 100%; display: block; }
.kind.on .ki svg { animation: kbop .45s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes kbop { 0% { transform: scale(.8) rotate(-8deg); } 100% { transform: none; } }
.panel-in { padding-top: calc(var(--st) + var(--ct) + 62px); }
.panel-in > .cake.mini, .panel-in > .bottle.mini { --cw: 150px; }
@media (max-width: 340px) { .kind { padding-right: 12px; font-size: 15px; } .ki { width: 38px; height: 38px; } }

@media (prefers-reduced-motion: reduce) {
  .bottle .drip, .bottle .icef, .bottle .itw, .bottle.opened .foam-in, .sb-ico svg, .st-ico .tug, .st-ico .spin, .bottle.pull .ftab, .sc-shine, .scratch.revealed { animation: none; }
}

/* =====================================================================
   Яйцо с сюрпризом (static/tort/egg.js, план 20.10): сцена 320×400 из утверждённого прототипа,
   масштаб --es считает egg.js под высоту экрана
   ===================================================================== */
.egg-stage { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.egg-stage[hidden] { display: none; }
.escene { position: relative; width: 320px; height: 400px; flex: none; transform: scale(var(--es, 1)); }
.escene > * { position: absolute; }
.escene svg { overflow: visible; display: block; }
.app.egg .bunting { display: none; }
.app.egg .bg-warm {
  background: radial-gradient(70% 36% at 50% 52%, rgba(255, 214, 150, .7) 0%, rgba(255, 214, 150, 0) 100%),
              radial-gradient(130% 80% at 50% 60%, #ffe9d6 0%, #fff1e6 55%, #fff4ea 100%);
}
.escene .idle { animation: ebreathe 3s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes ebreathe { 0%, 100% { transform: none; } 50% { transform: scale(1.025, .975); } }
.escene .wob { animation: ewob .5s ease-in-out infinite alternate; transform-origin: 50% 92%; }
@keyframes ewob { from { transform: rotate(-6deg); } to { transform: rotate(4deg); } }
.escene .squish, .egg-mini .squish { animation: esquish .32s cubic-bezier(.3, 1.6, .5, 1); transform-origin: 50% 95%; }
@keyframes esquish { 0% { transform: scale(1.12, .84); } 55% { transform: scale(.95, 1.06) translateY(-6px); } 100% { transform: none; } }
.escene .zz { font: 900 20px/1 "Nunito", sans-serif; color: rgba(255, 230, 190, .85); animation: ezz 2.6s ease-in-out infinite; }
.escene .zz.z2 { font-size: 15px; animation-delay: .9s; }
@keyframes ezz { 0% { opacity: 0; transform: translate(0, 8px) scale(.7); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(14px, -22px) scale(1.1); } }
.escene .twk { animation: tw 2.2s ease-in-out infinite; }
.lit .escene .twk { animation: none; }
.escene .rays { pointer-events: none; animation: espin 14s linear infinite; }
@keyframes espin { to { transform: rotate(360deg); } }
.escene .epetal { width: 220px; height: 264px; z-index: 3; pointer-events: none; will-change: transform, opacity; }
/* реплика яйца */
.escene .bubble { z-index: 4; padding: 9px 15px 10px; border-radius: 18px; background: #fff; color: var(--navy); white-space: nowrap;
  font: 900 19px/1.1 "Nunito", system-ui, sans-serif; box-shadow: 0 6px 18px rgba(20, 10, 50, .3); transform-origin: 0 100%; animation: ebpop .55s cubic-bezier(.3, 1.6, .5, 1) both; }
.escene .bubble::after { content: ""; position: absolute; left: 14px; bottom: -9px; border: 10px solid transparent; border-top-color: #fff; border-bottom: 0; transform: skewX(-25deg); }
@keyframes ebpop { 0% { opacity: 0; transform: scale(.3) rotate(-10deg); } 60% { opacity: 1; transform: scale(1.06) rotate(2deg); } 100% { opacity: 1; transform: rotate(-3deg); } }
/* «постучи сюда» — кольцо на яйце, если долго не стучат */
.escene .ringhint { width: 74px; height: 74px; border-radius: 50%; pointer-events: none; z-index: 3; animation: erh 1.05s ease-in-out infinite; }
.escene .ringhint::before, .escene .ringhint i { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.escene .ringhint::before { border: 3px solid rgba(255, 255, 255, .85); }
.escene .ringhint i { inset: 27px; background: rgba(255, 255, 255, .92); }
@keyframes erh { 0% { opacity: 0; transform: scale(1.3); } 25% { opacity: .95; transform: scale(.9); } 45% { opacity: .9; transform: scale(1.05); } 65% { opacity: .95; transform: scale(.88); } 100% { opacity: 0; transform: scale(.88); } }
/* «ХРУСЬ!» и «щёлк!» */
.escene .kh { z-index: 4; font: 1000 52px/1 "Nunito", system-ui, sans-serif; color: #fff; letter-spacing: .02em;
  -webkit-text-stroke: 4px var(--accent); paint-order: stroke fill; text-shadow: 0 4px 0 var(--accent); transform: rotate(-9deg); animation: ekh .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.escene .kh-s { font-size: 26px; -webkit-text-stroke-width: 3px; text-shadow: 0 3px 0 var(--accent); transform: rotate(12deg); animation-name: ekhs; animation-delay: .3s; }
@keyframes ekh { 0% { opacity: 0; transform: scale(.2) rotate(-20deg); } 100% { opacity: 1; transform: rotate(-9deg); } }
@keyframes ekhs { 0% { opacity: 0; transform: scale(.2) rotate(30deg); } 100% { opacity: 1; transform: rotate(12deg); } }
/* бумажка с предсказанием */
.escene .slip { z-index: 2; left: 50%; top: 4px; width: 334px; margin-left: -167px; padding: 20px 22px 18px; border-radius: 6px; color: var(--ink); text-align: center;
  background: linear-gradient(180deg, rgba(0,0,0,.035), rgba(0,0,0,0) 18%, rgba(0,0,0,0) 82%, rgba(0,0,0,.04)), #fffdf7;
  box-shadow: 0 16px 34px rgba(120, 60, 20, .18), 0 2px 5px rgba(120, 60, 20, .1); transform: rotate(-2deg); }
.escene .slip::before, .escene .slip::after { content: ""; position: absolute; left: 12px; right: 12px; height: 2px; background: rgba(212, 67, 42, .55); border-radius: 1px; }
.escene .slip::before { top: 9px; }
.escene .slip::after { bottom: 9px; }
.escene .slip .lab { margin: 4px 0 6px; font: 900 12px/1 "Nunito", sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); display: flex; align-items: center; justify-content: center; gap: 8px; }
.escene .slip .lab b { display: inline-block; width: 9px; height: 9px; background: #ffc94d; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.escene .slip .txt { margin: 0; font: 600 32px/35px "Caveat", cursive; overflow-wrap: anywhere; }
.escene .slip .txt em { display: block; font-style: normal; color: var(--accent); font-weight: 700; }   /* последнее предложение — своей строкой */
.escene .slip.rise { animation: eslip 1s cubic-bezier(.22, 1.3, .36, 1) both; }
@keyframes eslip { 0% { opacity: 0; transform: translateY(150px) scale(.2, .1) rotate(8deg); } 100% { opacity: 1; transform: rotate(-2deg); } }
/* крошки из-под пальца */
.ecrumb { position: absolute; z-index: 7; pointer-events: none; }
/* низ: «тук-тук-тук» и три кружка-счётчика; «Завтра здесь будет новое» */
.knock { margin: 8px 0 0; display: inline-flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 800; color: #fff; }
.knock .fing { width: 34px; height: 34px; flex: none; }
.knock .fing svg { width: 100%; height: 100%; animation: eknock 1.05s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes eknock { 0%, 100% { transform: translateY(-3px) rotate(-6deg); } 18% { transform: translateY(4px) rotate(0); } 30% { transform: translateY(-2px) rotate(-4deg); } 44% { transform: translateY(4px) rotate(0); } 60% { transform: translateY(-3px) rotate(-6deg); } }
.e-note { margin-top: 16px; }
.lit .e-note { color: var(--navy); }
.dots { display: flex; gap: 10px; margin-top: 12px; }
.dots i { width: 13px; height: 13px; border-radius: 50%; box-shadow: inset 0 0 0 2.5px rgba(255, 211, 138, .55); transition: background .2s, transform .3s cubic-bezier(.3, 1.8, .5, 1); }
.dots i.on { background: #ffd38a; box-shadow: 0 0 10px rgba(255, 200, 110, .8); transform: scale(1.15); }
#btn-make svg { width: 24px; height: 24px; flex: none; }
.tomorrow { margin: 10px 0 0; font-size: 15px; font-weight: 700; color: #8a829c; display: inline-flex; align-items: center; gap: 7px; }
.tomorrow[hidden] { display: none; }
.tomorrow svg { width: 17px; height: 17px; }
/* яйцо на экране «Сюрприз для подруги» */
.egg-mini { position: relative; flex: none; margin-top: auto; margin-bottom: 4px; touch-action: manipulation; cursor: pointer; }
.egg-mini[hidden] { display: none; }
.egg-mini .idle { animation: ebreathe 3s ease-in-out infinite; transform-origin: 50% 100%; }
.egg-mini svg { display: block; overflow: visible; }
.wish-card[hidden] { display: none; }
html.card .escene .twk, html.card .escene .idle { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .escene .idle, .escene .wob, .escene .zz, .escene .twk, .escene .rays, .escene .ringhint, .knock .fing svg, .egg-mini .idle { animation: none; }
}
.v-sent h2.long { font-size: 31px; }
.v-sent h2.long.xl { font-size: 27px; }

/* =====================================================================
   Хлопушка (static/tort/popper.js, план 25.10): свой холст на весь экран под записками и кнопками,
   рисует хлопушку, конфетти и имя; масштаб считает popper.js
   ===================================================================== */
.pcv { position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none; }
.pcv[hidden] { display: none; }
.app.popper { touch-action: none; }
.pull-fing svg { animation: epull 1.3s ease-in-out infinite; }
@keyframes epull { 0%, 100% { transform: translateY(-5px); } 55% { transform: translateY(6px); } 70% { transform: translateY(2px); } }
.popper-mini { position: relative; flex: none; margin-top: auto; margin-bottom: 4px; touch-action: manipulation; cursor: pointer; }
.popper-mini[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .pull-fing svg { animation: none; } }

/* =====================================================================
   Котёнок (static/tort/kitten.js, план 25.10): свой холст на весь экран (розовый фон, котёнок в коробке, лапки, сердечки),
   сверху — заголовок, записка и кнопки на розовом, а не на ночном; масштаб считает kitten.js
   ===================================================================== */
.app.kitten { touch-action: none; }
.app.kitten:not(.lit) .t-line { color: #b2456e; text-shadow: none; }
.app.kitten:not(.lit) .knock { color: #b2456e; font-size: 21px; font-weight: 900; }
.app.kitten:not(.lit) .snd { background: rgba(178, 69, 110, .1); color: #b2456e; }
.app.kitten:not(.lit) .logo { color: rgba(90, 50, 80, .45); }
.app.kitten:not(.lit) .logo span { color: #ff7a5f; }
.app.kitten:not(.lit) .btn, .app.kitten #ctl-card .pill { background: #ff5c8a; box-shadow: 0 10px 24px rgba(255, 92, 138, .4), inset 0 -3px 0 rgba(0, 0, 0, .1); }
html.card .app.kitten .t-line { color: #b2456e; text-shadow: none; }
.pet-fing svg { animation: epet 1.1s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes epet { 0%, 100% { transform: translateX(-7px) rotate(-9deg); } 50% { transform: translateX(7px) rotate(9deg); } }
@media (prefers-reduced-motion: reduce) { .pet-fing svg { animation: none; } }

/* шесть плиток выбора (торт, бутылка, яйцо, хлопушка, котёнок, черепушка): сетка 3×2, значок сверху, подпись под ним —
   на 390, 360 и даже 320 точек все подписи («Черепушка», «Хлопушка») помещаются без сжатия; плитка одна на всех открытках */
.kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; max-width: 330px; gap: 8px; margin: 0 0 12px; }
.kind { min-width: 0; flex-direction: column; justify-content: center; gap: 1px; height: 70px; padding: 6px 0 5px; font-size: 13.5px; border-radius: 16px; }
.kinds .ki { width: 40px; height: 40px; }
.kind.on { transform: scale(1.03); }
@media (max-width: 360px) { .kinds { gap: 6px; } .kind { height: 66px; font-size: 13px; } .kinds .ki { width: 36px; height: 36px; } }
@media (max-width: 340px) { .kind { font-size: 12px; } }

/* =====================================================================
   Черепушка дня (static/tort/skull.js, план 25.10): свой холст на весь экран (фиолетовая ночь, черепушка на подушке,
   бумажка с приговором); заголовок, подсказка и кнопка — лиловые на ночном фоне; масштаб считает skull.js
   ===================================================================== */
.app.skull { touch-action: none; }
/* рок-обложка: чёрный #0a0708, кость #ece3cc, красный #d4142e; надписи — Oswald прописными */
.app.skull:not(.lit) .t-line { color: #ece3cc; font-family: Oswald, Impact, sans-serif; font-weight: 700; text-transform: uppercase; text-shadow: 0 0 20px rgba(212, 20, 46, .9), 0 2px 0 #000; }
.app.skull:not(.lit) .knock { color: #ece3cc; font-family: Oswald, Impact, sans-serif; font-size: 22px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-align: center; text-shadow: 0 0 12px rgba(212, 20, 46, .8), 0 2px 0 #000; }
.app.skull:not(.lit) .snd { background: rgba(236, 227, 204, .12); color: #ece3cc; }
.app.skull:not(.lit) .logo { color: rgba(236, 227, 204, .45); }
.app.skull:not(.lit) .logo span { color: #d4142e; }
.app.skull:not(.lit) .btn, .app.skull #ctl-card .pill { background: #d4142e; font-family: Oswald, Impact, sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; box-shadow: 0 10px 24px rgba(212, 20, 46, .5), inset 0 -3px 0 rgba(0, 0, 0, .25); }
.app.skull:not(.lit) .tomorrow { color: #ece3cc; font-family: Oswald, Impact, sans-serif; text-transform: uppercase; letter-spacing: .04em; }
html.card .app.skull .t-line { color: #ece3cc; font-family: Oswald, Impact, sans-serif; font-weight: 700; text-transform: uppercase; text-shadow: 0 0 24px rgba(212, 20, 46, .95), 0 3px 0 #000; }
@media (max-width: 360px) { .app.skull:not(.lit) .knock { font-size: 19px; } }
/* плашка «Постучи по черепушке» длиннее остальных — в одну строку (картинки для чата и BotFather) */
.app.skull #ctl-card .pill { white-space: nowrap; font-size: 22px; padding: 0 28px; }
html.card.wide .app.skull #ctl-card .pill { font-size: 17px; padding: 0 20px; }
html.card.wide .app.skull .t-line { font-size: 38px; }
/* заголовок и пояснение экрана «сделать» не оставляют одно слово на второй строке («Черепушка дня для друга») */
.view h2, .lead { text-wrap: balance; }
