*, *::before, *::after {
    box-sizing: border-box; /* Важно для предотвращения скроллов */
}

:root {
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --primary-color: #007AFF;
    --whatsapp-color: #25D366;
    --text-main: #000000;
    --text-secondary: #2c2c2e;
    
    --bg-overlay: rgba(245, 245, 247, 0.45);
    --radius-m: 16px;
    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.15);
}

html { 
    height: 100%; 
    background: url('background.jpg') no-repeat center center fixed; 
    background-size: cover; 
    background-image: linear-gradient(135deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.2) 100%), url('background.jpg');
}

body { 
    width: 100%; height: 100%; margin: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, Helvetica, Arial, sans-serif; 
    display: flex; justify-content: center; align-items: center; 
    overflow: hidden; 
}

/* Фон (Облака) */
#cloud-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.cloud { position: absolute; background: url('cloud.png') no-repeat center/contain; opacity: 0.1; transition: all 15s linear; }

/* Навигация */
.nav-glass-btn {
    position: fixed; top: 20px; left: 20px; z-index: 100;
    width: 44px; height: 44px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-main); border: 1px solid rgba(255,255,255,0.6);
    cursor: pointer; padding: 0; text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}
.nav-glass-btn:hover { transform: scale(1.1); background: #fff; }
.nav-glass-btn svg { width: 22px; height: 22px; stroke: #000; }

/* === ОСНОВНОЙ КОНТЕЙНЕР === */
.content-block { 
    position: relative; 
    width: 95%; max-width: 600px; height: 90vh; max-height: 850px;
    background: var(--bg-overlay);
    backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
    border-radius: 32px; border: 1px solid rgba(255, 255, 255, 0.5); 
    box-shadow: var(--shadow-soft);
    display: flex; flex-direction: column; 
    overflow: hidden; /* Строго обрезаем все, что вылезает */
    z-index: 10;
}

/* Хедер */
.glass-header {
    padding: 20px 30px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 100%);
    flex-shrink: 0; text-align: center; z-index: 20;
}
.glass-header h1 { margin: 0; font-size: 26px; font-weight: 800; color: #000; letter-spacing: -0.5px; }
.glass-header .subtitle { margin: 5px 0 0; color: #222; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* === ВРАППЕР ДЛЯ ВИДОВ === */
.views-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
    overflow-x: hidden; /* Запрещаем горизонтальный скролл */
}

.view-slide {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; transform: translateX(20px); pointer-events: none;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex; flex-direction: column;
}

.view-slide.active {
    opacity: 1; transform: translateX(0); pointer-events: auto; z-index: 5;
}

/* Скролл контента */
.scrollable-content {
    flex: 1; 
    overflow-y: auto; 
    overflow-x: hidden; /* Дополнительная защита */
    padding: 10px 20px 20px;
    scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.2) transparent;
}
.scrollable-content::-webkit-scrollbar { width: 4px; }
.scrollable-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 10px; }

/* === ТЕКСТЫ И КОНТЕНТ === */
.intro-text { 
    font-size: 17px; line-height: 1.5; text-align: center; margin-bottom: 20px; 
    color: #000; font-weight: 600;
}
.book-main-desc {
    font-size: 15px; line-height: 1.6; text-align: justify; 
    color: #111; margin-bottom: 20px;
    background: rgba(255,255,255,0.4); padding: 15px; border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.2);
}
.book-main-desc strong { color: #000; font-weight: 700; }

/* Видео */
.video-frame {
    position: relative; 
    width: 100%; 
    max-width: 100%; /* Ограничение ширины */
    padding-bottom: 56.25%;
    background: #000; border-radius: var(--radius-m); overflow: hidden;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    margin-bottom: 20px;
    border: 3px solid rgba(255,255,255,0.5);
}
.video-frame iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.book-highlights { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.highlight-item {
    background: rgba(255,255,255,0.8); padding: 8px 12px; border-radius: 20px;
    font-size: 13px; font-weight: 700; color: #000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
}

/* === СЛАЙДЕР === */
.modern-slider {
    position: relative;
    width: 100%; aspect-ratio: 4/3;
    border-radius: var(--radius-m);
    overflow: hidden;
    margin-bottom: 20px;
    background: #f0f0f0;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border: 3px solid rgba(255,255,255,0.5);
}

.slider-track {
    display: flex; width: 100%; height: 100%;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.slide-item {
    min-width: 100%; height: 100%; position: relative;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; background: #fff;
}
.slide-item img {
    width: 100%; height: 100%; object-fit: contain;
}

.slider-control {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.3); color: white;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; opacity: 0; transition: opacity 0.3s;
}
.modern-slider:hover .slider-control { opacity: 1; }
.slider-control.prev { left: 10px; }
.slider-control.next { right: 10px; }

.expand-icon {
    position: absolute; top: 10px; right: 10px;
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(0,0,0,0.6); color: white;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; opacity: 0; transition: opacity 0.3s;
}
.modern-slider:hover .expand-icon { opacity: 1; }
.expand-icon svg { width: 18px; height: 18px; }

/* Текстовый контент (Списки и инфо) */
.text-content h3 { font-size: 19px; margin: 0 0 10px; color: #000; font-weight: 700; }

.features-list {
    list-style: none; padding: 0; margin: 0 0 20px;
}
.features-list li {
    font-size: 15px; color: #1a1a1a; margin-bottom: 12px;
    padding-left: 20px; position: relative;
    line-height: 1.5;
}
.features-list li::before {
    content: '•'; color: var(--primary-color); font-size: 20px;
    position: absolute; left: 0; top: -3px;
}
.features-list strong { color: #000; }

.delivery-info {
    background: rgba(255,255,255,0.6); padding: 15px; border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.6);
}
.delivery-info h3 { margin-top: 0; font-size: 16px; }
.delivery-info p { margin: 5px 0; font-size: 14px; color: #222; }

/* === НИЖНЯЯ ПАНЕЛЬ === */
.bottom-bar {
    padding: 15px 20px 20px;
    background: rgba(255,255,255,0.5);
    border-top: 1px solid rgba(255,255,255,0.5);
    flex-shrink: 0;
    display: flex; flex-direction: column; gap: 10px;
}

.ios-primary-btn {
    width: 100%; padding: 14px;
    background: var(--text-main); color: white;
    border: none; border-radius: 14px;
    font-size: 16px; font-weight: 600; cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.ios-primary-btn:active { transform: scale(0.98); }
.ios-primary-btn.secondary { background: rgba(0,0,0,0.1); color: #000; box-shadow: none; border: 1px solid rgba(0,0,0,0.1); }

.whatsapp-btn {
    width: 100%; padding: 14px;
    background: var(--whatsapp-color); color: white;
    border: none; border-radius: 14px;
    font-size: 16px; font-weight: 600; cursor: pointer;
    text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 10px;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
    transform: translateY(20px); opacity: 0; height: 0; overflow: hidden; padding: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.whatsapp-btn.hidden { display: none; }
.whatsapp-btn.visible { transform: translateY(0); opacity: 1; height: auto; padding: 14px; margin-top: 0; }
.whatsapp-btn svg { width: 20px; height: 20px; }

/* === МОДАЛЬНОЕ ОКНО (ВОЗВРАЩЕННЫЙ СТИЛЬ) === */
#image-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}
#image-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Обертка для изображения */
.modal-image-wrapper {
    position: relative;
    width: 95vw;
    height: 95vh;
}
.modal-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 1;
    transition: opacity 0.3s;
}
.modal-image-wrapper img.fade { opacity: 0.5; }

/* Кнопки модалки */
.modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 1002;
    background: none; border: none;
}
.modal-close:hover { color: #bbb; }

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.3);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    z-index: 1001;
}
.modal-nav:hover { background-color: rgba(0, 0, 0, 0.6); }
.modal-nav.prev { left: 15px; }
.modal-nav.next { right: 15px; }

@media (max-width: 768px) {
    .modal-nav.prev { left: 5px; }
    .modal-nav.next { right: 5px; }
}

/* Адаптив основного блока */
@media (max-width: 600px) {
    .content-block { width: 100%; height: 100%; border-radius: 0; max-height: none; border: none; }
    .glass-header { padding-top: 60px; }
    .nav-glass-btn { top: 15px; left: 15px; }
    .video-frame { border-width: 0; border-radius: 12px; }
}