/* ============ 新闻站样式 ============ */
:root {
  --bg: #0d1117;
  --bg-soft: #161b22;
  --card: #161b22;
  --card-hover: #1c2330;
  --line: #232b36;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #ff4d4f;
  --accent-soft: rgba(255, 77, 79, .14);
  --topbar-bg: rgba(13, 17, 23, .86);
  --radius: 14px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .35);
  /* 无封面时的占位块配色 */
  --ph-a: #1f2937;
  --ph-b: #374151;
  --ph-text: rgba(255, 255, 255, .75);
  --wrap: 1320px;
}

html[data-theme="light"] {
  --bg: #f3f5f8;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --card-hover: #f1f3f7;
  --line: #e3e7ee;
  --text: #1a1f26;
  --text-dim: #6b7280;
  --accent: #e11d48;
  --accent-soft: rgba(225, 29, 72, .1);
  --topbar-bg: rgba(255, 255, 255, .9);
  --shadow: 0 6px 20px rgba(15, 23, 42, .08);
  --ph-a: #e4e8ef;
  --ph-b: #cdd5e1;
  --ph-text: rgba(30, 41, 59, .45);
}

* { box-sizing: border-box; }

/* 必须放在最前面：部分元素设了 display，会盖掉 HTML 的 hidden 属性 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 18px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--topbar-bg);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
  animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.clock { color: var(--text-dim); font-variant-numeric: tabular-nums; font-size: 13px; }
.icon-btn {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 15px;
}
.icon-btn:hover { background: var(--card-hover); }

/* ---------- 栏目 ---------- */
.catbar { position: sticky; top: 62px; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--line); }
.catbar-inner { display: flex; gap: 8px; overflow-x: auto; padding-top: 10px; padding-bottom: 10px; scrollbar-width: none; }
.catbar-inner::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto; padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--text-dim);
  cursor: pointer; font-size: 14px; white-space: nowrap; transition: .18s;
}
.cat:hover { color: var(--accent); border-color: var(--accent); }
.cat.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ---------- 工具条 ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px 6px; }
.live { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
  70%  { box-shadow: 0 0 0 9px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.search { flex: 0 1 340px; }
.search input {
  width: 100%; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text); font-size: 14px; outline: none;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- 卡片网格 ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); padding-top: 12px; }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s;
  animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }

.thumb-link { display: block; }
.thumb { position: relative; aspect-ratio: 16/9; background: linear-gradient(135deg, var(--ph-a), var(--ph-b)); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .thumb img { transform: scale(1.06); }
/* 没有封面时的兜底内容：来源站点图标 + 来源名 */
.thumb-fallback {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  padding: 14px;
}
/* 注意：必须写成 .thumb .src-icon，
   否则会被上面的 `.thumb img { width:100%; height:100% }` 覆盖掉尺寸 */
.thumb .src-icon {
  width: 34px; height: 34px; padding: 4px; border-radius: 9px;
  background: #fff; object-fit: contain;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .16);
}
.src-name {
  font-size: 13px; font-weight: 700; letter-spacing: .5px;
  color: var(--ph-text); text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.badge {
  position: absolute; left: 10px; top: 10px; padding: 3px 10px; border-radius: 999px;
  background: rgba(0,0,0,.62); color: #fff; font-size: 12px; backdrop-filter: blur(4px);
}
.cat-tag { position: absolute; right: 10px; top: 10px; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; }

.card-body { padding: 14px 15px 16px; display: flex; flex-direction: column; flex: 1; }
.card-title { margin: 0 0 8px; font-size: 16px; font-weight: 700; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card:hover .card-title { color: var(--accent); }
.card-sum { margin: 0 0 12px; color: var(--text-dim); font-size: 13.5px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.card-meta { display: flex; align-items: center; justify-content: space-between; color: var(--text-dim); font-size: 12.5px; padding-top: 10px; border-top: 1px dashed var(--line); }
.card-meta .go { color: var(--accent); }

/* 骨架屏 */
.skeleton { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.skeleton .sk-thumb { aspect-ratio: 16/9; background: linear-gradient(100deg, var(--bg-soft) 30%, var(--card-hover) 50%, var(--bg-soft) 70%); background-size: 200% 100%; animation: shine 1.3s infinite; }
.skeleton .sk-line { height: 12px; margin: 12px 15px; border-radius: 6px; background: linear-gradient(100deg, var(--bg-soft) 30%, var(--card-hover) 50%, var(--bg-soft) 70%); background-size: 200% 100%; animation: shine 1.3s infinite; }
.skeleton .sk-line.short { width: 45%; }
@keyframes shine { to { background-position: -200% 0; } }

.empty { text-align: center; color: var(--text-dim); padding: 70px 0; }

/* 更多按钮 */
.more { display: flex; justify-content: center; padding: 26px 0 0; }
.more-btn {
  padding: 11px 34px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 14px;
}
.more-btn:hover { border-color: var(--accent); color: var(--accent); }

.foot-space { height: 40px; }

/* ---------- 右侧热点栏 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 316px;
  gap: 22px;
  align-items: start;
}
.main-col { min-width: 0; }
.side-col {
  position: sticky;
  top: 122px;
  display: flex; flex-direction: column; gap: 16px;
}

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 15px; font-size: 14.5px; font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.panel-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #ff8200; }
.panel-dot.baidu { background: #2932e1; }

.hot-list { margin: 0; padding: 6px 0 10px; list-style: none; }
.hot-item { display: flex; align-items: flex-start; gap: 9px; padding: 7px 15px; font-size: 13.5px; line-height: 1.5; }
.hot-item:hover { background: var(--card-hover); }
.hot-rank {
  flex: 0 0 17px; padding-top: 1px; font-size: 12.5px; font-weight: 800;
  color: var(--text-dim); font-variant-numeric: tabular-nums;
}
.hot-item.top .hot-rank { color: #ff6a00; }
.hot-title {
  flex: 1; min-width: 0; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hot-title:hover { color: var(--accent); }
.hot-flag {
  flex: 0 0 auto; margin-top: 2px; padding: 1px 6px; border-radius: 5px;
  font-size: 11px; line-height: 1.5; background: var(--accent-soft); color: var(--accent);
}
.hot-loading { padding: 14px 15px; color: var(--text-dim); font-size: 13px; }

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .main-col { order: 1; }
  .side-col { position: static; order: 2; }
}

/* 页脚 */
.footer { border-top: 1px solid var(--line); margin-top: 20px; }
.footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 22px 18px; color: var(--text-dim); font-size: 13px; }

.to-top {
  position: fixed; right: 22px; bottom: 26px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 18px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); box-shadow: var(--shadow);
}
.to-top:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 640px) {
  .brand-name { font-size: 18px; }
  .grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search { flex: 1 1 auto; }
  .clock { display: none; }
}
