/* ═══════════════════════════════════════════════════════════════
   FnixTop100 · 百强榜样式(白色卡片主题)
   版式:一行一张白卡;点缀延续 Fnix 金。桌面端与浏览器预览共用。
   ═══════════════════════════════════════════════════════════════ */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg: #f2f4f7;
  --bg-2: #ffffff;
  --bg-soft: #f8f9fb;
  --bg-hover: #fdfcf7;
  --gold: #b08327;
  --gold-hi: #8a6a24;
  --gold-soft: #f5ead1;
  --gold-line: rgba(176, 131, 39, 0.28);
  --fg: #1c2128;
  --fg-dim: #5b6472;
  --fg-faint: #9aa2af;
  --line: #e6e8ee;
  --line-strong: #d8dbe3;
  --up: #1d9e6e;
  --down: #cf5b47;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lift: 0 8px 24px rgba(16, 24, 40, 0.10), 0 2px 6px rgba(16, 24, 40, 0.06);
  --sans: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Cinzel", Georgia, "Times New Roman", serif;
  --mono: "Cascadia Mono", Consolas, monospace;
}

html, body { height: 100%; }
body {
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font: 13px/1.5 var(--sans);
  user-select: none; -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body.browser-preview { overflow: auto; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:disabled { opacity: 0.45; cursor: default; }
input, select { font: inherit; color: var(--fg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #ccd2dc; border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #b6bec9; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hi); }

/* ═══ 标题栏 ═══ */
#titlebar {
  height: 50px; flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 0 0 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { width: 27px; height: 27px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font: 700 14px var(--serif); color: var(--gold-hi); letter-spacing: 0.06em; }
.brand-sub { font-size: 10px; color: var(--fg-faint); letter-spacing: 0.08em; }
#preview-badge {
  font-size: 10px; color: var(--gold); background: var(--gold-soft);
  border: 1px solid var(--gold-line); border-radius: 20px; padding: 2px 10px; margin-left: 4px;
}
#nav { display: flex; gap: 4px; margin-left: 18px; }
.nav-btn {
  padding: 6px 16px; border-radius: 8px;
  color: var(--fg-dim); font-size: 12.5px; letter-spacing: 0.04em;
  border: 1px solid transparent;
}
.nav-btn:hover { color: var(--fg); background: var(--bg-soft); }
.nav-btn.active {
  color: var(--gold-hi); background: var(--gold-soft);
  border-color: var(--gold-line); font-weight: 600;
}
.win-controls { margin-left: auto; display: flex; align-self: stretch; }
.win-controls button { width: 46px; display: grid; place-items: center; color: var(--fg-dim); }
.win-controls button svg { width: 10px; height: 10px; }
.win-controls button:hover { background: #edeff3; color: var(--fg); }
.win-controls button.danger:hover { background: #e5484d; color: #fff; }

/* ═══ 主区 ═══ */
main { flex: 1; min-height: 0; display: flex; }
.view { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
body.browser-preview main { overflow: visible; }
body.browser-preview .view { overflow: visible; }

/* ─── 榜单切换条 ─── */
#board-bar {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: 10px 20px 0;
}
.board-switch { display: flex; gap: 6px; background: #e9ebf1; border-radius: 11px; padding: 4px; }
.board-switch.compact { padding: 3px; }
.board-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 6px 20px 7px; border-radius: 8px; line-height: 1.2;
  color: var(--fg-dim); transition: all 0.13s;
}
.board-switch.compact .board-btn { flex-direction: row; gap: 7px; padding: 5px 12px; }
.board-btn b { font-size: 13px; font-weight: 700; }
.board-btn span { font-size: 10px; color: var(--fg-faint); font-family: var(--mono); }
.board-switch.compact .board-btn span { font-size: 10px; }
.board-btn:hover { color: var(--fg); }
.board-btn.active { background: var(--bg-2); color: var(--gold-hi); box-shadow: var(--shadow); }
.board-btn.active b { color: var(--gold-hi); }
.board-btn.active span { color: var(--gold); }

/* ─── 统计条 ─── */
#stats-bar {
  flex: none; display: flex; align-items: stretch;
  padding: 12px 20px 10px; gap: 0;
}
.stat { display: flex; flex-direction: column; justify-content: center; padding: 2px 18px 2px 0; margin-right: 18px; border-right: 1px solid var(--line); }
.stat:last-of-type { border-right: none; }
.stat.grow { flex: 1; min-width: 0; }
.stat-k { font-size: 10px; letter-spacing: 0.14em; color: var(--fg-faint); }
.stat-v { font-size: 15px; font-weight: 650; color: var(--gold-hi); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.stat-v.dim { color: var(--fg-dim); font-size: 12px; font-weight: 400; }
.stat-actions { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 5px; }
.hint { font-size: 11px; color: var(--fg-faint); }
.btn-gold {
  padding: 7px 18px; border-radius: 8px; font-weight: 600; letter-spacing: 0.03em;
  color: #fff; background: linear-gradient(180deg, #c99a3c, #a87e26);
  border: 1px solid #97701f;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
}
.btn-gold:hover { filter: brightness(1.06); }
.btn-gold:active { filter: brightness(0.94); }
.btn-ghost {
  padding: 7px 16px; border-radius: 8px; color: var(--gold-hi);
  border: 1px solid var(--gold-line); background: var(--bg-2);
}
.btn-ghost:hover { background: var(--gold-soft); }

/* ─── 更新进度 ─── */
#update-progress { flex: none; padding: 6px 20px 10px; }
.progress-text { font-size: 11.5px; color: var(--fg-dim); margin-bottom: 5px; font-family: var(--mono); }
.progress-track { height: 5px; border-radius: 3px; background: #e7e9ef; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; border-radius: 3px; background: linear-gradient(90deg, #c99a3c, #e3bc63); transition: width 0.2s; }

/* ─── 过滤条(吸顶白条)─── */
#filter-bar {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 8px 20px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 5;
}
#chips { display: flex; gap: 6px; overflow-x: auto; flex: 1; padding: 2px; scrollbar-width: none; }
#chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 4px 12px; border-radius: 20px; font-size: 11.5px;
  color: var(--fg-dim); border: 1px solid var(--line-strong); background: var(--bg-2);
  white-space: nowrap; transition: all 0.12s;
}
.chip:hover { color: var(--fg); border-color: var(--gold-line); }
.chip.active { color: #7c5d1a; background: var(--gold-soft); border-color: var(--gold-line); font-weight: 600; }
.filter-right { display: flex; gap: 8px; flex: none; }
#search {
  width: 220px; padding: 6px 12px; border-radius: 8px; font-size: 12px;
  background: var(--bg-2); border: 1px solid var(--line-strong); outline: none;
  user-select: text;
}
#search:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176, 131, 39, 0.12); }
#sort {
  padding: 6px 8px; border-radius: 8px; font-size: 12px;
  background: var(--bg-2); border: 1px solid var(--line-strong); outline: none;
}

/* ─── 榜单:白色卡片,一行一个 ─── */
.rows {
  flex: 1; overflow-y: auto; padding: 14px 20px 28px;
  display: flex; flex-direction: column; gap: 9px;
}
body.browser-preview .rows { overflow: visible; }
.row {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns: 56px 40px minmax(220px, 1.7fr) 96px minmax(140px, 1fr) minmax(110px, 0.8fr) 20px;
  padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-2);
  box-shadow: var(--shadow);
  cursor: pointer; transition: border-color 0.12s, box-shadow 0.15s, transform 0.12s;
}
.row:hover { border-color: var(--gold-line); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.rank-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rank-num { font: 700 17px var(--mono); color: var(--fg-dim); }
.row.top1 .rank-num, .row.top2 .rank-num, .row.top3 .rank-num { font-size: 19px; }
.row.top1 .rank-num { color: #d4a017; }
.row.top2 .rank-num { color: #8e99a8; }
.row.top3 .rank-num { color: #b87333; }
.delta { font-size: 10.5px; font-family: var(--mono); }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat { color: var(--fg-faint); }
/* 头像:字母块先垫在 background 上,真图随后盖住 —— 加载前后都不会出现空框 */
.avatar { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background-color: var(--bg-soft); background-size: cover; object-fit: cover; }
.cell-main { min-width: 0; }
.cell-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.cell-name { font-weight: 650; color: var(--fg); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-blurb { font-size: 11.5px; color: var(--fg-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.badges { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: 1px; }
.badge { font-size: 10px; padding: 1px 7px; border-radius: 8px; white-space: nowrap; color: var(--fg-dim); background: var(--bg-soft); border: 1px solid var(--line); }
.badge.gold { color: #8a6a10; background: #fdf3d7; border-color: #ecd9a0; }
.badge.silver { color: #5a6572; background: #f0f2f5; border-color: #d5dae1; }
.badge.bronze { color: #8a5424; background: #f9ece0; border-color: #e6c8a8; }
.badge.dark-horse { color: #147a53; background: #e2f5ec; border-color: #b5e2cc; }
.badge.sleepy { color: var(--fg-faint); }
.badge.archived { color: var(--down); background: #fbeae6; border-color: #f0c4ba; }
.tag { font-size: 10.5px; color: var(--fg-dim); border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--bg-soft); }
.cell-stats { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--fg-dim); font-family: var(--mono); }
.cell-stats .stars { color: var(--gold-hi); font-weight: 600; }
.cell-stats .gain { color: var(--up); }
.cell-score { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.score-num { font: 700 16px var(--mono); color: var(--gold-hi); }
.bar { width: 100%; max-width: 150px; height: 5px; border-radius: 3px; background: #edeef3; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #c99a3c, #e3bc63); }
.chevron { color: var(--fg-faint); font-size: 16px; text-align: center; transition: color 0.12s, transform 0.12s; }
.row:hover .chevron { color: var(--gold-hi); transform: translateX(2px); }
.rows .empty { padding: 48px; text-align: center; color: var(--fg-faint); background: var(--bg-2); border: 1px dashed var(--line-strong); border-radius: 12px; }

/* ─── 文档页(方法论/设置)─── */
.doc { flex: 1; overflow-y: auto; padding: 26px 34px 40px; max-width: 860px; }
body.browser-preview .doc { overflow: visible; }
.doc.narrow { max-width: 640px; }
.doc h1 { font: 700 22px var(--serif); color: var(--gold-hi); letter-spacing: 0.05em; margin-bottom: 6px; }
.doc h2 { font-size: 14px; color: var(--gold); margin: 22px 0 6px; letter-spacing: 0.04em; }
.doc p { font-size: 12.5px; color: var(--fg-dim); margin: 4px 0; line-height: 1.75; user-select: text; }
.doc code { font-family: var(--mono); font-size: 11px; color: var(--gold-hi); background: var(--gold-soft); padding: 1px 5px; border-radius: 4px; }
.doc-lede { font-size: 13px !important; color: var(--fg) !important; border-left: 2px solid var(--gold); padding-left: 12px; margin: 10px 0 4px !important; }
.weights-live { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.weight-pill { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; text-align: center; min-width: 96px; background: var(--bg-2); box-shadow: var(--shadow); }
.weight-pill .w-name { display: block; font-size: 11px; color: var(--fg-dim); }
.weight-pill .w-val { display: block; font: 700 17px var(--mono); color: var(--gold-hi); margin-top: 2px; }
.weight-pill .w-bar { display: block; height: 3px; border-radius: 2px; background: #edeef3; margin-top: 6px; overflow: hidden; }
.weight-pill .w-bar i { display: block; height: 100%; background: linear-gradient(90deg, #c99a3c, #e3bc63); }
.form-row { display: flex; gap: 8px; margin: 10px 0 4px; }
.form-row input {
  flex: 1; padding: 8px 12px; border-radius: 8px; font-size: 12.5px; font-family: var(--mono);
  background: var(--bg-2); border: 1px solid var(--line-strong); outline: none; user-select: text;
}
.form-row input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176, 131, 39, 0.12); }
.weights-form { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 12px 0 2px; }
.weights-form .wf-item { display: flex; flex-direction: column; gap: 4px; }
.weights-form label { font-size: 11px; color: var(--fg-dim); }
.weights-form input {
  padding: 7px 10px; border-radius: 8px; font-family: var(--mono); font-size: 13px;
  background: var(--bg-2); border: 1px solid var(--line-strong); outline: none; user-select: text;
}
.pane-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
#month-select { padding: 6px 10px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line-strong); outline: none; }
