.story-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    direction: rtl;
    font-family: var(--font-family, Tahoma);
}

.story-grid {
    gap: var(--space-o-2, 12px);
    overflow-x: auto;
    padding: var(--space-i-2);
    flex-wrap: nowrap;
}

.story-grid::-webkit-scrollbar {
    height: 4px;
}

.story-grid::-webkit-scrollbar-track {
    background: var(--color-surface-0, #f0f0f0);
    border-radius: 9999px;
}

.story-grid::-webkit-scrollbar-thumb {
    background: var(--color-primary, #007bff);
    border-radius: 9999px;
}

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-i-2, 6px);
    cursor: pointer;
    flex-shrink: 0;
}

.story-avatar-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    padding: 3px;
    box-shadow: var(--shadow-1, 0 2px 8px rgba(0, 0, 0, 0.12));
    margin: 0 auto 10px;
}

.story-avatar-wrapper.story-has-slides {
    background: linear-gradient(0deg, var(--color-primary), var(--color-primary-light-4));
}

.story-avatar-wrapper.story-no-slides {
    background: var(--color-text-5, #ccc);
}

.story-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    border: 5px solid var(--color-white, #fff);
}

.story-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--color-surface-1, #e0e0e0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-4, #999);
    font-size: 12px;
    border: 3px solid var(--color-text-5, #ccc);
}

.story-title {
    font-size: 12px;
    color: var(--color-text-2, #666);
    text-align: center;
    max-width: 100%;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
    background: rgba(0, 0, 0, 0.85);
    z-index: var(--z-4);
    justify-content: center;
    align-items: center;
    padding: 60px;
    animation: storyFadeIn 0.25s ease;
}

@keyframes storyFadeIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.story-popup-inner {
    position: relative;
    max-width: 420px;
    height: 100%;
    aspect-ratio: 9/16;
    background: var(--color-black, #000);
    border-radius: var(--round-4, 12px);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.story-popup-header {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: var(--z-2);
    padding: var(--space-i-3, 12px);
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
    pointer-events: none;
}

.story-progress-container {
    display: flex;
    gap: 4px;
    margin-bottom: var(--space-i-2, 8px);
    width: 100%;
}

.story-progress-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    flex: 1;
    overflow: hidden;
}

.story-progress-bar .story-progress-fill {
    height: 100%;
    background: white;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.story-progress-bar.story-seen .story-progress-fill {
    width: 100% !important;
    background: rgba(255, 255, 255, 0.4);
}

.story-popup-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
}

.story-popup-title {
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.story-popup-actions {
    display: flex;
    gap: 8px;
}

.story-icon-btn {
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 9999px;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    transition: background 0.2s;
}

.story-icon-btn:hover {
    background: rgba(0, 0, 0, 0.5);
}

.story-mute-btn {
    display: none;
}

.story-popup-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-black, #000);
    position: relative;
}

.story-slide-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.story-slide-container img {
    width: 100%;
    height: fit-content !important;
    object-fit: contain;
}

.story-slide-container video {
    width: 100%;
    height: fit-content !important;
    object-fit: contain;
    background: var(--color-black, #000);
}

.story-video-play-btn {
    display: none;
    position: absolute;
    z-index: var(--z-2);
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    color: white;
    cursor: pointer;
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.story-video-play-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.story-video-play-btn svg {
    width: 30px;
    height: 30px;
}

#storyVideoPlayBtn {
    opacity: 0;
    transition-delay: 0.3s;
}

.story-popup-inner:hover #storyVideoPlayBtn {
    opacity: 1;
}

.story-video-progress-container {
    display: none;
    padding: var(--space-i-3, 12px);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
}

.story-video-progress-track {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.story-video-progress-fill {
    height: 100%;
    background: white;
    border-radius: 2px;
    width: 0%;
    transition: width 0.05s linear;
}

.story-video-progress-input {
    position: absolute;
    top: -5px;
    left: 0;
    width: 100%;
    height: 13px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    outline: none;
    cursor: pointer;
    opacity: 0;
}

.story-video-progress-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.story-video-progress-input::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.story-nav-areas {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    display: flex;
    z-index: var(--z-1);
}

.story-nav-area {
    flex: 1;
    cursor: pointer;
}

.story-empty {
    text-align: center;
    padding: 50px;
    color: var(--color-text-3, #888);
}

.story-empty p {
    font-size: 18px;
}

.story-popup-footer {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    z-index: var(--z-2);
}

.story-popup-actions-down {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-flow: column;
    pointer-events: auto;
    width: 100px;
    height: fit-content;
    margin-bottom: 30px;
    gap: 10px;
}

.story-popup-actions-like,
.story-popup-actions-comments {
    display: flex;
    align-items: center;
    gap: 6px;
}

.story-like-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 9999px;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all 0.2s;
    padding: 0;
}

.story-like-btn .heart-filled {
    display: none;
}

.story-like-btn.active .heart-filled {
    display: block;
}

.story-like-btn.active .heart-empty {
    display: none;
}

.story-like-btn svg {
    width: 22px;
    height: 22px;
}

.story-like-count {
    color: white;
    font-size: 14px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.story-comment-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 9999px;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all 0.2s;
    padding: 0;
}

.story-comment-btn svg {
    width: 22px;
    height: 22px;
}

.story-comment-count {
    color: white;
    font-size: 14px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.story-item.story-is-read .story-avatar-wrapper {
    opacity: 0.6;
}

.story-item.story-is-read .story-avatar-wrapper.story-has-slides {
    background: var(--color-text-5, #ccc);
}

.story-item.story-is-read .story-title {
    color: var(--color-text-4, #999);
}

.story-slide-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #000 25%, #151515 50%, #000 75%);
    background-size: 200% 100%;
    animation: storyShimmer 1.5s infinite;
    z-index: 1;
}

.story-slide-loading.hidden {
    display: none;
}

@keyframes storyShimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.story-comment-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 20;
    display: flex;
    flex-direction: column;
    animation: storyCommentSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes storyCommentSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.story-comment-header {
    display: flex;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
}

.story-comment-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    width: 36px;
    height: 36px;
}

.story-comment-close:hover {
    background: rgba(255, 255, 255, 0.16);
}

.story-comment-close svg {
    width: 20px;
    height: 20px;
}

.story-comment-title {
    color: #ffffff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.story-comment-total {
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    font-weight: 500;
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 12px;
    border-radius: 20px;
}

.story-comment-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.story-comment-list::-webkit-scrollbar {
    width: 3px;
}

.story-comment-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

.story-comment-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.story-comment-loading {
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    padding: 50px 20px;
    font-size: 14px;
}

.story-comment-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    padding: 50px 20px;
}

.story-comment-empty p {
    margin: 4px 0;
    font-size: 14px;
}

.story-comment-empty p:first-child {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.5);
}

@keyframes storyCommentFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.story-comment-author {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.story-comment-author img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.story-comment-author span {
    color: #ffffff;
}

.story-comment-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.6;
    padding-right: 36px;
}

.story-comment-time {
    color: rgba(255, 255, 255, 0.2);
    font-size: 11px;
    margin-top: 6px;
    padding-right: 36px;
}

.story-comment-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.story-comment-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 10px 18px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.25s ease;
    font-family: inherit;
    min-height: 44px;
    max-height: 100px;
    height: 44px;
    resize: none;
}

.story-comment-input:focus {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

.story-comment-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.story-comment-send {
    background: linear-gradient(135deg, #4a6cf7, #6a3de8);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 13px;
}

.story-comment-send:hover {
    box-shadow: 0 4px 20px rgba(74, 108, 247, 0.35);
}

.story-comment-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.story-comment-send svg {
    width: 20px;
    height: 20px;
}