:root {
    --reels-bg: #071014;
    --reels-surface: rgba(255, 255, 255, 0.08);
    --reels-border: rgba(255, 255, 255, 0.12);
    --reels-text: #f5fbfc;
    --reels-text-secondary: rgba(245, 251, 252, 0.74);
    --reels-glow: rgba(0, 191, 207, 0.18);
}

html,
body {
    height: 100%;
}

.reels-body {
    background: linear-gradient(180deg, #f7fbfc 0%, #eef7f8 100%);
}


.reels-page {
    min-height: calc(100dvh - var(--header-h, 72px));
}

.reels-kicker,
.reels-section-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(0, 191, 207, 0.08);
    border: 1px solid rgba(0, 191, 207, 0.18);
    color: var(--c-primary-dark);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.reels-gate {
    padding: 40px 0 72px;
}

.reels-gate-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 36px;
}

.reels-gate-copy {
    max-width: 760px;
    text-align: center;
}

.reels-gate-copy h1 {
    margin: 16px 0 14px;
    font-size: clamp(2.2rem, 6vw, 4.6rem);
    line-height: 0.98;
    letter-spacing: -0.06em;
}

.reels-gate-copy p {
    max-width: 60ch;
    margin: 0 auto;
    font-size: 1rem;
}

.reels-empty-notice {
    padding: 18px 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 18px 36px rgba(0, 39, 43, 0.06);
}

.reels-city-section {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.reels-section-head h2 {
    margin: 10px 0 0;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
}

.reels-city-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

.reels-city-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    border-radius: 22px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 18px 38px rgba(0, 39, 43, 0.06);
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s cubic-bezier(0.33, 1, 0.68, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.reels-city-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 191, 207, 0.24);
    box-shadow: 0 24px 48px rgba(0, 39, 43, 0.12);
}

.reels-city-media {
    position: relative;
    aspect-ratio: 9 / 16;
    background: linear-gradient(160deg, #dff4f7, #edf8f9);
    overflow: hidden;
}

.reels-city-media img,
.reels-city-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.reels-city-count {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    color: var(--c-primary-dark);
    font-size: 0.8rem;
    font-weight: 700;
}

.reels-city-body {
    padding: 16px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reels-city-body strong {
    font-size: 1.05rem;
    line-height: 1.2;
}

.reels-city-body span {
    color: var(--c-text-sec);
    font-size: 0.88rem;
}

.reels-feed-shell {
    background: radial-gradient(circle at top center, rgba(0, 191, 207, 0.1), transparent 38%), var(--reels-bg);
    min-height: calc(100dvh - var(--header-h, 72px));
    color: var(--reels-text);
}

.reels-feed-topbar {
    position: sticky;
    top: var(--header-h, 72px);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background: rgba(7, 16, 20, 0.78);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.reels-topbar-back,
.reels-topbar-link {
    color: var(--reels-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
}

.reels-topbar-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.reels-topbar-meta strong {
    font-size: 1.15rem;
    line-height: 1;
}

.reels-feed-topbar-minimal {
    justify-content: center;
    align-items: center;
    min-height: 56px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
}

.reels-feed {
    height: calc(100dvh - var(--header-h, 72px) - 74px);
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}

.reels-feed::-webkit-scrollbar {
    display: none;
}

.reel-slide {
    min-height: calc(100dvh - var(--header-h, 72px) - 74px);
    display: grid;
    place-items: center;
    padding: 18px 16px 32px;
    scroll-snap-align: start;
}

.reel-video-shell {
    position: relative;
    width: min(100%, 460px);
    height: min(82dvh, 860px);
    border-radius: 28px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.35);
}

.reels-tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0,0,0,0.7);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    pointer-events: auto;
}

.reels-tutorial-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.reels-tutorial-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    animation: swipeUpAnim 2s infinite ease-in-out;
}

.reels-tutorial-icon svg {
    width: 34px;
    height: 34px;
    opacity: 0.9;
}

@keyframes swipeUpAnim {
    0% { transform: translateY(20px); opacity: 0; }
    30% { opacity: 1; }
    70% { transform: translateY(-20px); opacity: 1; }
    100% { transform: translateY(-20px); opacity: 0; }
}

.reels-tutorial-content p {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 28px;
}

.reels-tutorial-btn {
    background: #fff;
    color: #000;
    border: none;
    padding: 12px 30px;
    border-radius: 99px;
    font-weight: 800;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255,255,255,0.2);
}

.reel-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #000;
}

.reel-overlay-gradient {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.10) 0%,
            rgba(0, 0, 0, 0.08) 42%,
            rgba(0, 0, 0, 0.28) 62%,
            rgba(0, 0, 0, 0.62) 82%,
            rgba(0, 0, 0, 0.92) 100%
        );
    pointer-events: none;
}

.reel-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px;
}

.reel-overlay-top {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.reel-overlay-minimal {
    justify-content: flex-end;
    padding: 18px 16px calc(26px + env(safe-area-inset-bottom));
}

.reel-badge {
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
}

.reel-badge-entity {
    background: rgba(0, 191, 207, 0.18);
}

.reel-overlay-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reel-overlay-body-minimal {
    gap: 6px;
    width: min(78vw, 320px);
    max-width: min(78vw, 320px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 0;
}

.reel-overlay-body-minimal .reel-meta {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.82);
    font-weight: 700;
}

.reel-overlay-body-minimal h2 {
    margin: 0;
    font-size: clamp(1.9rem, 5.6vw, 2.45rem);
    line-height: 0.94;
    letter-spacing: -0.04em;
    color: #fff;
    max-width: 10ch;
    text-wrap: balance;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reel-meta {
    margin: 0;
    color: var(--reels-text-secondary);
    font-size: 0.88rem;
    font-weight: 700;
}

.reel-overlay h2 {
    margin: 0;
    color: #fff;
    font-size: clamp(1.5rem, 4vw, 2.15rem);
    line-height: 0.98;
    letter-spacing: -0.05em;
    max-width: 12ch;
}

.reel-description {
    margin: 0;
    color: var(--reels-text-secondary);
    font-size: 0.93rem;
    line-height: 1.55;
    max-width: 34ch;
}

.reel-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.reel-description,
.reel-actions,
.reel-overlay-top {
    display: none !important;
}

.reel-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    background: #fff;
    color: var(--c-primary-dark);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 800;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.reel-inline-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    color: #fff;
    text-decoration: none;
    font-size: 0.98rem;
    font-weight: 800;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.reel-inline-link::after {
    content: "→";
    opacity: 0.9;
}

.reel-video-toggle {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 5;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.2s ease, transform 0.2s ease;
    opacity: 0;
    pointer-events: none;
    transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.reel-video-toggle:hover {
    background: rgba(0, 0, 0, 0.65);
    transform: scale(1.04);
}

.reel-video-toggle.is-paused {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
    pointer-events: auto;
}

.reel-video-toggle .icon-play {
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.reel-video-toggle.is-paused .icon-play {
    opacity: 1;
    transform: scale(1);
}

.reels-immersive {
    background: #000;
    overflow: hidden;
}

.reels-immersive .site-header {
    display: none !important;
}

.reels-immersive .reels-page,
.reels-immersive .reels-feed-shell,
.reels-immersive .reels-feed {
    height: 100dvh;
    min-height: 100dvh;
}

.reels-immersive .reels-feed-shell {
    background: #000;
}

.reels-immersive .reels-feed-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    padding: calc(10px + env(safe-area-inset-top)) 12px 12px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.18) 60%, rgba(0, 0, 0, 0) 100%);
    border-bottom: 0;
    backdrop-filter: none;
}

.reels-immersive .reels-feed {
    position: fixed;
    inset: 0;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-snap-stop: always;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-width: none;
}

.reels-immersive .reels-feed::-webkit-scrollbar {
    display: none;
}

.reels-immersive .reel-slide {
    height: 100dvh;
    min-height: 100dvh;
    padding: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.reels-immersive .reel-video-shell {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    margin: 0 auto;
}

.reels-immersive .reel-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: calc(16px + env(safe-area-inset-top)) 16px calc(26px + env(safe-area-inset-bottom)) 16px;
    text-align: left;
    margin: 0 auto;
}

.reels-immersive .reel-overlay-body {
    width: min(78vw, 320px);
    max-width: min(78vw, 320px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
}

.reels-immersive .reel-actions {
    position: absolute;
    right: 12px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    margin-top: 0;
}

.reels-immersive .reel-cta {
    min-height: 40px;
    padding: 0 14px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    box-shadow: none;
}

.reels-topbar-back {
    position: absolute;
    left: 12px;
    top: calc(10px + env(safe-area-inset-top));
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(8px);
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
}

.reels-topbar-meta-minimal {
    gap: 0;
}

.reels-topbar-meta-minimal .reels-section-label {
    display: none;
}

.reels-topbar-meta-minimal strong {
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
}

.reels-body .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 49;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.reels-body .nav-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .reels-body .nav-links {
        position: fixed;
        top: -100vh;
        left: 0;
        right: 0;
        bottom: auto;
        display: flex;
        width: auto;
        flex-direction: column;
        align-items: center;
        gap: var(--sp-6, 1.5rem);
        padding: calc(var(--header-h, 72px) + var(--sp-8, 2rem)) var(--sp-8, 2rem) var(--sp-8, 2rem);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        box-shadow: none;
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(0);
        transition: transform var(--dur, 0.3s) var(--ease, ease), opacity var(--dur, 0.3s) var(--ease, ease), top 0s linear var(--dur, 0.3s);
    }

    .reels-body .nav-links.is-open {
        top: 0;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        box-shadow: var(--shadow-lg, 0 20px 40px rgba(0, 39, 43, 0.12));
        transition: transform var(--dur, 0.3s) var(--ease, ease), opacity var(--dur, 0.3s) var(--ease, ease), top 0s linear 0s;
    }

    .reels-body .nav-links a.active::after {
        display: none;
    }

    .reels-gate {
        padding: 24px 0 48px;
    }

    .reels-city-grid {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }

    .reels-feed-topbar {
        padding: 12px 14px;
    }

    .reels-topbar-back,
    .reels-topbar-link {
        font-size: 0.82rem;
    }

    .reels-topbar-meta strong {
        font-size: 1rem;
    }

    .reel-slide {
        padding: 0;
        min-height: calc(100dvh - var(--header-h, 72px) - 66px);
    }

    .reels-feed {
        height: calc(100dvh - var(--header-h, 72px) - 66px);
    }

    .reel-video-shell {
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: 0;
        box-shadow: none;
    }

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

    .reel-description {
        max-width: 100%;
    }

    .reels-immersive .reel-overlay {
        padding: calc(16px + env(safe-area-inset-top) + 44px) 14px calc(22px + env(safe-area-inset-bottom));
    }

    .reels-immersive .reel-overlay-body,
    .reel-overlay-body-minimal {
        width: min(calc(100vw - 84px), 320px);
        max-width: min(calc(100vw - 84px), 320px);
    }
}

@media (min-width: 1280px) {
    .reels-gate-inner {
        gap: 44px;
    }

    .reels-city-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 769px) {
    .reels-immersive .reel-video-shell {
        width: calc(100dvh * 9 / 16);
        max-width: 100vw;
    }
    
    .reels-immersive .reel-overlay {
        width: calc(100dvh * 9 / 16);
        max-width: 100vw;
    }
}

/* Reels Search Bar */
#reels-search {
    position: relative;
    overflow: visible;
    z-index: 10001;
    margin: 30px auto 10px auto;
    max-width: 600px;
    width: 100%;
}
.reels-search-inner {
    background: #fff;
    border-radius: 99px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    position: relative;
    z-index: 10002;
    display: flex;
    align-items: center;
    padding: 4px 6px 4px 16px;
    min-height: 55px;
}
.reels-search-main {
    display: flex;
    flex: 1;
    align-items: center;
    min-width: 0;
}
#reelsSearchInput {
    width: 100%;
    font-size: 16px;
    border: none;
    outline: none;
    background: transparent;
    color: #333;
}

.reels-search-action {
    width: 45px;
    height: 45px;
    margin-left: 10px;
    flex-shrink: 0;
    background: var(--c-primary, #00bcd4);
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}
.reels-search-action:hover {
    background: var(--c-primary-deep, #0097a7);
}
.reels-autocomplete-list {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background-color: #ffffff;
    margin: 0;
    border-radius: 12px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.2);
    list-style: none;
    padding: 10px;
    z-index: 999999;
    text-align: left;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
}

@media (max-width: 768px) {
    #reels-search {
        margin: 20px auto;
        max-width: 95%;
    }
    .reels-search-inner {
        flex-direction: row;
        align-items: center;
        border-radius: 99px;
        padding: 4px 6px 4px 16px;
        min-height: 55px;
    }
    .reels-search-main {
        width: auto;
        flex: 1;
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 0;
    }
    #reelsSearchInput {
        font-size: 15px;
        padding: 0;
        width: 100%;
    }

    .reels-search-action {
        position: static;
        width: 44px;
        height: 44px;
        margin-left: 10px;
    }
}
