html * {
    box-sizing: border-box;
}

body {
    background-color: black;
    color: white;
    text-align: center;
    margin: 0;
    display: flex;
    font: 16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    background: var(--bg);
    color: var(--text);
}

.nwb h1 {
    margin-bottom: -5px;
}

.button {
    background-color: #555555;
    border: none;
    color: white;
    padding: 7.5px 16px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
}

:root {
    --bg: #0b0b0c;
    --card: #151517;
    --text: #eaeaea;
    --muted: #9aa0a6;
    --accent: #6aa3ff;
    --radius: 16px;
    --gap: 16px;
}

.wrap {
    max-width: 1200px;
    margin-inline: auto;
}

.video-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--gap);
    list-style: none;
    padding: 0;
    margin: 0;
    flex-direction: column;
}

.video-card {
    display: block;
    margin-bottom: 10px;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform .12s ease, box-shadow .12s ease;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 8px 24px rgba(0, 0, 0, .25);
}

.video-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 0 rgba(255, 255, 255, .04), 0 16px 36px rgba(0, 0, 0, .35);
}

.thumb {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #0f1115;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.35));
    opacity: .0;
    transition: opacity .15s ease;
}

.video-card:hover .thumb::after {
    opacity: 1;
}

.play {
    position: absolute;
    inset: auto auto 10px 10px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, .55);
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
    backdrop-filter: blur(6px);
}

.meta {
    padding: 12px 14px 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.title {
    font-weight: 650;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.info {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
    display: flex;
    gap: 10px;
    align-items: center;
    white-space: nowrap;
}

#search-bar {
    padding: 6px 10px;
    width: 40%;
    min-width: 250px;
    max-width: 600px;
    font-size: 16px;
    border: 1px solid #444;
    border-radius: 20px;
    background: #111;
    color: #fff;
}

.no-results {
    display: none;
    margin-top: 20px;
    font-size: 18px;
    color: white;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: #000;
    border-bottom: 1px solid #222;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 1000;
}

.left {
    flex: 0 0 auto;
    /* logo won’t stretch */
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
}

.center {
    flex: 1;
    /* take up all remaining space */
    display: flex;
    justify-content: center;
    /* center the input inside */
}

.center input {
    width: 40%;
    min-width: 250px;
    max-width: 600px;
    padding: 6px 10px;
    border: 1px solid #444;
    border-radius: 20px;
    background: #111;
    color: #fff;
}

.sidebar {
    width: 100px;
    background: #111;
    border-right: 1px solid #222;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    padding-top: 56px;
    /* leave space for topbar */
}

.sidebar a {
    padding: 12px 16px;
    text-decoration: none;
    color: #eee;
    font-weight: 500;
}

.sidebar a:hover {
    background: #222;
}

.main {
    margin-left: 200px;
    /* offset for sidebar */
    flex: 1;
}

.search-results {
    max-width: 1200px;
    margin: 80px auto 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

#no-results {
    display: none;
    grid-column: 1 / -1;
    text-align: center;
    font-size: 18px;
    color: white;
}

.video-page {
    display: flex;
    gap: 24px;
    margin-top: 70px;
    /* offset topbar */
}

.video-sidebar {
    flex: 1;
    max-width: 360px;
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.channel-pfp {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-top: -10px;
}

.channel-name {
    font-weight: bold;
    display: flex;
    align-items: center;
    margin-top: 5px;
}

.video-sidebar h2 {
    margin-bottom: 12px;
}

.video-card {
    display: flex;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.video-card img {
    width: 160px;
    height: 90px;
    object-fit: cover;
}

.upload-info {
    margin-top: -10px;
}

/* ---- Individual video page fixes (safe append) ---- */

/* Make sure the content area is below the fixed topbar (you already have this but re-enforce) */
.main .content {
    padding-top: 70px;
    /* keeps everything below the fixed topbar */
}

/* Layout: keep video + metadata on left, sidebar on right */
.video-main {
    float: left;
    /* keeps video block flush left */
    width: 960px;
    /* 50% of a 1920px source (adjust if needed) */
    max-width: 100%;
    box-sizing: border-box;
}

/* Video wrapper controls the player size; Video.js will fill it */
.video-wrapper {
    width: 100%;
}

/* Make Video.js respect wrapper width */
.video-wrapper .video-js {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
}

/* Keep metadata same width as video and left-aligned */
.video-meta {
    width: 100%;
    max-width: 960px;
    text-align: left;
    margin-top: 12px;
}

.video-meta .video-title {
    margin: 0 0 8px 0;
    /* tighten spacing under the title */
    font-size: 20px;
}

/* Sidebar sits to the right of the floated video */
.video-sidebar {
    margin-left: calc(960px + 24px);
    /* ensure gap of 24px from video */
    /* fallback if calc not ideal: you can set margin-left: 984px; */
}

/* Small screens: stack nicely (mobile) */
@media (max-width: 1100px) {
    .video-main {
        float: none;
        width: 100%;
    }

    .video-sidebar {
        margin-left: 0;
        max-width: 100%;
    }
}

/* Sidebar "More Videos" cards on video pages */
.sidebar-videos {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-card {
    display: flex;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .12s ease, box-shadow .12s ease;
}

.sidebar-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 8px 16px rgba(0, 0, 0, .2);
}

.sidebar-card img {
    width: 160px;
    height: 90px;
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-card .meta {
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sidebar-card .title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.search-dropdown {
    position: absolute;
    top: 48px;
    /* just below search input */
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    max-width: 600px;
    background: #111;
    border: 1px solid #444;
    border-radius: 6px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 10000;
    font-size: 16px;
}

.search-dropdown a {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: #fff;
    border-bottom: 1px solid #222;
}

.search-dropdown a:hover,
.search-dropdown a.active {
    background: #222;
}