:root {
  --bg: #0f0f0f;
  --panel: #181818;
  --panel-2: #202020;
  --text: #f1f1f1;
  --muted: #aaa;
  --line: #303030;
  --brand: #ff2d2d;
  --chip: #272727;
  --radius: 8px;
  --topbar: 64px;
  font-family: Inter, Roboto, Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html { scrollbar-color: #555 #111; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body.sidebar-collapsed .sidebar { width: 74px; }
body.sidebar-collapsed .side-item span { display: none; }
body.sidebar-collapsed .shell { margin-left: 74px; }

button, input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #101010; }
::-webkit-scrollbar-thumb { background: #4b4b4b; border-radius: 999px; }

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar);
  z-index: 10;
  display: grid;
  grid-template-columns: 44px 190px minmax(220px, 690px) auto;
  gap: 14px;
  align-items: center;
  padding: 0 24px;
  background: rgba(15, 15, 15, .94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.brand img { width: 160px; height: 36px; display: block; }
.icon-btn, .search button, .admin-link, .pill-btn, .action-pills button {
  border: 0;
  color: var(--text);
  background: var(--panel-2);
  border-radius: 999px;
  min-height: 40px;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}
.icon-btn { width: 40px; font-size: 20px; }
.icon-btn:hover, .search button:hover, .admin-link:hover, .pill-btn:hover, .action-pills button:hover {
  background: #333;
  transform: translateY(-1px);
}

.search {
  display: grid;
  grid-template-columns: 1fr 58px;
  max-width: 690px;
  width: 100%;
}
.search input {
  min-width: 0;
  height: 42px;
  background: #121212;
  border: 1px solid #333;
  border-radius: 999px 0 0 999px;
  color: var(--text);
  padding: 0 18px;
  outline: none;
}
.search input:focus { border-color: #555; background: #0b0b0b; }
.search button { border-radius: 0 999px 999px 0; border: 1px solid #333; font-size: 22px; }
.admin-link { justify-self: end; padding: 10px 18px; font-weight: 700; }

.sidebar {
  position: fixed;
  top: var(--topbar);
  bottom: 0;
  left: 0;
  width: 236px;
  z-index: 9;
  padding: 14px 12px;
  overflow-y: auto;
  background: #0f0f0f;
  border-right: 1px solid rgba(255,255,255,.06);
  transition: width .22s ease;
}
.side-item {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  color: #f0f0f0;
  white-space: nowrap;
}
.side-item:hover, .side-item.active { background: #272727; }
.sidebar hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

.shell {
  margin-left: 236px;
  padding: calc(var(--topbar) + 18px) 26px 42px;
  transition: margin-left .22s ease;
}

.chips, .mini-chips {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding-bottom: 14px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.chips { max-width: 100%; }
.chip, .pill-btn {
  padding: 10px 15px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: var(--chip);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 700;
}
.chip.active, .pill-btn { background: var(--text); color: #0f0f0f; }

.hero-strip {
  min-height: 170px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  margin: 8px 0 28px;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255,45,45,.28), rgba(255,255,255,.04)),
    linear-gradient(135deg, #202020, #121212);
  border: 1px solid rgba(255,255,255,.08);
}
.hero-strip h1 { margin: 6px 0 0; max-width: 720px; font-size: clamp(24px, 4vw, 42px); line-height: 1.05; }
.eyebrow { color: #ffd0d0; text-transform: uppercase; font-weight: 800; font-size: 12px; }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 14px 0;
}
.section-head h2 { margin: 0; font-size: 22px; }
.section-head p { margin: 0; color: var(--muted); }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 28px 18px;
}
.video-card {
  min-width: 0;
  cursor: pointer;
  animation: rise .35s ease both;
}
.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #222;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s ease, filter .25s ease;
}
.video-card:hover .thumb img { transform: scale(1.045); filter: brightness(1.08); }
.duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,.82);
  font-size: 12px;
  font-weight: 800;
}
.meta {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  padding-top: 12px;
}
.avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff2d2d, #9733ee);
  color: white;
  font-weight: 900;
}
.video-title {
  margin: 0 0 7px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 800;
  line-height: 1.3;
}
.video-sub { color: var(--muted); font-size: 14px; line-height: 1.45; }

.shorts-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}
.short-card .thumb { aspect-ratio: 9 / 14; }

.loading-grid {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 18px;
}
.loading-grid.active { display: grid; }
.loading-grid span {
  height: 210px;
  border-radius: 12px;
  background: linear-gradient(90deg, #1c1c1c, #2b2b2b, #1c1c1c);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

.watch-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 28px;
}
.player-wrap {
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}
.player-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.watch-title {
  margin: 16px 0 12px;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.2;
}
.watch-actions {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.channel-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.channel-row span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.subscribe-btn {
  border: 0;
  padding: 11px 17px;
  border-radius: 999px;
  color: #0f0f0f;
  background: #f1f1f1;
  font-weight: 900;
  cursor: pointer;
}
.action-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.action-pills button { padding: 10px 16px; font-weight: 800; }
.description-box {
  padding: 16px;
  background: var(--panel-2);
  border-radius: 12px;
  color: #ddd;
  line-height: 1.55;
}
.recommend-panel { min-width: 0; }
.recommend-card {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 10px;
  margin-bottom: 12px;
  cursor: pointer;
}
.recommend-card .thumb { border-radius: 8px; }
.recommend-card h3 { margin: 0 0 6px; font-size: 14px; line-height: 1.3; }

.empty {
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}

@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 980px) {
  .topbar { grid-template-columns: 44px minmax(126px, 154px) minmax(0, 1fr); padding: 0 12px; }
  .brand img { width: 142px; }
  .admin-link { display: none; }
  .sidebar {
    transform: translateX(-100%);
    width: min(212px, 78vw);
    transition: transform .22s ease;
    box-shadow: 16px 0 30px rgba(0,0,0,.34);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-collapsed .sidebar { width: min(212px, 78vw); }
  body.sidebar-collapsed .side-item span { display: inline; }
  .public-mobile-hidden { display: none; }
  .shell, body.sidebar-collapsed .shell { margin-left: 0; padding-left: 14px; padding-right: 14px; }
  .watch-shell { grid-template-columns: 1fr; }
  .recommend-card { grid-template-columns: 150px 1fr; }
}

@media (max-width: 640px) {
  .topbar {
    height: 112px;
    grid-template-columns: 42px minmax(0, 1fr);
    align-content: center;
    gap: 10px;
  }
  .brand img { width: min(142px, 48vw); }
  .search { grid-column: 1 / -1; grid-row: 2; }
  .search { grid-template-columns: minmax(0, 1fr) 50px; }
  .search input { height: 40px; padding: 0 14px; }
  .search button { min-height: 40px; }
  .shell { padding-top: 130px; }
  .sidebar { top: 112px; }
  .hero-strip { align-items: start; flex-direction: column; }
  .video-grid,
  .loading-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .shorts-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meta { grid-template-columns: 36px minmax(0, 1fr); gap: 10px; }
  .avatar { width: 36px; height: 36px; font-size: 13px; }
  .watch-actions, .channel-row { align-items: flex-start; }
  .channel-row { flex-wrap: wrap; }
  .action-pills { width: 100%; }
  .action-pills button { flex: 1 1 auto; padding: 10px 12px; }
  .recommend-card { grid-template-columns: 132px 1fr; }
}

@media (max-width: 420px) {
  .shell { padding-left: 10px; padding-right: 10px; }
  .sidebar { width: min(196px, 82vw); padding-inline: 10px; }
  body.sidebar-collapsed .sidebar { width: min(196px, 82vw); }
  .side-item { min-height: 42px; padding: 0 12px; gap: 14px; }
  .chip { padding: 9px 12px; }
  .hero-strip { padding: 18px; }
  .shorts-row { gap: 12px; }
  .recommend-card { grid-template-columns: 116px minmax(0, 1fr); }
  .recommend-card h3 { font-size: 13px; }
}
