* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #eaeaea;
  font-family: Arial, Helvetica, sans-serif;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#book-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

/* ================= KİTAP ================= */
#book {
  position: relative;
  width: 900px;
  height: 600px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  display: flex;
  transform-origin: center center;
}

/* ================= SAYFALAR ================= */
.page {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: #fff;
}

.page.left,
.page.right {
  width: 50%;
}

.page.blank {
  background: transparent;
}

.page.single {
  width: 100%;
}

/* ================= GÖRSEL ================= */
.page img.bg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ================= VIDEO ================= */
.page.video-page video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 5;
}

/* ================= PLAY OVERLAY ================= */
.video-play-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 72px;
  color: #fff;
  background: rgba(0,0,0,0.35);
  cursor: pointer;
}

/* ================= KONTROLLER ================= */
#controls {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999999;

  display: flex;
  gap: 12px;
  align-items: center;

  background: rgba(255,255,255,0.95);
  padding: 8px 16px;
  border-radius: 22px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

#controls button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #333;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

#controls span {
  min-width: 70px;
  text-align: center;
  font-size: 14px;
}

/* ================= MOBİL ================= */
@media (max-width: 768px) {

  #book {
    width: 100%;
    height: auto;
    display: block;
    perspective: 1200px;
  }

  .page {
    width: 100%;
    height: auto;
  }

  /* ===== MOBİL CROSS-SLIDE ===== */
  .mobile-slide-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
  }

  .mobile-slide-old,
  .mobile-slide-new {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    will-change: transform, opacity;
  }

  .mobile-slide-old {
    animation: slideOldOut 0.32s ease forwards;
  }

  .mobile-slide-new {
    animation: slideNewIn 0.32s ease forwards;
  }

  @keyframes slideOldOut {
    from {
      transform: translateX(0);
      opacity: 1;
    }
    to {
      transform: translateX(-35%);
      opacity: 0;
    }
  }

  @keyframes slideNewIn {
    from {
      transform: translateX(35%);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }

  /* =========================================================
     🔴 KAPAK SAYFASI (1.jpg) – KIRPILMA ÖNLEME
     SADECE KAPAKTA DEVREYE GİRER
  ========================================================= */
  #book:has(.page.single img[src$="/1.jpg"]),
  #book:has(.page.single img[src$="1.jpg"]) {
    height: auto !important;
    overflow: visible;
  }

  #book:has(.page.single img[src$="/1.jpg"]) .page.single,
  #book:has(.page.single img[src$="1.jpg"]) .page.single {
    height: auto;
    overflow: visible;
  }

  #book:has(.page.single img[src$="/1.jpg"]) img.bg,
  #book:has(.page.single img[src$="1.jpg"]) img.bg {
    height: auto;
    max-height: none;
    object-fit: contain;
    object-position: center bottom;
  }

  /* =========================================================
     🔴 MOBİL – VİDEO SAYFASI BOYUT DÜZELTME
     KÜÇÜK DİKDÖRTGEN SORUNUNU ÇÖZER
     MEVCUT YERLEŞİME DOKUNMAZ
  ========================================================= */
  .page.video-page {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;   /* Dergi oranı */
    height: auto;
  }

  .page.video-page video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .page.video-page .video-play-overlay {
    position: absolute;
    inset: 0;
  }
}
