﻿.cb-stories-bar-wrapper *, .cb-story-viewer * {
    box-sizing: border-box;
}

.cb-story-viewer img, .cb-story-viewer video, .cb-stories-bar-wrapper img {
    max-width: 100%;
    max-height: 100%;
}

.cb-stories-bar-wrapper {
    position: relative;
    z-index: 10;
    padding: clamp(10px, 2.5vw, 18px) 0;
    background: linear-gradient(180deg, rgba(9,11,13,0.95) 0%, transparent 100%);
}

.cb-stories-bar {
    display: flex;
    gap: clamp(10px, 2.5vw, 20px);
    overflow-x: auto;
    overflow-y: hidden;
    padding: clamp(6px, 1.8vw, 10px) clamp(12px, 3vw, 20px);
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

    .cb-stories-bar::-webkit-scrollbar {
        display: none;
    }

.cb-story-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(6px, 1.5vw, 10px);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

    .cb-story-item:active {
        transform: scale(0.92);
    }

    .cb-story-item:focus-visible {
        outline: 2px solid #cea277;
        outline-offset: 3px;
        border-radius: 12px;
    }

.cb-story-ring {
    width: clamp(60px, 15vw, 88px);
    height: clamp(60px, 15vw, 88px);
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, #cea277 0%, #b3855c 50%, #cea277 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.3s ease;
    box-shadow: 0 4px 16px rgba(206, 162, 119, 0.25);
}

.cb-story-item.is-viewed .cb-story-ring {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: none;
}

.cb-story-thumb {
    width: clamp(54px, 13.5vw, 82px);
    height: clamp(54px, 13.5vw, 82px);
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #090b0d;
    background: #111418;
}

    .cb-story-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.cb-story-title {
    color: rgba(246, 245, 245, 0.85);
    font-size: clamp(0.68rem, 2.4vw, 0.78rem);
    font-weight: 500;
    max-width: clamp(60px, 15vw, 88px);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cb-story-viewer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 0 env(safe-area-inset-left, 0px) 0 env(safe-area-inset-right, 0px);
}

    .cb-story-viewer.is-open {
        opacity: 1;
        pointer-events: auto;
    }

.cb-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.cb-story-layout {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: clamp(360px, 95vw, 480px);
    margin: 0 auto;
}

.cb-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: clamp(44px, 5vw, 56px);
    height: clamp(44px, 5vw, 56px);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 50;
}

.cb-nav-left {
    left: clamp(16px, 4vw, 56px);
}

.cb-nav-right {
    right: clamp(16px, 4vw, 56px);
}

.cb-nav-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-50%) scale(1.05);
}

.cb-nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.cb-nav-btn:focus-visible {
    outline: 2px solid #cea277;
    outline-offset: 2px;
}

.cb-nav-btn svg {
    width: clamp(20px, 2.5vw, 28px);
    height: clamp(20px, 2.5vw, 28px);
}

.cb-story-stage {
    position: relative;
    width: 100%;
    max-width: clamp(360px, 95vw, 480px);
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #000;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    margin: 0 auto;
}

@media (min-width: 480px) {
    .cb-story-stage {
        height: 85dvh;
        max-height: 800px;
        border-radius: 16px;
        box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
    }
}

.cb-story-progress-wrap {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: 0;
    right: 0;
    z-index: 200;
    padding: clamp(6px, 1.5vw, 10px) clamp(12px, 3vw, 16px);
    pointer-events: none;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.cb-story-progress {
    display: flex !important;
    flex-direction: row;
    gap: clamp(3px, 0.8vw, 5px);
    width: 100%;
    align-items: center;
    direction: rtl;
}

.cb-progress-segment {
    flex: 1 1 0;
    min-width: 0;
    height: clamp(2.5px, 0.7vw, 3.5px);
    min-height: 2.5px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    display: block !important;
}

.cb-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 3px;
    will-change: width;
    position: absolute;
    top: 0;
    right: 0;
    left: auto;
    transition: none;
}

    .cb-progress-fill.is-complete {
        width: 100% !important;
    }

.cb-story-header {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + clamp(20px, 4vw, 32px));
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(10px, 2.5vw, 14px) clamp(12px, 3vw, 18px) clamp(30px, 6vw, 44px);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
    z-index: 9;
    pointer-events: none;
}

    .cb-story-header > * {
        pointer-events: auto;
    }

.cb-header-info {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
    min-width: 0;
}

.cb-header-avatar {
    width: clamp(34px, 8vw, 44px);
    height: clamp(34px, 8vw, 44px);
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(206, 162, 119, 0.5);
    flex-shrink: 0;
}

    .cb-header-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.cb-header-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

    .cb-header-text strong {
        color: #fff;
        font-size: clamp(0.82rem, 2.8vw, 0.95rem);
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: clamp(140px, 40vw, 240px);
    }

    .cb-header-text small {
        color: rgba(255, 255, 255, 0.6);
        font-size: clamp(0.68rem, 2.4vw, 0.78rem);
    }

.cb-header-actions {
    display: flex;
    align-items: center;
    gap: clamp(6px, 1.5vw, 10px);
    flex-shrink: 0;
}

.cb-icon-btn {
    width: clamp(32px, 8vw, 38px);
    height: clamp(32px, 8vw, 38px);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    flex-shrink: 0;
}

    .cb-icon-btn:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .cb-icon-btn:focus-visible {
        outline: 2px solid #cea277;
        outline-offset: 2px;
    }

    .cb-icon-btn svg {
        width: clamp(16px, 4vw, 20px);
        height: clamp(16px, 4vw, 20px);
    }

.cb-mute-btn.is-sounding {
    background: rgba(206, 162, 119, 0.25);
    color: #cea277;
}

.cb-mute-btn.is-muted #cbMuteWavePath {
    display: none;
}

.cb-mute-btn.is-muted::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: linear-gradient(45deg, transparent 47%, #ff3040 47%, #ff3040 53%, transparent 53%);
    pointer-events: none;
}

.cb-mute-btn {
    position: relative;
}

.is-hidden {
    display: none !important;
}

.cb-story-media {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
    min-height: 0;
}

    .cb-story-media img, .cb-story-media video {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.cb-story-footer {
    position: absolute;
    bottom: env(safe-area-inset-bottom, 0px);
    left: 0;
    right: 0;
    padding: clamp(28px, 6vw, 44px) clamp(12px, 3vw, 18px) clamp(16px, 4vw, 24px);
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
    z-index: 9;
    pointer-events: none;
}

    .cb-story-footer > * {
        pointer-events: auto;
    }

.cb-story-caption {
    color: #fff;
    font-size: clamp(0.85rem, 3vw, 0.98rem);
    line-height: 1.55;
    margin-bottom: clamp(8px, 2vw, 14px);
}

.cb-story-actions {
    display: flex;
    align-items: center;
    gap: clamp(10px, 3vw, 18px);
    flex-wrap: wrap;
}

.cb-story-stats {
    display: flex;
    align-items: center;
    gap: clamp(10px, 3vw, 18px);
}

.cb-stat {
    display: flex;
    align-items: center;
    gap: clamp(4px, 1.2vw, 7px);
    color: #fff;
    font-size: clamp(0.78rem, 2.8vw, 0.88rem);
    font-weight: 500;
}

    .cb-stat svg {
        width: clamp(18px, 4.5vw, 22px);
        height: clamp(18px, 4.5vw, 22px);
    }

.cb-like-btn {
    display: flex;
    align-items: center;
    gap: clamp(4px, 1.2vw, 7px);
    background: none;
    border: none;
    color: #fff;
    font-size: clamp(0.78rem, 2.8vw, 0.88rem);
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
    user-select: none;
}

    .cb-like-btn:active {
        transform: scale(0.9);
    }

    .cb-like-btn svg {
        width: clamp(18px, 4.5vw, 22px);
        height: clamp(18px, 4.5vw, 22px);
        transition: fill 0.2s ease, stroke 0.2s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .cb-like-btn.is-liked svg {
        fill: #ff3040;
        stroke: #ff3040;
        animation: cb-heart-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
        filter: drop-shadow(0 0 8px rgba(255, 48, 64, 0.5));
    }

    .cb-like-btn.is-syncing::after {
        content: '';
        position: absolute;
        top: -2px;
        right: -10px;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #cea277;
        opacity: 0.6;
        animation: cb-sync-pulse 1s ease-in-out infinite;
    }

@keyframes cb-heart-pop {
    0% {
        transform: scale(1);
    }

    35% {
        transform: scale(1.45);
    }

    65% {
        transform: scale(0.92);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes cb-sync-pulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }

    50% {
        opacity: 0.9;
        transform: scale(1.2);
    }
}

@keyframes cb-spin {
    to {
        transform: rotate(360deg);
    }
}

.cb-story-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #cea277, #b3855c);
    color: #000;
    padding: clamp(8px, 2vw, 11px) clamp(14px, 4vw, 22px);
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: clamp(0.78rem, 2.8vw, 0.88rem);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-right: auto;
}

    .cb-story-link:hover {
        color: #fff;
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(206, 162, 119, 0.4);
    }

    .cb-story-link svg {
        width: clamp(14px, 3.5vw, 17px);
        height: clamp(14px, 3.5vw, 17px);
    }

.cb-touch-zone {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + clamp(50px, 12vw, 70px));
    bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(70px, 18vw, 90px));
    width: 35%;
    z-index: 5;
    cursor: pointer;
}

.cb-touch-zone--left {
    left: 0;
}

.cb-touch-zone--right {
    right: 0;
}

body.story-open {
    overflow: hidden;
}

    body.story-open > header,
    body.story-open header.site-header,
    body.story-open header.main-header,
    body.story-open header.app-header,
    body.story-open .site-header,
    body.story-open .main-header,
    body.story-open .app-header,
    body.story-open .navbar,
    body.story-open .main-navbar,
    body.story-open #mainHeader,
    body.story-open #siteHeader,
    body.story-open #appHeader,
    body.story-open #header,
    body.story-open .header-wrapper,
    body.story-open .page-header,
    body.story-open .cb-layout-header,
    body.story-open .cb-site-header {
        transform: translateY(-110%);
        opacity: 0;
        pointer-events: none !important;
        visibility: hidden;
    }

@media (max-width: 767px) {
    .cb-nav-btn {
        display: none !important;
    }

    .cb-story-layout {
        max-width: 100% !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .cb-story-stage {
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 0 !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow: hidden;
    }

    .cb-story-progress-wrap {
        top: calc(env(safe-area-inset-top, 0px) + 10px) !important;
        left: 0 !important;
        right: 0 !important;
        padding: 8px 14px !important;
        z-index: 300 !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: absolute !important;
    }

    .cb-story-progress {
        display: flex !important;
        flex-direction: row !important;
        gap: 4px !important;
        width: 100% !important;
        direction: rtl !important;
    }

    .cb-progress-segment {
        height: 3px !important;
        min-height: 3px !important;
        background: rgba(255, 255, 255, 0.5) !important;
        display: block !important;
        flex: 1 1 0 !important;
        min-width: 0 !important;
        border-radius: 3px !important;
    }

    .cb-progress-fill {
        background: #ffffff !important;
        right: 0 !important;
        left: auto !important;
        height: 100% !important;
    }

    .cb-story-header {
        top: calc(env(safe-area-inset-top, 0px) + 36px);
        padding: 10px 14px 30px;
        z-index: 9;
    }

    .cb-story-footer {
        padding: 30px 14px 20px;
    }
}

@media (max-width: 479px) {
    .cb-story-progress-wrap {
        top: calc(env(safe-area-inset-top, 0px) + 8px) !important;
        padding: 6px 12px !important;
    }

    .cb-story-header {
        top: calc(env(safe-area-inset-top, 0px) + 32px);
    }

    .cb-story-footer {
        padding: 24px 12px 16px;
    }

    .cb-story-caption {
        font-size: 0.85rem;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .cb-story-actions {
        gap: 12px;
    }

    .cb-story-stats {
        gap: 12px;
    }

    .cb-header-text strong {
        max-width: clamp(110px, 50vw, 180px);
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .cb-story-stage {
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
    }

    .cb-story-header {
        top: calc(env(safe-area-inset-top, 0px) + 6px);
        padding: 6px 12px 20px;
    }

    .cb-header-avatar {
        width: 30px;
        height: 30px;
    }

    .cb-header-text strong {
        font-size: 0.8rem;
        max-width: 160px;
    }

    .cb-header-text small {
        display: none;
    }

    .cb-icon-btn {
        width: 30px;
        height: 30px;
    }

        .cb-icon-btn svg {
            width: 16px;
            height: 16px;
        }

    .cb-story-footer {
        padding: 20px 12px 8px;
    }

    .cb-story-caption {
        font-size: 0.8rem;
        margin-bottom: 6px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .cb-touch-zone {
        top: calc(env(safe-area-inset-top, 0px) + 40px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 60px);
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .cb-story-layout, .cb-story-stage {
        max-width: 440px;
    }

    .cb-nav-left {
        left: clamp(20px, 3vw, 36px);
    }

    .cb-nav-right {
        right: clamp(20px, 3vw, 36px);
    }
}

@media (min-width: 768px) {
    .cb-nav-left {
        left: 32px;
    }

    .cb-nav-right {
        right: 32px;
    }
}

@media (min-width: 1200px) {
    .cb-nav-left {
        left: 48px;
    }

    .cb-nav-right {
        right: 48px;
    }
}

@media (min-width: 1400px) {
    .cb-story-layout, .cb-story-stage {
        max-width: 500px;
    }

    .cb-story-stage {
        max-height: 880px;
    }

    .cb-story-ring {
        width: 92px;
        height: 92px;
    }

    .cb-story-thumb {
        width: 86px;
        height: 86px;
    }

    .cb-story-title {
        max-width: 92px;
    }

    .cb-nav-left {
        left: 56px;
    }

    .cb-nav-right {
        right: 56px;
    }
}

@media (min-width: 1920px) {
    .cb-story-layout, .cb-story-stage {
        max-width: 540px;
    }

    .cb-story-stage {
        max-height: 920px;
    }

    .cb-story-ring {
        width: 96px;
        height: 96px;
    }

    .cb-story-thumb {
        width: 90px;
        height: 90px;
    }

    .cb-story-title {
        max-width: 96px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cb-story-item, .cb-nav-btn, .cb-icon-btn, .cb-like-btn, .cb-story-link {
        transition: none !important;
    }
}
