/* TrendTide TT · 设计令牌（北极星：全网热点雷达控制台——冷静、精密、有呼吸感）
   样式只准消费这里的令牌，禁止在组件里写裸色值/裸间距 */
:root {
  --bg: #050810;
  --panel: rgba(13, 20, 36, 0.72);
  --panel-solid: #0b1220;
  --line: rgba(120, 160, 255, 0.10);
  --line-strong: rgba(34, 211, 238, 0.35);

  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --ok: #34d399;
  --degrade: #fbbf24;
  --err: #f87171;
  --text: #e6edf7;
  --muted: #8a97ad;

  --fs1: 20px;  /* 标题 */
  --fs2: 14px;  /* 正文 */
  --fs3: 12px;  /* 辅助 */
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;

  --r1: 10px; --r2: 14px; --r3: 18px;
  --sp1: 4px; --sp2: 8px; --sp3: 12px; --sp4: 16px; --sp5: 24px; --sp6: 32px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 200ms;
  --content-w: 1480px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font: var(--fs2)/1.6 "Microsoft YaHei UI", "PingFang SC", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 深空底色：径向霓虹辉光 + 极淡网格 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(600px 400px at 12% -4%, rgba(34, 211, 238, 0.10), transparent 70%),
    radial-gradient(700px 500px at 88% 8%, rgba(139, 92, 246, 0.10), transparent 70%),
    radial-gradient(900px 600px at 50% 110%, rgba(34, 211, 238, 0.06), transparent 70%),
    var(--bg);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 160, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 160, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 30%, transparent 75%);
}

#bg-canvas { position: fixed; inset: 0; z-index: -1; opacity: 0.5; pointer-events: none; }

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); }

/* ---------- 品牌栏（随页滚动） ---------- */
.topbar { border-bottom: 1px solid var(--line); background: rgba(5, 8, 16, 0.55); }
.topbar-inner {
  max-width: var(--content-w); margin: 0 auto;
  padding: var(--sp3) var(--sp5);
  display: flex; align-items: center; gap: var(--sp4);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--sp4); }

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none !important; }
.logo-glyph {
  font-size: 22px; line-height: 1;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.45));
}
.logo-text { font-size: var(--fs1); font-weight: 700; letter-spacing: 0.5px; color: var(--text); }
.logo-text b {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo-chip {
  font-size: var(--fs3); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 10px; letter-spacing: 2px;
}
.clock { font-size: var(--fs2); color: var(--muted); letter-spacing: 1px; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs3); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(11, 18, 32, 0.7);
  padding: 4px 14px; white-space: nowrap;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: var(--fs2); color: var(--text);
  background: var(--panel-solid);
  border: 1px solid var(--line); border-radius: var(--r1);
  padding: 7px 14px; cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:hover { border-color: var(--line-strong); box-shadow: 0 0 14px rgba(34, 211, 238, 0.18); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(139, 92, 246, 0.16));
  border-color: rgba(34, 211, 238, 0.35);
}
.btn-sm { padding: 4px 12px; font-size: var(--fs3); }
.btn[disabled] { opacity: 0.5; cursor: wait; }

/* ---------- 工具栏（吸附：Tab + 元信息 + 过滤 + 刷新） ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(5, 8, 16, 0.82);
  border-bottom: 1px solid var(--line);
}
.toolbar-inner {
  max-width: var(--content-w); margin: 0 auto;
  padding: var(--sp2) var(--sp5);
  display: flex; align-items: center; gap: var(--sp4);
  min-height: 52px;
}

/* 分组 Tab */
.tabs { position: relative; display: flex; gap: 4px; }
.tab {
  position: relative; z-index: 1;
  font: inherit; font-size: var(--fs2); color: var(--muted);
  background: none; border: none; cursor: pointer;
  padding: 7px 16px; border-radius: var(--r1);
  transition: color var(--dur) var(--ease);
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-pressed="true"] { color: #061018; font-weight: 600; }
.tab-slider {
  position: absolute; top: 0; left: 0; height: 100%; z-index: 0;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  border-radius: var(--r1);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.35);
  transition: transform var(--dur) var(--ease), width var(--dur) var(--ease);
}

.toolbar-meta {
  margin-left: auto;
  display: flex; align-items: center; gap: var(--sp2);
  font-size: var(--fs3); color: var(--muted); white-space: nowrap;
}
.toolbar-meta .sep { opacity: 0.45; }

.searchbox {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: var(--r1);
  background: var(--panel-solid); padding: 6px 12px; width: 240px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.searchbox:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15); }
.search-icon { color: var(--muted); }
.searchbox input {
  background: none; border: none; outline: none; color: var(--text);
  font: inherit; font-size: var(--fs2); width: 100%;
}
.searchbox input::placeholder { color: var(--muted); }

/* ---------- 卡片网格 ---------- */
.grid {
  max-width: var(--content-w); margin: var(--sp4) auto var(--sp6); padding: 0 var(--sp5);
  display: grid; gap: var(--sp4);
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}
.card {
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: var(--sp4);
  display: flex; flex-direction: column; gap: var(--sp3);
  min-width: 0; /* 网格项允许收缩：防止 nowrap 简介把 1fr 轨道撑爆（375px 溢出根因） */
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  animation: card-in 0.45s var(--ease) backwards;
}
@keyframes card-in { from { opacity: 0; transform: translateY(12px); } }
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(34, 211, 238, 0.30);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45), 0 0 22px rgba(34, 211, 238, 0.10);
}
.card.hidden { display: none; }

.card-head { display: flex; align-items: center; gap: var(--sp3); }
.badge {
  width: 38px; height: 38px; border-radius: var(--r1); flex: none;
  display: grid; place-items: center;
  font-size: 17px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.card-title { min-width: 0; }
.card-title a {
  color: var(--text); font-weight: 600; font-size: 15px;
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-title a:hover { color: var(--cyan); text-decoration: none; }
.card-sub { font-size: var(--fs3); color: var(--muted); display: flex; align-items: center; gap: 8px; min-width: 0; }
.card-sub span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.card-refresh {
  font: inherit; font-size: 15px; line-height: 1; color: var(--muted);
  background: none; border: 1px solid transparent; border-radius: var(--r1);
  width: 30px; height: 30px; cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card-refresh:hover { color: var(--cyan); border-color: var(--line); }
.card-refresh.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 榜单 */
.rank-list { list-style: none; display: flex; flex-direction: column; flex: 1; }
.rank-item {
  display: flex; align-items: baseline; gap: 10px;
  padding: 6px; margin: 0 -6px; border-radius: 8px;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.rank-item:hover { background: rgba(34, 211, 238, 0.06); transform: translateX(3px); }
.rank-no {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center; align-self: center;
  font-family: var(--mono); font-size: var(--fs3); color: var(--muted);
  background: rgba(120, 160, 255, 0.08);
}
.rank-no.top1 { background: linear-gradient(135deg, #f7c948, #f59e0b); color: #241a00; font-weight: 700; box-shadow: 0 0 10px rgba(245, 158, 11, 0.45); }
.rank-no.top2 { background: linear-gradient(135deg, #67e8f9, #0891b2); color: #00212b; font-weight: 700; }
.rank-no.top3 { background: linear-gradient(135deg, #c4b5fd, #7c3aed); color: #170a33; font-weight: 700; }
.rank-body { min-width: 0; flex: 1; }
.rank-title {
  display: block; color: var(--text); font-size: var(--fs2); line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rank-item:hover .rank-title { color: var(--cyan); }
.rank-summary {
  display: block; color: var(--muted); font-size: var(--fs3); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rank-hot {
  flex: none; font-family: var(--mono); font-size: var(--fs3);
  font-variant-numeric: tabular-nums;
  color: rgba(34, 211, 238, 0.75); align-self: center;
}

.card-more {
  font: inherit; font-size: var(--fs3); color: var(--muted);
  background: none; border: 1px dashed var(--line); border-radius: var(--r1);
  padding: 6px; cursor: pointer; margin-top: auto;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card-more:hover { color: var(--cyan); border-color: var(--line-strong); }

/* 状态块 */
.state-block {
  border: 1px dashed var(--line); border-radius: var(--r1);
  padding: var(--sp4); font-size: var(--fs3); color: var(--muted); line-height: 1.7;
}
.state-block .state-title { color: var(--text); font-size: var(--fs2); display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.state-block.warn { border-color: rgba(251, 191, 36, 0.35); }
.state-block.error { border-color: rgba(248, 113, 113, 0.35); }
.state-block .btn { margin-top: 10px; }
.state-block.empty { display: flex; align-items: center; gap: 8px; border: none; padding: var(--sp3) 6px; }
.empty-icon { color: var(--muted); font-size: 15px; }

/* 骨架屏 */
.skeleton { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.sk-row { position: relative; overflow: hidden; height: 14px; border-radius: 6px; background: rgba(120, 160, 255, 0.07); }
.sk-row::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.10), transparent);
  animation: shimmer 1.6s infinite;
  transform: translateX(-100%);
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 50; max-width: min(90vw, 480px);
  background: var(--panel-solid); border: 1px solid var(--line-strong);
  border-radius: var(--r2); padding: 10px 18px;
  font-size: var(--fs2); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ---------- 页脚 ---------- */
.footer {
  max-width: var(--content-w); margin: 0 auto; padding: var(--sp5);
  border-top: 1px solid var(--line);
  font-size: var(--fs3); color: var(--muted); line-height: 1.9; text-align: center;
}
.footer-dim { opacity: 0.65; }

/* ---------- 可访问性 ---------- */
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .toolbar-meta { display: none; }
  .searchbox { margin-left: auto; }
}
@media (max-width: 768px) {
  .topbar-inner, .toolbar-inner, .grid, .footer { padding-left: var(--sp4); padding-right: var(--sp4); }
  .grid { grid-template-columns: 1fr; }
  .logo-chip { display: none; }
  .clock { display: none; }
  .toolbar-inner { flex-wrap: wrap; row-gap: var(--sp2); padding-top: var(--sp3); padding-bottom: var(--sp3); }
  .tabs { order: 1; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .searchbox { order: 2; flex: 1; width: auto; margin-left: 0; }
  .btn-primary { order: 3; flex: none; }
  .rank-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .rank-item:hover { transform: none; }
}
