/* --- TikTok Player & Share Dialog (moved from template) --- */
/* TikTok Player Responsive Widths */
/* TikTok Player Responsive Widths - CLEANED */
/* TikTok Player Full Width */
#tiktok-video-player {
    aspect-ratio: 9/16;
    width: min(56.25vh, 100vw); /* 56.25vh = 100vw * 16/9, giữ đúng tỉ lệ dọc */
    height: min(100vh, calc(100vw * 16 / 9));
    max-width: 100vw;
    max-height: 100vh;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
    border-radius: 0;
    z-index: 10;
}
#tiktok-video-player video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    display: block;
    margin: 0 auto;
}
/* No media query needed, always full width */
@keyframes popIn {
    0% { transform:scale(0.85); opacity:0; }
    100% { transform:scale(1); opacity:1; }
}
.share-dialog-responsive {
    display: none;
    position: absolute;
    left: -200%;
    top: 35px;
    transform: translateX(-50%);
    width: 360px;
    max-width: 96vw;
    min-width: 220px;
    background: rgba(24,24,32,0.98);
    backdrop-filter: blur(8px);
    border-radius: 18px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.32);
    padding: 0 0 18px 0;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.share-dialog-responsive.active { display: flex; }
.share-btn-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.share-link-btn.nav-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #222;
    color: #fff;
    border-radius: 50%;
    border: none;
    outline: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transition: box-shadow 0.18s, background 0.18s;
}
.share-label {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.18);
    margin-top: 2px;
}
/* --- End TikTok Player & Share Dialog --- */
/* TikTok style vertical player */
/* removed duplicate #tiktok-video-player rules */
@media (max-width: 700px) {
    /* removed, now always full screen */
}
/* Volume Controls Overlay Style */

.video-controls-overlay .control-btn,
.video-controls-overlay .skip-btn,
.video-controls-overlay .volume-down-btn,
.video-controls-overlay .volume-up-btn,
.video-controls-overlay .mute-btn,
.video-controls-overlay .unmute-btn {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-radius: 50%;
    margin: 0 2px;
    border: none;
    outline: none;
    box-shadow: none;
    transition: background 0.2s;
}
.video-controls-overlay .control-btn:hover,
.video-controls-overlay .skip-btn:hover,
.video-controls-overlay .volume-down-btn:hover,
.video-controls-overlay .volume-up-btn:hover,
.video-controls-overlay .mute-btn:hover,
.video-controls-overlay .unmute-btn:hover {
    background: rgba(255,255,255,0.25);
}
.video-controls-overlay i {
    font-size: 18px;
}
/* Like controls stack: icon loa trên icon tim */
.like-controls-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 10px;
}
.main-mute-btn {
    background: rgba(0,0,0,0.5);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    margin-bottom: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transition: background 0.2s;
    cursor: pointer;
}
.main-mute-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #ff004f;
}
.like-btn {
    margin: 0;
}
.tiktok-page-container,
.tiktok-video-container,
body,
html {
    width: 100vw;
    height: 100vh;
    padding: 0;
    overflow: hidden;
    margin: 0;
}
.like-count,
.video-close-btn,
.video-control-btn {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
#progress-wrap,
*,
.bottom-nav-bar,
.like-count,
.video-item {
    box-sizing: border-box;
}
:root {
    --nav-h: 70px;
    --video-col-w: 100vw;
    --safe: env(safe-area-inset-bottom, 0px);
    --tiktok-width: 390px; /* TikTok standard width */
    --tiktok-aspect: 9/16; /* TikTok aspect ratio */
}
body,
html {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    position: fixed;
    top: 0;
    left: 0;
}
.tiktok-page-container {
    background: #000;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
}
.tiktok-video-container {
    position: relative;
    background: #000;
    box-sizing: border-box;
    /* Touch optimization for mobile */
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 768px) {
    /* No special desktop override, always 9:16 aspect ratio */
}
.video-item,
.video-list {
    position: relative;
    width: 100%;
    display: flex;
}
.video-list {
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateY(0);
    flex-direction: column;
    /* Hardware acceleration for smooth scrolling on mobile */
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}
.video-item {
    height: 100vh;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
    flex-shrink: 0;
    /* Hardware acceleration */
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* Performance optimization: Only render visible items */
    content-visibility: auto;
    contain: layout style paint;
    /* Add padding for bottom navigation - TikTok style */
    padding-bottom: 0;
}
@media (max-width: 768px) {
    /* No special mobile override, always 9:16 aspect ratio */
}
.video-player-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: #000;
}
.video-player {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover để fill toàn bộ container */
    background: #000;
    object-position: center;
    position: absolute;
    top: 0;
    left: 0;
    transform: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: auto;
    /* Mobile optimization */
    will-change: transform;
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.video-player[poster] {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.video-player:not([src]):not([data-loaded]) {
    background: #000;
}
.video-loading {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.video-player[poster] + .video-loading {
    background: rgba(0, 0, 0, 0.1);
}
.video-player::-webkit-media-controls {
    display: none !important;
}
.video-player::-webkit-media-controls-panel {
    display: none !important;
}
.video-player::-webkit-media-controls-play-button {
    display: none !important;
}
.video-player::-webkit-media-controls-volume-slider {
    display: none !important;
}
.video-player::-webkit-media-controls-mute-button {
    display: none !important;
}
.video-player::-webkit-media-controls-timeline {
    display: none !important;
}
.video-player::-webkit-media-controls-current-time-display {
    display: none !important;
}
.video-player::-webkit-media-controls-time-remaining-display {
    display: none !important;
}
.video-player::-webkit-media-controls-fullscreen-button {
    display: none !important;
}
.video-player::-webkit-media-controls-overlay-play-button {
    display: none !important;
}
.video-player::-webkit-media-controls-start-playback-button {
    display: none !important;
}
.video-player::-moz-media-controls {
    display: none !important;
}
.video-player::-ms-media-controls {
    display: none !important;
}
.video-player:focus {
    outline: 0;
}
.video-player:focus::-webkit-media-controls,
.video-player:hover::-webkit-media-controls {
    display: none !important;
}
.video-header {
    position: absolute;
    top: 20px;
    left: 10px;
    right: 10px;
    z-index: 30;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.like-controls,
.navigation-controls,
.swipe-tutorial {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 103;
    display: flex;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.like-controls.show,
.navigation-controls.show,
.swipe-tutorial.show {
    opacity: 1;
}
.video-controls-left,
.video-controls-right {
    display: flex;
    gap: 10px;
}
.video-close-btn,
.video-control-btn,
.volume-down-btn,
.volume-up-btn,
.mute-btn,
.unmute-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: 0 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
    font-size: 16px;
    color: #fff;
}

.volume-down-btn i,
.volume-up-btn i,
.mute-btn i,
.unmute-btn i {
    font-size: 18px;
}
.video-close-btn:hover,
.video-control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}
.video-close-btn.active,
.video-control-btn.active {
    background: rgba(255, 255, 255, 0.2);
}
.like-controls {
    right: 20px;
    flex-direction: column;
    align-items: center;
    gap: clamp(6px, 1.2vh, 10px);
    padding: clamp(12px, 2vh, 18px) 8px;
    /* border-radius: 32px; */
    /* background: rgba(0, 0, 0, 0.06); */
    /* backdrop-filter: blur(6px); */
    /* border: 1px solid rgba(255, 255, 255, 0.08); */
    opacity: 1;
    transition: opacity 0.25s, 0.3s;
    display: flex; /* Show like controls with +10s button */
}
.swipe-tutorial {
    left: 20px;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border-radius: 25px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    text-align: center;
    max-width: 120px;
    opacity: 0;
    animation: swipeTutorialFadeIn 0.5s ease-out 2s forwards;
    pointer-events: none;
    display: none; /* Hidden by default */
}

.swipe-tutorial.show {
    opacity: 1;
}

.swipe-tutorial.hide {
    opacity: 0;
    animation: swipeTutorialFadeOut 0.5s ease-in forwards;
}

.swipe-gesture-icon {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    position: relative;
    background: rgba(255, 255, 255, 0.1);
}

.swipe-gesture-icon i {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    animation: swipeUpDown 2s ease-in-out infinite;
}

.swipe-tutorial-text {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    opacity: 0.9;
    margin: 0;
}

.swipe-tutorial-subtext {
    font-size: 9px;
    opacity: 0.7;
    margin: 0;
    font-weight: 400;
}

/* Navigation Controls for Desktop */
.navigation-controls {
    left: 20px;
    flex-direction: column;
    gap: clamp(10px, 1.6vh, 14px);
    padding: clamp(12px, 2vh, 20px) 8px;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.navigation-controls:hover {
    opacity: 1;
}

/* Desktop: Show navigation-controls, hide swipe-tutorial */
@media (min-width: 769px) {
    .navigation-controls {
        display: flex;
    }
    
    .swipe-tutorial {
        display: none !important; /* Force hide on desktop */
    }
}

/* Mobile: Hide navigation-controls, show swipe-tutorial */
@media (max-width: 768px) {
    .navigation-controls {
        display: none; /* Hide navigation controls on mobile */
    }
    
    .swipe-tutorial {
        display: flex; /* Allow display on mobile (still controlled by JS) */
    }
}

/* Swipe gesture animations */
@keyframes swipeUpDown {
    0%, 100% {
        transform: translateY(0);
        opacity: 1;
    }
    25% {
        transform: translateY(-3px);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-6px);
        opacity: 0.6;
    }
    75% {
        transform: translateY(-3px);
        opacity: 0.8;
    }
}

@keyframes swipeTutorialFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-50%) translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

@keyframes swipeTutorialFadeOut {
    0% {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-50%) translateX(-20px);
    }
}
#hud,
.grid-play-icon,
.like-animation,
.search-icon,
.video-info,
.video-loading.hide,
.video-overlay {
    pointer-events: none;
}
.like-btn,
.nav-btn {
    width: clamp(44px, 6.8vw, 54px);
    height: clamp(44px, 6.8vw, 54px);
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: clamp(16px, 2.6vw, 18px);
    backdrop-filter: blur(10px);
    transition: transform 0.2s, background 0.2s;
    cursor: pointer;
    visibility: visible;
}
.like-btn:hover,
.nav-btn:hover {
    transform: scale(1.06);
    background: rgba(255, 255, 255, 0.18);
}
.nav-btn:disabled {
    opacity: 0.55;
    transform: none;
    cursor: not-allowed;
}
.control-btn:hover,
.nav-item.active i,
.nav-item:hover i {
    transform: scale(1.1);
}
.like-btn.liked {
    background: rgba(255, 20, 147, 0.85);
    border-color: rgba(255, 20, 147, 0.9);
    color: #fff;
    animation: 0.6s ease-in-out heartPulse;
    cursor: default;
}
.like-btn.liked:hover {
    background: rgba(255, 20, 147, 0.9);
    transform: none;
}
.like-count {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: clamp(10px, 1.7vw, 12px);
    line-height: 1;
    min-width: clamp(26px, 5.2vw, 36px);
    min-height: clamp(18px, 3.2vw, 22px);
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: transform 0.15s;
    visibility: visible;
}
.like-btn.liked + .like-count {
    transform: translateY(-2px);
}
@keyframes heartPulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
}
@keyframes alreadyLikedShake {
    0%,
    100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-3px);
    }
    75% {
        transform: translateX(3px);
    }
}
.like-animation {
    position: absolute;
    font-size: 30px;
    color: #ff1493;
    animation: 1.5s ease-out forwards likeAnimation;
    z-index: 100;
}
@keyframes likeAnimation {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.5);
    }
    15% {
        transform: translateY(-10px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(1);
    }
}
@media (min-width: 768px) {
    .like-controls {
        right: calc(50vw - (var(--video-col-w) / 2) - 80px);
    }
    .navigation-controls {
        left: calc(50vw - (var(--video-col-w) / 2) - 80px);
    }
    .swipe-tutorial {
        display: none !important; /* Force hide swipe tutorial on desktop */
    }
    .video-item {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
    }
    .video-player-container {
        width: 100%;
        height: 100%;
        position: relative;
    }
    .video-info {
        position: absolute;
        bottom: 20px;
        left: 20px;
        right: 20px;
        background: 0 0;
        padding: 0;
        border-radius: 0;
        pointer-events: none;
    }
}
.video-description,
.video-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    background: linear-gradient(transparent 60%, rgba(0, 0, 0, 0.3) 80%, rgba(0, 0, 0, 0.6) 100%);
}
.video-info {
    position: absolute;
    bottom: 20px;
    left: 15px;
    right: 80px;
    z-index: 50;
    background: 0 0;
    color: #fff;
    padding: 0 0 15px 0;
    margin: 0;
    border-radius: 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    backdrop-filter: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.video-info.show {
    opacity: 1;
}
.control-btn,
.toast,
.video-counter {
    backdrop-filter: blur(10px);
}
.video-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.2;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}
.video-description {
    font-size: 13px;
    line-height: 1.3;
    opacity: 0.9;
    max-height: 36px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}
.video-controls {
    position: absolute;
    right: 20px;
    bottom: 100px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}
.loading-indicator,
.video-counter {
    position: absolute;
    z-index: 30;
    color: #fff;
}
.control-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: none;
}
#hud,
.toast,
.video-loading {
    transition: opacity 0.3s;
}
.toast,
.trending-video-thumbnail {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}
.video-counter {
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}
.loading-indicator {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    text-align: center;
}
.video-error,
.video-loading,
.video-processing {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    align-items: center;
    display: flex;
    position: absolute;
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: 1s linear infinite spin;
    margin: 0 auto 10px;
}
@keyframes spin {
    from {
        transform: rotate(0);
    }
    to {
        transform: rotate(360deg);
    }
}
.video-error,
.video-processing {
    justify-content: center;
    z-index: 5;
}
.video-processing {
    background: linear-gradient(135deg, #1e3c72 0, #2a5298 100%);
}
.video-error {
    background: linear-gradient(135deg, #c94b4b 0, #4b134f 100%);
}
.video-loading {
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10;
    opacity: 1;
}
.video-loading.hide {
    opacity: 0;
}
#hud,
.grid-video-item:hover .grid-play-icon,
.grid-video-item:hover .grid-video-overlay,
.toast.show {
    opacity: 1;
}
.video-loading-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #fff;
    text-align: center;
}
.loading-dots {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.loading-dot {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    animation: 1.4s ease-in-out infinite both loadingPulse;
}
.loading-dot:first-child {
    animation-delay: -0.32s;
}
.loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}
.loading-dot:nth-child(3) {
    animation-delay: 0s;
}
@keyframes loadingPulse {
    0%,
    100%,
    80% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}
.loading-text {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
    margin: 0;
}
.error-indicator,
.processing-indicator {
    text-align: center;
    color: #fff;
    padding: 30px;
}
.error-indicator h3,
.processing-indicator h3 {
    margin: 20px 0 10px;
    font-size: 22px;
    font-weight: 600;
}
.error-indicator p,
.processing-indicator p {
    margin: 10px 0;
    font-size: 16px;
    opacity: 0.9;
}
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 280px;
    text-align: center;
    word-wrap: break-word;
}
.nav-item,
.tab-btn {
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
}
.nav-item span,
.tab-btn {
    font-weight: 500;
    white-space: nowrap;
}
.bottom-nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    background: transparent;
    backdrop-filter: none;
    border-top: none;
    display: none; /* Hidden - using like-controls instead */
    justify-content: center;
    align-items: center;
    z-index: 500;
    padding: 20px;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.bottom-nav-bar.show {
    opacity: 1;
}

.nav-items {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    pointer-events: auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: 0.3s;
    padding: 8px 16px;
    border-radius: 20px;
    min-width: 80px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: auto;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    font-family: inherit;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Like button styling */
#like-btn-nav {
    background: rgba(0, 0, 0, 0.5);
}

#like-btn-nav.liked {
    background: rgba(255, 20, 147, 0.85);
    border-color: rgba(255, 20, 147, 0.9);
    color: #fff;
    animation: 0.6s ease-in-out heartPulse;
}

#like-btn-nav.liked:hover {
    background: rgba(255, 20, 147, 0.9);
    transform: none;
}

#like-btn-nav i,
#nav-scroll-top i {
    font-size: 20px;
    margin-bottom: 4px;
    transition: 0.3s;
}

#like-btn-nav span,
#nav-scroll-top span,
#like-count-nav {
    font-size: 12px;
    text-align: center;
    font-weight: 600;
}

#like-btn-nav:hover i,
#nav-scroll-top:hover i {
    transform: scale(1.1);
}

#progress-wrap,
.home-header {
    display: flex;
    align-items: center;
}
.nav-item.active,
.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}
.nav-item i {
    font-size: 20px;
    margin-bottom: 4px;
    transition: 0.3s;
}
.nav-item span {
    font-size: 12px;
    text-align: center;
}
.nav-item.active {
    animation: 0.3s navPulse;
}
@keyframes navPulse {
    0% {
        transform: scale(1) translateY(0);
    }
    50% {
        transform: scale(1.05) translateY(-3px);
    }
    100% {
        transform: scale(1) translateY(-2px);
    }
}
@media (max-width: 480px) {
    .bottom-nav-bar {
        padding: 15px;
    }
    .nav-items {
        gap: 12px;
    }
    .nav-item {
        min-width: 70px;
        padding: 6px 12px;
    }
    .nav-item i {
        font-size: 18px;
    }
    .nav-item span {
        font-size: 11px;
    }
}
#hud {
    position: fixed;
    inset: 0;
    z-index: 101;
}
#progress-wrap {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 5px;
    width: min(100vw, var(--video-col-w));
    padding: 0 15px;
    pointer-events: auto;
    height: 25px;
    z-index: 102;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#progress-wrap.show {
    opacity: 1;
}
#progress-bg {
    height: 4px;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    width: 100%;
    position: relative;
}
#progress-bar {
    height: 3px;
    width: 0%;
    background: #ff0050;
    border-radius: 999px;
    transition: width 0.1s linear;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    position: absolute;
    top: 0;
    left: 0;
}
@media (hover: hover) {
    #progress-wrap:hover #progress-bg {
        background: rgba(255, 255, 255, 0.6);
    }
    #progress-wrap:hover #progress-bar {
        height: 4px;
        box-shadow: 0 2px 6px rgba(255, 0, 80, 0.4);
    }
}
.app-container {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
}
.home-grid-container {
    width: 100vw;
    height: 100vh;
    background: #000;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}
body.grid-mode #hud,
body.grid-mode #progress-wrap {
    display: none !important;
}
.home-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    justify-content: center;
    padding: 0 20px;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.tab-content,
.tab-panel {
    width: 100%;
    height: 100%;
}
.home-title,
.tab-btn {
    align-items: center;
    display: flex;
}
.tab-navigation {
    display: flex;
    gap: 0;
    
    border-radius: 25px;
    padding: 6px;
    overflow: hidden;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.tab-btn {
    background: 0 0;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 15px;
    gap: 8px;
    transition: 0.3s;
    position: relative;
    z-index: 1;
    min-width: 100px;
    justify-content: center;
}
.tab-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: 600;
}
.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}
.tab-btn i {
    font-size: 12px;
}
.home-title i,
.tab-btn.active i {
    color: #ff0050;
}
.home-title {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    gap: 10px;
}
.home-nav {
    display: flex;
    gap: 15px;
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}
.grid-loading,
.grid-play-icon,
.trending-play-overlay {
    transform: translate(-50%, -50%);
}
.home-nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: 0.2s;
}
.home-nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}
.mobile-home-nav {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 101;
    display: none;
    justify-content: center;
    align-items: center;
}
.mobile-home-nav .home-nav-link {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: 0.3s;
    white-space: nowrap;
    min-width: 120px;
    justify-content: center;
}
.mobile-home-nav .home-nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.mobile-home-icon {
    display: none;
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
   
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    text-decoration: none;
    transition: 0.3s;
    z-index: 10;
}
.mobile-home-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.desktop-only {
    display: flex;
}
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}
.trending-container {
    padding: 60px 5px 100px;
    max-width: 1200px;
    margin: 0 auto;
}
.trending-header-info {
    text-align: center;
    margin-bottom: 16px;
}
.trending-header-info h2 {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
}
.trending-header-info p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin: 0;
}
.trending-videos-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}
.trending-list-item {
    aspect-ratio: 9/16;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: #0e0e0e;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    padding: 0;
    border: none;
    margin-bottom: 0;
    display: block;
}
.trending-list-item:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    z-index: 2;
}
/* Trending card inner elements */
.trending-item-thumb {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
}
.trending-item-thumb img,
.trending-item-thumb .grid-video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.trending-item-thumb .grid-video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    color: rgba(255,255,255,0.3);
    font-size: 24px;
}
.trending-item-thumb .thumbnail-placeholder {
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.3);
    font-size: 24px;
}
/* Rank / sequence badge at top-left corner */
.trending-rank-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 10;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 0 5px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.trending-rank-badge.rank-1 {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    font-size: 15px;
    height: 26px;
    padding: 0 4px;
}
.trending-rank-badge.rank-2 {
    background: linear-gradient(135deg, #D0D0D0, #909090);
    color: #000;
    font-size: 15px;
    height: 26px;
    padding: 0 4px;
}
.trending-rank-badge.rank-3 {
    background: linear-gradient(135deg, #CD7F32, #9A4F10);
    color: #fff;
    font-size: 15px;
    height: 26px;
    padding: 0 4px;
}
/* Trending card info overlay */
.trending-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 8px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.4) 65%, transparent 100%);
}
.trending-item-title {
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
    margin: 0 0 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}
.trending-item-likes {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(0,0,0,0.55);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    backdrop-filter: blur(4px);
}
.trending-item-likes i {
    color: #ff4060;
    font-size: 9px;
}
.trending-rank-container {
    flex-shrink: 0;
}
.trending-rank {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
}
.trending-rank.rank-1 {
    background: linear-gradient(45deg, gold, orange);
    border-color: gold;
    color: #000;
    font-size: 16px;
}
.trending-rank.rank-2 {
    background: linear-gradient(45deg, silver, #a0a0a0);
    border-color: silver;
    color: #000;
    font-size: 16px;
}
.trending-rank.rank-3 {
    background: linear-gradient(45deg, #cd7f32, sienna);
    border-color: #cd7f32;
    color: #fff;
    font-size: 16px;
}
.trending-video-info {
    flex: 1;
    display: flex;
    gap: 12px;
    align-items: center;
}
.trending-video-thumbnail {
    width: 80px;
    height: 110px;
    border-radius: 12px;
    overflow: hidden;
    background: #111;
    position: relative;
    flex-shrink: 0;
}
.trending-video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    color: rgba(255, 255, 255, 0.5);
}
.trending-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 10px;
    opacity: 0.8;
}
.trending-video-description,
.trending-video-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}
.trending-video-details {
    flex: 1;
}
.trending-video-title {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}
.trending-video-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    margin: 0 0 8px;
    -webkit-line-clamp: 1;
    line-clamp: 1;
}
.trending-video-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}
.trending-likes {
    color: #ff0050;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}
.trending-status {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}
.trending-status.success {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}
.trending-status.processing {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}
.trending-status.error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}
.trending-arrow {
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    flex-shrink: 0;
}
.trending-error,
.trending-loading {
    padding: 40px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}
.trending-error {
    color: #ef4444;
}
.trending-error i {
    font-size: 24px;
    margin-bottom: 12px;
}
.videos-grid {
    padding: 4px 5px 100px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    max-width: 1200px;
    margin: 0 auto;
}
.grid-video-item {
    aspect-ratio: 9/16;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: #0e0e0e;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.grid-play-icon,
.grid-video-overlay {
    display: flex;
    opacity: 0;
    transition: opacity 0.2s;
    position: absolute;
}
.grid-video-item:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    z-index: 2;
}
.grid-video-item:active {
    transform: scale(0.97);
}
.grid-video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #111;
}
.grid-video-overlay {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.7) 100%);
    flex-direction: column;
    justify-content: space-between;
    padding: 12px;
}
.grid-play-icon {
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #000;
}
.grid-video-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 8px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.4) 65%, transparent 100%);
}
.grid-video-title {
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
    margin: 0 0 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}
.grid-video-stats {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: rgba(255,255,255,0.9);
}
.grid-video-stat {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(0,0,0,0.55);
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}
.grid-video-stat i {
    color: #ff4060;
    font-size: 9px;
}
.trending-section {
    grid-column: 1/-1;
    margin-bottom: 30px;
    padding: 0 10px;
}
.trending-header {
    text-align: center;
    margin-bottom: 20px;
}
.trending-header h2 {
    font-size: 2rem;
    margin: 0;
    color: #ff6b6b;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.trending-subtitle {
    font-size: 0.9rem;
    color: #888;
    font-style: italic;
}
.trending-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    max-width: 1000px;
    margin: 0 auto;
}
.trending-video-item {
    position: relative;
    background: linear-gradient(135deg, #667eea 0, #764ba2 100%);
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    min-height: 180px;
    aspect-ratio: 16/9;
}
.trending-video-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}
.trending-rank {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #ff6b6b;
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}
.trending-content {
    position: relative;
    height: 100%;
}
.trending-content .video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}
.trending-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 25px 15px 15px;
    color: #fff;
}
.trending-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}
.trending-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
}
.trending-stats .like-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}
.grid-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    text-align: center;
    color: #fff;
    z-index: 50;
}
.back-to-grid-btn,
.close-video-btn {
    position: fixed;
    top: 20px;
    height: 44px;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
    z-index: 1000;
    align-items: center;
    transition: 0.2s;
    color: #fff;
    display: flex;
    backdrop-filter: blur(10px);
}
.close-video-btn {
    right: 20px;
    width: 44px;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    justify-content: center;
}
.close-video-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}
.back-to-grid-btn:active,
.close-video-btn:active,
.video-close-btn:active {
    transform: scale(0.95);
}
.back-to-grid-btn {
    left: 20px;
    border: none;
    border-radius: 22px;
    font-size: 14px;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    font-weight: 500;
}
.back-to-grid-btn i {
    font-size: 16px;
}
.back-to-grid-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
}
@media (max-width: 768px) {
    .tiktok-page-container,
    body,
    html {
        position: fixed;
        height: 100vh;
        width: 100vw;
    }
    .video-description,
    .video-title {
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
        color: #fff;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    body,
    html {
        overflow: hidden;
    }
    .tiktok-page-container {
        top: 0;
        left: 0;
    }
    .tiktok-video-container {
        height: 100vh;
        width: 100vw;
        position: relative;
        padding-bottom: 0;
        box-sizing: border-box;
    }
    .toast {
        top: env(safe-area-inset-top, 60px);
        max-width: calc(100vw - 40px);
        font-size: 14px;
    }
    #seek-feedback {
        top: env(safe-area-inset-top, 100px) !important;
        font-size: 13px !important;
        padding: 6px 12px !important;
        min-width: 50px !important;
    }
    .video-info {
        position: absolute;
        bottom: 40px;
        left: 16px;
        right: 80px;
        background: 0 0;
        padding: 0 0 10px 0;
        border-radius: 0;
        z-index: 50;
        color: #fff;
        opacity: 0;
        transition: opacity 0.3s;
        pointer-events: none;
    }
    
    /* Mobile show video info with auto-hide */
    .video-info.show {
        opacity: 1 !important;
    }
    
    .video-title {
        font-size: 16px;
        margin-bottom: 6px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        font-weight: 600;
    }
    .video-description {
        font-size: 14px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        max-height: 36px;
        opacity: 0.9;
    }
    .video-header {
        top: calc(env(safe-area-inset-top, 15px));
        left: 16px;
        right: 16px;
    }
    .video-close-btn,
    .video-control-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(10px);
    }
    .video-controls {
        right: 16px;
        bottom: 180px;
        gap: 20px;
    }
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
        background: rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(10px);
    }
    .like-controls {
        right: 6px;
        top: 50%;
        transform: translateY(-50%);
        color: #fff;
    }
    .swipe-tutorial {
        left: 7px;
        top: 50%;
        transform: translateY(-50%);
        max-width: 100px;
        padding: 12px 8px;
    }
    #progress-wrap {
        height: 35px;
        z-index: 102;
    }
    #progress-bg {
        height: 4px;
        background: rgba(255, 255, 255, 0.6);
    }
    #progress-bar {
        height: 4px;
    }
    .trending-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .trending-video-item {
        min-height: 160px;
    }
    .trending-header h2 {
        font-size: 1.5rem;
    }
    .trending-rank {
        padding: 5px 10px;
        font-size: 0.8rem;
        display: none;
    }
    .trending-title {
        font-size: 0.9rem;
    }
    .back-to-grid-btn {
        top: 15px;
        left: 15px;
        height: 40px;
        font-size: 13px;
        padding: 0 12px;
        gap: 6px;
    }
    .videos-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }
    .trending-videos-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }
    .home-header {
        height: 50px;
        padding: 0 15px;
    }
    .home-title {
        font-size: 18px;
    }
    .grid-video-title {
        font-size: 11px;
    }
    .grid-video-stats {
        font-size: 10px;
    }
    .close-video-btn {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}
@media (min-width: 769px) and (max-width: 1024px) {
    .videos-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }
    .trending-videos-list {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }
    .like-controls {
        right: 6px;
        top: 50%;
        transform: translateY(-50%);
        color: #fff;
    }
}
@media (min-width: 1025px) {
    .videos-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
    .trending-videos-list {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
}
.search-container {
    padding: 15px 20px;
    background: 0 0;
    border-bottom: none;
}
.search-container.grid-search {
    width: 100%;
    max-width: 500px;
    z-index: 40;
    margin: 60px auto 0;
    padding: 20px 20px 10px;
    background: 0 0;
    box-shadow: none;
}
.search-input-wrapper {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}
.search-input {
    width: 100%;
    height: 44px;
    padding: 0 45px;
    border: 2px solid #444;
    border-radius: 22px;
    font-size: 16px;
    background: #2a2a2a;
    color: #fff;
    transition: 0.2s;
    outline: 0;
    caret-color: white;
}
#grid-search-input {
    color: aliceblue;
}
.clear-search-btn,
.search-clear-btn {
    border: none;
    cursor: pointer;
    transition: 0.2s;
}
.search-clear-btn,
.search-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
}
.search-input::placeholder {
    color: #888;
}
.search-input:focus {
    border-color: #ff0050;
    background: #333;
    box-shadow: 0 0 0 3px rgba(255, 0, 80, 0.2);
      color: white;   
}
.search-icon {
    left: 15px;
    font-size: 16px;
}
.search-clear-btn {
    right: 15px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}
.search-clear-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}
.search-results-info {
    position: fixed;
    top: 144px;
    left: 0;
    right: 0;
    background: #2a2a2a;
    border-bottom: 1px solid #444;
    z-index: 39;
    display: none;
}
.search-results-content {
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    font-size: 14px;
}
.clear-search-btn {
    background: #ff0050;
    color: #fff;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.clear-search-btn:hover {
    background: #e6004a;
    transform: scale(1.05);
}
.video-player-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 20px;
}
.video-close-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    flex-shrink: 0;
}
.video-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}
.video-player-header + .tiktok-video-container {
    margin-top: 50px;
    height: calc(100vh - 50px);
}
.grid-video-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    gap: 8px;
}
.grid-video-placeholder i {
    font-size: 24px;
    opacity: 0.8;
}
.grid-video-placeholder span {
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
@media (max-width: 768px) {
    .video-player-header {
        height: 50px;
        padding: 0 15px;
    }
    .video-close-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
                
    }
    .video-player-header + .tiktok-video-container {
        margin-top: 50px;
        height: calc(100vh - 50px);
    }
   
    .search-input {
        height: 38px;
        font-size: 14px;
        padding: 0 35px;

    }
    .like-controls,
    .navigation-controls,
    .swipe-tutorial {
        top: 50%;
    }
    .home-header {
        padding: 8px 16px;
        justify-content: center;
       
        height: 70px;
    }
    .tab-navigation {
        position: static;
        transform: none;
        padding: 8px;
        min-width: 280px;
        margin: 0 auto;
    }
    .tab-btn {
        padding: 12px 20px;
        font-size: 15px;
        min-width: 120px;
    }
    .tab-btn span {
        display: inline;
    }
    .tab-btn i {
        font-size: 16px;
    }
    .home-nav {
        display: none;
    }
     .mobile-home-icon {
        display: flex;
    }
    .mobile-home-nav {
        display: flex;
    }
    .desktop-only {
        display: none !important;
    }
    .trending-container {
        padding: 125px 12px 100px;
    }
    .trending-header-info h2 {
        font-size: 20px;
    }
    .trending-list-item {
        padding: 16px;
        gap: 16px;
    }
    .trending-rank {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }
    .trending-rank.rank-1,
    .trending-rank.rank-2,
    .trending-rank.rank-3,
    .trending-video-title {
        font-size: 14px;
    }
    .trending-video-thumbnail {
        width: 70px;
        height: 95px;
    }
    .trending-video-description {
        font-size: 12px;
    }
    .trending-likes {
        font-size: 11px;
    }
    .trending-status {
        font-size: 10px;
        padding: 1px 6px;
    }
}

/* Video Overlay Icons */
.video-overlay-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.video-overlay-icon.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
    animation: overlayIconShow 0.3s ease-out forwards;
}

.video-overlay-icon.hide {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
    animation: overlayIconHide 0.3s ease-in forwards;
}

.video-overlay-icon i {
    font-size: 32px;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Specific styles for different icon types */
.video-overlay-icon.play-icon i {
    margin-left: 4px; /* Adjust play icon position for optical centering */
}

.video-overlay-icon.pause-icon {
    background: rgba(0, 0, 0, 0.5);
}

/* Persistent pause icon styling */
.video-overlay-icon.pause-icon.show {
    animation: overlayIconShow 0.3s ease-out forwards;
    /* No pulse animation for persistent pause */
}

.video-overlay-icon.mute-icon {
    background: rgba(220, 53, 69, 0.6); /* Red tint for mute */
    border-color: rgba(220, 53, 69, 0.5);
}

.video-overlay-icon.unmute-icon {
    background: rgba(40, 167, 69, 0.6); /* Green tint for unmute */
    border-color: rgba(40, 167, 69, 0.5);
}

/* Animation keyframes */
@keyframes overlayIconShow {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.15);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

@keyframes overlayIconHide {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
}

/* Pulse effect for emphasis */
@keyframes iconPulse {
    0% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(255, 255, 255, 0.2);
    }
    100% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
}

.video-overlay-icon.show {
    animation: overlayIconShow 0.3s ease-out forwards, iconPulse 0.6s ease-in-out;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .video-overlay-icon {
        width: 70px;
        height: 70px;
    }
    
    .video-overlay-icon i {
        font-size: 28px;
    }
    
    .video-overlay-icon.play-icon i {
        margin-left: 3px;
    }
}

/* Mobile responsive adjustments for swipe tutorial */
@media (max-width: 768px) {
    .swipe-tutorial {
        max-width: 90px;
        padding: 10px 6px;
        gap: 6px;
        left: 8px;
    }
    
    .swipe-gesture-icon {
        width: 35px;
        height: 35px;
    }
    
    .swipe-gesture-icon i {
        font-size: 16px;
    }
    
    .swipe-tutorial-text {
        font-size: 10px;
    }
    
    .swipe-tutorial-subtext {
        font-size: 8px;
    }
}

/* Ultra-mobile adjustments for very small screens */
@media (max-width: 375px) {
    .swipe-tutorial {
        max-width: 80px;
        padding: 8px 4px;
        gap: 4px;
        left: 6px;
    }
    
    .swipe-gesture-icon {
        width: 30px;
        height: 30px;
    }
    
    .swipe-gesture-icon i {
        font-size: 14px;
    }
    
    .swipe-tutorial-text {
        font-size: 9px;
    }
    
    .swipe-tutorial-subtext {
        font-size: 7px;
    }
}

/* Share/Copy link buttons for TikTok player */
.player-share-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.copy-link-btn, .share-link-btn {
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 15px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.copy-link-btn:hover, .share-link-btn:hover {
  background: #ff004f;
  color: #fff;
}
