/* ═══════════════════════════════════════════════════════════════
   yt-exact.css — YouTube 浅色版 精确匹配(最高优先级覆盖层)
   从 YouTube 截图逐像素提取,最后加载,覆盖一切
   ═══════════════════════════════════════════════════════════════ */

/* ── 0. CSS 变量(YouTube 设计令牌) ── */
:root {
  --yt-bg: #ffffff;
  --yt-surface: #ffffff;
  --yt-text: #0f0f0f;
  --yt-text-2: #606060;
  --yt-text-3: #909090;
  --yt-hover: #f2f2f2;
  --yt-border: #e5e5e5;
  --yt-chip-bg: #f2f2f2;
  --yt-chip-active: #0f0f0f;
  --yt-chip-active-text: #ffffff;
  --yt-radius: 12px;
  --yt-radius-sm: 8px;
  --yt-header-h: 56px;
}

/* ── 1. 页面基础 ── */
body {
  background: var(--yt-bg) !important;
  font-family: 'Roboto', 'Segoe UI', sans-serif !important;
  color: var(--yt-text) !important;
}

/* ── 2. 侧栏(BrowseChrome #cbBrowseGuide) ── */
#cbBrowseGuide {
  background: var(--yt-bg) !important;
  border-right: none !important;
}
#cbBrowseGuide .yt-guide-item,
#cbBrowseGuide .ph-nav-item {
  display: flex !important;
  align-items: center !important;
  gap: 24px !important;
  height: 40px !important;
  padding: 0 12px !important;
  margin: 0 !important;
  border-radius: 10px !important;
  color: var(--yt-text) !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  text-decoration: none !important;
  transition: background .1s ease !important;
}
#cbBrowseGuide .yt-guide-item:hover,
#cbBrowseGuide .ph-nav-item:hover {
  background: var(--yt-hover) !important;
}
#cbBrowseGuide .yt-guide-item.active,
#cbBrowseGuide .yt-guide-item.is-on {
  background: var(--yt-hover) !important;
  font-weight: 500 !important;
}
#cbBrowseGuide .yt-guide-item i,
#cbBrowseGuide .ph-nav-item i {
  width: 24px !important;
  min-width: 24px !important;
  text-align: center !important;
  font-size: 18px !important;
  color: var(--yt-text) !important;
}
#cbBrowseGuide .yt-guide-item.active i,
#cbBrowseGuide .yt-guide-item.is-on i {
  color: var(--yt-text) !important;
}
#cbBrowseGuide .yt-guide-heading {
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--yt-text) !important;
  padding: 6px 12px !important;
  margin-top: 12px !important;
}

/* ── 3. Chips(筛选标签) ── */
.qf-chip, .cb-chip, .sf-pill, .trending-tag-chip {
  display: inline-flex !important;
  align-items: center !important;
  height: 32px !important;
  padding: 0 12px !important;
  border-radius: 8px !important;
  background: var(--yt-chip-bg) !important;
  color: var(--yt-text) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  border: none !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: background .15s ease, color .15s ease !important;
  text-decoration: none !important;
}
.qf-chip:hover, .cb-chip:hover, .sf-pill:hover {
  background: var(--yt-border) !important;
}
.qf-chip.active, .cb-chip.active, .cb-chip.is-on, .sf-pill.active {
  background: var(--yt-chip-active) !important;
  color: var(--yt-chip-active-text) !important;
}

/* ── 4. 视频卡片(全站) ── */
.yt-card, .cb-trend-card, .card.video-preview {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  text-decoration: none !important;
  display: block !important;
}
.yt-card .yt-thumb, .cb-trend-thumb {
  border-radius: var(--yt-radius) !important;
  overflow: hidden !important;
  aspect-ratio: 16/9 !important;
  background: var(--yt-hover) !important;
  position: relative !important;
}
.yt-card .yt-thumb img, .cb-trend-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  transition: transform .3s ease !important;
}
.yt-card:hover .yt-thumb img {
  transform: scale(1.03) !important;
}
.yt-duration, .cb-dur {
  position: absolute !important;
  right: 8px !important;
  bottom: 8px !important;
  background: rgba(0,0,0,.8) !important;
  color: #fff !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  font-family: 'Roboto Mono', monospace !important;
}
.yt-card .yt-info {
  display: flex !important;
  gap: 12px !important;
  margin-top: 12px !important;
}
.yt-card .yt-avatar {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  background: var(--yt-hover) !important;
}
.yt-card .yt-title {
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--yt-text) !important;
  line-height: 20px !important;
  max-height: 40px !important;
  overflow: hidden !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  margin-bottom: 4px !important;
}
.yt-card .yt-channel, .yt-card .yt-meta {
  font-size: 12px !important;
  font-weight: 400 !important;
  color: var(--yt-text-2) !important;
  line-height: 18px !important;
}

/* ── 5. 视频网格 ── */
.yt-grid, .cb-trend-grid, .cb-cat-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  gap: 16px 12px !important;
  padding: 16px 0 !important;
}
@media (max-width: 900px) {
  .yt-grid, .cb-trend-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px 8px !important; }
}
@media (max-width: 600px) {
  .yt-grid, .cb-trend-grid { grid-template-columns: repeat(1, 1fr) !important; }
}

/* ── 6. 搜索栏 ── */
.search-input, input[type="search"], input[type="text"][placeholder*="搜索"], input[type="text"][placeholder*="Search"] {
  border: 1px solid var(--yt-border) !important;
  border-radius: 20px 0 0 20px !important;
  padding: 0 16px !important;
  height: 40px !important;
  font-size: 16px !important;
  background: var(--yt-surface) !important;
  color: var(--yt-text) !important;
  outline: none !important;
  flex: 1 !important;
}
.search-input:focus {
  border-color: #065fd4 !important;
}
.search-btn, button[type="submit"][class*="search"] {
  border: 1px solid var(--yt-border) !important;
  border-left: none !important;
  border-radius: 0 20px 20px 0 !important;
  height: 40px !important;
  width: 64px !important;
  background: var(--yt-hover) !important;
  color: var(--yt-text-2) !important;
  cursor: pointer !important;
}

/* ── 7. 空状态(全站) ── */
.cb-empty, .cb-later-empty {
  text-align: center !important;
  padding: 60px 20px !important;
  font-size: 15px !important;
  color: var(--yt-text-2) !important;
}

/* ── 8. 骨架屏 ── */
.cb-yt-skel, .sk-card {
  border-radius: var(--yt-radius) !important;
  overflow: hidden !important;
}
.cb-yt-skel-thumb {
  aspect-ratio: 16/9 !important;
  border-radius: var(--yt-radius) !important;
  background: linear-gradient(90deg, var(--yt-hover) 25%, var(--yt-border) 50%, var(--yt-hover) 75%) !important;
  background-size: 200% 100% !important;
  animation: yt-shimmer 1.5s infinite !important;
}
@keyframes yt-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.cb-yt-skel-line {
  height: 12px !important;
  border-radius: 4px !important;
  background: var(--yt-hover) !important;
  margin-top: 8px !important;
}
.cb-yt-skel-line.w2 { width: 60% !important; }

/* ── 9. 页面标题(YouTube: 24px / 400 / 主色;副标题 13px 次级色) ── */
.cb-page-h1 {
  font-size: 24px !important;
  font-weight: 400 !important;
  color: var(--text-primary) !important;
  margin: 24px 0 8px !important;
}
.cb-page-sub {
  font-size: 13px !important;
  color: var(--text-secondary) !important;
  margin: 0 0 16px !important;
}

/* ── 10. 统一空状态(浏览页家族): 48px 圆底图标 + 标题 + 副标题 ── */
body.page-browse .cb-empty-yt {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  padding: 64px 20px !important;
  grid-column: 1 / -1 !important;
}
body.page-browse .cb-empty-yt-icon {
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  background: var(--panel-soft) !important;
  color: var(--text-secondary) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
body.page-browse .cb-empty-yt-icon svg {
  display: block !important;
}
body.page-browse .cb-empty-yt-title {
  margin: 16px 0 4px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 22px !important;
  color: var(--text-primary) !important;
}
body.page-browse .cb-empty-yt-sub {
  margin: 0 !important;
  font-size: 13px !important;
  line-height: 18px !important;
  color: var(--text-secondary) !important;
}

/* ── 11. 列表行 / 表格行 hover: 灰底 + 8px 圆角 + .15s 过渡 ──
   .cb-trend-row 用 padding+负 margin 补一圈呼吸位,几何不变 */
body.page-browse .cb-trend-row {
  padding: 8px !important;
  margin: -8px !important;
  border-radius: 8px !important;
  transition: background-color .15s ease !important;
}
body.page-browse .cb-trend-row:hover {
  background: var(--card-hover) !important;
  border-radius: 8px !important;
}
body.page-browse .page-wrap table tbody tr {
  transition: background-color .15s ease !important;
}
body.page-browse .page-wrap table tbody tr:hover {
  background: var(--card-hover) !important;
  border-radius: 8px !important;
}

/* ── 12. 分类/标签/频道/明星卡片: 12px 圆角 + hover 上浮 + 阴影 ──
   bundle 在 (0,2,1) 锁了 transform/box-shadow !important,这里用 :hover
   抬特异性到 (0,3,1) + !important 反杀 */
body.page-browse .cb-cat-card,
body.page-browse .chan-card,
body.page-browse .star-card {
  border-radius: 12px !important;
  transition: transform .15s ease, box-shadow .15s ease !important;
}
body.page-browse .cb-cat-card:hover,
body.page-browse .chan-card:hover,
body.page-browse .star-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: var(--shadow-md) !important;
}
/* 卡片文字: 标题主色 / 计数次色(全部走主题变量) */
body.page-browse .cb-cat-name,
body.page-browse .chan-card .name,
body.page-browse .star-info .name {
  color: var(--text-primary) !important;
}
body.page-browse .cb-cat-count,
body.page-browse .chan-card .stats,
body.page-browse .star-info .stats,
body.page-browse .cb-tag .tag-cnt {
  color: var(--text-secondary) !important;
}
/* 标签 chips(热门 + 字母分区): hover 轻浮起,与卡片动效一致 */
body.page-tags .cb-tag {
  transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease !important;
}
body.page-tags .cb-tag:hover {
  transform: translateY(-2px) !important;
  box-shadow: var(--shadow-md) !important;
}

/* ── 13. 侧栏 active: 灰 pill + 600 加粗,不加左边条(YouTube 基准) ── */
body.page-browse .yt-mini-guide a {
  border-left: none !important;
  transition: background-color .15s ease !important;
}
body.page-browse .yt-mini-guide a:hover {
  background: var(--card-hover) !important;
}
body.page-browse .yt-mini-guide a.is-on {
  background: var(--card-hover) !important;
  font-weight: 600 !important;
  border-left: none !important;
  box-shadow: none !important;
}
