:root {
  --bg: #f4f2ec;
  --surface: #fffefa;
  --surface-strong: #ffffff;
  --ink: #17191d;
  --muted: #777b82;
  --line: #dedbd3;
  --accent: #f23d5b;
  --accent-soft: #ffe8ec;
  --teal: #078f8b;
  --teal-soft: #def4f1;
  --yellow: #f6c344;
  --shadow: 0 10px 28px rgba(25, 27, 31, 0.07);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Microsoft YaHei UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC",
    sans-serif;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

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

svg {
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 64px;
  padding: 0 max(20px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: rgba(244, 242, 236, 0.94);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
}

.brand-mark svg {
  width: 20px;
  height: 20px;
  fill: var(--accent);
  stroke: var(--accent);
}

.brand-name {
  margin-left: 10px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-divider {
  width: 1px;
  height: 17px;
  margin: 0 10px;
  background: var(--line);
}

.brand-subtitle {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.status-separator {
  color: #b3b0aa;
}

.topbar-actions {
  display: flex;
  justify-self: end;
  gap: 7px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.icon-button:hover {
  border-color: #bab6ad;
  background: #fff;
}

.icon-button:active {
  transform: translateY(1px);
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.icon-button[aria-pressed="true"] {
  border-color: #15171a;
  background: var(--ink);
  color: #fff;
}

.icon-button.is-loading svg {
  animation: spin 800ms linear infinite;
}

.action-label {
  font-size: 12px;
  font-weight: 700;
}

.workspace {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
}

.summary-band {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 44px 0 30px;
  gap: 36px;
}

.summary-copy {
  min-width: 0;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.eyebrow .live-dot {
  width: 6px;
  height: 6px;
  box-shadow: none;
}

.summary-copy h1 {
  margin: 13px 0 9px;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.12;
}

.summary-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.metric-strip {
  display: flex;
  flex: 0 0 auto;
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric-strip div {
  min-width: 108px;
  padding: 17px 20px;
  border-left: 1px solid var(--line);
}

.metric-strip div:last-child {
  border-right: 1px solid var(--line);
}

.metric-strip dt {
  color: var(--muted);
  font-size: 11px;
}

.metric-strip dd {
  margin: 5px 0 0;
  font-family: "Arial Narrow", "Microsoft YaHei UI", sans-serif;
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 286px;
  align-items: start;
  gap: 28px;
}

.feed {
  min-width: 0;
}

.feed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.view-tabs {
  display: flex;
  gap: 4px;
}

.view-tab {
  min-height: 36px;
  padding: 0 15px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.view-tab:hover {
  color: var(--ink);
}

.view-tab.is-active {
  background: var(--ink);
  color: #fff;
}

.search-box {
  display: flex;
  align-items: center;
  width: min(250px, 38%);
  min-height: 36px;
  padding: 0 11px;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f1efe9;
  color: var(--muted);
}

.search-box:focus-within {
  border-color: #bcb8ae;
  background: #fff;
}

.search-box svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.search-box input::placeholder {
  color: #9d9b96;
}

.feed-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 24px 2px 15px;
}

.feed-heading h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.feed-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.result-count {
  color: var(--muted);
  font-size: 12px;
}

.notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--yellow);
  background: #fff7dc;
  color: #65521a;
  font-size: 12px;
  line-height: 1.6;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.topic-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 100%;
  padding: 0;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: 0 1px 0 rgba(25, 27, 31, 0.02);
  text-align: left;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.topic-card:hover {
  transform: translateY(-2px);
  border-color: #c6c1b7;
  box-shadow: var(--shadow);
}

.topic-card:first-child {
  grid-column: span 2;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  height: clamp(300px, 25vw, 360px);
}

.card-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 8.8;
  background: #dfddd6;
}

.topic-card:first-child .card-media {
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
}

.card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 350ms ease;
}

.topic-card:hover .card-media img {
  transform: scale(1.018);
}

.card-media.is-fallback {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(242, 61, 91, 0.11), transparent 48%),
    #e9e6df;
  color: #a8a39a;
}

.card-media.is-fallback img {
  display: none;
}

.fallback-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid #c8c3b9;
  border-radius: 50%;
  font-family: "Arial Narrow", sans-serif;
  font-size: 20px;
  font-weight: 800;
}

.rank-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  min-width: 30px;
  height: 26px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  background: rgba(18, 20, 23, 0.86);
  color: #fff;
  font-family: "Arial Narrow", "Microsoft YaHei UI", sans-serif;
  font-size: 13px;
  font-weight: 800;
  backdrop-filter: blur(8px);
}

.rank-badge.is-top {
  background: var(--accent);
}

.card-body {
  display: flex;
  min-width: 0;
  padding: 14px 15px 15px;
  flex: 1;
  flex-direction: column;
}

.topic-card:first-child .card-body {
  justify-content: center;
  padding: 25px 24px;
}

.card-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
}

.card-kicker svg {
  width: 13px;
  height: 13px;
}

.card-title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.55;
}

.topic-card:first-child .card-title {
  -webkit-line-clamp: 3;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.35;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 14px;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.heat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-weight: 800;
}

.heat svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
  stroke: currentColor;
}

.video-count {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-arrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-weight: 700;
}

.card-arrow svg {
  width: 13px;
  height: 13px;
  transform: rotate(-90deg);
}

body.data-saver .card-media {
  display: grid;
  place-items: center;
  min-height: 92px;
  background: #e7e4dd;
}

body.data-saver .card-media img {
  display: none;
}

body.data-saver .card-media::after {
  content: attr(data-rank);
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid #c4bfb5;
  border-radius: 50%;
  color: #938f87;
  font-family: "Arial Narrow", sans-serif;
  font-size: 18px;
  font-weight: 800;
}

.empty-state {
  padding: 60px 20px;
  border: 1px dashed #cbc7be;
  text-align: center;
}

.empty-state svg {
  width: 30px;
  height: 30px;
  color: var(--muted);
}

.empty-state h3 {
  margin: 12px 0 4px;
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.load-more {
  display: flex;
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.load-more:hover {
  background: #fff;
}

.load-more svg {
  width: 15px;
  height: 15px;
}

.card-skeletons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.skeleton-card {
  height: 250px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(
      100deg,
      transparent 30%,
      rgba(255, 255, 255, 0.85) 50%,
      transparent 70%
    ),
    #e8e5de;
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
}

.skeleton-card:first-child {
  grid-column: span 2;
}

.side-rail {
  display: grid;
  gap: 14px;
  padding-top: 9px;
}

.rail-section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  font-size: 13px;
  font-weight: 800;
}

.source-badge,
.mini-label {
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 9px;
  font-weight: 900;
}

.mini-label {
  background: #f1efe9;
  color: var(--muted);
}

.rail-icon {
  width: 16px;
  height: 16px;
  color: var(--teal);
}

.source-row {
  display: flex;
  align-items: center;
  gap: 11px;
}

.source-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
}

.source-icon svg {
  width: 17px;
  height: 17px;
}

.source-row div {
  display: grid;
  gap: 3px;
}

.source-row strong {
  font-size: 13px;
}

.source-row span {
  color: var(--muted);
  font-size: 10px;
}

.source-facts {
  display: grid;
  margin: 16px 0;
  gap: 10px;
}

.source-facts div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 11px;
}

.source-facts dt {
  color: var(--muted);
}

.source-facts dd {
  margin: 0;
  font-weight: 700;
}

.source-link {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.source-link:hover {
  border-color: var(--ink);
}

.source-link svg {
  width: 14px;
  height: 14px;
}

.compact-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 13px;
  list-style: none;
}

.compact-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  font-size: 11px;
}

.compact-rank {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 4px;
  background: #efede7;
  color: var(--muted);
  font-family: "Arial Narrow", sans-serif;
  font-weight: 800;
}

.compact-item:first-child .compact-rank {
  background: var(--accent);
  color: #fff;
}

.compact-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-weight: 650;
  line-height: 1.5;
}

.compact-value {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.rising-list .compact-item {
  grid-template-columns: 22px minmax(0, 1fr);
}

.rising-list .compact-rank {
  background: var(--teal-soft);
  color: var(--teal);
}

.rising-list .compact-item:first-child .compact-rank {
  background: var(--teal);
  color: #fff;
}

.footer {
  display: flex;
  width: min(1240px, calc(100% - 40px));
  margin: 44px auto 0;
  padding: 20px 0 calc(24px + env(safe-area-inset-bottom));
  justify-content: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.footer-dot {
  color: #b4b0a8;
}

.detail-dialog {
  width: min(780px, calc(100% - 28px));
  max-height: min(86vh, 760px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: var(--surface-strong);
  box-shadow: 0 28px 70px rgba(15, 17, 20, 0.28);
}

.detail-dialog::backdrop {
  background: rgba(17, 19, 22, 0.58);
  backdrop-filter: blur(4px);
}

.dialog-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  max-height: inherit;
}

.dialog-media {
  min-height: 420px;
  overflow: hidden;
  background: #e4e1da;
}

.dialog-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dialog-media.is-fallback {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(242, 61, 91, 0.12), transparent 44%),
    #e9e6df;
}

.dialog-media.is-fallback img {
  display: none;
}

.dialog-content {
  display: flex;
  min-width: 0;
  padding: 36px 30px 28px;
  overflow-y: auto;
  flex-direction: column;
}

.dialog-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
}

.dialog-close svg {
  width: 17px;
  height: 17px;
}

.dialog-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
}

.rank-chip {
  padding: 4px 7px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-family: "Arial Narrow", sans-serif;
  font-weight: 800;
}

.dialog-content h2 {
  margin: 18px 0 24px;
  font-size: clamp(22px, 3.5vw, 32px);
  letter-spacing: 0;
  line-height: 1.35;
}

.dialog-stats {
  display: grid;
  margin: 0 0 26px;
  gap: 12px;
}

.dialog-stats div {
  display: flex;
  justify-content: space-between;
  padding-bottom: 11px;
  gap: 16px;
  border-bottom: 1px solid #ece9e2;
}

.dialog-stats dt {
  color: var(--muted);
  font-size: 11px;
}

.dialog-stats dd {
  margin: 0;
  font-size: 12px;
  font-weight: 750;
  text-align: right;
}

.primary-link {
  display: flex;
  min-height: 46px;
  margin-top: auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
}

.primary-link:hover {
  background: #2b2e33;
}

.primary-link svg {
  width: 15px;
  height: 15px;
}

.toast {
  position: fixed;
  z-index: 50;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  max-width: calc(100% - 40px);
  padding: 10px 14px;
  border-radius: 7px;
  background: rgba(23, 25, 29, 0.94);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    background-position: -120% 0;
  }
}

@media (max-width: 980px) {
  .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .side-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-rail .rail-section:first-child {
    grid-row: span 2;
  }
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 58px;
    padding: 0 14px;
  }

  .brand-subtitle,
  .brand-divider,
  .topbar-status {
    display: none;
  }

  .brand-mark {
    width: 31px;
    height: 31px;
  }

  .brand-name {
    font-size: 17px;
  }

  .icon-button {
    width: 38px;
    padding: 0;
  }

  .action-label {
    display: none;
  }

  .workspace {
    width: calc(100% - 28px);
  }

  .summary-band {
    display: block;
    padding: 29px 0 20px;
  }

  .summary-copy h1 {
    margin-top: 10px;
    font-size: 32px;
  }

  .metric-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 23px;
  }

  .metric-strip div {
    min-width: 0;
    padding: 14px 11px;
  }

  .metric-strip dd {
    font-size: 20px;
  }

  .feed-toolbar {
    position: sticky;
    z-index: 20;
    top: 58px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 7px;
    background: rgba(255, 254, 250, 0.96);
    backdrop-filter: blur(14px);
  }

  .view-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .view-tab {
    padding: 0 10px;
  }

  .search-box {
    width: 100%;
  }

  .feed-heading {
    padding-top: 20px;
  }

  .card-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .topic-card:first-child {
    grid-column: auto;
    display: flex;
    height: auto;
  }

  .topic-card:first-child .card-media {
    min-height: 0;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .topic-card:first-child .card-body {
    padding: 15px;
  }

  .topic-card:first-child .card-title {
    font-size: 18px;
    -webkit-line-clamp: 3;
  }

  .card-media {
    aspect-ratio: 16 / 9;
  }

  .side-rail {
    display: block;
    padding-top: 24px;
  }

  .rail-section {
    margin-bottom: 12px;
  }

  .side-rail .rail-section:nth-child(2),
  .side-rail .rail-section:nth-child(3) {
    display: none;
  }

  .card-skeletons {
    grid-template-columns: minmax(0, 1fr);
  }

  .skeleton-card:first-child {
    grid-column: auto;
  }

  .dialog-shell {
    display: block;
    overflow-y: auto;
  }

  .dialog-media {
    min-height: 0;
    aspect-ratio: 16 / 10;
  }

  .dialog-content {
    min-height: 330px;
    padding: 24px 20px 20px;
    overflow: visible;
  }

  .dialog-content h2 {
    margin: 15px 0 20px;
    font-size: 24px;
  }

  .footer {
    width: calc(100% - 28px);
    margin-top: 30px;
  }
}

@media (max-width: 390px) {
  .summary-copy h1 {
    font-size: 29px;
  }

  .metric-strip dt {
    font-size: 10px;
  }

  .metric-strip dd {
    font-size: 18px;
  }

  .card-body {
    padding: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
