/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ── */
:root {
  --gold:        #c9a84c;
  --gold-light:  #f0d080;
  --gold-dark:   #8a6820;
  --dark-bg:     #0a0812;
  --card-bg:     #131020;
  --card-border: #2a2240;
  --text-primary: #f5ecd7;
  --text-muted:   #7a6d8a;
  --radius:       20px;
}

/* ── Base ── */
html, body {
  min-height: 100vh;
  background: var(--dark-bg);
  font-family: 'Raleway', sans-serif;
  color: var(--text-primary);
  overflow-x: hidden;
}

/* ── Background ── */
.bg-stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.star-dot {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  animation: twinkle var(--dur, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes twinkle {
  0%, 100% { opacity: var(--op-min, 0.1); transform: scale(1); }
  50%       { opacity: var(--op-max, 0.6); transform: scale(1.4); }
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, #3b1a6622 0%, transparent 70%),
    radial-gradient(ellipse 50% 35% at 80% 80%, #1a3b6622 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 50% 50%, #c9a84c0a 0%, transparent 60%);
}

/* ─────────────────────────────
   OVERLAY & POPUP
───────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.4s ease both;
  padding: 1rem;
}

.overlay.hide {
  animation: fadeOut 0.35s ease forwards;
  pointer-events: none;
}

.popup {
  position: relative;
  width: min(400px, 92vw);
  background: linear-gradient(160deg, #1c1530 0%, #0e0b1a 100%);
  border-radius: 28px;
  border: 1px solid #c9a84c44;
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  animation: popIn 0.5s cubic-bezier(0.17, 0.67, 0.35, 1.3) both;
  box-shadow:
    0 0 0 1px #c9a84c22,
    0 32px 80px rgba(0,0,0,0.6),
    inset 0 1px 0 #c9a84c33;
  overflow: hidden;
}

.popup-shine {
  position: absolute;
  top: -60%;
  left: -30%;
  width: 160%;
  height: 80%;
  background: linear-gradient(135deg, transparent 40%, #c9a84c0a 50%, transparent 60%);
  transform: rotate(-20deg);
  pointer-events: none;
}

.popup-icon {
  font-size: 60px;
  filter: drop-shadow(0 6px 16px #c9a84c66);
  animation: bob 2.2s ease-in-out infinite;
}

.popup-stars-row {
  font-size: 16px;
  letter-spacing: 6px;
  color: var(--gold);
}

.popup-title {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.25;
}

.popup-title span {
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light), var(--gold-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.popup-divider {
  width: 50px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.popup-body {
  font-size: 14px;
  color: #b0a0c8;
  line-height: 1.7;
  max-width: 270px;
  font-weight: 500;
}

.popup-btn {
  margin-top: 6px;
  padding: 14px 44px;
  font-family: 'Raleway', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #f0d080 0%, #c9a84c 50%, #8a6820 100%);
  color: #1a0e00;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 6px 24px #c9a84c44, 0 2px 0 #f0d08066 inset;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}

.popup-btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: shimmerBtn 2.5s ease infinite;
}

@keyframes shimmerBtn {
  0%   { left: -100%; }
  100% { left: 200%; }
}

.popup-btn:hover  { transform: scale(1.05); box-shadow: 0 10px 32px #c9a84c66; }
.popup-btn:active { transform: scale(0.97); }

.popup-skip {
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: 1px;
  border: none;
  background: none;
  font-family: 'Raleway', sans-serif;
  transition: color 0.15s;
}
.popup-skip:hover { color: #b0a0c8; }

/* ─────────────────────────────
   PAGE LAYOUT
───────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1rem 3rem;
  gap: 2rem;
}

.page-header {
  text-align: center;
  max-width: 500px;
}

.page-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}

.page-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  font-weight: 900;
  line-height: 1.1;
  color: var(--text-primary);
  text-shadow: 0 0 60px #c9a84c33;
}

.page-title em {
  font-style: normal;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-sub {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* ─────────────────────────────
   BOXES GRID
───────────────────────────── */
.boxes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 3vw, 22px);
  width: 100%;
  max-width: 520px;
}

/* ── Single Box Card ── */
.box-card {
  position: relative;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #1e1830, #130f20);
  border: 1.5px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s cubic-bezier(0.34,1.56,0.64,1), border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.box-card:hover {
  transform: translateY(-6px) scale(1.04);
  border-color: var(--box-color, var(--gold));
  box-shadow: 0 12px 40px var(--box-shadow, #c9a84c44), 0 0 0 1px var(--box-color, var(--gold));
}

.box-card:active { transform: scale(0.96); }

.box-card.selected {
  animation: selectedPop 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
  pointer-events: none;
}

.box-card.dimmed {
  opacity: 0.3;
  filter: grayscale(0.5);
  pointer-events: none;
  transform: none !important;
}

@keyframes selectedPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); box-shadow: 0 0 60px var(--box-shadow, #c9a84c88); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1.06); }
}

/* ── Box visual ── */
.box-inner {
  width: 70%;
  height: 70%;
  position: relative;
  pointer-events: none;
}

.box-body {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 75%;
  background: var(--box-color, #c9a84c);
  border-radius: 6px 6px 8px 8px;
  overflow: hidden;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.25), inset 0 2px 0 rgba(255,255,255,0.15);
}

.box-lid {
  position: absolute;
  top: 0;
  left: -5%;
  width: 110%;
  height: 30%;
  background: color-mix(in srgb, var(--box-color, #c9a84c) 80%, #000 20%);
  border-radius: 5px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4), inset 0 2px 0 rgba(255,255,255,0.2);
  z-index: 2;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
  transform-origin: center top;
}

.box-card:hover .box-lid {
  transform: rotateX(-35deg) translateY(-4px);
}

.box-ribbon-h {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: var(--box-ribbon, #ffd700);
  clip-path: polygon(40% 0, 60% 0, 60% 100%, 40% 100%);
  opacity: 0.85;
}

.box-ribbon-v {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: var(--box-ribbon, #ffd700);
  clip-path: polygon(0 40%, 100% 40%, 100% 60%, 0 60%);
  opacity: 0.85;
}

.box-bow {
  position: absolute;
  top: -38%;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(14px, 4vw, 22px);
  z-index: 3;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

/* ── Box number badge ── */
.box-num {
  position: absolute;
  top: 8px;
  left: 10px;
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: rgba(0,0,0,0.55);
  border-radius: 20px;
  padding: 2px 7px;
  letter-spacing: 0.5px;
  backdrop-filter: blur(4px);
  pointer-events: none;
  z-index: 10;
}

/* ── Box glow on hover ── */
.box-glow {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 0%, var(--box-color, #c9a84c), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: -1;
}

.box-card:hover .box-glow { opacity: 0.18; }

/* ── Shimmer overlay on hover ── */
.box-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.06) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
  z-index: 5;
  border-radius: inherit;
}
.box-card:hover::before { transform: translateX(100%); }

/* ─────────────────────────────
   HINT TEXT
───────────────────────────── */
.hint-text {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  font-weight: 500;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* ─────────────────────────────
   REWARD SCREEN
───────────────────────────── */
.reward-screen {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0,0,0,0.85);
  animation: fadeIn 0.4s ease both;
}

.reward-screen.hidden { display: none; }

.reward-card {
  position: relative;
  width: min(400px, 92vw);
  background: linear-gradient(160deg, #1c1530 0%, #0e0b1a 100%);
  border-radius: 28px;
  border: 1px solid var(--gold);
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  animation: popIn 0.55s cubic-bezier(0.17, 0.67, 0.35, 1.3) both;
  box-shadow:
    0 0 0 1px #c9a84c55,
    0 0 80px #c9a84c22,
    0 32px 80px rgba(0,0,0,0.7);
  overflow: hidden;
}

.reward-shine {
  position: absolute;
  top: -40%;
  left: -20%;
  width: 140%;
  height: 60%;
  background: linear-gradient(135deg, transparent 40%, #c9a84c08 50%, transparent 60%);
  transform: rotate(-15deg);
  pointer-events: none;
  animation: shineSweep 3s ease-in-out infinite;
}

@keyframes shineSweep {
  0%   { left: -120%; }
  100% { left: 120%; }
}

.reward-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 6px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall var(--dur, 1.5s) ease-out var(--delay, 0s) forwards;
  opacity: 0;
}

@keyframes confettiFall {
  0%   { opacity: 1; transform: translateY(-20px) rotate(0deg); }
  100% { opacity: 0; transform: translateY(300px) rotate(var(--rot, 360deg)); }
}

.reward-trophy {
  font-size: 56px;
  filter: drop-shadow(0 4px 20px #c9a84c88);
  animation: trophyBounce 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes trophyBounce {
  from { transform: scale(0) rotate(-15deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg); opacity: 1; }
}

.reward-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 4px;
}

.reward-title {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 900;
  color: var(--text-primary);
}

.reward-amount-wrap {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin-top: 4px;
}

.reward-currency {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.3;
}

.reward-amount {
  font-family: 'Playfair Display', serif;
  font-size: clamp(52px, 14vw, 72px);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  animation: countUp 0.6s cubic-bezier(0.34,1.56,0.64,1) 0.2s both;
}

@keyframes countUp {
  from { transform: scale(0.4) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0);       opacity: 1; }
}

.reward-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: -4px;
}

.reward-divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 4px 0;
}

.reward-note {
  font-size: 13px;
  color: #b0a0c8;
  font-weight: 500;
}

.reward-claim-btn {
  width: 100%;
  max-width: 280px;
  margin-top: 6px;
  padding: 15px 20px;
  font-family: 'Raleway', sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #f0d080 0%, #c9a84c 50%, #8a6820 100%);
  color: #1a0e00;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 28px #c9a84c55, 0 2px 0 #f0d08066 inset;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}

.reward-claim-btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmerBtn 2s ease infinite;
}

.reward-claim-btn:hover  { transform: scale(1.04); box-shadow: 0 12px 36px #c9a84c77; }
.reward-claim-btn:active { transform: scale(0.97); }

.reward-again-btn {
  background: none;
  border: 1px solid #2a2240;
  border-radius: 50px;
  color: var(--text-muted);
  font-family: 'Raleway', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 8px 24px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.reward-again-btn:hover { border-color: var(--gold); color: var(--gold); }

/* ─────────────────────────────
   KEYFRAMES
───────────────────────────── */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

@keyframes popIn {
  from { opacity: 0; transform: scale(0.7) translateY(30px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

/* ─────────────────────────────
   UTILITY
───────────────────────────── */
.hidden { display: none !important; }
