/* Developer Stories front-end — v4.0.0 */
#dsStoryRoot,
#dsStoryRoot *,
#dsViewer,
#dsViewer * {
    box-sizing: border-box;
}

#dsStoryRoot {
    --ds-thumb-mobile: max(56px, calc(var(--ds-thumb) - 12px));
    --ds-surface: #fff;
    --ds-text: #2f2f33;
    --ds-shadow: 0 3px 12px rgba(0, 0, 0, .08);
    direction: rtl;
    display: block;
    width: 100%;
    background: var(--ds-surface);
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    position: relative;
    z-index: 10;
}

.ds-story-bar {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    padding: 14px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.ds-story-bar::-webkit-scrollbar {
    display: none;
}

.ds-story-item {
    display: flex;
    flex: 0 0 calc(var(--ds-thumb) + 10px);
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 0;
    margin: 0;
    padding: 0;
    color: var(--ds-text);
    font: inherit;
    text-align: center;
    cursor: pointer;
    background: transparent;
    border: 0;
    border-radius: 8px;
    scroll-snap-align: start;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.ds-story-item:focus-visible {
    outline: 3px solid #4069e8;
    outline-offset: 4px;
}

.ds-story-ring {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--ds-thumb);
    height: var(--ds-thumb);
    padding: 3px;
    background: linear-gradient(135deg, var(--ds-ring-1), var(--ds-ring-2), var(--ds-ring-3));
    border-radius: 50%;
    box-shadow: var(--ds-shadow);
}

.ds-story-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1e1e22;
    border: 2px solid #fff;
    border-radius: 50%;
}

.ds-story-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ds-video-icon {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    color: #fff;
    font-size: clamp(18px, 2vw, 25px);
    line-height: 1;
    background: linear-gradient(135deg, var(--ds-ring-2), var(--ds-ring-3));
}

.ds-story-name {
    display: block;
    width: 100%;
    max-width: calc(var(--ds-thumb) + 10px);
    overflow: hidden;
    color: var(--ds-text);
    font-family: Tahoma, Arial, sans-serif;
    font-size: 11px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ds-story-count {
    display: grid;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    place-items: center;
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 10px;
    line-height: 1;
    background: #e1306c;
    border-radius: 999px;
}

#dsViewer[hidden] {
    display: none;
}

#dsViewer {
    position: fixed;
    z-index: 999999;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: rgba(0, 0, 0, .94);
    overscroll-behavior: contain;
}

.ds-viewer-card {
    position: relative;
    width: min(100%, 430px);
    height: min(100dvh, 820px);
    overflow: hidden;
    isolation: isolate;
    background: #000;
    border-radius: 14px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, .45);
    outline: none;
    touch-action: pan-y;
}

.ds-progress {
    position: absolute;
    z-index: 5;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    gap: 4px;
    padding: calc(11px + env(safe-area-inset-top)) 12px 0;
    direction: ltr;
}

.ds-progress-segment {
    flex: 1 1 0;
    height: 3px;
    min-width: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, .4);
    border-radius: 10px;
}

.ds-progress-fill {
    display: block;
    width: 0;
    height: 100%;
    background: #fff;
    border-radius: inherit;
    transform-origin: left center;
}

.ds-viewer-header {
    position: absolute;
    z-index: 6;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(29px + env(safe-area-inset-top)) 14px 8px;
    color: #fff;
    direction: rtl;
    pointer-events: none;
}

.ds-viewer-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-family: Tahoma, Arial, sans-serif;
}

.ds-viewer-profile strong,
.ds-viewer-profile small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ds-viewer-profile strong {
    max-width: min(220px, 50vw);
    color: #fff;
    font-size: 13px;
    line-height: 1.35;
}

.ds-viewer-profile small {
    margin-top: 2px;
    color: rgba(255, 255, 255, .72);
    font-family: Arial, sans-serif;
    font-size: 11px;
    direction: ltr;
}

.ds-viewer-avatar {
    display: grid;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    overflow: hidden;
    place-items: center;
    background: #45454c;
    border: 2px solid #fff;
    border-radius: 50%;
}

.ds-viewer-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ds-icon-button {
    display: grid;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    place-items: center;
    color: #fff;
    cursor: pointer;
    pointer-events: auto;
    background: transparent;
    border: 0;
    border-radius: 50%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.ds-icon-button:hover {
    background: rgba(255, 255, 255, .14);
}

.ds-icon-button:focus-visible,
.ds-action-button:focus-visible,
.ds-story-link:focus-visible,
.ds-navigation:focus-visible {
    outline: 3px solid rgba(255, 255, 255, .85);
    outline-offset: -4px;
}

.ds-icon-button svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.ds-viewer-media {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
}

.ds-viewer-media img,
.ds-viewer-media video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.ds-viewer-caption {
    position: absolute;
    z-index: 5;
    right: 0;
    bottom: calc(92px + env(safe-area-inset-bottom));
    left: 0;
    max-height: 30%;
    margin: 0;
    padding: 0 20px;
    overflow-y: auto;
    color: #fff;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.7;
    text-align: center;
    text-shadow: 0 1px 7px rgba(0, 0, 0, .8);
    direction: rtl;
    scrollbar-width: thin;
    pointer-events: none;
}

.ds-viewer-actions {
    position: absolute;
    z-index: 7;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
    padding: 12px 17px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, rgba(0, 0, 0, .72));
    direction: rtl;
}

.ds-action-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ds-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 5px 7px;
    color: #fff;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 10px;
    cursor: pointer;
    background: transparent;
    border: 0;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.ds-action-button:hover {
    background: rgba(255, 255, 255, .12);
}

.ds-action-button svg,
.ds-story-link svg {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ds-action-button.is-liked {
    color: #f1487e;
}

.ds-action-button .ds-like-count {
    min-width: 1ch;
    color: #fff;
}

.ds-story-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    max-width: 55%;
    padding: 8px 14px;
    overflow: hidden;
    color: #fff;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 12px;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(255, 255, 255, .2);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ds-story-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .32);
}

.ds-story-link svg {
    width: 16px;
    height: 16px;
}

.ds-navigation {
    position: absolute;
    z-index: 4;
    top: calc(70px + env(safe-area-inset-top));
    bottom: calc(80px + env(safe-area-inset-bottom));
    width: 35%;
    margin: 0;
    padding: 0;
    cursor: pointer;
    background: transparent;
    border: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.ds-navigation-prev {
    right: 0;
}

.ds-navigation-next {
    left: 0;
}

@media (max-width: 768px) {
    .ds-story-bar {
        gap: 10px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .ds-story-item {
        flex-basis: calc(var(--ds-thumb-mobile) + 8px);
    }

    .ds-story-ring {
        width: var(--ds-thumb-mobile);
        height: var(--ds-thumb-mobile);
    }

    .ds-story-name {
        max-width: calc(var(--ds-thumb-mobile) + 8px);
        font-size: 10px;
    }

    #dsViewer {
        padding: 0;
    }

    .ds-viewer-card {
        width: 100%;
        height: 100dvh;
        border-radius: 0;
    }

    .ds-viewer-caption {
        font-size: 13px;
    }
}

@media (max-width: 380px) {
    .ds-story-item {
        flex-basis: 64px;
    }

    .ds-story-ring {
        width: 56px;
        height: 56px;
    }

    .ds-story-name {
        max-width: 64px;
        font-size: 9px;
    }

    .ds-viewer-actions {
        padding-right: 12px;
        padding-left: 12px;
    }

    .ds-action-group {
        gap: 5px;
    }

    .ds-story-link {
        max-width: 48%;
        padding-right: 10px;
        padding-left: 10px;
    }
}

@media (min-width: 769px) {
    .ds-viewer-card {
        height: min(90dvh, 820px);
    }

    .ds-progress {
        padding-top: 11px;
    }

    .ds-viewer-header {
        padding-top: 29px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* --------------------------------------------------------------------------
   Theme-conflict guard
   Some WooCommerce/mobile themes style every button, header, SVG, or list item
   globally. The viewer must remain visually isolated from those generic rules.
   -------------------------------------------------------------------------- */
#dsStoryRoot .ds-story-item,
#dsViewer button,
#dsViewer .ds-icon-button,
#dsViewer .ds-action-button,
#dsViewer .ds-navigation {
    -webkit-appearance: none !important;
    appearance: none !important;
    margin: 0 !important;
    padding: 0 !important;
    color: inherit !important;
    font: inherit !important;
    font-style: normal !important;
    font-weight: normal !important;
    letter-spacing: normal !important;
    line-height: normal !important;
    text-transform: none !important;
    text-shadow: none !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline-offset: 0;
    min-height: 0 !important;
    height: auto !important;
}

#dsStoryRoot .ds-story-item {
    display: flex !important;
    flex: 0 0 calc(var(--ds-thumb) + 10px) !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 5px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    cursor: pointer !important;
}

#dsStoryRoot .ds-story-item::before,
#dsStoryRoot .ds-story-item::after,
#dsViewer button::before,
#dsViewer button::after,
#dsViewer .ds-viewer-header::before,
#dsViewer .ds-viewer-header::after {
    display: none !important;
    content: none !important;
}

#dsStoryRoot .ds-story-ring {
    display: flex !important;
    width: var(--ds-thumb) !important;
    height: var(--ds-thumb) !important;
    min-width: var(--ds-thumb) !important;
    padding: 3px !important;
    overflow: visible !important;
    background: linear-gradient(135deg, var(--ds-ring-1), var(--ds-ring-2), var(--ds-ring-3)) !important;
    border: 0 !important;
    border-radius: 50% !important;
    box-shadow: var(--ds-shadow) !important;
}

#dsStoryRoot .ds-story-thumb,
#dsStoryRoot .ds-story-thumb img,
#dsStoryRoot .ds-video-icon {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 50% !important;
    box-shadow: none !important;
}

#dsStoryRoot .ds-story-thumb img {
    display: block !important;
    object-fit: cover !important;
    background: transparent !important;
}

#dsViewer,
#dsViewer .ds-viewer-card,
#dsViewer .ds-viewer-media {
    background-color: #000 !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
}

#dsViewer .ds-viewer-header {
    display: flex !important;
    min-height: 0 !important;
    height: auto !important;
    max-width: none !important;
    margin: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
}

#dsViewer .ds-icon-button {
    display: grid !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    place-items: center !important;
    color: #fff !important;
    cursor: pointer !important;
    border-radius: 50% !important;
}

#dsViewer .ds-icon-button svg {
    display: block !important;
    width: 23px !important;
    height: 23px !important;
    overflow: visible !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2.5 !important;
    background: transparent !important;
}

#dsViewer .ds-viewer-actions {
    display: flex !important;
    min-height: 80px !important;
    margin: 0 !important;
    background: linear-gradient(transparent, rgba(0, 0, 0, .72)) !important;
    border: 0 !important;
    box-shadow: none !important;
}

#dsViewer .ds-action-group {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
}

#dsViewer .ds-action-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    width: auto !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 5px 7px !important;
    color: #fff !important;
    cursor: pointer !important;
    border-radius: 8px !important;
}

#dsViewer .ds-action-button.is-liked {
    color: #f1487e !important;
}

#dsViewer .ds-action-button svg,
#dsViewer .ds-story-link svg {
    display: block !important;
    width: 24px !important;
    height: 24px !important;
    overflow: visible !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2 !important;
    background: transparent !important;
}

#dsViewer .ds-story-link {
    display: inline-flex !important;
    width: auto !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 8px 14px !important;
    color: #fff !important;
    text-decoration: none !important;
    background: rgba(255, 255, 255, .2) !important;
    background-color: rgba(255, 255, 255, .2) !important;
    background-image: none !important;
    border: 1px solid rgba(255, 255, 255, .22) !important;
    border-radius: 999px !important;
    box-shadow: none !important;
}

#dsViewer .ds-navigation {
    position: absolute !important;
    display: block !important;
    width: 35% !important;
    height: auto !important;
    min-height: 0 !important;
    color: transparent !important;
    cursor: pointer !important;
}

#dsViewer .ds-progress,
#dsViewer .ds-progress-segment,
#dsViewer .ds-progress-fill,
#dsViewer .ds-viewer-profile,
#dsViewer .ds-viewer-avatar,
#dsViewer .ds-viewer-caption {
    box-shadow: none !important;
}

@media (max-width: 768px) {
    #dsStoryRoot .ds-story-item {
        flex-basis: calc(var(--ds-thumb-mobile) + 8px) !important;
    }

    #dsStoryRoot .ds-story-ring {
        width: var(--ds-thumb-mobile) !important;
        height: var(--ds-thumb-mobile) !important;
        min-width: var(--ds-thumb-mobile) !important;
    }
}

@media (max-width: 380px) {
    #dsStoryRoot .ds-story-item {
        flex-basis: 64px !important;
    }

    #dsStoryRoot .ds-story-ring {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
    }
}
