.feed {
  padding-bottom: 48px;
}

.chips-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
}

.chips {
  display: flex;
  flex: 1;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.sort {
  flex: none;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-2);
  font-size: 13px;
}

.feed-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 24px 0;
}

.feed-head h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.feed-head p {
  color: var(--text-2);
  font-size: 13px;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.head-reset {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--bg-card);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}

.head-reset:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 24px 20px;
  max-width: 1760px;
  padding: 16px 24px 0;
}

.grid .empty {
  grid-column: 1 / -1;
}

/* First-paint placeholders, replaced as soon as feed.json arrives. */
.is-skeleton {
  pointer-events: none;
}

.sk-thumb {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
}

.sk-body {
  display: block;
  padding-top: 12px;
}

.sk-text {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 2px;
}

.sk-line {
  height: 12px;
  border-radius: 4px;
}

.sk-short {
  width: 68%;
}

.sk-tiny {
  width: 42%;
  height: 10px;
}

.sk-thumb,
.sk-line {
  background: linear-gradient(
    90deg,
    var(--bg-chip) 25%,
    var(--bg-chip-hover) 37%,
    var(--bg-chip) 63%
  );
  background-size: 400% 100%;
  animation: sk-shimmer 1.4s ease infinite;
}

@keyframes sk-shimmer {
  from { background-position: 100% 50%; }
  to { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .sk-thumb,
  .sk-line {
    animation: none;
  }
}

.card {
  position: relative;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--card-highlight), var(--card-shadow);
  transition: transform 0.22s var(--ease), background 0.2s var(--ease),
    box-shadow 0.22s var(--ease), border-color 0.2s var(--ease);
}

.card:hover {
  border-color: var(--border);
  background: var(--bg-card);
  box-shadow: var(--card-highlight), var(--card-shadow-hover);
  transform: translateY(-2px);
}

.card-link {
  display: block;
}

.thumb {
  position: relative;
  isolation: isolate;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
  background: var(--bg-chip);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s var(--ease);
}

.thumb img.is-loading {
  opacity: 0;
  transform: scale(1.02);
}

.card:hover .thumb img,
.card:focus-within .thumb img {
  transform: scale(1.04);
}

/* Bottom vignette so the glass badges stay legible over any thumbnail */
.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.45) 0%,
    rgba(0, 0, 0, 0) 42%
  );
  opacity: 0.65;
  pointer-events: none;
  transition: opacity 0.22s var(--ease);
}

.card:hover .thumb::after,
.card:focus-within .thumb::after {
  opacity: 1;
}

.thumb-fallback {
  display: grid;
  place-items: center;
}

.thumb-fallback span {
  color: var(--text-3);
  font-size: 34px;
  font-weight: 600;
}

.thumb-badges {
  position: absolute;
  right: 6px;
  bottom: 7px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge {
  position: absolute;
  right: 6px;
  bottom: 7px;
  z-index: 1;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(15, 15, 15, 0.62);
  -webkit-backdrop-filter: blur(8px) saturate(1.4);
  backdrop-filter: blur(8px) saturate(1.4);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.thumb-badges .badge {
  position: static;
}

.badge-sub {
  border-color: rgba(255, 237, 213, 0.28);
  background: linear-gradient(
    135deg,
    rgba(234, 88, 12, 0.92),
    rgba(194, 65, 12, 0.94)
  );
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-visited {
  position: absolute;
  left: 6px;
  bottom: 7px;
  z-index: 1;
  padding: 1px 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(15, 15, 15, 0.6);
  -webkit-backdrop-filter: blur(8px) saturate(1.4);
  backdrop-filter: blur(8px) saturate(1.4);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.thumb-progress {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.28);
}

.thumb-progress-fill {
  display: block;
  height: 100%;
  background: var(--brand-mark);
}

.card-save {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 15, 15, 0.72);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s var(--ease), background 0.15s var(--ease);
}

.card-save svg path {
  fill: none;
}

.card:hover .card-save,
.card:focus-within .card-save,
.card-save.is-on {
  opacity: 1;
}

.card-save:hover {
  background: rgba(15, 15, 15, 0.9);
}

.card-save.is-on {
  background: var(--brand-mark);
  color: #fff;
}

.card-save.is-on svg path {
  fill: currentColor;
}

.card-body {
  padding-top: 12px;
}

.card-text {
  min-width: 0;
}

.card-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 16px;
  font-weight: 500;
  line-height: 22px;
  word-break: break-word;
}

.card-channel {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  overflow: hidden;
  color: var(--text-2);
  font-size: 14px;
  white-space: nowrap;
}

.card-channel-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
  color: var(--text-2);
  font-size: 13px;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-chip);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}

.card:hover .meta-tag {
  background: var(--bg-chip-hover);
}

.meta-tag.is-intro {
  background: rgba(22, 163, 74, 0.14);
  color: #15803d;
}

.meta-tag.is-intermediate {
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
}

.meta-tag.is-advanced {
  background: rgba(234, 88, 12, 0.14);
  color: #c2410c;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .meta-tag.is-intro {
    color: #4ade80;
  }

  :root:not([data-theme="light"]) .meta-tag.is-intermediate {
    color: #60a5fa;
  }

  :root:not([data-theme="light"]) .meta-tag.is-advanced {
    color: #fb923c;
  }
}

:root[data-theme="dark"] .meta-tag.is-intro {
  color: #4ade80;
}

:root[data-theme="dark"] .meta-tag.is-intermediate {
  color: #60a5fa;
}

:root[data-theme="dark"] .meta-tag.is-advanced {
  color: #fb923c;
}

.card-why {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 6px;
  padding-left: 8px;
  border-left: 2px solid var(--border);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.5;
  transition: border-color 0.15s var(--ease);
}

.card:hover .card-why {
  border-left-color: var(--brand);
}

.sentinel {
  height: 1px;
}

.empty {
  max-width: 560px;
  margin: 72px auto;
  padding: 0 24px;
  text-align: center;
}

.empty-art {
  display: inline-grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 14px;
  border: 1px solid rgba(234, 88, 12, 0.22);
  border-radius: 18px;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 102, 0, 0.16),
    rgba(234, 88, 12, 0.04)
  );
  color: var(--brand);
  box-shadow: 0 8px 24px rgba(234, 88, 12, 0.1);
}

.empty h2 {
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 600;
}

.empty p {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
}

.empty .btn {
  margin-top: 18px;
}

.loading {
  padding: 48px 24px;
  color: var(--text-2);
}

@media (max-width: 640px) {
  .chips-bar {
    padding: 8px 12px;
  }

  #level-filter {
    display: none;
  }

  .feed-head {
    padding: 8px 12px 0;
  }

  .grid {
    grid-template-columns: 1fr;
    padding: 12px 12px 0;
  }

  .card {
    margin: 0;
    padding: 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  .card-save {
    top: 8px;
    right: 8px;
    opacity: 1;
  }

  .card:hover {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    transform: none;
  }

  .card:hover .thumb img {
    transform: none;
  }

  .card-title {
    font-size: 15px;
  }
}

/* Full-text subtitle search hits (under the feed head) */
.sub-hits {
  margin: 0 12px 18px;
  padding: 14px 16px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}

.sub-hits-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.sub-hits-title {
  font-size: 15px;
  font-weight: 600;
}

.sub-hits-meta {
  font-size: 12px;
}

.sub-hits-more {
  margin-left: auto;
  font-size: 12px;
}

.sub-hits-note {
  padding: 2px 0 4px;
  font-size: 12.5px;
}

.sub-hits-list {
  display: grid;
  gap: 2px;
}

.sub-hit {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s var(--ease);
}

.sub-hit:hover {
  background: var(--bg-hover);
}

.sub-hit-thumb {
  align-self: start;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.sub-hit-body {
  min-width: 0;
}

.sub-hit-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 600;
}

.sub-hit-snippet {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 3px;
}

.sub-hit-ts {
  flex: none;
  padding: 0 6px;
  border-radius: 4px;
  background: rgba(234, 88, 12, 0.12);
  color: var(--brand);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sub-hit-line {
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.55;
}

@media (max-width: 640px) {
  .sub-hits {
    margin: 0 12px 14px;
  }

  .sub-hit {
    grid-template-columns: 96px 1fr;
    gap: 10px;
  }
}

/* Geek mono readouts: counts, years, timestamps */
.card-meta,
.badge,
.badge-visited,
.sub-hit-ts {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.badge-visited {
  letter-spacing: -0.01em;
}

/* 首页个性化横排：继续观看 / 猜你想看（仅默认首页显示） */
.home-rails {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 1760px;
  padding: 18px 24px 0;
}

.home-rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.rail-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.rail-note {
  color: var(--text-2);
  font-size: 12px;
}

.rail-more {
  margin-left: auto;
  color: var(--text-2);
  font-size: 12.5px;
}

.rail-more:hover {
  color: var(--brand);
}

.rail-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.rail-scroll .card {
  flex: 0 0 248px;
  scroll-snap-align: start;
}

@media (max-width: 700px) {
  .rail-scroll .card {
    flex-basis: 212px;
  }
}


