* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  background: #ffbeda;
  font-family: "Comic Sans MS", cursive;
  color: #ff3399;
  text-align: center;
}

body {
  background: #ffbeda;
  font-family: "Comic Sans MS", cursive;
  text-align: center;
  padding: 20px;
  color: #ff3399;
  
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1, #mainTitle {
  font-size: 6vw;
  margin-bottom: 20px;
  padding: 0 10px;
}

/* Polaroid (modo câmera) */
#polaroidContainer {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: white;
  border: 8px solid #ff99cc;
  padding: 10px;
  margin: 20px auto;
  width: 100%;
  max-width: 90vw;
  box-shadow: 0 0 25px rgba(255, 105, 180, 0.5);
  border-radius: 20px;
}

#mainVideoWrapper {
  width: 100%;
  max-width: 90vw;
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

#mainVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  filter: none;
  border-radius: 12px;
  display: block;
}

/* Controles */
#arrowControls {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.arrow {
  font-size: 8vw;
  color: #ff69b4;
  cursor: pointer;
  user-select: none;
  padding: 10px 20px;
  border-radius: 50%;
  border: 4px solid #ff99cc;
  background-color: #ffe6f0;
  box-shadow: 0 5px 10px rgba(255, 105, 180, 0.3);
  transition: all 0.3s ease;
}

.arrow:hover {
  background-color: #ffccdd;
  transform: scale(1.1);
}

/* Botões gerais */
#saveButton,
#downloadButton,
#newPhotoButton,
#startButton,
#toggleCameraButton {
  width: 90%;
  max-width: 220px;
  padding: 14px 22px;
  background-color: #ff66aa;
  border: none;
  border-radius: 8px;
  font-size: 4vw;
  color: white;
  cursor: pointer;
  box-shadow: 0 5px #cc3366;
  z-index: 9999;
  transition: background-color 0.3s, transform 0.2s;
  margin: 10px auto;
}

#saveButton:hover,
#downloadButton:hover,
#newPhotoButton:hover,
#startButton:hover,
#toggleCameraButton:hover {
  background-color: #ff3399;
  transform: translateY(-2px);
}

/* Esconde por padrão */
#toggleCameraButton {
  display: none;
}

/* Versão mobile do botão de câmera */
@media (max-width: 767px) {
  #toggleCameraButton {
    display: inline-block;
    background-color: #ff66aa;
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 28px;
    line-height: 60px;
    text-align: center;
    margin: 15px auto 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s;
  }

  #toggleCameraButton:hover {
    background-color: #ff3399;
  }
}

/* Foto final */
#photoView {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-wrap: wrap;
  padding: 10px;
  gap: 10px;
}

#finalPhoto {
  position: absolute;
  top: 90px;
  left: 100px;
  width: 300px;
  z-index: 1;
  border: none;
}

/* FLASH OVERLAY */
#flashOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

/* FINAL POLAROID COM ROTAÇÃO */
#finalPolaroid {
  padding: 10px;
  display: inline-block;
  transform: rotate(-10deg) scale(0.8);
  opacity: 0;
  transition: transform 0.6s ease, opacity 0.6s ease;
  margin: 20px auto;
}

#finalPolaroid.show {
  transform: rotate(-5deg) scale(1);
  opacity: 1;
}

#finalPolaroid img {
  width: 100%;
  height: auto;
  display: block;
}

/* Filtros com overlay */
.filterOverlay,
#overlayDreamy,
#overlayGlitter {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 10;
}

.filterOverlay {
  mix-blend-mode: overlay;
}

#overlayDreamy {
  mix-blend-mode: screen;
  background: radial-gradient(circle at center, rgba(255,200,255,0.2), rgba(200,200,255,0.1));
}

#overlayGlitter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  font-size: 40px;
  color: rgba(255, 255, 255, 0.6);
  mix-blend-mode: screen;
}

/* Animação polaroid */
#polaroidWrapper {
  animation: enterPolaroid 0.6s ease forwards;
  transform-origin: center;
  width: 100%;
  max-width: 90vw;
  height: auto;
  position: relative;
  aspect-ratio: 1 / 1;
}

#polaroidWrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

@keyframes enterPolaroid {
  0% {
    transform: rotate(-10deg) scale(0.8);
    opacity: 0;
  }
  100% {
    transform: rotate(-5deg) scale(1);
    opacity: 1;
  }
}

#polaroidFrame {
  position: relative;
  width: 100%;
  z-index: 2;
  pointer-events: none;
}

/* Media Query: Desktop (estilo restaurado e proporções fixas) */
@media (min-width: 768px) {
  h1, #mainTitle {
    font-size: 36px;
  }

  #polaroidContainer {
    width: 600px;
    margin: 0 auto;
    padding: 20px 30px;
    border-width: 12px;
  }

  #mainVideoWrapper {
    width: 600px;
    height: 600px;
    aspect-ratio: unset;
    margin: 0 auto;
  }

  #mainVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translate(0, 0) scaleX(-1);
    position: relative;
  }

  .arrow {
    font-size: 50px;
    padding: 10px 20px;
  }

  #saveButton,
  #downloadButton,
  #newPhotoButton,
  #startButton {
    font-size: 18px;
    padding: 14px 22px;
    max-width: 220px;
  }

  #toggleCameraButton {
    font-size: 24px;
    display: none;
  }

  #finalPolaroid img {
    width: 300px;
  }

  #photoView img {
    max-width: 500px;
  }

  #polaroidWrapper {
    width: 600px;
    height: 600px;
    margin: 0 auto;
  }

  #polaroidWrapper img {
    object-fit: contain;
  }
}

.fadeOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: black;
  opacity: 1;
  transition: opacity 3s ease;
  z-index: 5;
  border-radius: 12px;
}


/* Menu lateral retrô */
#sidebarMenu {
  position: fixed;
  top: 60px;
  left: 0;
  background: #ffe0f0;
  border-right: 3px dotted #ff99cc;
  padding: 10px 15px;
  z-index: 10000;
  font-family: "Comic Sans MS", cursive;
  text-align: left;
  width: 150px;
}

#sidebarMenu h2 {
  font-size: 16px;
  color: #ff3399;
  margin-bottom: 5px;
}

#sidebarMenu ul {
  list-style: square;
  padding-left: 15px;
  margin: 0;
}

#sidebarMenu li {
  margin: 5px 0;
}

#sidebarMenu a {
  color: #ff3399;
  text-decoration: underline;
  font-size: 14px;
}

/* Ad banner retrô */
#adBanner {
  font-family: "Comic Sans MS", cursive;
  background: #fff0f8;
  border-top: 2px dashed #ff99cc;
  padding: 10px;
  margin-top: 30px;
  font-size: 14px;
}

/* Em construção */
#underConstruction {
  background-color: #ffe4ec;
  padding: 8px;
  font-family: "Comic Sans MS", cursive;
  margin-top: 20px;
  border-top: 2px dotted #ff99cc;
  border-bottom: 2px dotted #ff99cc;
}

/* Best viewed */
#bestViewed {
  margin-top: 30px;
  font-family: "Comic Sans MS", cursive;
  font-size: 12px;
  color: #999;
  background: #fff8fc;
  padding: 5px;
}

/* Blink fallback */
blink {
  animation: blinkAnim 1s step-start infinite;
}
@keyframes blinkAnim {
  50% {
    opacity: 0;
  }
}
.glitter-star {
  position: fixed;
  width: 24px;
  height: 24px;
  background-image: url('images/star.gif');
  background-size: cover;
  background-repeat: no-repeat;
  z-index: 99999;
  pointer-events: none;
}
