/* ==========================================
   Story Viewer
========================================== */
.story-viewer{
    position:fixed;
    top:0;
    left:0;
    right:0;
    bottom:0;
    width:100vw;
    height:100dvh;
    display:none;
    align-items:center;
    justify-content:center;
    background:#000;
    z-index:999999;
    overflow:hidden;
}

.story-viewer.active{
    display:flex;
}

.story-viewer-content{
    width:100%;
    height:100%;
    display:flex;
    flex-direction:column;
    position:relative;
    background:#000;
}

.story-viewer-body{
    width:100%;
    height:100%;
    position:relative;
    flex:1;
    min-height:0;
    overflow:hidden;
}

.story-viewer-body,
.story-viewer-body img,
.story-viewer-body video{
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-drag: none;
}

.story-viewer-close{
    border:none;
    background:transparent;
    color:#fff;
    font-size:20px;
    line-height:1;
    cursor:pointer;

    width:32px;
    height:32px;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:0;
}

/* ==========================================
   Story Viewer Header
========================================== */
.story-viewer-top{
    position:absolute;
    top:0;
    left:0;
    right:0;
    padding:10px 14px 0;
    flex-shrink:0;
    z-index:30;
    transition: opacity .18s ease;
    will-change: opacity;
    display:flex;
    flex-direction:column;
}

.story-progress{
    display:flex;
    gap:4px;
    margin-bottom:8px;
    transform-origin:right center;
}

.story-progress-item{
    flex:1;
    height:3px;
    background:rgba(255,255,255,.25);
    border-radius:999px;
    overflow:hidden;
}

.story-progress-fill{
    width:100%;
    height:100%;
    background:#ffffff;
    transform:scaleX(0);
    transform-origin:right center;
}

.story-viewer-header{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    width:100%;
}

.story-viewer-user{
    display:flex;
    align-items:flex-start;
    gap:10px;
    flex-direction:row-reverse;
    padding-top:4px;
}

.story-viewer-avatar{
    width:36px;
    height:36px;
    border-radius:50%;
    object-fit:cover;
    background:#222;
}

.story-viewer-meta{
    display:flex;
    align-items:center;
    justify-content:center;
    height:36px;
}

.story-viewer-info{
    display:flex;
    align-items:center;
    gap:6px;
    height:36px;
}

.story-viewer-title{
    color:#fff;
    font-size:12px;
    font-weight:400;
    line-height:1;
}

.story-viewer-time{
    color:rgba(255,255,255,.75);
    font-size:11px;
    line-height:1;
}

.story-progress-fill.active{
    animation-name:storyProgress;
    animation-timing-function:linear;
    animation-fill-mode:forwards;
}

@keyframes storyProgress{
    from{
        transform:scaleX(0);
    }
    to{
        transform:scaleX(1);
    }
}

.story-media {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
}

.story-caption{
    position:absolute;
    left:16px;
    right:16px;
    bottom:24px;
    z-index:30;
    display:inline-block;
    width:fit-content;
    max-width:calc(100% - 32px);
    margin:0 auto;
    padding:10px 16px;
    color:#fff;
    font-size:14px;
    line-height:1.6;
    text-align:center;
    background:rgba(0,0,0,.35);
    backdrop-filter:blur(12px);
    -webkit-backdrop-filter:blur(12px);
    border-radius:16px;
    white-space:normal;
    word-break:break-word;
    overflow-wrap:anywhere;
    pointer-events:none;
}

.story-media-bg{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    object-fit:cover;
    filter:blur(45px);
    transform:scale(1.15);
}

.story-media-overlay{
    position:absolute;
    inset:0;
    background:rgba(0,0,0,.28);
    z-index:1;
}

.story-media-main {
    position: relative;
    max-width: 100%;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain !important;
    z-index: 2;
    margin: auto;
}

.story-viewer-actions{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:14px;
    margin-top:4px;
}

.story-sound-btn,
.story-rotate-btn,
.story-share-btn{
    position:static;
    width:24px;
    height:24px;
    padding:0;
    margin:0;
    border:none;
    background:transparent;
    color:#fff;
    font-size:22px;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
}

.story-rotated{
    transform:rotate(90deg);
    transform-origin:center center;
}

.story-rotate-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-header-blur{
    position:absolute;
    top:0;
    left:0;
    right:0;
    height:118px;
    opacity:.95;
    pointer-events:none;
    z-index:10;
    overflow:hidden;
    border-bottom-left-radius:28px;
    border-bottom-right-radius:28px;
    transform:translateY(-8px) scaleY(1.08);
}

.story-header-blur::before{
    content:"";
    position:absolute;
    inset:0;
    
    backdrop-filter:blur(52px) saturate(150%);
    -webkit-backdrop-filter:blur(52px) saturate(150%);
    
    mask-image:linear-gradient(
        to bottom,
        rgba(0,0,0,1) 0%,
        rgba(0,0,0,1) 28%,
        rgba(0,0,0,.82) 58%,
        rgba(0,0,0,.35) 88%,
        rgba(0,0,0,0) 100%
    );
    
    -webkit-mask-image:linear-gradient(
        to bottom,
        rgba(0,0,0,1) 0%,
        rgba(0,0,0,1) 28%,
        rgba(0,0,0,.82) 58%,
        rgba(0,0,0,.35) 88%,
        rgba(0,0,0,0) 100%
    );
}

.story-header-blur::after{
    content:"";
    position:absolute;
    inset:0;
    background:
    linear-gradient(
        to bottom,
        rgba(0,0,0,.82) 0%,
        rgba(0,0,0,.52) 42%,
        rgba(0,0,0,.08) 68%,
        rgba(0,0,0,0) 100%
    ),
    linear-gradient(
        to bottom,
        rgba(255,255,255,.06) 0%,
        rgba(255,255,255,0) 55%
    );
}

/*.story-watermark-mask{*/
/*    position:absolute;*/
/*    left: 35px;*/
/*    bottom:240px;*/
/*    width:100px;*/
/*    height:65px;*/
/*    background:rgba(255,255,255,.08);*/
/*    backdrop-filter:blur(12px) saturate(180%);*/
/*    -webkit-backdrop-filter:blur(12px) saturate(180%);*/
/*    border-radius:12px;*/
/*    z-index:20;*/
/*    pointer-events:none;*/
/*}*/