:root {
  color-scheme: light dark;
  --hn-bg: #f5f7fa;
  --hn-card: #ffffff;
  --hn-border: #eceff3;
  --hn-border-soft: #f1f5f9;
  --hn-text: #374151;
  --hn-title: #111827;
  --hn-muted: #9ca3af;
  --hn-accent: #2563eb;
  --hn-rank-bg: #f3f4f6;
  --hn-rank-text: #6b7280;
  --hn-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --hn-cols: 3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --hn-bg: #0f172a;
    --hn-card: #1e293b;
    --hn-border: #334155;
    --hn-border-soft: #293548;
    --hn-text: #e2e8f0;
    --hn-title: #f8fafc;
    --hn-muted: #94a3b8;
    --hn-accent: #60a5fa;
    --hn-rank-bg: #334155;
    --hn-rank-text: #cbd5e1;
    --hn-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body.hotnews-page {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--hn-bg);
  color: var(--hn-text);
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  background: var(--hn-card);
  padding: 8px 12px;
  z-index: 99;
}

.hotnews-nav {
  background: var(--hn-card);
  border-bottom: 1px solid var(--hn-border);
}
.hotnews-nav-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.hotnews-brand {
  color: var(--hn-accent);
  text-decoration: none;
  font-weight: 700;
}
.hotnews-title {
  color: var(--hn-muted);
  font-size: 14px;
}

.hotnews-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.hotnews-grid {
  display: grid;
  grid-template-columns: repeat(var(--hn-cols), minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.hotnews-card {
  background: var(--hn-card);
  border: 1px solid var(--hn-border);
  border-radius: 12px;
  box-shadow: var(--hn-shadow);
  display: flex;
  flex-direction: column;
  min-height: 380px;
  max-height: 420px;
  overflow: hidden;
}

.hotnews-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--hn-border-soft);
  flex-shrink: 0;
}

.hotnews-card-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hotnews-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--hn-brand, #2563eb);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.hotnews-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--hn-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hotnews-card-metric {
  font-size: 12px;
  color: var(--hn-muted);
  flex-shrink: 0;
}

.hotnews-card-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.hotnews-card-list li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 8px 16px;
}

.hotnews-card-list li + li {
  border-top: 1px dashed var(--hn-border-soft);
}

.hotnews-rank {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--hn-rank-bg);
  color: var(--hn-rank-text);
}

.hotnews-rank.is-1 { background: #ffe4ec; color: #db2777; }
.hotnews-rank.is-2 { background: #ffedd5; color: #ea580c; }
.hotnews-rank.is-3 { background: #ede9fe; color: #7c3aed; }

@media (prefers-color-scheme: dark) {
  .hotnews-rank.is-1 { background: #831843; color: #fbcfe8; }
  .hotnews-rank.is-2 { background: #7c2d12; color: #fed7aa; }
  .hotnews-rank.is-3 { background: #4c1d95; color: #ddd6fe; }
}

.hotnews-link {
  color: var(--hn-text);
  text-decoration: none;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hotnews-link:hover {
  color: var(--hn-accent);
}

.hotnews-hot {
  font-size: 12px;
  color: var(--hn-muted);
  white-space: nowrap;
  padding-top: 2px;
}

.hotnews-card-foot {
  display: flex;
  justify-content: flex-end;
  padding: 8px 16px 12px;
  border-top: 1px solid var(--hn-border-soft);
  flex-shrink: 0;
}

.hotnews-card-refresh {
  border: 0;
  background: transparent;
  color: var(--hn-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px;
}

.hotnews-card-refresh:hover {
  color: var(--hn-accent);
}

.hotnews-card-loading,
.hotnews-card-error,
.hotnews-empty {
  grid-column: 1 / -1;
  color: var(--hn-muted);
  font-size: 13px;
}

.hotnews-card-error {
  color: #b91c1c;
}

@media (prefers-color-scheme: dark) {
  .hotnews-card-error {
    color: #fca5a5;
  }
}

.hotnews-foot {
  border-top: 1px solid var(--hn-border);
  background: var(--hn-card);
  margin-top: 8px;
}
.hotnews-foot-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--hn-muted);
}
.hotnews-foot a {
  color: var(--hn-accent);
  text-decoration: none;
}

@media (max-width: 1024px) {
  .hotnews-grid {
    --hn-cols: 2;
  }
}

@media (max-width: 640px) {
  .hotnews-grid {
    --hn-cols: 1;
  }
}
