/* ==============================
   GLOBAL
================================= */
body.shorts-page {
    margin: 0;
    background: #111;
    color: #fff;
    font-family: 'Pretendard', system-ui, sans-serif;
}

body.shorts-page.light {
    background: #fff;
    color: #000;
}

.shorts-app {
    position: relative;
}

/* ==============================
   SPLASH
================================= */
.splash {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.splash-content {
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    color: #000;
}

.splash-content h2 {
    margin-bottom: 20px;
    font-size: 24px;
}

.splash-content p {
    margin-bottom: 30px;
    font-size: 16px;
}

.interest-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

.interest-btn {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: #fff;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.interest-btn.selected {
    background: #ff4d4d;
    color: #fff;
    border-color: #ff4d4d;
}

.start-btn {
    padding: 12px 30px;
    background: #ff4d4d;
    color: #fff;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.start-btn:hover {
    background: #e63946;
}

.mode-toggle-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    cursor: pointer;
    user-select: none;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    z-index: 20;
}
.featured-section {
    padding: 10px 20px;
}

.featured-section h5,
.tags-section h5,
.sort-section h5 {
    color: #fff;
}

.shorts-title {
    display: inline-block;
    padding: 10px 0;
    padding-left: 21px;
    font-weight: 600;
    font-size: 24px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255,255,255,0.8);
}

body.shorts-page.light .shorts-title {
    color: #000;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
}

.featured-slider {
    display: flex;
    gap: 10px;
    overflow-x: hidden;
    padding: 6px 0;
    cursor: grab;
}

.featured-slider.active {
    cursor: grabbing;
}

.featured-thumb {
    width: 140px;
    height: 240px;
    background-size: cover;
    background-position: center;
    border-radius: 10px;
    flex-shrink: 0;
    cursor: pointer;
}

/* ==============================
   TAG FILTER
================================= */
.tags-section {
    padding: 10px 20px;
}

.tag-list {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    max-height: 90px; /* 3 lines * ~30px */
    overflow-y: auto;
    padding: 6px 0;
    cursor: grab;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    -webkit-overflow-scrolling: touch; /* Momentum scrolling on iOS */
    gap: 5px;
}

.tag-list::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.tag-list.active {
    cursor: grabbing;
}

.tag-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 20px;
    background: #eee;
    border: 1px solid #ccc;
    cursor: pointer;
    color: #000;
    white-space: nowrap;
}

body.shorts-page.light .tag-btn {
    background: #222;
    border: 1px solid #333;
    color: #fff;
}

.tag-btn.active {
    border-color: #ff4d4d;
    color: #ff4d4d;
}

.clear-btn {
    margin-top: 6px;
    padding: 6px 10px;
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 8px;
    color: #000;
    cursor: pointer;
}

body.shorts-page.light .clear-btn {
    background: #222;
    border: 1px solid #333;
    color: #fff;
}

/* ==============================
   SORT SELECT
================================= */
.sort-section {
    padding: 0 20px 10px;
}

.sort-buttons {
    display: flex;
    gap: 10px;
}

.sort-btn {
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 20px;
    background: #eee;
    border: 1px solid #ccc;
    cursor: pointer;
    color: #000;
    white-space: nowrap;
}

body.shorts-page.light .sort-btn {
    background: #222;
    border: 1px solid #333;
    color: #fff;
}

.sort-btn.active {
    border-color: #ff4d4d;
    color: #ff4d4d;
}

/* ==============================
   GRID LIST
================================= */
.grid {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.thumb {
    position: relative;
    background-size: cover;
    background-position: center;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
}

/* 재생시간 */
.duration-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    padding: 3px 6px;
    font-size: 12px;
    background: rgba(0,0,0,0.65);
    border-radius: 3px;
}

/* 좋아요·댓글 메타 */
.meta-info {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    padding: 4px 6px;
    font-size: 12px;
    background: rgba(0,0,0,0.55);
    display: flex;
    gap: 10px;
}

/* ==============================
   POPUP PLAYER
================================= */
.popup-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow: hidden;
}

.popup {
    position: relative;
    width: 100vw;
    height: 95vh;
    max-width: none;
    padding-bottom: 80px;
}

#videoFrame {
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 10px;
    z-index: 1;
    pointer-events: none;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 78%;
    z-index: 2;
    cursor: pointer;
}

.toast {
    position: absolute;
    top: 140px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 16px;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.toast.show {
    opacity: 1;
    visibility: visible;
}

/* 이동 버튼 */
.nav-btn {
    position: static;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(52,152,219,0.8), rgba(41,128,185,0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    user-select: none;
    z-index: 1000;
    color: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    border: 2px solid rgba(255,255,255,0.2);
}

.nav-btn:hover {
    background: linear-gradient(135deg, rgba(72,172,239,0.9), rgba(61,148,205,1));
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

.nav-btn:hover {
    background: linear-gradient(135deg, rgba(120,170,255,0.4), rgba(70,120,255,0.6));
    transform: scale(1.1);
}

.prev-btn { left: 10px; }
.next-btn { right: 10px; }

.close-btn {
    position: static;
    font-size: 24px;
    cursor: pointer;
    user-select: none;
    z-index: 1000;
    background: linear-gradient(135deg, rgba(220,53,69,0.8), rgba(176,42,55,0.9));
    border-radius: 50%;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    border: 2px solid rgba(255,255,255,0.2);
    transform: scale(0.8);
}

.close-btn:hover {
    background: linear-gradient(135deg, rgba(240,73,89,0.9), rgba(196,62,75,1));
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

.mode-toggle-btn {
    position: absolute;
    top: 15px;
    /* right: 50px; */
    font-size: 10px;
    cursor: pointer;
    user-select: none;
    background: rgba(255,255,255,0.2);
    color: #fff;
    text-shadow: 0 0 5px rgba(255,255,255,0.8);
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    z-index: 20;
}

body.shorts-page.light .mode-toggle-btn {
    background: rgba(0,0,0,0.2);
    color: #000;
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
}

.popup-controls {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    align-items: center;
}

.volume-slider {
    width: 80px;
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
    cursor: pointer;
}

/* ==============================
   MOBILE
================================= */
@media (max-width: 600px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }

    .featured-thumb {
        width: 120px;
        height: 200px;
    }

    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 28px;
    }
}

/* Mobile: Hide fullscreen button and adjust popup padding */
@media (max-width: 768px) {
    .fullscreen-btn {
        display: none;
    }
    .popup {
        padding-bottom: 160px;
    }
    .volume-slider {
        display: none;
    }
}
