:root {
    --bg: #0f1115;
    --bg-elev: #171a21;
    --card: #1b1f2a;
    --border: #262b38;
    --text: #e6e8ec;
    --muted: #9aa0ab;
    --accent: #2b6cff;
    --accent-hover: #1f5ae0;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
a:hover { color: inherit; }

/* Keyboard focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Skip-to-content link */
.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--accent); color: #fff; padding: .6rem 1rem;
    border-radius: 0 0 8px 0; z-index: 2000; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
    .video-card:hover { transform: none; }
}

/* Header */
.site-header {
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.site-header .inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.7rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.15rem; color: #fff; white-space: nowrap; }
.brand .logo { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; }
.brand .logo-fallback { width: 30px; height: 30px; border-radius: 6px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.brand .logo-fallback i { font-size: 1rem; }

.search-box { flex: 1; max-width: 520px; }
.search-box form { display: flex; }
.search-box input {
    flex: 1; background: var(--card); border: 1px solid var(--border); color: var(--text);
    border-radius: 8px 0 0 8px; padding: .5rem .8rem; outline: none; min-width: 0;
}
.search-box input:focus { border-color: var(--accent); }
.search-box button { background: var(--card); border: 1px solid var(--border); border-left: none; color: var(--muted); border-radius: 0 8px 8px 0; padding: 0 .9rem; }

.main-nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.main-nav a { padding: .4rem .75rem; border-radius: 8px; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.main-nav a:hover { background: var(--card); color: var(--text); }
.main-nav a.active { background: var(--card); color: #fff; }
.main-nav a.active:hover { color: #fff; }

/* Header responsiveness: search + nav wrap on small screens */
@media (max-width: 767px) {
    .site-header .inner { flex-wrap: wrap; row-gap: .6rem; }
    .search-box { order: 3; flex-basis: 100%; max-width: 100%; }
    .main-nav { order: 4; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .main-nav::-webkit-scrollbar { display: none; }
}

/* Layout */
.container-site { max-width: 1400px; margin: 0 auto; padding: 1.25rem 1rem; }

/* Ad slot */
.ad-slot { background: var(--card); border: 1px dashed var(--border); border-radius: 10px; padding: .9rem; text-align: center; color: var(--muted); margin: 0 0 1.25rem; }
.ad-slot a { display: inline-block; }
.ad-slot img { max-width: 100%; border-radius: 6px; }

/* Section headings */
.section-title { font-size: 1.15rem; font-weight: 700; margin: 1.5rem 0 1rem; display: flex; align-items: center; gap: .5rem; }
.section-title .bar { width: 4px; height: 1.1rem; background: var(--accent); border-radius: 2px; }

/* Video grid */
.video-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
@media (max-width: 1199px) { .video-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 991px) { .video-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 479px) { .video-grid { grid-template-columns: 1fr; } }

/* Video card */
.video-card { transition: transform .15s ease; }
.video-card:hover { transform: translateY(-3px); }
.video-thumb { position: relative; border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 16/9; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-thumb .placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--card); color: var(--muted); font-size: 2rem; }
.video-duration { position: absolute; right: .5rem; bottom: .5rem; background: rgba(0,0,0,.8); color: #fff; font-size: .75rem; padding: .1rem .4rem; border-radius: 4px; }
.video-featured { position: absolute; left: .5rem; top: .5rem; background: var(--accent); color: #fff; font-size: .68rem; padding: .1rem .45rem; border-radius: 4px; font-weight: 600; }
.video-card .title { font-weight: 600; font-size: .95rem; margin-top: .6rem; line-height: 1.35; color: #fff; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.video-card .meta { color: var(--muted); font-size: .8rem; margin-top: .25rem; }

/* Watch page */
.watch-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.5rem; align-items: start; }
@media (max-width: 991px) { .watch-grid { grid-template-columns: 1fr; } }
.player-wrap { border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 16/9; position: relative; }
.player-wrap video { width: 100%; height: 100%; display: block; }
.player-status {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: var(--muted); background: #000; gap: .5rem; font-size: .9rem;
}
.player-status.hidden { display: none; }
.player-status .spinner {
    width: 2rem; height: 2rem; border: 3px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.watch-title { font-size: 1.3rem; font-weight: 700; margin: 1rem 0 .4rem; color: #fff; }
.watch-meta { color: var(--muted); font-size: .85rem; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.watch-desc { margin-top: 1rem; background: var(--card); border-radius: 10px; padding: 1rem; white-space: pre-wrap; color: var(--text); font-size: .92rem; }
.watch-tags { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.watch-tags a { background: var(--card); border: 1px solid var(--border); color: var(--muted); border-radius: 20px; padding: .25rem .75rem; font-size: .8rem; }
.watch-tags a:hover { color: #fff; border-color: var(--accent); }

.related-item { display: flex; gap: .6rem; margin-bottom: .9rem; }
.related-item .thumb { width: 140px; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: #000; flex-shrink: 0; }
.related-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-item .t { font-size: .85rem; font-weight: 600; line-height: 1.3; color: #fff; }
.related-item .m { font-size: .75rem; color: var(--muted); margin-top: .2rem; }

/* Breadcrumb */
.breadcrumb-site { color: var(--muted); font-size: .82rem; margin-bottom: .75rem; }
.breadcrumb-site a { color: var(--muted); }
.breadcrumb-site a:hover { color: #fff; }
.breadcrumb-site span { color: var(--text); }

/* Pagination */
.pagination-site { display: flex; gap: .5rem; justify-content: center; margin-top: 2rem; }
.pagination-site a, .pagination-site span { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: .45rem .8rem; color: var(--muted); font-size: .85rem; }
.pagination-site span.current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; background: var(--bg-elev); }
.site-footer .inner { max-width: 1400px; margin: 0 auto; padding: 2rem 1rem; }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-bottom: 1rem; }
.site-footer .links a { color: var(--muted); font-size: .9rem; }
.site-footer .links a:hover { color: #fff; }
.site-footer .copyright { color: var(--muted); font-size: .8rem; }

/* Static pages */
.static-content { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.75rem; line-height: 1.7; }
.static-content h1, .static-content h2, .static-content h3 { color: #fff; }
.static-content a { color: var(--accent); }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 3rem; display: block; margin-bottom: .75rem; }

/* Player skin override */
video::-webkit-media-controls { --text-color: #fff; }

/* Forms (contact, advertise, ticket) */
.site-form .form-group { margin-bottom: 1rem; }
.site-form label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.site-form input, .site-form textarea, .site-form select {
    width: 100%; background: var(--card); border: 1px solid var(--border); color: var(--text);
    border-radius: 8px; padding: .6rem .8rem; font-size: .95rem; outline: none;
}
.site-form input:focus, .site-form textarea:focus, .site-form select:focus { border-color: var(--accent); }
.site-form .btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: .6rem 1.25rem; font-weight: 600; cursor: pointer; }
.site-form .btn:hover { background: var(--accent-hover); }
.form-alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.form-alert.success { background: #14321f; color: #7ee2a8; border: 1px solid #1f5a38; }
.form-alert.error { background: #3a1616; color: #f3a3a3; border: 1px solid #6b2828; }
.site-form .req { color: #ef4444; font-weight: 700; }
.site-form .form-note { color: var(--muted); font-size: .8rem; margin-bottom: 1rem; }

/* Ticket conversation */
.ticket-message { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: .9rem 1rem; margin-bottom: .75rem; }
.ticket-message.admin { border-left: 3px solid var(--accent); }
.ticket-message .author { font-weight: 600; font-size: .85rem; color: #fff; }
.ticket-message .when { color: var(--muted); font-size: .75rem; margin-bottom: .4rem; }
.ticket-message .body { white-space: pre-wrap; font-size: .92rem; }
