/* ============================================================
   Stories Viewer — standalone full-screen page
   ============================================================ */

body.stories-body {
    margin: 0;
    padding: 0;
    background: #000;
    color: #fff;
    overflow: hidden;
    height: 100dvh;
    width: 100vw;
    font-family: var(--font-body, system-ui, -apple-system, sans-serif);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* --- Progress bars ----------------------------------------- */

.stories-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    gap: 3px;
    padding: 8px 8px 0;
    padding-top: calc(env(safe-area-inset-top, 0px) + 8px);
}

.stories-progress-bar {
    flex: 1;
    height: 2.5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.stories-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 2px;
    transition: none;
}

.stories-progress-fill.complete {
    width: 100%;
}

/* --- Top bar ------------------------------------------------ */

.stories-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 16px 12px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 24px);
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
}

.stories-close-btn {
    color: #fff;
    font-size: 1.25rem;
    text-decoration: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.stories-influencer-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stories-top-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.4);
}

.stories-top-name {
    font-size: 0.875rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* --- Media display ----------------------------------------- */

.stories-display {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.stories-media {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stories-loading {
    position: absolute;
    color: rgba(255,255,255,0.5);
    font-size: 2rem;
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Desktop: constrain to phone-width */
@media (min-width: 768px) {
    .stories-display {
        left: 50%;
        transform: translateX(-50%);
        width: 420px;
        right: auto;
    }
}

/* --- Tap zones --------------------------------------------- */

.stories-tap-zone {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 10;
    cursor: pointer;
}

.stories-tap-prev {
    left: 0;
    width: 30%;
}

.stories-tap-next {
    right: 0;
    width: 70%;
}

/* --- Bottom overlay ---------------------------------------- */

.stories-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 15;
    padding: 40px 16px 20px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
}

.stories-caption {
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0 0 12px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.stories-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.stories-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: none;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.stories-action-btn:hover {
    background: rgba(255,255,255,0.25);
}

.stories-bookmark-btn.bookmarked {
    background: var(--accent, #c45d3e);
}

.stories-bookmark-btn.bookmarked i::before {
    content: "\f191";  /* bi-bookmark-fill */
}

.stories-link-btn {
    margin-left: auto;
}
