/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    overflow-y: hidden;  /* ✅ HTML 자체의 세로 스크롤 방지 */
    width: 100%;
    height: 100vh;  /* ✅ 화면 높이로 고정 */
    background-color: var(--bg-primary) !important;  /* ✅ 회색 바 완전 제거 */
    /* Prevent horizontal scroll on iOS */
    -webkit-overflow-scrolling: touch;
    /* Prevent swipe back gesture on mobile browsers */
    overscroll-behavior-x: none;
    -webkit-overscroll-behavior-x: none;
}

:root {
    /* Red-themed color palette */
    --primary-color: #DC143C;
    --primary-dark: #B71C1C;
    --primary-light: #FF5252;
    --secondary-color: #FF6B6B;
    --accent-color: #FFE5E5;
    
    /* Neutral colors */
    --bg-primary: #FFFFFF;
    --bg-color: #FFFFFF;
    --bg-secondary: #F5F5F5;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #E0E0E0;
    
    /* Spacing */
    --header-height: 60px;
    --tab-bar-height: 65px;
    --content-padding: 16px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);  /* ✅ secondary → primary (회색 바 제거) */
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: hidden;  /* ✅ Body 자체의 세로 스크롤 방지 */
    width: 100%;
    max-width: 100vw;
    height: 100vh;  /* ✅ 화면 높이로 고정 */
    /* Prevent swipe back gesture on mobile browsers */
    overscroll-behavior-x: none;
    -webkit-overscroll-behavior-x: none;
    /* Prevent pull-to-refresh and overscroll effects */
    overscroll-behavior-y: none;
    -webkit-overscroll-behavior-y: none;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Allow text selection in specific areas */
.card-title,
.modal-body,
input,
textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: var(--header-height);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
    z-index: 2200; /* ✅ 카테고리 패널(2100)보다 위에 표시 */
    overflow: hidden;
}

.header-content {
    width: 100%;  /* ✅ 전체 너비 */
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;  /* ✅ padding 제거 */
}


/* Logo Container */
.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;  /* ✅ 로고가 줄어들지 않도록 */
    padding-left: var(--content-padding);  /* ✅ 좌측 padding */
    /* Home button functionality */
    cursor: pointer;
    transition: opacity 0.3s, transform 0.2s;
    user-select: none;
}

.logo-container:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.logo-container:active {
    transform: scale(0.98);
}

.logo-icon {
    font-size: 1.5rem;
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    gap: 2px;
}

.logo-line-1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.logo-line-2 {
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.logo-premium {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.version-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    padding: 0;
    border-radius: 0;
    letter-spacing: 0.3px;
    border: none;
    transition: all 0.3s;
}

.version-badge:hover {
    color: rgba(255, 255, 255, 0.9);
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    flex: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: var(--content-padding);  /* ✅ 우측 padding */
}

.search-icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    /* Fix: 모바일에서 더 잘 보이도록 크기 증가 */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.1rem;
}

.search-icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.admin-link {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.admin-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.category-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Category Overlay */
.category-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Fix: 우측 1/3은 투명하게 */
    background: linear-gradient(to right, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.5) 66.66%, transparent 66.66%);
    z-index: 200;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.category-overlay.active {
    display: flex;
    opacity: 1;
    justify-content: flex-end;
}

.category-panel {
    background: white;
    /* Fix: 화면의 2/3만 차지하도록 수정 */
    width: 66.66vw;
    max-width: 360px;
    height: 100%;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s;
    z-index: 2100; /* 모달보다 위에 표시 */
    position: relative;
}

.category-overlay.active .category-panel {
    transform: translateX(0);
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.category-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.category-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.category-item {
    width: 100%;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: space-between; /* 🔧 v4.2.49: 유지 - 이름(좌)과 개수(우)를 양 끝으로 */
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    word-break: keep-all;
    line-height: 1.4;
}

/* 🆕 v4.2.49: 아이콘+텍스트를 묶어서 좌측 정렬 */
.category-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-item i {
    color: var(--primary-color);
    flex-shrink: 0; /* 아이콘 크기 고정 */
}

.category-item:hover {
    background: var(--accent-color);
    border-color: var(--primary-color);
    transform: translateX(-5px);
}

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

.category-item.active i {
    color: white;
}

/* Category count badge - Clean white style */
.category-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    background: white !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 14px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

/* Active category count badge */
.category-item.active .category-count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Hover state for count badge */
.category-item:hover .category-count {
    border-color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Main Content */
.main-content {
    margin-top: var(--header-height);
    padding-bottom: var(--tab-bar-height);  /* ✅ margin → padding으로 변경 (회색 바 제거) */
    height: calc(100vh - var(--header-height) - var(--tab-bar-height));  /* ✅ 높이 제한 */
    max-height: calc(100vh - var(--header-height) - var(--tab-bar-height));  /* ✅ 최대 높이 제한 */
    overflow-y: auto;  /* ✅ 스크롤 활성화 */
    background: var(--bg-primary) !important;  /* ✅ 배경색 강제 */
    position: relative;  /* ✅ z-index 기준 */
}

.tab-content {
    display: none;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;  /* ✅ 세로 스크롤 활성화 */
    height: 100%;  /* ✅ 부모(.main-content) 높이에 맞춤 */
    background: var(--bg-primary) !important;  /* ✅ 배경색 강제 */
}

.tab-content.active {
    display: block;
    background: var(--bg-primary) !important;  /* ✅ 활성 탭 배경색 강제 */
}

.featured-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.75rem;
    box-shadow: var(--shadow-sm);
    z-index: 2;
}

/* 모바일에서 배지 크기 조정 */
@media (max-width: 768px) {
    .featured-badge {
        padding: 5px 10px;
        font-size: 0.7rem;
    }
}

/* Feed Section */
.feed-section {
    padding: 0;
    padding-top: 20px;
    max-width: 100%;
    margin: 0 auto;
}

/* 
 * 반응형 그리드 시스템 v3.7.37:
 * 화면 크기에 따라 정확한 열 개수 지정 + 데스크톱 패딩 최소화
 * 
 * 기준:
 * - 모바일 (~767px): 1줄에 1개, 패딩 16px (손가락 터치 고려)
 * - 태블릿 (768~1023px): 1줄에 2개, 패딩 16px
 * - 데스크톱 (1024~1919px): 1줄에 3개, 패딩 8px (화면 꽉 참)
 * - FHD (1920×1080): 1줄에 4개, 패딩 8px (화면 꽉 참) ✅
 * - Ultra-wide (2560px~): 1줄에 5개 이상, 패딩 12px
 * 
 * 계산식 (FHD 기준):
 * - 화면: 1920px
 * - 카테고리 패널: -280px (우측 고정)
 * - 콘텐츠 영역: 1640px
 * - 좌우 패딩: -16px (8px × 2)
 * - 그리드 영역: 1624px
 * - gap: -60px (20px × 3)
 * - 카드 영역: 1564px
 * - 4열 고정: repeat(4, 1fr)
 * - 각 카드: 1564px ÷ 4 = 391px ✅
 */

.feed-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    overflow: visible;  /* ✅ 스크롤바 활성화 */
    padding: 0 16px;  /* 기본 패딩 (모바일) */
    position: relative;
    min-height: 400px;
}

/* 모바일: 1줄에 1개 롱폼 (가로 꽉 참) */
@media (max-width: 767px) {
    .feed-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 0 16px;  /* 터치 영역 고려 */
    }
    
    .feed-grid .content-card[data-size="large"],
    .feed-grid .content-card[data-size="small"] {
        grid-column: span 1;
    }
}

/* 태블릿: 1줄에 2개 (카테고리 패널 없음) */
@media (min-width: 768px) and (max-width: 1023px) {
    .feed-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 0 16px;  /* 터치 영역 고려 */
    }
    
    .feed-grid .content-card[data-size="large"],
    .feed-grid .content-card[data-size="small"] {
        grid-column: span 1;
    }
}

/* 데스크톱: 1줄에 3개 (우측 카테고리 패널 280px 고려) */
@media (min-width: 1024px) and (max-width: 1919px) {
    .feed-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
        padding: 0 8px;  /* 좌우 패딩 최소화 */
    }
    
    .feed-grid .content-card[data-size="large"],
    .feed-grid .content-card[data-size="small"] {
        grid-column: span 1;
    }
}

/* FHD: 1줄에 정확히 4개 (카테고리 패널 280px 고려) */
@media (min-width: 1920px) and (max-width: 2559px) {
    .feed-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
        padding: 0 8px;  /* 좌우 패딩 최소화 - 화면 꽉 참 */
    }
    
    .feed-grid .content-card[data-size="large"],
    .feed-grid .content-card[data-size="small"] {
        grid-column: span 1;
    }
}

/* Ultra-wide: 1줄에 5개 이상 (카테고리 패널 280px 고려) */
@media (min-width: 2560px) {
    .feed-grid {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
        gap: 24px;
        padding: 0 12px;  /* 좌우 패딩 최소화 */
    }
    
    .feed-grid .content-card[data-size="large"],
    .feed-grid .content-card[data-size="small"] {
        grid-column: span 1;
    }
}

/* Content Card */
.content-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    width: 100%;
    max-width: 100%;
    /* Improve touch feedback */
    -webkit-tap-highlight-color: rgba(220, 20, 60, 0.1);
}

.content-card:active {
    transform: scale(0.98);
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
    .content-card:hover {
        transform: none;
    }
    
    .content-card:active {
        transform: scale(0.97);
    }
}

.card-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: #222; /* 어두운 배경 */
}

/* 🔥 v3.7.71 - 썸네일 로딩 스피너 (강제 표시) */
.thumbnail-loading-spinner {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 5 !important;
    opacity: 1 !important;
    transition: opacity 0.3s ease !important;
    pointer-events: none !important;
    /* 🔥 모바일 기본 크기 */
    width: 50px !important;
    height: 50px !important;
}

.thumbnail-loading-spinner img {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    /* 🔥 모바일: 40px */
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid white !important;
    box-shadow: 0 0 0 1px #DC143C !important;
    z-index: 1 !important;
}

.thumbnail-spinner-ring {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    border: 2px solid transparent !important;
    border-top-color: #DC143C !important;
    border-right-color: #e74c3c !important;
    border-bottom-color: #B71C1C !important;
    animation: hasriSpinClean 1.5s linear infinite !important;
    z-index: 2 !important;
}

/* 🔥 v3.7.66 - 작은 PC/태블릿 (768px ~ 1023px): 60px */
@media (min-width: 768px) {
    .thumbnail-loading-spinner {
        width: 60px;
        height: 60px;
    }
    
    .thumbnail-loading-spinner img {
        width: 50px;
        height: 50px;
    }
    
    .thumbnail-spinner-ring {
        border-width: 2px;
    }
}

/* 🔥 v3.7.66 - 일반 PC (1024px ~ 1919px): 80px */
@media (min-width: 1024px) {
    .thumbnail-loading-spinner {
        width: 80px;
        height: 80px;
    }
    
    .thumbnail-loading-spinner img {
        width: 70px;
        height: 70px;
    }
    
    .thumbnail-spinner-ring {
        border-width: 3px;
    }
}

/* 🔥 v3.7.66 - FHD+ (1920px ~ 2559px): 90px */
@media (min-width: 1920px) {
    .thumbnail-loading-spinner {
        width: 90px;
        height: 90px;
    }
    
    .thumbnail-loading-spinner img {
        width: 80px;
        height: 80px;
    }
    
    .thumbnail-spinner-ring {
        border-width: 3px;
    }
}

/* 🔥 v3.7.66 - 4K+ (2560px+): 100px */
@media (min-width: 2560px) {
    .thumbnail-loading-spinner {
        width: 100px;
        height: 100px;
    }
    
    .thumbnail-loading-spinner img {
        width: 90px;
        height: 90px;
    }
    
    .thumbnail-spinner-ring {
        border-width: 4px;
    }
}

.card-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0; /* 처음에는 숨김 */
    transition: opacity 0.3s ease;
    /* High quality image rendering */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
    image-rendering: auto;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    z-index: 2;
}

/* Video preview styles removed in v3.2.4 for stability */

.card-category-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.card-info {
    padding: 15px;
}

.card-type-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--accent-color);
    color: var(--primary-color);
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.card-category-badge-text {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--primary-color) 100%);
    color: #fff;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-featured-badge-text {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #fff;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(255, 165, 0, 0.3);
}

/* 🆕 v4.2.30: Related videos badge */
.card-related-badge-text {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    color: #fff;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 4;  /* ✅ 4줄로 변경 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 8px;
}

.card-recommendation {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 10px;
}

.bookmark-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    z-index: 10;
}

.bookmark-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.bookmark-btn i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.bookmark-btn.bookmarked i {
    color: var(--primary-color);
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 1.1rem;
    display: none;
}

.loading-indicator.active {
    display: block;
}

/* Initial Loading - Centered in Content Area */
.initial-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 100;
    background: var(--bg-color);
    padding: 30px 40px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    max-width: 90%;
    min-width: 280px; /* 최소 너비 증가 (200px → 280px) */
}

.initial-loading i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    display: block;
    animation: spin 1s linear infinite;
}

.initial-loading h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: 600;
    white-space: nowrap;  /* 텍스트 줄바꿈 방지 */
}

.initial-loading p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;  /* 텍스트 줄바꿈 방지 */
}

/* 모바일 최적화 */
@media (max-width: 480px) {
    .initial-loading {
        padding: 20px 25px; /* 패딩 축소 */
        min-width: 260px; /* 최소 너비 증가 (250px → 260px) */
    }
    
    .initial-loading h3 {
        font-size: 1rem; /* 폰트 크기 축소 (1.1rem → 1rem) */
    }
    
    .initial-loading p {
        font-size: 0.8rem; /* 폰트 크기 축소 (0.85rem → 0.8rem) */
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 🆕 HASRI AI 프로필 스피너 애니메이션 (v3.7.58) */
@keyframes hasriSpinClean {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* In-App Browser Warning Overlay */
.in-app-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes scaleIn {
    from { 
        opacity: 0; 
        transform: scale(0.9);
    }
    to { 
        opacity: 1; 
        transform: scale(1);
    }
}

.in-app-warning-content {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease-out;
}

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

.warning-icon {
    font-size: 4rem;
    color: #FF9800;
    margin-bottom: 20px;
}

.warning-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.warning-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.6;
}

.warning-guide {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
}

.warning-guide h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.warning-guide ol {
    margin: 0;
    padding-left: 20px;
}

.warning-guide li {
    margin-bottom: 10px;
    color: var(--text-primary);
    line-height: 1.6;
}

.warning-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-primary-action {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.3);
}

.btn-primary-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 20, 60, 0.4);
}

.btn-primary-action:active {
    transform: translateY(0);
}

.btn-secondary-action {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-secondary-action:hover {
    background: var(--accent-color);
    transform: translateY(-1px);
}

.btn-tertiary-action {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-tertiary-action:hover {
    background: var(--border-color);
}

.btn-continue-anyway {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 10px 20px;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.btn-continue-anyway:hover {
    color: var(--text-primary);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .in-app-warning-content {
        padding: 30px 20px;
    }
    
    .warning-title {
        font-size: 1.5rem;
    }
    
    .warning-subtitle {
        font-size: 1rem;
    }
    
    .btn-primary-action {
        font-size: 1rem;
        padding: 14px 20px;
    }
}

/* Search Tab */
.search-container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--content-padding);
}

.search-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 1rem;
    transition: all 0.3s;
    /* Prevent zoom on iOS */
    font-size: 16px;
}

@media (max-width: 768px) {
    .search-input {
        padding: 12px 16px;
        border-radius: 22px;
    }
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--accent-color);
}

.search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Recent Searches */
.recent-searches {
    margin-bottom: 30px;
}

.recent-searches-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.recent-searches-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.clear-all-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

.clear-all-btn:hover {
    color: var(--primary-color);
}

.search-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.search-chip {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.search-chip:hover {
    background: var(--accent-color);
    border-color: var(--primary-color);
}

.search-chip .remove-chip {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.search-chip .remove-chip:hover {
    background: var(--primary-color);
    color: white;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-results i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.no-results p {
    font-size: 1.1rem;
}

/* Share Tab */
/* ====================================
 * Share Tab - Complete Override
 * ==================================== */

/* 공유 탭 전용 fixed 레이아웃 */
#shareTab {
    display: none;
    position: fixed !important;
    top: var(--header-height) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: var(--tab-bar-height) !important;  /* ✅ 탭바 위까지 */
    width: 100% !important;
    /* ✅ height 제거 - bottom으로 자동 계산 */
    background: var(--bg-primary) !important;
    z-index: 100 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    /* Hide scrollbar */
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

#shareTab::-webkit-scrollbar {
    display: none !important;
}

#shareTab.active {
    display: block !important;
}

.share-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100%;  /* ✅ 부모 요소 높이에 맞춤 */
    padding: 20px 0 20px 0 !important;  /* ✅ 하단도 20px 추가 */
    margin: 0 !important;
    box-sizing: border-box;
    background: var(--bg-primary);
}

/* PC에서는 상단 정렬 */
@media (min-width: 768px) {
    .share-container {
        align-items: flex-start;
        padding: 30px 0 30px 0 !important;  /* ✅ 상하 30px */
        margin: 0 !important;
        min-height: 100%;
    }
}


.share-card {
    background: white;
    border-radius: 20px;
    padding: 32px 24px 10px 24px;  /* ✅ 하단 패딩 대폭 축소: 20px → 10px */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 420px;
    width: calc(100% - 32px);  /* ✅ 좌우 16px 여백 */
    border: 1px solid rgba(74, 144, 226, 0.1);
}

/* 모바일: 최대한 컴팩트 */
@media (max-width: 767px) {
    .share-card {
        padding: 20px 16px 8px 16px;  /* ✅ 모든 패딩 최소화 */
        max-width: 90%;
        width: calc(90% - 32px);
    }
    
    /* ✅ 모바일 전용 추가 축소 */
    .share-header {
        margin-bottom: 14px !important;
        padding-bottom: 14px !important;
        gap: 12px !important;
    }
    
    .share-app-icon {
        width: 52px !important;
        height: 52px !important;
    }
    
    .share-card h2 {
        font-size: 1.25rem !important;
    }
    
    .share-description {
        margin-bottom: 14px !important;
        font-size: 0.88rem !important;
    }
}

/* Share Header with Icon */
.share-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 18px;  /* ✅ 줄임 */
    padding-bottom: 18px;  /* ✅ 줄임 */
    border-bottom: 2px solid rgba(74, 144, 226, 0.1);
}

.share-app-icon {
    width: 60px;  /* ✅ 약간 작게 */
    height: 60px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 3px solid white;
}

.share-title-group {
    text-align: left;
    flex: 1;
}

.share-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    line-height: 1.3;
}

.share-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 4px 0 0 0 !important;
    font-weight: 500;
}

.share-description {
    color: var(--text-secondary);
    margin-bottom: 18px;  /* ✅ 줄임 */
    line-height: 1.5;
    font-size: 0.92rem;
}

/* Share QR Code Section (v3.7.79) */
.share-qr-section {
    margin: 18px 0;  /* ✅ 마진 축소 */
    padding: 18px 14px;  /* ✅ 패딩 축소 */
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 14px;
    border: 2px dashed rgba(74, 144, 226, 0.3);
}

.share-qr-container {
    text-align: center;
}

.share-qr-code {
    display: inline-block;
    padding: 10px;  /* ✅ 줄임 */
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;  /* ✅ 줄임 */
}

.share-qr-code canvas,
.share-qr-code img {
    display: block;
    width: 130px !important;  /* ✅ 작게 */
    height: 130px !important;
    margin: 0 auto;
}

.share-qr-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 500;
}

.share-qr-text i {
    color: var(--primary-color);
    margin-right: 6px;
}

/* 반응형: 모바일 (전체 모바일) */
@media (max-width: 767px) {
    .share-qr-code canvas,
    .share-qr-code img {
        width: 100px !important;  /* ✅ 모바일에서 더 작게 */
        height: 100px !important;
    }
    
    .share-qr-section {
        padding: 12px 10px !important;  /* ✅ 패딩 축소 */
        margin: 12px 0 !important;
    }
    
    .share-qr-code {
        padding: 8px !important;  /* ✅ 패딩 축소 */
        margin-bottom: 8px !important;
    }
    
    .share-qr-text {
        font-size: 0.8rem !important;  /* ✅ 폰트 축소 */
    }
}

/* 반응형: 소형 모바일 */
@media (max-width: 480px) {
    .share-qr-code canvas,
    .share-qr-code img {
        width: 90px !important;  /* ✅ 소형은 더더 작게 */
        height: 90px !important;
    }
    
    .share-qr-section {
        padding: 10px 8px !important;
        margin: 10px 0 !important;
    }
}

/* 반응형: PC */
@media (min-width: 768px) {
    .share-qr-code canvas,
    .share-qr-code img {
        width: 180px !important;
        height: 180px !important;
    }
}

/* Share Buttons Container */
.share-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;  /* ✅ 버튼 간격 축소 */
    margin-top: 18px;  /* ✅ 상단 마진 축소 */
    margin-bottom: 0;
}

.share-btn,
.install-btn {
    width: 100%;
    border: none;
    padding: 13px 18px;  /* ✅ 패딩 축소 */
    border-radius: 10px;
    font-size: 0.94rem;  /* ✅ 폰트 약간 축소 */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

/* Share Button */
.share-btn {
    background: linear-gradient(135deg, var(--primary-color), #3a7bc8);
    color: white;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.share-btn:active {
    transform: translateY(0);
}

.share-btn i {
    font-size: 1.1rem;
}

/* Install Button */
.install-btn {
    background: linear-gradient(135deg, #FF6B6B, #EE5A6F);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.install-btn:active {
    transform: translateY(0);
}

.install-btn i {
    font-size: 1.1rem;
}

/* 모바일 버튼 최적화 */
@media (max-width: 767px) {
    .share-buttons {
        gap: 8px !important;  /* ✅ 버튼 간격 더 축소 */
        margin-top: 12px !important;  /* ✅ 상단 마진 축소 */
    }
    
    .share-btn,
    .install-btn {
        padding: 11px 16px !important;  /* ✅ 패딩 축소 */
        font-size: 0.88rem !important;  /* ✅ 폰트 축소 */
        gap: 6px !important;
    }
    
    .share-btn i,
    .install-btn i {
        font-size: 1rem !important;  /* ✅ 아이콘 축소 */
    }
}

/* Share Notification */
.share-notification {
    margin-top: 16px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.share-notification i {
    font-size: 1.1rem;
}

.share-notification.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
}

.share-notification.active {
    opacity: 1;
}

/* Bottom Tab Bar */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: var(--tab-bar-height);
    background: white !important;  /* ✅ 흰색 배경 강제 */
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15) !important;  /* ✅ 그림자 강화 */
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 2100 !important;  /* ✅ z-index 강제 */
    overflow: hidden;
}

.tab-bar-item {
    flex: 1;
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease, transform 0.1s ease;
    /* 🆕 터치 반응성 개선 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
}

/* 🆕 터치 피드백 효과 */
.tab-bar-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(220, 20, 60, 0.1);
    border-radius: 8px;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tab-bar-item:active::after {
    opacity: 1;
    transform: scale(1);
}

.tab-bar-item i {
    font-size: 1.5rem;
}

.tab-bar-item span {
    font-size: 0.75rem;
    font-weight: 500;
}

.tab-bar-item:hover {
    color: var(--primary-color);
}

.tab-bar-item.active {
    color: var(--primary-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;  /* 배경을 흰색으로 변경하여 뒤의 콘텐츠 완전히 숨김 */
    z-index: 2000;
    display: none;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active {
    display: block;
    transform: translateX(0);
}

.modal-content {
    background: white;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    position: relative;
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.modal-content::-webkit-scrollbar {
    display: none;
}

@keyframes modalSlideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes modalSlideOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

.modal-close {
    display: none; /* Hidden - use back button instead */
}

.modal-body {
    padding: var(--header-height) 0 var(--tab-bar-height) 0; /* 상단에 헤더 높이만큼 padding */
    min-height: 100vh;
    background: white;
}

/* Modal Detail Styles */
.modal-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0; /* padding 제거 - modal-body에서 처리 */
}

.modal-thumbnail-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    overflow: hidden;
}

.modal-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* High quality image rendering - optimized for sharpness */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
    image-rendering: auto;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* Add smooth anti-aliasing */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* YouTube Player Wrapper */
.modal-player-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: #000;
}

/* YouTube Preview (before play) */
.youtube-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.youtube-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* High quality image rendering - optimized for sharpness */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
    image-rendering: auto;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* Add smooth anti-aliasing */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.youtube-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    transition: background 0.3s;
    cursor: pointer;
}

.youtube-play-overlay:hover {
    background: rgba(0, 0, 0, 0.5);
}

.youtube-play-btn {
    background: rgba(255, 0, 0, 0.9);
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.youtube-play-btn:hover {
    background: rgba(255, 0, 0, 1);
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(255, 0, 0, 0.4);
}

.youtube-play-btn i {
    font-size: 1.5rem;
}

/* YouTube Player Container */
.youtube-player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.modal-youtube-player {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    background: #000;
    z-index: 10 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#playerContainer {
    position: absolute !important;  /* ✅ Shorts 방식: absolute */
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #000;
    display: none;
    z-index: 20 !important;  /* youtube-preview 위에 */
}

#playerContainer.active {
    display: block;
}

/* 🔥 v3.7.69 - 동영상 상세 로딩 스피너 (순수 CSS, 모바일 원형 강제) */
.youtube-loading-overlay .video-loading-container {
    position: relative;
    width: 80px !important;
    height: 80px !important;
}

.youtube-loading-overlay .video-loading-profile {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 70px !important;
    height: 70px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid white !important;
    box-shadow: 0 0 0 1px #DC143C !important;
    z-index: 1 !important;
}

.youtube-loading-overlay .video-loading-ring {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    border: 3px solid transparent !important;
    border-top-color: #DC143C !important;
    border-right-color: #e74c3c !important;
    border-bottom-color: #B71C1C !important;
    animation: hasriSpinClean 1.5s linear infinite !important;
    z-index: 2 !important;
}

/* PC 반응형 크기 (768px+) */
@media (min-width: 768px) {
    .youtube-loading-overlay .video-loading-container {
        width: 100px !important;
        height: 100px !important;
    }
    
    .youtube-loading-overlay .video-loading-profile {
        width: 85px !important;
        height: 85px !important;
    }
    
    .youtube-loading-overlay .video-loading-ring {
        border-width: 3px !important;
    }
}

@media (min-width: 1024px) {
    .youtube-loading-overlay .video-loading-container {
        width: 120px !important;
        height: 120px !important;
    }
    
    .youtube-loading-overlay .video-loading-profile {
        width: 100px !important;
        height: 100px !important;
        border-width: 3px !important;
    }
    
    .youtube-loading-overlay .video-loading-ring {
        border-width: 4px !important;
    }
}

@media (min-width: 1920px) {
    .youtube-loading-overlay .video-loading-container {
        width: 140px !important;
        height: 140px !important;
    }
    
    .youtube-loading-overlay .video-loading-profile {
        width: 120px !important;
        height: 120px !important;
    }
    
    .youtube-loading-overlay .video-loading-ring {
        border-width: 4px !important;
    }
}

@media (min-width: 2560px) {
    .youtube-loading-overlay .video-loading-container {
        width: 160px !important;
        height: 160px !important;
    }
    
    .youtube-loading-overlay .video-loading-profile {
        width: 140px !important;
        height: 140px !important;
        border-width: 4px !important;
    }
    
    .youtube-loading-overlay .video-loading-ring {
        border-width: 5px !important;
    }
}

/* 🆕 YouTube Loading Overlay (v3.7.60 - 프로필 스피너) */
.youtube-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.3s ease-in-out;
}

.youtube-loading-overlay .loading-spinner {
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* 🆕 프로필 스피너 스타일 */
.youtube-loading-overlay .loading-spinner > div {
    position: relative;
}

.youtube-loading-overlay .loading-spinner img {
    border-radius: 50%;
    object-fit: cover;
}

.youtube-loading-overlay .loading-spinner p {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    background: linear-gradient(135deg, #DC143C, #B71C1C);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 🆕 Fallback 스피너 제거 (v3.7.60 - 사각형 아이콘 완전 삭제) */
/* FontAwesome 스피너는 더 이상 사용하지 않음 - 프로필 스피너만 사용 */

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

/* Player Error / Message Display */
.player-error-content {
    text-align: center;
    padding: 30px 20px;
    max-width: 350px;
    margin: 0 auto;
}

.player-error-content i {
    font-size: 2.5rem;
    color: #ff6b6b;
    margin-bottom: 15px;
    display: block;
}

.player-error-content p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.95);
}

.player-error-content .modal-btn {
    margin: 15px auto 0;
}

.modal-featured-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
}

.modal-header-info {
    padding: 0 25px;
}

.modal-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.modal-type-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--accent-color);
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.modal-category-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.modal-category-badge:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.modal-category-badge:hover::after {
    content: '클릭하여 필터링';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0;
}

.modal-recommendation,
.modal-description,
.modal-keywords {
    padding: 0 25px;
}

.modal-recommendation h3,
.modal-description h3,
.modal-keywords h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-recommendation h3 i {
    color: var(--primary-color);
}

.modal-recommendation p,
.modal-description p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

.modal-keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.modal-keyword-tag {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

.modal-actions {
    display: flex;
    gap: 10px;
    padding: 25px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.modal-btn {
    flex: 1;
    min-width: 140px;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-btn-primary {
    background: var(--primary-color);
    color: white;
}

.modal-btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.modal-btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.modal-btn-bookmark {
    background: white;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.modal-btn-bookmark:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.modal-btn-bookmark.bookmarked {
    background: var(--accent-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        margin-top: auto;
    }
    
    .modal-thumbnail-wrapper,
    .modal-player-wrapper {
        border-radius: 16px 16px 0 0;
    }
    
    .youtube-play-btn {
        padding: 16px 32px;
        font-size: 1rem;
        gap: 10px;
    }
    
    .youtube-play-btn i {
        font-size: 1.3rem;
    }
    
    .modal-title {
        font-size: 1.25rem;
    }
    
    .modal-header-info,
    .modal-recommendation,
    .modal-description,
    .modal-keywords {
        padding: 0 20px;
    }
    
    .modal-actions {
        padding: 20px;
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
        min-width: unset;
    }
    
    /* 🆕 v4.2.28: Mobile - Show related videos right after video */
    #mobileRelatedVideosPlaceholder {
        display: block !important; /* Override PC display:none */
    }
    
    #mobileRelatedVideosPlaceholder .related-videos-section {
        display: block !important;
        margin: 0;
        padding: 0; /* ✅ 좌우 여백 제거 */
        padding-top: 0; /* ✅ 상단 여백 완전 제거 */
        padding-bottom: 20px;
        border-bottom: none; /* ✅ 구분선 제거 (제목-관련콘텐츠 사이) */
        background: transparent; /* ✅ 투명 배경 */
    }
    
    /* Hide category badge inside related videos on mobile */
    #mobileRelatedVideosPlaceholder .related-video-category {
        display: none !important;
    }
    
    /* Hide heading on mobile for cleaner design */
    #mobileRelatedVideosPlaceholder .related-videos-heading {
        display: none !important;
    }
    
    #pcRelatedVideosPlaceholder .related-videos-section {
        display: none !important; /* Hide PC version on mobile */
    }
    
    /* 🆕 v4.2.8: Mobile - Related Videos Section */
    .related-videos-section {
        margin-bottom: 30px;
        padding-bottom: 30px;
        border-bottom: 1px solid var(--border-color);
    }
    
    .related-videos-heading {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 16px;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 0 20px;
    }
    
    .related-videos-heading i {
        color: var(--primary-color);
        font-size: 1rem;
    }
    
    /* 🆕 v4.2.28: Mobile - Related Videos Horizontal Scroll (Full Width) */
    .related-videos-container {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 12px;
        padding: 0 16px; /* ✅ 좌우 패딩만 */
        padding-bottom: 12px;
        margin: 0;
        display: flex;
        
        /* Show scrollbar hint */
        scrollbar-width: thin;
        scrollbar-color: var(--primary-color) transparent;
    }
    
    .related-videos-container::-webkit-scrollbar {
        height: 4px;
    }
    
    .related-videos-container::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .related-videos-container::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 2px;
    }
    
    .related-video-card {
        flex: 0 0 calc(100% - 60px);  /* ✅ 더 넓게 (80px → 60px) */
        scroll-snap-align: start;
        display: flex;
        flex-direction: row;  /* 가로 방향 */
        gap: 12px;
        padding: 12px 16px; /* ✅ 좌우 패딩 증가 */
        background: white; /* ✅ 흰색 배경 */
        border: 1px solid rgba(0,0,0,0.08); /* ✅ 연한 테두리 */
        border-radius: 12px; /* ✅ 둥근 모서리 증가 */
        cursor: pointer;
        transition: all 0.2s;
        align-items: center;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06); /* ✅ 그림자 추가 */
    }
    
    .related-video-card:active {
        background: var(--accent-color);
        border-color: var(--primary-color);
        transform: scale(0.98);
    }
    
    /* Third card partially visible hint */
    .related-video-card:last-child {
        margin-right: 60px;
    }
    
    .related-video-thumbnail {
        width: 100px;  /* 1/4 크기 */
        height: 56px;  /* 16:9 비율 */
        flex-shrink: 0;
        border-radius: 6px;
        overflow: hidden;
        background: var(--bg-secondary);
    }
    
    .related-video-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .related-video-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
    }
    
    .related-video-category {
        display: inline-block;
        font-size: 0.65rem;
        padding: 2px 6px;
        border-radius: 4px;
        background: var(--primary-color);
        color: white;
        font-weight: 500;
        width: fit-content;
    }
    
    .related-video-title {
        font-size: 0.85rem;
        font-weight: 500;
        color: var(--text-primary);
        line-height: 1.3;
        margin: 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;  /* 2줄로 제한 */
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .related-videos-heading {
        padding: 0 20px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .modal {
        padding: 0;
    }
    
    .modal-content {
        border-radius: 0;
        max-height: 100vh;
    }
    
    .modal-thumbnail-wrapper,
    .modal-player-wrapper {
        border-radius: 0;
    }
}

.modal-body .visit-link:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
        --tab-bar-height: 60px;
        --content-padding: 12px;
    }
    
    /* Mobile Logo */
    .logo-icon {
        font-size: 1.3rem;
    }
    
    .logo-main {
        font-size: 0.95rem;
    }
    
    .logo-premium {
        font-size: 0.6rem;
    }

    .header-title {
        font-size: 1.1rem;
    }

    .header-actions {
        gap: 6px;
    }

    /* Hide category button on mobile (use floating button instead) */
    .category-btn {
        display: none !important;
    }

    .admin-link,
    .category-btn {
        width: 36px;
        height: 36px;
    }

    .featured-section {
        padding: 12px;
    }

    .featured-title {
        font-size: 1.15rem;
    }

    .featured-info {
        padding: 16px;
    }

    .featured-reason {
        font-size: 0.9rem;
    }

    .more-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .feed-section {
        padding: 12px;
    }

    .card-title {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        /* min-height 제거 - 1줄 제목 여백 문제 해결 */
    }

    .card-info {
        padding: 12px;
    }

    .card-type-badge {
        font-size: 0.7rem;
        padding: 2px 8px;
    }

    .card-keywords {
        font-size: 0.75rem;
    }

    .card-recommendation {
        font-size: 0.8rem;
    }

    .bookmark-btn {
        width: 32px;
        height: 32px;
        bottom: 12px;
        right: 12px;
    }

    .bookmark-btn i {
        font-size: 1rem;
    }

    .search-container {
        padding: 12px;
    }

    .search-input-wrapper {
        gap: 8px;
    }

    .search-input {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .search-btn {
        width: 44px;
        height: 44px;
    }

    .recent-searches-header h3 {
        font-size: 0.9rem;
    }

    .clear-all-btn {
        font-size: 0.85rem;
    }

    .search-chip {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .share-card {
        padding: 30px 20px;
    }

    .share-icon {
        width: 70px;
        height: 70px;
    }

    .share-icon i {
        font-size: 1.75rem;
    }

    .share-card h2 {
        font-size: 1.25rem;
    }

    .share-card p {
        font-size: 0.95rem;
    }

    .tab-bar-item i {
        font-size: 1.3rem;
    }

    .tab-bar-item span {
        font-size: 0.7rem;
    }

    .modal-content {
        max-width: 95vw;
        max-height: 85vh;
    }

    .modal-body {
        padding: var(--header-height) 16px var(--tab-bar-height) 16px; /* 좌우에만 16px 추가 */
    }

    .modal-body h2 {
        font-size: 1.25rem;
    }

    .modal-body p {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 1rem;
    }
    
    /* Logo - 2 line layout on mobile */
    .logo-line-1 {
        font-size: 0.95rem;
    }
    
    .logo-line-2 {
        gap: 3px;
    }
    
    .logo-premium {
        font-size: 0.6rem;
    }
    
    .version-badge {
        font-size: 0.55rem;
    }

    .featured-title {
        font-size: 1.05rem;
    }

    .featured-badge {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .card-category-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .category-panel {
        width: 100%;
        max-width: 100vw;
    }

    .category-item {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .share-card h2 {
        font-size: 1.15rem;
    }
}

/* ==================================== */
/* Search Overlay Styles */
/* ==================================== */

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.search-overlay.active {
    display: block;
}

.search-overlay-content {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 100%;
    background: white;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s ease-out;
}

/* Desktop/Tablet: Center and limit width */
@media (min-width: 768px) {
    .search-overlay-content {
        max-width: 700px;
        height: auto;
        max-height: 90vh;
        margin-top: 5vh;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.search-overlay-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.search-overlay-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    /* Fix: 모바일 최적화 - 가독성 향상 */
    font-size: 1.1rem;
    outline: none;
    transition: all 0.3s;
    background: white;
}

.search-overlay-input:focus {
    border-color: var(--primary-color);
}

/* Search Results List */
.search-results-list {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.search-result-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.search-result-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.search-result-thumbnail {
    width: 100px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.search-result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-result-type {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
}

.search-result-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ==================================== */
/* Info Tab (News Feed Style) */
/* ==================================== */

.info-feed {
    padding: var(--content-padding);
    max-width: 800px;
    margin: 0 auto;
}

.info-card {
    display: flex;
    gap: 12px;
    background: white;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.info-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.info-card:active {
    transform: translateY(0);
}

.info-card-thumbnail {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.info-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-badge-small {
    position: absolute;
    top: 6px;
    right: 6px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
}

.info-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-card-type {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
}

.info-card-category {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: var(--accent-color);
    padding: 2px 8px;
    border-radius: 8px;
}

.info-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.info-card-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.info-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.info-card-keywords {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.info-card-keywords .keyword-tag {
    font-size: 0.7rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: 8px;
}

.info-bookmark-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    padding: 4px 8px;
}

.info-bookmark-btn.bookmarked {
    color: var(--primary-color);
}

.info-bookmark-btn:hover {
    transform: scale(1.1);
}

/* Responsive for info cards */
@media (max-width: 768px) {
    .search-overlay-content {
        max-width: 100%;
    }
    
    .info-card {
        padding: 10px;
    }
    
    .info-card-thumbnail {
        width: 100px;
        height: 100px;
    }
    
    .info-card-title {
        font-size: 0.9rem;
    }
    
    .info-card-description {
        font-size: 0.8rem;
    }
    
    .search-result-item {
        padding: 10px;
    }
    
    .search-result-thumbnail {
        width: 80px;
        height: 50px;
    }
    
    .search-result-title {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .info-card {
        flex-direction: column;
        gap: 10px;
    }
    
    .info-card-thumbnail {
        width: 100%;
        height: 180px;
    }
    
    .search-overlay-header {
        padding: 12px;
    }
    
    .search-overlay-input {
        font-size: 0.95rem;
        padding: 10px 14px;
    }
}


/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;  /* ✅ 8px → 12px로 확대 */
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 6px;  /* ✅ 둥근 모서리 추가 */
}

::-webkit-scrollbar-thumb {
    background: #DC143C;  /* ✅ var(--border-color) → 빨간색으로 변경 (눈에 잘 띔) */
    border-radius: 6px;
    border: 2px solid var(--bg-secondary);  /* ✅ 테두리 추가 (더 선명하게) */
}

::-webkit-scrollbar-thumb:hover {
    background: #B71C1C;  /* ✅ 호버 시 더 진한 빨간색 */
    border-color: var(--bg-primary);  /* ✅ 호버 시 테두리 색상 변경 */
}

/* ====================================
   Desktop Layout (≥1024px)
   ==================================== */

@media (min-width: 1024px) {
    /* Desktop Header with Logo */
    .header-content {
        max-width: 1920px;
        justify-content: flex-start;
        gap: 30px;
    }
    
    .logo-container {
        flex: 0 0 auto;
        margin-right: auto;
    }
    
    .logo-icon {
        font-size: 2rem;
    }
    
    .logo-main {
        font-size: 1.3rem;
    }
    
    .logo-premium {
        font-size: 0.75rem;
    }
    
    /* Hide category button on desktop */
    .category-btn {
        display: none;
    }
    
    /* Desktop layout container */
    .main-content {
        display: flex;
        margin-left: 0;
        margin-right: 280px;  /* 카테고리 패널 공간만 확보 */
        position: relative;
        padding-bottom: 0;  /* ✅ PC에서는 하단 패딩 제거 */
    }
    
    /* Content area takes remaining space */
    .tab-content {
        flex: 1;
        width: 100%;
    }
    
    /* Fixed category sidebar on the right */
    .category-overlay {
        position: fixed;
        top: var(--header-height);
        right: 0;
        bottom: var(--tab-bar-height);
        left: auto;
        width: 280px;
        background: transparent;
        display: block !important;
        opacity: 1 !important;
        z-index: 50;
        pointer-events: none;
    }
    
    .category-panel {
        width: 100%;
        max-width: 100%;
        height: 100%;
        transform: none !important;
        box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
        border-left: 1px solid var(--border-color);
        pointer-events: auto;
        background: var(--bg-secondary) !important;
    }
    
    .category-header {
        background: var(--bg-secondary) !important;
        color: var(--text-primary) !important;
        border-bottom: 1px solid var(--border-color) !important;
    }
    
    .category-header h2 {
        color: var(--text-primary) !important;
    }
    
    /* Hide close button on desktop */
    .category-header .close-btn {
        display: none;
    }
    
    .category-list {
        overflow-y: auto;
        max-height: calc(100vh - var(--header-height) - var(--tab-bar-height) - 61px);
    }
    
    /* Hide category panel on desktop when Shorts tab is active */
    #shortsTab.active ~ .category-overlay {
        display: none !important;
    }
    
    /* ========================================
       PC Modal 3-Column Layout
       ======================================== */
    
    /* Modal container */
    .modal.active {
        display: flex !important;
        background: rgba(0, 0, 0, 0.8);
        transform: translateX(0) !important;
        right: 280px !important; /* 카테고리 패널 공간 확보 */
    }
    
    .modal.active .modal-content {
        width: 100% !important; /* 모달 자체가 이미 280px 줄어듦 */
        height: 100vh !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        max-width: none !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    
    .modal.active .modal-close {
        position: absolute;
        top: 20px;
        right: 20px; /* 모달 우측 끝 */
        z-index: 1002;
        display: block !important;
    }
    
    /* Modal body: 3-column layout (left + center) */
    .modal.active .modal-body {
        flex: 1 !important;
        display: flex !important;
        overflow: hidden !important;
        margin-top: var(--header-height) !important;
        padding: 0 !important;
        height: calc(100vh - var(--header-height) - var(--tab-bar-height)) !important;
        max-height: calc(100vh - var(--header-height) - var(--tab-bar-height)) !important;
    }
    
    /* Left column: Video + Info - 고정 크기 900px */
    .modal.active .modal-left-column {
        flex: 0 0 900px !important;
        width: 900px !important;
        max-width: 900px !important;
        min-width: 900px !important;
        height: 100% !important;
        max-height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        background: var(--bg-primary) !important;
    }
    
    /* Video fixed at top */
    .modal.active .modal-player-wrapper {
        flex-shrink: 0 !important;
        width: 100% !important;
        height: auto !important;
        padding: 0 !important;
        background: transparent !important;
        display: block !important;
        overflow: hidden !important;
        position: relative !important;
    }
    
    .modal.active .modal-player-wrapper .modal-thumbnail-wrapper,
    .modal.active .modal-player-wrapper .youtube-preview {
        position: relative !important;
        width: 100% !important;
        padding-top: 56.25% !important;
        height: 0 !important;
        display: block !important;
        background: #000 !important;
    }
    
    .modal.active .modal-player-wrapper img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        display: block !important;
        object-fit: cover !important;
        image-rendering: -webkit-optimize-contrast !important;
        image-rendering: crisp-edges !important;
    }
    
    .modal.active .youtube-player-container {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: #000 !important;
    }
    
    .modal.active .youtube-player-container iframe {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    /* Content below video (scrollable) */
    .modal.active .modal-left-content {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 30px 25px !important;
        padding-bottom: calc(var(--tab-bar-height) + 80px) !important; /* ✅ 65px + 80px = 145px */
        
        /* Hide scrollbar */
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }
    
    .modal.active .modal-left-content::-webkit-scrollbar {
        display: none !important;
    }
    
    /* Center column: Recommended Videos */
    .modal.active .modal-center-column {
        flex: 1 !important;
        height: 100vh !important; /* ✅ 100% → 100vh (뷰포트 높이 기준) */
        max-height: 100vh !important; /* ✅ 100% → 100vh */
        max-width: calc(100% - 280px) !important; /* ✅ 카테고리 영역 제외 */
        overflow: hidden !important; /* ✅ visible → hidden (너비 제한 + 스크롤 활성화) */
        padding: 0 !important; /* ✅ padding 제거 */
        background: var(--bg-secondary) !important;
        border-left: 1px solid var(--border-color) !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Category panel stays fixed on right */
    .modal.active ~ .category-overlay {
        display: block !important;
        z-index: 2001 !important;
        pointer-events: auto !important;
        opacity: 1 !important;
    }
    
    /* Recommended video section */
    .modal-video-list-section {
        margin-top: 0 !important;
        padding-top: 0 !important;
        border-top: none !important;
    }
    
    /* ====================================
       🆕 v4.2.13: Related Videos Section (PC - Sticky at top of center column)
       ==================================== */
    
    /* PC: Hide placeholders, render directly in center column */
    #pcRelatedVideosPlaceholder,
    #mobileRelatedVideosPlaceholder {
        display: none; /* Not used on PC */
    }
    
    /* PC: Related videos sticky at top of center column */
    .modal-center-column .related-videos-section {
        position: sticky;
        top: 0; /* ✅ 센터 컬럼 최상단에 고정 */
        z-index: 11; /* Higher than recommended header */
        background: var(--bg-secondary); /* Match center column */
        margin: 0;
        padding: 30px 20px 20px 20px;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 2px 4px rgba(0,0,0,0.08);
        flex-shrink: 0; /* ✅ 크기 고정 */
        width: 100%; /* ✅ 너비 고정 */
    }
    
    /* 🆕 v4.2.25: Scrollable wrapper for recommended videos */
    .recommended-videos-wrapper {
        flex: 1 1 auto; /* ✅ flex-shrink 활성화 */
        min-height: 0; /* ✅ Flexbox 스크롤을 위한 필수 속성 */
        max-height: calc(100vh - 100px); /* ✅ 뷰포트 기준 최대 높이 */
        overflow-y: scroll !important; /* ✅ scroll로 강제 (auto 대신) */
        overflow-x: hidden;
        padding: 0;
        padding-bottom: calc(var(--tab-bar-height) + 80px); /* 145px */
        width: 100%; /* ✅ 너비 고정 */
        position: relative; /* ✅ sticky header를 위한 positioning context */
        
        /* Hide scrollbar */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .recommended-videos-wrapper::-webkit-scrollbar {
        display: none;
    }
    
    /* 🆕 v4.2.20: Sticky header for recommended videos */
    .recommended-videos-header {
        position: sticky;
        top: 0; /* ✅ wrapper 내에서 상단 고정 */
        z-index: 10; /* 관련 동영상보다 낮음 */
        background: var(--bg-secondary); /* ✅ 배경색 추가 */
        padding: 30px 20px 10px 20px; /* ✅ 좌우 padding 추가 */
        margin: 0 0 20px 0;
        font-size: 1.3rem;
        font-weight: 600;
        color: var(--text-primary);
        box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* ✅ 구분선 효과 */
    }
    
    .related-videos-section {
        margin-bottom: 30px;
        padding-bottom: 30px;
        border-bottom: 1px solid var(--border-color);
    }
    
    .related-videos-heading {
        font-size: 1.3rem; /* ✅ 추천 동영상과 동일한 크기 */
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 16px;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .related-videos-heading i {
        color: var(--primary-color);
        font-size: 1rem;
    }
    
    .related-videos-container {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .related-video-card {
        display: flex;
        gap: 12px;
        padding: 12px;
        background: var(--bg-primary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s;
        align-items: center;
    }
    
    .related-video-card:hover {
        background: var(--accent-color);
        border-color: var(--primary-color);
        transform: translateX(5px);
        box-shadow: var(--shadow-sm);
    }
    
    .related-video-thumbnail {
        flex-shrink: 0;
        width: 100px;  /* 1/4 크기로 축소 */
        height: 56px;  /* 16:9 비율 유지 */
        border-radius: 6px;
        overflow: hidden;
        position: relative;
        background: var(--bg-secondary);
    }
    
    .related-video-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .related-video-featured {
        position: absolute;
        top: 4px;
        right: 4px;
        background: rgba(255, 215, 0, 0.95);
        padding: 2px 6px;
        border-radius: 4px;
        font-size: 0.7rem;
    }
    
    .related-video-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 6px;
        min-width: 0;
    }
    
    .related-video-category {
        display: inline-block;
        font-size: 0.7rem;
        padding: 3px 8px;
        border-radius: 4px;
        background: var(--primary-color);
        color: white;
        font-weight: 500;
        width: fit-content;
    }
    
    .related-video-title {
        font-size: 0.95rem;
        font-weight: 500;
        color: var(--text-primary);
        line-height: 1.4;
        margin: 0;
        
        /* 최대 2줄 표시 */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Recommended video cards */
    /* 데스크톱에서는 추천 영상 표시, 모바일에서만 숨김은 미디어 쿼리에서 처리 */
    
    .modal-video-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 0 20px; /* ✅ wrapper padding 이동 */
    }
    
    .modal-video-grid .video-card {
        display: flex !important;
        gap: 15px !important;
        padding: 12px !important;
        background: var(--bg-primary) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 8px !important;
        cursor: pointer !important;
        transition: all 0.2s !important;
        min-height: 70px !important;
        align-items: center !important;
    }
    
    .modal-video-grid .video-card:hover {
        background: var(--bg-secondary) !important;
        border-color: var(--primary-color) !important;
        transform: translateX(5px);
    }
    
    .modal-video-grid .video-thumbnail-wrapper {
        flex-shrink: 0 !important;
        width: 125px !important;
        height: 70px !important;
        border-radius: 6px !important;
        overflow: hidden !important;
        position: relative !important;
    }
    
    .modal-video-grid .video-thumbnail {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    
    .modal-video-grid .video-info {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }
    
    .modal-video-grid .video-title {
        font-size: 0.95rem !important;
        font-weight: 500 !important;
        color: var(--text-primary) !important;
        margin: 0 0 6px 0 !important;
        line-height: 1.3 !important;
        
        /* 1줄 제한 */
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    .modal-video-grid .video-meta {
        display: flex !important;
        gap: 6px !important;
        flex-wrap: wrap !important;
    }
    
    .modal-video-grid .type-badge,
    .modal-video-grid .category-badge {
        font-size: 0.7rem !important;
        padding: 2px 6px !important;
        border-radius: 4px !important;
        background: var(--primary-color) !important;
        color: white !important;
    }
    
    .modal-video-grid .featured-badge {
        position: absolute !important;
        top: 5px !important;
        right: 5px !important;
        background: rgba(255, 215, 0, 0.95) !important;
        padding: 3px 6px !important;
        border-radius: 4px !important;
        font-size: 0.7rem !important;
    }
    
    /* Adjust feed grids for desktop with sidebar */
    .feed-section {
        padding: var(--content-padding);
        max-width: 100%;
    }
    
    .feed-grid {
        width: 100%;
    }
}

/* Mobile/Tablet: Always hide category panel on Shorts tab */
@media (max-width: 1023px) {
    body:has(#shortsTab.active) .category-overlay {
        display: none !important;
    }
    
    /* ========================================
       Mobile Modal Layout
       ======================================== */
    
    .modal.active .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        display: block !important;
    }
    
    .modal.active .modal-body {
        display: flex !important;
        flex-direction: column !important;
        height: 100vh !important;
        overflow: hidden !important;  /* body는 스크롤 없음 */
        padding: 0 !important;  /* padding 제거 */
        position: relative !important;  /* 자식 absolute 기준 */
    }
    
    /* Mobile: single column layout */
    .modal.active .modal-left-column {
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        position: relative !important;
    }
    
    /* 동영상 영역 - 완전 고정 (absolute positioning) */
    .modal.active .modal-player-wrapper {
        position: absolute !important;  /* ✅ 절대 위치로 완전 고정 */
        top: var(--header-height) !important;  /* 상단바 바로 아래 */
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        padding-top: 56.25% !important;  /* 16:9 비율 */
        background: #000 !important;
        z-index: 1 !important;
        border-radius: 0 !important;  /* ✅ 모서리 굴림 제거 */
        overflow: hidden !important;
    }
    
    /* 동영상 내부 요소들도 모서리 제거 */
    .modal.active .modal-player-wrapper * {
        border-radius: 0 !important;
    }
    
    /* 콘텐츠 영역 - 스크롤 가능, 동영상 아래부터 시작 */
    .modal.active .modal-left-content {
        position: absolute !important;
        top: calc(var(--header-height) + 56.25vw) !important;  /* 상단바 + 동영상 높이 */
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;  /* ✅ 하단까지 꽉 차게 (탭바 공간 제거) */
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 20px 15px calc(var(--tab-bar-height) + 20px) 15px !important;  /* ✅ padding-bottom으로 탭바 공간 확보 */
        background: var(--bg-primary) !important;  /* ✅ 배경색 명시 */
        
        /* 스크롤 전파 차단 */
        overscroll-behavior: contain !important;  /* ✅ 핵심! 스크롤 전파 차단 */
        
        /* Hide scrollbar */
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }
    
    .modal.active .modal-left-content::-webkit-scrollbar {
        display: none !important;
    }
    
    /* Hide recommendation videos and category on mobile/tablet */
    .modal.active .modal-center-column {
        display: none !important;
    }
    
    /* 🆕 v4.2.28: Hide category badge on mobile modal */
    .modal.active .modal-category-badge {
        display: none !important;
    }
    
    /* 🆕 v4.2.30: Add divider between title and description (more subtle) */
    .modal.active .modal-header-info {
        padding-bottom: 16px;
        border-bottom: 1px solid rgba(0,0,0,0.05); /* ✅ 더 연한 구분선 */
        margin-bottom: 8px; /* ✅ 16px → 8px (반으로 줄임) */
    }
    
    /* 🆕 v4.2.17: Hide PC related videos section on mobile */
    .modal-center-column .related-videos-section {
        display: none !important;
    }
    
    /* 모바일에서 추천 영상 섹션도 숨김 */
    .modal-video-list-section {
        display: none !important;
    }
    
    .modal.active .category-overlay {
        display: none !important;
    }
    
    /* 공유 탭 - 하단 탭바 공간 확보 */
    #shareTab {
        position: fixed !important;
        top: var(--header-height) !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: var(--bg-primary) !important;
        z-index: 100 !important;
    }
    
    .main-content {
        padding-bottom: calc(var(--tab-bar-height) + 20px) !important;  /* ✅ 탭바 + 여백 */
        background: var(--bg-primary) !important;  /* ✅ 배경색 강제 */
    }
    
    .tab-content.active {
        background: var(--bg-primary) !important;  /* ✅ 배경색 강제 */
        min-height: 100vh !important;
    }
    
    .share-container {
        min-height: 100vh !important;
        padding: 20px !important;
        padding-bottom: 400px !important;  /* ✅ 400px - 매우 큰 여백 */
        background: var(--bg-primary) !important;  /* ✅ 배경색 강제 */
    }
    
    .share-card {
        margin-bottom: 120px !important;  /* ✅ 더 큰 여백 */
        padding-bottom: 80px !important;  /* ✅ 카드 내부 여백 증가 */
    }
    
    .share-buttons {
        margin-bottom: 40px !important;
        gap: 16px !important;  /* ✅ 버튼 사이 간격 증가 */
    }
    
    .share-btn,
    .install-btn {
        padding: 18px 24px !important;
        padding-bottom: 24px !important;  /* ✅ 버튼 하단 여백 증가 */
    }
    
    /* Mobile video cards - smaller */
    .modal-video-grid .video-card {
        height: 65px !important;
        min-height: 65px !important;
        max-height: 65px !important;
    }
    
    .modal-video-grid .video-thumbnail-wrapper {
        width: 115px !important;
        height: 65px !important;
    }
    
    .modal-video-grid .video-title {
        font-size: 0.85rem !important;
    }
}

/* ====================================
 * Mobile Optimization - Prevent Horizontal Scroll
 * ==================================== */

@media (max-width: 768px) {
    /* Ensure no element exceeds viewport width */
    * {
        max-width: 100vw;
    }
    
    /* Prevent horizontal scroll on all containers */
    html, body {
        overflow-x: hidden !important;
        width: 100%;
        position: relative;
    }
    
    /* Fixed elements should not exceed viewport */
    .header,
    .tab-bar {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    /* ============================================
       모바일 동영상 & Shorts 최적화 (1줄 전체 화면)
       최신 CSS 기술 적용: aspect-ratio, clamp(), env()
       ============================================ */
    
    /* 1열 그리드 - 전체 화면 꽉 차게 */
    .feed-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;  /* 1열 */
        gap: 0 !important;  /* 간격 제거 */
        padding: 0 !important;  /* padding 제거 */
        margin: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    /* 모든 카드를 전체 너비로 */
    .content-card[data-size="large"],
    .content-card[data-size="small"] {
        grid-column: span 1 !important;
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0 !important;
        border-radius: 0 !important;  /* 모서리 제거 */
        box-shadow: none !important;
        border-bottom: 1px solid var(--border-color) !important;
    }
    
    /* 썸네일 최적 비율 - 최신 aspect-ratio 사용 */
    .card-thumbnail {
        position: relative;
        width: 100% !important;
        padding-top: 0 !important;  /* padding-top 해제 */
        aspect-ratio: 16 / 9 !important;  /* 최신 CSS aspect-ratio 사용 */
        overflow: hidden;
        background: #000;
    }
    
    /* 썸네일 이미지 최적화 */
    .card-thumbnail img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
    }
    
    /* 카드 내부 - clamp()로 반응형 padding */
    .card-info {
        padding: clamp(12px, 3vw, 16px) !important;
        background: white;
    }
    
    /* 제목 - clamp()로 반응형 크기 */
    .card-title {
        font-size: clamp(0.95rem, 2.5vw, 1.1rem) !important;
        line-height: 1.4 !important;
        font-weight: 600 !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        display: -webkit-box;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: clamp(8px, 2vw, 12px) !important;
        color: var(--text-primary) !important;
    }
    
    /* 키워드 최적화 */
    .card-keywords {
        display: flex;
        flex-wrap: wrap;
        gap: clamp(4px, 1vw, 6px) !important;
        margin-bottom: clamp(6px, 1.5vw, 8px) !important;
        min-height: auto !important;
    }
    
    .keyword-tag {
        font-size: clamp(0.75rem, 2vw, 0.85rem) !important;
        color: var(--text-secondary) !important;
    }
    
    /* 배지 최적화 */
    .card-badges {
        display: flex;
        flex-wrap: wrap;
        gap: clamp(6px, 1.5vw, 8px) !important;
        margin-bottom: clamp(8px, 2vw, 10px) !important;
    }
    
    .card-category-badge-text,
    .card-featured-badge-text {
        font-size: clamp(0.7rem, 1.8vw, 0.8rem) !important;
        padding: clamp(3px, 0.8vw, 5px) clamp(8px, 2vw, 12px) !important;
        border-radius: 12px !important;
        font-weight: 600 !important;
    }
    
    /* 추천 이유 표시 (간결하게) */
    .card-recommendation {
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: clamp(0.8rem, 2vw, 0.9rem) !important;
        line-height: 1.4 !important;
        color: var(--text-secondary) !important;
        margin-bottom: 0 !important;
    }
    
    /* 북마크 버튼 */
    .bookmark-btn {
        width: clamp(36px, 9vw, 44px) !important;
        height: clamp(36px, 9vw, 44px) !important;
        bottom: clamp(12px, 3vw, 16px) !important;
        right: clamp(12px, 3vw, 16px) !important;
        font-size: clamp(1rem, 2.5vw, 1.2rem) !important;
        border-radius: 50% !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    }
    
    /* 카드 hover 효과 제거 */
    .content-card:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    .content-card:active {
        opacity: 0.9 !important;
    }
    
    /* Safe Area Insets 적용 (iPhone 노치 대응) */
    .feed-section {
        padding-left: env(safe-area-inset-left, 0) !important;
        padding-right: env(safe-area-inset-right, 0) !important;
    }
    
    /* ============================================
       END 모바일 동영상 최적화
       ============================================ */
    
    /* 모바일 - 동영상 모서리 제거 */
    .modal.active .modal-player-wrapper,
    .modal.active .modal-player-wrapper *,
    .modal.active .modal-thumbnail-wrapper,
    .modal.active .youtube-preview {
        border-radius: 0 !important;
    }
    
    /* 모바일 - 콘텐츠 하단 공간 추가 확보 */
    .modal.active .modal-left-content {
        padding-bottom: calc(var(--tab-bar-height) + 40px) !important;
    }
    
    /* 공유 탭 - 모바일 최적화 */
    #shareTab {
        position: fixed !important;
        top: var(--header-height) !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: var(--bg-primary) !important;
        z-index: 100 !important;
    }
    
    body {
        background: var(--bg-primary) !important;  /* ✅ body 배경 강제 */
    }
    
    .main-content {
        padding-bottom: calc(var(--tab-bar-height) + 40px) !important;  /* ✅ 105px */
        background: var(--bg-primary) !important;  /* ✅ 배경색 강제 */
    }
    
    .tab-content {
        min-height: 100vh !important;  /* ✅ 전체 화면 높이 */
        background: var(--bg-primary) !important;  /* ✅ 배경색 강제 */
    }
    
    .share-container {
        padding: 15px !important;
        padding-bottom: 450px !important;  /* ✅ 450px - 매우 매우 큰 여백 */
        min-height: 100vh !important;
        background: var(--bg-primary) !important;  /* ✅ 배경색 강제 */
    }
    
    .share-card {
        padding: 30px 20px !important;
        padding-bottom: 100px !important;  /* ✅ 카드 내부 매우 큰 여백 */
        margin-bottom: 150px !important;  /* ✅ 카드 아래 매우 큰 여백 */
    }
    
    .share-buttons {
        margin-bottom: 80px !important;  /* ✅ 매우 큰 여백 */
        gap: 18px !important;  /* ✅ 버튼 사이 간격 증가 */
    }
    
    .share-btn,
    .install-btn {
        margin-bottom: 16px !important;  /* ✅ 각 버튼 아래 여백 */
        padding: 20px 24px !important;  /* ✅ 버튼 크기 증가 */
        padding-bottom: 28px !important;  /* ✅ 버튼 하단 여백 대폭 증가 */
    }
    
    .tab-bar {
        background: white !important;  /* ✅ 탭바 흰색 강제 */
        z-index: 9999 !important;  /* ✅ 최상위 */
    }
    
    /* Content areas */
    .tab-content,
    .feed-grid,
    .info-feed {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    /* Cards should fit within grid */
    .content-card,
    .info-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
    
    /* Images should not exceed container */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Prevent text overflow */
    .card-title,
    .card-description,
    .info-card-title {
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
    }
}

/* ====================================
 * PWA Update Notification (v3.7.99 - 완벽한 중앙 정렬)
 * ==================================== */

.update-notification {
    position: fixed;
    bottom: 80px; /* 탭 바 위에 고정 */
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 10000; /* 더 높은 z-index */
    width: 90%;
    max-width: 500px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #5FA3FF 100%);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(74, 144, 226, 0.4);
    padding: 20px;
    animation: slideUpCenter 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    display: none; /* 기본적으로 숨김 */
    margin: 0 !important; /* 외부 마진 제거 */
}

/* 중앙 정렬 애니메이션 (수정) */
@keyframes slideUpCenter {
    0% {
        transform: translateX(-50%) translateY(200px);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* 표시 상태 강제 */
.update-notification.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* PC 반응형 */
@media (min-width: 769px) {
    .update-notification {
        bottom: 40px; /* PC에서는 하단 40px */
        width: 80%;
        max-width: 600px;
        padding: 24px;
    }
}

/* 태블릿 */
@media (min-width: 481px) and (max-width: 768px) {
    .update-notification {
        bottom: 60px;
        width: 85%;
        max-width: 550px;
    }
}

/* 모바일 */
@media (max-width: 480px) {
    .update-notification {
        bottom: 80px; /* 탭 바(65px) + 여백 */
        width: calc(100% - 32px); /* 좌우 16px 여백 */
        max-width: none;
        padding: 16px;
        border-radius: 12px;
    }
}

.update-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    text-align: center;
    width: 100%; /* 전체 너비 사용 */
    justify-content: center; /* 수직 중앙 정렬 */
}

.update-actions {
    display: flex;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
}

.update-actions button {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.update-btn-primary {
    background: #fff !important;
    color: var(--primary-color) !important;
}

.update-btn-primary:hover {
    background: rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.update-btn-primary:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

.update-btn-secondary {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    display: none; /* 기본적으로 숨김 */
}

.update-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

/* 업데이트 텍스트 스타일 */
.update-text h4 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.update-text p {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
}

/* 업데이트 아이콘 */
.update-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    animation: rotateIcon 2s linear infinite;
}

@keyframes rotateIcon {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 모바일에서 버튼 세로 배치 */
@media (max-width: 400px) {
    .update-actions {
        flex-direction: column;
    }
    
    .update-actions button {
        width: 100%;
        min-width: auto;
    }
}

.update-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: rotate 2s linear infinite;
}

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

/* 🎯 NEW: Fade out animation for mute/unmute indicators */
@keyframes fadeOut {
    0%, 70% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.update-icon i {
    font-size: 24px;
    color: #fff;
}

.update-text h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 5px 0;
}

.update-text p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* ============================================
   Shorts Grid Layout - PC: 4개, Mobile: 1개 전체화면
   ============================================ */

/* Shorts Grid View Container */
.shorts-grid-view {
    padding: 0;
    padding-top: 20px;
    max-width: 100%;
    margin: 0 auto;
}

/* Shorts Grid */
.shorts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);  /* PC: 3개 (더 큰 크기) */
    gap: 20px;
    padding: 0 16px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
}

/* Shorts Grid Item */
.shorts-grid-item {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    /* 9:16 세로 비율 (Shorts 비율) */
    aspect-ratio: 9 / 16;
    min-height: 400px;  /* 최소 높이 설정 */
    max-height: 600px;  /* 최대 높이 제한 */
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.shorts-grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.shorts-grid-item:active {
    transform: scale(0.98);
}

/* Shorts Grid Item Image */
.shorts-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 🎯 NEW: Shorts Grid Item iframe (for autoplay) */
.shorts-grid-item-iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    z-index: 10 !important;
    background: #000 !important;
}

/* Play Overlay - 재생 버튼 삼각형 */
.shorts-grid-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 15px 0 15px 25px;
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.95);
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.shorts-grid-item::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.shorts-grid-item:hover::before,
.shorts-grid-item:hover::after {
    opacity: 1;
}

/* ============================================
   반응형: 화면 크기별 최적화
   ============================================ */

/* 중형 PC (1200px~1599px): 3개 */
@media (max-width: 1599px) and (min-width: 1200px) {
    .shorts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    
    .shorts-grid-item {
        min-height: 350px;
        max-height: 500px;
    }
}

/* 태블릿 (768px~1199px): 2개 */
@media (max-width: 1199px) and (min-width: 768px) {
    .shorts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .shorts-grid-item {
        min-height: 400px;
        max-height: 550px;
    }
}

/* 모바일 (≤767px): 1개 전체 화면 - 최신 CSS 기술 적용 */
@media (max-width: 767px) {
    .shorts-grid-view {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    .shorts-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;  /* 1열 */
        gap: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    .shorts-grid-item {
        position: relative;
        width: 100% !important;
        max-width: 100vw !important;
        border-radius: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border-bottom: 1px solid #333 !important;
        
        /* 전체 화면 높이 - 헤더 - 탭바 (최신 CSS calc + env) */
        height: calc(100vh - var(--header-height) - var(--tab-bar-height) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
        min-height: calc(100vh - var(--header-height) - var(--tab-bar-height)) !important;
        max-height: calc(100vh - var(--header-height) - var(--tab-bar-height)) !important;
        
        aspect-ratio: auto !important;
        overflow: hidden;
    }
    
    /* Shorts 이미지 최적화 */
    .shorts-grid-item img {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;  /* contain으로 전체 보이기 */
        object-position: center !important;
        background: #000;
    }
    
    /* Hover 효과 제거 */
    .shorts-grid-item:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    .shorts-grid-item:active {
        opacity: 0.95 !important;
    }
    
    /* 재생 버튼 최적화 - clamp() 사용 */
    .shorts-grid-item::before {
        width: 0;
        height: 0;
        border-style: solid;
        border-width: clamp(18px, 4vw, 24px) 0 clamp(18px, 4vw, 24px) clamp(30px, 6vw, 40px) !important;
        border-color: transparent transparent transparent rgba(255, 255, 255, 0.95) !important;
        z-index: 3;
    }
    
    .shorts-grid-item::after {
        width: clamp(80px, 18vw, 100px) !important;
        height: clamp(80px, 18vw, 100px) !important;
        background: rgba(0, 0, 0, 0.6) !important;
        border-radius: 50%;
        z-index: 2;
    }
    
    /* 모바일에서는 재생 버튼 항상 표시 */
    .shorts-grid-item::before,
    .shorts-grid-item::after {
        opacity: 1 !important;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        pointer-events: none;
    }
    
    /* Safe Area 적용 */
    .shorts-grid-view {
        padding-left: env(safe-area-inset-left, 0) !important;
        padding-right: env(safe-area-inset-right, 0) !important;
    }
}

.update-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.update-btn-primary,
.update-btn-secondary {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.update-btn-primary {
    background: #fff;
    color: var(--primary-color);
}

.update-btn-primary:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
}

.update-btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.update-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==============================================
   반응형 레이아웃: 동영상 크기 고정 전략
   ============================================== */

/* 1024px - 1279px: 동영상(900px) + 카테고리 (추천 영상 숨김) */
@media (min-width: 1024px) and (max-width: 1279px) {
    .modal.active .modal-center-column {
        display: none !important;
    }
    
    .category-overlay {
        display: block !important;
    }
    
    .modal.active {
        right: 280px !important;
    }
}

/* 1280px - 1599px: 동영상(900px) + 추천 영상 (카테고리 숨김) */
@media (min-width: 1280px) and (max-width: 1599px) {
    .modal.active .modal-center-column {
        flex: 1 !important;
        display: block !important;
    }
    
    .category-overlay {
        display: none !important;
    }
    
    .modal.active {
        right: 0 !important;
    }
    
    .main-content {
        padding-right: 0 !important;
    }
}

/* 1600px+: 동영상(900px) + 추천 영상 + 카테고리 (3컬럼) */
@media (min-width: 1600px) {
    .modal.active .modal-center-column {
        flex: 1 !important;
        display: block !important;
    }
    
    .category-overlay {
        display: block !important;
    }
    
    .modal.active {
        right: 280px !important;
    }
}

/* PC Layout */
@media (min-width: 1024px) {
    .update-notification {
        bottom: 30px;
        max-width: 450px;
    }
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .update-notification {
        width: 85%;
        padding: 18px;
        bottom: calc(var(--tab-bar-height) + 15px);
    }
    
    .update-text h4 {
        font-size: 1rem;
    }
    
    .update-text p {
        font-size: 0.85rem;
    }
    
    .update-btn-primary,
    .update-btn-secondary {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* ====================================
 * Coming Soon Section - Touch Tab
 * ==================================== */

.coming-soon-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height) - var(--tab-bar-height));
    padding: 40px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.coming-soon-container {
    text-align: center;
    max-width: 500px;
    padding: 60px 40px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.6s ease-out;
}

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

.coming-soon-icon {
    font-size: 5rem;
    color: var(--primary-color);
    margin-bottom: 30px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.coming-soon-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    line-height: 1.2;
}

.coming-soon-message {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 15px;
}

.coming-soon-submessage {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Mobile Optimization for Coming Soon */
@media (max-width: 768px) {
    .coming-soon-container {
        padding: 40px 30px;
        margin: 0 15px;
    }
    
    .coming-soon-icon {
        font-size: 4rem;
        margin-bottom: 25px;
    }
    
    .coming-soon-title {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .coming-soon-message {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    .coming-soon-submessage {
        font-size: 1rem;
    }
}

