/* ==========================================================================
   Compass 罗盘 — 高中生专业规划与行业趋势看板
   设计语言：暖纸底 / 白卡片 / 墨色文字 / 赭红强调 / 编辑部式中文排版
   ========================================================================== */

:root {
  --bg: #faf9f6;
  --bg-card: #ffffff;
  --ink: #1c1a17;
  --ink-muted: #5f5a52;
  --ink-faint: #8a847a;
  --line: #e7e3db;
  --accent: #c2402a;
  --accent-soft: #fdf0ed;
  --blue: #1d5f8a;
  --blue-soft: #edf4f9;
  --green: #15803d;
  --green-soft: #f4faf5;
  --red: #b91c1c;
  --red-soft: #fdf5f4;
  --amber: #b45309;
  --amber-soft: #fdf8ef;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-num: "Helvetica Neue", Arial, "PingFang SC", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 16px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  width: 220px; display: flex; flex-direction: column;
  background: var(--bg-card); border-right: 1px solid var(--line);
  padding: 24px 0 18px;
}
.sidebar-logo {
  display: flex; align-items: baseline; gap: 8px;
  font-weight: 700; font-size: 18px; letter-spacing: .02em;
  padding: 0 24px 20px; border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.sidebar-links { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; overflow-y: auto; }
.sidebar-group {
  font-size: 11px; letter-spacing: .18em; color: var(--ink-faint);
  font-weight: 700; margin: 14px 12px 6px;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.sidebar-group:after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sidebar-group.spacer { margin-top: 10px; }
.sidebar-links a {
  display: flex; align-items: center; gap: 11px;
  font-size: 14.5px; color: var(--ink-muted);
  padding: 9px 12px; border-radius: 9px;
  transition: background .18s, color .18s;
}
.sidebar-links a .s-ico { font-size: 17px; width: 20px; text-align: center; opacity: .75; flex-shrink: 0; }
.sidebar-links a:hover { color: var(--ink); background: #f4f1ea; }
.sidebar-links a:hover .s-ico { opacity: 1; }
.sidebar-links a.active { color: var(--accent); font-weight: 700; background: var(--accent-soft); }
.sidebar-links a.active .s-ico { opacity: 1; }
.sidebar-links a { position: relative; }
.fav-count {
  margin-left: auto; font-family: var(--font-num); font-size: 11px; font-weight: 700;
  color: #fff; background: var(--accent); border-radius: 999px;
  min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}
.sidebar-foot {
  margin-top: auto; padding: 14px 24px 0; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-faint); line-height: 1.6;
}

/* 主内容区让位 */
body > main, body > footer { margin-left: 220px; }

/* 移动端：侧边栏折叠为顶部横滑条 */
@media (max-width: 920px) {
  .sidebar {
    position: sticky; top: 0; bottom: auto; width: 100%;
    flex-direction: row; align-items: center;
    padding: 0 16px; gap: 14px; overflow-x: auto;
    background: rgba(250, 249, 246, .96); backdrop-filter: blur(8px);
  }
  .sidebar-logo { padding: 14px 4px 12px; border-bottom: none; margin-bottom: 0; white-space: nowrap; }
  .sidebar-links { flex-direction: row; padding: 0; gap: 4px; overflow-x: auto; overflow-y: hidden; }
  .sidebar-links .sidebar-group { display: none; }
  .sidebar-links a { padding: 8px 12px; white-space: nowrap; gap: 7px; }
  .sidebar-links a .s-ico { font-size: 15px; width: auto; }
  .sidebar-foot { display: none; }
  body > main, body > footer { margin-left: 0; }
}

/* ---------- Hero ---------- */
.hero { padding: 72px 0 48px; }
.hero-kicker { font-size: 13px; letter-spacing: .22em; color: var(--accent); font-weight: 600; margin-bottom: 18px; }
.hero h1 { font-size: clamp(30px, 5.4vw, 52px); font-weight: 800; line-height: 1.25; letter-spacing: .01em; max-width: 680px; }
.hero p { margin-top: 20px; max-width: 580px; color: var(--ink-muted); font-size: 16.5px; }
.hero-actions { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 12px; }
.hero-meta { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 10px; }
.hero-chip {
  font-size: 13px; color: var(--ink-muted); background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
}

.cta-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 15px;
  padding: 12px 26px; border-radius: 10px; transition: background .2s, transform .2s;
}
.cta-primary:hover { background: var(--accent); transform: translateY(-1px); }
.cta-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-card); color: var(--ink); font-weight: 600; font-size: 15px;
  padding: 12px 26px; border-radius: 10px; border: 1px solid var(--line);
  transition: border-color .2s;
}
.cta-ghost:hover { border-color: var(--ink-faint); }

/* ---------- 章节 ---------- */
.section { padding: 44px 0; }
.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 24px; }
.section-num { font-family: var(--font-num); font-size: 13px; color: var(--accent); font-weight: 600; }
.section-title { font-size: 24px; font-weight: 700; letter-spacing: .01em; }
.section-sub { color: var(--ink-muted); font-size: 15px; margin: -14px 0 24px; max-width: 640px; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; padding: 4px 12px;
  border-radius: 999px; white-space: nowrap;
}
.badge:before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.hit     { color: var(--red);  background: var(--red-soft); }
.badge.reshape { color: var(--amber); background: var(--amber-soft); }
.badge.watch   { color: var(--blue); background: var(--blue-soft); }
.badge.gain    { color: var(--green); background: var(--green-soft); }
.badge.neutral { color: var(--ink-muted); background: #f1efe9; }
/* 蓝海层级徽章：跟随设计变量，深色模式自动适配 */
.badge.tier-core   { color: var(--blue);   background: var(--blue-soft); }
.badge.tier-rising { color: var(--accent); background: var(--accent-soft); }
.badge.tier-watch  { color: var(--amber);  background: var(--amber-soft); }

/* ---------- 网格 ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 960px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 14px; padding: 26px 24px 22px;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--ink-faint); transform: translateY(-2px); }
.card-name { font-size: 19px; font-weight: 700; }
.card-tagline { color: var(--ink-muted); font-size: 14px; margin-top: -6px; }
.card-verdict { font-size: 14px; color: var(--ink); line-height: 1.65; border-top: 1px solid var(--line); padding-top: 12px; }
.card-go { margin-top: auto; font-size: 13.5px; font-weight: 600; color: var(--accent); padding-top: 6px; }

.stat-card { background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.stat-value { font-family: var(--font-num); font-size: 38px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.stat-label { font-size: 14px; font-weight: 600; margin-top: 6px; }
.stat-note { font-size: 13.5px; color: var(--ink-muted); margin-top: 10px; line-height: 1.65; }

/* ---------- 涨跌双栏 ---------- */
.rf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .rf-grid { grid-template-columns: 1fr; } }
.rf-col { border-radius: 14px; padding: 24px; border: 1px solid var(--line); background: var(--bg-card); }
.rf-col.rise { background: var(--green-soft); border-color: #d3e8d6; }
.rf-col.fall { background: var(--red-soft); border-color: #f0d8d3; }
.rf-col h3 { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.rf-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.rf-col li { font-size: 14.5px; line-height: 1.6; padding-left: 20px; position: relative; }
.rf-col.rise li:before { content: "↑"; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.rf-col.fall li:before { content: "↓"; position: absolute; left: 0; color: var(--red); font-weight: 700; }

/* ---------- 列表块 ---------- */
.list-block { background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.list-block h3 { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.list-block ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.list-block li { font-size: 14.5px; line-height: 1.6; padding-left: 20px; position: relative; }
.list-block li:before {
  content: ""; position: absolute; left: 4px; top: 11px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint);
}

/* ---------- 详情页头 ---------- */
.detail-hero { padding: 56px 0 36px; }
.back-link { font-size: 13.5px; color: var(--ink-faint); transition: color .2s; }
.back-link:hover { color: var(--ink); }
.detail-hero h1 { font-size: clamp(28px, 4.6vw, 44px); font-weight: 800; margin-top: 16px; letter-spacing: .01em; }
.detail-tagline { color: var(--ink-muted); font-size: 16px; margin-top: 10px; }

.verdict-box {
  margin-top: 22px; background: var(--bg-card);
  border-left: 3px solid var(--accent);
  border-radius: 0 14px 14px 0; padding: 20px 24px;
  font-size: 15.5px; line-height: 1.75; max-width: 780px;
}

.policy-box {
  background: var(--accent-soft); border: 1px solid #f0d8d3;
  border-radius: 14px; padding: 22px 24px;
  font-size: 14.5px; line-height: 1.75; color: var(--ink);
}

/* ---------- 筛选器 ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.filter-btn {
  font-size: 13.5px; font-weight: 500; color: var(--ink-muted);
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 16px; transition: all .2s;
}
.filter-btn:hover { border-color: var(--ink-faint); color: var(--ink); }
.filter-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- 选科组合工具 ---------- */
.subject-picker {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 14px; padding: 24px; margin-bottom: 26px;
}
.subject-picker h3 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.pick-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.pick-label { font-size: 13px; color: var(--ink-faint); font-weight: 600; width: 64px; }
.pick-chip {
  font-size: 14px; font-weight: 600; padding: 8px 18px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink-muted); transition: all .2s;
}
.pick-chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.pick-chip.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.pick-chip:disabled { opacity: .35; cursor: not-allowed; }

.combo-result {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 14px; padding: 26px; margin-top: 4px;
}
.combo-result h3 { font-size: 20px; font-weight: 800; }
.combo-result .combo-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.combo-result p { font-size: 14.5px; color: var(--ink-muted); line-height: 1.75; }
.combo-majors { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.combo-majors .m-chip {
  font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px;
}

/* ---------- 蓝海矩阵 ---------- */
.ocean-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 18px; font-size: 13px; color: var(--ink-muted); }
.ocean-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ocean-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ocean-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 960px) { .ocean-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .ocean-grid { grid-template-columns: 1fr; } }
.ocean-card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; display: flex; flex-direction: column; gap: 10px;
  border-top: 3px solid var(--blue); transition: transform .2s, box-shadow .2s;
}
.ocean-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(28,26,23,.07); }
.ocean-card h3 { font-size: 18px; font-weight: 700; }
.ocean-card .ocean-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.ocean-card p { font-size: 14px; color: var(--ink-muted); line-height: 1.7; }
.ocean-card .ocean-majors { font-size: 13px; color: var(--blue); font-weight: 600; margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line); }

/* 潜力条 */
.potential-bar { height: 8px; background: #efece5; border-radius: 4px; overflow: hidden; }
.potential-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--blue), var(--accent)); }
.potential-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }

/* ---------- 职业路径 ---------- */
.career-track { display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
@media (max-width: 760px) { .career-track { grid-template-columns: 1fr; } }
.track-side { background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; height: fit-content; }
.track-side .side-kicker { font-size: 12px; letter-spacing: .18em; color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.track-side h3 { font-size: 18px; font-weight: 700; }
.track-side .side-meta { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--ink-muted); }
.track-steps { display: flex; flex-direction: column; gap: 14px; }
.step {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; display: grid; grid-template-columns: 44px 1fr; gap: 16px; align-items: start;
}
.step-num {
  font-family: var(--font-num); font-size: 15px; font-weight: 700; color: var(--accent);
  width: 36px; height: 36px; border: 1.5px solid var(--accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.step h4 { font-size: 15.5px; font-weight: 700; margin-bottom: 4px; }
.step p { font-size: 14px; color: var(--ink-muted); line-height: 1.7; }

/* ---------- 数据看板 ---------- */
.chart-card { background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.chart-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.chart-card .chart-sub { font-size: 13px; color: var(--ink-faint); margin-bottom: 16px; }
.chart-card canvas { width: 100%; height: auto; display: block; }
.chart-card > div { width: 100%; }

.kv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv-table th { text-align: left; font-size: 12.5px; color: var(--ink-faint); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.kv-table td { padding: 9px 10px; border-bottom: 1px solid #f1efe9; }
.kv-table tr:last-child td { border-bottom: none; }
.kv-table .num { font-family: var(--font-num); font-weight: 600; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 24px; }
.timeline:before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 22px 18px; }
.tl-item:before {
  content: ""; position: absolute; left: -24px; top: 7px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2.5px solid var(--accent);
}
.tl-item .tl-time { font-family: var(--font-num); font-size: 12.5px; color: var(--accent); font-weight: 700; letter-spacing: .06em; }
.tl-item h4 { font-size: 15.5px; font-weight: 700; margin: 2px 0 4px; }
.tl-item p { font-size: 14px; color: var(--ink-muted); line-height: 1.7; }

/* ---------- 深色模式（设置页切换，localStorage 持久化） ---------- */
:root[data-theme="dark"] {
  --bg: #171512; --bg-card: #211e1a; --ink: #ece8e1; --ink-muted: #b3ada3; --ink-faint: #8a847a;
  --line: #38342e; --accent: #e0593f; --accent-soft: #33221d;
  --blue: #5b9bd0; --blue-soft: #1e2a33; --green: #4ade80; --green-soft: #1d2b21;
  --red: #f87171; --red-soft: #33201e; --amber: #fbbf24; --amber-soft: #2f2718;
}
:root[data-theme="dark"] .sidebar { background: var(--bg-card); }
:root[data-theme="dark"] .badge.neutral { background: #2b2822; }
:root[data-theme="dark"] .potential-bar, :root[data-theme="dark"] .g-bar, :root[data-theme="dark"] .r-bar { background: #2e2a24; }
:root[data-theme="dark"] .rf-col.rise, :root[data-theme="dark"] .rf-col.fall { border-color: var(--line); }

/* ---------- 深色模式：反转按钮（--ink 背景在深色下变浅，文字必须跟随反转） ---------- */
:root[data-theme="dark"] .cta-primary { color: #171512; }               /* 浅底深字 */
:root[data-theme="dark"] .cta-primary:hover { color: #fff; }            /* hover 红底白字 */
:root[data-theme="dark"] .filter-btn.active { background: #ece8e1; color: #171512; border-color: #ece8e1; }
:root[data-theme="dark"] .life-stage.cur { background: #ece8e1; color: #171512; border-color: #ece8e1; }
:root[data-theme="dark"] .set-switch.on { background: #ece8e1; color: #171512; border-color: #ece8e1; }

/* ---------- 深色模式：硬编码浅色的统一替换 ---------- */
:root[data-theme="dark"] .sidebar-links a:hover { background: #2b2822; }
:root[data-theme="dark"] .policy-box { border-color: #4a332c; }
:root[data-theme="dark"] .rf-col.fall { border-color: #4a332c; }
/* 表格 / 列表分隔线 */
:root[data-theme="dark"] .kv-table td,
:root[data-theme="dark"] .opp-table td,
:root[data-theme="dark"] .rank-row,
:root[data-theme="dark"] .ocean-top a,
:root[data-theme="dark"] .fav-item,
:root[data-theme="dark"] .set-row { border-bottom-color: #2e2a24; }
/* 卡片悬浮阴影在深色下改深 */
:root[data-theme="dark"] .ocean-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.4); }
/* 输入框（专业搜索） */
:root[data-theme="dark"] #major-search { background: var(--bg-card); }

/* ---------- 未来引擎：路径链 ---------- */
.path-chain { display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
.path-node {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 16px; font-size: 14px; font-weight: 600;
}
.path-node small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-faint); }
.path-arrow { color: var(--accent); font-size: 15px; line-height: 1.6; padding-left: 20px; }

/* ---------- 收藏按钮 ---------- */
.fav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--ink-muted);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 13px;
  transition: all .2s; cursor: pointer;
}
.fav-btn:hover { border-color: var(--ink-faint); color: var(--ink); }
.fav-btn.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ---------- 概览面板（首页） ---------- */
.me-panel { background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.me-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 16px; }
@media (max-width: 760px) { .me-grid { grid-template-columns: 1fr 1fr; } }
.me-cell { border-left: 2px solid var(--line); padding-left: 14px; }
.me-cell .me-val { font-family: var(--font-num); font-size: 22px; font-weight: 700; line-height: 1.3; }
.me-cell .me-lab { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }

/* ---------- 生命周期条 ---------- */
.life-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.life-stage {
  font-size: 12.5px; font-weight: 600; padding: 5px 12px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--ink-faint); background: var(--bg);
}
.life-stage.cur { color: #fff; background: var(--ink); border-color: var(--ink); }

/* ---------- 对比表 ---------- */
.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; }
.cmp-table td:not(:first-child), .cmp-table th:not(:first-child) { text-align: center; }
.cmp-table .lvl-h { color: var(--green); font-weight: 700; }
.cmp-table .lvl-m { color: var(--amber); font-weight: 600; }
.cmp-table .lvl-l { color: var(--red); font-weight: 700; }

/* ---------- 反推选择器 ---------- */
.reverse-box { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 760px) { .reverse-box { grid-template-columns: 1fr; } }
.reverse-result { border-top: 2px solid var(--accent); padding-top: 16px; }

/* ---------- 关系树 ---------- */
.tree { font-size: 14.5px; line-height: 2; }
.tree .t-root { font-weight: 700; }
.tree .t-branch { padding-left: 20px; border-left: 1px solid var(--line); margin-left: 6px; }
.tree .t-leaf { color: var(--ink-muted); }
.tree .t-leaf:before { content: "├─ "; color: var(--ink-faint); }
.tree .t-leaf:last-child:before { content: "└─ "; }
/* ---------- 自定义滚动条（品牌化，替代浏览器默认） ---------- */
/* 侧边栏（桌面纵向 + 移动端横向） */
.sidebar-links {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.sidebar-links::-webkit-scrollbar { width: 5px; height: 5px; }
.sidebar-links::-webkit-scrollbar-track { background: transparent; }
.sidebar-links::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 999px;
  border: 1px solid transparent; background-clip: padding-box;
}
.sidebar-links::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); background-clip: padding-box; }
.sidebar-links { scrollbar-gutter: stable; }

/* 全站页面滚动条：同一套 token */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--ink-faint) transparent;
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 999px;
  border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); background-clip: padding-box; }

/* ---------- 专业详情弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(28, 26, 23, .48);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.modal-mask.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 16px; width: 100%; max-width: 720px; max-height: 86vh;
  overflow-y: auto; padding: 28px 30px 26px;
  transform: translateY(14px) scale(.985); transition: transform .22s ease;
}
.modal-mask.open .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.modal-head h2 { font-size: 24px; font-weight: 800; letter-spacing: .01em; }
.modal-head .m-sub { font-size: 13px; color: var(--ink-faint); margin-top: 3px; }
.modal-close {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-muted);
  font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
  transition: all .18s; cursor: pointer;
}
.modal-close:hover { color: var(--ink); border-color: var(--ink-faint); }
.m-sec { margin-top: 22px; }
.m-label {
  font-size: 11.5px; letter-spacing: .16em; font-weight: 700;
  color: var(--ink-faint); margin-bottom: 10px;
}
.m-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.m-chips span {
  font-size: 13.5px; font-weight: 500; color: var(--ink-muted);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px;
}
.m-foot {
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
}
.m-links { display: flex; gap: 16px; font-size: 13.5px; font-weight: 600; }
.m-links a { color: var(--accent); }

@media (max-width: 560px) {
  .modal { padding: 20px 18px; max-height: 92vh; }
  .modal-head h2 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-mask, .modal { transition: none; }
}

/* ---------- 页脚 / 免责 ---------- */
.disclaimer { font-size: 13px; color: var(--ink-faint); border-top: 1px solid var(--line); padding-top: 18px; margin-top: 40px; line-height: 1.7; }
.footer { border-top: 1px solid var(--line); padding: 32px 0 40px; margin-top: 24px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ink-faint); }

/* ---------- 编辑式堆叠编号列表（区别于卡片栅格的布局家族） ---------- */
.stack-list { background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.stack-item { display: grid; grid-template-columns: 64px 1fr; gap: 18px; padding: 26px 28px; }
.stack-item + .stack-item { border-top: 1px solid var(--line); }
.stack-item .stack-num {
  font-family: var(--font-num); font-size: 26px; font-weight: 700;
  color: var(--accent); line-height: 1; padding-top: 3px; letter-spacing: -.01em;
}
.stack-item h4 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.stack-item p { font-size: 14.5px; color: var(--ink-muted); line-height: 1.75; max-width: 68ch; }
@media (max-width: 560px) {
  .stack-item { grid-template-columns: 1fr; padding: 20px 22px; }
  .stack-item .stack-num { font-size: 15px; padding-top: 0; }
}

/* ---------- 页面入场（有动机的动效层：区分导航跳转与新页面加载） ---------- */
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
body > main { animation: pageIn .4s ease both; }

/* ---------- 动画 ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  body > main { animation: none; }
}

/* grid item 含 canvas/图表时允许收缩（min-width:auto 会撑破列） */
.grid-2 > *, .grid-3 > *, .grid-4 > *, .rf-grid > * { min-width: 0; }

/* 来源行（月度仪表盘等） */
.src-note { font-size: 13px; color: var(--ink-faint); margin-top: 14px; line-height: 1.6; }
.src-note a { color: var(--ink-muted); text-decoration: underline; text-underline-offset: 2px; }
#monthly-stats { margin-bottom: 18px; }
#monthly-section .chart-card h3 { margin-bottom: 12px; }

/* ---------- 榜单行（rank-row，rankings/trends 共用） ---------- */
.rank-row {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px;
  align-items: center; padding: 12px 2px; border-bottom: 1px solid #f1efe9;
}
.rank-row:last-child { border-bottom: none; }
.rank-row .r-pos { font-family: var(--font-num); font-size: 15px; font-weight: 700; color: var(--ink-faint); }
.rank-row.r-top .r-pos { color: var(--accent); }
.rank-row .r-name { font-size: 15px; font-weight: 600; }
.rank-row .r-name small { display: block; font-size: 12.5px; font-weight: 400; color: var(--ink-faint); margin-top: 2px; }
.rank-row .r-bar { display: block; height: 4px; border-radius: 2px; background: #f1efe9; margin-top: 7px; overflow: hidden; }
.rank-row .r-bar i { display: block; height: 100%; border-radius: 2px; }
.rank-row .r-val { font-family: var(--font-num); font-size: 17px; font-weight: 700; white-space: nowrap; }
.rank-row .r-val small { font-size: 12px; font-weight: 400; color: var(--ink-faint); }
:root[data-theme="dark"] .rank-row, :root[data-theme="dark"] .rank-row .r-bar { border-bottom-color: #2e2a24; background: #2e2a24; }

/* ---------- 专业卡统一节奏（ref 槽位等高） ---------- */
.ref-slot { display: flex; align-items: baseline; gap: 8px; min-height: 34px; margin-top: -2px; }
.ref-slot .ref-label {
  font-size: 12.5px; color: var(--ink-faint); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.ref-slot-none { align-items: center; gap: 10px; }
.ref-none-tag {
  font-size: 12px; font-weight: 700; color: var(--ink-muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; white-space: nowrap;
}
.card-verdict.clamp3 {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 67px;
}

/* ---------- 教育部目录全量 ---------- */
.moe-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.moe-chip {
  font-size: 12.5px; color: var(--ink-muted); background: #f4f1eb;
  border-radius: 6px; padding: 3px 9px; cursor: default; line-height: 1.5;
}
.moe-chip .tk-b {
  display: inline-block; font-style: normal; font-weight: 700; font-size: 9px;
  line-height: 1; vertical-align: super; border-radius: 3px; padding: 1.5px 3px; margin-left: 3px;
}
.moe-chip .tk-t { background: var(--blue); color: #fff; }
.moe-chip .tk-k { background: var(--amber); color: #fff; }
:root[data-theme="dark"] .moe-chip .tk-t { background: #2e6da4; }
:root[data-theme="dark"] .moe-chip .tk-k { background: #b8860b; }
:root[data-theme="dark"] .moe-chip { background: #2e2a24; color: #b3ada3; }
.gate-box { background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; overflow: hidden; }
.gate-box summary {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer;
  list-style: none; user-select: none;
}
.gate-box summary::-webkit-details-marker { display: none; }
.gate-box summary .gate-name { font-size: 17px; font-weight: 700; }
.gate-box summary .gate-meta { font-size: 13px; color: var(--ink-faint); }
.gate-box summary .ti { margin-left: auto; color: var(--ink-faint); transition: transform .2s; }
.gate-box[open] summary .ti { transform: rotate(180deg); }
.gate-box[open] summary { border-bottom: 1px solid var(--line); }
.gate-body { padding: 14px 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.cat-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: start; }
.cat-name { font-size: 13.5px; font-weight: 600; color: var(--ink-muted); padding-top: 3px; }
@media (max-width: 640px) { .cat-row { grid-template-columns: 1fr; gap: 6px; } }

/* 时间线未来项（虚线连接，区别于已发生） */
.tl-item.tl-future { opacity: .96; }
.tl-item.tl-future .tl-time { color: var(--accent); }
.tl-item.tl-future .tl-time::after { content: " · 预告"; font-size: 11px; }

/* 十五五点名赛道行：右值列双行内容，移动端换行收纳 */
#future-tracks .r-val { white-space: normal; max-width: 46%; }
@media (max-width: 760px) {
  #future-tracks .rank-row { grid-template-columns: 36px 1fr; }
  #future-tracks .r-val { grid-column: 2; grid-row: 2; max-width: 100%; flex-direction: row; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 2px; }
}
