/* =========================================================
   每日热榜看板 · 莫兰迪低饱和风格
   主色 #5b4b95 · 辅助 #9162a7 · 强调 #b69849
   背景 #f9f8fb · 卡片 #ffffff · 正文 #1f1b2c · 次要 #635c7a · 描边 #dddbe6
   圆角 14px · 衬线标题 + 无衬线正文 · 柔和阴影 + 细描边 + 极淡噪点
   ========================================================= */

:root {
  --c-primary: #5b4b95;
  --c-accent: #9162a7;
  --c-cta: #b69849;
  --c-bg: #f9f8fb;
  --c-surface: #ffffff;
  --c-text: #1f1b2c;
  --c-muted: #635c7a;
  --c-border: #dddbe6;

  --c-primary-soft: rgba(91, 75, 149, 0.07);
  --c-primary-softer: rgba(91, 75, 149, 0.04);
  --c-cta-soft: rgba(182, 152, 73, 0.12);
  --c-accent-soft: rgba(145, 98, 167, 0.10);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(31, 27, 44, 0.04), 0 10px 28px rgba(31, 27, 44, 0.06);
  --shadow-lift: 0 2px 4px rgba(31, 27, 44, 0.06), 0 16px 40px rgba(31, 27, 44, 0.10);

  --font-serif: 'Noto Serif SC', 'Songti SC', Georgia, 'Times New Roman', serif;
  --font-body: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;

  --header-h: 76px;
}

html[data-theme="dark"] {
  --c-bg: #15131c;
  --c-surface: #1d1a28;
  --c-text: #e9e6f2;
  --c-muted: #a49cc2;
  --c-border: #2f2b3f;

  --c-primary-soft: rgba(148, 130, 208, 0.12);
  --c-primary-softer: rgba(148, 130, 208, 0.06);
  --c-cta-soft: rgba(196, 168, 96, 0.14);
  --c-accent-soft: rgba(176, 132, 200, 0.12);

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 10px 28px rgba(0, 0, 0, 0.32);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.3), 0 16px 40px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.35s ease, color 0.35s ease;
  min-height: 100vh;
}

/* 极淡噪点 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.container {
  width: min(1180px, 100% - 48px);
  margin-inline: auto;
}

.serif { font-family: var(--font-serif); }

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 99;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--c-primary);
  color: #fff;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 16px; }

/* ---------- 头部 ---------- */
.site-header {
  padding: 44px 0 30px;
}

.header-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.brand-overline {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--c-cta);
  font-weight: 600;
}

.brand-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(30px, 4.4vw, 42px);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  color: var(--c-text);
}

.brand-sub {
  margin: 10px 0 0;
  color: var(--c-muted);
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-muted);
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}
.icon-btn:hover {
  color: var(--c-primary);
  border-color: var(--c-primary);
  box-shadow: var(--shadow);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn .icon { width: 20px; height: 20px; }

html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: none; }
html[data-theme="dark"] .icon-moon,
html[data-theme="light"] .icon-sun { display: block; animation: spin-in 0.35s ease; }
@keyframes spin-in { from { transform: rotate(-90deg) scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--c-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
}
.header-link:hover { color: var(--c-primary); border-color: var(--c-primary); }

/* ---------- 卡片基础 ---------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- 平台 Tab ---------- */
.tabs {
  display: flex;
  gap: 6px;
  padding: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--c-border) transparent;
  margin-bottom: 20px;
}

.tab {
  flex: 1 0 auto;
  min-width: 108px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--c-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}
.tab:hover { color: var(--c-primary); background: var(--c-primary-softer); }
.tab:active { transform: translateY(1px); }

.tab[aria-selected="true"] {
  background: var(--c-primary);
  color: #fbfaff;
  box-shadow: 0 4px 14px rgba(91, 75, 149, 0.30);
}

.tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search {
  position: relative;
  flex: 1 1 300px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--c-muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 12px 84px 12px 46px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  outline: none;
  box-shadow: var(--shadow);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.search input::placeholder { color: var(--c-muted); opacity: 0.7; }
.search input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft), var(--shadow);
}

.search kbd {
  position: absolute;
  right: 14px;
  padding: 2px 7px;
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--c-muted);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: var(--c-bg);
  user-select: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }

.btn-cta {
  background: var(--c-cta);
  color: #2a2311;
}
.btn-cta:hover { box-shadow: 0 6px 18px rgba(182, 152, 73, 0.35); }
.btn-cta.is-done { background: var(--c-primary); color: #fbfaff; }
.btn-cta.is-done svg { display: none; }

.btn-ghost {
  border-color: var(--c-border);
  color: var(--c-muted);
  background: var(--c-surface);
}
.btn-ghost:hover { border-color: var(--c-primary); color: var(--c-primary); }

/* ---------- 日期行 ---------- */
.days {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.days-label {
  flex: 0 0 auto;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--c-muted);
  margin-right: 4px;
}

.day-pill {
  flex: 0 0 auto;
  padding: 5px 13px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--c-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.day-pill:hover { color: var(--c-primary); border-color: var(--c-primary); }
.day-pill[aria-pressed="true"] {
  background: var(--c-primary-soft);
  color: var(--c-primary);
  border-color: var(--c-primary);
  font-weight: 600;
}

/* ---------- 主布局 ---------- */
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

/* ---------- 榜单 ---------- */
.list { padding: 24px 26px 18px; }

.list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.card-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.list-meta { margin: 4px 0 0; font-size: 12.5px; color: var(--c-muted); }

.count-badge {
  flex: 0 0 auto;
  padding: 4px 12px;
  font-size: 12.5px;
  color: var(--c-primary);
  background: var(--c-primary-soft);
  border-radius: 999px;
  font-weight: 600;
  margin-top: 4px;
}

.list-items {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  counter-reset: rank;
}

.item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 12px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--c-border);
  transition: background 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
  animation: rise-in 0.45s ease both;
  animation-delay: calc(var(--i, 0) * 26ms);
}
.list-items li:last-child .item { border-bottom: none; }

.item:hover {
  background: var(--c-primary-softer);
  transform: translateX(3px);
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.rank {
  flex: 0 0 40px;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--c-muted);
}

.item:nth-child(-n+3) .rank {
  color: var(--c-cta);
  position: relative;
}

.item-title {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-serif);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--c-text);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: left 92%;
  transition: background-size 0.35s ease, color 0.25s ease;
}
.item-title:hover { color: var(--c-primary); background-size: 100% 1px; }

.item-heat {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12.5px;
  color: var(--c-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.item-heat::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c-cta);
  align-self: center;
  opacity: 0.8;
}

.item-link {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--c-muted);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}
.item-link:hover { background: var(--c-surface); color: var(--c-primary); box-shadow: var(--shadow); }
.item-link svg { width: 14px; height: 14px; }

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--c-muted);
}
.empty-icon {
  font-family: var(--font-serif);
  font-size: 40px;
  line-height: 1;
  color: var(--c-border);
  margin: 0 0 10px;
}
.empty p { margin: 0 0 18px; }

/* 骨架屏 */
.skeleton-item {
  height: 58px;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  background: linear-gradient(90deg, var(--c-primary-softer) 25%, var(--c-accent-soft) 50%, var(--c-primary-softer) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.list-foot {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--c-muted);
  text-align: right;
}

/* ---------- 词云 ---------- */
.cloud {
  position: sticky;
  top: 20px;
  padding: 24px 22px 16px;
}

.cloud-head { margin-bottom: 8px; }

.cloud-sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--c-muted);
}

.cloud-canvas {
  display: block;
  width: 100%;
  height: 460px;
  cursor: pointer;
  touch-action: manipulation;
}

.cloud-hint {
  margin: 10px 0 2px;
  font-size: 12px;
  text-align: center;
  color: var(--c-muted);
}

/* ---------- 数据说明 ---------- */
.notice {
  margin-top: 20px;
  padding: 16px 22px;
}
.notice p { margin: 0; font-size: 13px; color: var(--c-muted); }
.notice strong { color: var(--c-text); }

/* ---------- 页脚 ---------- */
.site-footer { padding: 44px 0 56px; }

.footer-inner { text-align: center; }

.footer-updated { margin: 0 0 14px; font-size: 13px; color: var(--c-muted); }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  margin: 0 0 14px;
}
.footer-links a {
  font-size: 13px;
  color: var(--c-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
}
.footer-links a:hover { color: var(--c-accent); border-color: var(--c-accent); }

.footer-meta { margin: 0; font-size: 12.5px; color: var(--c-muted); opacity: 0.8; }

/* ---------- noscript 兜底 ---------- */
.noscript { padding: 30px 0 60px; }
.noscript h2 { font-family: var(--font-serif); }
.noscript li { margin-bottom: 8px; }
.noscript a { color: var(--c-primary); }

/* ---------- 错误提示 ---------- */
.banner-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 14px 18px;
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-cta);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: 13.5px;
  box-shadow: var(--shadow);
}
.banner-error button {
  flex: 0 0 auto;
}

/* ---------- 响应式 ---------- */
@media (max-width: 920px) {
  .main-grid { grid-template-columns: 1fr; }
  .cloud { position: static; }
  .cloud-canvas { height: 360px; }
}

@media (max-width: 560px) {
  .container { width: 100% - 28px; }
  .site-header { padding: 34px 0 22px; }
  .header-inner { align-items: flex-start; }
  .list { padding: 18px 16px 14px; }
  .item { gap: 10px; padding: 11px 8px; }
  .rank { flex-basis: 30px; font-size: 15px; }
  .item-title { font-size: 14.5px; }
  .toolbar .btn { width: 100%; }
  .search { flex-basis: 100%; }
  .cloud-canvas { height: 300px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
