/* ============================================================================
 *  Тема поздравления — тёплая, «мобайл-ферст», без внешних шрифтов/CDN.
 * ========================================================================== */

:root {
  --rose: #ff6b9d;
  --rose-soft: #ff8fab;
  --rose-deep: #e23e6b;
  --gold: #f4c95d;
  --gold-deep: #e0a92e;
  --plum: #5a2a47;
  --plum-soft: #8a5a76;
  --green: #2fae72;
  --green-soft: #e3f7ec;
  --bad: #e2674a;
  --bad-soft: #fdeae4;
  --card-bg: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 50px rgba(193, 60, 110, 0.22);
  --radius: 26px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
}

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

html,
body {
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--plum);
  background: linear-gradient(150deg, #ffe3ee 0%, #fff4e6 45%, #ffe0f0 100%);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  position: relative;
  overflow-x: hidden;
}

/* Мягкие декоративные «пятна» для глубины */
body::before,
body::after {
  content: "";
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}
body::before {
  background: #ffb3d1;
  top: -90px;
  left: -90px;
}
body::after {
  background: #ffe08a;
  bottom: -110px;
  right: -90px;
}

/* ───────────────────────── Экраны ───────────────────────── */
#app {
  width: 100%;
  max-width: 540px;
  z-index: 1;
}

.screen {
  display: none;
}
.screen.is-active {
  display: flex;
  justify-content: center;
  animation: screenIn 0.5s ease both;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 26px 34px;
  width: 100%;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

/* ───────────────────────── Герой 18 ×2 = 36 ───────────────────────── */
.hero {
  margin-bottom: 18px;
}

.hero-greeting {
  font-size: 1.1rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rose-deep);
  font-weight: 700;
  margin-bottom: 10px;
}

.hero-eq {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  line-height: 1;
}

.hero-base {
  font-size: 6.2rem;
  font-weight: 800;
  background: linear-gradient(160deg, var(--rose), var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: pop 0.6s ease both;
}

.hero-mult {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--gold-deep);
  transform: translateY(-2.4rem);
  animation: pop 0.6s ease 0.35s both;
}

.hero-eq-sign {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--plum-soft);
  margin-left: 6px;
  animation: fadeRight 0.6s ease 0.7s both;
}

@keyframes pop {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  70% {
    transform: scale(1.12);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
.hero-mult {
  /* сохранить смещение вверх в финальном кадре анимации */
  animation-name: popMult;
}
@keyframes popMult {
  0% {
    opacity: 0;
    transform: translateY(-2.4rem) scale(0.4);
  }
  70% {
    transform: translateY(-2.4rem) scale(1.15);
  }
  100% {
    opacity: 1;
    transform: translateY(-2.4rem) scale(1);
  }
}
@keyframes fadeRight {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.hero-name {
  font-size: 2.6rem;
  font-weight: 800;
  margin-top: 8px;
  color: var(--plum);
  animation: fadeRight 0.6s ease 0.9s both;
}

.intro-text {
  font-size: 1.06rem;
  line-height: 1.6;
  color: var(--plum-soft);
  margin: 6px auto 6px;
  max-width: 36ch;
}

.daughters-line {
  font-size: 0.98rem;
  color: var(--rose-deep);
  margin: 12px 0 22px;
  font-weight: 600;
}

/* ───────────────────────── Кнопки ───────────────────────── */
.btn {
  font-family: inherit;
  font-size: 1.12rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 15px 30px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  box-shadow: 0 10px 24px rgba(226, 62, 107, 0.4);
}
.btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 12px 30px rgba(226, 62, 107, 0.5);
}

.btn-ghost {
  color: var(--rose-deep);
  background: #fff;
  border: 2px solid var(--rose-soft);
}
.btn-ghost:hover {
  background: #fff0f5;
}

.btn-submit {
  color: #fff;
  background: linear-gradient(135deg, var(--rose-soft), var(--rose));
  box-shadow: 0 8px 18px rgba(255, 107, 157, 0.35);
  font-size: 1rem;
  padding: 13px 26px;
}

/* ───────────────────────── Квиз ───────────────────────── */
.quiz-card {
  text-align: left;
}

.quiz-progress {
  margin-bottom: 20px;
}
.progress-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
#progress-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--plum-soft);
}
.topic-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--rose-deep);
  background: #fff0f5;
  border: 1px solid #ffd4e3;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.progress-bar {
  height: 9px;
  background: #ffe1ec;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--rose-soft), var(--rose-deep));
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.question-text {
  font-size: 1.32rem;
  line-height: 1.4;
  color: var(--plum);
  margin: 8px 0 20px;
  animation: screenIn 0.4s ease both;
}

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

/* Варианты ответа */
.choice {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: left;
  color: var(--plum);
  background: #fff;
  border: 2px solid #ffd9e6;
  border-radius: 16px;
  padding: 15px 18px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.2s ease,
    background 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.choice:hover:not(:disabled) {
  border-color: var(--rose-soft);
  box-shadow: 0 6px 16px rgba(255, 107, 157, 0.18);
}
.choice:active:not(:disabled) {
  transform: scale(0.985);
}
.choice:disabled {
  cursor: default;
}
.choice.is-correct {
  border-color: var(--green);
  background: var(--green-soft);
  color: #176b46;
}
.choice.is-wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: #a23a22;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Ввод текста */
.text-answer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.text-input {
  font-family: inherit;
  font-size: 1.1rem;
  color: var(--plum);
  background: #fff;
  border: 2px solid #ffd9e6;
  border-radius: 16px;
  padding: 15px 18px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.text-input:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(255, 107, 157, 0.16);
}
.text-input.is-wrong {
  border-color: var(--bad);
  animation: shake 0.4s ease;
}

/* Отклик */
.feedback {
  min-height: 1.5em;
  margin-top: 16px;
  font-weight: 700;
  font-size: 1.02rem;
  text-align: center;
}
.feedback.ok {
  color: var(--green);
}
.feedback.bad {
  color: var(--bad);
}
.feedback.tip {
  color: var(--gold-deep);
  font-weight: 600;
}

/* Кнопка «Начать заново» внизу карточки квиза */
.restart-link {
  display: block;
  width: fit-content;
  margin: 26px auto 0;
  padding: 10px 20px;
  background: #fff;
  color: var(--rose-deep);
  border: 1.5px solid #ffd4e3;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.restart-link:hover {
  background: #fff0f5;
  border-color: var(--rose-soft);
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.18);
}
.restart-link:active {
  transform: scale(0.97);
}

/* ───────────────────────── Финал ───────────────────────── */
.final-card {
  text-align: center;
}
.final-emoji {
  font-size: 4.4rem;
  animation: pop 0.7s ease both, floaty 3s ease-in-out 0.7s infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.final-title {
  font-size: 1.9rem;
  color: var(--rose-deep);
  margin: 10px 0 16px;
}
.final-hint {
  font-size: 1.18rem;
  line-height: 1.65;
  color: var(--plum);
  white-space: pre-line; /* сохраняем переносы строк из questions.js */
  margin-bottom: 26px;
}

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

.page-footer {
  margin-top: 18px;
  font-size: 0.82rem;
  color: var(--plum-soft);
  opacity: 0.8;
  z-index: 1;
}

/* ───────────────────────── Десктоп ───────────────────────── */
@media (min-width: 640px) {
  .card {
    padding: 40px 40px 44px;
  }
  .hero-base {
    font-size: 7.4rem;
  }
  .hero-name {
    font-size: 3rem;
  }
  .question-text {
    font-size: 1.45rem;
  }
}

/* Уважаем «уменьшить движение» */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
