:root {
    --bg-main: #f9f9f9;
    --bg-card: #ffffff;
    --bg-hover: #f2f2f2;
    --accent: #ff0000;
    --text-primary: #0f0f0f;
    --text-secondary: #606060;
    --text-muted: #909090;
    --border: #e5e5e5;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
}

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

body {
    font-family: var(--site-font, 'Inter', sans-serif);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 64px;
    display: flex;
    align-items: center;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #000;
    font-size: 20px;
    font-weight: 800;
    flex-shrink: 0;
}

.logo svg {
    width: 32px;
    height: 32px;
    fill: var(--accent);
}

.search-bar {
    flex: 1;
    max-width: 600px;
    display: flex;
    background: #f8f8f8;
    border: 1px solid var(--border);
    border-radius: 40px;
    margin: 0 40px;
    overflow: hidden;
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 15px;
    outline: none;
}

.search-bar button {
    background: #f0f0f0;
    border: none;
    border-left: 1px solid var(--border);
    padding: 0 20px;
    cursor: pointer;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 30px 0;
}

.video-card {
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease;
}

.thumbnail-box {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    background: #ddd;
    margin-bottom: 12px;
}

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

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.video-info {
    display: flex;
    gap: 12px;
}

.channel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: #eee;
}

.info-content { flex: 1; }

.video-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.channel-name {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.video-meta-small {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Watch Page */
.video-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    padding: 24px 0;
}

.player-area {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    margin-bottom: 20px;
}

.disclaimer-text {
    color: #888;
    font-size: 11px;
    text-align: center;
    margin: 8px auto 20px;
    font-weight: 400;
    max-width: 80%;
    line-height: 1.4;
    overflow-wrap: break-word;
}

.player-area iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.video-meta-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    gap: 15px;
}

.author-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.author-img-large {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.author-h2 { font-size: 16px; font-weight: 700; }
.sub-count { font-size: 12px; color: var(--text-secondary); }

.video-badges { display: flex; gap: 8px; }
.badge {
    background: #f2f2f2;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.video-h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

.unified-content {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 15px;
    overflow-wrap: break-word;
}

.comment-paragraph { margin-bottom: 10px; color: #333; text-align: left; overflow-wrap: break-word; }
.description-block { color: #111; margin-top: 20px; text-align: left; overflow-wrap: break-word; }
.hashtags-plain { margin-top: 20px; font-weight: 500; text-align: left; overflow-wrap: break-word; }
.hashtags-plain a { color: #065fd4; text-decoration: none; margin-right: 8px; }
.hashtags-plain a:hover { text-decoration: underline; }

/* Sidebar */
.sidebar h3 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 20px;
    padding-left: 4px;
}

.related-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
    padding: 4px;
    border-radius: 12px;
}

.related-item:hover {
    background: var(--bg-hover);
}

.related-thumb-box {
    position: relative;
    width: 160px;
    height: 90px; /* Explicit fixed height for 16:9 at 160px width */
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #eee;
}

.related-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.related-content h4 {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-content p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

@media (max-width: 1100px) {
    .video-layout { grid-template-columns: 1fr; }
    .search-bar { margin: 0 16px; }
}

@media (max-width: 768px) {
    .header-inner { gap: 8px; padding: 0 12px !important; }
    .logo span { display: none; }
    .search-bar { margin: 0; width: 100%; flex: 1; border-radius: 30px; }
    .search-bar input { padding: 8px 15px; font-size: 14px; width: 100%; }
    .search-bar button { padding: 0 15px; }
    .video-grid { grid-template-columns: 1fr; }
    
    /* Video Page Specific Mobile Tweaks */
    .video-layout { padding: 0; overflow-x: hidden; }
    .main-video-col { max-width: 100%; overflow-x: hidden; padding: 0; }
    
    /* The 'Breakout' Trick: Makes player full-width even inside a container */
    .player-area { 
        border-radius: 0; 
        width: 100vw;
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
        margin-bottom: 12px;
    }

    .video-meta-section, .video-h1, .unified-content {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    .video-meta-section { flex-direction: column; align-items: flex-start; }
    .video-badges { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .unified-content { padding-top: 20px; padding-bottom: 20px; max-width: 100%; border: none; border-radius: 0; }
    .video-h1 { font-size: 18px; line-height: 1.3; margin-top: 20px; }
    .sidebar { margin-top: 20px; padding: 0 16px; }
    .related-thumb-box { width: 120px; height: 68px; }
    
    /* Force all text elements to wrap */
    h1, h2, h3, h4, p, span { overflow-wrap: break-word; word-wrap: break-word; max-width: 100%; }
}

/* Homepage Redesign */
.home-layout {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 30px;
    padding: 30px 0;
}

.right-sidebar {
    height: fit-content;
}

/* List Mode Video Card */
.video-card.list-mode {
    display: flex;
    gap: 25px;
    background: #fff;
    padding: 24px;
    border-radius: 24px;
    border: 1px solid rgba(0,0,0,0.04);
    margin-bottom: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.video-card.list-mode:hover {
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    transform: translateY(-4px) scale(1.01);
    border-color: var(--accent);
}

.video-card.list-mode .thumbnail-box {
    width: 320px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.video-card.list-mode .video-info {
    flex: 1;
    flex-direction: column;
    gap: 5px;
}

.video-card.list-mode .video-title {
    font-size: 18px;
    margin-bottom: 8px;
}

.video-card.list-mode .video-description-snippet {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
}

.video-added-time {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    margin-top: 5px;
}

/* Center Banner Notification */
.banner-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    display: none;
    width: 90%;
    max-width: 600px;
}

.banner {
    background: linear-gradient(135deg, #1a1a1a, #333);
    color: #fff;
    padding: 30px 40px;
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    animation: bannerFadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bannerFadeIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.banner h2 { font-size: 24px; margin-bottom: 10px; color: var(--accent); }
.banner p { font-size: 16px; opacity: 0.9; }

.btn-refresh {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}

.btn-refresh:hover {
    background: #cc0000;
    transform: scale(1.05);
}

@media (max-width: 1300px) {
    .home-layout { 
        display: flex;
        flex-direction: column;
        gap: 30px;
    }
    .right-sidebar { 
        order: 2; 
        position: static;
        width: 100%;
    }
    .home-content {
        order: 1; 
        width: 100%;
    }
}

@media (max-width: 768px) {
    .container { padding: 0px !important; margin: 0px !important; max-width: 100%; overflow-x: hidden; }
    .video-card.list-mode { flex-direction: column; padding: 15px 0; border-radius: 0; border-left: none; border-right: none; box-shadow: none; margin-bottom: 0; border-bottom: 1px solid var(--border); }
    .video-card.list-mode .thumbnail-box { width: 100%; border-radius: 0; margin-bottom: 10px; }
    .video-card.list-mode .video-info { padding: 0 15px; }
    .home-layout { padding-top: 0; gap: 15px; }
    .right-sidebar { padding: 0 15px; }
    .section-header { padding-left: 15px; padding-right: 15px; margin-top: 20px !important; }
    .pagination { padding: 0 15px; flex-wrap: wrap; }
}

/* Smart Scrollbar */
.smart-scroll::-webkit-scrollbar {
    width: 6px;
}
.smart-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.smart-scroll::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 10px;
}
.smart-scroll::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}
