:root {
    --bg: #0b0e14;
    --card: #161b22;
    --text: #e6edf3;
    --accent: #2f81f7;
    --border: #30363d;
    --danger: #f85149;
    --success: #3fb950;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    margin: 0;
    overflow-x: hidden;
    font-size: 15px;
}

.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }

button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 24px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    transition: opacity 0.2s;
}
button:hover { opacity: 0.85; }
button.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
button.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
button.btn-danger:hover { background: rgba(248,81,73,0.1); opacity: 1; }

input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="search"], textarea, select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: #8b949e; }
input:disabled, textarea:disabled { opacity: 0.5; cursor: not-allowed; }
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--card); }

.field-wrap { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; color: #8b949e; }
.field-error { color: var(--danger); font-size: 13px; }
.field-success { color: var(--success); font-size: 13px; }
.field-hint { color: #8b949e; font-size: 12px; }

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 28px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 20px; }
.nav-logo-img { height: 34px; }
.nav-search { display: flex; gap: 8px; align-items: center; }
.nav-search input { width: 360px; border-radius: 24px; padding: 10px 18px; font-size: 15px; }
.nav-search button { background: transparent; border: none; padding: 8px; cursor: pointer; }
.nav-search button:hover { opacity: 0.7; }
.nav-search button img { width: 22px; height: 22px; filter: invert(0.6); display: block; }
.nav-right { display: flex; align-items: center; gap: 14px; }

.avatar-mini { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); cursor: pointer; }

.user-menu-wrap { position: relative; }
#user-btn { background: transparent; border: none; padding: 0; border-radius: 50%; }

.dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    min-width: 240px;
    overflow: hidden;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.dropdown-profile { display: flex; align-items: center; gap: 14px; padding: 18px; }
.dropdown-pfp { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); flex-shrink: 0; }
.dropdown-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dropdown-fullname { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown-sub { font-size: 13px; color: #8b949e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown-divider { height: 1px; background: var(--border); }
.dropdown a, .dropdown button.dropdown-item {
    display: block; padding: 12px 18px; color: var(--text); font-size: 14px;
    background: transparent; border: none; width: 100%; text-align: left; border-radius: 0; font-weight: 400;
}
.dropdown a:hover, .dropdown button.dropdown-item:hover { background: rgba(255,255,255,0.05); opacity: 1; }

.page-loader {
    position: fixed; top: 0; left: 0; right: 0; height: 3px;
    background: var(--accent); z-index: 9999;
    transition: width 0.4s ease, opacity 0.5s ease; width: 0%;
}
.page-loader.done { width: 100%; opacity: 0; }

.page-spinner { display: flex; justify-content: center; align-items: center; height: 60vh; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.content-tabs {
    display: flex;
    gap: 4px;
    padding: 16px 28px 0;
    border-bottom: 1px solid var(--border);
}
.content-tab-btn {
    background: none; border: none; border-bottom: 2px solid transparent;
    color: #8b949e; padding: 10px 18px; font-size: 15px; font-weight: 500;
    cursor: pointer; border-radius: 0; margin-bottom: -1px;
}
.content-tab-btn:hover { color: var(--text); opacity: 1; }
.content-tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    padding: 28px;
}

.video-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}
.video-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.video-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #1a1f27; }
.video-thumb-placeholder { width: 100%; aspect-ratio: 16/9; background: #1a1f27; display: flex; align-items: center; justify-content: center; color: #8b949e; font-size: 13px; }
.video-thumb-wrap { position: relative; }
.video-duration { position: absolute; bottom: 8px; right: 10px; background: rgba(0,0,0,0.85); color: white; font-size: 12px; font-weight: 700; padding: 3px 7px; border-radius: 5px; }
.video-info { padding: 14px; }
.video-title { font-size: 15px; font-weight: 600; margin: 0 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.video-meta { font-size: 13px; color: #8b949e; display: flex; align-items: center; gap: 8px; }
.channel-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.channel-avatar-small { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.video-channel { color: var(--accent); font-size: 13px; font-weight: 500; }

.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; padding: 28px; }
.post-card {
    background: var(--card); border: 1px solid var(--border); border-radius: 14px;
    overflow: hidden; cursor: pointer; transition: border-color 0.2s, transform 0.15s;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-image { width: 100%; max-height: 200px; object-fit: cover; display: block; }
.post-info { padding: 16px; }
.post-title { font-size: 16px; font-weight: 700; margin: 0 0 8px; line-height: 1.4; }
.post-excerpt { font-size: 14px; color: #c9d1d9; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 10px; }
.post-meta { font-size: 13px; color: #8b949e; display: flex; gap: 12px; }

.watch-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 28px;
    max-width: 1500px;
    margin: 0 auto;
    padding: 28px;
}

.video-player-wrap { background: #000; border-radius: 14px; overflow: hidden; position: relative; aspect-ratio: 16/9; }
video { width: 100%; height: 100%; display: block; }
video::-webkit-media-controls { display: none !important; }
video::-webkit-media-controls-enclosure { display: none !important; }

.player-controls {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 14px 18px 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    display: flex; flex-direction: column; gap: 10px;
    opacity: 0; transition: opacity 0.2s;
}
.video-player-wrap:hover .player-controls { opacity: 1; }

.player-timeline { width: 100%; height: 5px; background: rgba(255,255,255,0.25); border-radius: 3px; cursor: pointer; position: relative; }
.player-timeline-fill { height: 100%; background: var(--accent); border-radius: 3px; pointer-events: none; width: 0%; }
.player-bottom { display: flex; align-items: center; gap: 14px; }
.player-btn { background: none; border: none; padding: 0; cursor: pointer; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 0; }
.player-btn:hover { opacity: 0.8; }
.player-btn img { width: 22px; height: 22px; filter: invert(1); display: block; }
.player-time { font-size: 13px; color: white; white-space: nowrap; }
.player-volume { display: flex; align-items: center; gap: 8px; }
.player-volume input[type=range] { width: 80px; height: 4px; background: rgba(255,255,255,0.3); border: none; border-radius: 2px; padding: 0; cursor: pointer; accent-color: var(--accent); }
.player-speed { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.player-speed-btn { background: none; border: none; color: white; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 4px; padding: 0; border-radius: 0; font-weight: 600; }
.player-speed-btn img { width: 18px; height: 18px; filter: invert(1); }
.speed-menu { position: absolute; bottom: 56px; right: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; z-index: 10; }
.speed-menu button { display: block; width: 100%; text-align: center; padding: 9px 22px; background: none; border: none; color: var(--text); font-size: 14px; cursor: pointer; border-radius: 0; font-weight: 400; }
.speed-menu button:hover { background: rgba(255,255,255,0.07); opacity: 1; }
.speed-menu button.active { color: var(--accent); font-weight: 600; }

.video-details { margin-top: 18px; }
.video-details h1 { font-size: 22px; margin: 0 0 12px; line-height: 1.3; }
.video-details-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.video-stats { font-size: 14px; color: #8b949e; }
.video-actions { display: flex; gap: 10px; }
.action-btn {
    display: flex; align-items: center; gap: 8px; background: var(--card);
    border: 1px solid var(--border); color: var(--text); padding: 9px 18px;
    border-radius: 24px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.action-btn:hover { background: rgba(255,255,255,0.07); opacity: 1; }
.action-btn img { width: 18px; height: 18px; }
.action-btn.active { border-color: var(--accent); color: var(--accent); }

.channel-info-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.channel-info-left { display: flex; align-items: center; gap: 14px; }
.channel-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.channel-name { font-weight: 700; font-size: 16px; }
.channel-subs { font-size: 13px; color: #8b949e; margin-top: 2px; }

.video-description { font-size: 14px; line-height: 1.7; color: #c9d1d9; white-space: pre-wrap; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 22px; }

.comments-section h3 { margin: 0 0 18px; font-size: 17px; }
.comment-input-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 22px; }
.comment-input-row textarea { flex: 1; min-height: 64px; border-radius: 10px; }
.comment-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-body { flex: 1; }
.comment-author { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.comment-text { font-size: 14px; line-height: 1.6; color: #c9d1d9; }
.comment-actions { display: flex; gap: 14px; margin-top: 8px; }
.comment-action-btn { background: none; border: none; color: #8b949e; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 5px; padding: 0; border-radius: 0; font-weight: 400; }
.comment-action-btn:hover { color: var(--text); opacity: 1; }
.comment-action-btn img { width: 16px; height: 16px; }

.sidebar-videos h3 { font-size: 16px; margin: 0 0 16px; }
.sidebar-video { display: flex; gap: 12px; padding: 10px 0; cursor: pointer; border-bottom: 1px solid var(--border); }
.sidebar-video:hover .sidebar-title { color: var(--accent); }
.sidebar-thumb { width: 130px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #1a1f27; }
.sidebar-info { flex: 1; min-width: 0; }
.sidebar-title { font-size: 13px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 5px; }
.sidebar-meta { font-size: 12px; color: #8b949e; }

.studio-layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 61px); }
.studio-sidebar { border-right: 1px solid var(--border); padding: 24px 14px; display: flex; flex-direction: column; gap: 4px; }
.studio-nav-btn { display: flex; align-items: center; gap: 12px; background: none; border: none; color: var(--text); padding: 11px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; width: 100%; text-align: left; cursor: pointer; }
.studio-nav-btn:hover { background: rgba(255,255,255,0.05); opacity: 1; }
.studio-nav-btn.active { background: rgba(47,129,247,0.15); color: var(--accent); }
.studio-nav-btn img { width: 20px; height: 20px; }
.studio-content { padding: 36px; overflow-y: auto; }
.studio-panel { display: none; }
.studio-panel.active { display: block; }
.studio-panel h2 { margin: 0 0 28px; font-size: 22px; }

.upload-zone { border: 2px dashed var(--border); border-radius: 14px; padding: 56px 32px; text-align: center; cursor: pointer; transition: border-color 0.2s; margin-bottom: 28px; }
.upload-zone:hover { border-color: var(--accent); }
.upload-zone p { color: #8b949e; margin: 8px 0 0; font-size: 14px; }
.upload-form { display: flex; flex-direction: column; gap: 20px; max-width: 660px; }

.analytics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.analytics-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.analytics-card .label { font-size: 13px; color: #8b949e; margin-bottom: 8px; }
.analytics-card .value { font-size: 30px; font-weight: 700; }

.chart-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px; margin-bottom: 28px; }
.chart-wrap h3 { margin: 0 0 18px; font-size: 16px; }
canvas { width: 100% !important; }

.country-list { display: flex; flex-direction: column; gap: 10px; }
.country-row { display: flex; align-items: center; gap: 12px; }
.country-bar-wrap { flex: 1; background: var(--border); border-radius: 4px; height: 8px; }
.country-bar { background: var(--accent); height: 8px; border-radius: 4px; }
.country-label { font-size: 13px; min-width: 40px; color: #8b949e; }
.country-value { font-size: 13px; font-weight: 600; min-width: 48px; text-align: right; }

.video-manage-list { display: flex; flex-direction: column; gap: 14px; }
.video-manage-item { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; gap: 16px; align-items: center; }
.video-manage-thumb { width: 110px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #1a1f27; }
.video-manage-info { flex: 1; min-width: 0; }
.video-manage-title { font-weight: 600; font-size: 15px; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-manage-meta { font-size: 13px; color: #8b949e; }
.video-manage-actions { display: flex; gap: 10px; flex-shrink: 0; }

.channel-page-header { position: relative; margin-bottom: 22px; }
.channel-banner { width: 100%; height: 200px; object-fit: cover; background: var(--card); display: block; }
.channel-header-info { display: flex; align-items: flex-end; gap: 18px; padding: 0 28px; margin-top: -44px; margin-bottom: 18px; }
.channel-avatar-large { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 4px solid var(--bg); flex-shrink: 0; }
.channel-header-text { padding-bottom: 6px; }
.channel-header-name { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.channel-header-meta { font-size: 14px; color: #8b949e; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 28px; margin-bottom: 22px; }
.tab-btn { background: none; border: none; border-bottom: 2px solid transparent; color: #8b949e; padding: 12px 18px; font-size: 15px; font-weight: 500; cursor: pointer; border-radius: 0; margin-bottom: -1px; }
.tab-btn:hover { color: var(--text); opacity: 1; }
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }

.report-card { max-width: 540px; margin: 48px auto; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 40px; display: flex; flex-direction: column; gap: 20px; }
.report-card h2 { margin: 0; font-size: 22px; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 500; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 32px; width: 520px; max-width: 95vw; display: flex; flex-direction: column; gap: 18px; max-height: 90vh; overflow-y: auto; }
.modal-box h3 { margin: 0; font-size: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

.warning-banner { background: rgba(248,81,73,0.1); border: 1px solid rgba(248,81,73,0.3); border-radius: 10px; padding: 14px 18px; font-size: 14px; color: var(--danger); margin-bottom: 18px; }

.milestone-item { padding: 10px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }

@media (max-width: 1000px) {
    .watch-layout { grid-template-columns: 1fr; }
    .studio-layout { grid-template-columns: 1fr; }
    .studio-sidebar { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 10px; }
    .nav-search input { width: 200px; }
}