/*=============== GOOGLE FONTS ===============*/
@import url("https://fonts.googleapis.com/css2?family=Montserrat&display=swap");

:root {
  --primary-color: #a876aa;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Montserrat", sans-serif;
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, #cbd5ff 0%, #902680 100%);
}

h4 {
  font-size: 20px;
  margin: 5px;
  text-transform: uppercase;
  color: #fff;
}

.counter {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 200;
}

.counter.hidden {
  transform: translate(-50%, -50%) scale(0);
  animation: hide 0.2s ease-out;
}

.final {
  color: #444;
  position: fixed;
  text-align: center;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 200;
}

.final.show {
  transform: translate(-50%, -50%) scale(1);
  animation: show 0.2s ease-out;
}

.final.show h1 {
  color: #fff;
  animation: shake 1s ease infinite;
}

.nums {
  color: #fff;
  font-size: 50px;
  position: relative;
  overflow: hidden;
  width: 250px;
  height: 50px;
}

.nums span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(120deg);
  transform-origin: bottom center;
}

.nums span.in {
  transform: translate(-50%, -50%) rotate(0deg);
  animation: goIn 0.5s ease-in-out;
}

.nums span.out {
  animation: goOut 0.5s ease-in-out;
}

button#replay,
button#restart {
  border: 1px solid #fff;
  color: #fff;
  font-size: 11px;
  letter-spacing: 1px;
  background-color: transparent;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.2s ease;
}

button#replay:hover,
button#restart:hover {
  transform: translateY(-2px);
}

button#replay:active,
button#restart:active {
  transform: translateY(2px);
}
/* Botón de control de música */
.music-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--primary-color);
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.music-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.music-toggle:active {
  transform: scale(0.95);
}


.music-toggle.muted .music-icon {
  opacity: 0.5;
}

.music-toggle.muted::after {
  content: '❌';
  position: absolute;
  font-size: 16px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}



/* SecciÃ³n de fotos */
.photos-section {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 100;
  visibility: hidden;
}

.photos-section.show {
  opacity: 1;
  pointer-events: all;
  visibility: visible;
}

.photos-section.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.photo-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  padding: 20px;
  overflow-y: auto;
  gap: 20px;
}

.photo-container.active {
  opacity: 1;
  pointer-events: all;
}

.photo-wrapper {
  position: relative;
  width: 90%;
  max-width: 400px;
  height: 50vh;
  max-height: 400px;
  flex-shrink: 0;
}

.photo {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.3s ease;
  position: relative;
  overflow: hidden;
}

.photo:active {
  transform: scale(0.98);
}

.tap-hint {
  display: none;
}

.photo.breaking .tap-hint {
  display: none;
}

/* Efecto de rotura */
.shards {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.shard {
  position: absolute;
  background-size: cover;
  opacity: 0;
}

.shard.breaking {
  animation: shatter 1s ease-out forwards;
  opacity: 1;
}

/* Mensaje */
.message {
  position: static;
  transform: none;
  background: white;
  padding: 25px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
  opacity: 1;
  width: 90%;
  max-width: 400px;
  z-index: 10;
}

.message h2 {
  color: var(--primary-color);
  margin: 0 0 15px 0;
  font-size: 24px;
}

.message p {
  color: #555;
  line-height: 1.6;
  margin: 0;
  font-size: 16px;
}

.continue-hint {
  margin-top: 20px;
  padding: 12px 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-block;
}

.continue-hint:hover,
.continue-hint:active {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Final de cumpleaÃ±os */
.final-birthday {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  text-align: center;
  opacity: 0;
  transition: all 0.5s ease;
  color: white;
}

.final-birthday.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.final-birthday h1 {
  font-size: 80px;
  margin: 0;
  animation: rotate 3s infinite linear;
}

.final-birthday h2 {
  font-size: 32px;
  margin: 20px 0;
}

.final-birthday p {
  font-size: 24px;
  margin: 20px 0;
}

.final-birthday button {
  border: 2px solid white;
  color: white;
  background: transparent;
  padding: 12px 30px;
  font-size: 14px;
  margin-top: 20px;
}

/* Animaciones */
@keyframes hide {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    transform: translate(-50%, -50%) scale(0);
  }
}

@keyframes show {
  0% {
    transform: translate(-50%, -50%) scale(0);
  }
  30% {
    transform: translate(-50%, -50%) scale(1.4);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes goIn {
  0% {
    transform: translate(-50%, -50%) rotate(120deg);
  }
  30% {
    transform: translate(-50%, -50%) rotate(-20deg);
  }
  60% {
    transform: translate(-50%, -50%) rotate(10deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
}

@keyframes goOut {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  60% {
    transform: translate(-50%, -50%) rotate(20deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(-120deg);
  }
}

@keyframes shake {
  0% {
    transform: rotate(-5deg);
  }
  60% {
    transform: rotate(5deg);
  }
  100% {
    transform: rotate(-5deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes shatter {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) rotate(var(--rotation));
    opacity: 0;
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Responsive para móvil */
@media (max-width: 600px) {
  .music-toggle {
    width: 50px;
    height: 50px;
    font-size: 20px;
    top: 15px;
    right: 15px;
  }

  .photo-wrapper {
    width: 95%;
    height: 40vh;
    max-height: 350px;
  }
  
  .message {
    padding: 20px;
    width: 95%;
  }
  
  .message h2 {
    font-size: 20px;
  }
  
  .message p {
    font-size: 14px;
  }
  
  .continue-hint {
    font-size: 13px;
    padding: 10px 25px;
  }
  
  .final-birthday h1 {
    font-size: 60px;
  }
  
  .final-birthday h2 {
    font-size: 26px;
  }
  
  .final-birthday p {
    font-size: 20px;
  }
}

/* Estilos para el rasca y gana */
.scratch-section {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  padding: 20px;
  overflow-y: auto;
}

.scratch-section.show {
  opacity: 1;
  pointer-events: all;
}

.scratch-container {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.scratch-container h2 {
  text-align: center;
  color: #333;
  margin-bottom: 10px;
  font-size: 1.8em;
}

.scratch-subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 25px;
  font-size: 0.95em;
  line-height: 1.5;
}

.scratch-card {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  margin: 0 auto;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.prize-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  padding: 20px;
}

.prize-icon {
  font-size: 3.5em;
  margin-bottom: 10px;
}

.prize-text {
  color: white;
  font-size: 1.5em;
  font-weight: bold;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.prize-amount {
  color: #fff700;
  font-size: 2.5em;
  font-weight: bold;
  margin: 10px 0;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
}

.prize-message {
  color: white;
  font-size: 1.1em;
  text-align: center;
  margin-top: 5px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

#scratchCanvas {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  width: 100%;
  height: 100%;
}

.progress-container {
  margin-top: 20px;
  text-align: center;
}

.progress-container p {
  color: #666;
  margin-bottom: 10px;
  font-size: 0.9em;
}

.progress-bar {
  width: 100%;
  height: 30px;
  background: #e0e0e0;
  border-radius: 15px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  width: 0%;
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 0.8em;
}

.button-container {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-reset,
.btn-reveal {
  flex: 1;
  padding: 12px 20px;
  font-size: 0.95em;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-reset {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-reset:hover,
.btn-reset:active {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-reveal {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.btn-reveal:hover,
.btn-reveal:active {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
}

.instructions {
  text-align: center;
  color: #666;
  margin-top: 20px;
  font-size: 0.85em;
  font-style: italic;
}

.btn-restart {
  width: 100%;
  margin-top: 25px;
  padding: 15px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-restart:hover,
.btn-restart:active {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

@media (max-width: 600px) {
  .scratch-container {
    padding: 20px;
    max-height: 95vh;
  }

  .scratch-container h2 {
    font-size: 1.4em;
  }

  .scratch-subtitle {
    font-size: 0.9em;
  }

  .prize-icon {
    font-size: 2.5em;
  }

  .prize-text {
    font-size: 1.2em;
  }

  .prize-amount {
    font-size: 2.5em;
  }

  .prize-message {
    font-size: 0.95em;
  }
}