*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f0f;
  --surface: #212121;
  --surface2: #272727;
  --border: #3f3f3f;
  --text: #f1f1f1;
  --text-muted: #aaaaaa;
  --red: #0077ff;
  --accent: #0077ff;
  --chip-bg: #272727;
  --chip-active: #f1f1f1;
  --chip-active-text: #0f0f0f;
  --header-h: 56px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  overflow-x: hidden;
}

/* ── HEADER ── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.header__left { display: flex; align-items: center; gap: 12px; }
.header__right { display: flex; align-items: center; gap: 8px; }

/* burger */
.burger {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px; padding: 4px;
}
.burger span {
  display: block; width: 20px; height: 2px;
  background: var(--text); border-radius: 2px;
}

/* logo */
.logo { display: flex; align-items: center; text-decoration: none; }
.logo__svg { width: 100px; height: 24px; color: var(--text); }

/* search */
.header__center { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 600px; margin: 0 16px; }
.search-bar { display: flex; flex: 1; }
.search-bar__input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 20px 0 0 20px;
  padding: 8px 16px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.search-bar__input:focus { border-color: #1c62b9; }
.search-bar__btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 20px 20px 0;
  padding: 0 16px;
  cursor: pointer;
  color: var(--text);
  display: flex; align-items: center;
}
.search-bar__btn svg { width: 18px; height: 18px; }
.search-bar__btn:hover { background: #3f3f3f; }

.mic-btn {
  background: var(--surface);
  border: none; border-radius: 50%;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text); flex-shrink: 0;
}
.mic-btn:hover { background: var(--surface2); }
.mic-btn svg { width: 20px; height: 20px; }

/* icon buttons */
.icon-btn {
  background: none; border: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text);
}
.icon-btn:hover { background: var(--surface); }
.icon-btn svg { width: 22px; height: 22px; }

/* avatar */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #065fd4;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  cursor: pointer; user-select: none;
}

/* ── LAYOUT ── */
.layout {
  display: flex;
  margin-top: var(--header-h);
}

/* ── SIDEBAR ── */
.sidebar {
  width: 240px;
  min-width: 240px;
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 12px 0;
  background: var(--bg);
  transition: transform .2s ease;
  z-index: 90;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar__nav { display: flex; flex-direction: column; }

.sidebar__link {
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px;
  text-decoration: none;
  color: var(--text);
  border-radius: 10px;
  margin: 1px 6px;
  transition: background .15s;
}
.sidebar__link:hover { background: var(--surface); }
.sidebar__link--active { background: var(--surface); }
.sidebar__link svg { width: 24px; height: 24px; flex-shrink: 0; }
.sidebar__link span { font-size: 14px; }

.sidebar__divider {
  height: 1px; background: var(--border);
  margin: 10px 16px;
}
.sidebar__section-title {
  padding: 8px 24px;
  font-size: 12px; font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
}

/* ── MAIN ── */
.main {
  margin-left: 240px;
  flex: 1;
  padding: 16px 24px 40px;
  min-width: 0;
}

/* ── CHIPS ── */
.chips {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  background: var(--chip-bg);
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s;
}
.chip:hover { background: #3f3f3f; }
.chip--active {
  background: var(--chip-active);
  color: var(--chip-active-text);
  font-weight: 500;
}

/* ── VIDEO GRID ── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px 16px;
}

/* ── VIDEO CARD ── */
.video-card { cursor: pointer; }

.video-card__thumb {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.video-card__thumb img {
  position: absolute;
  inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.video-card:hover .video-card__thumb img { transform: scale(1.04); }

.video-card__duration {
  position: absolute;
  bottom: 6px; right: 8px;
  background: rgba(0,0,0,.85);
  color: #fff;
  font-size: 12px; font-weight: 500;
  padding: 2px 5px;
  border-radius: 4px;
}

.video-card__info {
  display: flex;
  gap: 10px;
  padding: 10px 0 4px;
}

.video-card__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  color: #fff;
}

.video-card__meta { flex: 1; min-width: 0; }
.video-card__title {
  font-size: 14px; font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.video-card__channel {
  font-size: 13px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.video-card__stats {
  font-size: 13px; color: var(--text-muted);
  margin-top: 2px;
}

/* ── MODAL OVERLAY ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%; max-width: 800px;
  overflow: hidden;
  transform: scale(.95);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: scale(1); }

.modal__video {
  position: relative; padding-top: 56.25%;
  background: #000;
}
.modal__video iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: none;
}

.modal__body { padding: 16px 20px 20px; }
.modal__title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.modal__channel { font-size: 14px; color: var(--text-muted); margin-bottom: 10px; }
.modal__stats {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap;
}
.modal__close {
  position: absolute; top: 12px; right: 12px;
  background: rgba(0,0,0,.6); border: none;
  color: #fff; width: 36px; height: 36px;
  border-radius: 50%; font-size: 20px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  z-index: 5;
}
.modal__close:hover { background: rgba(255,255,255,.2); }

.btn-like, .btn-sub {
  border: none; border-radius: 20px;
  padding: 8px 18px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .15s;
}
.btn-like { background: var(--surface2); color: var(--text); }
.btn-like:hover { background: #3f3f3f; }
.btn-sub { background: var(--text); color: #0f0f0f; }
.btn-sub:hover { background: #d0d0d0; }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .sidebar { width: 72px; min-width: 72px; }
  .sidebar__link span,
  .sidebar__section-title { display: none; }
  .sidebar__link { padding: 12px; justify-content: center; gap: 0; }
  .main { margin-left: 72px; }
}

@media (max-width: 720px) {
  .sidebar { transform: translateX(-100%); width: 240px; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 12px 12px 40px; }
  .header__center { max-width: none; }
}

@media (max-width: 480px) {
  .mic-btn { display: none; }
  .icon-btn:not(:last-of-type) { display: none; }
  .logo__svg text { display: none; }
}
