:root {
  --ink: #3a2430;
  --ink-soft: #7a5566;
  --rose: #e06b7a;
  --rose-deep: #c44d5e;
  --blush: #ffb6c1;
  --cream: #fff5f7;
  --card-back: #5a3344;
  --shadow: rgba(90, 40, 55, 0.18);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Sora", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: #f5c5ce;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 12% 18%, #ffe0e8 0%, transparent 55%),
    radial-gradient(ellipse 65% 50% at 88% 12%, #ffc9d4 0%, transparent 50%),
    radial-gradient(ellipse 90% 60% at 50% 100%, #f0a8b6 0%, transparent 55%),
    linear-gradient(165deg, #ffe8ee 0%, #f7c2cc 48%, #ebb0bc 100%);
  overflow: hidden;
}

.floaty {
  position: absolute;
  width: 22px;
  height: 22px;
  opacity: 0.4;
  animation: float-around 11s var(--ease) infinite;
}

.floaty::before,
.floaty::after {
  content: "";
  position: absolute;
}

/* Classic filled heart */
.floaty--classic::before,
.floaty--classic::after {
  width: 12px;
  height: 18px;
  background: var(--rose);
  border-radius: 12px 12px 0 0;
}
.floaty--classic::before {
  left: 6px;
  transform: rotate(-45deg);
}
.floaty--classic::after {
  left: 0;
  transform: rotate(45deg);
}

/* Outline heart */
.floaty--outline::before,
.floaty--outline::after {
  width: 12px;
  height: 18px;
  border: 2.5px solid var(--rose-deep);
  background: transparent;
  border-radius: 12px 12px 0 0;
  border-bottom: none;
}
.floaty--outline::before {
  left: 6px;
  transform: rotate(-45deg);
  border-left: none;
}
.floaty--outline::after {
  left: 0;
  transform: rotate(45deg);
  border-right: none;
}

/* Soft blush heart */
.floaty--soft::before,
.floaty--soft::after {
  width: 14px;
  height: 20px;
  background: var(--blush);
  border-radius: 14px 14px 0 0;
  opacity: 0.9;
}
.floaty--soft::before {
  left: 7px;
  transform: rotate(-45deg);
}
.floaty--soft::after {
  left: 0;
  transform: rotate(45deg);
}

/* Double / layered heart */
.floaty--double {
  filter: drop-shadow(3px 3px 0 rgba(196, 77, 94, 0.35));
}
.floaty--double::before,
.floaty--double::after {
  width: 11px;
  height: 17px;
  background: var(--rose-deep);
  border-radius: 11px 11px 0 0;
}
.floaty--double::before {
  left: 5px;
  transform: rotate(-45deg);
}
.floaty--double::after {
  left: 0;
  transform: rotate(45deg);
}

/* Sparkle heart with center shine */
.floaty--sparkle::before,
.floaty--sparkle::after {
  width: 11px;
  height: 17px;
  background: linear-gradient(145deg, #ffd0d8 0%, var(--rose) 55%, var(--rose-deep) 100%);
  border-radius: 11px 11px 0 0;
}
.floaty--sparkle::before {
  left: 5px;
  transform: rotate(-45deg);
}
.floaty--sparkle::after {
  left: 0;
  transform: rotate(45deg);
}
.floaty--sparkle {
  animation-name: float-sparkle;
}

/* Bubble / hollow soft heart */
.floaty--bubble::before,
.floaty--bubble::after {
  width: 13px;
  height: 19px;
  background: rgba(255, 245, 247, 0.55);
  border: 2px solid rgba(224, 107, 122, 0.7);
  border-radius: 13px 13px 0 0;
}
.floaty--bubble::before {
  left: 6px;
  transform: rotate(-45deg);
}
.floaty--bubble::after {
  left: 0;
  transform: rotate(45deg);
}

/* Tiny dotted heart */
.floaty--tiny {
  width: 14px;
  height: 14px;
  opacity: 0.5;
}
.floaty--tiny::before,
.floaty--tiny::after {
  width: 7px;
  height: 11px;
  background: #f7a8b4;
  border-radius: 7px 7px 0 0;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.45);
}
.floaty--tiny::before {
  left: 3.5px;
  transform: rotate(-45deg);
}
.floaty--tiny::after {
  left: 0;
  transform: rotate(45deg);
}

/* Tall narrow heart */
.floaty--tall::before,
.floaty--tall::after {
  width: 9px;
  height: 22px;
  background: #d47888;
  border-radius: 10px 10px 2px 2px;
}
.floaty--tall::before {
  left: 4px;
  transform: rotate(-38deg);
}
.floaty--tall::after {
  left: 0;
  transform: rotate(38deg);
}

.floaty--1 { top: 10%; left: 7%; animation-delay: 0s; }
.floaty--2 { top: 18%; right: 11%; animation-delay: -1.5s; transform: scale(0.85); }
.floaty--3 { bottom: 16%; left: 14%; animation-delay: -3s; transform: scale(1.2); }
.floaty--4 { bottom: 26%; right: 9%; animation-delay: -4.5s; transform: scale(0.95); }
.floaty--5 { top: 42%; left: 5%; animation-delay: -6s; transform: scale(0.7); opacity: 0.3; }
.floaty--6 { top: 8%; left: 42%; animation-delay: -2.2s; transform: scale(0.8); opacity: 0.32; }
.floaty--7 { top: 62%; right: 18%; animation-delay: -7s; }
.floaty--8 { bottom: 10%; left: 48%; animation-delay: -5s; transform: scale(0.9); opacity: 0.28; }
.floaty--9 { top: 30%; right: 6%; animation-delay: -8s; transform: scale(1.15) rotate(12deg); }
.floaty--10 { top: 72%; left: 8%; animation-delay: -3.8s; transform: scale(0.75) rotate(-8deg); }
.floaty--11 { top: 14%; left: 70%; animation-delay: -9s; transform: scale(0.65); opacity: 0.25; }
.floaty--12 { bottom: 36%; left: 62%; animation-delay: -1s; transform: scale(1.05) rotate(6deg); }

@keyframes float-around {
  0%,
  100% { translate: 0 0; }
  50% { translate: 0 -18px; }
}

@keyframes float-sparkle {
  0%,
  100% {
    translate: 0 0;
    filter: brightness(1);
  }
  50% {
    translate: 0 -16px;
    filter: brightness(1.2);
  }
}

.confetti-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  opacity: 0;
  will-change: transform, opacity;
  animation: confetti-burst 1.1s var(--ease) forwards;
}

.confetti-piece.is-heart {
  width: 12px;
  height: 12px;
  border-radius: 0;
  background: transparent !important;
}

.confetti-piece.is-heart::before,
.confetti-piece.is-heart::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 11px;
  background: var(--piece, var(--rose));
  border-radius: 7px 7px 0 0;
}

.confetti-piece.is-heart::before {
  left: 5px;
  transform: rotate(-45deg);
}

.confetti-piece.is-heart::after {
  left: 0;
  transform: rotate(45deg);
}

.confetti-piece.is-heart-outline {
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: transparent !important;
}

.confetti-piece.is-heart-outline::before,
.confetti-piece.is-heart-outline::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 12px;
  border: 2px solid var(--piece, var(--rose));
  background: transparent;
  border-radius: 8px 8px 0 0;
  border-bottom: none;
}

.confetti-piece.is-heart-outline::before {
  left: 5px;
  transform: rotate(-45deg);
  border-left: none;
}

.confetti-piece.is-heart-outline::after {
  left: 0;
  transform: rotate(45deg);
  border-right: none;
}

.confetti-piece.is-heart-soft {
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: transparent !important;
  filter: drop-shadow(0 0 2px rgba(255, 182, 193, 0.8));
}

.confetti-piece.is-heart-soft::before,
.confetti-piece.is-heart-soft::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 12px;
  background: var(--blush);
  border-radius: 8px 8px 0 0;
}

.confetti-piece.is-heart-soft::before {
  left: 5px;
  transform: rotate(-45deg);
}

.confetti-piece.is-heart-soft::after {
  left: 0;
  transform: rotate(45deg);
}

@keyframes confetti-burst {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.7);
  }
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: 1rem;
}

.screen {
  display: none;
  width: min(100%, 56rem);
  margin: 0 auto;
  text-align: center;
  padding-top: 9vh;
}

.screen.is-active {
  display: block;
  animation: screen-in 0.55s var(--ease);
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#game.screen.is-active,
#quiz.screen.is-active {
  padding-top: 0.75rem;
  padding-bottom: 1.5rem;
}

#gate.screen {
  display: none;
  padding-top: 0;
  min-height: 100dvh;
  width: 100%;
  max-width: none;
  place-items: center;
  animation: none;
}

#gate.screen.is-active {
  display: grid !important;
  opacity: 1 !important;
  visibility: visible !important;
  animation: none !important;
  transform: none !important;
  z-index: 5;
  position: relative;
}

.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  width: min(100%, 22rem);
}

.gate__clue {
  margin: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  font-size: clamp(2.8rem, 12vw, 4rem);
  line-height: 1;
  user-select: none;
  white-space: nowrap;
}

.gate__clue span {
  display: inline-block;
  flex: 0 0 auto;
}

.gate__form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.gate__input {
  width: 100%;
  border: 1.5px solid rgba(58, 36, 48, 0.12);
  border-radius: 999px;
  padding: 0.95rem 1.25rem;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  text-align: center;
  outline: none;
}

.gate__input:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(224, 107, 122, 0.18);
}

.gate__input.is-wrong {
  border-color: var(--rose-deep);
  animation: gate-shake 0.35s ease;
}

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

.brand {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: clamp(2.9rem, 11vw, 4.7rem);
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: var(--rose-deep);
  animation: brand-soft 4s ease-in-out infinite;
  text-decoration: none;
}

a.brand:hover,
a.brand:focus-visible {
  color: var(--rose-deep);
}

.brand--small {
  font-size: 1.35rem;
  margin: 0;
  text-align: left;
  animation: none;
  color: var(--ink);
  font-style: italic;
}

a.brand--small:hover,
a.brand--small:focus-visible {
  color: var(--ink);
}

@keyframes brand-soft {
  0%,
  100% { transform: rotate(-1.5deg); }
  50% { transform: rotate(1.5deg); }
}

.headline {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3.8vw, 1.7rem);
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
}

.lede {
  margin: 0 auto 1.75rem;
  max-width: 26rem;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cream);
  background: var(--rose);
  padding: 0.95rem 1.7rem;
  border-radius: 999px;
  box-shadow: 0 10px 28px var(--shadow);
  transition:
    transform 0.25s var(--ease),
    background 0.2s ease;
}

.btn:hover {
  background: var(--rose-deep);
  transform: translateY(-2px) rotate(-1deg);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.game-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.55rem;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.85rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.stats strong {
  color: var(--rose-deep);
  font-weight: 600;
}

.game-hint {
  margin: 0 0 0.9rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-style: italic;
}

.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.45rem;
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .board {
    gap: 0.65rem;
  }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.modal[hidden] {
  display: none !important;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(58, 36, 48, 0.4);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 22rem);
  padding: 2.1rem 1.5rem 1.75rem;
  text-align: center;
  background: var(--cream);
  border-radius: 1.4rem;
  box-shadow: 0 22px 50px rgba(90, 40, 55, 0.25);
  animation: modal-in 0.4s var(--ease);
}

.modal__panel--win {
  background: linear-gradient(180deg, #fff7fa 0%, #ffe4ea 100%);
}

.modal__stamp {
  width: 42px;
  height: 42px;
  margin: 0 auto 0.85rem;
  position: relative;
}

.modal__stamp::before,
.modal__stamp::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 34px;
  background: var(--rose);
  border-radius: 22px 22px 0 0;
}

.modal__stamp::before {
  left: 12px;
  transform: rotate(-45deg);
}

.modal__stamp::after {
  left: 0;
  transform: rotate(45deg);
}

.modal__stamp--win {
  animation: stamp-pop 0.7s var(--ease);
}

.modal__stamp--win::before,
.modal__stamp--win::after {
  background: var(--rose-deep);
}

@keyframes stamp-pop {
  0% { transform: scale(0.4) rotate(-12deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

.modal__title {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  font-style: italic;
  color: var(--ink);
}

.modal__copy {
  margin: 0 0 1.35rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card {
  position: relative;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.card::before {
  content: "";
  display: block;
  padding-top: 100%;
}

.card__inner {
  position: absolute;
  inset: 0;
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 8px 18px var(--shadow);
  background: var(--card-back);
  transition: transform 0.25s var(--ease);
}

.card:hover .card__inner {
  transform: translateY(-2px);
}

.card__photo,
.card__cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.card__photo {
  object-fit: cover;
  object-position: center;
  display: block;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.card__cover {
  z-index: 1;
  background:
    radial-gradient(circle at 30% 20%, #7a4558 0%, transparent 42%),
    linear-gradient(145deg, #6b3a4c 0%, var(--card-back) 55%, #402030 100%);
  transition: opacity 0.2s ease;
}

.card__cover::before,
.card__cover::after {
  content: "";
  position: absolute;
  top: 46%;
  left: 50%;
  width: 14%;
  height: 22%;
  background: rgba(255, 182, 193, 0.75);
  border-radius: 40px 40px 0 0;
}

.card__cover::before {
  transform: translate(-35%, -50%) rotate(-45deg);
}

.card__cover::after {
  transform: translate(-65%, -50%) rotate(45deg);
}

.card.is-flipped .card__cover,
.card.is-matched .card__cover {
  opacity: 0;
  pointer-events: none;
}

.card.is-flipped .card__photo,
.card.is-matched .card__photo {
  opacity: 1;
}

.card.is-matched {
  pointer-events: none;
}

.card.is-matched .card__inner {
  outline: 3px solid var(--rose);
  outline-offset: -3px;
  animation: match-pop 0.5s var(--ease);
}

@keyframes match-pop {
  0% { transform: scale(1) rotate(0); }
  35% { transform: scale(1.08) rotate(-2deg); }
  70% { transform: scale(1.04) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}

.card:focus-visible .card__inner {
  outline: 2px solid var(--rose);
  outline-offset: 2px;
}

.quiz {
  width: min(100%, 32rem);
  margin: 1.5rem auto 0;
  text-align: left;
  padding: 1.35rem 1.25rem;
  background: rgba(255, 245, 247, 0.72);
  border-radius: 1.25rem;
  box-shadow: 0 12px 30px var(--shadow);
}

.quiz__eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--rose-deep);
}

.quiz__question {
  margin: 0 0 1.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 500;
  line-height: 1.25;
  color: var(--ink);
}

.quiz__form {
  display: grid;
  gap: 0.75rem;
}

.quiz__label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.quiz__input {
  width: 100%;
  border: 1.5px solid rgba(58, 36, 48, 0.12);
  border-radius: 1rem;
  padding: 0.95rem 1.1rem;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.quiz__input:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(224, 107, 122, 0.18);
}

.quiz__input:disabled {
  opacity: 0.75;
}

.quiz__feedback {
  min-height: 1.25rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.quiz__feedback.is-hint {
  color: var(--ink-soft);
}

.quiz__feedback.is-wrong {
  color: var(--rose-deep);
}

.quiz__feedback.is-correct {
  color: #3d8f6e;
}

.quiz__form .btn {
  justify-self: start;
  margin-top: 0.25rem;
}

#challenge-3.screen.is-active {
  padding-top: 0.75rem;
  padding-bottom: 1.5rem;
}

.zoom-challenge {
  width: 100%;
  margin: 0.5rem auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

.zoom-stage {
  position: relative;
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  line-height: 0;
  border-radius: 1.1rem;
  overflow: hidden;
  box-shadow: 0 16px 36px var(--shadow);
  cursor: none;
  touch-action: none;
  background: transparent;
}

.zoom-stage__img {
  display: block;
  width: auto;
  max-width: min(100%, 42rem);
  max-height: min(70vh, 580px);
  height: auto;
  user-select: none;
  pointer-events: none;
}

.zoom-lens {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 245, 247, 0.95);
  box-shadow:
    0 0 0 1px rgba(58, 36, 48, 0.18),
    0 10px 24px rgba(90, 40, 55, 0.28);
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transform: translateZ(0);
}

.zoom-lens[hidden] {
  display: none !important;
}

.zoom-stage.is-zooming .zoom-lens {
  opacity: 1;
}

.zoom-dots {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
}

.zoom-dots__item {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(58, 36, 48, 0.12);
  box-shadow: 0 4px 10px rgba(90, 40, 55, 0.12);
  flex: 0 0 auto;
}

.wa-help {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.wa-help__label {
  margin: 0;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 245, 247, 0.92);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: 0 8px 20px var(--shadow);
  white-space: nowrap;
}

.wa-help__btn {
  display: grid;
  place-items: center;
  width: 3.35rem;
  height: 3.35rem;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  box-shadow: 0 10px 24px rgba(18, 140, 70, 0.35);
  transition: transform 0.2s var(--ease), box-shadow 0.2s ease;
}

.wa-help:hover .wa-help__btn,
.wa-help:focus-visible .wa-help__btn {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 28px rgba(18, 140, 70, 0.42);
}

.wa-help:focus-visible {
  outline: none;
}

.wa-help:focus-visible .wa-help__btn {
  outline: 2px solid var(--rose-deep);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .brand,
  .floaty,
  .screen.is-active,
  .modal__panel,
  .modal__stamp--win {
    animation: none !important;
  }

  .wa-help__btn {
    transition: none;
  }

  .zoom-stage__img {
    transition: none;
  }

  .zoom-lens {
    display: none !important;
  }
}
