:root {
  --bg: #f4f5f7;
  --bg-grad: radial-gradient(1200px 600px at 15% -10%, #eef2ff 0%, transparent 55%),
             radial-gradient(1000px 500px at 100% 0%, #fef2f4 0%, transparent 50%);
  --card-bg: #ffffff;
  --text: #14161c;
  --text-soft: #565e6c;
  --text-faint: #9aa0ab;
  --border: #eceef2;
  --border-soft: #f2f4f7;
  --accent: #3b6cf6;
  --accent-soft: #eef3ff;
  --up: #e23b3b;      /* 涨=红（国内习惯） */
  --up-soft: #fdeeee;
  --down: #17a34a;    /* 跌=绿 */
  --down-soft: #eafaf0;
  --gold: #f1a80b;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow: 0 1px 3px rgba(16,24,40,.05), 0 8px 24px rgba(16,24,40,.05);
  --shadow-lg: 0 4px 12px rgba(16,24,40,.08), 0 16px 40px rgba(16,24,40,.06);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  padding: 22px;
  max-width: 1320px;
  margin: 0 auto;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 14px; margin-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  font-size: 30px; width: 52px; height: 52px; display: grid; place-items: center;
  background: var(--card-bg); border-radius: 14px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.topbar h1 { font-size: 23px; font-weight: 800; letter-spacing: -.4px; }
.subtitle { color: var(--text-soft); font-size: 13px; margin-top: 1px; }
.meta { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.updated { color: var(--text-soft); display: flex; align-items: center; gap: 6px; }
.updated::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #2ec26b; box-shadow: 0 0 0 3px rgba(46,194,107,.18); }
.refresh-btn {
  border: 1px solid var(--border); background: var(--card-bg);
  color: var(--accent); padding: 7px 15px; border-radius: 22px;
  cursor: pointer; font-size: 13px; font-weight: 600; transition: .18s;
  box-shadow: var(--shadow-sm); display: inline-flex; align-items: center; gap: 5px;
}
.refresh-btn:hover { background: var(--accent-soft); border-color: #c9d8fd; transform: translateY(-1px); }
.refresh-btn .ri { display: inline-block; font-size: 15px; }
.refresh-btn.spinning { pointer-events: none; opacity: .7; }
.refresh-btn.spinning .ri { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auto { color: var(--text-soft); display: flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }
.auto input { accent-color: var(--accent); }

/* ---------- 今日看点 ---------- */
.insights {
  background: linear-gradient(100deg, #fff 0%, #fffdf7 100%);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 13px 16px; margin-bottom: 18px;
  display: flex; align-items: center; gap: 16px; overflow: hidden;
}
.insights-head {
  flex: 0 0 auto; font-weight: 800; font-size: 14px; color: var(--text);
  display: flex; align-items: center; gap: 7px;
}
.insights-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(241,168,11,.16); }
.insights-scope {
  font-weight: 500; font-size: 11.5px; color: var(--text-faint);
  padding: 2px 8px; border-radius: 999px;
  background: #f4f5f7; border: 1px solid var(--border);
  margin-left: 4px;
}
.insights-track { display: flex; gap: 10px; overflow-x: auto; flex: 1 1 auto; padding-bottom: 2px; scrollbar-width: thin; }
.insights-track::-webkit-scrollbar { height: 5px; }
.insights-track::-webkit-scrollbar-thumb { background: #e2e5ea; border-radius: 4px; }

/* 跑马灯模式：≥3 条信号时自动无缝滚动 */
.insights-track.marquee {
  display: block; overflow: hidden; padding-bottom: 0;
  /* 两侧渐隐遮罩，滚动更柔和 */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%);
}
.insights-track.marquee::-webkit-scrollbar { display: none; }
.insights-track.marquee .marquee-track {
  display: flex; width: max-content; gap: 10px;
  animation: marqueeScroll var(--marquee-duration, 30s) linear infinite;
}
.insights-track.marquee .marquee-group {
  display: flex; gap: 10px; flex: 0 0 auto; padding-right: 10px;
}
.insights-track.marquee:hover .marquee-track,
.insights-track.marquee:focus-within .marquee-track { animation-play-state: paused; }
@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .insights-track.marquee .marquee-track { animation: none; }
  .insights-track.marquee { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
}
.insight-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 20px; font-size: 13px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--border); white-space: nowrap;
  color: var(--text); transition: .15s;
}
.insight-chip:hover { box-shadow: var(--shadow-sm); }
.insight-chip.up { background: var(--up-soft); border-color: #f7d5d5; color: #b52c2c; }
.insight-chip.hot { background: #fff4e6; border-color: #ffe0b8; color: #b5710b; }
.insight-chip .ci { font-size: 15px; }

/* ---------- Grid ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid.grid-3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 18px 10px; overflow: hidden; transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-lg); }
.card.wide { grid-column: 1 / -1; }
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; flex-wrap: nowrap; gap: 8px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border-soft);
  min-height: 44px;  /* 三栏 card-head 强制等高，防止 hint 换行导致后续行错位 */
  box-sizing: border-box;
}
.card-head h2 { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; letter-spacing: -.2px; flex: 1 1 auto; min-width: 0; }
.card-head h2 .ic { font-size: 18px; }
.hint { font-size: 12px; color: var(--text-faint); flex: 0 0 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 3px; background: var(--bg); padding: 3px; border-radius: 10px; }
.tab {
  border: none; background: transparent; color: var(--text-soft);
  padding: 5px 13px; border-radius: 8px; cursor: pointer; font-size: 13px;
  font-weight: 600; transition: .15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--card-bg); color: var(--accent); box-shadow: var(--shadow-sm); }

/* ---------- Lists ---------- */
.list { list-style: none; }
.empty { color: var(--text-faint); padding: 28px 4px; text-align: center; font-size: 14px; }

/* 榜单条目 —— 固定高度，物理锁死，三栏必然对齐 */
.rank-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 0 6px; border-radius: var(--radius-sm);
  transition: background .15s; position: relative;
  height: 72px;               /* 固定行高（非 min-height），内容超出裁剪 */
  overflow: hidden;
  box-sizing: border-box;
}
.rank-list li:hover { background: var(--bg); }
.rank-list li:not(:last-child)::after {
  content: ""; position: absolute; left: 6px; right: 6px; bottom: 0; height: 1px; background: var(--border-soft);
}
.rank-num {
  flex: 0 0 24px; text-align: center; font-weight: 800; font-size: 15px;
  color: var(--text-faint); font-variant-numeric: tabular-nums;
}
.rank-num.top { color: var(--gold); }
.rank-icon { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 11px; object-fit: cover; background: var(--bg); box-shadow: var(--shadow-sm); }
/* Steam 图标改为 42×42 方形（居中裁剪），与 iOS 榜完全一致，确保三栏视觉严格对齐 */
#steamList .rank-icon { width: 42px; flex-basis: 42px; height: 42px; border-radius: 11px; object-fit: cover; object-position: center; }
.rank-main { flex: 1 1 auto; min-width: 0; }
.rank-title { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.rank-title a { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.rank-title a:hover { color: var(--accent); }
.rank-sub { font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.rank-metric { flex: 0 0 auto; text-align: right; }
.metric-val { font-weight: 800; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.metric-label { font-size: 11px; color: var(--text-faint); }
.metric-sub { font-size: 10.5px; color: var(--text-faint); margin-top: 3px; opacity: .8; font-variant-numeric: tabular-nums; }

/* 变化标记 */
.badge-new {
  flex: 0 0 auto; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 6px;
  background: var(--up-soft); color: var(--up); letter-spacing: .3px;
}
.delta { flex: 0 0 auto; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; gap: 1px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat { color: var(--text-faint); }
.peak-delta { font-size: 11px; font-weight: 700; margin-top: 1px; font-variant-numeric: tabular-nums; }
.peak-delta.up { color: var(--up); }
.peak-delta.down { color: var(--down); }
.record-tag { font-size: 10px; font-weight: 800; color: var(--gold); }

/* Steam 迷你趋势图 */
.spark { flex: 0 0 auto; width: 54px; height: 22px; }

/* ---------- 制作人动态（Bluesky） ---------- */
.daily-bar {
  display: flex; gap: 10px; align-items: flex-start;
  background: linear-gradient(90deg, #f3f8ff, #fafbff 60%);
  border: 1px solid #dbe6fb; border-radius: var(--radius-sm);
  padding: 12px 15px; margin-bottom: 12px;
}
.daily-tag {
  flex: 0 0 auto; font-size: 11.5px; font-weight: 800;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid #d3e0fb; border-radius: 7px; padding: 3px 9px;
  white-space: nowrap;
}
.daily-text { font-size: 13px; line-height: 1.7; color: var(--text-soft); }

.post-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 10px; padding-top: 2px;
}
.post-item {
  display: flex; gap: 11px; align-items: flex-start;
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--card-bg);
  text-decoration: none; color: var(--text);
  transition: .16s; position: relative;
}
.post-item:hover { border-color: #c9d6f8; background: #fafbff; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.post-avatar {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%;
  object-fit: cover; background: var(--bg); border: 1px solid var(--border-soft);
}
.post-avatar-fallback { display: grid; place-items: center; font-size: 18px; }
.post-main { flex: 1 1 auto; min-width: 0; }
.post-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.post-name { font-weight: 800; font-size: 13px; }
.post-handle {
  font-size: 11px; color: var(--text-faint);
  font-family: ui-monospace, Consolas, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46%;
}
.post-text {
  margin-top: 4px; font-size: 12.5px; line-height: 1.65; color: var(--text-soft);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  white-space: pre-wrap; word-break: break-word;
}
.post-media-note { color: var(--text-faint); font-size: 12px; }
.post-stats {
  margin-top: 6px; font-size: 11px; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- 资讯：多列卡片网格 ---------- */
.news-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px; padding-top: 2px;
}
.news-item {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 13px 14px; background: var(--card-bg); transition: .16s; position: relative;
  min-height: 104px;
}
.news-item:hover { border-color: #dfe3ea; box-shadow: var(--shadow); transform: translateY(-2px); }
.news-top { display: flex; align-items: center; gap: 8px; }
.src-tag {
  flex: 0 0 auto; font-size: 11px; font-weight: 800; padding: 2px 9px;
  border-radius: 6px; color: #fff; letter-spacing: .3px;
}
.src-机核 { background: #d9433f; }
.src-游研社 { background: #4a8fe7; }
.src-竞核 { background: #7b52d6; }
.news-date { font-size: 12px; color: var(--text-faint); margin-left: auto; font-variant-numeric: tabular-nums; }
.news-title {
  font-size: 14.5px; font-weight: 650; line-height: 1.45; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-item a.news-title-link { text-decoration: none; color: inherit; }
.news-item a.news-title-link:hover .news-title { color: var(--accent); }
.news-summary {
  font-size: 12.5px; color: var(--text-soft); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.related {
  display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 4px;
}
.rel-chip {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid #dde7fe;
  display: inline-flex; align-items: center; gap: 3px;
}
.rel-chip::before { content: "🎮"; font-size: 10px; }

/* ---------- Footer ---------- */
.footer { margin-top: 26px; text-align: center; color: var(--text-faint); font-size: 12px; padding-bottom: 10px; }

/* ---------- Steam 可展开行 & 趋势抽屉面板 ---------- */
/* Steam 榜的 <li> 是外壳（steam-item），内部 .steam-row 才是内容行 */
#steamList.rank-list > li.steam-item {
  display: block;                    /* 覆盖 .rank-list li 的 flex，抽屉需要块级流 */
  padding: 0;                        /* 内层 .steam-row 自己 padding */
  height: auto;                      /* 覆盖通用 72px：外壳必须随趋势抽屉增高 */
  min-height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;                  /* auto 高度下不会裁掉抽屉，同时保持圆角 */
  transition: background .18s ease;
}
#steamList.rank-list > li.steam-item::after { display: none !important; } /* 关闭默认下划分隔 */
#steamList.rank-list > li.steam-item:not(:last-child) {
  border-bottom: 0;                    /* border 会把每行撑成 73px，造成逐行累计错位 */
  box-shadow: inset 0 -1px 0 var(--border-soft); /* 内描边不参与布局，实际行高仍为 72px */
  border-radius: 0;
}
#steamList.rank-list > li.steam-item:first-child { border-top-left-radius: var(--radius-sm); border-top-right-radius: var(--radius-sm); }
#steamList.rank-list > li.steam-item:last-child  { border-bottom-left-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
#steamList.rank-list > li.steam-item.open { background: linear-gradient(180deg, #fff5f5 0%, #fffafa 60%, #ffffff 100%); }

.steam-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 30px 10px 6px;
  position: relative;
  cursor: pointer;
  transition: background .15s ease;
  height: 72px;       /* 只锁可见榜单行；外层 steam-item 保持 auto 供抽屉展开 */
  box-sizing: border-box;
}
.steam-row:hover { background: #f7f9fd; }
.steam-item.open > .steam-row { background: transparent; }

.expand-chevron {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: #c0c6d4; font-size: 11px; transition: transform .25s ease, color .25s ease;
  pointer-events: none;
}
.steam-item.open .expand-chevron { transform: translateY(-50%) rotate(180deg); color: var(--up); }

/* 抽屉面板本体 —— 用 grid-template-rows 0fr↔1fr 做纯 CSS 高度动画 */
.trend-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .32s cubic-bezier(.4, 0, .2, 1);
}
.steam-item.open > .trend-panel { grid-template-rows: 1fr; }
.trend-panel-body {
  min-height: 0; overflow: hidden;
}
.steam-item.open > .trend-panel > .trend-panel-body {
  border-top: 1px dashed #e6e9f2;
  padding: 14px 14px 14px;
  background: linear-gradient(180deg, #fbfcff, #ffffff);
}

.trend-panel-inner { animation: fadeInUp .35s ease .05s both; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.trend-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 4px; flex-wrap: wrap;
}
.trend-title { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: .2px; }
.trend-stats { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-soft); flex-wrap: wrap; }
.trend-stats span b { color: var(--text); font-weight: 700; margin-left: 2px; }
.trend-change.up { color: #e23b3b; font-weight: 700; }
.trend-change.down { color: #17a34a; font-weight: 700; }
.trend-change.flat { color: var(--text-soft); }

.trend-chart-wrap { position: relative; margin-top: 6px; }
.trend-chart { width: 100%; height: auto; display: block; }
.trend-dot { cursor: pointer; }
.trend-dot:hover .dot-vis { r: 4; }
.trend-tooltip {
  position: absolute; pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  background: rgba(30, 34, 45, .94); color: #fff;
  padding: 6px 10px; border-radius: 6px;
  font-size: 11.5px; line-height: 1.4;
  white-space: nowrap; box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
  z-index: 5;
}
.trend-tooltip::after {
  content: ""; position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: rgba(30, 34, 45, .94);
}
.trend-tooltip .tt-time { opacity: .8; font-size: 10.5px; }
.trend-tooltip .tt-val { font-weight: 700; font-size: 13px; margin-top: 1px; }

.trend-empty {
  text-align: center; padding: 22px 12px; color: var(--text-soft);
}
.trend-empty-icon { font-size: 28px; margin-bottom: 6px; }
.trend-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }

/* ---------- 更多文章按钮 ---------- */
.news-more-wrap {
  display: flex; justify-content: center;
  margin-top: 16px; padding-top: 6px;
}
.news-more-btn {
  appearance: none; border: 1px solid var(--border);
  background: #fff; color: var(--text);
  padding: 10px 22px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all .18s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.news-more-btn:hover {
  background: var(--accent-soft);
  border-color: #d3ddf7; color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(59,108,246,.14);
}
.news-more-btn .more-count {
  color: var(--text-faint); font-weight: 500; font-size: 12.5px;
}
.news-more-btn:hover .more-count { color: var(--accent); }

/* ---------- 弹层 (Modal) ---------- */
body.modal-open { overflow: hidden; }
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: modalFade .18s ease;
}
.modal[hidden] { display: none; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(20, 22, 28, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-panel {
  position: relative;
  width: min(1120px, calc(100vw - 40px));
  max-height: calc(100vh - 60px);
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modalRise .22s cubic-bezier(.2,.7,.3,1);
}
@keyframes modalRise {
  from { transform: translateY(14px) scale(.985); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-head {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfd 0%, #ffffff 100%);
}
.modal-head h3 {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin-right: auto;
}
.modal-tabs {
  display: flex; gap: 4px;
  background: #f2f4f7; border-radius: 10px; padding: 4px;
}
.modal-tabs .tab {
  appearance: none; border: 0; background: transparent;
  padding: 6px 14px; border-radius: 7px;
  font-size: 12.5px; color: var(--text-soft);
  cursor: pointer; transition: all .15s ease;
}
.modal-tabs .tab:hover { color: var(--text); }
.modal-tabs .tab.active {
  background: #fff; color: var(--accent);
  box-shadow: var(--shadow-sm); font-weight: 600;
}
.modal-close {
  appearance: none; border: 0; background: transparent;
  width: 32px; height: 32px; border-radius: 8px;
  font-size: 16px; color: var(--text-soft); cursor: pointer;
  transition: all .15s ease;
}
.modal-close:hover { background: #f2f4f7; color: var(--text); }
.modal-body {
  padding: 20px 22px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-body .news-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-thumb {
  background: #d8dce4; border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover { background: #c0c5d0; }

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .grid.grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .grid, .grid.grid-3 { grid-template-columns: 1fr; }
  body { padding: 14px; }
  .topbar h1 { font-size: 20px; }
  .news-grid { grid-template-columns: 1fr; }
  .post-grid { grid-template-columns: 1fr; }
  .insights { flex-direction: column; align-items: flex-start; gap: 10px; }
  .trend-stats { gap: 10px; font-size: 11px; }
  .modal-panel { width: calc(100vw - 20px); max-height: calc(100vh - 30px); border-radius: 14px; }
  .modal-head { flex-wrap: wrap; padding: 12px 14px; }
  .modal-head h3 { width: 100%; margin-bottom: 4px; }
  .modal-body { padding: 14px; }
}

/* ---------- AI 解读卡片（榜单 / 资讯 共用） ---------- */
.ai-brief {
  position: relative;
  background: linear-gradient(135deg, #f7f5ff 0%, #ffffff 45%, #f0f9ff 100%);
  border: 1px solid #e2dcff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 18px;
  overflow: hidden;
}
.ai-brief::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(400px 120px at 10% 0%, rgba(139,92,246,.10), transparent 60%),
    radial-gradient(400px 120px at 100% 100%, rgba(59,130,246,.10), transparent 60%);
}
.ai-brief-inline { margin: 4px 0 12px; }  /* 资讯卡内使用时收紧外距 */

.ai-brief-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  position: relative; z-index: 1;
}
.ai-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  background: linear-gradient(90deg, #8b5cf6, #6366f1);
  color: #fff; font-size: 12px; font-weight: 700;
  letter-spacing: .2px; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(99,102,241,.25);
}
.ai-icon { font-size: 13px; }
.ai-brief-title {
  font-weight: 700; font-size: 15px; color: var(--text);
  flex: 1 1 auto; line-height: 1.45;
}
.ai-brief-meta {
  font-size: 12px; color: var(--text-faint); white-space: nowrap;
}

.ai-brief-body {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 12px; position: relative; z-index: 1;
}
.ai-brief-col:empty { display: none; }
.ai-brief-body:has(.ai-brief-col:only-child),
.ai-brief-body:has(.ai-brief-col:empty) { grid-template-columns: 1fr; }

.ai-brief-section {
  background: rgba(255,255,255,.7);
  border: 1px solid rgba(139,92,246,.14);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.ai-brief-section-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: #6366f1;
  margin-bottom: 6px; letter-spacing: .3px;
}
.ai-brief-section-icon { font-size: 13px; }

.ai-brief-item + .ai-brief-item { margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(139,92,246,.15); }
.ai-brief-item-title {
  font-size: 13px; font-weight: 700; color: var(--text);
  margin-bottom: 2px;
}
.ai-brief-item-text {
  font-size: 13px; color: var(--text-soft); line-height: 1.55;
}

@media (max-width: 720px) {
  .ai-brief { padding: 13px 14px; }
  .ai-brief-body { grid-template-columns: 1fr; gap: 10px; }
  .ai-brief-title { font-size: 14px; }
}
