/* ============================================================
   Website xin lỗi gửi Trà My 💕
   Palette: soft sky blue + pink + creamy yellow accents
   ============================================================ */

:root {
  /* Backgrounds */
  --color-bg-1: #e3f1fb;   /* light sky */
  --color-bg-2: #cfe6f6;   /* sky blue */
  --color-bg-3: #ffd6e3;   /* light pink */
  --color-bg-4: #ffc2d4;   /* pink */

  /* Card */
  --color-card: rgba(255, 255, 255, 0.95);
  --color-card-border: rgba(255, 255, 255, 0.7);
  --color-side-strip: #c9e6f5;

  /* Brand */
  --color-blue: #2c5f8d;        /* dark blue for title */
  --color-blue-soft: #5a8fb8;
  --color-blue-bg: #b8dcef;
  --color-pink: #ff7ba1;
  --color-pink-dark: #e85a87;
  --color-yellow: #fcd34d;       /* letter circles */
  --color-yellow-soft: #ffe082;

  /* Text */
  --color-text: #2c4a6b;
  --color-text-soft: #5a6f87;
  --color-text-muted: #94a8c0;

  /* Shadows */
  --shadow-soft: 0 20px 50px rgba(44, 95, 141, 0.18);
  --shadow-strong: 0 30px 80px rgba(44, 95, 141, 0.25);
  --shadow-btn: 0 10px 25px rgba(255, 123, 161, 0.35);

  --radius-card: 32px;
  --radius-btn: 999px;

  --font-display: "Dancing Script", "Quicksand", cursive;
  --font-body: "Quicksand", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(
    135deg,
    var(--color-bg-1) 0%,
    var(--color-bg-2) 35%,
    var(--color-bg-3) 75%,
    var(--color-bg-4) 100%
  );
  background-attachment: fixed;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.6) 0%, transparent 35%),
    radial-gradient(circle at 85% 80%, rgba(255, 192, 203, 0.4) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

/* =================== Background hearts =================== */
.bg-hearts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.bg-hearts .heart {
  position: absolute;
  bottom: -60px;
  font-size: 22px;
  opacity: 0.55;
  animation: floatUp linear infinite;
  filter: drop-shadow(0 4px 10px rgba(255, 123, 161, 0.3));
  will-change: transform, opacity;
}

@keyframes floatUp {
  0%   { transform: translateY(0)        rotate(0deg)   scale(0.9); opacity: 0; }
  10%  { opacity: 0.7; }
  90%  { opacity: 0.7; }
  100% { transform: translateY(-110vh) rotate(360deg) scale(1.1); opacity: 0; }
}

/* =================== Sparkles (decorative) =================== */
.sparkle {
  position: absolute;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 2;
  animation: sparkleSpin 5s ease-in-out infinite;
}

.sparkle--1 { top: 8%;  right: 10%; }
.sparkle--2 { top: 16%; right: 22%; width: 18px; height: 18px; animation-delay: 1s; }
.sparkle--3 { bottom: 12%; left: 8%; width: 22px; height: 22px; animation-delay: 2s; }

@keyframes sparkleSpin {
  0%, 100% { transform: rotate(0deg) scale(1);   opacity: 0.7; }
  50%      { transform: rotate(180deg) scale(1.25); opacity: 1; }
}

/* =================== Stage / Screens =================== */
.stage {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px 80px;
}

.screen {
  display: none;
  width: 100%;
  max-width: 720px;
  animation: screenIn 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

/* Question card needs more room so it doesn't look small on big screens */
.screen--question { max-width: 960px; }
.screen--final    { max-width: 720px; }

.screen.active { display: block; }

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

/* =================== Card =================== */
.card {
  background: var(--color-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-card);
  padding: 50px 44px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  text-align: center;
}

/* Decorative blue strip on the left edge (like the Canva quiz card) */
.card--quiz::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 32px;
  background: linear-gradient(180deg, var(--color-bg-2), var(--color-side-strip));
  border-radius: 6px 50% 50% 6px / 6px 100% 100% 6px;
  z-index: 0;
}

.card--quiz::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 28px;
  background: linear-gradient(180deg, var(--color-bg-3), var(--color-bg-4));
  border-radius: 50% 6px 6px 50% / 100% 6px 6px 100%;
  z-index: 0;
  opacity: 0.7;
}

.card > * { position: relative; z-index: 1; }

/* =================== Gate (birthday) =================== */
.card--gate { padding: 50px 38px; }

.card__emoji {
  font-size: 56px;
  margin-bottom: 16px;
  display: inline-block;
  animation: wobble 2.6s ease-in-out infinite;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-6deg) scale(1); }
  50%      { transform: rotate(6deg)  scale(1.08); }
}

.card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.6rem;
  background: linear-gradient(135deg, var(--color-blue), var(--color-pink));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 14px;
  line-height: 1.2;
}

.card__subtitle {
  color: var(--color-text-soft);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 28px;
  font-weight: 500;
}

.gate-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.gate-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.gate-input {
  width: 70px;
  height: 64px;
  border: 2px solid rgba(44, 95, 141, 0.2);
  border-radius: 18px;
  background: #ffffff;
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  color: var(--color-text);
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 6px 16px rgba(44, 95, 141, 0.08);
}

.gate-input--year { width: 100px; }

.gate-input::placeholder {
  color: var(--color-text-muted);
  font-weight: 500;
}

.gate-input:focus {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 4px rgba(44, 95, 141, 0.15);
  transform: translateY(-2px);
}

.gate-sep {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-blue);
}

.gate-error {
  min-height: 22px;
  font-size: 0.95rem;
  color: var(--color-pink-dark);
  font-weight: 600;
  margin-top: 4px;
}

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

/* =================== Buttons =================== */
.btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 32px;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  letter-spacing: 0.2px;
  position: relative;
}

.btn--primary {
  background: linear-gradient(135deg, var(--color-blue), var(--color-pink));
  color: #fff;
  box-shadow: var(--shadow-btn);
  margin-top: 6px;
}

.btn--primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 16px 36px rgba(255, 123, 161, 0.45);
}

.btn--primary:active { transform: translateY(-1px) scale(0.99); }

.btn--ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--color-blue);
  border: 2px solid rgba(44, 95, 141, 0.25);
  box-shadow: 0 8px 18px rgba(44, 95, 141, 0.12);
  margin-top: 28px;
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-2px);
}

/* =================== Quiz card layout =================== */
.card--quiz {
  padding: 64px 72px 64px;
  text-align: left;
}

.quiz-header {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 10px;
}

.quiz-label {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 700;
  color: var(--color-blue);
  line-height: 1;
  letter-spacing: -1px;
}

.quiz-sparkle {
  font-size: 38px;
  color: var(--color-yellow);
  filter: drop-shadow(0 4px 10px rgba(252, 211, 77, 0.5));
  animation: sparkleSpin 4s ease-in-out infinite;
}

.quiz-question {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--color-text-soft);
  line-height: 1.5;
  margin-bottom: 38px;
  max-width: 95%;
}

/* ---------- yes/no layout (Q1 only) ---------- */
.quiz-options--yesno {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 32px;
  min-height: 100px;
  margin-top: 24px;
}

.btn--runaway {
  background: rgba(255, 255, 255, 0.92);
  color: var(--color-text-soft);
  border: 2px dashed rgba(255, 123, 161, 0.6);
  font-size: 1.25rem;
  padding: 20px 44px;
  box-shadow: 0 10px 24px rgba(44, 95, 141, 0.12);

  /* Smooth visible flight to a new position */
  transition:
    transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
    top       0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
    left      0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn--runaway.is-flying {
  z-index: 9999;
  box-shadow: 0 14px 32px rgba(255, 123, 161, 0.45);
}

.btn--accept {
  background: linear-gradient(135deg, var(--color-pink), var(--color-pink-dark));
  color: #fff;
  font-size: 1.25rem;
  padding: 20px 44px;
  box-shadow: var(--shadow-btn);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.btn--accept:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 16px 36px rgba(255, 123, 161, 0.5);
}

/* ---------- choice layout (A/B/C/D) ---------- */
.quiz-options--choice {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px 28px;
  margin-top: 10px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 18px;
  background: rgba(255, 255, 255, 0.65);
  border: 2px solid transparent;
  border-radius: 22px;
  padding: 18px 22px 18px 16px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-text);
  transition: transform 0.2s ease, background 0.2s ease,
    border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

.choice:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 123, 161, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(44, 95, 141, 0.15);
}

.choice:active { transform: translateY(-1px) scale(0.99); }

.choice__letter {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-yellow-soft), var(--color-yellow));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.7rem;
  color: #fff;
  text-shadow: 0 2px 4px rgba(207, 145, 0, 0.4);
  box-shadow: 0 8px 18px rgba(252, 211, 77, 0.5),
    inset 0 -3px 0 rgba(207, 145, 0, 0.2);
}

.choice__text { flex: 1; line-height: 1.4; }

/* =================== Final screen =================== */
.card--final { padding: 60px 38px; text-align: center; }

.final-heart {
  font-size: 100px;
  line-height: 1;
  display: inline-block;
  margin-bottom: 12px;
  animation: heartBeat 1.4s ease-in-out infinite;
  filter: drop-shadow(0 16px 36px rgba(255, 123, 161, 0.5));
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  25%      { transform: scale(1.18); }
  50%      { transform: scale(1); }
  75%      { transform: scale(1.12); }
}

.final-title {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-blue), var(--color-pink), var(--color-pink-dark));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 18px 0;
  line-height: 1.2;
}

.final-message {
  color: var(--color-text-soft);
  font-size: 1.05rem;
  line-height: 1.75;
  font-weight: 500;
  max-width: 580px;
  margin: 0 auto;
  white-space: pre-line;
  text-align: left;
}

/* =================== Footer =================== */
.page-footer {
  position: fixed;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-soft);
  z-index: 2;
  pointer-events: none;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.footer-heart {
  display: inline-block;
  animation: heartBeat 1.4s ease-in-out infinite;
}

/* =================== Burst hearts =================== */
.burst-heart {
  position: fixed;
  font-size: 22px;
  pointer-events: none;
  z-index: 6;
  animation: burstAway 1.4s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes burstAway {
  0%   { transform: translate(-50%, -50%) scale(0.4);                 opacity: 1; }
  100% { transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(1.1); opacity: 0; }
}

/* =================== Responsive =================== */
@media (max-width: 960px) {
  .card--quiz { padding: 52px 48px; }
  .quiz-label { font-size: 3.2rem; }
  .quiz-question { font-size: 1.3rem; }
  .choice { font-size: 1.1rem; }
  .choice__letter { width: 52px; height: 52px; font-size: 1.5rem; }
}

@media (max-width: 720px) {
  .card { padding: 40px 26px; border-radius: 24px; }
  .card--quiz { padding: 42px 28px; }

  .quiz-label { font-size: 2.6rem; }
  .quiz-question { font-size: 1.1rem; margin-bottom: 26px; max-width: 100%; }
  .quiz-options--choice {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .card__title, .final-title { font-size: 2.1rem; }

  .gate-input { width: 60px; height: 56px; font-size: 1.3rem; }
  .gate-input--year { width: 86px; }

  .final-heart { font-size: 80px; }
  .btn { font-size: 1rem; padding: 12px 26px; }
  .quiz-options--yesno { gap: 18px; }
  .btn--runaway, .btn--accept { font-size: 1.1rem; padding: 16px 32px; }

  .choice { font-size: 1.02rem; padding: 14px 16px 14px 12px; gap: 14px; }
  .choice__letter { width: 44px; height: 44px; font-size: 1.25rem; }
}

@media (max-width: 380px) {
  .gate-input { width: 52px; height: 52px; font-size: 1.15rem; }
  .gate-input--year { width: 76px; }
  .gate-sep { font-size: 1.15rem; }
  .quiz-label { font-size: 2rem; }
}
