@import url(https://fonts.googleapis.com/css2?family=Oswald:wght@700&display=swap);
@import url(https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap);
/* --- Import Fonts --- */

html {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Roboto', sans-serif;
}

body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden;
  background-color: #000000;
}

#main-app-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#canvas { z-index: 1; }

/* =========================================
   GLOBAL PERSISTENT LOGO
   ========================================= */
#global-logo-container {
  position: fixed;
  top: 50px;
  left: 6%;
  width: 15%; 
  z-index: 9999;
  pointer-events: none;
}

#global-logo-container img {
  width: 100%;
  height: auto;
  display: block;
  background: transparent; 
  padding: 0;
}

/* =========================================
   START SCREEN & GENERAL THEME
   ========================================= */
#start-screen {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
  z-index: 2000;
  background-image: url(assets/bg.png);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#start-screen-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 85%;
  max-width: 400px;
}

.festive-header {
  font-family: 'Great Vibes', cursive;
  color: #d4af69; 
  background: linear-gradient(to right, #bfa05f, #fdeeb8, #bfa05f);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: clamp(3rem, 10vw, 4.5rem); 
  line-height: 1.3;
  padding: 10px 20px;
  margin: 0 0 20px 0;
  filter: drop-shadow(0px 4px 5px rgba(0,0,0,0.5));
  font-weight: normal;
  text-align: center;
  width: 100%;
  display: block;
  box-sizing: border-box; 
}

.festive-sub {
  font-family: 'Roboto', sans-serif;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1.4;
  margin: 0 0 40px 0;
  letter-spacing: 0.5px;
}

#lens-input {
  width: 100%;
  max-width: 280px;
  padding: 15px 20px;
  background-color: rgba(10, 10, 10, 0.6);
  border: 2px solid #E34E46; 
  border-radius: 50px; 
  color: #ffffff;
  font-size: 1.2em;
  text-align: center;
  box-sizing: border-box;
  outline: none;
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  margin-bottom: 25px;
  transition: border-color 0.3s ease;
}

#lens-input::placeholder { color: #ffffff; opacity: 0.7; font-weight: 300; }
#lens-input:focus { border-color: #ff7e77; background-color: rgba(10, 10, 10, 0.8); }

/* --- PERMISSIONS TEXT (UPDATED) --- */
.permissions-text {
  font-family: 'Roboto', sans-serif;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.8);
  margin: -10px 0 20px 0; 
  font-weight: 300;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  
  /* UPDATED: Hidden by default to match button logic */
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#start-screen button#start-button {
  width: 100%;
  max-width: 200px;
  padding: 15px 0;
  background: linear-gradient(to bottom, #cfa662, #aa8645);
  box-shadow: 0 4px 15px rgba(170, 134, 69, 0.4);
  border: none;
  border-radius: 50px; 
  color: #2a1f0b; 
  font-family: 'Roboto', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  visibility: hidden; 
  opacity: 0;
  transition: all 0.3s ease;
}

#start-screen button#start-button:active { transform: scale(0.95); box-shadow: 0 2px 8px rgba(170, 134, 69, 0.4); }
#start-screen button#start-button:disabled { opacity: 0.7; filter: grayscale(0.5); cursor: not-allowed; }

/* =========================================
   LOADING SCREEN
   ========================================= */
#loading-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-image: url(assets/bg.png);
  background-size: cover; background-position: center;
  z-index: 2001; 
  display: flex; justify-content: center; align-items: center;
}

.loader-content {
  display: flex; flex-direction: column; align-items: center; gap: 0px; width: 80%; max-width: 300px;
}

.loading-year-img {
  width: 200px;
  height: auto;
  display: block;
  margin-bottom: 0px;
}

.progress-container {
  width: 100%; height: 20px; background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 4px;
  overflow: hidden; position: relative;
  margin-top: 0; 
}
.progress-bar {
  width: 0%; height: 100%;
  background: linear-gradient(90deg, #aa8645, #fdeeb8, #aa8645);
  background-size: 200% 100%;
  animation: loadProgress 3.5s ease-out forwards, shimmer 2s infinite linear;
}
@keyframes loadProgress { 0% { width: 0%; } 20% { width: 30%; } 60% { width: 70%; } 100% { width: 100%; } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.loading-text {
  font-family: 'Roboto', sans-serif; 
  color: #D42426; 
  font-size: 14px;
  letter-spacing: 2px; text-transform: uppercase; font-weight: 500;
}

/* =========================================
   GLOBAL LOADER (Processing State)
   ========================================= */
#loading-global {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.8); z-index: 3000;
  display: flex; justify-content: center; align-items: center;
}
.diya-loader { display: flex; justify-content: center; align-items: center; gap: 15px; }
.diya-item { position: relative; width: 50px; }
.diya-base { display: block; width: 100%; height: auto; }
.diya-flame {
  position: absolute; width: 20px; height: auto; left: 50%; bottom: 22px;
  transform-origin: bottom center; opacity: 1;
  animation-name: diya-wave-continuous;
  animation-duration: 1.2s;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}
.diya-item:nth-child(1) .diya-flame { animation-delay: 0s; }
.diya-item:nth-child(2) .diya-flame { animation-delay: 0.15s; }
.diya-item:nth-child(3) .diya-flame { animation-delay: 0.3s; }
.diya-item:nth-child(4) .diya-flame { animation-delay: 0.45s; }

@keyframes diya-wave-continuous {
  0%, 100% { transform: translateX(-50%) scale(0.7); opacity: 0.6; }
  50% { transform: translateX(-50%) scale(1.3); opacity: 1; }
}

/* =========================================
   CONTROLS & PREVIEWS
   ========================================= */
#controls { 
  position: absolute; bottom: 5%; width: 100%; 
  display: flex; justify-content: center; align-items: center; 
  z-index: 999; gap: 40px; 
}

#photo-capture-button, #video-capture-button {
  height: 80px; width: 80px; background-color: rgba(255,255,255,0.1);
  border-radius: 50%; cursor: pointer; transition: all 0.2s ease;
  position: relative; border: 4px solid #fff;
}
#photo-capture-button:active, #video-capture-button:active { transform: scale(0.95); }

#photo-capture-button {
  background-image: url(assets/cam.png); background-size: 50%;
  background-position: center; background-repeat: no-repeat; border-color: #d4af69; 
}
#video-capture-button { border-color: #d4af69; }

/* --- Video Button: Red Shape (::after) --- */
#video-capture-button::after {
  content: ''; 
  position: absolute; 
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 60px; height: 60px; border-radius: 50%; 
  background-color: #D42426; 
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 1; 
}

/* Rounded Rectangle shape when recording */
#video-capture-button.recording::after {
  width: 40px; height: 40px; 
  border-radius: 10px; 
  background-color: #D42426; 
  box-shadow: 0 0 10px rgba(212, 36, 38, 0.6);
}

/* --- Video Button: Text Label (::before) --- */
#video-capture-button::before {
  content: 'RECORD';
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 2;
  color: #fdeeb8; 
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  pointer-events: none; 
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

#video-capture-button.recording::before {
  content: 'STOP';
  font-size: 9px; 
  color: #ffffff; 
}

/* PREVIEW POPUP */
#video-preview-container, #photo-preview-container { 
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
  background-color: #000; z-index: 2500; 
  display: flex; justify-content: center; align-items: center; 
}

#video-preview-popup, #photo-preview-popup { 
  position: relative; width: 100%; height: 100%;
  background-image: url(assets/bg.png);
  background-size: cover; background-position: center; background-repeat: no-repeat;
}

.preview-media-wrapper { 
  position: absolute; 
  top: 55%; 
  left: 50%; 
  transform: translate(-50%, -50%);
  width: 80%; 
  height: 65%; 
  border: 4px solid #d4af69;
  border-radius: 20px;
  box-shadow: 0 0 20px rgba(212, 175, 105, 0.5); 
  background-color: #000;
  overflow: hidden;
}

#preview-video, #preview-image { width: 100%; height: 100%; object-fit: contain; }

#close-video-preview-button, #close-photo-preview-button { 
  position: absolute; 
  top: 10px; 
  right: 10px;
  width: 36px; 
  height: 36px; 
  background: rgba(0,0,0,0.6); 
  color: #fff;
  border: 2px solid #fff; 
  border-radius: 50%; 
  font-size: 20px; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  cursor: pointer; 
  z-index: 2510;
  padding: 0;
  line-height: 1;
}

#popup-actions, #photo-popup-actions { 
  position: absolute; bottom: 30px; left: 0; width: 100%;
  display: flex; justify-content: center; gap: 20px;
  z-index: 2505;
}

.popup-cta-button { 
  padding: 12px 30px;
  background: linear-gradient(to bottom, #cfa662, #aa8645);
  box-shadow: 0 4px 10px rgba(170, 134, 69, 0.4);
  color: #2a1f0b;
  border: none; border-radius: 50px;
  font-family: 'Roboto', sans-serif; font-weight: 700; text-transform: uppercase;
  cursor: pointer; transition: all 0.2s ease;
}
.popup-cta-button:active { transform: scale(0.95); }

.poweredbysnap-logo { position: absolute; bottom: 15px; left: 15px; z-index: 2; }
.poweredbysnap-logo > img { width: 100px; opacity: 0.8; }
#switch-cam { display: none; }
