@import url(https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&display=swap);
/* --- GLOBAL RESET --- */
* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Montserrat', sans-serif;
  background-color: #000;
}

/* --- SHARED BACKGROUND --- */
#background-wrapper,
#loading-overlay,
#video-preview-container,
#photo-preview-container {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
  z-index: 2000;
  background: repeating-conic-gradient(
    from 0deg,
    #BFEAF5 0deg 15deg,
    #A3D8E8 15deg 30deg
  );
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* --- ROTATING RAYS ANIMATION --- */
#background-wrapper::before,
#loading-overlay::before,
#video-preview-container::before,
#photo-preview-container::before {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 200vmax; height: 200vmax;
  transform: translate(-50%, -50%); z-index: -1;
  background: repeating-conic-gradient(
    from 0deg,
    #BFEAF5 0deg 15deg,
    #A3D8E8 15deg 30deg
  );
  animation: spin-rays 60s linear infinite;
}
@keyframes spin-rays {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

#intro-screen, #input-screen {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  position: absolute; top: 0; left: 0;
  transition: opacity 0.8s ease-in-out;
}

/* --- CARNIVAL CARD STYLE --- */
.theme-border-container,
.carnival-popup {
  position: relative;
  width: 90%;
  max-width: 380px;
  background: rgba(220, 245, 255, 0.9);
  backdrop-filter: blur(5px);
  border-radius: 20px;
  box-shadow: 0 8px 0 #8B0000, 0 20px 30px rgba(0,0,0,0.4);
  border: 4px solid #D32F2F;
  padding: 8px; 
  display: flex; flex-direction: column;
  margin-top: 50px;
}

.theme-inner-content {
  border: 2px dashed #fff; 
  background: transparent;
  outline: 2px solid #D32F2F; 
  border-radius: 14px;
  padding: 25px 15px;
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  gap: 15px; width: 100%;
  position: relative; z-index: 2; 
  min-height: 350px; justify-content: center;
}

.center-content { justify-content: center; }

/* --- HEADER DECORATION --- */
.top-decoration {
  position: absolute; top: -85px; left: 50%;
  transform: translateX(-50%);
  width: 100%; display: flex; justify-content: center;
  z-index: 10; pointer-events: none;
}
.top-decoration img {
  width: 100%; max-width: 320px; height: auto;
  filter: drop-shadow(0px 5px 5px rgba(0,0,0,0.2));
}

/* --- STARS (Safety Zones) --- */
.star { position: absolute; font-size: 20px; user-select: none; z-index: 1; animation: twinkle 2s infinite ease-in-out; }
.star-1 { color: #0047AB; top: 38%; left: 2%; transform: rotate(-15deg); font-size: 28px; animation-delay: 0s; }
.star-2 { color: #5CB3FF; top: 40%; right: 2%; transform: rotate(10deg); animation-delay: 0.5s; }
.star-3 { color: #0047AB; bottom: 8%; left: 3%; transform: rotate(20deg); animation-delay: 1s; } 
.star-4 { color: #0047AB; bottom: 10%; right: 3%; transform: rotate(-10deg); font-size: 24px; animation-delay: 1.5s; }
.star-5 { color: #5CB3FF; top: 60%; left: 1%; font-size: 16px; animation-delay: 0.2s; }
.star-6 { color: #5CB3FF; top: 65%; right: 1%; font-size: 18px; animation-delay: 0.7s; }
.star-8 { color: #5CB3FF; bottom: 25%; right: 2%; font-size: 16px; animation-delay: 0.4s; }

.floating-star {
  position: absolute; color: #D32F2F; font-size: 40px;
  filter: drop-shadow(1px 1px 0px white);
  animation: float 3s infinite ease-in-out;
}
.fs-1 { bottom: 10%; left: 10%; animation-delay: 0s; }
.fs-2 { bottom: 5%; right: 15%; animation-delay: 1s; font-size: 30px; }
.fs-3 { top: 20%; left: 5%; animation-delay: 2s; color: #0047AB; }
.fs-4 { top: 15%; right: 8%; animation-delay: 0.5s; color: #5CB3FF; font-size: 25px; }
.fs-5 { bottom: 40%; left: -5%; animation-delay: 1.5s; color: #D32F2F; font-size: 35px; }

@keyframes twinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(0.8); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }

/* --- TYPOGRAPHY --- */
.logo-area { width: 100%; display: flex; justify-content: center; margin-bottom: 10px; }
.main-logo { max-width: 160px; height: auto; display: block; }
.loader-logo { max-width: 120px; height: auto; }
.mb-20 { margin-bottom: 20px; }
.animated-wishes { display: flex; flex-direction: column; gap: 5px; }
.reveal-line {
  opacity: 0; transform: translateY(20px);
  animation: slideUpFade 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  animation-delay: var(--delay);
  color: #C62828; font-size: 1.4rem; line-height: 1.3; margin: 0; font-weight: 700; 
}
.big-text {
  font-size: 2rem; font-weight: 900; color: #D32F2F; text-transform: uppercase;
  text-shadow: 2px 2px 0px rgba(255,255,255,0.4);
}
@keyframes slideUpFade { to { opacity: 1; transform: translateY(0); } }
.input-instruction p { color: #003366; font-weight: 700; font-size: 0.9rem; margin: 0; }

/* --- INPUTS & BUTTON --- */
.input-group { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 5px; }
#user-name-input, #user-phone-input {
  width: 100%; padding: 12px; border: 2px solid #fff; border-radius: 8px;
  font-size: 1rem; font-family: 'Montserrat', sans-serif;
  text-align: center; color: #C62828; background: rgba(255,255,255,0.6);
  font-weight: 700; outline: none;
}
#user-name-input::placeholder, #user-phone-input::placeholder { color: #C62828; opacity: 0.6; }
.button-wrapper { position: relative; width: 100%; margin-top: 15px; }
#start-button {
  width: 100%; background: linear-gradient(to bottom, #E53935, #B71C1C);
  color: white; border: none; padding: 15px;
  font-size: 1.4rem; font-family: 'Montserrat', sans-serif; font-weight: 900;
  border-radius: 12px; cursor: pointer;
  box-shadow: 0 6px 0 #7F0000; text-transform: uppercase; position: relative; z-index: 2;
  transition: transform 0.1s, box-shadow 0.1s; text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}
#start-button:active { transform: translateY(4px); box-shadow: 0 2px 0 #7F0000; }
#start-button:disabled { filter: grayscale(0.8); cursor: not-allowed; }
.btn-screw {
  position: absolute; width: 8px; height: 8px; background: #FFD700;
  border-radius: 50%; z-index: 3; pointer-events: none;
  box-shadow: inset 1px 1px 1px rgba(0,0,0,0.5);
}
.top-left { top: 8px; left: 8px; } .top-right { top: 8px; right: 8px; }
.bottom-left { bottom: 14px; left: 8px; } .bottom-right { bottom: 14px; right: 8px; }

/* --- APP CONTAINER --- */
#main-app-container { position: relative; width: 100%; height: 100%; z-index: 1; }
#canvas { width: 100%; height: 100%; display: block; }

/* --- LOADER --- */
#loading-overlay { z-index: 3000; background: rgba(0,0,0,0.8); }
.loader-container { width: 80%; max-width: 300px; text-align: center; }
#loading-text { color: white; font-family: 'Montserrat', sans-serif; font-weight: 700; margin-bottom: 10px; font-size: 1.1rem; }
.progress-track {
  width: 100%; height: 12px; background: rgba(255,255,255,0.2);
  border-radius: 10px; overflow: hidden; border: 2px solid white;
}
.progress-fill {
  width: 0%; height: 100%;
  background: linear-gradient(90deg, #FFD700, #FFA500);
  transition: width 0.4s ease-out; border-radius: 10px;
}

/* --- CONTROLS (Updated) --- */
#controls {
  position: absolute; bottom: 30px; width: 100%;
  display: flex; justify-content: center; gap: 40px; z-index: 999;
}

/* Themed Capture Button */
#capture-button-wrapper {
  position: relative;
  width: 180px; /* Wider for text */
  margin: 0 auto;
  opacity: 0; /* Hidden by default */
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#capture-button-wrapper.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#photo-capture-button {
  width: 100%; 
  height: auto;
  padding: 15px;
  
  /* Red Gradient Background */
  background: linear-gradient(to bottom, #E53935, #B71C1C);
  
  color: white; 
  border: none; 
  font-size: 1.4rem; 
  font-family: 'Montserrat', sans-serif; 
  font-weight: 900;
  border-radius: 12px; 
  cursor: pointer;
  
  /* 3D Depth Shadow */
  box-shadow: 0 6px 0 #7F0000;
  
  text-transform: uppercase; 
  position: relative; 
  z-index: 2;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
  
  /* --- FIX: Removed 'background-image: none' line that was here --- */
}

#photo-capture-button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #7F0000;
}

/* Hide video button */
#video-capture-button { display: none !important; }

.poweredbysnap-logo { position: absolute; bottom: 10px; left: 10px; z-index: 2; }
.poweredbysnap-logo img { width: 80px; opacity: 0.8; }

/* --- PREVIEW POPUPS --- */
#video-preview-container, #photo-preview-container { z-index: 2500; }
#video-preview-popup, #photo-preview-popup { align-items: center; justify-content: center; }
.preview-media-wrapper {
  width: 100%; aspect-ratio: 9/16; max-height: 55vh; 
  border-radius: 12px; overflow: hidden; margin-bottom: 15px;
  background: black; border: 2px dashed #D32F2F;
}
#preview-video, #preview-image { width: 100%; height: 100%; object-fit: cover; }
#popup-actions, #photo-popup-actions { display: flex; gap: 15px; width: 100%; }
.popup-cta-button {
  flex: 1; padding: 12px; border-radius: 30px; border: none;
  font-weight: 800; cursor: pointer;
  background: #D32F2F; color: white;
  font-size: 0.9rem; text-transform: uppercase;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
#close-video-preview-button, #close-photo-preview-button {
  position: absolute; top: -15px; right: -10px;
  background: #D32F2F; border: 2px solid white; color: white;
  font-size: 20px; width: 36px; height: 36px; border-radius: 50%;
  font-weight: bold; cursor: pointer; z-index: 2505;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  display: flex; align-items: center; justify-content: center;
}
