:root {
  --ink: #51415e;
  --soft-ink: #74657d;
  --paper: #fffdf9;
  --pink: #ff7eb3;
  --pink-deep: #f55f9f;
  --yellow: #ffd166;
  --blue: #6ed7f4;
  --mint: #81e6c7;
  --lavender: #b8a1ff;
  --shadow: 0 14px 35px rgba(94, 66, 114, 0.17);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #fff8ef;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Mali", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 209, 102, .35), transparent 22%),
    radial-gradient(circle at 90% 12%, rgba(110, 215, 244, .30), transparent 23%),
    radial-gradient(circle at 12% 90%, rgba(129, 230, 199, .28), transparent 24%),
    radial-gradient(circle at 90% 88%, rgba(184, 161, 255, .28), transparent 24%),
    linear-gradient(135deg, #fff9ef, #fff4fa 55%, #f3fbff);
  overflow-x: hidden;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.hero {
  position: relative;
  text-align: center;
  background: rgba(255, 255, 255, .78);
  border: 3px solid rgba(255, 255, 255, .95);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 22px 20px 20px;
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .18;
}

.hero::before {
  background: var(--pink);
  left: -34px;
  top: -38px;
}

.hero::after {
  background: var(--blue);
  right: -36px;
  bottom: -48px;
}

.hero__sparkles {
  letter-spacing: 10px;
  font-size: clamp(18px, 3vw, 28px);
  animation: floaty 2.4s ease-in-out infinite;
}

.hero h1 {
  margin: 4px 0 6px;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1.12;
  color: #f45a9c;
  text-shadow: 0 3px 0 #fff;
}

.hero p {
  margin: 0;
  font-size: clamp(16px, 2vw, 23px);
  font-weight: 600;
  color: var(--soft-ink);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 14px;
  padding: 9px 18px;
  border-radius: 999px;
  background: #fff2b8;
  color: #7d5a00;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(255, 209, 102, .38);
}

.gift-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  padding: 30px 6px 24px;
}

.gift-card {
  --gift-main: #ff8fbe;
  --gift-deep: #f45f9f;
  --ribbon: #fff3a8;
  position: relative;
  border: 0;
  border-radius: 26px;
  background: rgba(255, 255, 255, .76);
  padding: 18px 10px 20px;
  min-height: 190px;
  cursor: pointer;
  box-shadow: 0 11px 25px rgba(91, 61, 106, .13);
  transition: box-shadow .2s ease, background .2s ease;
  isolation: isolate;
}

.gift-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 2px dashed rgba(255, 255, 255, .9);
  border-radius: 20px;
  pointer-events: none;
}

.gift-card:hover,
.gift-card:focus-visible {
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 15px 34px rgba(91, 61, 106, .22);
  outline: none;
}

.gift-card:focus-visible {
  box-shadow: 0 0 0 5px rgba(110, 215, 244, .45), 0 15px 34px rgba(91, 61, 106, .22);
}

.gift-card[disabled] {
  cursor: default;
}

.gift-card__number {
  position: absolute;
  top: 11px;
  left: 12px;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 50%;
  background: white;
  color: var(--gift-deep);
  border: 3px solid var(--gift-main);
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 5px 12px rgba(60, 42, 74, .14);
}

.gift {
  position: relative;
  width: 120px;
  height: 130px;
  margin: 23px auto 0;
  transform-origin: 50% 95%;
  animation: wiggle 1.35s ease-in-out infinite;
}

.gift-card:nth-child(3n + 1) .gift { animation-delay: -.2s; }
.gift-card:nth-child(3n + 2) .gift { animation-delay: -.55s; }
.gift-card:nth-child(3n) .gift { animation-delay: -.85s; }

.gift__box {
  position: absolute;
  bottom: 0;
  left: 10px;
  width: 100px;
  height: 84px;
  background: linear-gradient(135deg, var(--gift-main), var(--gift-deep));
  border-radius: 10px 10px 17px 17px;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .05), 0 9px 0 rgba(81, 65, 94, .08);
}

.gift__lid {
  position: absolute;
  left: 4px;
  top: 35px;
  width: 112px;
  height: 29px;
  border-radius: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--gift-main) 84%, white), var(--gift-main));
  box-shadow: 0 5px 0 rgba(0, 0, 0, .06);
  z-index: 3;
}

.gift__ribbon-v {
  position: absolute;
  z-index: 4;
  left: 50px;
  top: 35px;
  width: 20px;
  height: 95px;
  background: linear-gradient(90deg, #fff7c8, var(--ribbon), #ffe478);
}

.gift__ribbon-h {
  position: absolute;
  z-index: 4;
  left: 4px;
  top: 45px;
  width: 112px;
  height: 15px;
  background: linear-gradient(#fff7c8, var(--ribbon));
}

.gift__bow-left,
.gift__bow-right {
  position: absolute;
  z-index: 5;
  top: 10px;
  width: 48px;
  height: 34px;
  background: var(--ribbon);
  border: 5px solid #ffe77f;
}

.gift__bow-left {
  left: 19px;
  border-radius: 70% 35% 60% 40%;
  transform: rotate(23deg);
}

.gift__bow-right {
  right: 19px;
  border-radius: 35% 70% 40% 60%;
  transform: rotate(-23deg);
}

.gift__knot {
  position: absolute;
  z-index: 6;
  top: 22px;
  left: 49px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffe77f;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .05);
}

.gift-card__hint {
  margin-top: 10px;
  font-weight: 700;
  font-size: 16px;
  color: #75657c;
}

.gift-card:hover .gift,
.gift-card:focus-visible .gift {
  animation: happyWiggle .55s ease-in-out infinite;
}

.gift-card.is-picked {
  background: #fff;
  box-shadow: 0 0 0 5px rgba(255, 209, 102, .6), 0 18px 38px rgba(91, 61, 106, .24);
}

.gift-card.is-picked .gift {
  animation: popGift .55s cubic-bezier(.2, .9, .25, 1.3) both;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 13px 24px;
  min-height: 52px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(81, 65, 94, .13), 0 12px 20px rgba(81, 65, 94, .12);
  transition: transform .15s ease, box-shadow .15s ease;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(4px); box-shadow: 0 3px 0 rgba(81, 65, 94, .13); }

.btn-reset {
  background: linear-gradient(135deg, #ff8eba, #ff6aa7);
  color: white;
}

.btn-fullscreen {
  background: linear-gradient(135deg, #6fdcf5, #79c5ff);
  color: #164865;
}

.btn-close {
  background: linear-gradient(135deg, #ffd166, #ffbd4a);
  color: #714c00;
  margin-top: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 22px;
}

.modal.is-open {
  display: grid;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(56, 39, 67, .52);
  backdrop-filter: blur(7px);
}

.modal__card {
  position: relative;
  z-index: 2;
  width: min(640px, 94vw);
  border-radius: 34px;
  background: linear-gradient(180deg, #fff, #fff9ec);
  padding: 28px 28px 30px;
  text-align: center;
  border: 6px solid white;
  box-shadow: 0 28px 80px rgba(46, 27, 57, .34);
  animation: modalPop .42s cubic-bezier(.2, 1.2, .32, 1) both;
}

.modal__burst {
  font-size: 50px;
  animation: floaty 1.1s ease-in-out infinite;
}

.modal__eyebrow {
  display: inline-block;
  margin: 4px 0 3px;
  padding: 6px 15px;
  border-radius: 999px;
  background: #ffe6f2;
  color: #c4437c;
  font-weight: 700;
}

.modal h2 {
  margin: 8px 0 4px;
  font-size: clamp(34px, 7vw, 58px);
  color: #f0579b;
}

.reward-icon {
  font-size: clamp(58px, 10vw, 90px);
  filter: drop-shadow(0 8px 8px rgba(75, 54, 82, .12));
}

.reward-text {
  margin: 8px auto 16px;
  max-width: 560px;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.35;
  font-weight: 700;
  color: #5c4965;
}

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

.confetti {
  position: absolute;
  top: -30px;
  width: 14px;
  height: 22px;
  border-radius: 4px;
  animation: confettiFall var(--fall-time) linear forwards;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-2.5deg) translateY(0); }
  50% { transform: rotate(2.5deg) translateY(-4px); }
}

@keyframes happyWiggle {
  0%, 100% { transform: rotate(-5deg) translateY(-2px) scale(1.02); }
  50% { transform: rotate(5deg) translateY(-7px) scale(1.05); }
}

@keyframes popGift {
  0% { transform: scale(1) rotate(0); }
  45% { transform: scale(1.18) rotate(-7deg); }
  75% { transform: scale(.96) rotate(5deg); }
  100% { transform: scale(1.04) rotate(0); }
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes modalPop {
  from { transform: scale(.72) translateY(26px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes confettiFall {
  0% { transform: translate3d(0, -5vh, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--drift), 108vh, 0) rotate(900deg); opacity: .95; }
}

@media (max-width: 820px) {
  .gift-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
  }

  .gift-card {
    min-height: 175px;
    padding-inline: 4px;
  }

  .gift {
    transform: scale(.9);
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 10px;
  }

  .hero {
    padding: 16px 12px 14px;
    border-radius: 22px;
  }

  .hero__sparkles { letter-spacing: 3px; }

  .gift-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding-top: 18px;
  }

  .gift-card {
    min-height: 164px;
    border-radius: 21px;
  }

  .gift {
    margin-top: 18px;
    transform: scale(.82);
  }

  .gift-card__hint {
    font-size: 14px;
    margin-top: 1px;
  }

  .btn {
    font-size: 16px;
    min-height: 48px;
    padding: 11px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
