* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: #f1f5f9;
    color: #0f172a;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

.page-wrapper {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    background: #fff;
    min-height: 100vh;
}

/* HEADER */
.header {
    height: 82px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-wrap {
    display: flex;
    align-items: center;
}

.logo-image {
    height: 42px;
    width: auto;
    display: block;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 40px;
}

.nav-menu li {
    font-size: 15px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
}

/* 변경 전 (파란색) -> 변경 후 (빨간색) */
.nav-menu li.active {
    color: #ef4444; 
}
.nav-menu li:hover {
    color: #ef4444;
}

.header-icons {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-icons i {
    font-size: 18px;
    color: #334155;
    cursor: pointer;
}

/* MAIN LAYOUT */
.main-layout {
    display: grid;
    padding: 24px;
    gap: 18px 20px;
    align-items: start;
}

/* 데스크톱 레이아웃 */
@media (min-width: 961px) {
    .main-layout {
        grid-template-columns: minmax(640px, 2fr) minmax(320px, 1fr);
    }
    .live-area, .right-area {
        display: contents;
    }
    
    .live-top {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }
    .player-wrap {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }
    .product-section {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
    }
    
    .chat-wrap {
        grid-column: 2 / 3;
        grid-row: 1 / 3; 
        height: 0; 
        min-height: 100%; 
    }
    
    .side-banner {
        grid-column: 2 / 3;
        grid-row: 3 / 4; 
        height: 0; 
        min-height: 100%; 
    }
}

/* LIVE TOP */
.live-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 36px;
}

.live-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 900;
}

.live-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ef4444;
    animation: blink 1.2s infinite;
}

@keyframes blink {
    0% { opacity: 1 }
    50% { opacity: 0.3 }
    100% { opacity: 1 }
}

.viewer-box {
    background: #fee2e2;
    color: #dc2626;
    font-weight: 800;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
}

/* PLAYER */
.player-wrap {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 24px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    height: auto;
    box-shadow: 0 15px 40px rgba(0,0,0,0.12);
}

.player-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* CHAT */
.chat-wrap {
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #fff;
    width: 100%; /* 너비 100% 보장 */
}

.chat-header {
    padding: 18px 20px;
    background: #0f172a;
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-live {
    color: #f87171;
    font-size: 14px;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    min-height: 0; 
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 6px; 
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent; 
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15); 
    border-radius: 10px; 
}
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3); 
}

.msg {
    margin-bottom: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-all;
}

.msg strong {
    color: #2563eb;
    margin-right: 8px;
}

.msg.admin {
    background: #dbeafe;
    padding: 12px;
    border-radius: 12px;
}

.chat-input {
    padding: 16px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    height: 46px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    padding: 0 16px;
    outline: none;
}

.chat-input button {
    width: 70px;
    border: none;
    border-radius: 12px;
    background: #2563eb;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

/* SIDE BANNER */
.side-banner {
    width: 100%;
    border-radius: 24px;
    overflow: hidden;
    border: none; 
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
}

.side-banner a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative; /* 이미지를 포개기 위한 기준점 */
}

/* 롤링 배너 이미지 공통 속성 */
.side-banner img.banner-img {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    position: absolute; /* 두 이미지를 완벽히 겹치게 배치 */
    top: 0;
    left: 0;
    opacity: 0; /* 기본적으로는 투명하게 숨김 */
    transition: opacity 0.8s ease-in-out; /* 0.8초 동안 스르륵 바뀌는 디졸브 효과 */
}

/* 현재 보여야 할 이미지 */
.side-banner img.banner-img.active {
    opacity: 1; /* 투명도를 100%로 만들어서 보이게 함 */
    z-index: 1; /* 위로 올라오게 함 */
}

/* PRODUCTS */
.product-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 24px;
}

.product-title {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 20px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.product-card {
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    overflow: hidden;
    transition: 0.25s;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
    border-color: #2563eb;
}

.product-thumb {
    aspect-ratio: 1/1;
    background: #f8fafc;
    position: relative;
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.live-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ef4444;
    color: #fff;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    z-index: 5;
}

.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-info h4 {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 42px;
}

.product-code {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 6px;
}

.product-spec {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 10px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 20px;
    font-weight: 900;
    color: #ef4444;
    margin-top: auto; 
}

.buy-btn {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: #2563eb;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    margin-top: 14px;
}

/* VOD */
.vod-section {
    padding: 0 24px 40px;
}

.vod-title {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 20px;
}

.vod-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.vod-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    overflow: hidden;
    transition: 0.2s;
}

.vod-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}

.vod-thumb {
    aspect-ratio: 16/9;
    position: relative;
}

.vod-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vod-time {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
}

.vod-info {
    padding: 16px;
}

.vod-info h4 {
    font-size: 15px;
    margin-bottom: 8px;
}

.vod-info span {
    color: #64748b;
    font-size: 13px;
}

/* =========================================
   반응형 최적화 (태블릿)
========================================= */
@media(max-width:1200px){
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .vod-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* =========================================
   반응형 최적화 (모바일)
========================================= */
@media(max-width:960px){
    .header {
        height: 64px;
        padding: 0 16px;
    }
    .nav-menu {
        display: none;
    }
    
    .main-layout {
        display: flex;
        flex-direction: column;
        align-items: stretch; 
        gap: 20px;
        padding: 16px;
    }
    
    .live-area, .right-area {
        display: contents; 
    }
    
    .live-top { order: 1; }
    .player-wrap { order: 2; }
    .chat-wrap { 
        order: 3; 
        height: 350px; 
        min-height: 350px;
    }
    
    .side-banner { 
        order: 4; 
        height: auto;
    }
    .side-banner img {
        height: auto;
        max-height: 400px;
    }
    
    .product-section { 
        order: 5; 
        padding: 16px; 
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .vod-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 가장 작은 스마트폰 화면 */
@media(max-width:640px){
    .live-title {
        font-size: 18px;
    }
    .viewer-box {
        font-size: 12px;
        padding: 6px 12px;
    }
    .vod-title {
        font-size: 20px;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .product-info { padding: 12px; }
    .product-info h4 { font-size: 13px; height: 36px; }
    .product-code { font-size: 11px; margin-bottom: 4px; }
    .product-spec { font-size: 11px; margin-bottom: 8px; }
    .product-price { font-size: 16px; }
    .buy-btn { height: 36px; font-size: 13px; margin-top: 10px; }
    .live-badge { font-size: 10px; padding: 4px 8px; }
    
    .vod-grid {
        grid-template-columns: 1fr;
    }
}