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

html, body {
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
}

body {
  font-family: 'Montserrat', sans-serif;
  background: #0a0a0a;
  color: #f5f0e8;
  -webkit-text-size-adjust: 100%;
}

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Telas de mensagem */
.message-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a1510 0%, #0a0a0a 70%);
  transition: opacity 1.2s ease, visibility 1.2s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.message-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.message-content {
  text-align: center;
  padding: 1.5rem 1.25rem;
  max-width: 560px;
  width: 100%;
}

.message-label {
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #a89070;
  margin-bottom: 1rem;
}

.message-date {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  color: #c9a882;
  margin-bottom: 2rem;
}

.message-body {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.05rem, 4.2vw, 1.45rem);
  line-height: 1.7;
  color: #e8ddd0;
  margin-bottom: 2rem;
}

.message-body p + p {
  margin-top: 1.25rem;
}

.message-body em {
  font-style: italic;
  color: #f5f0e8;
}

.message-sign {
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: #8a7a68;
  margin-bottom: 2rem;
}

.message-sign strong {
  color: #c9a882;
  font-weight: 400;
}

.start-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #f5f0e8;
  background: transparent;
  border: 1px solid #a89070;
  padding: 0.9rem 1.75rem;
  min-height: 48px;
  cursor: pointer;
  transition: background 0.4s ease, color 0.4s ease;
  width: 100%;
  max-width: 280px;
}

.end-screen {
  z-index: 110;
}

.end-screen[hidden] {
  display: none;
}

.start-btn:hover {
  background: #a89070;
  color: #0a0a0a;
}

.start-btn-outline {
  margin-top: 0.5rem;
}

.start-btn-outline:hover {
  background: transparent;
  color: #a89070;
}

.end-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.exit-btn {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 20;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a89070;
  background: rgba(10, 10, 10, 0.65);
  border: 1px solid rgba(168, 144, 112, 0.5);
  padding: 0.55rem 0.9rem;
  min-height: 40px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.3s ease, color 0.3s ease;
}

.exit-btn:hover {
  background: #a89070;
  color: #0a0a0a;
}

/* Slideshow */
.slideshow {
  position: fixed;
  inset: 0;
  opacity: 0;
  transition: opacity 1.5s ease;
  min-height: 100dvh;
}

.slideshow.active {
  opacity: 1;
}

.slides-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
  z-index: 1;
}

.slide.active {
  opacity: 1;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0a0a0a;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 10, 0.2) 0%,
    transparent 15%,
    transparent 85%,
    rgba(10, 10, 10, 0.35) 100%
  );
  pointer-events: none;
}

.progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 15;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: #a89070;
  transition: width 0.1s linear;
}

.slide-counter {
  display: none;
}

.controls {
  position: absolute;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.control-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(168, 144, 112, 0.7);
  background: rgba(10, 10, 10, 0.55);
  color: #f5f0e8;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.3s ease, color 0.3s ease;
  flex-shrink: 0;
}

.control-btn-main {
  font-size: 1rem;
}

.control-btn:hover {
  background: #a89070;
  color: #0a0a0a;
}

.music-box {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.yt-wrap {
  position: fixed;
  width: 200px;
  height: 200px;
  left: -9999px;
  top: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Celular */
@media (max-width: 600px) {
  .message-label {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
  }

  .message-date {
    font-size: 1.15rem;
    margin-bottom: 1.5rem;
  }

  .message-body {
    line-height: 1.65;
    margin-bottom: 1.5rem;
  }

  .message-sign {
    margin-bottom: 1.5rem;
  }

  .message-content {
    padding: 1rem 0.75rem;
  }

  .controls {
    gap: 1.25rem;
  }

  .control-btn {
    width: 52px;
    height: 52px;
  }
}

/* Telas muito baixas (celular deitado) */
@media (max-height: 500px) and (orientation: landscape) {
  .message-screen {
    align-items: flex-start;
    padding-top: 0.75rem;
  }

  .message-content {
    padding: 0.75rem 1rem;
  }

  .message-body {
    font-size: 1rem;
    margin-bottom: 1rem;
  }

  .message-sign {
    margin-bottom: 1rem;
  }

  .controls {
    bottom: max(0.5rem, env(safe-area-inset-bottom));
  }

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

/* Telas largas */
@media (min-width: 768px) {
  .start-btn {
    width: auto;
    max-width: none;
    padding: 1rem 2.5rem;
  }
}
