: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 {
  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); }

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

.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;
  align-items: center;
  justify-content: center;
  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;
  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%;
  border-radius: 16px;
  margin: 14px 0 6px;
  display: block;
}

.secret h2 { font-size: 2rem; 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; }
.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; }

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

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); } }

@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); }
}
