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

body {
  font-family: "Special Elite", cursive;
  color: #290916;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  
  background: url('background.jpg') no-repeat center center / cover;
  
  z-index: -2;
  transition: filter 0.8s ease;
}

body.blur-active::before {
  filter: blur(8px);
}

.intro {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 30px;
  opacity: 1;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.intro.fade-out {
  opacity: 0;
  transform: translateY(-30px);
}

.btn {
  padding: 10px 20px;
  font-size: 1rem;
  background: #9b5fd3; /* purple base */
  border: none;
  border-radius: 20px;
  cursor: pointer;
  color: #fff;
  transition: 0.5s ease, opacity 0.5s ease, transform 0.5s ease;
}

.btn:hover {
  background: #7b3ea1;
}

.btn.fade-out {
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}

.book {
  width: 80%;
  max-width: 500px;
  height: 600px;
  position: relative;
  perspective: 1200px;
}

.page {
  position: absolute;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    to bottom,
    #a084f7 0px,
    #a084f7 27px,
    #7b5fd3 28px
  );
  color: #fff;
  padding: 30px 30px 30px 70px;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
  transform-origin: left;
  backface-visibility: hidden;
  overflow: hidden;
  transition: transform 0.8s ease, opacity 0.5s ease;
}

.page.back {
  transform: rotateY(0deg) scale(0.98);
  z-index: 0;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.2);
}

.page.front {
  z-index: 1;
  opacity: 1;
}

.text {
  white-space: pre-wrap;
  font-family: "Courier New", monospace;
  line-height: 28px;
  overflow-y: auto;
  max-height: 100%;
  word-break: break-word;

  text-align: justify;
}

.page::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 25px;
  height: 100%;
  background-image: radial-gradient(circle, #1e1e2f 6px, transparent 7px);
  background-size: 25px 40px;
  background-repeat: repeat-y;
  background-position: center;
  pointer-events: none;
}

.cursor {
  display: inline-block;
  width: 2px;
  background: #fff;
  margin-left: 3px;
  animation: blink 1s infinite;
}

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

.controls {
  margin-top: 20px;
}

.controls button {
  padding: 10px 15px;
  margin: 5px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: #9b5fd3;
  color: #fff;
  transition: 0.3s;
}

.controls button:hover {
  background: #7b3ea1;
}

