/* Stories Container - click and drag to scroll. scroll-behavior: auto so drag follows cursor 1:1 like tab bar. */
.stories-container {
    background: var(--uw-white-1);
    padding: 16px 0;
    padding-top: 0 !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: auto;
    cursor: pointer;
}

.stories-container.drag-scroll-dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

.stories-container img,
.story-card img,
.story-card-background img {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

.stories-container .story-create-card,
.stories-container .story-card {
    pointer-events: auto;
}

.stories-container::-webkit-scrollbar {
    height: 0px;
}

.stories-wrapper {
    display: flex;
    gap: 8px;
    padding: 0;
    min-width: min-content;
}

/* Story Card - New Design */
.story-card {
    position: relative;
    width: 112px;
    height: 200px;
    -webkit-user-select: none;
    user-select: none;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    transition: 0.1s;
}

.story-card:hover {
    opacity: 0.8;
}

/* Create Story Card */
.story-create-card {
    background: var(--uw-background-11);
}

.story-create-bg {
    width: 100%;
    height: 130px;
    object-fit: cover;

}

.story-create-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--uw-background-11);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.story-create-add-icon {
    position: absolute;
    top: -20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--uw-blurple-1);
    border: 4px solid var(--uw-background-11);
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-create-text {
    font-family: "Roboto", sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--uw-text-1);
    text-align: center;
    padding: 0 8px;
}

/* Story Card with Preview */
.story-card-background {
    width: 100%;
    height: 100%;
    position: relative;
}

.story-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-card-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.3));
}

.story-card-avatar {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--uw-blurple-1);
    background: var(--uw-white-1);
}

.story-card-avatar.viewed {
    border-color: var(--uw-white-4);
}

.story-card-username-wrapper {
    position: absolute;
    bottom: 12px;
    left: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
}

.story-card-username {
    font-size: 12px;
    font-weight: 600;
    color: var(--uw-white-1);
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

/* Memories Section */
.memories-section {
    margin-top: 12px;
    min-height: 200px; /* Memory card height (200px) + padding (16px) */
}

.memories-scroller-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    height: 200px;
}

/* Memories container - click and drag to scroll (no arrows/fades). No scroll-behavior: smooth so drag follows cursor 1:1 like tab bar. */
.memories-container {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    flex: 1;
    height: 100%;
    cursor: pointer;
    user-select: none;
}

.memories-container.drag-scroll-dragging {
    scroll-behavior: auto;
}

.memories-container img,
.memory-card img,
.memory-card-background img {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

.memories-container .memory-card {
    pointer-events: auto;
}

.memories-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Scroller Arrow Buttons */
.scroller-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--uw-white-1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
    transition: all 0.2s;
    opacity: 0;
    pointer-events: none;
}

.memories-scroller-wrapper:hover .scroller-arrow,
.interests-scroller-wrapper:hover .scroller-arrow {
    opacity: 1;
    pointer-events: all;
}

.scroller-arrow:hover {
    background: var(--uw-white-2);
    border-color: var(--uw-white-4);
}

.scroller-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.scroller-arrow:hover,
.scroller-arrow:active {
    pointer-events: all;
}

.scroller-arrow-left {
    left: 0;
}

.scroller-arrow-right {
    right: 0;
}

.scroller-arrow i {
    font-size: 12px;
    color: var(--uw-text-1);
}

.scroller-arrow.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Scroller Fade Gradients */
.scroller-fade {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.2s;
}

.scroller-fade-left {
    left: 0;
    background: linear-gradient(to right, var(--uw-white-1) -50%, transparent 90%);
}

.scroller-fade-right {
    right: 0;
    background: linear-gradient(to left, var(--uw-white-1) -50%, transparent 90%);
}

.scroller-fade.hidden {
    opacity: 0;
}

.memories-wrapper {
    display: flex;
    gap: 8px;
    min-width: min-content;
}

/* Memory Card - Same as Story Card */
.memory-card {
    position: relative;
    width: 112px;
    height: 198px;
    -webkit-user-select: none;
    user-select: none;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    transition: 0.1s;
}

.memory-card:hover {
    opacity: 0.8;
}

.memory-card-background {
    width: 100%;
    height: 100%;
    position: relative;
}

.memory-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.memory-card-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.4));
}

.memory-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.memory-card-username-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
}

.memory-card-username {
    font-size: 13px;
    font-weight: 600;
    color: var(--uw-white-2);
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.memory-card-time {
    font-size: 11px;
    color: var(--uw-white-2);
}

.memory-card-badges {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}


.memory-skeleton-card {
    width: 112px;
    height: 200px;
    border-radius: 20px;
    background: linear-gradient(
        135deg,
        var(--uw-background-11) 0%,
        var(--uw-white-2) 50%,
        var(--uw-background-11) 100%
    );
    flex-shrink: 0;
    animation: memory-skeleton-breathe 2s ease-in-out infinite;
}

/* ============================================
   INTERESTS SECTION (PROFILE)
   ============================================ */

.interests-section {
    margin-left: -20px;
    margin-right: -20px;
    padding: 0 20px;
    margin-bottom:0px;
}

.interests-scroller-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    height: 86px;
}

.interests-container {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    flex: 1;
    height: 100%;
}

.interests-container::-webkit-scrollbar {
    display: none;
}

.interests-grid-profile {
    display: flex;
    gap: 8px;
}

.interest-card-profile {
    position: relative;
    width: 112px;
    height: 160px;
    flex-shrink: 0;
    border-radius: 20px;
    overflow: hidden;
    transition: 0.3s ease;
    background: var(--uw-background-11);
    display: flex;
    flex-direction: column;
}

.interest-card-profile:hover {
    width: 280px;  
    z-index: 10;
}

/* Scroll buttons always on top */
.scroller-arrow {
    pointer-events: all;
}

.interest-card-image-section {
    width: 100%;
    flex: 1;
    overflow: hidden;
}

.interest-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.interest-card-title-section {
    padding: 12px;
    background: var(--uw-background-11);
    border-radius: 0 0 20px 20px;
    transition: background 0.1s ease;
}

.interest-card-profile:hover .interest-card-title-section {
    background: var(--uw-white-2);
}

.interest-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--uw-text-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    text-align: center;
    display: block;
}


.memory-skeleton-card:nth-child(2) {
    animation-delay: 0.2s;
}

.memory-skeleton-card:nth-child(3) {
    animation-delay: 0.4s;
}

.memory-skeleton-card:nth-child(4) {
    animation-delay: 0.6s;
}

.memory-skeleton-card:nth-child(5) {
    animation-delay: 0.8s;
}

@keyframes memory-skeleton-breathe {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

.memories-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.memories-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--uw-white-3);
    border-top-color: var(--uw-blurple-1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.memories-empty,
.memories-error {
    padding: 40px 16px;
    text-align: center;
    color: var(--uw-text-2);
    font-size: 14px;
}

.memories-error {
    color: var(--uw-error);
}

.story-card-badges {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}


/* Skeleton Loading Cards */
.story-skeleton-card {
    position: relative;
    width: 112px;
    height: 200px;
    border-radius: 20px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--uw-white-2);
    animation: skeleton-breathe 1.5s ease-in-out infinite;
}

.story-skeleton-background {
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        var(--uw-white-2) 0%,
        var(--uw-white-3) 50%,
        var(--uw-white-2) 100%
    );
}

.story-skeleton-avatar {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--uw-white-3);
    border: 2px solid var(--uw-white-1);
}

.story-skeleton-text {
    position: absolute;
    bottom: 12px;
    left: 8px;
    right: 8px;
    height: 12px;
    border-radius: 6px;
    background: var(--uw-white-3);
}

@keyframes skeleton-breathe {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Old Story Item Styles - Keep for backward compatibility */
.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    width: 74px;
    transition: 0.1s;
}

.story-item:hover {
    opacity: 0.8;
}

.story-avatar-wrapper {
    position: relative;
    width: 64px;
    height: 64px;
    margin-bottom: 4px;
}

.story-avatar-ring {
    position: absolute;
    top: -3px;
    left: -3px;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--uw-blurple-1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
}

.story-avatar-ring.viewed {
    background: var(--uw-white-4);
}

.story-avatar-inner {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--uw-white-1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
}

.story-add-icon {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: var(--uw-blurple-1);
    border: 4px solid var(--uw-white-1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--uw-white-1);
    font-size: 11px;
    font-weight: bold;
    font-family: "Roboto", sans-serif;
}

.story-username {
    font-size: 12px;
    color: var(--uw-text-1);
    text-align: center;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: none; /* Hidden by default, only show for "Your Story" */
}

.story-item:first-child .story-username {
    display: block; /* Show for first item (Your Story) */
}

/* Story Viewer Modal */
.story-viewer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.story-viewer-modal.active {
    display: flex;
}

/* Prevent body scroll when modal is open */
body.story-modal-open {
    overflow: hidden;
    height: 100vh;
}

.story-viewer-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--uw-white-1);
    border-radius: 20px;
    overflow: hidden;
}

/* Progress Section */
.story-progress-section {
    position: relative;
    padding: 5px 8px;
    background: var(--uw-white-1);
    border-top: 1px solid var(--uw-white-3);
}

.story-progress-bars {
    display: flex;
    gap: 4px;
}

.story-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--uw-white-4);
    border-radius: 50px;
    overflow: hidden;
}

.story-progress-fill {
    height: 100%;
    background: var(--uw-blurple-1);
    width: 0%;
    transition: width 0.1s linear;
}

.story-progress-fill.active {
    animation: progress-fill 14s linear forwards;
}

@keyframes progress-fill {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

/* Story Image Section */
.story-image-section {
    position: relative;
    flex: 1;
    background: var(--uw-black-1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.story-image {
    object-fit: cover !important;
    min-width: 100%;
}

/* User Info Section */
.story-info-section {
    background: var(--uw-white-1);
    padding: 16px;
}

.story-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
}

.story-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    transition: 0.1s;
}

.story-user-details {
    flex: 1;
    min-width: 0;
}

.story-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--uw-text-1);
    margin: 0 0 2px 0;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: 0.1s;
}

.story-user-name:hover {
    color: var(--uw-blurple-1);
}

.story-time {
    font-size: 12px;
    color: var(--uw-text-2);
}

.story-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.story-view-info {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--uw-background-11);
    border-radius: 50px;
    padding: 10px 20px;
    position: relative;
    cursor: pointer;
    max-height: 16px !important;
}

.story-viewers-avatars {
    display: flex;
    align-items: center;
    margin-right: 4px;
}

.story-viewer-avatar-small {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--uw-white-2);
    object-fit: cover;
    margin-left: -8px;
}

.story-viewer-avatar-small:first-child {
    margin-left: 0;
}

.story-view-count {
    font-size: 12px;
    color: var(--uw-text-2);
    font-weight: 500;
    white-space: nowrap;
}

.story-viewers-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0%;
    transform: translateX(-50%);
    background: var(--uw-background-11);
    border-radius: 20px;
    min-width: 280px;
    max-width: 320px;
    max-height: 400px;
    overflow: hidden;
    z-index: 10002;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    transform: translateX(-50%) translateY(8px);
    pointer-events: none;
}

.story-view-info:hover .story-viewers-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.story-viewers-tooltip-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--uw-white-3);
    font-size: 13px;
    font-weight: 600;
    color: var(--uw-text-1);
    background: var(--uw-white-2);
}

.story-viewers-tooltip-list {
    max-height: 360px;
    overflow-y: auto;
    padding: 8px 0;
}

.story-viewers-tooltip-loading {
    padding: 16px;
    text-align: center;
    color: var(--uw-text-2);
    font-size: 13px;
}

.story-viewer-tooltip-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    transition: background 0.1s;
    cursor: pointer;
}

.story-viewer-tooltip-item:hover {
    background: var(--uw-white-2);
}

.story-viewer-tooltip-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--uw-white-3);
    flex-shrink: 0;
}

.story-viewer-tooltip-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.story-viewer-tooltip-name {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--uw-text-1);
    margin-bottom: 2px;
}

.story-viewer-tooltip-username {
    font-size: 12px;
    color: var(--uw-text-2);
    font-weight: 400;
}

.story-viewer-tooltip-badges {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
}

.story-header-btn {
    background: var(--uw-background-11);
    color: var(--uw-text-1);
    width: 36px;
    height: 36px;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.1s;
    padding: 10px;
    outline: none;
    border: none;
}

.story-header-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.story-header-btn:hover {
    background: var(--uw-white-2);
}

/* Caption Section */
.story-caption-section {
    position: relative;
    background: var(--uw-white-1);
    padding: 0 16px 16px 16px;
    max-height: 150px;
    overflow-y: auto;
}

.story-caption-counter {
    position: absolute;
    top: 4px;
    right: 20px;
    font-size: 11px;
    color: var(--uw-text-3);
    font-weight: 500;
    transition: color 0.2s;
    pointer-events: none;
}

.story-caption-counter.warning {
    color: #F59E0B;
}

.story-caption-counter.error {
    color: var(--uw-red-1);
}

.story-caption {
    color: var(--uw-text-1) !important;
    font-size: 16px;
    line-height: 1.5;
    word-wrap: break-word;
}

.story-user-avatar:hover {
    opacity: 0.8;
}

.story-user-details {
    flex: 1;
}

.story-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--uw-text-1);
    margin: 0 0 2px 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.story-time {
    font-size: 12px;
    color: var(--uw-text-2);
}

.story-close-btn {
    background: none;
    border: none;
    color: var(--uw-text-1);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.story-close-btn:hover {
    opacity: 0.7;
}

/* Story text and emoji overlays */
.story-text-overlay {
    position: absolute;
    color: var(--uw-white-1);
    font-weight: 600;
    pointer-events: none;
    text-align: center;
    max-width: 80%;
}

.story-emoji-overlay {
    position: absolute;
    font-size: 48px;
    pointer-events: none;
}

.story-navigation {
    display: none; /* Hidden - using click zones instead */
}

.story-nav-prev {
    display: none;
}

.story-nav-next {
    display: none;
}

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

/* Story click zones for navigation */
.story-click-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30%;
    z-index: 5;
    cursor: pointer;
}

.story-click-zone-left {
    left: 0;
}

.story-click-zone-right {
    right: 0;
}

.story-viewer-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 10px;
    border-radius: 0 0 20px 20px;
    min-height: 60px;
}

.story-caption {
    color: var(--uw-text-1);
    font-size: 16px;
    line-height: 1.4;
    word-wrap: break-word;
    margin-bottom: 8px;
    border-radius: 20px;
    padding: 12px;
}

/* Story Management Panel - REMOVED, buttons moved to header */

/* Story Stats Modal */
.story-stats-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10001;
    align-items: center;
    justify-content: center;
}

.story-stats-modal.active {
    display: flex;
}

.story-stats-container {
    background: var(--uw-white-1);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 24px;
}

.story-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--uw-white-3);
}

.story-stats-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--uw-text-1);
    margin: 0;
}

.story-stats-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--uw-text-2);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.story-stats-close:hover {
    background: var(--uw-white-3);
}

.story-stats-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--uw-white-2);
    border-radius: 12px;
}

.story-stat-item {
    flex: 1;
    text-align: center;
}

.story-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--uw-blurple-1);
    margin: 0;
}

.story-stat-label {
    font-size: 12px;
    color: var(--uw-text-2);
    margin: 4px 0 0 0;
}

.story-viewers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.story-viewer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--uw-white-2);
    border-radius: 12px;
    transition: background 0.2s;
    cursor: pointer;
}

.story-viewer-item:hover {
    background: var(--uw-white-3);
}

.story-viewer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--uw-white-1);
    flex-shrink: 0;
}

.story-viewer-info {
    flex: 1;
    min-width: 0;
}

.story-viewer-username {
    font-size: 14px;
    color: var(--uw-text-1);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.story-viewer-time {
    font-size: 12px;
    color: var(--uw-text-2);
    margin: 2px 0 0 0;
}

.story-no-viewers {
    text-align: center;
    padding: 40px 20px;
    color: var(--uw-text-2);
    font-size: 14px;
}

/* Story Upload Placeholder (for upload modal using story viewer structure) */
.story-upload-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--uw-white-2);
    cursor: pointer;
    transition: background 0.2s;
}

.story-upload-placeholder:hover {
    background: var(--uw-white-3);
}

.story-upload-placeholder p {
    margin: 0;
}

/* Caption editable placeholder text */
#storyCaptionEditable:empty:before {
    content: attr(data-placeholder);
    color: var(--uw-text-3);
    pointer-events: none;
}

#storyCaptionEditable:focus {
    color: var(--uw-text-1);
}

/* Make change/share buttons show as flex */
#changeImageBtn,
#shareStoryBtn {
    display: none;
}

#changeImageBtn[style*="display: flex"],
#shareStoryBtn[style*="display: flex"] {
    display: flex !important;
}

/* Multi-step UI */
.story-step {
    display: none;
}

.story-step-actions {
    display: flex;
    gap: 12px;
    margin-left: 40px;
    margin-right: 40px;
}

/* Step 1: Crop Canvas */
.story-crop-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.story-crop-canvas {
    cursor: move;
    user-select: none;
    display: block;
    position: relative;
    margin: 0 auto;
}

.story-crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.story-crop-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    border: 3px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.story-crop-controls {
    background: var(--uw-white-2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.story-crop-control-label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    color: var(--uw-text-1);
}

.story-crop-control-label input[type="range"] {
    width: 100%;
}

.story-crop-hint {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: var(--uw-text-2);
    text-align: center;
}
.story-final-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16;
    max-height: 500px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.story-final-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.story-final-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.story-upload-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.story-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-left: 40px;
    margin-right: 40px;
    margin-bottom: 20px;
}

.story-form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--uw-text-1);
}

.story-form-input,
.story-form-textarea {
    background: var(--uw-background-11);
    border-radius: 20px;
    padding: 40px;
    font-size: 14px;
    color: var(--uw-text-1);
    font-family: "Roboto", sans-serif;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.story-form-input:focus,
.story-form-textarea:focus {
    outline: none;
    border-color: var(--uw-blurple-1);
}

.story-form-textarea {
    resize: vertical;
    min-height: 120px;
}

.story-caption-input-wrap {
    position: relative;
}

/* Emoji Autocomplete Styles for Story Upload Modal (floating overlay) */
.story-caption-section .emoji-autocomplete {
    position: fixed;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 668px;
    background: var(--uw-white-1);
    border-radius: 20px;
    z-index: 10001;
    max-height: 280px;
    overflow: hidden;
}

/* Position it above the caption section when modal is open */
#storyUploadModal.active .story-caption-section .emoji-autocomplete {
    top: auto;
    bottom: 200px;
}

.story-caption-section .emoji-autocomplete-header {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--uw-text-1);
    background: var(--uw-white-1);
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.story-caption-section .emoji-autocomplete-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 4px;
    padding: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.story-caption-section .emoji-suggestion {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.1s ease;
    border-radius: 14px;
    gap: 8px;
    border: none;
}

.story-caption-section .emoji-suggestion:hover,
.story-caption-section .emoji-suggestion.selected {
    background: var(--uw-white-2);
}

.story-caption-section .emoji-suggestion img {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    object-fit: contain;
}

.story-caption-section .emoji-suggestion-name {
    font-size: 12px;
    color: var(--uw-text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.story-caption-section .emoji-suggestion-no-results {
    padding: 16px;
    text-align: center;
    color: var(--uw-text-2);
    font-size: 14px;
    grid-column: 1 / -1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .story-caption-section .emoji-autocomplete {
        width: calc(100% - 16px);
        max-height: 240px;
    }
    
    #storyUploadModal.active .story-caption-section .emoji-autocomplete {
        bottom: 180px;
    }
    
    .story-caption-section .emoji-autocomplete-suggestions {
        max-height: 180px;
    }
}

/* Old emoji autocomplete styles (keeping for other uses) */
.story-emoji-autocomplete {
    border-radius: 0 0 20px 20px;
    top: 100%;
}

.story-caption-editable {
    font-family: "Roboto", sans-serif;
    width: 100%;
    padding: 20px;
    font-size: 14px;
    color: var(--uw-text-1);
    border: 1px solid var(--uw-white-3);
    background: var(--uw-white-1);
    border-radius: 20px;
    box-sizing: border-box;
    min-height: 120px;
    line-height: 1.4;
    outline: none;
    white-space: pre-wrap;
}

.story-caption-editable:focus {
    border-color: var(--uw-blurple-1);
    background: var(--uw-white-2);
}

.story-caption-editable:empty::before {
    content: attr(placeholder);
    color: var(--uw-text-2);
    pointer-events: none;
}

.story-emoji-autocomplete .emoji-suggestions {
    max-height: 220px;
}

/* Emoji Autocomplete Styles (shared with create post) */
.emoji-autocomplete {
    position: absolute;
    top: 84%;
    left: 0;
    right: 0;
    background: var(--uw-white-1);
    border-radius: 0 0 20px 20px;
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
}

.emoji-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 4px;
    padding: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.emoji-suggestion {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.1s ease;
    border-radius: 14px;
    gap: 8px;
    border: 1px solid transparent;
}

.emoji-suggestion:hover,
.emoji-suggestion.selected {
    background: var(--uw-white-2);
}

.emoji-suggestion-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    object-fit: contain;
}

.emoji-suggestion-name {
    font-size: 12px;
    color: var(--uw-text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.emoji-suggestion-no-results {
    padding: 16px;
    text-align: center;
    color: var(--uw-text-2);
    font-size: 14px;
    grid-column: 1 / -1;
}

.story-text-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.story-emoji-picker {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    padding: 12px;
    background: var(--uw-white-2);
    border-radius: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.story-emoji-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.2s;
}

.story-emoji-btn:hover {
    background: var(--uw-white-3);
}

.story-color-input {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--uw-white-3);
    cursor: pointer;
}

.story-duration-select {
    background: var(--uw-white-2);
    border: 1px solid var(--uw-white-3);
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    color: var(--uw-text-1);
    font-family: "Roboto", sans-serif;
    cursor: pointer;
}

.story-upload-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.story-btn {
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: 0.1s;
    border: none;
    font-family: "Roboto", sans-serif;
    margin-bottom: 20px;
    width: fit-content !important;
}

.story-btn-primary {
    background: var(--uw-white-2);
    color: var(--uw-text-1);
    border: 1px solid var(--uw-white-3);
}

.story-btn-primary:hover {
    background: var(--uw-white-3);
    border: 1px solid var(--uw-white-4);
    color: var(--uw-blurple-1);
}

.story-btn-primary:disabled {
    background: var(--uw-white-4);
    cursor: not-allowed;
}

.story-btn-secondary {
    background: var(--uw-white-2);
    color: var(--uw-text-1);
    border: 1px solid var(--uw-white-3);
}

.story-btn-secondary:hover {
    background: var(--uw-white-3);
}

.story-file-input {
    display: none;
}

/* Profile Picture Story Ring */
.has-story {
    position: relative;
}

.has-story::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    z-index: -1;
}

.has-story.viewed::before {
    background: var(--uw-white-4);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .stories-wrapper {
        padding: 0 12px;
    }

    .story-item {
        width: 64px;
    }

    .story-avatar-wrapper {
        width: 56px;
        height: 56px;
    }

    .story-avatar-ring {
        width: 62px;
        height: 62px;
    }

    .story-avatar {
        width: 50px;
        height: 50px;
    }

    .story-username {
        font-size: 11px;
        max-width: 64px;
    }

    .story-viewer-container {
        max-width: 100%;
        height: 100vh;
    }

    .story-upload-container {
        width: 95%;
    }

    .story-upload-preview {
        max-height: 300px;
    }

    .story-text-controls {
        grid-template-columns: 1fr;
    }

    .story-emoji-picker {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Loading State */
.story-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--uw-text-2);
}

.story-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--uw-white-3);
    border-top-color: var(--uw-blurple-1);
    border-radius: 50%;
    animation: story-spin 0.8s linear infinite;
}

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

/* Empty State */
.stories-empty {
    text-align: center;
    color: var(--uw-text-2);
    font-size: 14px;
}

