.flashM {
    overflow: hidden;
    position: sticky;
    top: 53px;
    height: calc(100vh - 53px);
}

/* Swipe Feed Container with Scroll Snapping */
.swipe-feed-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    /* Prevent layout shift on scroll */
    scrollbar-width: none;
    /* Hide for Firefox */
    -ms-overflow-style: none;
    /* Hide for IE/Edge */
}

.swipe-feed-container::-webkit-scrollbar {
    display: none;
    /* Hide for Chrome/Safari */
}

/* Force momentum scrolling on iOS */
.swipe-feed-container {
    -webkit-overflow-scrolling: touch;
}

/* Individual Card with Snap Points - Centered and Premium Rounded */
.swipe-card {
    position: relative;
    height: calc(100dvh - 83px);
    margin: 15px auto;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    font-family: 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.3125;
    margin: 15px 40px 15px 15px;
}

/* Featured Image Section */
.image-container {
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    height: 45%;
    /* Increased from 45% */
    width: 100%;
    z-index: 1;
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}


.post-featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Blurred Background for the whole card */
.card-blurred-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.card-blurred-bg img {
    width: 100%;
    height: 50%;
    object-fit: cover;
    filter: blur(60px) brightness(0.6) saturate(1.4);
    transform: scale(1.2);
}



/* Hide the existing flash header */
.flash-feed-header {
    display: none !important;
}

/* Image Nav Overlay (Top-Left) */
.image-nav-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1000;
}

.flash-nav-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.5);
    height: 30px;
    /* Expert Desktop height */
    padding: 0 15px;
    border-radius: 16px;
    color: #ffffff;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.flash-nav-trigger:hover {
    color: var(--primary-color);
}

.flash-nav-label {
    font-size: var(--font-13);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.flash-nav-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flash-nav-chevron svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}



/* Stats overlay at bottom of image */
/* Stats overlay at bottom of image */
/* New Flash Stats Bar Styling */
.flash-stats-new {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    box-sizing: border-box;
}

.stats-info-left {
    display: flex;
    flex-direction: column;
}

.stats-publisher-name {
    font-size: var(--font-12);
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
}

.stats-publisher-name:hover {
    text-decoration: underline;
}

.stats-meta-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-12);
    color: var(--text-secondary);
}

.stats-sep {
    color: var(--text-muted);
}

.stats-actions-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.flash-stats-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.flash-stats-icon:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

.flash-stats-icon svg {
    width: var(--font-21);
    height: var(--font-21);
}

.flash-stats-icon.liked svg {
    fill: #F91880;
    color: #F91880;
}

.flash-stats-icon.bookmarked svg {
    fill: var(--primary-color);
    color: var(--primary-color);
}


/* Removed CSS-based filling for liked and bookmarked states */

/* Three dots menu icon styling */
.flash-menu-icon {
    color: #ffffff;
}

.flash-menu-icon:hover {
    color: var(--primary-color);
}

/* Default state (Desktop): Show Horizontal, Hide Vertical */
.icon-vertical {
    display: none !important;
}

.icon-horizontal {
    display: flex !important;
}

/* Image menu overlay for three dots icon */
.image-menu-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    /* Increased z-index */
    background-color: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    border-radius: 50%;
    width: 30px;
    /* Match Desktop height */
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Removed overflow: hidden from parents if possible, 
       but here we just ensure the overlay doesn't clip children */
    overflow: visible;
}

/* Back button overlay - Left top corner */
.image-back-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1000;
    overflow: visible;
}

/* Back button - Circular icon button (same style as menu icon) */
.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background-color: rgb(0 0 0 / 50%);
    border-radius: 50%;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 0;
}

.back-btn .back-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: #ffffff;
}

/* Content Area - Fixed Height with Scroll */
.post-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    position: relative;
    box-sizing: border-box;
    margin: -30px 12px 12px 12px;
    padding: 0;
    border-radius: 12px 12px 0 0;
    font-family: 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    overflow: hidden;
    /* Changed from visible to hidden to clip bottom-section */
    /* Allow stats to overlap upwards */
    min-height: 0;
    /* Important for flex child to shrink properly */
    border: none;
    z-index: 10;
}

.post-title {
    font-weight: 600;
    /* Bold for titles like Twitter */
    color: var(--text-primary);
    margin-bottom: 5px;
    line-height: 1.3125;
    /* Twitter line height */
    font-size: var(--font-18);
    /* Twitter header size */
    margin-top: 0;
    padding: 15px 15px 0 15px;
    font-family: 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    display: block;
    /* Override global -webkit-box */
    overflow: visible;
    /* Ensure it's not hidden */
    -webkit-line-clamp: none;
    /* Remove line clamp */
    line-clamp: none;
}

.post-content {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    /* Hide content that exceeds available space */
    min-height: 0;
    padding: 0 15px 10px 15px;
}

/* Content Fade Overlay for Truncated Text */
.content-fade-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    /* Increased height */
    background: linear-gradient(to bottom, transparent 0%, var(--bg-primary) 70%);
    /* Stronger fade at bottom */
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    display: flex;
    flex-direction: row;
    /* Changed to inline */
    align-items: end;
    justify-content: center;
    padding-bottom: 5px;
    color: var(--text-secondary);
    font-size: var(--font-14);
    font-weight: 400;
    gap: 6px;
}

/* Show overlay only when there's overflow AND not expanded */
.post-content-area:not(.is-expanded) .post-content.has-overflow .content-fade-overlay {
    opacity: 1;
}

.content-fade-overlay svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

/* Hide text/icon but maybe keep a small fade when expanded or just hide completely */
.post-content-area.is-expanded .content-fade-overlay {
    opacity: 0 !important;
}

.post-content-wrapper {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.post-content p {
    margin-bottom: 0;
    font-size: var(--font-16);
    margin-top: 0;
    color: var(--text-secondary);
    font-family: 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-weight: 400;
    line-height: 1.4;
}

.post-meta,
.post-meta a {
    color: var(--text-muted);
    font-size: var(--font-14);
    text-decoration: none;
    font-family: 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-weight: 400;
    line-height: 1.3125;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
}

.publisher-link {
    display: inline-flex !important;
    align-items: center;
    gap: 0 !important;
}

/* Navigation Arrows */
.swipe-nav-arrows {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 100;
}

.swipe-nav-arrow {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-family: 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-weight: 500;
}

.swipe-nav-arrow:hover {
    transform: scale(1.1);
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
}

.swipe-nav-arrow:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
    background-color: rgba(255, 255, 255, 0.5);
}

/* Loading and Error States */
.loading-indicator,
.no-flashes-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100dvh;
    /* Use dynamic viewport height */
    text-align: center;
    color: #777;
    font-family: 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Mobile: Show Vertical, Hide Horizontal */
@media (max-width: 768px) {
    .icon-vertical {
        display: flex !important;
    }

    .icon-horizontal {
        display: none !important;
    }

    .image-nav-overlay,
    .image-back-overlay {
        top: 8px;
        left: 8px;
    }

    .image-menu-overlay {
        top: 8px;
        right: 8px;
        width: 28px;
        height: 28px;
    }

    .flash-nav-trigger {
        height: 28px;
        padding: 0 12px;
    }

    /* Skeleton mobile overrides */
    .swipe-card.skeleton .flash-nav-trigger {
        width: 75px !important;
        height: 28px !important;
    }

    .swipe-card.skeleton .image-menu-overlay div {
        width: 28px !important;
        height: 28px !important;
    }
}

/* Responsive Design */
@media (max-width: 768px) {

    .swipe-feed-container,
    .swipe-card {
        height: calc(100dvh - 53px);
        /* Mobile: account for both main header (53px) and mobile nav (45px) */
        font-family: 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
        font-size: 15px;
        font-weight: 400;
        line-height: 1.3125;
        margin: 0;
        border-radius: 0;
        border: none;
    }

    .swipe-nav-arrows {
        display: none;
    }
}

/* Mobile border radius for flash cards */
@media (max-width: 768px) {

    /* Mobile border radius */
    .flash-card {
        border-radius: 0;
    }
}

/* Animation Classes for Card Transitions */
.slide-up-out {
    transform: translateY(-100dvh);
    /* Use dynamic viewport height */
    opacity: 0;
}

.slide-down-out {
    transform: translateY(100dvh);
    /* Use dynamic viewport height */
    opacity: 0;
}

.slide-from-top {
    transform: translateY(-100dvh);
    /* Use dynamic viewport height */
    opacity: 0;
}

.slide-from-bottom {
    transform: translateY(100dvh);
    /* Use dynamic viewport height */
    opacity: 0;
}

.slide-to-position {
    transform: translateY(0);
    opacity: 1;
}



/* Flash Bottom Section */
.flash-bottom-section {
    position: relative;
    height: 52px;
    overflow: hidden;
    flex-shrink: 0;
    background-color: transparent;
    border-radius: 10px;
}

.flash-bottom-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.flash-bottom-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(10px) brightness(0.8) saturate(1.6);
    /* Lower blur (10px) and higher saturation (1.6) for a distinct reflection */
    transform: scale(1.7);
}

.flash-bottom-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    /* Very minimal overlay to let the image shine */
    z-index: 2;
}

.flash-bottom-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 15px;
    color: #ffffff;
    z-index: 3;
}

.flash-bottom-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flash-bottom-line {
    font-size: var(--font-13);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flash-bottom-line:not(:last-child) {
    margin-bottom: 2px;
}

.flash-bottom-arrow {
    flex-shrink: 0;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile styles */
@media (max-width: 768px) {
    .image-container {
        height: 41.5%;
        /* Increased from 35% */
    }

    .post-content-area {
        margin: -40px 8px 8px 8px;
        /* Less margin on mobile (5px instead of 10px) */
    }

    .post-title {
        font-size: var(--font-17);
        padding: 12px 12px 0 12px;
    }

    .post-content {
        padding: 0 12px 8px 12px;
    }

    .flash-stats-new {
        padding: 8px 12px;
    }

    .flash-bottom-content {
        padding: 0 12px;
    }

    .post-content p {
        font-size: var(--font-15);
    }
}

/* Instagram-like Heart Animation */
.like-heart-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 1000;
    pointer-events: none;
    will-change: transform, opacity;
}

.like-pulse-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 999;
    pointer-events: none;
    will-change: transform, opacity;
}

/* Skeleton Loading States - Built from scratch to match real card */
.swipe-card.skeleton {
    overflow: hidden;
    background-color: var(--bg-primary);
}

.skeleton-image,
.skeleton-title,
.skeleton-text,
.skeleton-text-small,
.skeleton-meta,
.skeleton-icon,
.skeleton-overlay {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.skeleton-title {
    height: 18px;
    border-radius: 6px;
}

.skeleton-text,
.skeleton-text-small,
.skeleton-meta,
.skeleton-icon,
.skeleton-overlay {
    border-radius: 4px;
}

.skeleton-icon {
    border-radius: 50%;
}

/* Reset backgrounds for containers during skeleton state */
.swipe-card.skeleton .flash-nav-trigger,
.swipe-card.skeleton .image-menu-overlay,
.swipe-card.skeleton .image-back-overlay {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Shimmer Animation */
@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

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

/* Visibility toggles */
.swipe-card.skeleton .flash-bottom-section,
.swipe-card.skeleton .post-title,
.swipe-card.skeleton .post-content,
.swipe-card.skeleton .flash-stats-new {
    /* These containers will host skeleton elements */
    visibility: visible;
}

.swipe-card.skeleton .post-featured-image {
    display: none;
}

.swipe-card:not(.skeleton) .skeleton-image,
.swipe-card:not(.skeleton) .skeleton-title,
.swipe-card:not(.skeleton) .skeleton-text,
.swipe-card:not(.skeleton) .skeleton-text-small,
.swipe-card:not(.skeleton) .skeleton-meta,
.swipe-card:not(.skeleton) .skeleton-icon,
.swipe-card:not(.skeleton) .skeleton-overlay {
    display: none;
}



.skeleton-bottom {
    background-color: var(--bg-secondary) !important;
}

/* Category Grid Styles for Bottom Sheet */
.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 10px 5px;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 5px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.category-item:hover {
    background: var(--bg-secondary);
}

.category-item.active {
    background: var(--bg-tertiary);
}

.category-item:active {
    transform: scale(0.95);
}

.category-icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 20px;
    border: 1px solid var(--border-color);
}

.category-item.active .category-icon-circle {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.category-name {
    font-size: var(--font-13);
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-item.active .category-name {
    color: var(--primary-color);
    font-weight: 600;
}

@media (max-width: 400px) {
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}