/* Reset e configurações base */
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  width: 100vw;
  background: #16171a;
  color: #f1f3f4;
  font-family: Helvetica, Arial, sans-serif;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

/* Layout principal */
section {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
}

/* Painel de pontuação */
#score-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 15px 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  position: relative;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 80px;
}

.score-label {
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-value {
  font-size: 1.8em;
  font-weight: bold;
  color: #fff;
  font-family: 'Courier New', monospace;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Animação para valores que mudam */
.score-value.updated {
  animation: scoreUpdate 0.6s ease-out;
}

@keyframes scoreUpdate {
  0% {
    transform: scale(1);
    color: #fff;
  }
  50% {
    transform: scale(1.2);
    color: #4CAF50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
  }
  100% {
    transform: scale(1);
    color: #fff;
  }
}

/* Container do vídeo */
#liveView {
  flex: 1 1 auto;
  position: relative;
  width: 100vw;
  height: 75vh;
  min-height: 320px;
  background: #222;
  margin: 0;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Webcam */
#webcam {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: rotateY(180deg);
  z-index: 1;
  background: #111;
}

/* Canvas de overlay */
.output_canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  transform: rotateY(180deg);
}

/* Botão da webcam */
#webcamButton {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

/* Texto de início */
#info-start {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 2.5em;
  font-family: monospace;
  z-index: 20;
}

/* Status de hoje completado */
#today-status {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}

#today-completed-message {
  background: rgba(76, 175, 80, 0.9);
  color: white;
  padding: 12px 20px;
  border-radius: 25px;
  font-size: 1.2em;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  animation: pulseGreen 2s ease-in-out infinite;
}

@keyframes pulseGreen {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  }
  50% {
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.6);
  }
}

/* Timer do sorriso */
#smile-timer {
  position: absolute;
  bottom: 62px;
  /* Deixe espaço para o botão, ajuste conforme necessário */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.4em;
  border-radius: 9px;
  padding: 7px 15px;
  font-family: monospace;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.30);
}

/* Barra de progresso */
#smile-progress {
  width: 80%;
  height: 20px;
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  background: rgba(255, 255, 255, 0.3);
  /* fallback */
  border-radius: 8px;
  overflow: hidden;
  appearance: none;
}

/* Chrome, Safari, Opera (Webkit) */
#smile-progress::-webkit-progress-bar {
  background-color: rgba(255, 255, 255, 0.3);
}

#smile-progress::-webkit-progress-value {
  background-color: #fff;
}

/* Firefox */
#smile-progress::-moz-progress-bar {
  background-color: #fff;
}

#smile-progress::-moz-progress-bar,
#smile-progress::-moz-progress-bar {
  background-color: #fff;
}

#smile-progress {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Edge, IE */
#smile-progress::-ms-fill {
  background-color: #fff;
  border-radius: 8px;
}

/* Remove a borda azul padrão no Chrome */
#smile-progress:focus {
  outline: none;
  box-shadow: none;
}

/* Texto da barra de progresso */
#smile-progress-text {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #222;
  /* Cor do texto, combine com o fundo da barra para contraste */
  font-size: 1em;
  font-weight: bold;
  pointer-events: none;
  z-index: 30;
  /* acima do progress */
  user-select: none;
  text-shadow: 0 1px 6px rgba(255, 255, 255, 0.6);
  /* opcional para melhor contraste */
}

/* Modal fullscreen */
#fullscreenModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  z-index: 9999;
  align-items: center;
  text-align: center;
  justify-content: center;
  flex-direction: column;
}

#celebration-content {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  max-width: 500px;
  width: 90%;
}

#celebration-title {
  font-size: 2.5em;
  margin-bottom: 10px;
  animation: bounce 1s ease-in-out;
}

#celebration-message {
  font-size: 1.2em;
  margin-bottom: 30px;
  opacity: 0.9;
}

#celebration-stats {
  display: flex;
  justify-content: space-around;
  margin: 30px 0;
  gap: 20px;
}

.celebration-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.celebration-stat .stat-number {
  font-size: 3em;
  font-weight: bold;
  color: #000000;
  font-family: 'Courier New', monospace;
  text-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.celebration-stat .stat-label {
  font-size: 0.9em;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Botão de ajuda */
.help-btn {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  font-weight: bold;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.help-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.help-btn:focus {
  outline: 2px solid #4CAF50;
  outline-offset: 2px;
}

/* Media queries para responsividade */
@media (max-width: 700px) {
  #liveView {
    min-height: 180px;
    height: 45vh;
  }
  
  #score-panel {
    gap: 15px;
    padding: 10px 15px;
  }
  
  .score-item {
    min-width: 60px;
  }
  
  .score-value {
    font-size: 1.4em;
  }
  
  .score-label {
    font-size: 0.8em;
  }
  
  #celebration-content {
    padding: 30px 20px;
  }
  
  #celebration-title {
    font-size: 2em;
  }
  
  #celebration-stats {
    flex-direction: column;
    gap: 15px;
  }
  
  .celebration-stat .stat-number {
    font-size: 2.5em;
  }
}
