:root {
  --bg: #0f0f0f;
  --bg-elevated: #1b1b1b;
  --border: #2f2f2f;
  --text: #f1f1f1;
  --text-muted: #aaaaaa;
  --accent: #e63946;
  --accent-hover: #ff4d5e;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Roboto, -apple-system, sans-serif;
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo { width: 32px; height: 32px; border-radius: 8px; }

.hero-banner {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 20px;
  display: block;
}

.channel-banner { max-height: 180px; margin-bottom: 0; }

.search-form {
  flex: 1;
  max-width: 600px;
  display: flex;
}

.search-form input {
  flex: 1;
  padding: 8px 14px;
  border-radius: 20px 0 0 20px;
  border: 1px solid var(--border);
  background: #121212;
  color: var(--text);
}

.search-form button {
  border-radius: 0 20px 20px 0;
  border: 1px solid var(--border);
  background: #222;
  color: var(--text);
  padding: 0 16px;
  cursor: pointer;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  white-space: nowrap;
}

.btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline.active { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-block { width: 100%; margin-top: 8px; }

.avatar, .avatar-small {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
}
.avatar { width: 36px; height: 36px; }
.avatar.large { width: 80px; height: 80px; font-size: 32px; }
.avatar-small { width: 28px; height: 28px; font-size: 13px; flex-shrink: 0; }

.content { padding: 20px 24px; max-width: 1400px; margin: 0 auto; }

.category-bar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin-bottom: 20px;
}

.chip {
  padding: 6px 14px;
  border-radius: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  white-space: nowrap;
  font-size: 13px;
}
.chip.active { background: var(--text); color: var(--bg); }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.video-card { display: block; }

.thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: #222;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb.small { width: 120px; aspect-ratio: 16/9; flex-shrink: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder { font-size: 32px; color: #555; }

.video-card-info {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  align-items: flex-start;
}

.video-title { font-weight: 600; font-size: 15px; line-height: 1.3; }
.video-title.small { font-size: 13px; }
.video-meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }

.auth-box {
  max-width: 400px;
  margin: 40px auto;
  background: var(--bg-elevated);
  padding: 30px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.auth-box.wide { max-width: 560px; }

.auth-box h1 { margin-top: 0; font-size: 22px; }

.auth-box label {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-box input, .auth-box textarea, .auth-box select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #121212;
  color: var(--text);
  font-family: inherit;
}

.error { color: var(--accent-hover); font-size: 14px; }
.success { color: #4ade80; font-size: 14px; }

.social-links { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.social-link {
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
  color: white;
}
.social-fb { background: #1877f2; }
.social-ig { background: linear-gradient(45deg, #f58529, #dd2a7b, #8134af, #515bd4); }
.social-yt { background: #ff0000; }
.social-tw { background: #9146ff; }

.watch-layout {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 30px;
}

.player {
  width: 100%;
  aspect-ratio: 16/9;
  background: black;
  border-radius: var(--radius);
}

.watch-title { font-size: 20px; margin: 14px 0 6px; }

.watch-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 14px;
}

.reactions { display: flex; gap: 8px; }

.channel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.channel-name { font-weight: 600; margin-right: auto; }

.description { color: var(--text-muted); white-space: pre-wrap; margin: 14px 0; }

.comment-form { display: flex; gap: 10px; margin: 14px 0 20px; }
.comment-form input {
  flex: 1;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #121212;
  color: var(--text);
}

.comments { display: flex; flex-direction: column; gap: 16px; }
.comment { display: flex; gap: 10px; }
.comment p { margin: 4px 0 0; font-size: 14px; }

.related-card {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.channel-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 0 30px;
}
.channel-header h1 { margin: 0; }
.channel-header p { color: var(--text-muted); margin: 4px 0 0; }
.channel-header form { margin-left: auto; }

.btn-ghost.disabled {
  color: #666;
  cursor: not-allowed;
}

.text-muted { color: var(--text-muted); }
.text-muted.small { font-size: 12px; }

.table-wrap { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-table th, .admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.admin-table th { color: var(--text-muted); font-weight: 600; font-size: 13px; }

.user-cell { display: flex; align-items: center; gap: 10px; }

.actions-cell { display: flex; gap: 8px; flex-wrap: wrap; }
.actions-cell form { display: inline; }

.badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  background: #2a2a2a;
  color: var(--text-muted);
  white-space: nowrap;
}
.badge-admin { background: var(--accent); color: white; }
.badge-ok { background: #1e3d2f; color: #4ade80; }
.badge-off { background: #3d1e1e; color: #f87171; }

@media (max-width: 900px) {
  .watch-layout { grid-template-columns: 1fr; }
  .search-form { max-width: none; }
}

.segment-row {
  background: #171717;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.segment-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.segment-reorder { display: flex; gap: 4px; }
.segment-reorder button { padding: 4px 10px; font-size: 13px; }
.segment-reorder button:disabled { opacity: 0.3; cursor: not-allowed; }

.segment-actions { display: flex; gap: 8px; margin: 4px 0 12px; }
.segment-actions .btn { padding: 5px 10px; font-size: 12px; }
