/* =====================================================
   头条 Radar —— 类 Telegram 频道流的信息流 UI
   浅色 / 深色双主题（TG 配色），纯 CSS 无框架
   ===================================================== */

:root {
  --bg: #eef2f6;
  --card: #ffffff;
  --text: #17212b;
  --muted: #70818f;
  --line: #e3e9ef;
  --accent: #2481cc;
  --accent-2: #38bdf8;
  --chip: #eaf2fa;
  --heat: #e8590c;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(23, 33, 43, .05), 0 4px 16px rgba(23, 33, 43, .06);
  --shadow-hover: 0 4px 10px rgba(23, 33, 43, .08), 0 12px 32px rgba(23, 33, 43, .10);
}

html[data-theme="dark"] {
  --bg: #0e1621;
  --card: #17212b;
  --text: #e8edf3;
  --muted: #7f91a4;
  --line: #22303d;
  --accent: #5ab3f0;
  --accent-2: #38bdf8;
  --chip: #1d2a38;
  --heat: #ff8a4c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 4px 16px rgba(0, 0, 0, .18);
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .28);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) { --bg: #0e1621; --card: #17212b; --text: #e8edf3; --muted: #7f91a4;
    --line: #22303d; --accent: #5ab3f0; --accent-2: #38bdf8; --chip: #1d2a38; --heat: #ff8a4c;
    --shadow: 0 1px 2px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.18);
    --shadow-hover: 0 4px 10px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.28); }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent); color: #fff; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  width: min(680px, 100% - 24px); margin: 0 auto;
  display: flex; align-items: center; gap: 16px; height: 56px;
}
.brand {
  font-size: 17px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px; letter-spacing: .3px;
}
.brand:hover { text-decoration: none; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.tabs { display: flex; gap: 6px; margin-left: 8px; }
.tabs a {
  padding: 5px 14px; border-radius: 999px; font-size: 14px;
  color: var(--muted); font-weight: 500;
}
.tabs a:hover { color: var(--text); text-decoration: none; background: var(--chip); }
.tabs a.active { background: var(--accent); color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #34c759; animation: pulse 2s infinite; }
.live-dot.off { background: var(--muted); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, .5); }
  70% { box-shadow: 0 0 0 7px rgba(52, 199, 89, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}
.icon-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 15px;
  display: grid; place-items: center; transition: all .2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }

/* ---------- 信息流 ---------- */
.wrap { width: min(680px, 100% - 24px); margin: 20px auto 40px; }
.date-chip {
  position: sticky; top: 64px; z-index: 5;
  width: fit-content; margin: 18px auto 10px; padding: 3px 14px;
  font-size: 12.5px; color: var(--muted); background: color-mix(in srgb, var(--card) 85%, transparent);
  backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 999px;
}

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px 12px; margin-bottom: 14px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  transition: transform .18s ease, box-shadow .18s ease;
  animation: fade-in .3s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

.card-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.src-name { color: var(--text); font-weight: 600; }
.sep { opacity: .6; }
.badge {
  font-size: 11px; padding: 1px 7px; border-radius: 6px; font-weight: 600; letter-spacing: .3px;
}
.badge.tg { background: color-mix(in srgb, #2481cc 14%, transparent); color: #2481cc; }
.badge.web { background: color-mix(in srgb, #9c6ade 14%, transparent); color: #9c6ade; }
.badge.tg, .badge.web { color: color-mix(in srgb, currentColor 100%, transparent); }
html[data-theme="dark"] .badge.tg { color: #5ab3f0; }
html[data-theme="dark"] .badge.web { color: #b98ef5; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
  background: linear-gradient(135deg, hsl(var(--h, 210) 62% 48%), hsl(calc(var(--h, 210) + 40) 62% 40%));
}
.avatar.sm { width: 30px; height: 30px; font-size: 13px; }

.multi-src {
  margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--heat);
  background: color-mix(in srgb, var(--heat) 10%, transparent);
  width: fit-content; padding: 2px 10px; border-radius: 999px;
}
.card-title { font-size: 17px; line-height: 1.45; margin: 10px 0 6px; font-weight: 650; }
.card-summary {
  margin: 0 0 10px; color: var(--muted); font-size: 14px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.cover img, .cover { border-radius: 12px; overflow: hidden; }
.cover img { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; }

.album { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; border-radius: 12px; overflow: hidden; }
.album img { width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; cursor: zoom-in; }
.album.large { grid-template-columns: repeat(3, 1fr); }

.card-video, .detail-video { width: 100%; border-radius: 12px; margin-top: 8px; background: #000; }

.card-foot {
  display: flex; align-items: center; gap: 16px; margin-top: 12px;
  font-size: 13px; color: var(--muted);
}
.card-foot .heat { color: var(--heat); font-weight: 600; }
.card-foot .origin { margin-left: auto; }

.load-more-wrap { display: grid; place-items: center; margin: 20px 0; }
.load-more {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  padding: 9px 32px; border-radius: 999px; cursor: pointer; font-size: 14px;
  transition: all .2s; box-shadow: var(--shadow);
}
.load-more:hover { color: var(--accent); border-color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* ---------- 新消息提醒 ---------- */
.new-pill {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  z-index: 50; border: none; cursor: pointer;
  padding: 8px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 24px color-mix(in srgb, var(--accent) 45%, transparent);
  animation: drop-in .35s ease;
  transition: transform .15s;
}
.new-pill:hover { transform: translateX(-50%) scale(1.04); }
.hidden { display: none !important; }
@keyframes drop-in { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; } }

/* ---------- 详情页 ---------- */
.detail { width: min(760px, 100% - 24px); margin: 20px auto 40px; }
.back { display: inline-block; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.detail-card { cursor: default; padding: 20px 22px; }
.detail-title { font-size: 24px; line-height: 1.35; margin: 14px 0 10px; }
.detail-meta {
  display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13.5px; color: var(--muted);
  padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px;
}
.detail-body p { font-size: 16px; line-height: 1.85; margin: 0 0 14px; white-space: pre-wrap; }

.siblings { margin-top: 18px; background: var(--chip); border-radius: 12px; padding: 14px; }
.siblings h3 { margin: 0 0 8px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.sib {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 10px; color: var(--text); font-size: 14px;
}
.sib:hover { background: var(--card); text-decoration: none; }
.sib-src { color: var(--muted); flex: none; font-size: 13px; }
.sib-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.comments { margin-top: 18px; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; border: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.comments h2 { font-size: 15px; margin: 0 0 6px; }
.comment { display: flex; gap: 10px; padding: 13px 0; border-top: 1px solid var(--line); }
.comment:first-of-type { border-top: none; }
.c-main { min-width: 0; flex: 1; }
.c-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--muted); }
.c-name { color: var(--text); font-weight: 600; }
.c-user { opacity: .75; }
.c-text { margin-top: 3px; font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

/* ---------- 灯箱 / 页脚 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(8, 12, 18, .88);
  display: grid; place-items: center; cursor: zoom-out; padding: 24px;
}
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 12px; }

.footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 28px 16px 40px; }

@media (max-width: 480px) {
  .detail-title { font-size: 20px; }
  .album.large { grid-template-columns: 1fr 1fr; }
  .tabs { gap: 2px; }
  .tabs a { padding: 5px 10px; }
}
