:root {
    --accent: #7C5CFC;
    --accent-hot: #FF3CAC;
    --surface: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --text-primary: #F0EEF8;
    --text-muted: rgba(240, 238, 248, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #08070F;
    font-family: 'DM Sans', sans-serif;
}

/* ── Layout ── */
.reel-wrapper {
    max-width: 430px;
    margin: 0 auto;
    position: relative;
}

.reel-container {
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height - accounts for mobile browser chrome */
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

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

/* ── Individual Reel ── */
.reel {
    position: relative;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height */
    scroll-snap-align: start;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #08070F;
    overflow: hidden;
}

/* Blurred ambient background */
.reel-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(40px) brightness(0.3) saturate(1.6);
    transform: scale(1.15);
    transition: opacity 0.5s;
}

/* Product image */
.reel-img-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    /* Reserve space so image doesn't sit behind overlay */
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Push image up so it's not hidden behind bottom overlay */
    padding-bottom: 210px;
    padding-top: 70px;
}

.reel img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reel.active img {
    transform: scale(1.03);
}

/* ── Top bar (exit + view cart) ── */
.top-bar {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    /* Add safe area for notched phones */
    padding-top: calc(14px + env(safe-area-inset-top));
    background: linear-gradient(to bottom, rgba(8, 7, 15, 0.85), transparent);
    pointer-events: none;
}

.top-bar>* {
    pointer-events: all;
}

.btn-exit {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.2s, transform 0.2s;
    line-height: 1;
}

.btn-exit:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: scale(1.08);
}

.top-brand {
    font-family: 'Syne', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.btn-view-cart {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(124, 92, 252, 0.2);
    border: 1px solid rgba(124, 92, 252, 0.45);
    backdrop-filter: blur(10px);
    color: #C4B0FF;
    font-family: 'Syne', sans-serif;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 13px;
    border-radius: 20px;
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.btn-view-cart:hover {
    background: rgba(124, 92, 252, 0.35);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124, 92, 252, 0.35);
}

.btn-view-cart .cart-count {
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ── Bottom overlay ── */
.reel-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    padding: 28px 20px 24px;
    /* Safe area padding for home indicator on iOS */
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    background: linear-gradient(to top,
            rgba(8, 7, 15, 0.97) 0%,
            rgba(8, 7, 15, 0.75) 55%,
            transparent 100%);
}

/* Badge */
.reel-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(124, 92, 252, 0.18);
    border: 1px solid rgba(124, 92, 252, 0.35);
    color: #e4e2e8;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 20px;
    margin-bottom: 10px;
}

.product-name {
    font-family: 'Syne', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.product-price {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
}

.product-moq {
    font-size: 12px;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: 6px;
}

/* ── CTA row ── */
.cta-row {
    display: flex;
    gap: 10px;
}

.btn-cart {
    flex: 1;
    padding: 13px 18px;
    background: linear-gradient(135deg, var(--accent) 0%, #9C7CFF 100%);
    color: #fff;
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    box-shadow: 0 4px 20px rgba(124, 92, 252, 0.4);
    letter-spacing: 0.01em;
}

.btn-cart:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(124, 92, 252, 0.55);
}

.btn-cart:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-cart:disabled {
    opacity: 0.7;
}

.btn-cart .cart-icon {
    font-size: 16px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-cart:not(:disabled):hover .cart-icon {
    transform: rotate(-12deg) scale(1.2);
}

.btn-details {
    width: 52px;
    height: 52px;
    min-width: 52px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 18px;
    transition: background 0.18s, border-color 0.18s, transform 0.18s;
    flex-shrink: 0;
}

.btn-details:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: translateY(-2px);
}

/* ── Side actions ── */
.side-actions {
    position: absolute;
    right: 14px;
    /* Position above the overlay - adjust based on overlay height */
    bottom: calc(210px + env(safe-area-inset-bottom));
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.side-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    backdrop-filter: blur(8px);
    color: #fff;
    text-decoration: none;
}

.side-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: scale(1.1);
}

.side-btn.liked {
    background: rgba(255, 60, 172, 0.2);
    border-color: rgba(255, 60, 172, 0.4);
}

.side-btn span {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    display: block;
    text-align: center;
}

.side-action-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* ── Scroll hint ── */
.scroll-hint {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
    transition: opacity 0.4s;
}

.scroll-hint.hidden {
    opacity: 0;
}

.scroll-arrow {
    width: 20px;
    height: 20px;
    border-right: 1.5px solid rgba(255, 255, 255, 0.3);
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.3);
    transform: rotate(45deg);
    animation: bounce 1.4s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: rotate(45deg) translateY(0);
    }

    50% {
        transform: rotate(45deg) translateY(5px);
    }
}

/* ── Desktop ambient ── */
@media (min-width: 768px) {
    body {
        background: #050409;
    }

    .reel-wrapper {
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.04),
            0 30px 80px rgba(0, 0, 0, 0.7);
        border-radius: 0;
    }

    .desktop-hint {
        display: flex !important;
    }
}

@media (max-width: 320px) {
    .top-brand {
        display: none;
    }
}

/* Smaller screens: scale down overlay text slightly */
@media (max-height: 680px) {
    .product-name {
        font-size: 18px;
    }

    .product-price {
        font-size: 22px;
    }

    .reel-overlay {
        padding: 20px 16px 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .product-meta {
        margin-bottom: 10px;
    }

    .side-actions {
        bottom: calc(190px + env(safe-area-inset-bottom));
    }
}

.desktop-hint {
    display: none;
    position: fixed;
    top: 50%;
    right: calc(50% - 290px - 160px);
    transform: translateY(-50%);
    flex-direction: column;
    gap: 16px;
    z-index: 50;
}

.hint-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 30px;
    padding: 8px 14px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
}

.hint-pill span {
    font-size: 16px;
}

/* ── Success animation ── */
@keyframes cartPop {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.08);
    }

    70% {
        transform: scale(0.96);
    }

    100% {
        transform: scale(1);
    }
}

.btn-cart.success {
    background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
    animation: cartPop 0.4s ease;
}

/* ── Reel entrance animation ── */
.reel-overlay,
.side-actions {
    opacity: 0;
    transition: opacity 0.5s ease 0.1s;
}

.reel.active .reel-overlay,
.reel.active .side-actions {
    opacity: 1;
}

.reel.active .product-name {
    animation: slideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes slideUp {
    from {
        transform: translateY(18px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}