/* ========== ОБЩИЕ СТИЛИ ========== */

/* Затемнение фона */
.story-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1;
}

/* Контейнер */
.story-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Картинка/видео */
.story-content img,
.story-content video {
    max-width: 80vw;
    max-height: 70vh;
    border-radius: 12px;
    object-fit: contain;
}

/* Описание */
.story-caption {
    color: #fff;
    font-size: 16px;
    text-align: center;
    margin-top: 15px;
    padding: 0 20px;
    max-width: 80vw;
    word-wrap: break-word;
}

/* Прогресс-бар */
.story-progress-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 15px;
    width: 100%;
    max-width: 500px;
}

.story-progress-segment {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    overflow: hidden;
}

.story-progress-fill {
    height: 100%;
    background: #fff;
    width: 0%;
    transition: width 0.1s linear;
}

/* Кнопки навигации */
.story-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: none;
    font-size: 30px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 3;
    line-height: 40px;
    text-align: center;
}

.story-prev { left: -50px; }
.story-next { right: -50px; }

.story-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    color: #fff;
    border: none;
    font-size: 28px;
    cursor: pointer;
    z-index: 3;
}

/* Анимация появления */
#story-viewer.show {
    display: flex !important;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* Блокировка скролла */
.story-open {
    overflow: hidden !important;
}

/* Адаптация для мобильных */
@media (max-width: 640px) {
    .story-container {
        max-width: 100%;
        max-height: 100vh;
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .story-content img,
    .story-content video {
        max-width: 100vw;
        max-height: 80vh;
    }
}