:root {
  --bg: #fdf1e6;
  --bg2: #fbe2d0;
  --card: #fffaf4;
  --ink: #5a3826;
  --ink-soft: #94705c;
  --pumpkin: #f0812e;
  --pumpkin-d: #d9681a;
  --pink: #f39aa8;
  --pink-d: #e0717f;
  --cream: #fff3e2;
  --line: #f1d9c4;
  --like: #ef6b84;
  --nope: #9a8a80;
  --shadow: 0 10px 30px rgba(146, 84, 44, .18), 0 2px 6px rgba(146, 84, 44, .10);
  --radius: 28px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(120% 70% at 10% 0%, #ffe3cf 0%, transparent 60%),
              radial-gradient(100% 60% at 100% 100%, #fbd3d9 0%, transparent 60%),
              var(--bg);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; color: inherit; }
img { -webkit-user-drag: none; user-select: none; }
[hidden] { display: none !important; }
h1, h2, .title { font-family: 'Nunito', system-ui, sans-serif; font-weight: 900; }

/* ---------- фон ---------- */
.bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.bg .f { position: absolute; opacity: .22; filter: saturate(.9); animation: float 9s ease-in-out infinite; }
.f1 { width: 70px; top: 8%; left: -14px; transform: rotate(-14deg); }
.f2 { width: 46px; top: 22%; right: 8px; animation-delay: -2s !important; }
.f3 { width: 34px; top: 52%; left: 12px; animation-delay: -4s !important; }
.f4 { width: 54px; bottom: 16%; right: -6px; transform: rotate(20deg); animation-delay: -1s !important; }
.f5 { width: 40px; bottom: 6%; left: 18%; animation-delay: -5s !important; }
.f6 { width: 38px; bottom: 30%; left: -6px; transform: rotate(-30deg); animation-delay: -3s !important; }
.f7 { width: 30px; top: 4%; right: 30%; animation-delay: -6s !important; }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }

#app {
  position: relative; z-index: 1;
  height: 100dvh; max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 12px) 16px calc(var(--safe-b) + 14px);
}

/* ---------- общие кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 24px; border-radius: 999px;
  background: linear-gradient(180deg, #f6964a, var(--pumpkin));
  color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: 0 6px 16px rgba(240, 129, 46, .35), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .12s;
}
.btn:active { transform: scale(.96); }
.btn.pink { background: linear-gradient(180deg, #f7aab6, var(--pink-d)); box-shadow: 0 6px 16px rgba(224, 113, 127, .35); }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 15px; }
.link { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; padding: 8px; }

/* ---------- PIN ---------- */
.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.pin-hero { width: 150px; filter: drop-shadow(0 10px 18px rgba(217, 104, 26, .3)); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
.center h1 { margin: 4px 0 0; font-size: 26px; }
.sub { color: var(--ink-soft); margin: 0; font-size: 15px; }
.dots { display: flex; gap: 14px; margin: 10px 0 6px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--pink-d); transition: .15s; }
.dots i.on { background: var(--pink-d); transform: scale(1.1); }
.dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; }
.keypad button {
  height: 72px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow);
  font-size: 28px; font-weight: 700; font-family: 'Nunito', system-ui, sans-serif;
}
.keypad button:active { background: var(--cream); transform: scale(.94); }
.keypad .empty { visibility: hidden; }
.pin-err { color: var(--pink-d); min-height: 20px; font-weight: 700; font-size: 14px; }

/* ---------- Кто вы ---------- */
.who-title { text-align: center; margin: 10px 0 4px; font-size: 26px; }
.who { flex: 1; display: flex; flex-direction: column; gap: 16px; justify-content: center; }
.who button {
  position: relative; display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 20px 14px 14px; text-align: left; overflow: hidden; transition: transform .15s;
}
.who button:active { transform: scale(.97); }
.who button img { height: 150px; width: auto; flex: none; filter: drop-shadow(0 6px 8px rgba(90,56,38,.18)); }
.who button span { font-family: 'Nunito', system-ui, sans-serif; font-weight: 700; font-size: 24px; line-height: 1.2; }
.who button small { display: block; font-family: 'Nunito', system-ui, sans-serif; font-weight: 600; font-size: 14px; color: var(--ink-soft); margin-top: 6px; }
.who .cat { background: linear-gradient(135deg, #fff7f0, #fde3e6); }
.who .bear { background: linear-gradient(135deg, #fff7f0, #f7e1c8); }

/* ---------- шапка ---------- */
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.me-ava { width: 44px; height: 44px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; overflow: hidden; flex: none; }
.me-ava img { width: 40px; height: 40px; object-fit: contain; object-position: top; }
.top .t { flex: 1; min-width: 0; }
.top .t b { display: block; font-family: 'Nunito', system-ui, sans-serif; font-size: 17px; }
.top .t span { display: block; font-size: 13px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; flex: none; position: relative; }
.icon-btn svg { width: 22px; height: 22px; }
.bar { height: 10px; border-radius: 99px; background: rgba(255,255,255,.7); box-shadow: inset 0 1px 3px rgba(90,56,38,.12); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--pink), var(--pumpkin)); transition: width .35s; }
.progress-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); margin: 6px 2px 0; font-weight: 700; }

/* ---------- колода ---------- */
.deck { position: relative; flex: 1; margin: 14px 0 10px; min-height: 300px; }
.card {
  position: absolute; inset: 26px 6px 0; perspective: 1400px;
  touch-action: none; will-change: transform;
}
.card.back-card { transform: scale(.94) translateY(16px); opacity: .85; filter: saturate(.85); }
.card .inner { position: relative; width: 100%; height: 100%; transition: transform .55s cubic-bezier(.3,1.3,.5,1); transform-style: preserve-3d; }
.card.flipped .inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; border-radius: var(--radius); background: var(--card);
  box-shadow: var(--shadow); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 22px; text-align: center;
  border: 3px solid #fff;
  background-image: radial-gradient(circle at 50% 120%, #ffe6d2 0%, transparent 55%), radial-gradient(circle at 0 0, #fff0f2 0%, transparent 40%);
}
.face.back { transform: rotateY(180deg); justify-content: flex-start; padding-top: 74px; overflow: hidden; }
.peek { position: absolute; top: -58px; left: 50%; width: 150px; transform: translateX(-50%); pointer-events: none; z-index: 2; filter: drop-shadow(0 -2px 3px rgba(90,56,38,.08)); }
.card .deco { position: absolute; pointer-events: none; }
.deco.d1 { width: 56px; bottom: 46px; left: 14px; transform: rotate(-12deg); opacity: .9; }
.deco.d2 { width: 44px; top: 66px; right: 18px; transform: rotate(14deg); opacity: .85; }
.deco.d3 { width: 70px; bottom: 12px; right: 12px; opacity: .9; }
.name {
  font-family: 'Nunito', system-ui, sans-serif; font-weight: 700;
  font-size: clamp(34px, 11vw, 54px); line-height: 1.1; word-break: break-word;
  color: var(--ink); text-shadow: 0 2px 0 #fff;
}
.name.long { font-size: clamp(28px, 8.5vw, 42px); }
.origin-chip { margin-top: 14px; display: inline-block; background: var(--cream); border-radius: 99px; padding: 6px 14px; font-size: 14px; color: var(--ink-soft); font-weight: 700; }
.tap-hint { position: absolute; bottom: 18px; left: 0; right: 0; font-size: 13px; color: var(--ink-soft); opacity: .8; }
.added-by { margin-top: 10px; font-size: 13px; color: var(--pink-d); font-weight: 700; }

.back h3 { margin: 0 0 4px; font-family: 'Nunito', system-ui, sans-serif; font-size: 26px; }
.fio { background: linear-gradient(135deg, #fff1e3, #ffe7ea); border-radius: 18px; padding: 14px 12px; margin: 10px 0 14px; width: 100%; }
.fio small { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); font-weight: 800; margin-bottom: 4px; }
.fio div { font-family: 'Nunito', system-ui, sans-serif; font-weight: 700; font-size: 19px; line-height: 1.35; }
.facts { width: 100%; text-align: left; display: grid; gap: 10px; font-size: 15px; }
.facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 800; }
.facts dd { margin: 2px 0 0; font-weight: 600; }

.stamp {
  position: absolute; top: 40px; padding: 6px 14px; border-radius: 14px; font-family: 'Nunito', system-ui, sans-serif; font-weight: 700; font-size: 24px;
  border: 4px solid; opacity: 0; z-index: 3; pointer-events: none; background: rgba(255,255,255,.85);
}
.stamp.like { left: 22px; color: var(--like); border-color: var(--like); transform: rotate(-14deg); }
.stamp.nope { right: 22px; color: var(--nope); border-color: var(--nope); transform: rotate(14deg); }

.actions { display: flex; justify-content: center; align-items: center; gap: 22px; padding-top: 4px; }
.round-btn { width: 70px; height: 70px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; transition: transform .12s; }
.round-btn:active { transform: scale(.9); }
.round-btn svg { width: 32px; height: 32px; }
.round-btn.small { width: 52px; height: 52px; }
.round-btn.small svg { width: 22px; height: 22px; }
.round-btn.like { background: linear-gradient(180deg, #ff9fb0, var(--like)); color: #fff; }
.round-btn.nope { color: var(--nope); }
.round-btn:disabled { opacity: .4; }

.stage-hint { text-align: center; font-size: 14px; color: var(--ink-soft); margin: 2px 8px 0; }

/* ---------- ожидание / пусто ---------- */
.wait-img { width: 220px; max-width: 70%; filter: drop-shadow(0 10px 16px rgba(90,56,38,.18)); }
.wait-img.sleep { animation: breathe 3.5s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.03); } }
.center h2 { margin: 6px 0 0; font-size: 24px; }
.partner-bar { width: 80%; }
.stack-btns { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; margin-top: 10px; }

/* ---------- дуэли ---------- */
.duel-q { text-align: center; font-family: 'Nunito', system-ui, sans-serif; font-size: 22px; margin: 6px 0 0; font-weight: 700; }
.duel { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; position: relative; }
.duel button.opt {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 3px solid #fff;
  padding: 22px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform .18s, opacity .3s;
}
.duel button.opt:active { transform: scale(.97); }
.duel button.opt .name { font-size: clamp(30px, 9vw, 44px); }
.duel button.opt .fio-line { font-size: 14px; color: var(--ink-soft); font-weight: 700; }
.duel button.opt .mean { font-size: 14px; color: var(--ink-soft); }
.duel button.opt.win { transform: scale(1.04); border-color: var(--pink); }
.duel button.opt.lose { opacity: .25; transform: scale(.95); }
.vs { align-self: center; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; margin: -34px 0; z-index: 2; background: var(--card); box-shadow: var(--shadow); }
.vs img { width: 40px; }

/* ---------- финал ---------- */
.final { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; overflow-y: auto; padding: 10px 0 20px; gap: 8px; }
.final .hero { position: relative; width: 210px; margin-top: 6px; }
.final .hero img.p { width: 100%; animation: bob 3s ease-in-out infinite; filter: drop-shadow(0 12px 20px rgba(217,104,26,.35)); }
.final .hero img.b { position: absolute; width: 90px; top: -14px; right: -18px; transform: rotate(18deg); }
.final .pre { font-size: 18px; color: var(--ink-soft); font-weight: 700; margin-top: 8px; }
.final .big { font-family: 'Nunito', system-ui, sans-serif; font-weight: 700; font-size: clamp(42px, 13vw, 64px); line-height: 1.05; background: linear-gradient(180deg, var(--pumpkin), var(--pink-d)); -webkit-background-clip: text; background-clip: text; color: transparent; padding: 0 6px; animation: pop .9s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.final .fio { max-width: 360px; }
.final .mean { color: var(--ink-soft); font-size: 15px; max-width: 340px; }
.final .parents { display: flex; gap: 6px; align-items: flex-end; margin-top: 4px; }
.final .parents img { height: 92px; }
.final .parents .h { width: 34px; height: auto !important; align-self: center; margin-bottom: 30px; animation: beat 1.2s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } 45% { transform: scale(1.15); } }
.ranking { width: 100%; max-width: 360px; background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 12px 16px; text-align: left; margin-top: 8px; }
.ranking h4 { margin: 0 0 6px; font-family: 'Nunito', system-ui, sans-serif; }
.ranking ol { margin: 0; padding-left: 22px; }
.ranking li { padding: 3px 0; font-weight: 700; }
.ranking li span { color: var(--ink-soft); font-weight: 600; font-size: 13px; }

/* ---------- нижняя шторка ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(90, 56, 38, .35); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet .panel {
  width: 100%; max-width: 520px; height: 92dvh; background: var(--bg); border-radius: 28px 28px 0 0;
  display: flex; flex-direction: column; box-shadow: 0 -10px 30px rgba(90,56,38,.2); animation: up .28s cubic-bezier(.2,.9,.3,1);
  padding-bottom: var(--safe-b);
}
@keyframes up { from { transform: translateY(100%); } }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 10px auto 4px; }
.sheet header { display: flex; align-items: center; padding: 4px 16px 8px; gap: 10px; }
.sheet header h2 { flex: 1; margin: 0; font-size: 21px; }
.tabs { display: flex; gap: 6px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: 1 0 auto; padding: 9px 10px; border-radius: 99px; background: var(--card); font-weight: 800; font-size: 13px; color: var(--ink-soft); box-shadow: 0 2px 6px rgba(90,56,38,.08); }
.tabs button.on { background: var(--ink); color: #fff; }
.tabs button em { font-style: normal; opacity: .7; margin-left: 4px; }
.search { margin: 10px 16px 6px; position: relative; }
.search input { width: 100%; height: 44px; border-radius: 99px; border: 2px solid var(--line); background: var(--card); padding: 0 16px 0 40px; font-size: 16px; outline: none; }
.search input:focus { border-color: var(--pink); }
.search svg { position: absolute; left: 14px; top: 12px; width: 20px; height: 20px; color: var(--ink-soft); }
.list { flex: 1; overflow-y: auto; padding: 4px 16px 16px; -webkit-overflow-scrolling: touch; }
.row { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 16px; padding: 10px 10px 10px 14px; margin-bottom: 8px; box-shadow: 0 2px 6px rgba(90,56,38,.06); }
.row .n { flex: 1; min-width: 0; }
.row .n b { font-size: 17px; display: block; }
.row .n span { font-size: 13px; color: var(--ink-soft); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .tag { font-size: 11px; color: var(--pink-d); font-weight: 800; }
.chip-btn { padding: 8px 12px; border-radius: 99px; font-weight: 800; font-size: 13px; background: var(--cream); flex: none; }
.chip-btn.like { background: #ffe1e7; color: var(--like); }
.chip-btn.nope { background: #f0ebe7; color: var(--nope); }
.empty-note { text-align: center; color: var(--ink-soft); padding: 30px 10px; }
.empty-note img { width: 120px; display: block; margin: 0 auto 10px; opacity: .9; }
.add-form { display: flex; gap: 8px; padding: 6px 16px 10px; }
.add-form input { flex: 1; min-width: 0; height: 48px; border-radius: 99px; border: 2px solid var(--line); background: var(--card); padding: 0 16px; font-size: 16px; outline: none; }
.add-form input:focus { border-color: var(--pumpkin); }
.round-item { background: var(--card); border-radius: 18px; padding: 14px; margin-bottom: 10px; box-shadow: 0 2px 6px rgba(90,56,38,.06); }
.round-item h4 { margin: 0 0 4px; font-family: 'Nunito', system-ui, sans-serif; font-size: 17px; }
.round-item p { margin: 0 0 8px; font-size: 14px; color: var(--ink-soft); }
.round-item .names { font-weight: 700; font-size: 15px; margin-bottom: 10px; line-height: 1.5; }
.sheet-foot { padding: 8px 16px 12px; display: flex; justify-content: center; }

/* мини-справка в списке */
.mini { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(90,56,38,.3); padding: 20px; animation: fade .15s; }
.mini .box { background: var(--card); border-radius: 26px; padding: 26px 22px 20px; width: 100%; max-width: 380px; text-align: center; box-shadow: var(--shadow); position: relative; }
.mini .box .name { font-size: 38px; }

/* тост */
.toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 110px); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 99px; font-weight: 700; z-index: 40; max-width: 90%; text-align: center; animation: fade .2s; font-size: 15px; }

/* праздник совпадений */
.celebrate { position: fixed; inset: 0; z-index: 25; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; background: radial-gradient(circle, rgba(255,240,228,.97), rgba(253,226,214,.97)); animation: fade .3s; gap: 10px; }
.celebrate h2 { font-size: 30px; margin: 0; }
.celebrate .num { font-family: 'Nunito', system-ui, sans-serif; font-size: 80px; font-weight: 700; color: var(--pink-d); line-height: 1; animation: pop .8s cubic-bezier(.3,1.6,.5,1) both; }
.celebrate img { width: 200px; }
.celebrate .names { font-weight: 700; color: var(--ink); max-width: 360px; line-height: 1.6; max-height: 30dvh; overflow-y: auto; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti img { position: absolute; top: -60px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(115dvh) rotate(var(--r)); } }


/* ================= милые анимации ================= */
/* всплески сердечек / листиков */
.confetti img.burst { position: fixed; top: 0; margin: -16px 0 0 -16px; animation: burst 1.1s cubic-bezier(.2,.8,.3,1) forwards; }
.confetti img.burst.nope { animation-duration: 1.2s; animation-timing-function: ease-in; }
@keyframes burst {
  0% { transform: translate(0, 0) scale(.2) rotate(0); opacity: 0; }
  15% { opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--r)); opacity: 0; }
}

/* PIN: тыква подпрыгивает при верном коде, кнопки пружинят */
.pin-hero.jump { animation: jump .6s cubic-bezier(.3,1.6,.5,1); }
@keyframes jump { 0% { transform: scale(1); } 30% { transform: translateY(-40px) scale(1.15, .9) rotate(-8deg); } 60% { transform: translateY(0) scale(.9, 1.1); } 100% { transform: scale(1); } }
.keypad button { transition: transform .12s cubic-bezier(.3,1.8,.5,1), background .15s; }
.keypad button:active { transform: scale(.86); }
.keypad { animation: rise .5s .1s backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }

/* Кто вы: Кошка и Медведь покачиваются */
.who button { animation: rise .5s backwards; }
.who button.bear { animation-delay: .12s; }
.who button img { animation: sway 3.2s ease-in-out infinite; transform-origin: 50% 95%; }
.who button.bear img { animation-delay: -1.6s; }
@keyframes sway { 0%, 100% { rotate: -3deg; } 50% { rotate: 3deg; } }
.who button.chosen { animation: chosen .5s cubic-bezier(.3,1.6,.5,1) forwards; }
.who button.chosen img { animation: jump .55s cubic-bezier(.3,1.6,.5,1); }
@keyframes chosen { 50% { transform: scale(1.05); } 100% { transform: scale(1); box-shadow: 0 0 0 4px var(--pink), var(--shadow); } }

/* шапка: аватар иногда машет */
.me-ava img { animation: wiggle 6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes wiggle { 0%, 86%, 100% { rotate: 0deg; } 89% { rotate: -12deg; } 92% { rotate: 10deg; } 95% { rotate: -6deg; } }
.bar i { background-size: 200% 100%; background-image: linear-gradient(90deg, var(--pink), var(--pumpkin), var(--pink)); animation: shimmer 3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* карточка выпрыгивает, котёнок выглядывает */
.card.enter { animation: cardIn .45s cubic-bezier(.3,1.5,.5,1) both; }
@keyframes cardIn { from { scale: .88; opacity: .3; } }
.card.enter .peek { animation: peekIn .6s .15s cubic-bezier(.3,1.6,.5,1) both, peekLook 5s 1s ease-in-out infinite; }
@keyframes peekIn { from { translate: 0 46px; opacity: 0; } }
@keyframes peekLook { 0%, 80%, 100% { rotate: 0deg; translate: 0 0; } 85% { rotate: -6deg; translate: 0 -4px; } 92% { rotate: 5deg; translate: 0 -4px; } }
.card .deco.d1 { animation: float 4s ease-in-out infinite; }
.card .deco.d2 { animation: float 5s -2s ease-in-out infinite; }
.card .name { animation: namePop .5s .1s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes namePop { from { scale: .6; opacity: 0; } }
.card .stamp { transition: scale .15s; }

/* кнопки: сердечко бьётся, крестик покачивается при нажатии */
.round-btn.like svg { animation: beat 1.6s ease-in-out infinite; }
.round-btn:active svg { scale: .8; }
.round-btn { transition: transform .15s cubic-bezier(.3,1.8,.5,1); }
.round-btn:active { transform: scale(.85) rotate(-6deg); }

/* ожидание: котёнок сопит */
.sleep-wrap { position: relative; display: inline-block; }
.sleep-wrap .wait-img { width: 220px; }
.z { position: absolute; font-style: normal; font-weight: 900; color: var(--ink-soft); opacity: 0; animation: zzz 3s ease-out infinite; }
.z1 { top: 26%; left: 30%; font-size: 18px; }
.z2 { top: 18%; left: 24%; font-size: 24px; animation-delay: 1s; }
.z3 { top: 10%; left: 18%; font-size: 30px; animation-delay: 2s; }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 30% { opacity: .8; } 100% { opacity: 0; transform: translate(-26px, -40px) scale(1.1); } }

/* дуэли: варианты выезжают, сердечко между ними бьётся */
.duel button.opt { animation: rise .45s backwards; }
.duel button.opt:last-child { animation-delay: .1s; }
.vs img { animation: beat 1.4s ease-in-out infinite; }
.duel-q { animation: namePop .5s both; }

/* шторка: строки появляются по очереди */
.row, .round-item { animation: rowIn .35s backwards; }
.row:nth-child(2) { animation-delay: .03s; } .row:nth-child(3) { animation-delay: .06s; } .row:nth-child(4) { animation-delay: .09s; }
.row:nth-child(5) { animation-delay: .12s; } .row:nth-child(6) { animation-delay: .15s; } .row:nth-child(n+7) { animation-delay: .18s; }
@keyframes rowIn { from { opacity: 0; transform: translateY(12px); } }
.empty-note img { animation: sway 3s ease-in-out infinite; }

/* праздник и финал */
.celebrate img { animation: beat 1.3s ease-in-out infinite; }
.celebrate h2 { animation: namePop .5s .2s both; }
.final .parents img:first-child { animation: sway 3s ease-in-out infinite; transform-origin: 50% 95%; }
.final .parents img:last-child { animation: sway 3s -1.5s ease-in-out infinite; transform-origin: 50% 95%; }
.final .hero img.b { animation: sway 2.6s ease-in-out infinite; }

/* фон: изредка всплывают сердечки */
.bg::before, .bg::after {
  content: ''; position: absolute; bottom: -40px; width: 26px; height: 26px; opacity: 0;
  background: url(img/heart_small.webp) center/contain no-repeat; animation: riseUp 11s linear infinite;
}
.bg::before { left: 22%; }
.bg::after { left: 74%; animation-delay: -5.5s; width: 20px; height: 20px; background-image: url(img/heart_orange.webp); }
@keyframes riseUp { 0% { transform: translateY(0) rotate(0); opacity: 0; } 10% { opacity: .5; } 50% { transform: translateY(-55dvh) translateX(18px) rotate(12deg); } 90% { opacity: .4; } 100% { transform: translateY(-110dvh) translateX(-10px) rotate(-8deg); opacity: 0; } }

@media (min-height: 760px) {
  .card { inset: 40px 8px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* отклонённые по этапам */
.hint-line { padding: 0 18px 6px; font-size: 13px; }
details.sec { margin-bottom: 10px; }
details.sec summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  font-weight: 900; font-size: 15px; padding: 10px 4px 8px; color: var(--ink);
}
details.sec summary::-webkit-details-marker { display: none; }
details.sec summary::before { content: '▸'; color: var(--pink-d); transition: rotate .2s; display: inline-block; }
details.sec[open] summary::before { rotate: 90deg; }
details.sec summary em { font-style: normal; margin-left: auto; background: var(--cream); color: var(--ink-soft); border-radius: 99px; padding: 2px 10px; font-size: 13px; }
.sec-empty { padding: 4px 8px 10px; font-size: 14px; }
span.chip-btn { color: var(--ink-soft); }
