/* ==========================================================================
   Emma's Birthday Website - Design System & Custom Stylesheet
   Aesthetic: Cosmic Deep Dark, Glassmorphism, Neon Highlights & Snapchat Yellow
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-primary: #0a0813;
  --bg-secondary: #131026;
  --text-primary: #ffffff;
  --text-muted: #b3b0d2;
  
  /* Neon Accents */
  --accent-purple: #9d4edd;
  --accent-pink: #ff007f;
  --accent-snapchat: #FFFC00; /* Neon Snapchat Yellow */
  --accent-blue: #00f0ff;
  
  /* Gradients */
  --grad-main: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  --grad-snap: linear-gradient(135deg, #FFFC00, #ffb703);
  --grad-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
  
  /* Shadows & Glows */
  --glow-snap: 0 0 25px rgba(255, 252, 0, 0.4);
  --glow-pink: 0 0 20px rgba(255, 0, 127, 0.4);
  --glow-purple: 0 0 25px rgba(157, 78, 221, 0.4);
  --shadow-premium: 0 20px 50px rgba(0, 0, 0, 0.5);
  
  /* Transitions */
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

h1, h2, h3, .spin-text, .section-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Ambient Background Glows */
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.45;
}

.glow-1 {
  width: 45vw;
  height: 45vw;
  background: var(--accent-purple);
  top: -10vw;
  left: -10vw;
  animation: floatGlow1 20s infinite alternate ease-in-out;
}

.glow-2 {
  width: 50vw;
  height: 50vw;
  background: var(--accent-pink);
  bottom: -15vw;
  right: -10vw;
  animation: floatGlow2 25s infinite alternate ease-in-out;
}

@keyframes floatGlow1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(8vw, 10vw) scale(1.15); }
}

@keyframes floatGlow2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-8vw, -12vw) scale(0.9); }
}

/* Floating Photo Background System */
#floating-bg-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

/* Polaroid-Style Frames */
.floating-photo {
  position: absolute;
  background: #ffffff;
  padding: 10px 10px 24px 10px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  will-change: transform, opacity;
  animation: driftUp var(--float-duration, 25s) linear infinite;
  animation-delay: var(--float-delay, 0s);
  opacity: 0;
  width: 150px;
  transform-origin: center;
}

.floating-photo .img-wrapper {
  width: 130px;
  height: 130px;
  background: #eaeaea;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.floating-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fallback procedural designs inside the polaroids */
.floating-photo .placeholder-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  color: var(--text-primary);
  font-size: 2.2rem;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.floating-photo .placeholder-content::after {
  content: '';
  position: absolute;
  width: 150%;
  height: 150%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  top: -25%;
  left: -25%;
}

.floating-photo .caption {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  color: #333333;
  margin-top: 8px;
  text-align: center;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes driftUp {
  0% {
    transform: translateY(105vh) translateX(0) rotate(var(--start-rot, -10deg));
    opacity: 0;
  }
  10% {
    opacity: var(--max-opacity, 0.75);
  }
  90% {
    opacity: var(--max-opacity, 0.75);
  }
  100% {
    transform: translateY(-25vh) translateX(var(--drift-x, 40px)) rotate(var(--end-rot, 15deg));
    opacity: 0;
  }
}

/* Glassmorphism Cards */
.card-glass {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 40px;
  width: 90%;
  max-width: 580px;
  text-align: center;
  box-shadow: var(--shadow-premium);
  transition: var(--transition-smooth);
  z-index: 10;
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transform: translateY(30px) scale(0.95);
}

.card-glass.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Greet / Intro Screen */
#intro-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.gift-icon-container {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 10px;
}

.gift-box {
  width: 80px;
  height: 80px;
  background: var(--grad-main);
  position: absolute;
  bottom: 0;
  left: 10px;
  border-radius: 12px;
  box-shadow: var(--glow-pink);
  animation: pulseGift 2.5s infinite ease-in-out;
}

.gift-lid {
  width: 90px;
  height: 20px;
  background: var(--accent-pink);
  position: absolute;
  top: -5px;
  left: -5px;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.gift-ribbon-v, .gift-ribbon-h {
  background: #ffffff;
  position: absolute;
}

.gift-ribbon-v {
  width: 14px;
  height: 100%;
  left: calc(50% - 7px);
  top: 0;
}

.gift-ribbon-h {
  width: 100%;
  height: 14px;
  top: calc(50% - 7px);
  left: 0;
}

.gift-bow {
  width: 30px;
  height: 30px;
  border: 8px solid #ffffff;
  border-radius: 50% 50% 0 50%;
  position: absolute;
  top: -30px;
  left: calc(50% - 19px);
  transform: rotate(45deg);
}

.gift-bow::after {
  content: '';
  width: 30px;
  height: 30px;
  border: 8px solid #ffffff;
  border-radius: 50% 50% 50% 0;
  position: absolute;
  top: -8px;
  left: -28px;
  transform: rotate(-90deg);
}

@keyframes pulseGift {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.06) translateY(-5px); }
}

.glow-text {
  font-size: 2.2rem;
  background: linear-gradient(to right, #fff, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}

.intro-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* Buttons */
.btn-primary {
  background: var(--grad-main);
  color: #fff;
  border: none;
  padding: 16px 36px;
  border-radius: 14px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--glow-pink);
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 0 30px rgba(255, 0, 127, 0.7);
}

.btn-primary:active {
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 14px 28px;
  border-radius: 12px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Wheel Screen Layout */
#game-container {
  max-width: 650px;
}

.section-title {
  font-size: 2rem;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff, #a0a0ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.wheel-outer-wrapper {
  position: relative;
  width: 440px;
  height: 440px;
  margin: 0 auto 20px auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Pointer Arrow */
#wheel-pointer {
  position: absolute;
  top: -15px;
  left: calc(50% - 20px);
  width: 40px;
  height: 40px;
  z-index: 25;
  transform-origin: 20px 8px; /* Pivot near top of arrow */
  transition: transform 0.1s cubic-bezier(0.1, 0.8, 0.3, 1);
  will-change: transform;
}

/* Wheel Wrapper and Canvas */
#wheel-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  padding: 10px;
  background: linear-gradient(135deg, #2c2557 0%, #0f0a28 100%);
  box-shadow: 
    0 15px 45px rgba(0, 0, 0, 0.6),
    inset 0 0 25px rgba(255, 255, 255, 0.05),
    0 0 0 10px rgba(255, 255, 255, 0.02);
  display: flex;
  justify-content: center;
  align-items: center;
}

#wheel-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
}

#wheel-canvas.dragging {
  cursor: grabbing;
}

#wheel-canvas.spinning {
  cursor: not-allowed;
}

/* Central Spin Button */
#spin-btn {
  position: absolute;
  width: 105px;
  height: 105px;
  border-radius: 50%;
  border: 4px solid #1c1543;
  background: radial-gradient(circle, #2d2663 0%, #150f38 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 
    0 8px 25px rgba(0, 0, 0, 0.5),
    0 0 15px rgba(157, 78, 221, 0.3);
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition-smooth);
}

#spin-btn::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  z-index: -1;
  opacity: 0.6;
  transition: var(--transition-smooth);
}

#spin-btn:hover {
  transform: scale(1.05);
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.6),
    0 0 25px rgba(255, 0, 127, 0.6);
}

#spin-btn:hover::before {
  opacity: 1;
}

#spin-btn:active {
  transform: scale(0.96);
}

#spin-btn.disabled {
  pointer-events: none;
  opacity: 0.8;
  filter: grayscale(0.5);
}

.spin-btn-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.spin-text {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

#spin-btn i {
  font-size: 1.1rem;
}

#spin-status-message {
  margin-top: 15px;
  color: var(--text-muted);
  font-size: 0.9rem;
  min-height: 20px;
  transition: var(--transition-smooth);
}

#spin-status-message.highlight {
  color: var(--accent-snapchat);
  text-shadow: 0 0 10px rgba(255, 252, 0, 0.3);
}

/* Modals & Backdrop */
#modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 3, 9, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Winner Modal Custom Styles */
#win-modal {
  z-index: 110;
  max-width: 480px;
  border-color: rgba(255, 252, 0, 0.25);
  box-shadow: 0 25px 60px rgba(0,0,0,0.7), 0 0 35px rgba(255, 252, 0, 0.15);
}

.snap-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-snapchat);
  color: #000;
  padding: 10px 18px;
  border-radius: 50px;
  margin: -10px auto 20px auto;
  box-shadow: var(--glow-snap);
}

.snap-badge .ghost-icon {
  font-size: 1.5rem;
}

.snap-badge .plus-sign {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  margin-left: 2px;
  line-height: 1;
}

.win-title {
  font-size: 2.1rem;
  margin-bottom: 20px;
  color: #ffffff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

/* Gift Card Mockup */
.win-gift-card {
  position: relative;
  width: 100%;
  height: 180px;
  margin: 10px 0 25px 0;
  border-radius: 16px;
  overflow: hidden;
  perspective: 1000px;
}

.card-glow {
  position: absolute;
  width: 150%;
  height: 150%;
  top: -25%; left: -25%;
  background: radial-gradient(circle, rgba(255, 252, 0, 0.35) 0%, transparent 60%);
  animation: pulseGlow 3s infinite alternate ease-in-out;
  pointer-events: none;
}

@keyframes pulseGlow {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.15); opacity: 1; }
}

.card-inner {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #0e0d16 0%, #1a1926 100%);
  border: 2px solid var(--accent-snapchat);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
  box-shadow: inset 0 0 20px rgba(255, 252, 0, 0.15);
}

.card-inner::after {
  content: '+';
  position: absolute;
  right: -5px;
  bottom: -20px;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 11rem;
  color: rgba(255, 252, 0, 0.04);
  pointer-events: none;
}

.snapchat-logo-yellow {
  font-size: 3.5rem;
  color: var(--accent-snapchat);
  filter: drop-shadow(var(--glow-snap));
}

.card-details {
  display: flex;
  flex-direction: column;
}

.card-brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.8rem;
  color: #fff;
  line-height: 1.1;
}

.card-duration {
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--accent-snapchat);
  margin-top: 4px;
  font-weight: 700;
}

.card-for {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 14px;
}

.win-description {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 30px;
}

.win-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.snap-theme-btn {
  background: var(--accent-snapchat);
  color: #000;
  box-shadow: var(--glow-snap);
}

.snap-theme-btn:hover {
  background: #ffea00;
  box-shadow: 0 0 35px rgba(255, 252, 0, 0.9);
  color: #000;
}

/* Greeting Card Modal (Redeem) */
#redeem-modal {
  z-index: 120;
  max-width: 440px;
  border-color: rgba(255, 255, 255, 0.12);
  padding: 35px;
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.close-btn:hover {
  color: #fff;
}

.redeem-title {
  font-size: 1.6rem;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fff, var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.redeem-content {
  text-align: left;
  line-height: 1.6;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.redeem-content p strong {
  color: #fff;
}

.redeem-content .signature {
  margin-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 15px;
  font-size: 0.95rem;
}

.redeem-content .signature strong {
  font-family: 'Outfit', sans-serif;
  color: var(--accent-pink);
  font-size: 1.1rem;
}

/* Confetti Overlay */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 105;
  pointer-events: none;
}

/* Responsiveness adjustments for phones (mobile QR code scans!) */
@media (max-width: 480px) {
  .card-glass {
    padding: 24px 16px;
    width: 95%;
  }

  .glow-text {
    font-size: 1.7rem;
  }

  .section-title {
    font-size: 1.6rem;
  }

  .wheel-outer-wrapper {
    width: 290px;
    height: 290px;
  }

  #wheel-pointer {
    width: 32px;
    height: 32px;
    top: -12px;
    left: calc(50% - 16px);
  }

  #spin-btn {
    width: 75px;
    height: 75px;
    border-width: 3px;
  }

  .spin-text {
    font-size: 0.65rem;
  }

  #spin-btn i {
    font-size: 0.85rem;
  }

  .win-title {
    font-size: 1.7rem;
  }

  .win-gift-card {
    height: 140px;
  }

  .card-inner {
    padding: 16px;
    gap: 12px;
  }

  .snapchat-logo-yellow {
    font-size: 2.5rem;
  }

  .card-brand {
    font-size: 1.4rem;
  }

  .card-inner::after {
    font-size: 8rem;
  }
}
