/* =========================
   STORY COVER
========================= */

.story-cover {
  max-width: 900px;
  margin: 30px auto 10px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}

/* =========================
   CAROUSEL (FIXED)
========================= */

.carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
}

/* shared image style */
.cover-img,
.carousel-img {
  width: 100%;
  height: 360px;
  object-fit: cover;
}

/* hide all carousel images */
.carousel-img {
  display: none;
}

/* show only active image */
.carousel-img.active {
  display: block;
}

/* carousel buttons */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  color: #fff;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 22px;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 5;
}

.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }

/* =========================
   STORY TITLE
========================= */

.story-title {
  text-align: center;
  font-size: 36px;
  font-weight: 700;
  margin: 24px auto 18px;
  color: #3b2f1c;
  max-width: 760px;
  font-family: 'Comic Neue', cursive;
  position: relative;
}

/* decorative underline */
.story-title::after {
  content: "";
  display: block;
  width: 80px;
  height: 4px;
  background: #e6b566;
  margin: 14px auto 0;
  border-radius: 2px;
}

/* =========================
   STORY BOOK WRAPPER
========================= */

.story-book {
  max-width: 900px;
  margin: 0 auto;
}

/* =========================
   BOOK PAGE
========================= */

.book-page {
  background: #fffaf0;
  border: 3px solid #222;
  border-radius: 18px;
  padding: 36px;
  box-shadow: 8px 8px 0 #222;
  min-height: 360px;
  max-width: 760px;
  margin: auto;
  position: relative;
  overflow: visible;
  font-family: 'Comic Neue', cursive;
}

/* Paragraphs as comic panels */
.book-page p {
  background: #ffffff;
  border: 2px solid #333;
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 18px;
  position: relative;
  font-size: 18px;
  line-height: 1.7;
}

/* Speech bubble tail */
.book-page p::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 28px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-left: 2px solid #333;
  border-bottom: 2px solid #333;
  transform: rotate(45deg);
}

/* =========================
   PAGE CONTROLS
========================= */

.page-controls {
  max-width: 760px;
  margin: 20px auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-controls button {
  font-family: 'Comic Neue', cursive;
  font-size: 16px;
  border: 2px solid #222;
  border-radius: 999px;
  padding: 10px 18px;
  box-shadow: 4px 4px 0 #222;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
}

.page-controls button:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #222;
}

#pageIndicator {
  font-size: 14px;
  color: #6b4f2a;
}

/* =========================
   STORY ACTIONS
========================= */

.story-actions {
  max-width: 760px;
  margin: 30px auto 0;
  text-align: center;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  background: #fff;
  color: #7a4a00;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #f1d39a;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  transition: all 0.25s ease;
}

.back-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0,0,0,0.15);
  background: #fff7e6;
}

/* =========================
   COMIC STICKERS
========================= */

.comic-sticker {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #ffeb3b;
  color: #000;
  font-weight: 900;
  font-size: 20px;
  padding: 10px 14px;
  border-radius: 50%;
  border: 4px solid #000;
  box-shadow: 6px 6px 0 #000;
  transform: rotate(-10deg);
  z-index: 9999;
  animation: pop 0.4s ease-out;
}

.sticker-wow { background: #ff5c5c; color: #fff; }
.sticker-pow { background: #4dd0e1; }
.sticker-bam { background: #a5d6a7; }
.sticker-boom { background: #ffd54f; }

@keyframes pop {
  0% { transform: scale(0) rotate(-20deg); }
  80% { transform: scale(1.2) rotate(10deg); }
  100% { transform: scale(1) rotate(-12deg); }
}

/* =========================
   NIGHT MODE
========================= */

body.night-mode {
  background: #121212;
  color: #e8e8e8;
}

body.night-mode .story-title {
  color: #f5d7a1;
}

body.night-mode .book-page {
  background: #1e1e1e;
  border-color: #555;
  box-shadow: 8px 8px 0 #000;
}

body.night-mode .book-page p {
  background: #2a2a2a;
  color: #eee;
  border-color: #666;
}

body.night-mode .book-page p::after {
  background: #2a2a2a;
  border-color: #666;
}

body.night-mode .story-cover {
  box-shadow: 0 12px 28px rgba(0,0,0,0.8);
}

/* =========================
   MOBILE RESPONSIVE
========================= */

@media (max-width: 768px) {

  .story-cover {
    margin: 20px 14px 10px;
    border-radius: 18px;
  }

  .cover-img,
  .carousel-img {
    height: 220px;
  }

  .story-title {
    font-size: 28px;
    margin: 18px 14px 14px;
  }

  .book-page {
    padding: 22px;
    box-shadow: 5px 5px 0 #222;
  }

  .book-page p {
    font-size: 16px;
    padding: 14px;
  }

  .page-controls {
    padding: 0 14px;
  }

  .comic-sticker {
    font-size: 14px;
    padding: 8px 10px;
    top: -14px;
    right: -14px;
  }
}