        /* --- VARIABLES --- */
        :root {
            /* Default: Dark Mode */
            --bg-dark: #0f0f0f;
            --bg-secondary: #272727;
            --bg-element: #1f2633;
            --bg-hover: #3f3f3f;
            --text-main: #ffffff;
            --text-main2: #6c6c6c;
            --chip-main: #000000;
            --chip-text: #ffffff;
            --text-secondary: #aaaaaa;
            --accent: #ff006a; 
            --border: #303030;
            --header-h: 56px;
            --sidebar-w: 240px;
            --sidebar-w-collapsed: 69px;
            --tags-h: 48px;
            --card-min-width: 280px;
            --icon-main: #ffffff;
        }

        /* Light Mode */
        body.light-theme {
            --bg-dark: #ffffff;
            --bg-secondary: #f1f1f1;
            --bg-element: #ffffff;
            --bg-hover: #e5e5e5;
            --text-main: #0f0f0f;
            --text-main2:#7f7f7f;
            --chip-main: #a8a8a8;
            --chip-text: #000000;
            --text-secondary: #606060;
            --border: #e5e5e5;
            --icon-main: #0f0f0f;
        }

        * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Roboto', Arial, sans-serif; }
        
        body {
            background-color: var(--bg-dark);
            color: var(--text-main);
            overflow-x: hidden;
            font-size: 14px;
            transition: background-color 0.3s, color 0.3s;
        }
        
        ::-webkit-scrollbar { display: none; } 
        * { scrollbar-width: none; }

        header {
            position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
            background-color: var(--bg-dark); display: flex; align-items: center;
            justify-content: space-between; padding: 0 16px; z-index: 2000;
            border-bottom: 1px solid var(--border);
        }

        .start-section { display: flex; align-items: center; gap: 0px; }
        .menu-btn { 
            background: transparent; border: none; color: var(--icon-main); cursor: pointer; 
            padding: 8px; border-radius: 50%; display: flex; margin-right: 12px; 
        }
        .menu-btn:hover { background: var(--bg-hover); }
        .menu-icon { width: 24px; height: 24px; fill: var(--icon-main); }
        
        .logo { font-size: 1.3rem; font-weight: bold; letter-spacing: -1px; display: flex; align-items: center; cursor: pointer; user-select: none; }
        .logo span { color: var(--text-main); padding-top: 0.4em;}
        .logo-icon { margin-right: 4px; display: flex; align-items: center;}

        .center-section { flex: 1; max-width: 600px; display: flex; justify-content: center; position: relative; }
        .search-wrapper { display: flex; width: 100%; position: relative; }
        .search-box-container {
            display: flex; flex: 1; align-items: center; background: #121212;
            border: 1px solid var(--border); border-radius: 40px 0 0 40px;
            padding: 0 4px 0 16px; margin-left: 32px;
            body.light-theme & { background: #f1f1f1; border-color: #ccc; }
        }
        .search-box-container:focus-within { border-color: var(--accent); }
        .search-box { width: 100%; background: transparent; border: none; color: var(--text-main); padding: 8px 0; outline: none; font-size: 1rem; }
        .clear-btn { background: transparent; border: none; color: #888; cursor: pointer; padding: 8px; display: none; border-radius: 50%; }
        .clear-btn:hover { color: var(--text-main); }
        .search-btn {
            background: var(--bg-secondary); border: 1px solid var(--border); border-left: none;
            border-radius: 0 40px 40px 0; padding: 0 20px; cursor: pointer; display: flex; align-items: center;
        }
        .search-dropdown {
            position: absolute; top: 100%; left: 32px; right: 0; background: #212121;
            border-radius: 12px; margin-top: 4px; box-shadow: 0 4px 10px rgba(0,0,0,0.5);
            display: none; flex-direction: column; padding: 8px 0; z-index: 2000;
            body.light-theme & { background: #fff; border: 1px solid var(--border); }
        }
        .search-item { padding: 8px 16px; cursor: pointer; color: var(--text-main); font-weight: 500; }
        .search-item:hover { background: var(--bg-hover); }
        
        .end-section { min-width: 80px; position: relative; display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
        
        /* Theme Toggle Button */
        .theme-btn {
            background: transparent; border: none; cursor: pointer;
            color: var(--icon-main); padding: 8px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 1.2rem; transition: color 0.2s;
        }
        .theme-btn:hover { background: var(--bg-hover); max-width: 35px; width: 100%; }

        .profile-btn { 
            width: 32px; height: 32px; background: #555; border-radius: 50%; 
            cursor: pointer; overflow: hidden; border: none;
        }
        .profile-btn img { width: 100%; height: 100%; object-fit: cover; }

        .settings-menu {
            position: absolute; top: 45px; right: 0; width: 300px;
            background: var(--bg-secondary); border-radius: 12px; padding: 12px 0;
            box-shadow: 0 4px 12px rgba(0,0,0,0.5); display: none;
            flex-direction: column; z-index: 2001; border: 1px solid var(--border);
        }
        .settings-header { padding: 0 16px 12px 16px; border-bottom: 1px solid #3d3d3d; display: flex; gap: 12px; align-items: center; }
        .settings-avatar { width: 40px; height: 40px; background: #555; border-radius: 50%; overflow: hidden;}
        .settings-avatar img { width: 100%; height: 100%; object-fit: cover; }
        .settings-info div:first-child { font-weight: bold; }
        .settings-info div:last-child { color: var(--text-secondary); font-size: 0.9rem; }

        .settings-item {
            padding: 10px 16px; cursor: pointer; display: flex; align-items: center; gap: 16px;
            font-size: 0.95rem; color: var(--text-main); text-decoration: none;
        }
        .settings-item:hover { background: var(--bg-hover); }
        .settings-item i { width: 24px; text-align: center; color: #aaa; }
        
        .settings-control { padding: 10px 16px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid #3d3d3d; margin-top: 8px; }
        .slider-row { display: flex; align-items: center; justify-content: space-between; color: #aaa; font-size: 0.9rem;}
        input[type=range] { width: 100%; margin-top: 5px; accent-color: var(--accent); }

        .category-wrapper {
            position: fixed; top: var(--header-h); left: 0; right: 0; height: var(--tags-h);
            background: var(--bg-dark); z-index: 90; border-bottom: 1px solid var(--border);
            display: flex; align-items: center;
        }
        .category-bar {
            display: flex; align-items: center; padding: 0 24px; gap: 12px;
            overflow-x: auto; width: 100%; height: 100%; cursor: grab; user-select: none;
        }
        .category-bar:active { cursor: grabbing; }
        .chip {
            background: var(--bg-secondary); color: var(--text-main2); padding: 6px 12px;
            border-radius: 8px; font-size: 0.9rem; white-space: nowrap; cursor: pointer; border: none;
            font-weight: 500; transition: 0.2s; pointer-events: auto;
        }
        .chip:hover { background: var(--bg-hover); }
        .chip.active { background: var(--chip-main); color: var(--chip-text); }

        aside {
            position: fixed; top: var(--header-h); bottom: 0; left: 0; width: var(--sidebar-w);
            background: var(--bg-dark); overflow-y: auto; overflow-x: hidden; padding: 12px 0;
            transition: transform 0.2s ease, width 0.2s ease; z-index: 100; display: none;
        }
        #sidebar-backdrop {
            position: fixed; top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.5); z-index: 99; display: none;
        }
        
        .sidebar-header, .sidebar-item {
            display: flex; align-items: center; padding: 8px 24px; cursor: pointer; overflow: hidden;
        }
        .sidebar-header { margin-top: 12px; margin-bottom: 4px; cursor: default; }
        .sidebar-header-text { font-weight: bold; font-size: 1rem; color: var(--text-main); }
        .sidebar-header-icon, .sidebar-icon {
            width: 24px; height: 24px; margin-right: 20px; flex-shrink: 0;
            display: flex; align-items: center; justify-content: center;
        }
        .sidebar-header-icon svg { width: 20px; height: 20px; fill: var(--text-main); }
        .sidebar-item:hover { background: var(--bg-secondary); }
        .sidebar-icon { background: #333; border-radius: 50%; overflow: hidden; }
        .sidebar-icon img { width: 100%; height: 100%; object-fit: cover; }
        .sidebar-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.9rem; color: var(--text-secondary); }

        aside.collapsed { width: var(--sidebar-w-collapsed); }
        aside.collapsed .sidebar-header, aside.collapsed .sidebar-item { flex-direction: column; padding: 14px 0; gap: 4px; justify-content: center; }
        aside.collapsed .sidebar-header-icon, aside.collapsed .sidebar-icon { margin-right: 0; }
        aside.collapsed .sidebar-header-text, aside.collapsed .sidebar-text { display: none; }

        aside.overlay {
            display: block !important; width: var(--sidebar-w); transform: translateX(0);
            box-shadow: 4px 0 10px rgba(0,0,0,0.5);
        }

        .main-container {
            margin-top: calc(var(--header-h) + var(--tags-h));
            margin-left: 0; padding: 24px; min-height: 100vh;
        }

        #video-grid {
            display: grid; 
            grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
            gap: 16px; row-gap: 40px;
        }

        .video-card { cursor: pointer; display: flex; flex-direction: column; position: relative; }
        .thumb {
            width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 12px;
            overflow: hidden; margin-bottom: 12px; box-shadow: 0 0 0 1px #1c1c1c;
        }
        .thumb img { width: 100%; height: 100%; object-fit: contain; padding: 30px}

        .details { display: flex; gap: 12px; align-items: flex-start; padding-right: 0; position: relative; }
        .channel-icon { width: 36px; height: 36px; border-radius: 50%; background: #333; flex-shrink: 0; overflow: hidden;}
        .channel-icon img { width: 100%; height: 100%; object-fit: cover; }
        
        .meta { display: flex; flex-direction: column; flex: 1; min-width: 0; padding-right: 30px; }
        .title { font-weight: 600; font-size: 1rem; line-height: 1.4; margin-bottom: 4px; color: var(--text-main); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;}
        .c-name { color: var(--text-secondary); font-size: 0.85rem; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;}

        .card-menu-btn {
            background: transparent; border: none; cursor: pointer;
            width: 40px; height: 40px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            position: absolute; right: -10px; top: -10px; opacity: 1;
        }
        .card-menu-btn svg { fill: var(--icon-main); width: 24px; height: 24px; }
        .card-menu-btn:active { background: rgba(0,0,0,0.1); }
        body.light-theme .card-menu-btn:active { background: rgba(0,0,0,0.05); }

        /* Watch Page Header specific styles */
        .watch-header-row {
            display: flex; justify-content: space-between; align-items: flex-start;
            margin-bottom: 8px; position: relative;
        }
        .watch-title-text {
            font-size: 1.25rem; font-weight: bold; line-height: 1.3;
            padding-right: 40px; /* Space for button */
        }
        .watch-menu-btn {
            background: transparent; border: none; cursor: pointer;
            width: 36px; height: 36px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            position: absolute; right: 0; top: 0;
        }
        .watch-menu-btn:hover { background: rgba(0,0,0,0.1); }
        body.light-theme .watch-menu-btn:hover { background: rgba(0,0,0,0.05); }
        .watch-menu-btn svg { fill: var(--icon-main); width: 20px; height: 20px; }

        .context-menu {
            position: fixed; background: var(--bg-secondary); border-radius: 13px; padding: 8px 0; width: 200px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.8); display: none; z-index: 9999; 
            border: 1px solid var(--border);
        }
        .context-item { padding: 8px 16px; cursor: pointer; font-size: 0.9rem; display: flex; align-items: center; gap: 12px; color: var(--text-main); }
        .context-item:hover { background: var(--bg-hover); }

        #watch-view {
            display: none;
            position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0;
            flex-direction: row; overflow: hidden; background: var(--bg-dark);
        }

        .primary-col { flex: 1; overflow-y: auto; padding: 24px 24px 100px 24px; }
        .secondary-col { width: 400px; padding: 0; border-left: 1px solid transparent; display: flex; flex-direction: column; height: 100%; }
        .static-top-section { flex-shrink: 0; padding: 24px 24px 0 0; background: var(--bg-dark); }
        .ad-container { width: 100%; height: 120px; background-color: #1a1a1a; border: 1px dashed #333; display: flex; align-items: center; justify-content: center; color: #555; margin-bottom: 12px; border-radius: 8px; position: relative; }
        body.light-theme .ad-container { background-color: #f9f9f9; border-color: #ddd; }
        .ad-label { position: absolute; top: 0; right: 0; background: #eba800; color: #000; font-size: 10px; padding: 2px 6px; }
        .chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
        .scrolling-suggestions { flex: 1; overflow-y: auto; padding: 0 24px 100px 0; }
        .player-frame { width: 100%; aspect-ratio: 16/9; background: #000; position: relative; z-index: 10; }
        video { width: 100%; height: 100%; outline: none; }
        .video-meta-block { margin-top: 12px; border-bottom: 1px solid var(--border); padding-bottom: 16px; }
        .suggestion-item { display: flex; gap: 8px; margin-bottom: 8px; cursor: pointer; position: relative; padding-right: 30px; }
        .s-thumb { width: 168px; height: 94px; border-radius: 8px; background: #000; overflow: hidden; flex-shrink: 0; }
        .s-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 15px; }
        .s-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
        .s-title { font-size: 0.9rem; font-weight: 600; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;}
        .suggestion-item .card-menu-btn { right: -10px; top: 0; }
        
        .video-card {
            transition: transform 0.10s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.10s ease;
            border-radius: 12px;
            overflow: hidden;
        }
        .suggestion-item:hover,
        .video-card:hover {
            transform: scale(1.01);
            box-shadow: 0 10px 20px rgba(0,0,0,0.4);
            z-index: 2;
        }
        body.light-theme .suggestion-item:hover,
        body.light-theme .video-card:hover {
            box-shadow: 0 10px 20px rgba(0,0,0,0.15);
        }

        .video-card:hover .title {
            color: var(--accent);
        }

        /* COMMENTS */
        .comments-container { margin-top: 20px; border-top: 0px solid var(--border); padding-top: 20px; }
        .comments-header { font-size: 1.2rem; font-weight: bold; margin-bottom: 20px; }
        .comment-input-area { display: flex; gap: 16px; margin-bottom: 30px; }
        .user-avatar-small { width: 40px; height: 40px; border-radius: 50%; background: #333; overflow: hidden; flex-shrink: 0; }
        .user-avatar-small img { width: 100%; height: 100%; object-fit: cover; }
        .comment-box-wrapper { flex: 1; position: relative; }
        .comment-input {
            width: 100%; background: transparent; border: none; border-bottom: 1px solid var(--text-secondary);
            color: var(--text-main); padding: 8px 0; font-size: 0.95rem; outline: none;
        }
        .comment-input:focus { border-bottom-color: var(--text-main); }
        .comment-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; display: none; }
        .comment-input:focus + .comment-actions, .comment-box-wrapper:focus-within .comment-actions { display: flex; }
        .cmt-btn { padding: 8px 16px; border-radius: 18px; font-weight: bold; cursor: pointer; border: none; }
        .btn-cancel { background: transparent; color: var(--text-main); }
        .btn-submit { background: var(--bg-element); color: var(--text-secondary); pointer-events: none; }
        .btn-submit.active { background: var(--accent); color: #000; pointer-events: auto; }
        .comment-item { display: flex; gap: 16px; margin-bottom: 20px; }
        .comment-content { display: flex; flex-direction: column; gap: 4px; }
        .comment-author { font-size: 0.85rem; font-weight: bold; display: flex; gap: 8px; align-items: center; }
        .comment-time { color: var(--text-secondary); font-weight: normal; font-size: 0.75rem; }
        .comment-text { font-size: 0.9rem; line-height: 1.4; }
        

        /* Comment Menu Styles */
        .comment-actions-container { position: relative; margin-left: auto; }
        .comment-menu-btn { 
            color: var(--text-secondary); cursor: pointer; padding: 4px 8px; 
            border-radius: 50%; transition: 0.2s;
            font-size: large;
        }
        .comment-menu-btn:hover { background: var(--bg-hover); color: var(--text-main); }

        .comment-dropdown {
            position: absolute; right: 0; top: 25px;
            background: var(--bg-secondary); border: 1px solid var(--border);
            border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,0.5);
            display: none; z-index: 10; min-width: 100px;
        }
        .comment-dropdown-item {
            padding: 10px 17px; font-size: 0.85rem; color: var(--text-main); cursor: pointer;
            display: flex; align-items: center; gap: 8px;
        }
        .comment-dropdown-item:hover { background: var(--bg-hover); color: #ff4444; }

        /* MODAL STYLES */
        .modal-overlay {
            position: fixed; top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.8); z-index: 3000; display: none;
            align-items: center; justify-content: center; backdrop-filter: blur(5px);
        }
        .modal-box {
            background: var(--bg-secondary); width: 350px; padding: 30px;
            border-radius: 12px; border: 1px solid var(--border);
            display: flex; flex-direction: column; gap: 16px; position: relative;
        }
        .modal-close { position: absolute; top: 15px; right: 15px; cursor: pointer; color: var(--text-secondary); }
        .modal-title { font-size: 1.5rem; font-weight: bold; text-align: center; }
        .modal-input {
            background: #121212; border: 1px solid var(--border); color: var(--text-main); padding: 12px; border-radius: 4px; outline: none; font-size: 1rem;
        }
        .modal-btn {
            background: var(--accent); color: #000; border: none; padding: 12px; border-radius: 4px; font-weight: bold; cursor: pointer; transition: 0.2s;
        }
        .modal-btn:hover { opacity: 0.9; }
        .auth-switch { text-align: center; font-size: 0.9rem; color: var(--text-secondary); cursor: pointer; margin-top: 10px;}
        .auth-switch span { color: var(--accent); font-weight: bold; }
        .error-msg { color: #ff4444; font-size: 0.85rem; display: none; text-align: center; }

        /* TOAST STYLE */
        #toast {
            visibility: hidden; min-width: 250px; background-color: #333; color: #fff;
            text-align: center; border-radius: 4px; padding: 16px; position: fixed;
            z-index: 3001; left: 50%; bottom: 30px; transform: translateX(-50%);
            font-size: 17px; opacity: 0; transition: opacity 0.3s, bottom 0.3s;
        }
        body.light-theme #toast { background-color: #323232; }
        #toast.show { visibility: visible; opacity: 1; bottom: 50px; }

        /* LOGO ANIMATION*/
        .logo {
            position: relative;
            overflow: hidden;
            cursor: pointer;
            }

        .logo::after {
            content: "";
            position: absolute;
            width: 20px;
            height: 20px;
            background: rgba(255, 152, 0, 0.35);
            border-radius: 50%;
            transform: scale(0);
            opacity: 0;
            }

        .logo:active::after {
            animation: logoRipple 0.45s ease-out;
            }

            @keyframes logoRipple {
            0% {
                transform: scale(0);
                opacity: 0.6;
                left: 50%;
                top: 50%;
            }
            100% {
                transform: scale(6);
                opacity: 0;
                left: 50%;
                top: 50%;
            }
            }

        @media(min-width: 1024px) {
            aside { display: block; }
            .main-container { margin-left: var(--sidebar-w); }
            .category-wrapper { left: var(--sidebar-w); }
            body.s-collapsed aside { width: var(--sidebar-w-collapsed); }
            body.s-collapsed .main-container { margin-left: var(--sidebar-w-collapsed); }
            body.s-collapsed .category-wrapper { left: var(--sidebar-w-collapsed); }
        }

        @media(max-width: 1023px) {
            aside { display: none; }
            aside.overlay { display: block; }
            .main-container { margin-left: 0; padding: 16px; }
            .category-wrapper { left: 0; }
            #watch-view { flex-direction: column; overflow-y: auto; position: static; height: auto; display: none; }
            .primary-col { padding: 0; overflow: visible; height: auto; }
            .secondary-col { width: 100%; padding: 0 16px 50px 16px; overflow: visible; height: auto; display: block; }
            .static-top-section { padding: 16px 0 0 0; }
            .scrolling-suggestions { padding: 0; overflow: visible; }
            .player-frame { position: sticky; top: 56px; z-index: 10; }
        }

        @media(max-width: 720px) {
            .video-meta-block {margin-top: 62px;}
            aside { display: block; z-index: 99; }
            .main-container { margin-left: 0; }
            .category-wrapper { left: 0; }
            body.s-collapsed aside { display: none }
            body.s-collapsed .main-container { margin-left: 0; }
            body.s-collapsed .category-wrapper { left: 0; }
            .settings-menu {width: 250px}
            .menu-btn {margin-right: 2px;}
            .search-btn {padding: 0 10px;}
            .logo span {display: none}
            .logo {margin-top: -6px;}
            :root { --card-min-width: 150px; }
        }