body {
  background-color: #807f76;
  background-image: url("https://www.transparenttextures.com/patterns/greyzz.png");
  margin: 0;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

#flipbook {
  width: 900px;
  height: auto;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);

  object-fit: cover;
}

#flipbook .page,
#flipbook .hard {
  background-color: #fff;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.1);
  border: 1px solid #e0e0e0;
  overflow: hidden;
}

/* Стили для изображений страниц */
.page img,
.hard img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Обложки */
.hard {
  background: #2c3e50;
}

@media (max-width: 940px) {
  #flipbook {
    width: 100%;
    height: auto;
  }
}

/* Модальное окно */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  animation: fadeIn 0.3s;
}

.modal-content {
  position: relative;
  margin: auto;
  width: 80%;
  max-width: 900px;
  animation: slideDown 0.3s;
}

.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 соотношение */
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Кнопка закрытия */
.close-btn {
  position: absolute;
  right: -40px;
  top: -40px;
  color: #fff;
  font-size: 35px;
  font-weight: bold;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.3s;
}

.close-btn:hover {
  color: #f1c40f;
  transform: rotate(90deg);
}

/* Кнопка открытия видео на странице */
.video-button {
  display: inline-block;

  padding: 15px 30px;
  position: absolute;
  bottom: 20px;
  right: 30px;
  opacity: 0;
  color: white;
  width: 160px;
  height: 260px;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition:
    transform 0.3s,
    box-shadow 0.3s;
}

.video-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.video-button:active {
  transform: translateY(-1px);
}

/* Анимации */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: auto;
    margin-top: 50%;
  }

  .close-btn {
    right: 10px;
    top: -50px;
  }
}

/* Добавьте в конец файла style.css */
@media (max-width: 768px) {
  body {
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
  }

  #flipbook {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
  }

  #flipbook .page {
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
  }

  /* Чтобы изображения правильно отображались в портретном формате */
  .page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #fff;
  }

  /* Уменьшаем кнопку видео на мобильных */
  .video-button {
    width: 125px;
    height: 200px;
    padding: 0;
    bottom: 250px;
    left: 230px;

    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;

    opacity: 0;
  }

  /* Скрываем текст кнопки, оставляем только иконку */
  .video-button {
    text-indent: -9999px;
    position: relative;
  }

  .video-button::before {
    content: "🎬";
    position: absolute;
    text-indent: 0;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
  }

  .video-button:hover {
    transform: scale(1.05);
  }
}

/* Для очень маленьких экранов (iPhone SE, 375px и меньше) */
@media (max-width: 380px) {
  body {
    padding: 8px;
  }

  .video-button {
    width: 44px;
    height: 44px;
    bottom: 20px;
    right: 10px;
    opacity: 0;
  }

  .video-button::before {
    font-size: 20px;
  }
}

/* Для экранов с высотой меньше ширины (альбомная ориентация на телефоне) */
@media (max-width: 768px) and (orientation: landscape) {
  #flipbook .page img {
    object-fit: cover;
  }

  .video-button {
    width: 44px;
    height: 44px;
    opacity: 0;
  }
}

/* Улучшаем модальное окно на мобильных */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: auto;
    margin-top: 50%;
  }

  .close-btn {
    right: 5px;
    top: -45px;
    font-size: 32px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .close-btn:hover {
    transform: rotate(90deg);
  }

  .video-container {
    border-radius: 12px;
  }
}

/* Стили для сенсорного управления */
@media (hover: none) and (pointer: coarse) {
  .video-button {
    opacity: 0.95;
  }

  /* Увеличиваем область нажатия для кнопок */
  .video-button {
    min-width: 48px;
    opacity: 0;
    min-height: 48px;
  }
}
