:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e7ebf3;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef2ff;
  --domestic: #10b981;
  --international: #6366f1;
  --chip: #eef1f7;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(79, 70, 229, .18);
}

html[data-theme="dark"] {
  --bg: #090e1d;
  --card: #121a2e;
  --ink: #e8edf7;
  --muted: #93a1bd;
  --line: #243049;
  --brand: #818cf8;
  --brand-2: #a855f7;
  --brand-soft: #1b2340;
  --domestic: #34d399;
  --international: #a78bfa;
  --chip: #1a2440;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 12px 40px rgba(129, 140, 248, .25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background:
    radial-gradient(1100px 480px at 85% -12%, rgba(124, 58, 237, .12), transparent 60%),
    radial-gradient(900px 420px at -5% 0%, rgba(79, 70, 229, .10), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  transition: background-color .3s ease, color .3s ease;
}

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ---------- Topbar（玻璃渐变 + 光晕） ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  color: #fff;
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 100%);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow-lg);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #e9e6ff);
  color: var(--brand);
  font-weight: 800;
  font-size: 19px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: .5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2), inset 0 0 0 1px rgba(255, 255, 255, .5);
}
.topbar h1 { margin: 0; font-size: 20px; color: #fff; letter-spacing: .3px; }
.subtitle { margin: 2px 0 0; color: rgba(255, 255, 255, .82); font-size: 13px; }

.actions { display: flex; align-items: center; gap: 10px; }
.updated { color: rgba(255, 255, 255, .82); font-size: 12.5px; white-space: nowrap; }

.btn {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: transform .12s ease, opacity .15s ease, background .2s ease;
}
.btn:hover { opacity: .92; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }

.topbar .btn {
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .35);
  color: #fff;
  backdrop-filter: blur(6px);
}
.topbar .btn:hover { background: rgba(255, 255, 255, .28); opacity: 1; }

/* ---------- 统计概览条 ---------- */
.stats {
  max-width: 920px;
  margin: 20px auto 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stat {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow);
}
.stat::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(var(--brand), var(--brand-2));
}
.stat-num {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label { font-size: 12.5px; color: var(--muted); }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px 4px;
}
.tabs { display: flex; gap: 8px; }
.tab {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  padding: 7px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  transition: all .15s ease;
}
.tab:hover { border-color: var(--brand); color: var(--brand); }
.tab.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .25);
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.search, .select {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search { width: 220px; }
.search:focus, .select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 24px 4px; }
.chip {
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--muted);
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s ease;
}
.chip:hover { color: var(--ink); }
.chip.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .22);
}

/* ---------- List ---------- */
main { max-width: 920px; margin: 0 auto; padding: 16px 24px 40px; }
.status {
  color: var(--muted);
  font-size: 14px;
  padding: 8px 2px 14px;
  min-height: 20px;
}
.status.warn { color: #b45309; }

.news-list { list-style: none; margin: 0; padding: 0; }
.news-item {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  animation: fadeUp .35s ease both;
}
.news-item.domestic { border-left-color: var(--domestic); }
.news-item.international { border-left-color: var(--international); }
.news-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}
.item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.badge {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.domestic { background: rgba(16, 185, 129, .12); color: var(--domestic); }
.badge.international { background: rgba(99, 102, 241, .12); color: var(--international); }
.badge.cat { color: var(--muted); font-weight: 500; }
.source { font-size: 13px; color: var(--muted); }
.time { font-size: 12px; color: var(--muted); margin-left: auto; }
.item-title { font-size: 16px; font-weight: 600; margin: 2px 0 6px; line-height: 1.45; }
.news-item:hover .item-title { color: var(--brand); }
.item-summary {
  font-size: 13.5px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.empty { text-align: center; color: var(--muted); padding: 48px 12px; font-size: 14px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

/* ---------- 设置入口 & 来源配置面板 ---------- */
.icon-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  width: 38px; height: 38px;
  border-radius: 10px;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: all .15s ease;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); }

.topbar .icon-btn {
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .3);
  color: #fff;
}
.topbar .icon-btn:hover { background: rgba(255, 255, 255, .26); color: #fff; border-color: rgba(255, 255, 255, .5); }

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); }
.modal-box {
  position: relative;
  background: var(--card);
  width: min(720px, 94vw);
  max-height: 88vh;
  overflow: auto;
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
  border: 1px solid var(--line);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-tip { color: var(--muted); font-size: 13px; margin: 6px 0 14px; line-height: 1.5; }
.feed-editor { display: flex; flex-direction: column; gap: 8px; }
.feed-row { display: grid; grid-template-columns: 150px 110px 1fr 56px; gap: 8px; align-items: center; }
.feed-row input, .feed-row select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 14px;
  outline: none;
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.feed-row input:focus, .feed-row select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.row-del {
  border: 1px solid var(--line);
  background: var(--card);
  color: #dc2626;
  border-radius: 10px;
  padding: 9px 0;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s ease;
}
.row-del:hover { background: #fef2f2; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.modal-actions .spacer { flex: 1; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.btn.ghost { background: var(--card); color: var(--brand); border: 1px solid var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .search { width: 100%; }
  .filters { width: 100%; }
  .filters .select { flex: 1; }
  .feed-row { grid-template-columns: 1fr 1fr; }
  .feed-row .f-url { grid-column: 1 / -1; }
}
