:root {
  --brand: #FF0230;
  --brand-deep: #9B111E;
  --gold: #D9700A;
  --bg: #f4f4f5;
  --panel: #ffffff;
  --panel-2: #fff8f1;
  --text: #1d1b1c;
  --sub: #6f646a;
  --border: #ece9ea;
  --chip: #fdeaea;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
  --safe-top: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #140f0e;
    --panel: #221a18;
    --panel-2: #2c201d;
    --text: #f3ece9;
    --sub: #b3a39d;
    --border: #3a2f2b;
    --chip: #3a2422;
    --shadow: 0 2px 12px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.app { max-width: 720px; margin: 0 auto; min-height: 100vh; background: var(--bg); }

/* 顶部栏 */
.topbar {
  position: sticky; top: 0; z-index: 30;
  padding: calc(10px + var(--safe-top)) 14px 8px;
  background: linear-gradient(120deg, var(--brand), var(--brand-deep));
  color: #fff; box-shadow: var(--shadow);
}
.topbar .row1 { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 20px; font-weight: 800; letter-spacing: 1px; display: flex; align-items: center; gap: 6px; }
.logo .badge { font-size: 11px; background: rgba(255,255,255,.2); padding: 2px 6px; border-radius: 6px; font-weight: 600; }
.date { margin-left: auto; font-size: 12px; opacity: .9; }
.searchbox {
  margin-top: 10px; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.95); border-radius: 20px; padding: 7px 14px; color: #555;
}
.searchbox input { border: 0; outline: 0; flex: 1; font-size: 14px; background: transparent; color: #222; }
.searchbox .clear { cursor: pointer; font-size: 16px; color: #999; display: none; }
.searchbox .clear.show { display: inline; }
.searchbox .arch-btn { cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; filter: grayscale(.1); }
.searchbox .arch-btn:active { transform: scale(.9); }

/* 分类 Tabs */
.tabs {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 4px; overflow-x: auto; padding: 8px 10px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 6px 13px; border-radius: 16px; font-size: 14px;
  color: var(--sub); background: transparent; border: 0; cursor: pointer; white-space: nowrap;
  font-weight: 600; transition: .15s;
}
.tab.active { background: var(--brand); color: #fff; }

/* 信息流 */
.feed { padding: 10px 12px 40px; }
.feed-meta { font-size: 12px; color: var(--sub); padding: 4px 2px 10px; }
.card {
  background: var(--panel); border-radius: 14px; padding: 13px 14px; margin-bottom: 11px;
  box-shadow: var(--shadow); border-left: 4px solid var(--brand); cursor: pointer;
  transition: transform .12s;
}
.card:active { transform: scale(.99); }
.card .chead { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.cat-chip { font-size: 11px; padding: 2px 8px; border-radius: 6px; color: #fff; font-weight: 700; }
.impact { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.impact.机会 { background: #e7f6ec; color: #1a8a4a; }
.impact.风险 { background: #fdeaea; color: var(--brand); }
.impact.观察 { background: #fff4e3; color: var(--gold); }
.card .title { font-size: 16px; font-weight: 700; line-height: 1.4; margin: 2px 0 6px; }
.card .meta { font-size: 12px; color: var(--sub); margin-bottom: 7px; }
.card .summary {
  font-size: 13.5px; color: var(--text); opacity: .92; margin: 0 0 9px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card .foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--brand); font-weight: 600; }
.card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tag { font-size: 11px; color: var(--sub); background: var(--chip); padding: 1px 7px; border-radius: 5px; }

/* 详情弹层 */
.detail-mask {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45);
  display: none; align-items: flex-end;
}
.detail-mask.show { display: flex; }
.detail {
  background: var(--panel); width: 100%; max-width: 720px; margin: 0 auto;
  border-radius: 18px 18px 0 0; max-height: 88vh; overflow-y: auto;
  padding: 18px 18px calc(24px + env(safe-area-inset-bottom,0px));
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.detail .dhead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.detail .dtitle { font-size: 19px; font-weight: 800; line-height: 1.4; margin: 6px 0 10px; }
.detail .dmeta { font-size: 12.5px; color: var(--sub); margin-bottom: 12px; }
.detail .dsummary { font-size: 15px; line-height: 1.75; color: var(--text); }
.detail .dtags { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.detail .orig {
  display: block; text-align: center; background: var(--brand); color: #fff;
  padding: 12px; border-radius: 12px; font-size: 15px; font-weight: 700; text-decoration: none; margin-top: 8px;
}
.detail .close { margin-left: auto; font-size: 22px; color: var(--sub); cursor: pointer; line-height: 1; }

/* 我的偏好浮标 */
.fab {
  position: fixed; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom,0px)); z-index: 40;
  width: 46px; height: 46px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 4px 14px rgba(155,17,30,.4);
  cursor: pointer; border: 0;
}
.pref-mask { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: none; align-items: flex-end; }
.pref-mask.show { display: flex; }
.pref { background: var(--panel); width: 100%; max-width: 720px; margin: 0 auto; border-radius: 18px 18px 0 0; padding: 18px; max-height: 80vh; overflow-y: auto; }
.pref h3 { margin: 0 0 12px; font-size: 16px; }
.pref .prow { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.pref .bar { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.pref .bar > i { display: block; height: 100%; background: var(--brand); }
.pref .clearbtn { margin-top: 6px; font-size: 13px; color: var(--brand); background: none; border: 0; cursor: pointer; }
.empty { text-align: center; color: var(--sub); padding: 40px 0; font-size: 14px; }
footer.footnote { text-align: center; color: var(--sub); font-size: 11px; padding: 14px; line-height: 1.7; }

/* 往期回顾 */
.arch-mask { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.45); display: none; align-items: flex-end; }
.arch-mask.show { display: flex; }
.arch {
  background: var(--panel); width: 100%; max-width: 720px; margin: 0 auto;
  border-radius: 18px 18px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom,0px));
  max-height: 82vh; overflow-y: auto; animation: slideUp .22s ease;
}
.arch-head { display: flex; align-items: center; font-size: 16px; font-weight: 800; margin-bottom: 2px; }
.arch-head .arch-close { margin-left: auto; font-size: 22px; color: var(--sub); cursor: pointer; line-height: 1; }
.arch-sub { font-size: 12px; color: var(--sub); margin-bottom: 12px; }
.arch-item {
  display: flex; flex-direction: column; gap: 3px; padding: 12px 14px;
  border-radius: 12px; background: var(--panel-2); margin-bottom: 8px; cursor: pointer;
  border: 2px solid transparent; transition: transform .12s;
}
.arch-item:active { transform: scale(.99); }
.arch-item.cur { border-color: var(--brand); }
.arch-date { font-size: 15px; font-weight: 700; }
.arch-sub2 { font-size: 12px; color: var(--sub); }
.back-latest { color: var(--brand); font-weight: 700; cursor: pointer; }
