*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --red:        #d10000;
    --red-dark:   #a80000;
    --red-hover:  #ff1a1a;
    --bg:         #111111;
    --bg2:        #1a1a1a;
    --bg3:        #242424;
    --border:     #2e2e2e;
    --text:       #e0e0e0;
    --text-muted: #888;
    --white:      #ffffff;
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--white); }
img { display: block; max-width: 100%; }

#header {
    background: #000;
    border-bottom: 3px solid var(--red);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.5px;
    white-space: nowrap;
}
.logo span.xv { color: var(--white); }
.logo span.red { color: var(--red); }

.search-form {
    flex: 1;
    max-width: 560px;
    display: flex;
    border: 2px solid var(--red);
    border-radius: 3px;
    overflow: hidden;
}
.search-form input {
    flex: 1;
    background: var(--bg3);
    border: none;
    color: var(--white);
    padding: 0 12px;
    font-size: 14px;
    outline: none;
    height: 36px;
}
.search-form input::placeholder { color: var(--text-muted); }
.search-form button {
    background: var(--red);
    border: none;
    color: #fff;
    padding: 0 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
.search-form button:hover { background: var(--red-hover); }

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.header-nav a {
    color: var(--text);
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 13px;
    white-space: nowrap;
    transition: background .15s;
}
.header-nav a:hover { background: var(--bg3); color: var(--white); }
.header-nav a.active { background: var(--red); color: #fff; }

#catbar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
#catbar::-webkit-scrollbar { display: none; }
.catbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    gap: 2px;
}
.catbar-inner a {
    color: var(--text-muted);
    font-size: 12px;
    padding: 8px 12px;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
}
.catbar-inner a:hover,
.catbar-inner a.active {
    color: var(--white);
    border-bottom-color: var(--red);
}

#main {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 20px 16px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    border-left: 4px solid var(--red);
    padding-left: 10px;
}
.section-head h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.section-head a {
    font-size: 12px;
    color: var(--red);
}
.section-head a:hover { color: var(--red-hover); text-decoration: underline; }

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 32px;
}

.video-card {
    background: var(--bg2);
    border-radius: 4px;
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
    cursor: pointer;
}
.video-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,.6);
}

.thumb-wrap {
    position: relative;
    padding-top: 56.25%;
    background: #000;
    background-repeat: repeat;
    background-size: auto 100%;
    background-position: center top;
    overflow: hidden;
}
.thumb-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity .2s;
}
.video-card:hover .thumb-wrap img { opacity: .85; }

.duration-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,.75);
    color: #fff;
    font-size: 11px;
    padding: 2px 5px;
    border-radius: 2px;
}

.hd-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 2px;
}

.video-info {
    padding: 8px 10px 10px;
}
.video-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}
.video-card:hover .video-title { color: var(--white); }
.video-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.cat-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
}
.cat-pill {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 3px;
    font-size: 12px;
    transition: background .15s, color .15s, border-color .15s;
}
.cat-pill:hover {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 20px 0 32px;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 13px;
    color: var(--text);
    transition: background .15s;
}
.pagination a:hover { background: var(--red); border-color: var(--red); color: #fff; }
.pagination span.current { background: var(--red); border-color: var(--red); color: #fff; }

#footer {
    background: #000;
    border-top: 2px solid var(--red);
    padding: 20px 16px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}
#footer a { color: var(--text-muted); margin: 0 8px; }
#footer a:hover { color: var(--red); }
.footer-logo { font-size: 18px; font-weight: 900; margin-bottom: 8px; }
.footer-logo span.red { color: var(--red); }

.skeleton {
    background: linear-gradient(90deg, var(--bg3) 25%, var(--bg2) 50%, var(--bg3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 3px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── SVG Icon Helpers ── */
.ico {
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: -3px;
    margin-right: 5px;
    flex-shrink: 0;
}
.search-form button .ico { margin-right: 0; width: 18px; height: 18px; }
.empty-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}
.empty-icon svg {
    width: 56px;
    height: 56px;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .header-nav { display: none; }
    .search-form { max-width: 100%; }
    .video-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
}
@media (max-width: 480px) {
    .video-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Skeleton Card ─────────────────────────────────────────── */
.video-card-skeleton {
    background: var(--bg2);
    border-radius: 4px;
    overflow: hidden;
    pointer-events: none;
}
.video-card-skeleton .sk-thumb {
    padding-top: 56.25%;
    background: linear-gradient(90deg, var(--bg3) 25%, #282828 50%, var(--bg3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
.video-card-skeleton .sk-line {
    background: linear-gradient(90deg, var(--bg3) 25%, #282828 50%, var(--bg3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 3px;
    margin: 8px 10px 4px;
    height: 13px;
}
.video-card-skeleton .sk-line.short { width: 55%; height: 11px; margin-bottom: 10px; }

/* ── Toast Notification ────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: #1a1a1a;
    border: 1px solid var(--border);
    border-left: 3px solid var(--red);
    color: var(--text);
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    box-shadow: 0 4px 16px rgba(0,0,0,.5);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity .25s, transform .25s;
    max-width: 280px;
}
.toast.show { opacity: 1; transform: translateX(0); }

/* ── Focus visible accessibility ───────────────────────────── */
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
