:root {
  color-scheme: light;
  --yt-bg: #f9f9f9;
  --yt-text: #0f0f0f;
  --yt-muted: #606060;
  --yt-border: #e5e5e5;
  --yt-chip: #f2f2f2;
  --yt-chip-active: #0f0f0f;
  --yt-red: #ff0033;
  --yt-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

body.nostube {
  font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
  background: var(--yt-bg);
  color: var(--yt-text);
  -webkit-font-smoothing: antialiased;
}

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

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--yt-border);
}

.topbar-left,
.topbar-center,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-center {
  flex: 1;
  justify-content: center;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #1f1f1f;
}

.icon-btn:hover {
  background: #f2f2f2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.brand-icon {
  width: 32px;
  height: 22px;
  border-radius: 6px;
  background: var(--yt-red);
  display: grid;
  place-items: center;
  color: #fff;
}

.brand-icon .material-symbols-rounded {
  font-size: 18px;
}

.brand-text {
  font-size: 18px;
  letter-spacing: -0.3px;
}

.brand-tag {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--yt-muted);
  border: 1px solid var(--yt-border);
  padding: 2px 6px;
  border-radius: 999px;
}

.search {
  display: flex;
  align-items: center;
  width: min(620px, 100%);
  border: 1px solid #d3d3d3;
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
  height: 40px;
}

.search input {
  flex: 1;
  border: none;
  padding: 8px 16px;
  font-size: 15px;
  outline: none;
  height: 40px;
}

.search input::placeholder {
  color: #6b7280;
}

.search-btn {
  width: 56px;
  height: 40px;
  border-left: 1px solid var(--yt-border);
  border-radius: 0;
  background: #f8f8f8;
}

.mic-btn {
  background: #f2f2f2;
}

.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--yt-red);
  color: #fff;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 999px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0f0f0f;
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.app-body {
  display: flex;
  flex: 1;
}

.sidebar {
  width: 240px;
  padding: 12px 8px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid var(--yt-border);
  background: #fff;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-title {
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  color: var(--yt-muted);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  color: #202020;
}

.sidebar-link:hover {
  background: #f2f2f2;
}

.sidebar-link.is-active {
  background: #f2f2f2;
  font-weight: 600;
}

.channel-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ea4335;
}

.channel-dot.alt {
  background: #1a73e8;
}

.channel-dot.alt-2 {
  background: #34a853;
}

.content {
  flex: 1;
  padding: 16px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.feed-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feed-title {
  font-size: 18px;
  font-weight: 600;
}

.feed-empty {
  font-size: 14px;
  color: var(--yt-muted);
  padding: 12px 0;
}

.chips {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 0 8px;
  position: sticky;
  top: 56px;
  background: var(--yt-bg);
  z-index: 5;
}

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--yt-chip);
  font-size: 14px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.chip:hover {
  background: #eaeaea;
}

.chip.is-active {
  background: var(--yt-chip-active);
  color: #fff;
}

.chips::-webkit-scrollbar {
  height: 6px;
}

.chips::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 999px;
}

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

.video-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
}

.thumbnail {
  position: relative;
  border-radius: 16px;
  background: linear-gradient(135deg, #f6c36f, #ef5da8);
  padding-top: 56.25%;
  overflow: hidden;
  box-shadow: var(--yt-shadow);
  transition: transform 150ms ease, box-shadow 150ms ease;
  background-size: cover;
  background-position: center;
}

.thumbnail::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.15));
}

.thumbnail.alt {
  background: linear-gradient(135deg, #7ac7ff, #4263eb);
}

.thumbnail.alt-2 {
  background: linear-gradient(135deg, #7ef29d, #2f9e44);
}

.thumbnail.alt-3 {
  background: linear-gradient(135deg, #d3b6ff, #845ef7);
}

.thumbnail.alt-4 {
  background: linear-gradient(135deg, #ffd6a5, #ff7b00);
}

.thumbnail.alt-5 {
  background: linear-gradient(135deg, #f1f3f5, #adb5bd);
}

.thumbnail.alt-6 {
  background: linear-gradient(135deg, #ffc9de, #ff6b6b);
}

.thumbnail.alt-7 {
  background: linear-gradient(135deg, #dee2ff, #5c7cfa);
}

.thumbnail.alt-8 {
  background: linear-gradient(135deg, #ffe3e3, #f03e3e);
}

.thumbnail.alt-9 {
  background: linear-gradient(135deg, #b2f2bb, #2b8a3e);
}

.thumbnail.alt-10 {
  background: linear-gradient(135deg, #ffd8a8, #ff922b);
}

.thumbnail.alt-11 {
  background: linear-gradient(135deg, #d0ebff, #339af0);
}

.duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 1;
}

.live-pill {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: #d61f1f;
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.03em;
  z-index: 1;
}

.video-meta {
  display: flex;
  gap: 12px;
}

.channel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1a73e8;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  position: relative;
  overflow: hidden;
}

.channel-avatar.alt {
  background: #ea4335;
}

.channel-avatar.alt-2 {
  background: #34a853;
}

.channel-avatar.alt-3 {
  background: #7b61ff;
}

.channel-avatar.alt-4 {
  background: #ff922b;
}

.channel-avatar.alt-5 {
  background: #6c757d;
}

.channel-avatar.alt-6 {
  background: #ff6b6b;
}

.channel-avatar.alt-7 {
  background: #5c7cfa;
}

.channel-avatar.alt-8 {
  background: #f03e3e;
}

.channel-avatar.alt-9 {
  background: #2b8a3e;
}

.channel-avatar.alt-10 {
  background: #ff922b;
}

.channel-avatar.alt-11 {
  background: #339af0;
}

.video-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.video-title {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--yt-muted);
  flex-wrap: wrap;
}

.video-sub span + span::before {
  content: "·";
  margin-right: 6px;
}

.video-sub .verified::before {
  content: "";
  margin: 0;
}

.video-channel {
  color: var(--yt-muted);
}

.verified {
  font-size: 14px;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
}

.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 150ms ease;
}

.avatar-img.is-loaded {
  opacity: 1;
}

.shorts {
  border-top: 1px solid var(--yt-border);
  padding-top: 16px;
}

.shorts-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 500;
}

.shorts-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.short-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.short-thumb {
  border-radius: 16px;
  padding-top: 160%;
  background: linear-gradient(160deg, #1b1b1b, #5f6368);
  box-shadow: var(--yt-shadow);
  background-size: cover;
  background-position: center;
}

.short-thumb.alt {
  background: linear-gradient(160deg, #1f2937, #9ca3af);
}

.short-thumb.alt-2 {
  background: linear-gradient(160deg, #111827, #7c3aed);
}

.short-thumb.alt-3 {
  background: linear-gradient(160deg, #0f172a, #e11d48);
}

.short-title {
  font-size: 14px;
  font-weight: 500;
}

.short-meta {
  font-size: 12px;
  color: var(--yt-muted);
}

.channel-initials {
  position: relative;
  z-index: 1;
}

.mobile-nav {
  display: none;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--yt-border);
  padding: 6px 10px 8px;
  justify-content: space-between;
  box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.05);
}

.mobile-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--yt-muted);
}

.mobile-link.is-active {
  color: var(--yt-text);
}

.mobile-link.is-active::after {
  content: "";
  width: 24px;
  height: 2px;
  background: #0f0f0f;
  border-radius: 999px;
}

.watch-overlay {
  position: fixed;
  inset: 0;
  background: var(--yt-bg);
  z-index: 30;
  display: none;
  flex-direction: column;
}

.watch-overlay.active {
  display: flex;
}

.watch-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.watch-header {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--yt-border);
  background: #fff;
}

.watch-titlebar {
  font-size: 16px;
  font-weight: 500;
}

.watch-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  padding: 24px;
  overflow: hidden;
}

.watch-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding-right: 8px;
}

.watch-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  background: #000;
  overflow: hidden;
  display: grid;
  place-items: center;
}

#watch-video {
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
  position: relative;
  z-index: 1;
  display: block;
}

.watch-player > #watch-video {
  position: absolute;
  inset: 0;
}

.watch-poster {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
  z-index: 2;
  visibility: hidden;
}

.watch-poster.is-visible {
  opacity: 1;
  visibility: visible;
}

.watch-status {
  position: absolute;
  color: #fff;
  font-size: 14px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 999px;
  z-index: 3;
  pointer-events: none;
}

.watch-status[hidden] {
  display: none;
}

.watch-meta h1 {
  font-size: 20px;
  line-height: 1.3;
}

.watch-stats {
  font-size: 13px;
  color: var(--yt-muted);
}

.watch-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.watch-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f2f2f2;
  font-size: 13px;
}

.watch-channel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f5f5f5;
}

.watch-channel-name {
  font-weight: 500;
}

.watch-channel-meta {
  font-size: 12px;
  color: var(--yt-muted);
}

.watch-subscribe {
  margin-left: auto;
  background: #0f0f0f;
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}

.watch-desc {
  background: #f2f2f2;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
}

.watch-side {
  border-left: 1px solid var(--yt-border);
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.watch-side-title {
  font-size: 16px;
  font-weight: 600;
}

.watch-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.watch-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  text-align: left;
}

.watch-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: #d1d5db;
  background-size: cover;
  background-position: center;
}

.watch-item-title {
  font-size: 14px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.watch-item-channel {
  font-size: 12px;
  color: var(--yt-muted);
}

.search-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 20;
  display: none;
  flex-direction: column;
}

.search-overlay.active {
  display: flex;
}

.search-overlay-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--yt-border);
}

.search-overlay-bar input {
  flex: 1;
  border: none;
  font-size: 16px;
  outline: none;
}

.search-suggestions {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--yt-muted);
}

.suggestion {
  padding: 12px 16px;
  background: var(--yt-chip);
  border-radius: 999px;
}

.video-card:hover .thumbnail {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

body.sidebar-collapsed .sidebar {
  width: 76px;
}

body.sidebar-collapsed .sidebar-link span:last-child,
body.sidebar-collapsed .sidebar-title,
body.sidebar-collapsed .channel-dot + span {
  display: none;
}

body.sidebar-collapsed .sidebar-link {
  justify-content: center;
}

@media (max-width: 1100px) {
  .sidebar {
    width: 76px;
  }

  .sidebar-link span:last-child,
  .sidebar-title,
  .channel-dot + span {
    display: none;
  }

  .sidebar-link {
    justify-content: center;
  }
}

@media (max-width: 900px) {
  .topbar-center {
    display: none;
  }

  .topbar-right {
    gap: 6px;
  }

  .mobile-search {
    display: inline-grid;
  }

  .watch-layout {
    grid-template-columns: 1fr;
  }

  .watch-side {
    border-left: none;
    padding-left: 0;
    overflow: visible;
  }
}

@media (max-width: 1100px) {
  .watch-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

@media (max-width: 720px) {
  .app-body {
    flex-direction: column;
  }

  .sidebar {
    display: none;
  }

  .content {
    padding: 12px 16px 90px;
  }

  .mobile-nav {
    display: flex;
  }

  .watch-layout {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
  }

  .watch-main {
    order: 1;
    overflow: visible;
  }

  .watch-side {
    order: 2;
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--yt-border);
    padding-top: 16px;
    overflow: visible;
  }

  .watch-actions {
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .watch-actions::-webkit-scrollbar {
    height: 4px;
  }

  .watch-actions::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 999px;
  }

  .watch-item {
    grid-template-columns: 140px 1fr;
  }
}

@media (min-width: 901px) {
  .mobile-search {
    display: none;
  }
}

.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}
