:root {
  --bg: #140d1f;
  --panel: #20162e;
  --panel-2: #2a1e3a;
  --line: rgba(196, 170, 255, 0.14);
  --text: #f7f2ff;
  --muted: rgba(247, 242, 255, 0.62);
  --white: #ffffff;
  --black: #140d1f;
  --maxw: 430px;

  --purple-1: #1a1127;
  --purple-2: #241735;
  --purple-3: #312048;
  --purple-4: #6f50b5;
  --purple-5: #b99cff;
  --purple-6: #eadfff;
  --gold-soft: #f0dfb3;
  --pink-soft: #f0d8ea;
  --shadow-soft: rgba(26, 12, 46, 0.32);
  --shadow-strong: rgba(10, 4, 20, 0.42);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, sans-serif;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 10%, rgba(132, 95, 220, 0.20), transparent 34%),
    radial-gradient(circle at 82% 88%, rgba(240, 223, 179, 0.10), transparent 28%),
    linear-gradient(180deg, #1a1127 0%, #140d1f 100%);
}

button,
input {
  font: inherit;
}

button {
  appearance: none;
}

img {
  max-width: 100%;
  display: block;
}

[hidden] {
  display: none !important;
}

.app {
  width: 100%;
  max-width: var(--maxw);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(142, 110, 228, 0.14), transparent 24%),
    linear-gradient(180deg, #1c1329 0%, #140d1f 100%);
  position: relative;
  overflow: hidden;
}

.screen {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 8px;
  padding:
    max(10px, env(safe-area-inset-top))
    clamp(10px, 3vw, 14px)
    max(12px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.hero {
  display: grid;
  gap: 4px;
  align-content: start;
  margin-bottom: 0;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.logo-box {
  width: clamp(64px, 15vw, 88px);
  height: clamp(64px, 15vw, 88px);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.02) 100%),
    linear-gradient(180deg, #342250 0%, #1c1328 100%);
  border: 1px solid rgba(196, 170, 255, 0.12);
  display: grid;
  place-items: center;
  margin-bottom: clamp(6px, 1vh, 10px);
  box-shadow:
    0 16px 32px rgba(0,0,0,0.26),
    0 0 0 1px rgba(255,255,255,0.03) inset;
  overflow: hidden;
  position: relative;
}

.logo-box::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.18) 0%,
    rgba(255,255,255,0.04) 36%,
    rgba(255,255,255,0) 66%
  );
  pointer-events: none;
}

.logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,.18));
}

.title {
  margin: 0;
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 800;
  line-height: 1.12;
  color: #f8f4ff;
}

.subtitle {
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(10px, 2.8vw, 13px);
  line-height: 1.35;
  text-align: center;
  max-width: 310px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gift-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.1vw, 12px);
  overflow: hidden;
  margin-top: 0;
}

.gift-card {
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.02) 100%),
    linear-gradient(180deg, #2a1d3c 0%, #1a1228 100%);
  border: 1px solid rgba(196, 170, 255, 0.14);
  border-radius: clamp(14px, 3.2vw, 18px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 12px 24px rgba(0,0,0,0.22),
    0 1px 0 rgba(255,255,255,0.03) inset;
  position: relative;
}

.gift-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    145deg,
    rgba(255,255,255,.10) 0%,
    rgba(255,255,255,0) 34%
  );
  pointer-events: none;
}

.gift-card.is-empty {
  opacity: 0.75;
}

.gift-image {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: clamp(8px, 1.5vw, 12px);
  background:
    radial-gradient(circle at 50% 18%, rgba(185, 156, 255, 0.12), transparent 48%),
    linear-gradient(180deg, #302046 0%, #211730 100%);
  overflow: hidden;
}

.gift-image img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  filter:
    drop-shadow(0 10px 18px rgba(0, 0, 0, 0.22))
    drop-shadow(0 0 10px rgba(185, 156, 255, 0.08));
}

.gift-emoji {
  font-size: clamp(26px, 6vw, 38px);
}

.gift-name {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 8px 8px 10px;
  font-size: clamp(9px, 2.35vw, 11px);
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #f2eaff;
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.00) 100%);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-shadow: 0 0 10px rgba(140, 98, 231, 0.18);
}

.bottom-stack {
  display: grid;
  gap: clamp(8px, 1vh, 10px);
  align-content: end;
}

.token-box {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%),
    linear-gradient(180deg, #251936 0%, #1a1228 100%);
  border: 1px solid rgba(196, 170, 255, 0.12);
  border-radius: clamp(14px, 3vw, 18px);
  padding: clamp(9px, 1.7vh, 12px);
  box-shadow:
    0 10px 24px rgba(0,0,0,0.16),
    0 1px 0 rgba(255,255,255,0.03) inset;
}

.token-label {
  display: block;
  font-size: clamp(10px, 2.7vw, 12px);
  color: rgba(247, 242, 255, 0.76);
  margin-bottom: 6px;
  font-weight: 700;
  text-align: center;
}

.token-input {
  width: 100%;
  height: clamp(40px, 5.7vh, 44px);
  border-radius: 12px;
  border: 1px solid rgba(196, 170, 255, 0.14);
  background: linear-gradient(180deg, #191124 0%, #241734 100%);
  color: #f7f2ff;
  padding: 0 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: center;
  font-size: clamp(11px, 2.9vw, 13px);
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
  transition: border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.token-input:focus {
  border-color: rgba(185, 156, 255, 0.30);
  box-shadow:
    0 0 0 3px rgba(185, 156, 255, 0.10),
    inset 0 0 0 1px rgba(255,255,255,0.03);
}

.token-input:disabled {
  opacity: 0.72;
}

.token-msg {
  margin-top: 6px;
  min-height: 16px;
  text-align: center;
  font-size: clamp(10px, 2.7vw, 12px);
  line-height: 1.25;
  color: rgba(247, 242, 255, 0.62);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.shake-btn {
  width: 100%;
  height: clamp(42px, 6vh, 48px);
  border: 0;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #8a68f0 0%, #6e4fc2 100%);
  color: #ffffff;
  font-size: clamp(12px, 3vw, 15px);
  font-weight: 800;
  cursor: pointer;
  box-shadow:
    0 12px 24px rgba(88, 57, 150, 0.28),
    inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .18s ease, opacity .2s ease, filter .2s ease;
}

.shake-btn:active {
  transform: translateY(1px) scale(0.995);
}

.shake-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(185, 156, 255, 0.18) 0%, rgba(185, 156, 255, 0.06) 26%, transparent 42%),
    linear-gradient(180deg, #261936 0%, #1a1228 52%, #140d1f 100%);
  z-index: 50;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
}

.overlay-topbar {
  flex: 0 0 auto;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(8px, env(safe-area-inset-top)) 10px 0;
  position: relative;
  z-index: 10;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #e9deff;
  font-size: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  border-radius: 999px;
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.overlay-title {
  font-size: 16px;
  font-weight: 800;
  color: #f6f2ff;
}

.shake-scene {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.center-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-50%);
  background: linear-gradient(
    180deg,
    rgba(196, 170, 255, .03) 0%,
    rgba(196, 170, 255, .10) 20%,
    rgba(196, 170, 255, .14) 50%,
    rgba(196, 170, 255, .08) 80%,
    rgba(196, 170, 255, .03) 100%
  );
  z-index: 1;
  pointer-events: none;
}

.curtain-split {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.curtain-half {
  position: absolute;
  left: 0;
  width: 100%;
  height: 57%;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%),
    linear-gradient(180deg, #301f46 0%, #1d142b 100%);
  transition: transform 1.35s cubic-bezier(.16,1,.3,1);
  will-change: transform, filter;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.curtain-top {
  top: 0;
  border-bottom: 1px solid rgba(196, 170, 255, .06);
  box-shadow: 0 14px 28px rgba(10, 4, 20, 0.22);
}

.curtain-bottom {
  bottom: 0;
  border-top: 1px solid rgba(196, 170, 255, .06);
  box-shadow: 0 -14px 28px rgba(10, 4, 20, 0.22);
}

.overlay.reveal-start .curtain-top {
  transform: translateY(-105%);
  animation: curtainTopGreget 1.35s cubic-bezier(.16,1,.3,1) forwards;
}

.overlay.reveal-start .curtain-bottom {
  transform: translateY(105%);
  animation: curtainBottomGreget 1.35s cubic-bezier(.16,1,.3,1) forwards;
}

.flash-burst {
  position: absolute;
  inset: 0;
  z-index: 4;
  background:
    radial-gradient(circle at center, rgba(255,255,255,1) 0%, rgba(234,223,255,.92) 18%, rgba(185,156,255,.28) 40%, rgba(255,255,255,0) 70%);
  opacity: 0;
  transform: scale(.45);
  pointer-events: none;
}

.overlay.flash-on .flash-burst {
  animation: flashBurst .7s ease forwards;
}

@keyframes flashBurst {
  0% { opacity: 0; transform: scale(.35); }
  20% { opacity: 1; transform: scale(.75); }
  55% { opacity: .8; transform: scale(1.15); }
  100% { opacity: 0; transform: scale(1.72); }
}

@keyframes curtainTopGreget {
  0% {
    transform: translateY(0);
    filter: brightness(1);
  }
  10% {
    transform: translateY(5px) scaleY(1.015);
    filter: brightness(1.02);
  }
  18% {
    transform: translateY(-3px) scaleY(.995);
  }
  28% {
    transform: translateY(8px) scaleY(1.012);
  }
  44% {
    transform: translateY(-24%);
  }
  62% {
    transform: translateY(-60%);
  }
  80% {
    transform: translateY(-92%);
  }
  90% {
    transform: translateY(-100.5%);
  }
  96% {
    transform: translateY(-98.8%);
  }
  100% {
    transform: translateY(-105%);
    filter: brightness(1);
  }
}

@keyframes curtainBottomGreget {
  0% {
    transform: translateY(0);
    filter: brightness(1);
  }
  10% {
    transform: translateY(-5px) scaleY(1.015);
    filter: brightness(1.02);
  }
  18% {
    transform: translateY(3px) scaleY(.995);
  }
  28% {
    transform: translateY(-8px) scaleY(1.012);
  }
  44% {
    transform: translateY(24%);
  }
  62% {
    transform: translateY(60%);
  }
  80% {
    transform: translateY(92%);
  }
  90% {
    transform: translateY(100.5%);
  }
  96% {
    transform: translateY(98.8%);
  }
  100% {
    transform: translateY(105%);
    filter: brightness(1);
  }
}

.confetti-layer {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -12%;
  border-radius: 2px;
  opacity: 0;
  animation: confettiFall linear forwards;
  box-shadow: 0 0 8px rgba(255,255,255,.25);
}

.confetti.c1 { background: #d2c0ff; }
.confetti.c2 { background: #f0dfb3; }
.confetti.c3 { background: #ffffff; border-radius: 50%; }
.confetti.c4 { background: #9b7dff; }
.confetti.c5 { background: #f0d8ea; border-radius: 50%; }
.confetti.c6 { background: #eadfff; }

@keyframes confettiFall {
  0% {
    transform: translate3d(0, -12vh, 0) rotate(0deg) scale(.85);
    opacity: 0;
  }
  10% { opacity: 1; }
  100% {
    transform: translate3d(var(--x-shift), 115vh, 0) rotate(var(--rot)) scale(1.04);
    opacity: 1;
  }
}

.shake-device-wrap {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.shake-device {
  width: clamp(132px, 36vw, 190px);
  aspect-ratio: 1 / 1;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  top: -60px;
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: center center;
  transition:
    transform .45s ease,
    opacity .45s ease,
    filter .45s ease;
}

.shake-device::before {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(185,156,255,.22) 0%, rgba(185,156,255,.08) 42%, rgba(255,255,255,0) 76%);
  opacity: .95;
  transform: scale(.92);
  box-shadow:
    0 0 20px rgba(138, 104, 240, 0.16),
    0 0 44px rgba(138, 104, 240, 0.10);
  pointer-events: none;
}

.shake-device-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  filter:
    drop-shadow(0 14px 24px rgba(0, 0, 0, 0.22))
    drop-shadow(0 0 16px rgba(185, 156, 255, 0.12));
}

.shake-scene.ready .shake-device {
  animation: idleFloat 1.8s ease-in-out infinite;
}

.shake-scene.listening .shake-device {
  animation: deviceListening 1s ease-in-out infinite;
}

.shake-scene.impact .shake-device {
  animation: deviceImpact .36s ease-in-out 2;
}

@keyframes idleFloat {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(0, -5px, 0) scale(1.02); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes deviceListening {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  20% { transform: translate3d(0, 0, 0) rotate(-8deg) scale(1.03); }
  40% { transform: translate3d(0, 0, 0) rotate(8deg) scale(1.03); }
  60% { transform: translate3d(0, 0, 0) rotate(-6deg) scale(1.02); }
  80% { transform: translate3d(0, 0, 0) rotate(6deg) scale(1.02); }
  100% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
}

@keyframes deviceImpact {
  0% { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
  25% { transform: translate3d(0, 0, 0) scale(.92) rotate(-12deg); }
  50% { transform: translate3d(0, 0, 0) scale(1.08) rotate(12deg); }
  75% { transform: translate3d(0, 0, 0) scale(.98) rotate(-6deg); }
  100% { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
}

.overlay.reveal-start .shake-device {
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(.7);
  filter: blur(6px);
}

.reward-stage {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.reward-ray {
  position: absolute;
  width: clamp(220px, 58vw, 360px);
  height: clamp(220px, 58vw, 360px);
  border-radius: 50%;
  background:
    conic-gradient(
      from 0deg,
      rgba(240,223,179,0) 0deg,
      rgba(240,223,179,.48) 18deg,
      rgba(240,223,179,0) 36deg,
      rgba(240,223,179,0) 54deg,
      rgba(234,223,255,.24) 72deg,
      rgba(240,223,179,0) 90deg,
      rgba(240,223,179,0) 108deg,
      rgba(185,156,255,.30) 126deg,
      rgba(240,223,179,0) 144deg,
      rgba(240,223,179,0) 162deg,
      rgba(240,223,179,.28) 180deg,
      rgba(240,223,179,0) 198deg,
      rgba(240,223,179,0) 216deg,
      rgba(234,223,255,.30) 234deg,
      rgba(240,223,179,0) 252deg,
      rgba(240,223,179,0) 270deg,
      rgba(240,223,179,.28) 288deg,
      rgba(240,223,179,0) 306deg,
      rgba(240,223,179,0) 324deg,
      rgba(240,223,179,.46) 342deg,
      rgba(240,223,179,0) 360deg
    );
  opacity: 0;
  transform: scale(.45) rotate(0deg);
}

.reward-glow {
  position: absolute;
  width: clamp(180px, 50vw, 300px);
  height: clamp(180px, 50vw, 300px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,248,227,.72) 0%, rgba(185,156,255,.20) 38%, rgba(255,255,255,0) 72%);
  filter: blur(12px);
  opacity: 0;
  transform: scale(.55);
}

.reward-orbit {
  position: absolute;
  border-radius: 999px;
  border: 2px solid rgba(196, 170, 255, .12);
  opacity: 0;
}

.orbit-1 {
  width: clamp(170px, 44vw, 240px);
  height: clamp(170px, 44vw, 240px);
}

.orbit-2 {
  width: clamp(210px, 54vw, 300px);
  height: clamp(210px, 54vw, 300px);
}

.reward-shell {
  position: relative;
  z-index: 2;
  width: clamp(180px, 56vw, 290px);
  min-height: clamp(230px, 68vw, 380px);
  border-radius: 32px;
  background:
    linear-gradient(145deg, #fffdfa 0%, #f8f3ff 42%, #fffaf2 100%);
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.20),
    0 0 18px rgba(185, 156, 255, 0.16),
    0 0 0 1px rgba(255,255,255,.55) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 16px 18px;
  opacity: 0;
  transform: scale(.2) translateY(18px);
  transform-origin: center center;
  overflow: hidden;
}

.reward-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,.56) 0%,
    rgba(255,255,255,.10) 32%,
    rgba(255,255,255,0) 60%
  );
  pointer-events: none;
}

.reward-shell::after {
  content: "";
  position: absolute;
  inset: -10%;
  border-radius: inherit;
  background: linear-gradient(
    120deg,
    transparent 16%,
    rgba(255,255,255,.02) 28%,
    rgba(255,255,255,.72) 50%,
    rgba(255,255,255,.05) 66%,
    transparent 82%
  );
  opacity: 0;
  pointer-events: none;
}

.reward-media {
  width: clamp(132px, 38vw, 210px);
  height: clamp(132px, 38vw, 210px);
  border-radius: 28px;
  overflow: visible;
  display: grid;
  place-items: center;
  background: transparent;
  box-shadow: none;
  position: relative;
}

.reward-media::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(185,156,255,.14) 0%, rgba(185,156,255,.05) 42%, rgba(255,255,255,0) 74%);
  filter: blur(8px);
  z-index: 0;
}

.reward-media img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 16px 24px rgba(78, 58, 120, 0.14))
    drop-shadow(0 0 14px rgba(185, 156, 255, 0.12));
}

.reward-emoji {
  position: relative;
  z-index: 1;
  font-size: clamp(42px, 10vw, 70px);
  animation: rewardItemFloat 2.2s ease-in-out infinite;
}

.reward-name {
  font-size: clamp(17px, 4.4vw, 25px);
  line-height: 1.15;
  font-weight: 900;
  text-align: center;
  color: #33264a;
  margin-top: 2px;
  word-break: break-word;
}

.reward-code {
  font-size: clamp(10px, 2.8vw, 13px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: .14em;
  color: #7d679a;
  text-align: center;
  word-break: break-word;
}

.overlay.reward-shown .reward-ray {
  animation: rewardRayIn .95s ease forwards, spinRay 10s linear infinite .95s;
}

.overlay.reward-shown .reward-glow {
  animation: rewardGlowPulse 1.15s ease-in-out infinite alternate;
}

.overlay.reward-shown .orbit-1 {
  animation: orbitIn .6s ease forwards, orbitSpin 8s linear infinite .7s;
}

.overlay.reward-shown .orbit-2 {
  animation: orbitIn .7s ease forwards, orbitSpinReverse 11s linear infinite .8s;
}

.overlay.reward-shown .reward-shell {
  animation: rewardPopVertical .72s cubic-bezier(.2,.9,.2,1) forwards;
}

.overlay.reward-shown .reward-shell::after {
  animation: shineMove 1.15s ease .16s forwards;
}

.overlay.reward-shown .reward-media img {
  animation: rewardItemFloat 2.2s ease-in-out infinite, rewardItemTilt 3.4s ease-in-out infinite;
  transform-origin: center center;
}

@keyframes rewardRayIn {
  0% { opacity: 0; transform: scale(.35) rotate(0deg); }
  100% { opacity: .80; transform: scale(1) rotate(0deg); }
}

@keyframes spinRay {
  0% { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1) rotate(360deg); }
}

@keyframes rewardGlowPulse {
  0% {
    opacity: .56;
    transform: scale(.92);
  }
  100% {
    opacity: .90;
    transform: scale(1.14);
  }
}

@keyframes orbitIn {
  0% { opacity: 0; transform: scale(.55); }
  100% { opacity: .62; transform: scale(1); }
}

@keyframes orbitSpin {
  0% { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1) rotate(360deg); }
}

@keyframes orbitSpinReverse {
  0% { transform: scale(1) rotate(360deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes rewardPopVertical {
  0% {
    opacity: 0;
    transform: scale(.22) translateY(18px);
  }
  55% {
    opacity: 1;
    transform: scale(1.08) translateY(0);
  }
  75% {
    opacity: 1;
    transform: scale(.97) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes rewardItemFloat {
  0% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-4px) scale(1.015); }
  50% { transform: translateY(-8px) scale(1.03); }
  75% { transform: translateY(-4px) scale(1.015); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes rewardItemTilt {
  0% { rotate: 0deg; }
  25% { rotate: -2deg; }
  50% { rotate: 0deg; }
  75% { rotate: 2deg; }
  100% { rotate: 0deg; }
}

@keyframes shineMove {
  0% {
    transform: translateX(-120%) skewX(-14deg);
    opacity: 0;
  }
  30% {
    opacity: .9;
  }
  100% {
    transform: translateX(120%) skewX(-14deg);
    opacity: 0;
  }
}

.shake-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 96px;
  z-index: 8;
  padding: 0 16px;
  text-align: center;
  transition: all .35s ease;
}

.overlay.reveal-start .shake-copy {
  opacity: .12;
  transform: translateY(8px);
}

.shake-hint {
  font-size: 13px;
  line-height: 1.4;
  color: #f2eaff;
}

.shake-subhint {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(242, 234, 255, 0.62);
}

.result-actions {
  flex: 0 0 auto;
  padding: 10px 12px max(12px, env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: all .35s ease;
  position: relative;
  z-index: 12;
}

.result-actions.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.result-action,
.result-close {
  width: 100%;
  height: 44px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.result-action {
  border: 0;
  background:
    linear-gradient(180deg, #8a68f0 0%, #6e4fc2 100%);
  color: #ffffff;
  box-shadow:
    0 10px 22px rgba(88, 57, 150, 0.24),
    inset 0 1px 0 rgba(255,255,255,.18);
}

.result-close {
  border: 1px solid rgba(196, 170, 255, .12);
  background: rgba(255,255,255,.06);
  color: #f2eaff;
  backdrop-filter: blur(3px);
}

.result-action:active,
.result-close:active,
.icon-btn:active {
  transform: scale(0.99);
}

@media (max-height: 720px) {
  .shake-copy {
    bottom: 90px;
  }

  .reward-shell {
    width: 164px;
    min-height: 210px;
    border-radius: 26px;
    padding: 16px 14px 14px;
  }

  .reward-media {
    width: 112px;
    height: 112px;
  }

  .shake-device {
    width: clamp(112px, 30vw, 140px);
  }

  .gift-name {
    min-height: 42px;
    font-size: 9px;
    padding: 7px 6px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }

  .overlay,
  .result-actions,
  .shake-copy {
    transition: none !important;
  }

  .overlay.reveal-start .curtain-top,
  .overlay.reveal-start .curtain-bottom {
    animation: none !important;
  }

  .overlay.reveal-start .curtain-top {
    transform: translateY(-105%) !important;
  }

  .overlay.reveal-start .curtain-bottom {
    transform: translateY(105%) !important;
  }
}

/* =========================
   GIFT GRID ANIMATION UPGRADE
   ========================= */

.gift-card {
  isolation: isolate;
  transition:
    transform .28s ease,
    box-shadow .28s ease,
    border-color .28s ease;
}

.gift-card:hover {
  transform: translateY(-3px);
  border-color: rgba(196, 170, 255, 0.24);
  box-shadow:
    0 16px 30px rgba(0,0,0,0.28),
    0 0 0 1px rgba(255,255,255,0.03) inset,
    0 0 22px rgba(185, 156, 255, 0.10);
}

.gift-card::after {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 18%,
    rgba(255,255,255,0.00) 28%,
    rgba(255,255,255,0.12) 42%,
    rgba(255,255,255,0.30) 50%,
    rgba(255,255,255,0.10) 58%,
    rgba(255,255,255,0.00) 72%,
    transparent 84%
  );
  transform: translateX(-140%) skewX(-18deg);
  opacity: 0;
}

.gift-card:nth-child(1)::after {
  animation: cardShine 5.2s ease-in-out infinite;
  animation-delay: .2s;
}

.gift-card:nth-child(2)::after {
  animation: cardShine 5.4s ease-in-out infinite;
  animation-delay: 1s;
}

.gift-card:nth-child(3)::after {
  animation: cardShine 5.6s ease-in-out infinite;
  animation-delay: 1.8s;
}

.gift-card:nth-child(4)::after {
  animation: cardShine 5.1s ease-in-out infinite;
  animation-delay: 2.6s;
}

.gift-card:nth-child(5)::after {
  animation: cardShine 5.5s ease-in-out infinite;
  animation-delay: 3.4s;
}

.gift-card:nth-child(6)::after {
  animation: cardShine 5.3s ease-in-out infinite;
  animation-delay: 4.2s;
}

.gift-image {
  position: relative;
}

.gift-image::before {
  content: "";
  position: absolute;
  inset: 16% 18%;
  border-radius: 999px;
  background: radial-gradient(
    circle,
    rgba(185, 156, 255, 0.18) 0%,
    rgba(185, 156, 255, 0.08) 36%,
    rgba(255,255,255,0) 74%
  );
  filter: blur(8px);
  z-index: 0;
  animation: imageGlowPulse 3.2s ease-in-out infinite;
}

.gift-image img,
.gift-emoji {
  position: relative;
  z-index: 1;
}

.gift-image img {
  animation: giftFloat 3.2s ease-in-out infinite;
  transform-origin: center center;
  will-change: transform, filter;
}

.gift-card:nth-child(1) .gift-image img {
  animation-delay: 0s;
}

.gift-card:nth-child(2) .gift-image img {
  animation-delay: .35s;
}

.gift-card:nth-child(3) .gift-image img {
  animation-delay: .7s;
}

.gift-card:nth-child(4) .gift-image img {
  animation-delay: 1.05s;
}

.gift-card:nth-child(5) .gift-image img {
  animation-delay: 1.4s;
}

.gift-card:nth-child(6) .gift-image img {
  animation-delay: 1.75s;
}

.gift-card:nth-child(odd) .gift-image img {
  animation-name: giftFloatTiltA;
}

.gift-card:nth-child(even) .gift-image img {
  animation-name: giftFloatTiltB;
}

.gift-emoji {
  animation: giftEmojiFloat 2.8s ease-in-out infinite;
}

.gift-name {
  position: relative;
  z-index: 2;
}

@keyframes giftFloat {
  0% {
    transform: translateY(0) scale(1);
  }
  25% {
    transform: translateY(-3px) scale(1.015);
  }
  50% {
    transform: translateY(-7px) scale(1.03);
  }
  75% {
    transform: translateY(-3px) scale(1.015);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes giftFloatTiltA {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  25% {
    transform: translateY(-3px) rotate(-1.4deg) scale(1.015);
  }
  50% {
    transform: translateY(-7px) rotate(0deg) scale(1.03);
  }
  75% {
    transform: translateY(-3px) rotate(1.4deg) scale(1.015);
  }
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

@keyframes giftFloatTiltB {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  25% {
    transform: translateY(-3px) rotate(1.2deg) scale(1.015);
  }
  50% {
    transform: translateY(-6px) rotate(0deg) scale(1.028);
  }
  75% {
    transform: translateY(-3px) rotate(-1.2deg) scale(1.015);
  }
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

@keyframes giftEmojiFloat {
  0% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-6px) scale(1.06);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes imageGlowPulse {
  0% {
    opacity: .45;
    transform: scale(.92);
  }
  50% {
    opacity: .9;
    transform: scale(1.08);
  }
  100% {
    opacity: .45;
    transform: scale(.92);
  }
}

@keyframes cardShine {
  0% {
    transform: translateX(-140%) skewX(-18deg);
    opacity: 0;
  }
  8% {
    opacity: .95;
  }
  24% {
    transform: translateX(140%) skewX(-18deg);
    opacity: 0;
  }
  100% {
    transform: translateX(140%) skewX(-18deg);
    opacity: 0;
  }
}

.gift-card:nth-child(1) .gift-image::before {
  animation-delay: 0s;
}
.gift-card:nth-child(2) .gift-image::before {
  animation-delay: .4s;
}
.gift-card:nth-child(3) .gift-image::before {
  animation-delay: .8s;
}
.gift-card:nth-child(4) .gift-image::before {
  animation-delay: 1.2s;
}
.gift-card:nth-child(5) .gift-image::before {
  animation-delay: 1.6s;
}
.gift-card:nth-child(6) .gift-image::before {
  animation-delay: 2s;
}

@media (max-width: 480px) {
  .gift-grid {
    gap: 8px;
  }

  .gift-image {
    padding: 7px;
  }

  .gift-image img {
    width: 100%;
    height: 100%;
    animation-duration: 3.4s;
  }

  .gift-name {
    min-height: 40px;
    padding: 7px 6px 8px;
    font-size: clamp(8px, 2.7vw, 10px);
    line-height: 1.1;
  }

  .gift-card::after {
    inset: -28%;
  }
}

@media (max-width: 390px) {
  .gift-grid {
    gap: 6px;
  }

  .gift-image {
    padding: 6px;
  }

  .gift-name {
    min-height: 36px;
    padding: 6px 5px 7px;
    font-size: 8px;
    line-height: 1.05;
    letter-spacing: .02em;
  }
}

@media (max-width: 360px) {
  .gift-grid {
    gap: 5px;
  }

  .gift-image {
    padding: 5px;
  }

  .gift-name {
    min-height: 32px;
    padding: 5px 4px 6px;
    font-size: 8px;
    line-height: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gift-card::after,
  .gift-image::before,
  .gift-image img,
  .gift-emoji {
    animation: none !important;
  }
}

/* =========================================
   SHAKE FEEDBACK UPGRADE - TEMPel DI BAWAH
   ========================================= */

.shake-scene {
  perspective: 1000px;
  transform-style: preserve-3d;
}

.shake-device {
  will-change: transform, filter;
  transform-origin: center center;
}

.shake-device::before {
  animation: deviceAuraPulse 2.2s ease-in-out infinite;
}

.shake-device::after {
  content: "";
  position: absolute;
  inset: -10%;
  border-radius: 999px;
  background:
    radial-gradient(circle,
      rgba(255,255,255,0.18) 0%,
      rgba(185,156,255,0.14) 22%,
      rgba(138,104,240,0.10) 42%,
      rgba(255,255,255,0) 72%);
  filter: blur(10px);
  opacity: .55;
  pointer-events: none;
  z-index: 0;
  animation: deviceOuterPulse 2.8s ease-in-out infinite;
}

.shake-device-img {
  will-change: transform, filter;
  transition: filter .22s ease, transform .22s ease;
}

.shake-scene.ready .shake-device {
  animation:
    idleFloatHeavy 1.8s ease-in-out infinite,
    idleSway 2.8s ease-in-out infinite;
}

.shake-scene.listening .shake-device {
  animation:
    listeningHeavy 0.92s ease-in-out infinite,
    listeningDepth 1.2s ease-in-out infinite;
}

.shake-scene.impact .shake-device {
  animation: deviceImpactHeavy 0.72s cubic-bezier(.2,.9,.2,1) 1;
}

.shake-scene.impact .shake-device::before {
  animation: impactAuraBlast 0.72s ease-out 1;
}

.shake-scene.impact .shake-device::after {
  animation: impactOuterBlast 0.78s ease-out 1;
}

.shake-scene.impact .shake-device-img {
  filter:
    drop-shadow(0 18px 26px rgba(0, 0, 0, 0.28))
    drop-shadow(0 0 22px rgba(185, 156, 255, 0.26))
    drop-shadow(0 0 38px rgba(138, 104, 240, 0.18));
}

.shake-copy {
  transition:
    opacity .35s ease,
    transform .35s ease,
    filter .35s ease;
}

.shake-scene.listening .shake-copy {
  animation: copyPulse 1.05s ease-in-out infinite;
}

.shake-scene.impact .shake-copy {
  transform: translateY(-3px) scale(1.015);
  filter: drop-shadow(0 0 14px rgba(185,156,255,.16));
}

.shake-hint strong {
  color: #fff3c9;
  text-shadow:
    0 0 12px rgba(240,223,179,.28),
    0 0 24px rgba(185,156,255,.18);
}

.overlay.flash-on .shake-device {
  animation: flashKick 0.7s ease-out 1;
}

.overlay.reveal-start .shake-device::before,
.overlay.reveal-start .shake-device::after {
  opacity: 0;
  transition: opacity .25s ease;
}

.shake-scene.listening .center-line {
  background: linear-gradient(
    180deg,
    rgba(196, 170, 255, .06) 0%,
    rgba(240, 223, 179, .16) 18%,
    rgba(196, 170, 255, .24) 50%,
    rgba(240, 223, 179, .14) 78%,
    rgba(196, 170, 255, .05) 100%
  );
  box-shadow:
    0 0 12px rgba(185,156,255,.14),
    0 0 24px rgba(240,223,179,.08);
}

.shake-scene.impact .center-line {
  animation: lineShock 0.62s ease-out 1;
}

.overlay.reward-shown .reward-shell {
  box-shadow:
    0 26px 52px rgba(0, 0, 0, 0.24),
    0 0 28px rgba(185, 156, 255, 0.22),
    0 0 52px rgba(240, 223, 179, 0.12),
    0 0 0 1px rgba(255,255,255,.55) inset;
}

.overlay.reward-shown .reward-glow {
  filter: blur(16px);
}

@keyframes idleFloatHeavy {
  0%   { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
  25%  { transform: translate3d(0, -4px, 0) scale(1.015) rotate(-1deg); }
  50%  { transform: translate3d(0, -8px, 0) scale(1.03) rotate(0deg); }
  75%  { transform: translate3d(0, -4px, 0) scale(1.015) rotate(1deg); }
  100% { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
}

@keyframes idleSway {
  0%   { filter: drop-shadow(0 14px 24px rgba(0,0,0,.22)); }
  50%  { filter: drop-shadow(0 20px 28px rgba(0,0,0,.28)); }
  100% { filter: drop-shadow(0 14px 24px rgba(0,0,0,.22)); }
}

@keyframes listeningHeavy {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }
  12% {
    transform: translate3d(-7px, 0, 0) rotate(-10deg) scale(1.03);
  }
  24% {
    transform: translate3d(8px, 0, 0) rotate(10deg) scale(1.05);
  }
  36% {
    transform: translate3d(-9px, 0, 0) rotate(-12deg) scale(1.04);
  }
  48% {
    transform: translate3d(10px, 0, 0) rotate(12deg) scale(1.05);
  }
  60% {
    transform: translate3d(-7px, 0, 0) rotate(-9deg) scale(1.03);
  }
  72% {
    transform: translate3d(7px, 0, 0) rotate(9deg) scale(1.03);
  }
  84% {
    transform: translate3d(-4px, 0, 0) rotate(-4deg) scale(1.01);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }
}

@keyframes listeningDepth {
  0% {
    filter:
      drop-shadow(0 14px 24px rgba(0, 0, 0, 0.22))
      drop-shadow(0 0 16px rgba(185, 156, 255, 0.12));
  }
  50% {
    filter:
      drop-shadow(0 20px 30px rgba(0, 0, 0, 0.32))
      drop-shadow(0 0 28px rgba(185, 156, 255, 0.20))
      drop-shadow(0 0 42px rgba(138, 104, 240, 0.14));
  }
  100% {
    filter:
      drop-shadow(0 14px 24px rgba(0, 0, 0, 0.22))
      drop-shadow(0 0 16px rgba(185, 156, 255, 0.12));
  }
}

@keyframes deviceImpactHeavy {
  0% {
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
  10% {
    transform: translate3d(-16px, 0, 0) scale(0.93) rotate(-16deg);
  }
  22% {
    transform: translate3d(18px, 0, 0) scale(1.08) rotate(16deg);
  }
  34% {
    transform: translate3d(-16px, 0, 0) scale(0.96) rotate(-13deg);
  }
  46% {
    transform: translate3d(15px, 0, 0) scale(1.06) rotate(13deg);
  }
  58% {
    transform: translate3d(-10px, 0, 0) scale(0.99) rotate(-9deg);
  }
  70% {
    transform: translate3d(10px, 0, 0) scale(1.03) rotate(9deg);
  }
  82% {
    transform: translate3d(-5px, 0, 0) scale(1.01) rotate(-4deg);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
}

@keyframes deviceAuraPulse {
  0% {
    opacity: .72;
    transform: scale(.88);
    box-shadow:
      0 0 18px rgba(138, 104, 240, 0.14),
      0 0 38px rgba(138, 104, 240, 0.10);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
    box-shadow:
      0 0 26px rgba(138, 104, 240, 0.22),
      0 0 52px rgba(138, 104, 240, 0.16);
  }
  100% {
    opacity: .72;
    transform: scale(.88);
    box-shadow:
      0 0 18px rgba(138, 104, 240, 0.14),
      0 0 38px rgba(138, 104, 240, 0.10);
  }
}

@keyframes deviceOuterPulse {
  0% {
    opacity: .28;
    transform: scale(.92);
  }
  50% {
    opacity: .72;
    transform: scale(1.08);
  }
  100% {
    opacity: .28;
    transform: scale(.92);
  }
}

@keyframes impactAuraBlast {
  0% {
    opacity: .9;
    transform: scale(.84);
  }
  35% {
    opacity: 1;
    transform: scale(1.14);
  }
  100% {
    opacity: .35;
    transform: scale(1.24);
  }
}

@keyframes impactOuterBlast {
  0% {
    opacity: .5;
    transform: scale(.92);
  }
  40% {
    opacity: .95;
    transform: scale(1.22);
  }
  100% {
    opacity: 0;
    transform: scale(1.42);
  }
}

@keyframes lineShock {
  0% {
    opacity: .65;
    transform: translateX(-50%) scaleY(.92);
    box-shadow: 0 0 0 rgba(255,255,255,0);
  }
  35% {
    opacity: 1;
    transform: translateX(-50%) scaleY(1.06);
    box-shadow:
      0 0 12px rgba(240,223,179,.18),
      0 0 24px rgba(185,156,255,.20);
  }
  100% {
    opacity: .75;
    transform: translateX(-50%) scaleY(1);
    box-shadow: 0 0 0 rgba(255,255,255,0);
  }
}

@keyframes copyPulse {
  0% {
    opacity: .88;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
  100% {
    opacity: .88;
    transform: translateY(0);
  }
}

@keyframes flashKick {
  0% {
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
  22% {
    transform: translate3d(-10px, 0, 0) scale(0.96) rotate(-10deg);
  }
  45% {
    transform: translate3d(10px, 0, 0) scale(1.06) rotate(10deg);
  }
  70% {
    transform: translate3d(-6px, 0, 0) scale(1.01) rotate(-5deg);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
}

@media (max-width: 480px) {
  .shake-scene.listening .shake-device {
    animation:
      listeningHeavy 0.96s ease-in-out infinite,
      listeningDepth 1.22s ease-in-out infinite;
  }

  .shake-scene.impact .shake-device {
    animation: deviceImpactHeavy 0.76s cubic-bezier(.2,.9,.2,1) 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shake-device,
  .shake-device::before,
  .shake-device::after,
  .shake-copy,
  .center-line {
    animation: none !important;
    transition: none !important;
  }
}

.gift-name {
  display: none !important;
}

.gift-card {
  justify-content: center;
}

.gift-image {
  flex: 1 1 auto;
}