/* --- Reset & Global Holiday Theme --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

:root {
  --bg-gradient: radial-gradient(circle at 50% 12%, #1a4434 0%, #0d2a1f 52%, #05130e 100%);
  --gold: #ffdf78;
  --gold-glow: rgba(255, 223, 120, 0.45);
  --gold-flare: rgba(255, 215, 0, 0.9);
  --text-light: #f6fff8;
  --text-muted: #a7c4bc;

  /* Gift Box Color Palettes */
  --box-ruby: linear-gradient(135deg, #d90429 0%, #b00020 50%, #660012 100%);
  --box-ruby-side: #4d000d;
  --box-sapphire: linear-gradient(135deg, #1e6091 0%, #16425b 50%, #0c2331 100%);
  --box-sapphire-side: #071720;
  --box-emerald: linear-gradient(135deg, #2d6a4f 0%, #1b4332 50%, #081c15 100%);
  --box-emerald-side: #05120e;
  --box-gold: linear-gradient(135deg, #ffd166 0%, #d4a325 50%, #996f0b 100%);
  --box-gold-side: #664a07;
  --box-plum: linear-gradient(135deg, #7b2cbf 0%, #5a189a 50%, #3c096c 100%);
  --box-plum-side: #240046;

  /* Ribbon Styles */
  --ribbon-gold: linear-gradient(90deg, #ffe599 0%, #d4af37 50%, #aa820a 100%);
  --ribbon-silver: linear-gradient(90deg, #ffffff 0%, #dcdfe3 50%, #9aa0ad 100%);
  --ribbon-red: linear-gradient(90deg, #ff4d6d 0%, #c9184a 50%, #800f2f 100%);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-light);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* --- Falling Snow Particles --- */
.snowflakes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.snowflake {
  position: absolute;
  top: -25px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.15rem;
  animation: fall linear infinite;
}

.snowflake:nth-child(1)  { left: 3%; animation-duration: 8.5s; animation-delay: 0s; font-size: 0.8rem; opacity: 0.8; }
.snowflake:nth-child(2)  { left: 8%; animation-duration: 11.5s; animation-delay: 1.5s; font-size: 1.25rem; opacity: 0.75; }
.snowflake:nth-child(3)  { left: 14%; animation-duration: 7.8s; animation-delay: 3.2s; font-size: 1.05rem; opacity: 0.85; }
.snowflake:nth-child(4)  { left: 19%; animation-duration: 10s; animation-delay: 0.5s; font-size: 1.4rem; opacity: 0.9; }
.snowflake:nth-child(5)  { left: 24%; animation-duration: 12.5s; animation-delay: 2.2s; font-size: 0.75rem; opacity: 0.7; }
.snowflake:nth-child(6)  { left: 29%; animation-duration: 8.2s; animation-delay: 4.1s; font-size: 1.2rem; opacity: 0.8; }
.snowflake:nth-child(7)  { left: 35%; animation-duration: 11s; animation-delay: 1.2s; font-size: 0.9rem; opacity: 0.85; }
.snowflake:nth-child(8)  { left: 41%; animation-duration: 7s; animation-delay: 2.8s; font-size: 1.45rem; opacity: 0.95; }
.snowflake:nth-child(9)  { left: 47%; animation-duration: 9.8s; animation-delay: 3.7s; font-size: 0.85rem; opacity: 0.75; }
.snowflake:nth-child(10) { left: 52%; animation-duration: 9s; animation-delay: 0.8s; font-size: 1.15rem; opacity: 0.85; }
.snowflake:nth-child(11) { left: 58%; animation-duration: 12s; animation-delay: 1.8s; font-size: 0.7rem; opacity: 0.65; }
.snowflake:nth-child(12) { left: 63%; animation-duration: 8s; animation-delay: 4.5s; font-size: 1.3rem; opacity: 0.9; }
.snowflake:nth-child(13) { left: 68%; animation-duration: 10.5s; animation-delay: 2.5s; font-size: 0.85rem; opacity: 0.8; }
.snowflake:nth-child(14) { left: 73%; animation-duration: 7.5s; animation-delay: 0.3s; font-size: 1.35rem; opacity: 0.9; }
.snowflake:nth-child(15) { left: 78%; animation-duration: 13s; animation-delay: 3.5s; font-size: 0.95rem; opacity: 0.75; }
.snowflake:nth-child(16) { left: 82%; animation-duration: 8.8s; animation-delay: 1.6s; font-size: 1.25rem; opacity: 0.85; }
.snowflake:nth-child(17) { left: 87%; animation-duration: 11.2s; animation-delay: 4.8s; font-size: 0.8rem; opacity: 0.7; }
.snowflake:nth-child(18) { left: 91%; animation-duration: 6.8s; animation-delay: 2.1s; font-size: 1.4rem; opacity: 0.95; }
.snowflake:nth-child(19) { left: 95%; animation-duration: 10s; animation-delay: 0.9s; font-size: 0.75rem; opacity: 0.75; }
.snowflake:nth-child(20) { left: 98%; animation-duration: 9.2s; animation-delay: 3.1s; font-size: 1.1rem; opacity: 0.8; }
.snowflake:nth-child(21) { left: 6%; animation-duration: 13.5s; animation-delay: 5s; font-size: 0.9rem; opacity: 0.7; }
.snowflake:nth-child(22) { left: 32%; animation-duration: 7.2s; animation-delay: 1.9s; font-size: 1.15rem; opacity: 0.85; }
.snowflake:nth-child(23) { left: 55%; animation-duration: 10.8s; animation-delay: 4.2s; font-size: 0.85rem; opacity: 0.75; }
.snowflake:nth-child(24) { left: 80%; animation-duration: 8.4s; animation-delay: 2.9s; font-size: 1.2rem; opacity: 0.85; }

@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  15% { opacity: 0.85; }
  85% { opacity: 0.75; }
  100% { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}

/* --- Container Layout --- */
.app-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 440px;
  padding: 0.9rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 100vh;
  min-height: 100dvh;
}

/* --- Header Banner --- */
.header {
  text-align: center;
  width: 100%;
}

.garland {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 0.35rem;
}

.bulb {
  width: 10px;
  height: 15px;
  border-radius: 50% 50% 40% 40%;
  box-shadow: 0 0 10px currentColor;
  animation: twinkle 1.8s infinite alternate ease-in-out;
}

.bulb.red { color: #ff3344; background: #ff3344; animation-delay: 0s; }
.bulb.gold { color: #ffcc00; background: #ffcc00; animation-delay: 0.4s; }
.bulb.green { color: #2ecc71; background: #2ecc71; animation-delay: 0.8s; }
.bulb.blue { color: #3498db; background: #3498db; animation-delay: 1.2s; }

@keyframes twinkle {
  0% { opacity: 0.45; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1.15); filter: brightness(1.35); }
}

.title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
  margin-bottom: 0.35rem;
}

/* User Holiday Name Greeting (Pure text, no badge, enlarged font) */
.user-greeting {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.25rem;
  margin-bottom: 0.15rem;
  font-size: 1.12rem;
  color: var(--text-light);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.greeting-prefix {
  color: var(--text-muted);
  font-weight: 500;
}

.user-holiday-name {
  color: var(--gold);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.3px;
  text-shadow: 0 0 12px var(--gold-glow);
}

.user-avatar {
  font-size: 1.35rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}

/* Centered Opens Today Badge directly under Elf greeting */
.quota-pill {
  margin: 0.35rem auto 0.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  color: var(--text-light);
}

/* --- Action & Countdown Bar --- */
.action-bar {
  text-align: center;
  margin: 0.3rem 0 0.5rem;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-prompt {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold-glow);
}

.timer-box {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 223, 120, 0.15);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 0 16px rgba(255, 223, 120, 0.35);
  animation: glowTimer 2s infinite alternate;
}

@keyframes glowTimer {
  0% { box-shadow: 0 0 8px rgba(255, 223, 120, 0.2); }
  100% { box-shadow: 0 0 20px rgba(255, 223, 120, 0.5); }
}

/* ===============================================================
   ALL-DIGITAL HOLIDAY SCENE: TREE + 3D PRESENTS AROUND SKIRT
   =============================================================== */
.holiday-scene {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  margin: 0.2rem auto 0.6rem;
}

/* Ambient warm floor glow radiating from tree skirt */
.ambient-warm-glow {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 220, 130, 0.35) 0%, rgba(255, 170, 0, 0.12) 50%, transparent 75%);
  filter: blur(16px);
  pointer-events: none;
  z-index: 0;
}

/* Tree Container */
.tree-container {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 330px;
  height: 400px;
  z-index: 1;
  pointer-events: none;
}

.tree-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.55));
}

/* Fairy Lights Twinkle Animations - Static positions, purely pulsing opacity and glow */
.f-light {
  animation: lightPulse 2.2s infinite alternate ease-in-out;
}

.f-light.gold { fill: #fff6cc; filter: drop-shadow(0 0 5px #ffd700); animation-delay: 0.1s; }
.f-light.red { fill: #ff85a1; filter: drop-shadow(0 0 5px #ff0054); animation-delay: 0.6s; }
.f-light.cyan { fill: #e0fbfc; filter: drop-shadow(0 0 5px #00f5d4); animation-delay: 1.1s; }
.f-light.green { fill: #d8f3dc; filter: drop-shadow(0 0 5px #2ec4b6); animation-delay: 1.6s; }
.f-light.purple { fill: #f3c4fb; filter: drop-shadow(0 0 5px #b5179e); animation-delay: 0.8s; }

@keyframes lightPulse {
  0% { opacity: 0.4; filter: drop-shadow(0 0 2px currentColor); }
  100% { opacity: 1; filter: drop-shadow(0 0 7px currentColor); }
}

/* Star Topper - Crisp 3D Gold Facets, Zero Background Glow */
.star-halo {
  display: none !important;
}

.star-faceted {
  /* Crisp clean facets with no blurry yellow halo glow */
  filter: none;
}

/* Glass Baubles - Static and reflective */
.bauble {
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.45));
}

/* ===============================================================
   PRESENTS STAGE (ORGANIC 3D ARC AROUND & UNDER TREE SKIRT)
   =============================================================== */
.presents-stage {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 160px;
  z-index: 5;
  pointer-events: auto;
}

/* Individual Present Item wrapper */
.present-item {
  position: absolute;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.present-item:active {
  transform: scale(0.93) !important;
}

/* Idle gentle breathing bounce for ready presents */
.present-item.ready {
  animation: presentFloat 3s ease-in-out infinite;
}

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

/* Specific Staging Positions around the Tree Skirt */
.pos-far-left {
  left: 2%;
  bottom: 45px;
  z-index: 6;
  animation-delay: 0s;
}

.pos-front-left {
  left: 14%;
  bottom: 6px;
  z-index: 10;
  animation-delay: 0.8s;
}

.pos-center {
  left: 50%;
  transform: translateX(-50%);
  bottom: 2px;
  z-index: 12;
  animation-delay: 1.5s;
}

.pos-front-right {
  right: 12%;
  bottom: 8px;
  z-index: 10;
  animation-delay: 0.5s;
}

.pos-far-right {
  right: 2%;
  bottom: 45px;
  z-index: 6;
  animation-delay: 1.2s;
}

/* Keep center alignment transform while floating */
.pos-center.ready {
  animation: presentFloatCenter 3s ease-in-out infinite;
}

@keyframes presentFloatCenter {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-5px); }
}

/* Ground Shadows */
.box-shadow {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  height: 12px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0) 70%);
  filter: blur(3px);
  border-radius: 50%;
  z-index: 1;
  pointer-events: none;
}

/* --- Dramatically Varied Present Sizes & Proportions --- */

/* 1. Tall Slender Luxury Tower (Far Left - Emerald) */
.size-tall-slender .gift-box-3d { width: 50px; height: 96px; }
.size-tall-slender .box-lid { width: 56px; height: 16px; }
.size-tall-slender .box-body { height: 82px; }
.size-tall-slender .ribbon-vertical { width: 10px; }
.size-tall-slender .ribbon-horizontal { height: 9px; }
.size-tall-slender .satin-bow { width: 28px; height: 12px; top: -11px; }
.size-tall-slender .bow-knot { width: 8px; height: 7px; }
.size-tall-slender .bow-loop { width: 12px; height: 11px; border-width: 2.5px; }
.size-tall-slender .box-shadow { width: 52px; height: 10px; }

/* 2. Big Chunky Deluxe Square Box (Front Left - Ruby) */
.size-large-square .gift-box-3d { width: 96px; height: 86px; }
.size-large-square .box-lid { width: 104px; height: 21px; }
.size-large-square .box-body { height: 68px; }
.size-large-square .ribbon-vertical { width: 18px; }
.size-large-square .ribbon-horizontal { height: 14px; }
.size-large-square .satin-bow { width: 44px; height: 18px; top: -15px; }
.size-large-square .bow-knot { width: 12px; height: 10px; }
.size-large-square .bow-loop { width: 18px; height: 17px; border-width: 3.5px; }
.size-large-square .box-shadow { width: 102px; height: 14px; }

/* 3. Little Sparkling Treasure Cube (Center - Gold) */
.size-cube-deluxe .gift-box-3d { width: 54px; height: 50px; }
.size-cube-deluxe .box-lid { width: 60px; height: 14px; }
.size-cube-deluxe .box-body { height: 38px; }
.size-cube-deluxe .ribbon-vertical { width: 10px; }
.size-cube-deluxe .ribbon-horizontal { height: 8px; }
.size-cube-deluxe .satin-bow { width: 26px; height: 12px; top: -10px; }
.size-cube-deluxe .bow-knot { width: 7px; height: 6px; }
.size-cube-deluxe .bow-loop { width: 11px; height: 10px; border-width: 2.2px; }
.size-cube-deluxe .box-shadow { width: 58px; height: 9px; }

/* 4. Extra-Wide Flat Boutique Box (Front Right - Sapphire) */
.size-medium-wide .gift-box-3d { width: 108px; height: 50px; }
.size-medium-wide .box-lid { width: 116px; height: 16px; }
.size-medium-wide .box-body { height: 36px; }
.size-medium-wide .ribbon-vertical { width: 16px; }
.size-medium-wide .ribbon-horizontal { height: 11px; }
.size-medium-wide .satin-bow { width: 42px; height: 16px; top: -13px; }
.size-medium-wide .bow-knot { width: 11px; height: 9px; }
.size-medium-wide .bow-loop { width: 17px; height: 15px; border-width: 3px; }
.size-medium-wide .box-shadow { width: 114px; height: 13px; }

/* 5. Medium Classic Gift Box (Far Right - Plum) */
.size-chunky-boutique .gift-box-3d { width: 74px; height: 70px; }
.size-chunky-boutique .box-lid { width: 80px; height: 18px; }
.size-chunky-boutique .box-body { height: 54px; }
.size-chunky-boutique .ribbon-vertical { width: 14px; }
.size-chunky-boutique .ribbon-horizontal { height: 11px; }
.size-chunky-boutique .satin-bow { width: 36px; height: 15px; top: -13px; }
.size-chunky-boutique .bow-knot { width: 10px; height: 9px; }
.size-chunky-boutique .bow-loop { width: 15px; height: 14px; border-width: 3px; }
.size-chunky-boutique .box-shadow { width: 78px; height: 12px; }

/* --- 3D Box Construction --- */
.gift-box-3d {
  position: relative;
  z-index: 2;
}

/* Box Body Base */
.box-body {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  border-radius: 0 0 5px 5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  z-index: 2;
}

/* Color Themes */
.color-ruby .box-lid, .color-ruby .box-body { background: var(--box-ruby); }
.color-sapphire .box-lid, .color-sapphire .box-body { background: var(--box-sapphire); }
.color-emerald .box-lid, .color-emerald .box-body { background: var(--box-emerald); }
.color-gold .box-lid, .color-gold .box-body { background: var(--box-gold); }
.color-plum .box-lid, .color-plum .box-body { background: var(--box-plum); }

/* Wrapping Paper Patterns */
.pattern-stripes .wrap-pattern {
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.18) 0px, rgba(255, 255, 255, 0.18) 6px, transparent 6px, transparent 13px);
}
.pattern-snowflakes .wrap-pattern {
  background-image: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.7) 1.5px, transparent 2px),
                    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.5) 1px, transparent 1.5px),
                    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.5) 1px, transparent 1.5px);
  background-size: 18px 18px;
}
.pattern-stars .wrap-pattern {
  background-image: radial-gradient(circle at 50% 50%, rgba(255,230,120,0.85) 1.6px, transparent 2.2px),
                    radial-gradient(circle at 25% 25%, rgba(255,215,80,0.5) 1.2px, transparent 1.8px);
  background-size: 16px 16px;
}
.pattern-damask .wrap-pattern {
  background: repeating-linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0px, rgba(255, 215, 0, 0.15) 3.5px, transparent 3.5px, transparent 10px);
}
.pattern-velvet .wrap-pattern {
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,0.15) 0%, transparent 70%);
}

.wrap-pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.9;
}

/* Ribbons on Box */
.ribbon-vertical {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 100%;
  box-shadow: 0 0 4px rgba(0,0,0,0.25);
  z-index: 3;
}

.ribbon-horizontal {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 11px;
  box-shadow: 0 0 4px rgba(0,0,0,0.25);
  z-index: 3;
}

.ribbon-gold .ribbon-vertical,
.ribbon-gold .ribbon-horizontal,
.ribbon-gold .lid-ribbon,
.ribbon-gold .bow-knot,
.ribbon-gold .bow-tail { background: var(--ribbon-gold); }
.ribbon-gold .bow-loop { border-color: #ffe599; background: linear-gradient(135deg, #d4af37, #997b1a); }

.ribbon-silver .ribbon-vertical,
.ribbon-silver .ribbon-horizontal,
.ribbon-silver .lid-ribbon,
.ribbon-silver .bow-knot,
.ribbon-silver .bow-tail { background: var(--ribbon-silver); }
.ribbon-silver .bow-loop { border-color: #ffffff; background: linear-gradient(135deg, #dcdfe3, #8a919e); }

.ribbon-red .ribbon-vertical,
.ribbon-red .ribbon-horizontal,
.ribbon-red .lid-ribbon,
.ribbon-red .bow-knot,
.ribbon-red .bow-tail { background: var(--ribbon-red); }
.ribbon-red .bow-loop { border-color: #ff85a1; background: linear-gradient(135deg, #c9184a, #800f2f); }

/* Removable Box Lid */
.box-lid {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 3.5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  z-index: 4;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lid-ribbon {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 100%;
}

/* 3D Satin Ribbon Bow */
.satin-bow {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 16px;
  z-index: 5;
}

.bow-knot {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 9px;
  border-radius: 2.5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 3;
}

.bow-loop {
  position: absolute;
  top: 0;
  width: 16px;
  height: 15px;
  border: 3px solid;
  border-radius: 50% 50% 10% 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.loop-left {
  left: 2px;
  transform: rotate(-25deg);
}

.loop-right {
  right: 2px;
  transform: scaleX(-1) rotate(-25deg);
}

.bow-tail {
  position: absolute;
  bottom: -9px;
  width: 5px;
  height: 10px;
  border-radius: 1px;
}

.tail-left {
  left: 12px;
  transform: rotate(20deg);
}

.tail-right {
  right: 12px;
  transform: rotate(-20deg);
}

/* Radiance Beam emerging from inside opened box */
.glow-beam {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 85px;
  height: 85px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 235, 140, 0.95) 0%, rgba(255, 180, 50, 0.5) 50%, rgba(255, 150, 0, 0) 70%);
  filter: blur(7px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 1;
}

/* --- Opened State Animations --- */
.present-item.opened {
  z-index: 20 !important;
}

.present-item.opened .box-lid {
  transform: translateX(-50%) translateY(-38px) rotate(-16deg) scale(0.95);
}

.present-item.opened .glow-beam {
  opacity: 1;
  transform: translateX(-50%) scale(1.6);
  animation: pulsePresentGlow 1.8s infinite alternate ease-in-out;
}

@keyframes pulsePresentGlow {
  0% { transform: translateX(-50%) scale(1.3); opacity: 0.7; }
  100% { transform: translateX(-50%) scale(1.7); opacity: 1; }
}

/* Shake Animation (busy / limit) */
.present-item.shake {
  animation: shakeBox 0.45s ease-in-out !important;
}

@keyframes shakeBox {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.pos-center.shake {
  animation: shakeCenter 0.45s ease-in-out !important;
}

@keyframes shakeCenter {
  0%, 100% { transform: translateX(-50%); }
  20%, 60% { transform: translateX(calc(-50% - 6px)); }
  40%, 80% { transform: translateX(calc(-50% + 6px)); }
}

/* Dimmed Waiting State for other presents during show */
.present-item.dimmed {
  opacity: 0.48;
  filter: grayscale(0.25) brightness(0.85);
}

.hidden {
  display: none !important;
}

/* --- Community Stats & Leaderboard Card --- */
.community-card {
  width: 100%;
  max-width: 420px;
  background: rgba(10, 30, 22, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  margin-top: 0.2rem;
  margin-bottom: 0.8rem;
}

.community-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.stat-number {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold-glow);
}

.stat-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-divider {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.12);
}

/* Leaderboard */
.leaderboard-section {
  padding-top: 0.65rem;
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.leaderboard-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: -0.2px;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.leaderboard-item.is-you {
  background: rgba(255, 223, 120, 0.12);
  border-color: rgba(255, 223, 120, 0.35);
}

.leaderboard-user {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.leaderboard-medal {
  font-size: 0.95rem;
}

.leaderboard-avatar {
  font-size: 0.95rem;
}

.leaderboard-name {
  font-weight: 600;
  color: var(--text-light);
}

.you-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--gold);
  color: #0b2917;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  margin-left: 0.25rem;
}

.leaderboard-count {
  font-weight: 700;
  color: var(--gold);
  font-size: 0.78rem;
}

.leaderboard-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.35rem 0;
  font-style: italic;
}

/* --- Toast Notifications (Centered in middle of screen) --- */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(13, 30, 23, 0.96);
  color: #fff;
  padding: 1.1rem 1.6rem;
  border-radius: 16px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid rgba(255, 215, 100, 0.4);
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.8), 0 0 24px rgba(255, 209, 102, 0.25);
  z-index: 1000;
  text-align: center;
  max-width: 86%;
  width: auto;
  pointer-events: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: toastPopCenter 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  line-height: 1.5;
  white-space: pre-line;
}

@keyframes toastPopCenter {
  from { opacity: 0; transform: translate(-50%, -40%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* --- Footer --- */
.footer {
  text-align: center;
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 0.3rem;
}
