* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&display=swap');

body {
  font-family: 'Caveat', cursive;
  background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: auto;
  perspective: 1500px;
  position: relative;
  touch-action: manipulation;
}

body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(100, 150, 255, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

.instructions {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 15px;
  border-radius: 10px;
  text-align: right;
  z-index: 100;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 250px;
}

.instructions p {
  margin: 3px 0;
  font-family: 'Arial', sans-serif;
  font-size: 12px;
}

.instructions strong {
  color: #ff6b6b;
  font-weight: bold;
  font-size: 16px;
}

.scene {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-x pan-y pinch-zoom;
}

.letter-container {
  width: 500px;
  height: 650px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
  cursor: grab;
  touch-action: pan-x pan-y pinch-zoom;
}

.letter-container:active {
  cursor: grabbing;
}

.letter-side {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  padding: 40px;
  transition: all 0.3s ease;
}

/* Frente da carta */
.letter-front {
  background: linear-gradient(135deg, #fffaf0 0%, #fef5e7 100%);
  border: 2px solid #d4af37;
  z-index: 2;
  font-family: 'Caveat', cursive;
}

.letter-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid #d4af37;
}

.stamp {
  font-size: 50px;
  transform: rotate(-15deg);
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.2));
}

.address {
  text-align: right;
  font-size: 14px;
  color: #8b4513;
  line-height: 1.6;
  font-style: italic;
}

.letter-content {
  position: relative;
  z-index: 1;
}

.date {
  text-align: right;
  font-size: 13px;
  color: #666;
  margin-bottom: 20px;
  font-style: italic;
}

.greeting {
  font-size: 20px;
  color: #2c3e50;
  margin-bottom: 15px;
  font-weight: 700;
}

.body-text {
  font-size: 18px;
  color: #2c3e50;
  line-height: 1.6;
  margin-bottom: 12px;
  text-align: left;
}

.hidden-help-message {
  text-align: center;
  margin: 0 0 20px 0;
  padding: 10px 0;
}

.urgent-hidden {
  font-size: 28px;
  font-weight: bold;
  color: transparent;
  margin: 8px 0;
  letter-spacing: 2px;
  transition: all 0.5s ease;
}

body.blacklight-on .urgent-hidden {
  color: #ff0080;
  text-shadow:
    0 0 10px #ff0080,
    0 0 20px #ff0080,
    0 0 30px #ff0080,
    0 0 40px #ff0080;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

.signature {
  text-align: right;
  font-size: 20px;
  color: #34495e;
  margin-top: 25px;
  font-weight: 600;
  line-height: 1.6;
}

.decorations {
  position: absolute;
  bottom: 20px;
  left: 40px;
  font-size: 24px;
}

.decorations span {
  margin: 0 5px;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

.star:nth-child(2) {
  animation-delay: 0.5s;
}

.tree {
  animation-delay: 1s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Verso da carta */
.letter-back {
  background: linear-gradient(135deg, #f5f5dc 0%, #f0e68c 100%);
  transform: rotateY(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #d4af37;
  position: relative;
  overflow: hidden;
}


.back-texture {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(255, 255, 255, 0.01) 10px,
      rgba(255, 255, 255, 0.01) 20px
    );
  pointer-events: none;
}

.hidden-message {
  position: relative;
  z-index: 1;
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  padding: 15px;
  overflow-y: auto;
  max-height: 100%;
}

.reveal-text {
  color: transparent;
  font-size: 15px;
  line-height: 1.8;
  margin: 8px 0;
  text-shadow: none;
  transition: all 0.5s ease;
  text-transform: uppercase;

}

.reveal-text.emphasis {
  font-weight: bold;
  font-size: 16px;
  text-transform: uppercase;

}

.reveal-text.final {
  font-size: 17px;
  margin-top: 15px;
  text-transform: uppercase;

}

/* Efeito de luz negra */
body.blacklight-on .letter-front {
  background: linear-gradient(135deg, #1a0033 0%, #0d001a 100%);
  border-color: #4a0080;
  box-shadow: 0 0 40px rgba(138, 43, 226, 0.6);
}

body.blacklight-on .letter-front .body-text,
body.blacklight-on .letter-front .greeting,
body.blacklight-on .letter-front .signature,
body.blacklight-on .letter-front .date,
body.blacklight-on .letter-front .address {
  color: rgba(100, 100, 255, 0.2) !important;
  text-shadow: 0 0 5px rgba(100, 100, 255, 0.3);
}

body.blacklight-on .stamp {
  opacity: 0.2;
}

body.blacklight-on .letter-back {
  background: linear-gradient(135deg, #0a0015 0%, #000000 100%);
  border-color: #4a0080;
  box-shadow: 0 0 40px rgba(138, 43, 226, 0.6);
  font-family: 'Arial', sans-serif;
}

body.blacklight-on .hidden-message {
  opacity: 1;
}

body.blacklight-on .reveal-text {
  color: #00ff88;
  font-family: 'Covered By Your Grace', cursive;
  text-shadow:
    0 0 10px #00ff88,
    0 0 20px #00ff88,
    0 0 30px #00ff88,
    0 0 40px #00cc66;
  animation: glow 2s ease-in-out infinite alternate;
}

body.blacklight-on .reveal-text.emphasis {
  color: #00ff88;
  font-family: 'Covered By Your Grace', cursive;
  text-shadow:
    0 0 10px #00ff88,
    0 0 20px #00ff88,
    0 0 30px #00ff88,
    0 0 40px #00cc66;
    text-transform: uppercase;

}

body.blacklight-on .reveal-text.final {
  color: #00ff88;
  font-family: 'Covered By Your Grace', cursive;
  text-shadow:
    0 0 10px #00ff88,
    0 0 20px #00ff88,
    0 0 30px #00ff88;
    text-transform: uppercase;

}

@keyframes glow {
  from {
    text-shadow:
      0 0 10px currentColor,
      0 0 20px currentColor,
      0 0 30px currentColor;
  }
  to {
    text-shadow:
      0 0 15px currentColor,
      0 0 25px currentColor,
      0 0 40px currentColor,
      0 0 50px currentColor;
  }
}

body.blacklight-on {
  background: linear-gradient(135deg, #000000 0%, #0a0015 50%, #1a0033 100%);
}

/* Indicador de luz negra */
.blacklight-indicator {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 12px 20px;
  border-radius: 25px;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  z-index: 100;
}

.indicator-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #666;
  transition: all 0.3s ease;
}

body.blacklight-on .indicator-dot {
  background: #00ffff;
  box-shadow:
    0 0 10px #00ffff,
    0 0 20px #00ffff;
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.indicator-text {
  font-family: 'Arial', sans-serif;
  font-size: 14px;
}

body.blacklight-on .indicator-text::after {
  content: 'Ativada';
}

body:not(.blacklight-on) .indicator-text::after {
  content: 'Desativada';
}

.indicator-text::before {
  content: 'Luz Negra: ';
}

/* Botões de controle mobile */
.mobile-controls {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  gap: 15px;
  z-index: 100;
}

.control-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  color: white;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.control-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.1);
}

.control-btn:active {
  transform: scale(0.95);
}

.control-btn.active {
  background: rgba(0, 255, 136, 0.3);
  border-color: #00ff88;
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

/* Responsividade */
@media (max-width: 768px) {
  .letter-container {
    width: 90vw;
    max-width: 350px;
    height: 480px;
  }

  .letter-side {
    padding: 20px;
  }

  .instructions {
    display: none;
  }

  .urgent-hidden {
    font-size: 20px;
  }

  .body-text {
    font-size: 16px;
    line-height: 1.5;
  }

  .greeting {
    font-size: 18px;
  }

  .signature {
    font-size: 18px;
    margin-top: 20px;
  }

  .date {
    font-size: 11px;
  }

  .address {
    font-size: 12px;
  }

  .stamp {
    font-size: 40px;
  }

  .decorations {
    font-size: 20px;
    bottom: 15px;
    left: 20px;
  }

  .reveal-text {
    font-size: 15px;
    line-height: 1.5;
    margin: 5px 0;
    text-transform: uppercase;

  }

  .hidden-message {
    padding: 10px;
  }

  .mobile-controls {
    top: 15px;
    left: 15px;
    gap: 12px;
  }

  .control-btn {
    width: 45px;
    height: 45px;
    font-size: 22px;
  }
}

@media (max-width: 480px) {
  .letter-container {
    width: 95vw;
    max-width: 320px;
    height: 500px;
  }

  .letter-side {
    padding: 12px;
  }

  .instructions {
    display: none;
  }

  .body-text {
    font-size: 14px;
  }

  .greeting {
    font-size: 16px;
  }

  .signature {
    font-size: 16px;
    margin-top: 15px;
  }

  .urgent-hidden {
    font-size: 18px;
  }

  .stamp {
    font-size: 35px;
  }

  .mobile-controls {
    top: 10px;
    left: 10px;
    gap: 10px;
  }

  .control-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .reveal-text {
    font-size: 15px;
    line-height: 1.4;
    margin: 4px 0;
    text-transform: uppercase;

  }

  .hidden-message {
    padding: 8px;
  }

  .hidden-message br {
    display: block;
    content: "";
    margin: 2px 0;
  }
}
