/* ---------- palette + tokens ---------- */
:root {
  --night-1: #1a1240;
  --night-2: #2a1f5c;
  --night-3: #3b2876;
  --cream: #fff6e8;
  --cream-deep: #ffe9c2;
  --gold: #f1c34a;
  --gold-deep: #d4a23e;
  --gold-shadow: #8b6320;
  --rose: #ff7aa2;
  --rose-deep: #c9325e;
  --plum: #3b2552;
  --plum-deep: #2a1538;
  --mint: #8de0b6;
  --sky: #8ec8ff;

  --card-radius: 0;
  --shadow-hard: 6px 6px 0 0 var(--gold-shadow);
  --shadow-soft: 4px 4px 0 0 rgba(0, 0, 0, 0.35);

  --font-pixel: "Press Start 2P", "VT323", monospace;
  --font-body: "VT323", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--night-1);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 22px;
  line-height: 1.35;
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
  font-smooth: never;
  min-height: 100vh;
  overflow-x: hidden;
}

img,
svg {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

/* ---------- background ---------- */
body {
  background:
    radial-gradient(ellipse at 20% 10%, var(--night-3) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, var(--plum-deep) 0%, transparent 60%),
    linear-gradient(180deg, var(--night-2) 0%, var(--night-1) 100%);
  background-attachment: fixed;
}

.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(2px 2px at 10% 20%, var(--cream) 50%, transparent 51%),
    radial-gradient(2px 2px at 30% 70%, var(--cream-deep) 50%, transparent 51%),
    radial-gradient(2px 2px at 55% 30%, var(--cream) 50%, transparent 51%),
    radial-gradient(2px 2px at 70% 80%, var(--gold) 50%, transparent 51%),
    radial-gradient(2px 2px at 85% 15%, var(--cream) 50%, transparent 51%),
    radial-gradient(2px 2px at 92% 60%, var(--gold) 50%, transparent 51%),
    radial-gradient(2px 2px at 15% 90%, var(--cream-deep) 50%, transparent 51%),
    radial-gradient(2px 2px at 45% 50%, var(--cream) 50%, transparent 51%),
    radial-gradient(2px 2px at 25% 45%, var(--gold) 50%, transparent 51%),
    radial-gradient(2px 2px at 65% 10%, var(--cream-deep) 50%, transparent 51%);
  opacity: 0.7;
  animation: twinkle 4s steps(2, end) infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.4; }
}

/* ---------- page layout ---------- */
.page {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

/* ---------- header ---------- */
.header {
  text-align: center;
  margin-bottom: 40px;
}

.scene-wrap {
  position: relative;
  width: 100%;
  max-width: 800px;
  aspect-ratio: 96 / 56;
  margin: 0 auto 32px;
  background-image: url("./scene.svg");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 4px solid var(--gold);
  outline: 4px solid var(--gold-shadow);
  box-shadow: 0 8px 0 0 rgba(0, 0, 0, 0.4);
}

.scene-actors {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6%;
}
.scene-actors .sprite {
  width: 30%;
  height: auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.scene-actors .sprite img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.scene-actors .heart-float {
  position: absolute;
  left: 50%;
  top: 25%;
  transform: translateX(-50%);
  margin: 0;
  z-index: 2;
  width: 12%;
  height: auto;
}
.scene-actors .heart-float svg {
  width: 100%;
  height: 100%;
}

.heart-float {
  align-self: center;
  animation: heartbeat 1.6s steps(2, end) infinite;
  filter: drop-shadow(0 0 8px rgba(255, 122, 162, 0.6));
}
@keyframes heartbeat {
  0%, 100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-4px) scale(1.15); }
  60% { transform: translateY(0) scale(0.95); }
}

.title {
  font-family: var(--font-pixel);
  font-size: 56px;
  margin: 0 0 18px;
  color: var(--gold);
  text-shadow:
    4px 4px 0 var(--rose-deep),
    8px 8px 0 var(--plum-deep);
  letter-spacing: 3px;
  line-height: 1.1;
}

.subtitle {
  font-family: var(--font-body);
  font-size: 32px;
  margin: 0;
  color: var(--cream-deep);
  letter-spacing: 1px;
}

/* ---------- sprite frame ---------- */
.sprite {
  width: 192px;
  height: 288px;
  position: relative;
  animation: bob 2.4s steps(2, end) infinite;
}
.sprite::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translateX(-50%);
  width: 60%;
  height: 6px;
  background: var(--plum-deep);
  border-radius: 50%;
  opacity: 0.55;
  filter: blur(2px);
  animation: shadow-pulse 2.4s steps(2, end) infinite;
}
.sprite-alysha::after { animation-delay: 0.6s; }
@keyframes shadow-pulse {
  0%, 100% { width: 60%; opacity: 0.55; }
  50% { width: 50%; opacity: 0.4; }
}
.sprite img {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}
.sprite-alysha {
  animation-delay: 0.6s;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ---------- coupon frame ---------- */
.coupon-frame {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 246, 232, 0.04) 0%, rgba(255, 246, 232, 0.08) 100%);
  border: 4px solid var(--gold);
  outline: 4px solid var(--gold-shadow);
  outline-offset: 0;
  padding: 36px 28px;
}

.frame-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  background:
    linear-gradient(45deg, var(--rose) 25%, transparent 25%, transparent 75%, var(--rose) 75%) 0 0 / 10px 10px,
    var(--gold);
}
.frame-corner.tl { top: -12px; left: -12px; }
.frame-corner.tr { top: -12px; right: -12px; }
.frame-corner.bl { bottom: -12px; left: -12px; }
.frame-corner.br { bottom: -12px; right: -12px; }

/* ---------- coupon grid ---------- */
.coupon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

@media (max-width: 900px) {
  .coupon-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .title { font-size: 40px; }
  .sprite { width: 144px; height: 216px; }
  .header-sprites { min-height: 240px; }
}
@media (max-width: 600px) {
  .coupon-grid { grid-template-columns: 1fr; }
  .title {
    font-size: 18px;
    letter-spacing: 1px;
    text-shadow:
      2px 2px 0 var(--rose-deep),
      4px 4px 0 var(--plum-deep);
  }
  .subtitle { font-size: 18px; }
  .page { padding: 20px 12px 48px; }
  .coupon-frame { padding: 24px 16px; }
  .coupon-title { font-size: 11px; }
  .coupon-desc { font-size: 18px; }
  .coupon--unlimited .coupon-title { font-size: 13px; }
}

/* ---------- coupon card ---------- */
.coupon {
  position: relative;
  background: var(--cream);
  color: var(--plum);
  border: 3px solid var(--plum);
  box-shadow: var(--shadow-hard);
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 240px;
  transition: transform 0.12s steps(2, end), box-shadow 0.12s steps(2, end);
}
.coupon:hover:not(.is-redeemed) {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 0 var(--gold-shadow);
}

.coupon-ribbon {
  position: absolute;
  top: -10px;
  left: -10px;
  background: var(--rose-deep);
  color: var(--cream);
  font-family: var(--font-pixel);
  font-size: 10px;
  padding: 6px 8px;
  letter-spacing: 1px;
  box-shadow: 3px 3px 0 0 var(--plum-deep);
}

.coupon-icon {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 32 / 24;
  margin: 0 auto;
  border: 2px solid var(--plum-deep);
  background: var(--night-2);
  image-rendering: pixelated;
}
.coupon-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.coupon-title {
  font-family: var(--font-pixel);
  font-size: 12px;
  line-height: 1.5;
  margin: 4px 0 2px;
  color: var(--plum-deep);
  text-align: center;
  letter-spacing: 0.5px;
  text-wrap: balance;
  min-height: 38px;
}

.coupon-desc {
  font-family: var(--font-body);
  font-size: 20px;
  text-align: center;
  margin: 0;
  color: var(--plum);
  flex: 1;
}

.coupon-redeem {
  align-self: center;
  margin-top: 6px;
  font-family: var(--font-pixel);
  font-size: 11px;
  background: var(--gold);
  color: var(--plum-deep);
  border: 3px solid var(--plum-deep);
  padding: 10px 16px;
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow: 3px 3px 0 0 var(--plum-deep);
  transition: transform 0.08s steps(2, end), box-shadow 0.08s steps(2, end);
}
.coupon-redeem:hover {
  background: var(--rose);
  color: var(--cream);
}
.coupon-redeem:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 0 var(--plum-deep);
}
.coupon-redeem:focus-visible {
  outline: 3px solid var(--rose);
  outline-offset: 3px;
}
.coupon:focus-within {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 0 var(--gold-shadow);
}
.coupon-redeem.is-armed {
  background: var(--rose-deep);
  color: var(--cream);
  animation: armed-pulse 0.4s steps(2, end) infinite;
}
@keyframes armed-pulse {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-1px, -1px); }
}

/* hearts confetti on redeem */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}
.confetti-heart {
  position: absolute;
  color: var(--rose-deep);
  text-shadow: 1px 1px 0 var(--cream);
  font-family: var(--font-pixel);
  animation: confetti-burst 1.4s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 6px rgba(255, 122, 162, 0.7));
}
@keyframes confetti-burst {
  0% {
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(20deg);
    opacity: 0;
  }
}

.coupon-infinity {
  align-self: center;
  margin-top: 6px;
  font-family: var(--font-pixel);
  font-size: 13px;
  color: var(--rose-deep);
  letter-spacing: 2px;
}

/* Unlimited coupon (kisses) spans full row as a feature card */
.coupon--unlimited {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 100%);
  border-color: var(--rose-deep);
  box-shadow: 6px 6px 0 0 var(--rose-deep);
}
.coupon--unlimited:hover {
  box-shadow: 8px 8px 0 0 var(--rose-deep);
}
.coupon--unlimited .coupon-ribbon {
  background: var(--gold-deep);
  color: var(--plum-deep);
}
.coupon--unlimited .coupon-title {
  font-size: 18px;
}
.coupon--unlimited .coupon-icon {
  max-width: 360px;
  aspect-ratio: 32 / 24;
}
.coupon--unlimited .coupon-desc {
  font-size: 24px;
}
.coupon--unlimited .coupon-infinity {
  font-size: 16px;
  color: var(--rose-deep);
  margin-top: 12px;
}
@media (max-width: 600px) {
  .coupon--unlimited .coupon-title { font-size: 14px; }
  .coupon--unlimited .coupon-desc { font-size: 20px; }
}

/* ---------- redeemed state ---------- */
.coupon.is-redeemed {
  background: var(--cream-deep);
  filter: saturate(0.6);
  opacity: 0.85;
  cursor: default;
}
.coupon.is-redeemed .coupon-redeem {
  display: none;
}
.coupon.is-redeemed .coupon-title,
.coupon.is-redeemed .coupon-desc {
  color: var(--gold-shadow);
}

.coupon-stamp {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: rotate(-12deg) scale(1.2);
}
.coupon.is-redeemed .coupon-stamp {
  opacity: 1;
  animation: stamp 0.5s steps(4, end) 1;
}
.coupon-stamp span {
  font-family: var(--font-pixel);
  font-size: 22px;
  color: var(--rose-deep);
  border: 4px solid var(--rose-deep);
  padding: 10px 14px;
  letter-spacing: 3px;
  background: rgba(255, 246, 232, 0.6);
  text-shadow: 2px 2px 0 rgba(255, 246, 232, 0.8);
}
@keyframes stamp {
  0% { transform: rotate(-12deg) scale(2.5); opacity: 0; }
  60% { transform: rotate(-12deg) scale(0.85); opacity: 1; }
  100% { transform: rotate(-12deg) scale(1); opacity: 1; }
}

.coupon-tear {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    -28deg,
    transparent 0,
    transparent 12px,
    rgba(201, 50, 94, 0.0) 12px,
    rgba(201, 50, 94, 0.0) 14px
  );
  opacity: 0;
}
.coupon.is-redeemed .coupon-tear {
  opacity: 1;
  background: repeating-linear-gradient(
    -28deg,
    transparent 0,
    transparent 12px,
    rgba(201, 50, 94, 0.12) 12px,
    rgba(201, 50, 94, 0.12) 14px
  );
}

/* ---------- footer ---------- */
.footer {
  text-align: center;
  margin-top: 48px;
  color: var(--cream-deep);
  font-size: 20px;
  letter-spacing: 1px;
  opacity: 0.85;
}
