:root {
  --bg1: #ffe9d6;
  --bg2: #ffd3e0;
  --bg3: #e9dcff;
  --ink: #3a2740;
  --muted: #7d6a84;
  --accent: #ff6f91;
  --accent-2: #ff9f68;
  --accent-ink: #fff;
  --card: rgba(255, 255, 255, 0.84);
  --card-border: rgba(255, 255, 255, 0.9);
  --shadow: 0 24px 60px -24px rgba(90, 40, 80, 0.35);
  --radius: 28px;
  --font-hand: 'Caveat', 'Segoe Script', 'Bradley Hand', 'Marker Felt', cursive;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg2);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; -webkit-tap-highlight-color: transparent; }

/* Оболочка */
.shell {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  gap: 16px;
  align-content: center;
}
.card {
  width: 100%;
  max-width: 560px;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: clamp(22px, 5vw, 40px);
  animation: pop-in .55s cubic-bezier(.2, .9, .3, 1.2) both;
}
.card.leaving { animation: pop-out .22s ease-in both; }
@keyframes pop-in { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pop-out { to { opacity: 0; transform: translateY(-10px) scale(.98); } }

h1, h2 {
  font-family: var(--font-hand);
  font-weight: 700;
  line-height: 1.05;
  margin: 0 0 8px;
  letter-spacing: .01em;
}
h1 { font-size: clamp(2.3rem, 8vw, 3.4rem); }
h2 { font-size: clamp(2rem, 7vw, 2.8rem); }
.subtitle { margin: 0 0 22px; color: var(--muted); font-size: 1.02rem; }
.hint { color: var(--muted); font-size: .95rem; margin: 14px 0 0; min-height: 1.4em; }
.hint strong { color: var(--ink); }

/* Прогресс-сердечки */
.progress { display: flex; gap: 10px; justify-content: center; }
.progress i {
  width: 14px; height: 14px; display: inline-block; font-style: normal;
  background: rgba(58, 39, 64, .16); border-radius: 50%; transition: transform .35s, background .35s;
}
.progress i.done { background: var(--accent); }
.progress i.current { background: var(--accent); transform: scale(1.5); box-shadow: 0 0 0 5px rgba(255, 111, 145, .25); }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 26px; border-radius: 999px; font-weight: 800; font-size: 1.05rem;
  transition: transform .15s, box-shadow .2s, opacity .2s, background .2s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  box-shadow: 0 14px 30px -12px rgba(255, 111, 145, .8);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -12px rgba(255, 111, 145, .9); }
.btn-primary:disabled { opacity: .5; box-shadow: none; transform: none; cursor: not-allowed; }
.btn-ghost { background: rgba(58, 39, 64, .07); color: var(--ink); }
.btn-ghost:hover { background: rgba(58, 39, 64, .12); }
.btn-link { color: var(--muted); padding: 10px 12px; font-weight: 600; }
.btn-link:hover { color: var(--ink); }
.actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.actions .spacer { flex: 1; }

/* Плавающие сердечки */
.hearts { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.hearts span {
  position: absolute; bottom: -10vh; left: var(--x, 50%);
  font-size: var(--s, 22px); opacity: 0;
  animation: float-up var(--d, 9s) linear forwards;
  filter: drop-shadow(0 6px 10px rgba(255, 111, 145, .35));
}
@keyframes float-up {
  0% { transform: translateY(0) rotate(0) scale(.6); opacity: 0; }
  10% { opacity: .9; }
  100% { transform: translateY(-120vh) translateX(var(--dx, 0)) rotate(25deg) scale(1.1); opacity: 0; }
}

/* Конфетти */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* Собака */
#dog-stage { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
