.cp-posts-wrap {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    padding: 2rem 0;
}

/* TikTok-style vertical scrolling layout */
.cp-posts-wrap.tiktok-style {
    display: block;
    height: 100%;
    max-height: 800px;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    padding: 0;
    gap: 0;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    background: #000;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.cp-posts-wrap.tiktok-style::-webkit-scrollbar {
    width: 4px;
}

.cp-posts-wrap.tiktok-style::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.cp-posts-wrap.tiktok-style::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 2px;
}

.cp-posts-wrap.tiktok-style::-webkit-scrollbar-thumb:hover {
    background: #b8943a;
}

.cp-post-item {
    border: 1px solid var(--grey-lt);
    border-radius: var(--radius-lg);
    padding: 2rem;
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

/* TikTok-style post items */
.cp-post-item.tiktok-style {
    /* Each post should match the scrolling container height, not the viewport */
    height: 100%;
    max-height: none;
    min-height: 600px; /* Ensure minimum height for content to be visible */
    width: 100%;
    border-radius: 0;
    border: none;
    padding: 0;
    margin: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
}

.cp-post-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gold) 0%, #b8943a 50%, var(--gold) 100%);
    transform: scaleX(0);
    transition: var(--transition);
}

.cp-post-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(135, 106, 32, 0.15);
    border-color: var(--gold);
}

.cp-post-item:hover::before {
    transform: scaleX(1);
}

.cp-post-item h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--black);
    font-family: 'Martel', serif;
    font-weight: 600;
    position: relative;
    padding-left: 1rem;
}

.cp-post-item h3::before {
    content: '★';
    position: absolute;
    left: 0;
    color: var(--gold);
    font-size: 0.9rem;
}

.cp-post-text {
    font-size: 1rem;
    color: var(--grey-dk);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-weight: 300;
}

.cp-post-date {
    font-size: 0.85rem;
    color: var(--gold);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1.5rem;
    position: relative;
    padding-left: 1.5rem;
}

.cp-post-date::before {
    content: '📅';
    position: absolute;
    left: 0;
    font-size: 0.8rem;
}

.cp-post-media {
    margin: 1.5rem 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

/* TikTok-style media */
.cp-post-media.tiktok-style {
    flex: 1;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    align-items: stretch; /* fill area */
    justify-content: stretch;
    position: relative;
    width: 100%;
    min-height: 500px; /* Ensure media area has minimum height */
}

/* Make inner media slider fill full height in TikTok view */
.cp-post-media.tiktok-style .cp-post-splide {
    height: 100%;
    width: 100%;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    background: #000;
    display: flex;
}
.cp-post-media.tiktok-style .cp-post-splide .splide__track,
.cp-post-media.tiktok-style .cp-post-splide .splide__list,
.cp-post-media.tiktok-style .cp-post-splide .splide__slide {
    height: 100%;
    width: 100%;
    min-height: 400px;
}

/* Force all slides to be visible - override Splide defaults */
.cp-post-splide {
    width: 100%;
    height: 100%;
}

.cp-post-splide .splide__track {
    height: 100%;
}

.cp-post-splide .splide__list {
    height: 100%;
}

.cp-post-splide .splide__slide {
    height: 100%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    visibility: visible !important;
    opacity: 1 !important;
}

.cp-post-splide .splide__slide img,
.cp-post-splide .splide__slide video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}
.cp-post-media.tiktok-style .cp-post-splide .splide__slide img,
.cp-post-media.tiktok-style .cp-post-splide .splide__slide video {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border-radius: 0;
    object-fit: cover;
    display: block;
}

/* In modal, show media fully (no cropping) by letterboxing if needed */
.cp-posts-modal .cp-post-media.tiktok-style .cp-post-splide .splide__slide img,
.cp-posts-modal .cp-post-media.tiktok-style .cp-post-splide .splide__slide video {
    object-fit: contain !important;
    max-width: 100%;
    max-height: 100%;
}

/* Broad safeguard in modal: ensure any slide media is contained, not cropped */
.cp-posts-modal .splide__slide img,
.cp-posts-modal .splide__slide video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

/* In modal, make any letterbox area match modal background (white) */
.cp-posts-modal .cp-post-media.tiktok-style .cp-post-splide {
    background: #9d9898 !important;
}
.cp-posts-modal .cp-post-item.tiktok-style {
    background: #9d9898 !important;
}

/* Ensure all inner Splide layers in modal use the same gray for letterboxing */
.cp-posts-modal .cp-post-media.tiktok-style .cp-post-splide .splide__track,
.cp-posts-modal .cp-post-media.tiktok-style .cp-post-splide .splide__list,
.cp-posts-modal .cp-post-media.tiktok-style .cp-post-splide .splide__slide {
    background: #9d9898 !important;
}

/* Ensure video element's own letterbox (from object-fit: contain) uses gray */
.cp-posts-modal .cp-post-media.tiktok-style .cp-post-splide .splide__slide video,
.cp-posts-modal .splide__slide video {
    background-color: #9d9898 !important;
}

/* In modal, hide all paginations by default and only show a single one */
.cp-posts-modal .cp-post-splide .splide__pagination { display: none !important; }
.cp-posts-modal .cp-post-splide > .splide__pagination:last-of-type { display: flex !important; }

/* In modal feed, only reveal pagination for the active slide's inner media slider */
.cp-posts-modal .cp-feed-splide .splide__slide .cp-post-splide .splide__pagination { display: none !important; }
.cp-posts-modal .cp-feed-splide .splide__slide.is-active .cp-post-splide > .splide__pagination:last-of-type { display: flex !important; }

.cp-post-media:hover {
    box-shadow: 0 6px 20px rgba(135, 106, 32, 0.2);
}

.cp-post-media img,
.cp-post-media video {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-lg);
    height: 350px;
    object-fit: cover;
    transition: var(--transition);
}

/* TikTok-style media content */
.cp-post-media.tiktok-style img,
.cp-post-media.tiktok-style video {
    width: 100%;
    height: 100%;
    border-radius: 0;
    object-fit: cover;
}

.cp-post-media:hover img,
.cp-post-media:hover video {
    transform: scale(1.02);
}

/* Disable hover zoom effects in Feed View */
.cp-post-item.tiktok-style:hover { transform: none; box-shadow: none; border-color: transparent; }
.cp-post-media.tiktok-style:hover img,
.cp-post-media.tiktok-style:hover video { transform: none; }

/* Grid layout for multiple media items */
.cp-post-media.multiple-media {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    grid-gap: 1rem;
}

.cp-post-media.multiple-media img,
.cp-post-media.multiple-media video {
    height: 250px;
    object-fit: cover;
}

/* Enhanced Splide slider styles */
.cp-feed-splide {
    position: absolute;
    top: 0; /* header now contains the toggle; no gap needed */
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    width: 100%;
}

.cp-feed-splide .splide__track,
.cp-feed-splide .splide__list,
.cp-feed-splide .splide__slide {
    height: 100%;
    width: 100%;
}

.cp-post-splide {
    margin: 1.5rem 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Grid view */
.cp-grid {
    position: absolute;
    top: 0; /* header now contains the toggle; no gap needed */
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 6px;
    padding-bottom: 6rem; /* extra space so last row isn't hidden behind floating UI */
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: #fff;
    pointer-events: auto;
    z-index: 1;
}

/* Caption expand modal */
.caption-modal { position: fixed; inset: 0; z-index: 10000; display: none; }
.caption-modal.open { display: block; }
.caption-modal-overlay{ position:absolute; inset:0; background:rgba(0,0,0,.4); }
.caption-modal-content{ position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:min(520px,92vw); max-height:60vh; background:#fff; color:var(--black); border-radius:12px; box-shadow:0 10px 30px rgba(0,0,0,.2); padding:1rem 1.25rem; display:flex; flex-direction:column; }
.caption-close{ align-self:flex-end; background:transparent; border:0; font-size:1.5rem; line-height:1; cursor:pointer; color:var(--black); }
.caption-body{ overflow:auto; margin-top:.5rem; white-space:pre-wrap; line-height:1.6; }

@media (max-width: 768px) {
    /* Ensure feed uses full height on small screens so text isn't clipped */
    .cp-feed-splide { bottom: 0; }
    .cp-grid {
        padding-bottom: 8rem; /* a bit more space on mobile */
    }
    /* Tighten the embedded posts modal on mobile to remove bottom gap */
    .posts-page #posts-modal .cp-posts-modal-content { height: calc(100vh - 1rem) !important; }
    .posts-page .cp-post-media.tiktok-style { padding-bottom: 0 !important; }
    .posts-page .cp-post-media.tiktok-style .cp-post-splide { height: 100% !important; }
    .posts-page .cp-posts-modal .cp-grid { padding-bottom: 0 !important; }
    /* Place caption overlay lower, just above controls/safe-area */
    .cp-post-content-overlay { bottom: calc(1.25rem + env(safe-area-inset-bottom)) !important; }
    .cp-post-item.has-video .cp-post-content-overlay { bottom: calc(6.5rem + env(safe-area-inset-bottom)) !important; }
}

/* Posts page (embedded modal) mobile spacing tweaks */
@media (max-width: 768px) {
    .posts-page .cp-posts-page { margin-top: .5rem !important; }
    .posts-page .cp-posts-modal { margin: .5rem 0 0 0 !important; }
    .posts-page #posts-modal .cp-posts-modal-header { padding: 1rem !important; }
}

/* Simplified posts modal header layout */
.cp-posts-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.cp-posts-modal-header h2 {
    margin: 0;
    text-align: left;
    flex: 1 1 auto;
}
.cp-posts-modal-header .cp-posts-view-toggle {
    position: static;
    transform: none;
    margin: 0 2.5rem 0 auto; /* push right, keep space for close button */
    display: flex;
    gap: .5rem;
}
/* Ensure the back-to-grid button lives inline next to the toggle */
.cp-posts-modal-header .cp-back-to-grid { position: static; left: auto; top: auto; margin: 0 .25rem 0 0; }

/* Remove extra spacing inside modal body; let feed/grid fill fully */
.cp-posts-modal-body .cp-posts-wrap { gap: 0; padding: 0; }
.cp-posts-modal-body .cp-posts-wrap.tiktok-style { height: 100%; max-height: none; }

/* Reduce extra bottom space in grid when inside modal */
.cp-posts-modal .cp-grid { padding-bottom: 1rem; }

.cp-grid-item {
    position: relative;
    width: 100%;
    padding-top: 133%; /* 3:4 portrait-ish ratio */
    overflow: hidden;
    border-radius: 8px;
}

.cp-grid-item img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cp-grid-item .cp-grid-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.cp-post-splide .splide__slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
    position: relative;
    min-height: 350px;
}

.cp-post-splide .splide__slide img,
.cp-post-splide .splide__slide video {
    width: 100%;
    height: 100%;
    min-height: 350px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    transition: var(--transition);
    display: block;
}

/* Hide default Splide pagination; we render a custom one */
.cp-post-splide .splide__pagination { display: none !important; }

.cp-post-splide .splide__pagination__page {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(135, 106, 32, 0.3);
    width: 12px;
    height: 12px;
    margin: 0 4px;
    transition: var(--transition);
}

.cp-post-splide .splide__pagination__page.is-active {
    background: var(--gold);
    border-color: var(--gold);
    transform: scale(1.2);
}

.cp-post-splide .splide__pagination__page:hover {
    background: var(--gold);
    border-color: var(--gold);
}

/* Custom simple pagination (single source of truth) */
/* Hide custom simple pagination dots entirely */
.cp-simple-pagination{ display:none !important; }
.cp-simple-dot{ display:none !important; }

/* In modal, suppress any default Splide paginations just in case */
.cp-posts-modal .splide__pagination{ display:none !important; }

.cp-post-splide .splide__arrow {
    background: rgba(135, 106, 32, 0.9);
    color: #fff;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    opacity: 0.9;
    transition: var(--transition);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.cp-post-splide .splide__arrow:hover {
    background: var(--gold);
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.5);
}

/* Hide arrows when they are disabled (at the first/last slide) */
.cp-post-splide .splide__arrow[disabled] {
    display: none !important;
    pointer-events: none;
    opacity: 0;
}

.cp-post-splide .splide__arrow svg {
    width: 22px;
    height: 22px;
}

/* Post item loading animation */
.cp-post-item {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation for multiple posts */
.cp-post-item:nth-child(1) { animation-delay: 0.1s; }
.cp-post-item:nth-child(2) { animation-delay: 0.2s; }
.cp-post-item:nth-child(3) { animation-delay: 0.3s; }
.cp-post-item:nth-child(4) { animation-delay: 0.4s; }
.cp-post-item:nth-child(5) { animation-delay: 0.5s; }

/* TikTok-style content overlay */
.cp-post-content-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent; /* remove gradient behind name/caption/date */
    padding: .75rem 1.25rem calc(2.25rem + env(safe-area-inset-bottom)) 1.25rem;
    color: white;
    z-index: 100;
    display: flex;
    flex-direction: column;
    row-gap: .35rem;
    pointer-events: none; /* avoid being clipped by overlapping UI; media still draggable */
}

/* When a post contains video, ensure overlay sits above native controls */
.cp-post-item.has-video video { pointer-events: auto; }
/* Position overlay above native controls area for video posts */
.cp-post-item.has-video .cp-post-content-overlay { 
    z-index: 200; 
    pointer-events: none; /* allow video controls to receive taps */
    bottom: 3.6rem; /* leave space for controls */
    padding-bottom: 1rem; 
}

@media (max-width: 768px) {
    .cp-post-item.has-video .cp-post-content-overlay { bottom: calc(8.5rem + env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
    .cp-post-item.has-video .cp-post-content-overlay { bottom: calc(9rem + env(safe-area-inset-bottom)); }
}

.cp-post-content-overlay h3 {
    color: #fff;
    font-size: 1.35rem;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Clickable post author name */
.cp-post-name-link { color: #fff; text-decoration: none; pointer-events: auto; }
.cp-post-name-link:hover { text-decoration: underline; }

.cp-post-content-overlay .cp-post-text {
    color: rgba(255, 255, 255, 0.92);
    font-size: .95rem;
    line-height: 1.35;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    /* One-line clamp with ellipsis; clickable to expand */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    pointer-events: auto;
    cursor: pointer;
}

/* In-post caption slide-up overlay */
.cp-caption-overlay{ position:absolute; left:0; right:0; bottom:0; top:0; display:flex; align-items:flex-end; pointer-events:none; z-index:400; }
.cp-caption-overlay.open{ pointer-events:auto; }
.cp-caption-box{ width:100%; max-height:calc(98% - env(safe-area-inset-bottom)); background:rgba(0,0,0,.85); color:#fff; transform:translateY(100%); transition:transform .3s ease; padding:1rem 1rem calc(2.75rem + env(safe-area-inset-bottom)) 1rem; overflow:hidden; border-top-left-radius:12px; border-top-right-radius:12px; display:flex; flex-direction:column; row-gap:.75rem; box-sizing:border-box; }
.cp-caption-overlay.open .cp-caption-box{ margin-bottom: 0; padding-top: 2rem; }
.cp-caption-overlay.open .cp-caption-box{ transform:translateY(0); }
.cp-caption-box { position: relative; }
.cp-caption-box .caption-close{ position:absolute; right:.6rem; top:.6rem; background:rgba(0,0,0,.5); border:1px solid rgba(255,255,255,.35); color:#fff; font-size:1.2rem; line-height:1; cursor:pointer; width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center; }
.cp-caption-box .caption-header{ font-weight:700; font-size:1.25rem; line-height:1.2; padding-right:2rem; }
.cp-caption-box .caption-body{ white-space:pre-wrap; line-height:1.6; position:relative; flex:1 1 auto; overflow:auto; padding-bottom: 4.5rem; }
.cp-caption-box .caption-date{ font-size:.9rem; opacity:.9; position: sticky; bottom: 0; padding-top: .75rem; padding-bottom: env(safe-area-inset-bottom); background: transparent; }
/* Show a simple, always-visible thin scrollbar for the caption body */
.cp-caption-box .caption-body{ scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.6) transparent; scrollbar-gutter: stable; -webkit-overflow-scrolling: touch; }
.cp-caption-box .caption-body::-webkit-scrollbar{ width: 6px; }
.cp-caption-box .caption-body::-webkit-scrollbar-track{ background: transparent; }
.cp-caption-box .caption-body::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.6); border-radius: 6px; }
.cp-caption-box .caption-body::-webkit-scrollbar-thumb:hover{ background: rgba(255,255,255,.8); }
/* Remove faux track to avoid a second scrollbar; rely on native scrollbar styling above */
.cp-caption-box .caption-body::after{ content:''; width:0; height:0; }

.cp-post-content-overlay .cp-post-date {
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
    margin: 0;
}

/* When caption overlay is open, hide the base overlay so there is no visual overlap */
.cp-post-item .cp-caption-overlay.open ~ .cp-post-content-overlay,
.cp-post-item .cp-post-content-overlay.hidden-while-caption { display: none; }

/* Ensure caption box respects safe-area and avoids being cut off by mobile UI */
@media (max-width: 768px) {
    .cp-caption-box{ max-height: calc(80% - env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) {
    .cp-caption-box{ max-height: calc(82% - env(safe-area-inset-bottom)); }
}

/* TikTok-style navigation controls */
.cp-tiktok-controls {
    position: absolute;
    right: 1rem;
    bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 3;
}

.cp-tiktok-control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.cp-tiktok-control-btn:hover {
    background: var(--gold);
    border-color: var(--gold);
    transform: scale(1.1);
}

.cp-tiktok-control-btn svg {
    width: 24px;
    height: 24px;
}

/* Progress indicator */
.cp-tiktok-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 3;
}

.cp-tiktok-progress-bar {
    height: 100%;
    background: var(--gold);
    width: 0%;
    transition: width 0.3s ease;
}

/* Scroll indicator */
/* Hide auxiliary scroll indicator dots on the right */
.cp-tiktok-scroll-indicator { display: none !important; }

.cp-tiktok-scroll-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: var(--transition);
}

.cp-tiktok-scroll-dot.active {
    background: var(--gold);
    transform: scale(1.2);
}

.cp-tiktok-scroll-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    margin-top: 1rem;
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
    /* Aggressively raise video so native controls are fully visible */
    .cp-post-media.tiktok-style { padding-bottom: calc(6.75rem + env(safe-area-inset-bottom)); }
    .cp-post-media.tiktok-style .cp-post-splide { height: calc(100% - (6.75rem + env(safe-area-inset-bottom))); }
    .cp-posts-wrap {
        gap: 2rem;
        padding: 1.5rem 0;
    }
    
    .cp-posts-wrap.tiktok-style {
        height: 70vh;
        max-height: 600px;
    }
    
    .cp-post-item {
        padding: 1.5rem;
        margin: 0 1rem;
    }
    
    .cp-post-item.tiktok-style {
        height: 70vh;
        max-height: 600px;
        min-height: 500px;
    }
    
    .cp-post-item h3 {
        font-size: 1.1rem;
        padding-left: 0.75rem;
    }
    
    .cp-post-item h3::before {
        font-size: 0.8rem;
    }
    
    .cp-post-text {
        font-size: 0.95rem;
        margin-bottom: 1.25rem;
    }
    
    .cp-post-date {
        font-size: 0.8rem;
        padding-left: 1.25rem;
        margin-bottom: 1.25rem;
    }
    
    .cp-post-media img,
    .cp-post-media video {
        height: 250px;
    }
    
    .cp-post-splide .splide__slide img,
    .cp-post-splide .splide__slide video {
        height: 250px;
    }
    
    .cp-post-media.multiple-media {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        grid-gap: 0.75rem;
    }
    
    .cp-post-media.multiple-media img,
    .cp-post-media.multiple-media video {
        height: 180px;
    }
    
    .cp-post-splide .splide__arrow {
        width: 40px;
        height: 40px;
    }
    
    .cp-post-splide .splide__arrow svg {
        width: 20px;
        height: 20px;
    }
    
    /* TikTok-style mobile adjustments */
    .cp-post-content-overlay {
        /* Slightly higher to show more caption */
        bottom: calc(25% + env(safe-area-inset-bottom));
        padding: .85rem 1rem calc(2.25rem + env(safe-area-inset-bottom)) 1rem;
        row-gap: .3rem;
    }
    /* Ensure same position on video posts */
    .cp-post-item.has-video .cp-post-content-overlay {
        bottom: calc(25% + env(safe-area-inset-bottom));
    }
    .cp-caption-overlay.open .cp-caption-box{ margin-bottom: 0; padding-top: 2.25rem; }
    
    .cp-post-content-overlay h3 {
        font-size: 1.15rem;
    }
    
    .cp-tiktok-controls {
        right: 0.75rem;
        bottom: 1.5rem;
        gap: 0.75rem;
    }
    
    .cp-tiktok-control-btn {
        width: 45px;
        height: 45px;
    }
    
    .cp-tiktok-control-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .cp-tiktok-scroll-indicator {
        right: 0.75rem;
    }
    /* Place media dots near the lower edge on small screens */
    .cp-simple-pagination{ bottom: calc(.75rem + env(safe-area-inset-bottom)); }
    /* Hide dots entirely in the posts modal on small screens; keep arrows */
    .cp-posts-modal .cp-simple-pagination{ display:none !important; }
}

@media (max-width: 480px) {
    /* Even more lift on very small screens for full control visibility */
    .cp-post-media.tiktok-style { padding-bottom: calc(7rem + env(safe-area-inset-bottom)); }
    .cp-post-media.tiktok-style .cp-post-splide { height: calc(100% - (7rem + env(safe-area-inset-bottom))); }
    .cp-post-content-overlay {
        bottom: calc(1.25rem + env(safe-area-inset-bottom)) !important;
        padding: .8rem 0.9rem calc(2.25rem + env(safe-area-inset-bottom)) 0.9rem;
    }
    .cp-post-item.has-video .cp-post-content-overlay {
        bottom: calc(6.5rem + env(safe-area-inset-bottom)) !important;
    }
    .cp-caption-overlay.open .cp-caption-box{ margin-bottom: 0; padding-top: 2.5rem; }
    .cp-post-item {
        padding: 1.25rem;
        margin: 0 0.5rem;
    }
    
    .cp-post-item h3 {
        font-size: 1rem;
    }
    
    .cp-post-text {
        font-size: 0.9rem;
    }
    
    .cp-post-media img,
    .cp-post-media video {
        height: 200px;
    }
    
    .cp-post-splide .splide__slide img,
    .cp-post-splide .splide__slide video {
        height: 200px;
    }
    
    .cp-post-media.multiple-media img,
    .cp-post-media.multiple-media video {
        height: 150px;
    }
    /* Keep dots near the lower edge on very small screens */
    .cp-simple-pagination{ bottom: calc(.9rem + env(safe-area-inset-bottom)); }
    /* Hide dots entirely in the posts modal on very small screens; keep arrows */
    .cp-posts-modal .cp-simple-pagination{ display:none !important; }
}