/* ============================================================================
 * 零号热搜（ZoneHot）· 样式
 * 文号：【ZONE O2026 第13号】 规格：TECH 第 11 节 · WBS T8.1
 * 原生 CSS，无构建、无框架；移动端单列，桌面端多列。
 * ========================================================================== */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #17181c;
  --muted: #71757e;
  --line: #e7e8ec;
  --accent: #e23b3b;
  --accent-weak: #fdecec;
  --up: #e23b3b;      /* 中国习惯：上升为红 */
  --down: #2f9e44;    /* 下降为绿 */
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 18, 22, 0.04);
  --shadow-md: 0 8px 28px rgba(16, 18, 22, 0.10);
  --page-max: 1200px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

a { color: inherit; }

button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- 顶部栏 */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(226, 59, 59, 0.28);
}

.brand-text { display: inline-flex; align-items: baseline; gap: 8px; }

.brand-en {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.control-label { white-space: nowrap; }

.date-input,
.round-select {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 14px;
  color: var(--text);
  min-height: 36px;
}

.date-input:hover,
.round-select:hover { border-color: #d3d6dc; }

.update-time {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ 标签 */
.tabs {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  gap: 4px;
  padding: 8px 20px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab:hover { background: #f0f1f4; color: var(--text); }

.tab.is-active {
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: 600;
}

/* ------------------------------------------------------------------ 主体 */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 18px 20px 40px;
}

.view { min-height: 320px; }

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.rank-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
}

.rank-row:first-child { border-top: 0; }

.rank-row[data-event-id] {
  cursor: pointer;
  transition: background 0.15s ease;
}

.rank-row[data-event-id]:hover { background: #fafafb; }

.rank-row[data-event-id]:active { background: #f3f4f6; }

/* 平台榜多一列热度 */
.rank-row.is-static {
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
}

.rank-num {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: #f2f3f6;
}

.rank-num.is-top { color: #fff; }
.rank-num.is-top-1 { background: var(--accent); box-shadow: 0 3px 10px rgba(226, 59, 59, 0.3); }
.rank-num.is-top-2 { background: #f2772f; }
.rank-num.is-top-3 { background: #e5a13a; }

.rank-main { min-width: 0; }

.rank-title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.rank-title:hover { color: var(--accent); }

.rank-meta {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f2f3f6;
  color: #4b4f57;
  font-size: 12px;
  white-space: nowrap;
}

.score { font-variant-numeric: tabular-nums; }
.score b { color: var(--text); font-weight: 600; }

.hot {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 58px;
}

.hot.is-empty { opacity: 0.35; }

.change {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  text-align: right;
  white-space: nowrap;
}

.change.is-up { color: var(--up); }
.change.is-down { color: var(--down); }
.change.is-new { color: var(--accent); }
.change.is-flat { color: #b6bac2; }

/* ------------------------------------------------------------ 全部平台 */
.all-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.platform-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.platform-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.platform-card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.mini-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-top: 1px dashed #f0f1f4;
}

.mini-row:first-child { border-top: 0; }

.mini-rank {
  font-size: 12px;
  font-weight: 700;
  color: #b6bac2;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.mini-rank.is-top-1 { color: var(--accent); }
.mini-rank.is-top-2 { color: #f2772f; }
.mini-rank.is-top-3 { color: #e5a13a; }

.mini-title {
  font-size: 13px;
  color: #2c2f36;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.mini-title:hover { color: var(--accent); }

.mini-hot {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card-more {
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  text-align: left;
  padding: 4px 0;
  cursor: pointer;
}

.card-more:hover { text-decoration: underline; }

/* ------------------------------------------------------------ 状态与骨架 */
.state {
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 44px 24px;
  text-align: center;
}

.state-title { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.state-desc { margin: 0; color: var(--muted); font-size: 14px; }
.state-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.state.is-error .state-title { color: var(--accent); }

.state code {
  background: #f2f3f6;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12px;
  word-break: break-all;
}

.btn {
  margin-top: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
}

.btn:hover { border-color: #d3d6dc; background: #fafafb; }

.skeleton {
  display: grid;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.skeleton-row {
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(90deg, #f2f3f6 25%, #f8f9fb 37%, #f2f3f6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------------------------------------------------------------- 详情层 */
.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 16, 20, 0.48);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: min(86vh, 860px);
  overflow-y: auto;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 26px 26px 22px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f2f3f6;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover { background: #e9eaee; color: var(--text); }

.modal-title {
  margin: 0 40px 8px 0;
  font-size: 19px;
  line-height: 1.45;
}

.modal-meta {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.chip {
  background: #f2f3f6;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  color: #4b4f57;
}

.chip b { font-weight: 600; }

.trend-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.seg {
  display: inline-flex;
  background: #f2f3f6;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.seg-btn.is-active {
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.dim-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.dim-picker select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 9px;
  font-size: 13px;
  background: var(--card);
  color: var(--text);
}

.chart-wrap {
  position: relative;
  height: 300px;
  background: #fbfbfc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.chart-empty {
  margin: 0;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 0 20px;
}

.member-links {
  list-style: none;
  margin: 16px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
}

.member-links a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-links a:hover { color: var(--accent); }

.modal-loading {
  min-height: 220px;
  display: grid;
  place-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid #eceef2;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.modal-error { color: var(--accent); font-size: 14px; }

/* ------------------------------------------------------------------ 页脚 */
.footer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 20px 32px;
  color: #9aa0aa;
  font-size: 12px;
}

.noscript {
  max-width: var(--page-max);
  margin: 20px auto;
  padding: 16px 20px;
  background: var(--accent-weak);
  color: var(--accent);
  border-radius: 12px;
}

/* ------------------------------------------------------------------ 响应式 */
@media (max-width: 900px) {
  .all-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

@media (max-width: 720px) {
  body { font-size: 14px; }

  .topbar-inner {
    padding: 12px 14px;
    gap: 10px;
  }

  .brand { font-size: 18px; }
  .brand-en { display: none; }

  .controls {
    width: 100%;
    gap: 10px;
    justify-content: space-between;
  }

  .update-time {
    width: 100%;
    order: 3;
    font-size: 12px;
  }

  .tabs { padding: 6px 12px; }

  .page { padding: 12px 12px 32px; }

  .rank-row,
  .rank-row.is-static {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    padding: 11px 12px;
    gap: 10px;
  }

  /* 手机端把热度放到标题下方一行，避免挤成一坨 */
  .rank-row.is-static .hot {
    grid-column: 2;
    grid-row: 2;
    text-align: left;
    min-width: 0;
    font-size: 12px;
    margin-top: 2px;
  }

  .rank-row.is-static .change {
    grid-column: 3;
    grid-row: 1;
  }

  .rank-title { font-size: 14px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

  .all-grid { grid-template-columns: 1fr; }

  .modal { padding: 8px; }
  .modal-card { padding: 20px 16px 16px; max-height: 92vh; border-radius: 16px; }
  .modal-title { font-size: 17px; }
  .chart-wrap { height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-row { animation: none; }
  .spinner { animation: none; }
  * { scroll-behavior: auto !important; }
}
