* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #000;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "Courier New", monospace;
  color: white;
  overflow: hidden;
  position: relative;
}

/* Léger effet écran rétro */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035),
    rgba(255, 255, 255, 0.035) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.18;
  z-index: 50;
}

/* =============================== */
/* LOADING */
/* =============================== */

.loading-container {
  text-align: left;
  transform: scale(1.4);
  position: relative;
  z-index: 2;
  transition:
    opacity 1.4s ease,
    filter 1.4s ease,
    transform 1.4s ease;
}

.loading-container.fade-out {
  opacity: 0;
  filter: blur(10px);
  transform: scale(1.32);
  pointer-events: none;
}

.loading-text {
  font-size: 18px;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.progress-bar {
  width: 420px;
  height: 34px;
  border: 4px solid white;
  background-color: black;
  padding: 4px;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background-color: white;
  transition: width 0.5s linear;
  position: relative;
  z-index: 2;
}

.progress-empty-effect {
  position: absolute;
  top: 4px;
  bottom: 4px;
  right: 4px;
  overflow: hidden;
  z-index: 1;
  opacity: 0.8;
}

.progress-empty-effect::before {
  content: "";
  position: absolute;
  inset: -20px;
  background: repeating-linear-gradient(
    45deg,
    transparent 0px,
    transparent 14px,
    rgba(255, 255, 255, 0.35) 14px,
    rgba(255, 255, 255, 0.35) 20px
  );
  animation: loadingMoveDiagonal 0.8s linear infinite;
}

@keyframes loadingMoveDiagonal {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(28px);
  }
}

.percent-text {
  margin-top: 14px;
  font-size: 16px;
  opacity: 0.85;
  text-align: center;
}

.read-content {
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  animation: readContentAppear 1.8s ease forwards;
}

@keyframes readContentAppear {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.read-advice {
  font-family: 'Libre Baskerville', serif;
  font-size: clamp(18px, 1.5vw, 24px);
  line-height: 1.6;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 38px;
  letter-spacing: 0.3px;
}

.read-button {
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.38);

  padding: 13px 38px;
  font-family: 'Libre Baskerville', serif;
  font-size: clamp(18px, 1.4vw, 24px);
  font-weight: 400;
  letter-spacing: 4px;

  cursor: pointer;
  transition:
    color 0.4s ease,
    border-color 0.4s ease,
    background 0.4s ease,
    transform 0.3s ease,
    opacity 0.4s ease;
}

.read-button:hover {
  color: rgba(255, 255, 255, 1);
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.045);
  transform: translateY(-2px);
}

.read-button:active {
  transform: translateY(0);
}

/* =============================== */
/* BOUTON LIRE */
/* =============================== */

.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.read-screen {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 30;
  transition: opacity 1.5s ease, visibility 1.5s ease;
}

.read-screen.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.read-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* =============================== */
/* LECTURE DE LA LETTRE */
/* =============================== */

.letter-screen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 40;
  overflow: hidden;
  transition: opacity 1.5s ease, visibility 1.5s ease;
}

.letter-screen.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.letter-window {
  position: relative;
  width: min(1150px, 92vw);
  height: 100vh;
  margin: 0 auto;
  overflow: hidden;
}

.letter-text {
  position: absolute;
  top: 60%;
  left: 0;
  width: 100%;
  transform: translateY(0);
  font-family: 'Libre Baskerville', serif;
  font-size: clamp(18px, 2vw, 28px);
  line-height: 1.2;
  letter-spacing: 0.5px;
  text-align: center;
  opacity: 0;
}

.letter-text.play {
  animation: textFadeIn 0.8s ease forwards, scrollLetter 300s linear forwards;
}

.letter-text p {
  margin-bottom: 42px;
}

/* Apparition douce du texte */
@keyframes textFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Vitesse du défilement */
@keyframes scrollLetter {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(calc(-100% - 100vh));
  }
}

/* Dégradés haut et bas pour effacer le texte */
.fade {
  position: fixed;
  left: 0;
  width: 100%;
  height: 29vh;
  pointer-events: none;
  z-index: 45;
}

.fade-top {
  top: 0;
  background: linear-gradient(
    to bottom,
    #000 0%,
    rgba(0, 0, 0, 0.92) 32%,
    rgba(0, 0, 0, 0) 100%
  );
}

.fade-bottom {
  bottom: 0;
  background: linear-gradient(
    to top,
    #000 0%,
    rgba(0, 0, 0, 0.92) 95%,
    rgba(0, 0, 0, 0) 100%
  );
}

/* =============================== */
/* RESPONSIVE */
/* =============================== */

@media (max-width: 600px) {
  .loading-container {
    transform: scale(0.9);
  }

  .progress-bar {
    width: 320px;
  }

  .letter-window {
    width: 86vw;
  }

  .letter-text {
    font-size: 18px;
    line-height: 1.8;
  }
}

/* =============================== */
/* BOUTON PAUSE */
/* =============================== */


.pause-button {
  position: fixed;
  top: 22px;
  left: 22px;
  z-index: 60;

  background: rgba(0, 0, 0, 0.65);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.75);

  padding: 10px 18px;
  font-family: "Courier New", monospace;
  font-size: 14px;
  letter-spacing: 2px;

  cursor: pointer;
  opacity: 0.75;

  transition:
    opacity 0.25s ease,
    background 0.25s ease,
    color 0.25s ease,
    transform 0.2s ease;
}

.pause-button:hover {
  opacity: 1;
  background: white;
  color: black;
  transform: scale(1.04);
}

.pause-button.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pause-button.visible {
  opacity: 0.75;
  visibility: visible;
  pointer-events: auto;
}

/* Classe qui met l'animation du texte en pause */
.letter-text.paused {
  animation-play-state: paused;
}


.final-black-screen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  display: flex;
  justify-content: center;
  align-items: center;

  transition: opacity 4s ease, visibility 4s ease;
}

.final-black-screen.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.final-message {
  color: white;
  font-family: 'Libre Baskerville', serif;
  font-size: clamp(20px, 2.2vw, 36px);
  font-weight: 400;
  letter-spacing: 1px;
  line-height: 1.6;
  text-align: center;

  opacity: 0;
  transform: translateY(10px);
}

/* Message final : apparaît, reste, puis disparaît */
.final-black-screen.visible .final-message {
  animation: finalMessageAppearThenDisappear 8s ease forwards;
  animation-delay: 6s;
}

@keyframes finalMessageAppearThenDisappear {
  0% {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(6px);
  }

  25% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }

  70% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-8px);
    filter: blur(6px);
  }
}

/* Curseur + FIN */
.final-ending {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  font-family: "Courier New", monospace;
  font-size: clamp(28px, 3vw, 48px);
  letter-spacing: 6px;
  color: white;

  opacity: 0;
  visibility: hidden;
}

.final-ending.visible {
  opacity: 1;
  visibility: visible;
}

.final-typed-text {
  display: inline-block;
}

.final-cursor {
  display: inline-block;
  opacity: 0;
}