:root {
  --bg: #fbf7f4;
  --card: #ffffff;
  --soft: #f6e9e6;
  --text: #4a3f3c;
  --muted: #9a8b87;
  --accent: #d9a5a0;
  --accent-dark: #b9827d;
  --shadow: 0 10px 30px rgba(185, 130, 125, 0.12);
  --radius: 22px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, sans-serif;
  font-weight: 300;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, .riddle, .num {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 400;
}

/* ---------- Вкладки ---------- */

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 14px 16px;
  background: rgba(251, 247, 244, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tabs a, .tabs span {
  padding: 8px 20px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.3s, color 0.3s;
}

.tabs a.active { background: var(--soft); color: var(--accent-dark); }
.tabs.spacer { visibility: hidden; }

/* ---------- Сторінка ---------- */

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 16px 72px;
}

header { text-align: center; margin-bottom: 48px; }

h1 { font-size: clamp(2.3rem, 7vw, 3.5rem); line-height: 1.15; }

.subtitle { color: var(--muted); margin: 14px auto 0; max-width: 480px; }

.heart { color: var(--accent); font-size: 1.1rem; display: block; margin-bottom: 12px; }

/* ---------- Картки ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.card {
  height: 240px;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: center;
  background: none;
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.8s ease forwards;
}

.card:nth-child(2) { animation-delay: 0.08s; }
.card:nth-child(3) { animation-delay: 0.16s; }
.card:nth-child(4) { animation-delay: 0.24s; }
.card:nth-child(5) { animation-delay: 0.32s; }
.card:nth-child(6) { animation-delay: 0.40s; }
.card:nth-child(7) { animation-delay: 0.48s; }

.face {
  height: 100%;
  border-radius: var(--radius);
  background: var(--card) center / cover no-repeat;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.card:not(:disabled):hover .face { transform: translateY(-4px); box-shadow: 0 16px 36px rgba(185, 130, 125, 0.2); }

.day {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.num { font-size: 3.6rem; line-height: 1; color: var(--accent); }

.hint { font-size: 0.82rem; color: var(--accent-dark); }

.title { font-size: 1.05rem; }

.card.locked { cursor: default; }
.card.locked .face { background: transparent; box-shadow: none; border: 1px dashed #e6d4d0; }
.lock { font-size: 1.4rem; opacity: 0.55; }
.when, .timer { font-size: 0.9rem; color: var(--muted); }
.timer { font-variant-numeric: tabular-nums; color: var(--accent-dark); }

.card.open .face { box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.card.open .num { animation: glow 2.4s ease-in-out infinite; }

.card.solved .face { background-color: var(--soft); }
.card.solved .face[style] { justify-content: flex-end; position: relative; overflow: hidden; }
.card.solved .face[style]::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 45%, rgba(74, 63, 60, 0.55));
}
.card.solved .face[style] > * { position: relative; color: #fff; }

/* ---------- Модальне вікно ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  overflow-y: auto;
  padding: 16px;
  background: rgba(74, 63, 60, 0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.modal.show { opacity: 1; pointer-events: auto; }

.panel {
  position: relative;
  margin: auto; /* по центру, а якщо вікно вище за екран — гортається, а не обрізається */
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 40px 28px 32px;
  text-align: center;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.35s ease;
}

.modal.show .panel { transform: none; }

.close {
  position: absolute;
  top: 10px;
  right: 14px;
  border: 0;
  background: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.riddle { font-size: 1.5rem; line-height: 1.45; margin: 14px 0 26px; white-space: pre-line; }

.answer { display: flex; flex-direction: column; gap: 12px; }

.answer input {
  font: inherit;
  font-size: 1rem;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid #e6d4d0;
  background: #fff;
  color: var(--text);
  text-align: center;
  outline: none;
}

.answer input:focus { border-color: var(--accent); }

.btn {
  font: inherit;
  padding: 13px 34px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.3s;
}

.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: 0.6; }

.msg { min-height: 1.7em; margin-top: 14px; color: var(--accent-dark); font-size: 0.92rem; }

.shake { animation: shake 0.4s; }

.secret img {
  width: 100%;
  max-height: 52vh;
  object-fit: cover;
  border-radius: 16px;
  margin: 14px 0 6px;
  display: block;
}

.secret h2 { font-size: 2rem; line-height: 1.2; margin-top: 12px; }
.secret p { margin-top: 10px; white-space: pre-line; }
.secret.fresh { animation: bloom 0.9s ease; }

.welcome h2 { font-size: 2.1rem; line-height: 1.2; }
.welcome h2 { margin-bottom: 24px; }
.welcome .buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.welcome .buttons .btn { padding: 13px 22px; }
.panel.free { overflow: visible; max-height: none; }
.btn.grey {
  background: #ece8e6;
  border-color: #ece8e6;
  color: #8f8583;
  position: relative;
  z-index: 1;
  touch-action: none;
  transition: transform 0.25s ease, background 0.3s;
}
.btn.grey:hover { background: #e2dcda; }
.welcome p { margin: -8px 0 26px; white-space: pre-line; font-size: 0.97rem; }

/* ---------- Кружечки ---------- */

body { position: relative; }

/* Шар поверх усієї сторінки: клікаються лише самі кружечки */
.bubbles {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.bubble {
  position: absolute;
  width: 44px;
  height: 44px;
  translate: -50% -50%;
  pointer-events: auto;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: radial-gradient(circle at 32% 30%, #fff 0, var(--soft) 45%, var(--accent) 100%);
  box-shadow: var(--shadow);
  animation: float 6s ease-in-out infinite;
  transition: scale 0.3s ease, box-shadow 0.3s ease;
}

.bubble:hover, .bubble.active { scale: 1.12; box-shadow: 0 0 0 3px rgba(217, 165, 160, 0.35), var(--shadow); }

.note {
  position: absolute;
  z-index: 2;
  width: max-content;
  max-width: min(240px, calc(100% - 24px));
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 12px 30px rgba(185, 130, 125, 0.22);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  transform: scale(0.2);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.note.show { opacity: 1; transform: none; pointer-events: auto; }

@keyframes float { 50% { transform: translateY(-8px); } }

/* ---------- Зайчик ---------- */

.bunny {
  position: fixed;
  left: 18px;
  bottom: -10px;
  z-index: 9;
  width: 110px;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  transform: translateY(110%);
  transition: transform 0.9s cubic-bezier(0.34, 1.4, 0.64, 1);
  filter: drop-shadow(0 6px 14px rgba(185, 130, 125, 0.25));
}

.bunny svg { display: block; width: 100%; height: auto; overflow: visible; }
.bunny.show { transform: none; }

.bunny .paw { transform-origin: 84px 116px; }
.bunny.show .paw { animation: wave 2.6s ease-in-out 0.8s infinite; }

.bunny .ear-r { transform-origin: 70px 58px; animation: twitch 5s ease-in-out infinite; }
.bunny .sign-heart { transform-origin: 40px 124px; animation: beat 1.4s ease-in-out infinite; }
.bunny .eyes { transform-origin: 58px 79px; animation: blink 4.5s infinite; }

/* Хмаринка з текстом над зайчиком */
.bunny .say {
  position: absolute;
  left: 74%;
  bottom: 86%;
  width: max-content;
  max-width: min(210px, calc(100vw - 120px));
  padding: 10px 14px;
  border-radius: 18px 18px 18px 4px;
  background: var(--card);
  box-shadow: 0 10px 26px rgba(185, 130, 125, 0.22);
  color: var(--text);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.12rem;
  line-height: 1.3;
  text-align: left;
  opacity: 0;
  transform: scale(0.3);
  transform-origin: 0 100%;
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bunny .say b { font-weight: 500; color: var(--accent-dark); }
.bunny.talk .say { opacity: 1; transform: none; }
.heart-beat { display: inline-block; color: var(--accent-dark); animation: beat 1.4s ease-in-out infinite; }

@keyframes beat { 0%, 60%, 100% { transform: scale(1); } 20% { transform: scale(1.3); } 40% { transform: scale(0.95); } }
@keyframes wave {
  0%, 60%, 100% { transform: rotate(0); }
  10%, 30%, 50% { transform: rotate(-28deg); }
  20%, 40% { transform: rotate(12deg); }
}
@keyframes twitch { 0%, 88%, 100% { transform: rotate(0); } 93% { transform: rotate(9deg); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }

@media (prefers-reduced-motion: reduce) {
  .bunny, .bunny * { animation: none !important; transition: none !important; }
}

/* ---------- Жабка ---------- */

.pond {
  position: absolute;
  z-index: 8;
  width: min(190px, 44vw);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.pond svg { display: block; width: 100%; height: auto; overflow: visible; }
.pond.shown { opacity: 1; }
.pond .frog { pointer-events: auto; cursor: pointer; }

/* Початок жабки (0,0) — посередині між лапками, тому scale стискає її «до землі» */
.pond .frog, .pond .pad { transform-box: view-box; }
.pond .frog { transform-origin: 0 0; transform: translate(150px, 196px); }
.pond.peek .frog { transform: translate(150px, 168px); transition: transform 0.9s cubic-bezier(0.34, 1.4, 0.64, 1); }
.pond.jump .frog { animation: hop 1.1s linear forwards; transition: none; }
.pond.leap .frog { animation: leap 1.15s linear forwards; }
.pond.dive .frog { animation: dive 1s linear forwards; }
.pond.done .frog { transform: translate(60px, 139px); }
.pond.dive .r4 { animation: ripple 1.4s ease-out 0.7s 1; }
.pond.leap .r4 { animation: ripple 1.4s ease-out 0.05s 1; }
.pond.dive .pad { animation: bob 0.6s ease-out; }

.pond .pad { transform-origin: 58px 141px; }
.pond.jump .pad { animation: bob 0.7s ease-out 0.95s; }
.pond.leap .pad { animation: bob 0.7s ease-out 1s; }

.pond .frog-eyes { transform-box: fill-box; transform-origin: center; animation: blink 4s 4s infinite; }

.pond .ripple { transform-box: fill-box; transform-origin: center; opacity: 0; }
.pond.peek .r1 { animation: ripple 1.6s ease-out 0.2s 2; }
.pond.peek .r2 { animation: ripple 1.6s ease-out 1s 1; }
.pond.jump .r3 { animation: ripple 1.4s ease-out 0.95s 1; }
.pond.leap .r3 { animation: ripple 1.4s ease-out 1s 1; }

/* Бризки: вилітають там, де жабка виринає чи пірнає */
.pond .drops { transform-box: view-box; transform: translate(124px, 140px); }
.pond.peek .drops { transform: translate(150px, 140px); }
.pond .drops circle { opacity: 0; }
.pond.jump .drops circle { animation: splash 0.7s ease-out 0.2s; }
.pond.leap .drops circle { animation: splash 0.7s ease-out 0.1s; }
.pond.dive .drops circle { animation: splash 0.7s ease-out 0.75s; }
@keyframes splash {
  0% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translate(calc(var(--x) * 1.6), calc(var(--y) * 1.2)); }
}

@keyframes hop {
  0% { transform: translate(150px, 168px); animation-timing-function: ease-in-out; }
  12% { transform: translate(150px, 174px) scale(1.14, 0.84); animation-timing-function: ease-out; }
  24% { transform: translate(145px, 136px) scale(0.86, 1.2) rotate(-6deg); animation-timing-function: ease-out; }
  50% { transform: translate(106px, 54px) rotate(-16deg); animation-timing-function: ease-in; }
  78% { transform: translate(64px, 128px) scale(0.9, 1.12) rotate(-3deg); animation-timing-function: ease-out; }
  86% { transform: translate(60px, 139px) scale(1.24, 0.78); animation-timing-function: ease-out; }
  94% { transform: translate(60px, 139px) scale(0.95, 1.06); }
  100% { transform: translate(60px, 139px); }
}
@keyframes leap {
  0% { transform: translate(126px, 205px) scale(0.85, 1.2); animation-timing-function: ease-out; }
  22% { transform: translate(122px, 138px) scale(0.84, 1.22) rotate(-6deg); animation-timing-function: ease-out; }
  50% { transform: translate(96px, 50px) rotate(-16deg); animation-timing-function: ease-in; }
  78% { transform: translate(64px, 128px) scale(0.9, 1.12) rotate(-3deg); animation-timing-function: ease-out; }
  86% { transform: translate(60px, 139px) scale(1.24, 0.78); animation-timing-function: ease-out; }
  94% { transform: translate(60px, 139px) scale(0.95, 1.06); }
  100% { transform: translate(60px, 139px); }
}
/* Хмаринка над жабкою: початок жабки на листку — 30% ширини ставка */
.pond .say {
  position: absolute;
  left: 30%;
  bottom: 52%;
  width: max-content;
  max-width: 200px;
  padding: 8px 14px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 10px 26px rgba(116, 180, 109, 0.22);
  color: var(--text);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.3;
  text-align: center;
  transform: translateX(-50%) scale(0.3);
  transform-origin: 50% 100%;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pond .say::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
}
.pond.talking .say { opacity: 1; transform: translateX(-50%); }

/* Маленька жабка на літері заголовка («т» у «моментах», «п» у «подарунках») */
.letter-frog { position: relative; }
.mini-frog {
  position: absolute;
  left: 50%;
  top: 0.52em;
  width: 0.62em;
  overflow: visible;
  transform: translate(-50%, -100%) scale(0);
  transform-origin: 50% 100%;
  opacity: 0;
}
.mini-frog.pop { animation: mini-pop 0.9s cubic-bezier(0.34, 1.4, 0.64, 1) forwards; }
.mini-frog .frog-eyes { transform-box: fill-box; transform-origin: center; animation: blink 3.5s 2s infinite; }
@keyframes mini-pop {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.2); }
  45% { opacity: 1; transform: translate(-50%, -150%) scale(0.9, 1.1); }
  75% { transform: translate(-50%, -100%) scale(1.15, 0.85); }
  100% { opacity: 1; transform: translate(-50%, -100%); }
}

/* Лілії виринають з води разом із сердечками */
.pond .lily { transform-box: view-box; transform: translateY(34px); }
.pond.gift .lily { animation: lily-rise 1.1s cubic-bezier(0.34, 1.3, 0.64, 1) forwards, sway 4s ease-in-out 1.4s infinite; }
.pond.gift .l2 { animation-delay: 0.45s, 1.9s; }
.pond.gift .l3 { animation-delay: 0.8s, 2.3s; }
@keyframes lily-rise { from { transform: translateY(34px); } to { transform: none; } }
@keyframes sway { 50% { transform: rotate(4deg); } }

/* Три сердечка-подарунки біля жабки: велике і два менші */
.pond .love {
  position: absolute;
  left: 50%;
  top: 22%;
  width: 36%;
  aspect-ratio: 1;
}
.pond .love .h { position: absolute; opacity: 0; transform: scale(0); }
.pond .love .big { left: 0; top: 24%; width: 60%; }
.pond .love .s1 { left: 58%; top: 0; width: 34%; }
.pond .love .s2 { left: 66%; top: 52%; width: 27%; }
.pond .love svg { display: block; width: 100%; fill: #e8a09a; filter: drop-shadow(0 4px 8px rgba(217, 165, 160, 0.5)); }
.pond .love .small svg { fill: #f0b9b3; }
.pond.gift .love .h { animation: love-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, float 3s ease-in-out 0.8s infinite; }
.pond.gift .love .s1 { animation-delay: 0.3s, 1.1s; }
.pond.gift .love .s2 { animation-delay: 0.55s, 1.5s; }
.pond.gift .love svg { animation: beat 1.4s ease-in-out 0.8s infinite; }
.pond.gift .love .s1 svg { animation-delay: 1.2s; }
.pond.gift .love .s2 svg { animation-delay: 1.6s; }
.pond .love i {
  position: absolute;
  left: 40%;
  top: 30%;
  font-style: normal;
  font-size: 0.8rem;
  color: var(--accent);
  opacity: 0;
}
.pond.gift .love i { animation: burst 1.3s ease-out 0.2s forwards; }
.pond .love i:nth-of-type(1) { --x: -34px; --y: -38px; }
.pond .love i:nth-of-type(2) { --x: 6px; --y: -52px; animation-delay: 0.3s; }
.pond .love i:nth-of-type(3) { --x: 38px; --y: -30px; }
.pond .love i:nth-of-type(4) { --x: 44px; --y: 8px; animation-delay: 0.4s; }
.pond .love i:nth-of-type(5) { --x: -26px; --y: 10px; animation-delay: 0.5s; }
.pond .love i:nth-of-type(6) { --x: 20px; --y: -62px; animation-delay: 0.6s; }

@keyframes love-pop { 0% { opacity: 1; transform: scale(0) rotate(-20deg); } 100% { opacity: 1; transform: none; } }
@keyframes burst { 0% { opacity: 0; transform: none; } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1.4); } }

@keyframes dive {
  0% { transform: translate(60px, 139px); animation-timing-function: ease-in-out; }
  18% { transform: translate(60px, 139px) scale(1.2, 0.8); animation-timing-function: ease-out; }
  30% { transform: translate(66px, 120px) scale(0.88, 1.16) rotate(8deg); animation-timing-function: ease-out; }
  50% { transform: translate(90px, 82px) rotate(28deg); animation-timing-function: ease-in; }
  75% { transform: translate(122px, 150px) scale(0.85, 1.15) rotate(60deg); }
  100% { transform: translate(130px, 215px) rotate(75deg); }
}
@keyframes bob { 30% { transform: translateY(3px); } 65% { transform: translateY(-1px); } }
@keyframes ripple { 0% { opacity: 0.9; transform: scale(0.4); } 100% { opacity: 0; transform: scale(1.8); } }

@media (prefers-reduced-motion: reduce) {
  .pond .frog { transform: translate(60px, 139px) !important; }
  .pond *, .pond { animation: none !important; transition: none !important; }
  .pond.gift .love .h, .pond.gift .lily { opacity: 1; transform: none; }
  .mini-frog.pop { animation: none; opacity: 1; transform: translate(-50%, -100%); }
}

@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes glow { 50% { opacity: 0.55; } }
@keyframes bloom { from { opacity: 0; transform: scale(0.94); } }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
