:root {
  --bg: #0f0f0f;
  --bg-2: #181818;
  --bg-3: #222222;
  --text: #f1f1f1;
  --muted: #aaaaaa;
  --line: #2f2f2f;
  --chip: #272727;
  --danger: #ff0033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  display: grid;
  grid-template-columns: 210px minmax(280px, 1fr) 240px;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  background: rgba(15, 15, 15, 0.98);
}

.brand-wrap,
.actions,
.search-cluster {
  display: flex;
  align-items: center;
}

.brand-wrap {
  gap: 0.85rem;
}

.icon-btn,
.icon-circle,
.close {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.icon-btn:hover,
.icon-circle:hover,
.nav-link:hover,
.chip:hover,
.pill:hover {
  background: var(--bg-3);
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.logo-mark {
  width: 34px;
  height: 24px;
  border-radius: 8px;
  background: var(--danger);
  display: grid;
  place-items: center;
}

.logo-triangle {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid #fff;
  margin-left: 2px;
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 800;
}

.search-cluster {
  justify-content: center;
  gap: 0.8rem;
}

.search-wrap {
  width: min(680px, 100%);
  display: grid;
  grid-template-columns: 1fr 110px;
}

.search-wrap input {
  height: 40px;
  background: #121212;
  color: var(--text);
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 999px 0 0 999px;
  padding: 0 1rem;
}

.search-wrap button {
  height: 40px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0 999px 999px 0;
  cursor: pointer;
}

.icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-2);
}

.actions {
  justify-content: flex-end;
  gap: 0.6rem;
}

.pill {
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  height: 36px;
  border-radius: 999px;
  padding: 0 0.95rem;
  cursor: pointer;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.92rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ff9966, #ff5e62);
}

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 56px);
}

.sidebar {
  padding: 0.75rem;
  border-right: 1px solid #1f1f1f;
  overflow: auto;
}

.sidebar.compact {
  width: 88px;
}

.sidebar.compact h2,
.sidebar.compact .nav-link,
.sidebar.compact .sub-item span:last-child {
  font-size: 0;
}

.sidebar.compact .nav-link,
.sidebar.compact .sub-item {
  justify-content: center;
}

.nav-group,
.sub-list {
  display: grid;
  gap: 0.25rem;
}

.nav-link,
.sub-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 0;
  color: var(--text);
  background: transparent;
  border-radius: 10px;
  padding: 0.75rem 0.8rem;
  text-align: left;
  cursor: pointer;
}

.nav-link.active {
  background: var(--bg-3);
  font-weight: 700;
}

.divider {
  height: 1px;
  background: #232323;
  margin: 0.9rem 0;
}

.sidebar-section h2 {
  font-size: 1rem;
  margin: 0 0 0.65rem;
}

.sub-avatar,
.video-avatar,
.channel-avatar,
.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
}

.content {
  padding: 0 1.25rem 1.5rem;
}

.chips {
  position: sticky;
  top: 56px;
  z-index: 10;
  display: flex;
  gap: 0.55rem;
  overflow: auto;
  padding: 0.85rem 0 1rem;
  background: linear-gradient(180deg, rgba(15, 15, 15, 0.98), rgba(15, 15, 15, 0.92));
}

.chip {
  border: 0;
  background: var(--chip);
  color: var(--text);
  white-space: nowrap;
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}

.chip.active {
  background: #fff;
  color: #111;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.section-head h2,
.watch-side h3,
.comments-head h3 {
  margin: 0;
}

.section-head p,
.player-stats,
.description-meta,
.meta-line,
.comments-head span,
.watch-side p {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.shelf {
  margin-bottom: 1.75rem;
}

.shorts-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: 0.95rem;
}

.short-card {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid #2a2a2a;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: end;
  cursor: pointer;
}

.short-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 10%, rgba(0, 0, 0, 0.82) 100%);
}

.short-content {
  position: relative;
  z-index: 1;
}

.short-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
}

.short-meta {
  color: #dddddd;
  font-size: 0.85rem;
  margin-top: 0.45rem;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.4rem 1rem;
}

.card {
  background: transparent;
  border: 0;
  cursor: pointer;
}

.thumb-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
}

.thumb {
  aspect-ratio: 16 / 9;
  width: 100%;
}

.duration,
.live-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.duration {
  background: rgba(0, 0, 0, 0.82);
}

.live-badge {
  left: 10px;
  right: auto;
  background: #cc0000;
}

.card-body {
  display: grid;
  grid-template-columns: 40px 1fr 24px;
  gap: 0.75rem;
  padding-top: 0.8rem;
}

.video-avatar {
  width: 40px;
  height: 40px;
  font-size: 0.9rem;
}

.title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.35;
}

.meta-line {
  font-size: 0.88rem;
  margin-top: 0.25rem;
}

.more {
  color: var(--muted);
  font-weight: 800;
}

.player-modal {
  width: min(1320px, 96vw);
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid #303030;
  background: #181818;
  color: var(--text);
}

.player-modal::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.close {
  float: right;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.15rem;
}

.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 360px;
  gap: 1rem;
  clear: both;
}

.player-frame {
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid #2a2a2a;
  margin-bottom: 1rem;
}

.player-art {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: end;
  padding: 1.25rem;
}

.player-overlay {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.9rem 1rem;
  border-radius: 14px;
}

.player-pill {
  display: inline-flex;
  padding: 0.28rem 0.52rem;
  background: rgba(0, 0, 0, 0.72);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.watch-main h2 {
  margin: 0 0 0.35rem;
  font-size: 1.3rem;
}

.watch-row {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.channel-box,
.action-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.channel-box {
  flex-wrap: wrap;
}

.channel-avatar {
  width: 44px;
  height: 44px;
  font-size: 1rem;
}

.channel-copy strong {
  display: block;
}

.sub-copy {
  color: var(--muted);
  font-size: 0.86rem;
}

.subscribe-btn,
.action-pill {
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 0.95rem;
  cursor: pointer;
}

.subscribe-btn {
  background: #fff;
  color: #111;
  font-weight: 800;
}

.action-pill {
  background: #282828;
  color: var(--text);
}

.description-box,
.comments-box {
  margin-top: 1rem;
  background: #232323;
  border-radius: 16px;
  padding: 1rem;
}

.description-copy {
  margin: 0.6rem 0 0;
  line-height: 1.65;
  color: #e2e2e2;
}

.comments-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.comments-list,
.related-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.comment {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 0.75rem;
}

.comment p {
  margin: 0.15rem 0 0;
  color: #dddddd;
  line-height: 1.5;
}

.related-card {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 0.7rem;
  cursor: pointer;
}

.related-thumb {
  aspect-ratio: 16 / 9;
  border-radius: 10px;
}

.related-title {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.35;
}

.related-meta {
  margin-top: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .watch-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .actions {
    gap: 0.4rem;
  }

  .actions .pill,
  .search-cluster .icon-circle {
    display: none;
  }

  .search-cluster {
    grid-column: 1 / -1;
    justify-content: stretch;
    padding-bottom: 0.7rem;
  }

  .topbar {
    height: auto;
    padding-top: 0.55rem;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .sidebar.open {
    display: block;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 250px;
    background: #111;
    z-index: 40;
  }

  .content {
    padding-inline: 0.85rem;
  }
}

@media (max-width: 700px) {
  .shorts-rail,
  .video-grid {
    grid-template-columns: 1fr;
  }

  .search-wrap {
    grid-template-columns: 1fr 88px;
  }

  .card-body {
    grid-template-columns: 40px 1fr;
  }

  .more {
    display: none;
  }

  .related-card {
    grid-template-columns: 132px 1fr;
  }
}
