/* ==========================================================
   TVUCC — 영상 채널형 다크 UI
   16:9 와이드 카드 · 시안/바이올렛 시그널 · 랭크 배지
   ========================================================== */

:root {
    --bg:       #07090f;
    --bg-soft:  #0d111a;
    --surface:  #141a26;
    --surface2: #1c2433;
    --border:   #232c3d;
    --text:     #e9eef7;
    --muted:    #8b97ad;
    --accent:   #22d3ee;   /* 시안 — 시그널 컬러 */
    --accent2:  #a855f7;   /* 바이올렛 — 그라디언트 짝 */
    --hot:      #ff4d6d;
    --radius:   12px;
    --maxw:     1200px;
}

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

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ---------- 헤더 ---------- */
.site-header {
    position: sticky; top: 0; z-index: 60;
    background: rgba(7, 9, 15, .9);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.site-header .inner {
    max-width: var(--maxw); margin: 0 auto; padding: 0 16px;
    display: flex; align-items: center; gap: 12px;
    height: 58px;
}
.brand {
    display: flex; align-items: center; gap: 9px;
    font-weight: 800; font-size: 20px; letter-spacing: -.3px;
}
/* 브랜드 마크 — 방송 채널 느낌의 그라디언트 칩 */
.brand .mark {
    display: grid; place-items: center;
    width: 34px; height: 26px; border-radius: 7px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #06080d; font-size: 12px; font-weight: 900; letter-spacing: -.5px;
}
.brand .name { background: linear-gradient(90deg, #fff, #b9c6dc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.header-live {
    margin-left: auto;
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 700; color: var(--muted);
    padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px;
}
.header-live .dot {
    width: 6px; height: 6px; border-radius: 50%; background: var(--hot);
    animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }

/* ---------- 채널 탭 ---------- */
.channels {
    border-bottom: 1px solid var(--border);
    background: rgba(7, 9, 15, .9);
    backdrop-filter: blur(14px);
    position: sticky; top: 58px; z-index: 55;
}
.channels .inner {
    max-width: var(--maxw); margin: 0 auto; padding: 9px 16px;
    display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none;
}
.channels .inner::-webkit-scrollbar { display: none; }
.ch {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 5px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--muted);
    font-size: 13px; font-weight: 600;
    white-space: nowrap;
    transition: .16s;
}
.ch:hover { color: var(--text); border-color: #33405a; }
.ch.on {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-color: transparent;
    color: #06080d;
    font-weight: 800;
}
/* 채널 식별 점 — 이모지 대신 색으로 구분(폰트 의존 없음) */
.ch .ico {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--dot, var(--muted));
    flex: 0 0 auto;
}
.ch.on .ico { background: rgba(6, 8, 13, .5); }

/* ---------- 섹션 헤딩 ---------- */
.sec-head {
    display: flex; align-items: baseline; gap: 10px;
    margin: 22px 0 12px;
}
.sec-head h2 { font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.sec-head .bar {
    width: 3px; height: 16px; border-radius: 2px;
    background: linear-gradient(180deg, var(--accent), var(--accent2));
    align-self: center;
}
.sec-head .sub { font-size: 12px; color: var(--muted); margin-left: auto; }

/* ---------- 그리드 (16:9 와이드 카드) ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px 14px;
}
.card { cursor: pointer; position: relative; }
.card .shot {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
}
.card .shot img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .35s ease;
}
.card:hover .shot img { transform: scale(1.05); }

/* 포토는 세로 원본이 많아 상단 정렬해야 얼굴이 잘리지 않는다 */
.card.is-photo .shot img { object-position: top center; }

.card .meta { padding: 9px 2px 0; }
.card .tit {
    font-size: 13.5px; font-weight: 600; line-height: 1.38;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
/* 채널명이 길어도 한 줄로 잘리게 — flex면 text-overflow가 먹지 않아 block 유지 */
.card .sub {
    margin-top: 4px;
    font-size: 11.5px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .sub .sep { opacity: .45; margin: 0 4px; }

/* 썸네일 오버레이 배지 */
.badge-play {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,.45));
    opacity: 0; transition: opacity .2s;
}
.card:hover .badge-play { opacity: 1; }
.badge-play span {
    width: 46px; height: 46px; border-radius: 50%;
    background: rgba(7,9,15,.72); backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,.22);
    display: grid; place-items: center;
    font-size: 15px; color: #fff; padding-left: 3px;
}
.badge-hit {
    position: absolute; right: 7px; bottom: 7px;
    background: rgba(7,9,15,.82);
    padding: 2px 7px; border-radius: 5px;
    font-size: 11px; font-weight: 700; letter-spacing: -.2px;
}
.badge-shots {
    position: absolute; right: 7px; bottom: 7px;
    background: rgba(7,9,15,.82);
    padding: 2px 7px; border-radius: 5px;
    font-size: 11px; font-weight: 700;
}
.badge-rank {
    position: absolute; left: 7px; top: 7px;
    min-width: 24px; height: 24px; padding: 0 6px;
    display: grid; place-items: center;
    border-radius: 6px;
    font-size: 12px; font-weight: 900;
    background: rgba(7,9,15,.78);
    border: 1px solid var(--border);
}
.badge-rank.top { background: linear-gradient(135deg, var(--hot), var(--accent2)); border-color: transparent; color: #fff; }
.badge-cate {
    position: absolute; left: 7px; bottom: 7px;
    background: rgba(7,9,15,.78);
    padding: 2px 7px; border-radius: 5px;
    font-size: 10.5px; font-weight: 700; color: var(--accent);
}

/* ---------- 광고 ---------- */
.ad-badge {
    position: absolute; left: 7px; top: 7px; z-index: 2;
    background: rgba(7,9,15,.8);
    border: 1px solid rgba(255,255,255,.16);
    color: #cfd8e8;
    font-size: 9.5px; font-weight: 800; letter-spacing: .6px;
    padding: 2px 6px; border-radius: 4px;
}
.ad-banner {
    position: relative; display: block;
    margin: 16px 0;
    border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border);
}
.ad-banner img { width: 100%; }

/* 인피드 광고 셀 — 콘텐츠 카드와 같은 골격, 테두리로만 구분 */
.card.ad-cell .shot { border-color: rgba(34,211,238,.35); }
.card.ad-cell .shot img { object-fit: cover; object-position: top center; }
.card.ad-cell .tit { color: var(--accent); }

/* 하단 스티키 */
.ad-sticky {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: rgba(13,17,26,.97);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    transform: translateY(110%);
    transition: transform .32s cubic-bezier(.2,.8,.3,1);
}
.ad-sticky.show { transform: translateY(0); }
.ad-sticky .inner {
    max-width: var(--maxw); margin: 0 auto;
    padding: 9px 14px;
    display: flex; align-items: center; gap: 11px;
}
.ad-sticky .thumb {
    width: 42px; height: 42px; border-radius: 8px; overflow: hidden; flex: 0 0 auto;
    border: 1px solid var(--border);
}
.ad-sticky .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.ad-sticky .txt { min-width: 0; flex: 1; }
.ad-sticky .txt b { display: block; font-size: 13px; }
.ad-sticky .txt span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-sticky .go {
    flex: 0 0 auto;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #06080d; font-weight: 800; font-size: 13px;
    padding: 9px 15px; border-radius: 9px;
}
.ad-sticky .x {
    flex: 0 0 auto;
    background: none; border: none; color: var(--muted); font-size: 20px; line-height: 1; padding: 4px 2px;
}

/* 진입 팝업 */
.overlay {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(0,0,0,.82);
    display: none; align-items: center; justify-content: center; padding: 20px;
}
.overlay.show { display: flex; }
.popup-ad { position: relative; width: min(330px, 88vw); }
.popup-ad img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.popup-ad .acts {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 10px; font-size: 12.5px; color: #cfd8e8;
}
.popup-ad .acts label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.popup-ad .acts button { background: none; border: none; color: #cfd8e8; font-size: 13px; font-weight: 700; }

/* 데스크톱 사이드 레일 */
.ad-side { display: none; }
@media (min-width: 1480px) {
    .ad-side {
        display: block; position: fixed; z-index: 40;
        right: 20px; top: 50%; transform: translateY(-50%);
        width: 168px;
        border-radius: var(--radius); overflow: hidden;
        border: 1px solid var(--border);
        background: var(--surface);
    }
    .ad-side img { width: 100%; aspect-ratio: 9/16; object-fit: cover; object-position: top; }
    .ad-side .cta {
        display: block; padding: 9px 10px;
        font-size: 12px; font-weight: 800; text-align: center;
        background: linear-gradient(135deg, var(--accent), var(--accent2));
        color: #06080d;
    }
}

/* ---------- 뷰어 모달 ---------- */
.viewer {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(4,6,10,.97);
    display: none; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.viewer.show { display: block; }
.vclose {
    position: fixed; right: 14px; top: 12px; z-index: 110;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(28,36,51,.92); border: 1px solid var(--border);
    color: var(--text); font-size: 22px; line-height: 1;
}
.vbox { max-width: 900px; margin: 0 auto; padding: 62px 14px 70px; }
.vtitle { font-size: 16px; font-weight: 800; margin-bottom: 4px; line-height: 1.4; }
.vtitle small { display: block; margin-top: 5px; font-size: 12px; font-weight: 500; color: var(--muted); }
.vplayer {
    margin: 14px 0; border-radius: var(--radius); overflow: hidden;
    aspect-ratio: 16/9; background: #000; border: 1px solid var(--border);
}
.vplayer iframe { width: 100%; height: 100%; border: 0; }
.vimg { width: 100%; border-radius: var(--radius); margin: 10px 0; border: 1px solid var(--border); }

/* ---------- 로더 / 푸터 ---------- */
.loader { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 0 8px; min-height: 44px; }
#sentinel { height: 1px; }

.site-footer {
    margin-top: 34px; padding: 24px 16px 84px;
    border-top: 1px solid var(--border);
    text-align: center; color: var(--muted); font-size: 12px; line-height: 1.7;
}
.site-footer .disclosure {
    color: #6f7c93; font-size: 11.5px;
    margin-bottom: 8px;
}
.site-footer .foot-brand { color: var(--text); font-weight: 800; letter-spacing: -.2px; }

/* ---------- 모바일 ---------- */
@media (max-width: 640px) {
    .grid { grid-template-columns: repeat(2, 1fr); gap: 14px 10px; }
    .card .tit { font-size: 12.5px; }
    .site-header .inner { height: 52px; }
    .channels { top: 52px; }
    .brand { font-size: 18px; }
    .vbox { padding: 58px 10px 70px; }
}
@media (max-width: 380px) {
    .grid { grid-template-columns: 1fr; }
}
