.gk-stories-v3 {
    --gk-story-avatar-size: 72px;
    --gk-story-ring-width: 3px;
    --gk-story-ring-1: var(--gk-primary, #3b82f6);
    --gk-story-ring-2: var(--gk-accent, #ef4444);
    --gk-story-seen-ring: #d1d5db;
    --gk-story-overlay-bg: rgba(2, 6, 23, .92);
    --gk-story-viewer-width: 430px;
    --gk-story-viewer-radius: 28px;
    --gk-story-action-bg: rgba(255,255,255,.14);
    --gk-story-title-gap: 4px;
    --gk-story-title-width: calc(var(--gk-story-avatar-size) + (var(--gk-story-ring-width) * 4) + 8px);
    --gk-story-item-width: var(--gk-story-title-width);
    position: relative;
    width: 100%;
    direction: inherit;
}

.gk-stories-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.gk-stories-section-title {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
    color: var(--gk-text, #111827);
}

.gk-stories-rail-shell {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gk-stories-swiper {
    width: 100%;
    overflow: hidden;
    opacity: 1 !important;
    padding: 8px 2px 10px;
}

.gk-stories-swiper .swiper-wrapper {
    align-items: flex-start;
}

.gk-story-avatar {
    width: auto;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    text-align: center;
    color: inherit;
    outline: none;
    transition: transform 180ms ease;
    width: var(--gk-story-item-width) !important;
    max-width: var(--gk-story-item-width);
    box-sizing: border-box;
}

.gk-stories-swiper .swiper-slide.gk-story-avatar {
    width: var(--gk-story-item-width) !important;
    flex: 0 0 var(--gk-story-item-width);
}


.gk-story-avatar:hover {
    transform: translateY(-2px);
}

.gk-story-avatar:active {
    transform: translateY(0) scale(.96);
}

.gk-story-avatar:focus-visible .gk-ring {
    box-shadow: 0 0 0 4px rgba(59,130,246,.18);
}

.gk-avatar,
.gk-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gk-avatar {
    width: 100%;
    flex: 0 0 auto;
}

.gk-ring {
    position: relative;
    width: calc(var(--gk-story-avatar-size) + (var(--gk-story-ring-width) * 4));
    height: calc(var(--gk-story-avatar-size) + (var(--gk-story-ring-width) * 4));
    border-radius: 999px;
    padding: var(--gk-story-ring-width);
    background: linear-gradient(135deg, var(--gk-story-ring-1), var(--gk-story-ring-2), #f59e0b);
    box-shadow: 0 8px 18px rgba(15,23,42,.08);
}

.gk-story-avatar.is-seen .gk-ring {
    background: var(--gk-story-seen-ring);
}

.gk-ring img {
    width: var(--gk-story-avatar-size);
    height: var(--gk-story-avatar-size);
    display: block;
    object-fit: cover;
    border-radius: 999px;
    border: 3px solid var(--gk-background, #fff);
    background: #f3f4f6;
}

.gk-story-badge {
    position: absolute;
    inset-inline: 8px;
    bottom: 6px;
    min-height: 16px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 5px;
    font-size: 9px;
    line-height: 1;
    font-weight: 900;
    color: #fff;
    background: rgba(0,0,0,.58);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    pointer-events: none;
}

.gk-avatar-title {
    width: min(var(--gk-story-title-width), 100%);
    max-width: 100%;
    min-height: 32px;
    margin-top: var(--gk-story-title-gap);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    line-height: 16px;
    font-weight: 800;
    color: var(--gk-text, #111827);
}

.gk-story-avatar.is-seen .gk-avatar-title {
    color: var(--gk-neutral-400, #9ca3af);
}

.gk-stories-rail-nav {
    position: relative;
    z-index: 2;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 999px;
    border: 1px solid rgba(15,23,42,.08);
    background: #fff;
    box-shadow: 0 10px 28px rgba(15,23,42,.08);
    cursor: pointer;
    color: var(--gk-text, #111827);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.gk-stories-rail-nav:hover,
.gk-stories-rail-nav:focus-visible {
    transform: translateY(-1px);
    background: #f8fafc;
    box-shadow: 0 14px 32px rgba(15,23,42,.12);
}

.gk-stories-rail-nav::before {
    display: none;
}

.gk-stories-rail-pagination {
    position: static;
    margin-top: 8px;
    text-align: center;
}

.gk-stories-rail-pagination .swiper-pagination-bullet {
    width: 7px;
    height: 7px;
    opacity: .25;
    background: var(--gk-primary, #3b82f6);
}

.gk-stories-rail-pagination .swiper-pagination-bullet-active {
    width: 22px;
    border-radius: 999px;
    opacity: 1;
}

.gk-story-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.gk-story-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.gk-story-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    background: var(--gk-story-overlay-bg);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    cursor: default;
}

body.gk-no-scroll {
    overflow: hidden !important;
    touch-action: none;
}

.gk-story-shell {
    position: relative;
    z-index: 2;
    width: min(var(--gk-story-viewer-width), calc(100vw - 32px));
    height: min(88vh, 820px);
    max-height: 820px;
    border-radius: var(--gk-story-viewer-radius);
    overflow: hidden;
    background: #000;
    color: #fff;
    box-shadow: 0 30px 90px rgba(0,0,0,.58);
    direction: rtl;
    isolation: isolate;
}

.gk-story-shell::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(0,0,0,.42), transparent 24%, transparent 64%, rgba(0,0,0,.62));
}

.gk-story-progress {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 12px;
    right: 12px;
    z-index: 30;
    display: flex;
    gap: 5px;
}

.gk-story-progress-item {
    flex: 1;
    height: 3px;
    border-radius: 99px;
    overflow: hidden;
    background: rgba(255,255,255,.28);
}

.gk-story-progress-item span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #fff;
    transition: width 70ms linear;
}

.gk-story-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 31;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(26px + env(safe-area-inset-top, 0px)) 14px 14px;
    pointer-events: none;
}

.gk-story-author {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.gk-story-author-img {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.28);
}

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

.gk-story-author-text {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.gk-story-title {
    display: block;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 900;
    color: #fff;
}

.gk-story-subtitle {
    display: block;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    line-height: 1.4;
    color: rgba(255,255,255,.68);
}

.gk-story-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: auto;
}

.gk-story-btn {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 999px;
    background: var(--gk-story-action-bg);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    line-height: 1;
    font-weight: 900;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.gk-svg-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.gk-svg-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.gk-story-btn .gk-svg-icon {
    width: 18px;
    height: 18px;
}

.gk-story-close .gk-svg-icon,
.gk-story-mute .gk-svg-icon {
    width: 19px;
    height: 19px;
}

.gk-story-btn:hover,
.gk-story-btn:focus-visible {
    transform: scale(1.06);
    background: rgba(255,255,255,.24);
}

.gk-story-btn .gk-icon-play,
.gk-story-btn .gk-icon-muted {
    display: none;
}

.gk-story-overlay.is-paused .gk-story-btn .gk-icon-pause { display: none; }
.gk-story-overlay.is-paused .gk-story-btn .gk-icon-play { display: inline-flex; }
.gk-story-overlay.is-muted .gk-story-btn .gk-icon-sound { display: none; }
.gk-story-overlay.is-muted .gk-story-btn .gk-icon-muted { display: inline-flex; }

.gk-story-media-area {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #000;
}

.gk-story-viewer-swiper,
.gk-story-viewer-swiper .swiper-wrapper,
.gk-story-viewer-swiper .swiper-slide {
    width: 100%;
    height: 100%;
}

.gk-story-slide {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
}

.gk-story-media {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    background: #000;
}

.gk-story-overlay.is-fit-contain .gk-story-media {
    object-fit: contain;
}

.gk-story-text-slide {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px;
    text-align: center;
}

.gk-story-text-inner {
    max-width: 92%;
    font-size: clamp(18px, 4vw, 30px);
    line-height: 1.8;
    font-weight: 900;
    word-break: break-word;
}

.gk-story-tap-zone {
    position: absolute;
    top: 84px;
    bottom: 112px;
    z-index: 20;
    width: 50%;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.gk-story-tap-prev { right: 0; }
.gk-story-tap-next { left: 0; }

.gk-story-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 32;
    padding: 14px;
    display: grid;
    gap: 10px;
    pointer-events: none;
}

.gk-story-description {
    display: none;
    padding: 10px 12px;
    border-radius: 18px;
    background: rgba(0,0,0,.28);
    color: rgba(255,255,255,.88);
    font-size: 12px;
    line-height: 1.8;
    font-weight: 600;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.gk-story-product {
    display: none;
    pointer-events: auto;
}

.gk-story-product-card {
    width: 100%;
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 18px;
    text-decoration: none;
    color: #111827;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(255,255,255,.72);
    box-shadow: 0 16px 36px rgba(0,0,0,.28);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.gk-story-product-card img {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 13px;
    object-fit: cover;
    background: #f3f4f6;
}

.gk-story-product-meta {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 3px;
}

.gk-story-product-meta strong {
    font-size: 13px;
    line-height: 1.4;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gk-story-product-meta small {
    font-size: 12px;
    color: var(--gk-primary, #2563eb);
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gk-story-cta {
    display: none;
    height: 46px;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: #fff;
    color: #111827;
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 16px 36px rgba(0,0,0,.28);
    pointer-events: auto;
}

.gk-story-cta::after {
    content: '';
    width: 8px;
    height: 8px;
    margin-inline-start: 9px;
    border-top: 2px solid currentColor;
    border-inline-start: 2px solid currentColor;
    transform: rotate(-45deg);
}

.gk-story-desktop-nav {
    position: absolute;
    top: 50%;
    z-index: 3;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    color: #fff;
    cursor: pointer;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.gk-story-desktop-nav .gk-svg-icon {
    width: 24px;
    height: 24px;
}

.gk-story-desktop-nav::before {
    display: none;
}

.gk-story-desktop-prev {
    right: calc(50% + (min(var(--gk-story-viewer-width), calc(100vw - 32px)) / 2) + 22px);
}

.gk-story-desktop-next {
    left: calc(50% + (min(var(--gk-story-viewer-width), calc(100vw - 32px)) / 2) + 22px);
}

.gk-story-desktop-nav:hover,
.gk-story-desktop-nav:focus-visible {
    background: rgba(255,255,255,.22);
    transform: translateY(-50%) scale(1.06);
}

@media (max-width: 767px) {
    .gk-stories-v3 {
        --gk-story-avatar-size: 62px;
    }

    .gk-stories-rail-nav,
    .gk-story-desktop-nav {
        display: none !important;
    }

    .gk-story-overlay {
        padding: 0;
    }

    .gk-story-shell {
        width: 100vw;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }

    .gk-story-topbar {
        padding-inline: 12px;
    }

    .gk-story-title,
    .gk-story-subtitle {
        max-width: 180px;
    }

    .gk-story-bottom {
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }
}

@media (min-width: 768px) {
    .gk-story-overlay:not(.is-open) .gk-story-shell {
        transform: translateY(8px) scale(.985);
    }

    .gk-story-overlay.is-open .gk-story-shell {
        transform: translateY(0) scale(1);
        transition: transform 220ms ease;
    }
}


/* GK Stories v4 - modular viewer refinements */
.gk-stories-v4 .gk-story-avatar.is-scheduled-hidden { display:none !important; }
.gk-stories-v4 .gk-story-avatar.is-seen .gk-ring { filter: saturate(.7); }
.gk-story-global-overlay {
    --gk-story-overlay-bg: rgba(2, 6, 23, .92);
    --gk-story-viewer-width: 430px;
    --gk-story-viewer-radius: 28px;
    --gk-story-action-bg: rgba(255,255,255,.14);
    z-index: 999999;
}
.gk-story-global-overlay .gk-story-shell:focus { outline: none; }
.gk-story-global-overlay .gk-story-bottom { gap: 10px; }
.gk-story-global-overlay.is-mobile-compact .gk-story-bottom { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
.gk-story-global-overlay.is-mobile-hidden .gk-story-bottom { display: none; }
.gk-story-global-overlay.is-mobile-card-under .gk-story-bottom { position: static; background: #fff; color: #111827; }
.gk-story-global-overlay.is-mobile-card-under .gk-story-shell { background: #000; }
.gk-story-global-overlay.is-mobile-card-under .gk-story-description { color: #334155; }
.gk-story-global-overlay.is-mobile-card-under .gk-story-cta { background: var(--gk-primary, #2563eb); color: #fff; }
.gk-story-global-overlay.is-mobile-hide-description .gk-story-description { display: none !important; }
.gk-story-global-overlay.is-mobile-hide-product .gk-story-product { display: none !important; }
.gk-story-global-overlay.is-mobile-hide-cta .gk-story-cta { display: none !important; }
.gk-story-slide-text .gk-story-text-inner a { color: inherit; text-decoration: underline; }
.gk-story-stats-hit { pointer-events:auto; }
.gk-stories-v4 .gk-avatar-title { line-height: 1.45; }
@media (max-width: 767px) {
    .gk-story-global-overlay.is-mobile-compact .gk-story-description { font-size: 12px; line-height: 1.6; }
    .gk-story-global-overlay.is-mobile-compact .gk-story-product-card { min-height: 46px; }
    .gk-story-global-overlay.is-mobile-compact .gk-story-product-card img { width: 38px; height: 38px; }
}
