/* Self-hosted Poppins (latin subset) — only the weights used on this page.
   Removes the render-blocking Google Fonts request and third-party origin. */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("poppins-400.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("poppins-500.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("poppins-700.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("poppins-800.woff2") format("woff2");
}

:root {
  --ink: #1c1c1e;
  --ink-soft: #4a4a4f;
  --page-top: #f3f9fd;
  --page-bot: #e4f1fb;
  --card-face: #dbeefd;
  --card-face-2: #eaf5fe;
  --card-border: #bcdcf2;
  --yellow: #f6ee9c;
  --pink: #f7ccd6;
  --win-bg: #d3efdf;
  --win-bg-2: #c3e8d2;
  --win-border: #7fcaa3;
  --cta: #1f97d6;
  --cta-dark: #1580bd;
  --radius: 18px;
  --shadow: 0 10px 24px rgba(31, 94, 140, 0.12);
}

* { box-sizing: border-box; }

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

body {
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--page-top) 0%, var(--page-bot) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

.game {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 20px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ---------- Header ---------- */
.brand {
  height: 30px;
  width: auto;
  margin-bottom: 22px;
}

.title {
  font-size: clamp(2.6rem, 9vw, 4.1rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 0.98;
  margin: 0;
  text-transform: uppercase;
  transition: color 0.35s ease, transform 0.35s ease;
}

.title.win {
  color: var(--cta);
  font-size: clamp(2rem, 7.5vw, 3.2rem);
}

.subtitle {
  margin: 10px 0 26px;
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
  min-height: 1.4em;
}

/* ---------- Board ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
  perspective: 1200px;
}

.card {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius);
  transition: opacity 0.4s ease, transform 0.4s ease, filter 0.4s ease;
  font-family: inherit;
  outline: none;
}

.card:focus-visible .card__inner {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--cta);
}

.card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.55s cubic-bezier(0.4, 0.15, 0.2, 1);
  transform-style: preserve-3d;
  border-radius: var(--radius);
}

.card.flipped .card__inner {
  transform: rotateY(180deg);
}

.card__front,
.card__back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Face-down: product packshot on light blue */
.card__front {
  background: linear-gradient(160deg, var(--card-face-2), var(--card-face));
  border: 2px solid var(--card-border);
  box-shadow: var(--shadow);
}

.card__front img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(0.9);
  margin-top: 8px;
}

.card:hover:not(.flipped):not(.locked) {
  transform: translateY(-4px);
}

.card:hover:not(.flipped):not(.locked) .card__front {
  border-color: var(--cta);
}

/* Won reveal side */
.card__back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, var(--win-bg), var(--win-bg-2));
  border: 2px solid var(--win-border);
  padding: 8px;
  gap: 6px;
}

.prize__media {
  height: 46%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  line-height: 1;
}

.prize__media img {
  max-height: 100%;
  max-width: 78%;
  object-fit: contain;
  filter: drop-shadow(0 5px 9px rgba(0, 0, 0, 0.14));
}

/* Transparent product cutout (travel bottle) — sits taller and floats
   cleanly on the tile instead of a pasted rectangle. */
.prize__media--cut {
  height: 58%;
  margin-top: -2px;
}

.prize__media--cut img {
  max-height: 118%;
  max-width: 64%;
  filter: drop-shadow(0 8px 10px rgba(31, 94, 140, 0.22));
}

/* ---------- Flip star-burst ---------- */
.burst {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  overflow: visible;
  pointer-events: none;
  z-index: 6;
}

.burst__star {
  fill: #f4b731;
  font-size: 15px;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  animation: burstStar 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.5) forwards;
}

@keyframes burstStar {
  0% { opacity: 0; transform: scale(0) rotate(0deg); }
  45% { opacity: 1; transform: scale(1.3) rotate(35deg); }
  100% { opacity: 0; transform: scale(0.95) rotate(65deg); }
}

.prize__label {
  font-weight: 700;
  font-size: clamp(0.62rem, 2.6vw, 0.82rem);
  line-height: 1.12;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--ink);
  padding: 0 4px;
}

/* Locked (unflipped after game ends) */
.card.locked {
  cursor: default;
  opacity: 0.45;
  filter: grayscale(0.9);
  transform: scale(0.97);
}

/* ---------- CTA ---------- */
.cta-wrap {
  width: 100%;
  margin-top: 26px;
  animation: rise 0.5s ease both;
}

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

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 17px 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--cta), var(--cta-dark));
  color: #fff;
  font-size: 1.12rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(31, 151, 214, 0.36);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(31, 151, 214, 0.44);
}

.cta:active { transform: translateY(0); }

.cta__gift { font-size: 1.25rem; }

.cta__arrow {
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.cta:hover .cta__arrow { transform: translateX(4px); }

/* ---------- Counter + disclaimer ---------- */
.counter {
  margin: 22px 0 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.counter b { color: var(--ink); font-weight: 800; }

.disclaimer {
  margin-top: 34px;
  max-width: 440px;
  font-size: 0.68rem;
  line-height: 1.5;
  color: #9aa4ad;
  font-weight: 400;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .game { padding: 22px 16px 40px; }
  .board { gap: 10px; }
  .brand { height: 26px; margin-bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .card__inner,
  .card,
  .cta,
  .cta__arrow { transition-duration: 0.001ms; }
  .cta-wrap { animation: none; }
}
