/* =========================================================
   美国 Top 40 大学全景指南 — 样式表
   ========================================================= */

:root {
  --bg: #f5f7fb;
  --bg-grad: radial-gradient(1200px 600px at 12% -10%, #e8edff 0%, transparent 60%),
             radial-gradient(900px 500px at 92% 0%, #e6f7f1 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f2f5fb;
  --surface-3: #e9eef8;
  --text: #131722;
  --text-2: #37405a;
  --muted: #67728c;
  --border: #e2e7f2;
  --border-strong: #ccd4e6;
  --accent: #3d5afe;
  --accent-soft: #eaeefe;
  --accent-text: #2b3fd1;
  --ok: #0f9d76;
  --warn: #d9822b;
  --danger: #d94b4b;
  --shadow-sm: 0 1px 2px rgba(19, 23, 34, .06), 0 4px 14px rgba(19, 23, 34, .05);
  --shadow-md: 0 8px 30px rgba(19, 23, 34, .10);
  --shadow-lg: 0 24px 60px rgba(19, 23, 34, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --maxw: 1280px;
  --c-white: #6b8cff;
  --c-asian: #ffab1f;
  --c-hispanic: #ff7a59;
  --c-black: #9179ff;
  --c-intl: #17c3a2;
  --c-multi: #f45d9b;
  --c-unknown: #aab4c8;
  --c-other: #4bb4e6;
}

html[data-theme="dark"] {
  --bg: #0d1017;
  --bg-grad: radial-gradient(1200px 600px at 12% -10%, #1a2242 0%, transparent 60%),
             radial-gradient(900px 500px at 92% 0%, #10322a 0%, transparent 55%);
  --surface: #161b25;
  --surface-2: #1c222e;
  --surface-3: #232a38;
  --text: #e9edf6;
  --text-2: #c3cbdd;
  --muted: #94a0b8;
  --border: #262e3d;
  --border-strong: #364154;
  --accent: #7b8dff;
  --accent-soft: #1e2540;
  --accent-text: #a8b6ff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

/* 关键修复：作者样式里的 display（flex / grid）会覆盖浏览器对 [hidden] 的默认 display:none，
   导致抽屉与弹窗点关闭后仍然显示。这里强制让 [hidden] 永远隐藏。 */
[hidden], .is-hidden { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 96px;
}

h1, h2, h3, h4 { line-height: 1.3; margin: 0; }
p { margin: 0; }
ul { margin: 0; padding-left: 1.1em; }
li { margin: 4px 0; }
a { color: var(--accent-text); }
code {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: .88em;
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: 5px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 8px 14px; z-index: 999;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 10px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  flex: none; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #7b5cff);
  color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .5px;
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15.5px; letter-spacing: .2px; }
.brand-text span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; flex: none; }

/* ---------- 按钮 ---------- */
.ghost-btn, .primary-btn, .reset-btn, .view-btn, .linkish, .icon-btn {
  font: inherit; cursor: pointer; border-radius: 999px;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .12s ease;
}
.ghost-btn {
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border); padding: 7px 14px; font-size: 13px;
}
.ghost-btn:hover { background: var(--surface-3); color: var(--text); }
.primary-btn {
  background: var(--accent); color: #fff; border: 1px solid transparent;
  padding: 8px 16px; font-size: 13px; font-weight: 600;
}
.primary-btn:hover { filter: brightness(1.07); }
.primary-btn[disabled] { opacity: .5; cursor: not-allowed; }
.reset-btn {
  background: transparent; border: 1px dashed var(--border-strong); color: var(--muted);
  padding: 6px 14px; font-size: 12.5px; align-self: center;
}
.reset-btn:hover { color: var(--text); border-color: var(--accent); }
.linkish {
  background: none; border: none; color: var(--accent-text); padding: 0;
  font-size: inherit; text-decoration: underline; text-underline-offset: 3px;
}
.icon-btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  width: 34px; height: 34px; font-size: 20px; line-height: 1; display: grid; place-items: center;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

main { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------- Hero ---------- */
.hero { padding: 34px 0 10px; }
.hero-inner {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 26px; align-items: center;
}
.hero-copy h1 { font-size: clamp(26px, 3.4vw, 40px); letter-spacing: -.5px; margin-bottom: 14px; }
.hero-copy > p { color: var(--text-2); font-size: 15.5px; max-width: 62ch; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pill {
  background: var(--accent-soft); color: var(--accent-text);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.hero-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 18px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
}
.hero-stat {
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.hero-stat-num { font-size: 24px; font-weight: 750; letter-spacing: -.5px; color: var(--accent-text); }
.hero-stat-label { font-size: 12px; color: var(--muted); }
.hero-note {
  margin-top: 20px; font-size: 13px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm); padding: 11px 15px;
}

/* ---------- 工具栏 ---------- */
.toolbar {
  margin-top: 22px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 16px 18px;
  position: sticky; top: 60px; z-index: 40;
}
.toolbar-row-main { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-wrap {
  position: relative; flex: 1 1 320px; display: flex; align-items: center;
}
.search-icon { position: absolute; left: 13px; font-size: 14px; opacity: .7; }
.search-wrap input {
  width: 100%; font: inherit; font-size: 14.5px;
  padding: 11px 40px 11px 38px;
  border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text);
}
.search-wrap input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; background: var(--surface); }
.clear-search {
  position: absolute; right: 8px; width: 26px; height: 26px; border-radius: 50%;
  border: none; background: var(--surface-3); color: var(--text-2);
  font-size: 17px; line-height: 1; cursor: pointer;
}
.select-wrap { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex: none; }
.select-wrap select {
  font: inherit; font-size: 13.5px; padding: 9px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); cursor: pointer;
}
.view-toggle { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; flex: none; }
.view-btn {
  border: none; background: transparent; color: var(--muted);
  padding: 6px 14px; font-size: 13px; font-weight: 600;
}
.view-btn.is-active { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-sm); }

.filter-rows { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.filter-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-group::before {
  content: attr(data-label); font-size: 12px; color: var(--muted);
  margin-right: 2px; white-space: nowrap;
}
.chip {
  font: inherit; font-size: 12.5px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  border-radius: 999px; padding: 4px 11px;
}
.chip:hover { border-color: var(--accent); color: var(--accent-text); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.result-count { margin-top: 12px; font-size: 13px; color: var(--muted); }
.result-count b { color: var(--text); }

/* ---------- 卡片网格 ---------- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(335px, 1fr));
  gap: 16px; margin-top: 20px; scroll-margin-top: 200px;
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 16px 16px 14px;
  display: flex; flex-direction: column; gap: 12px;
  position: relative; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent), var(--shadow-sm); }
.card-top { display: flex; gap: 12px; align-items: flex-start; }
.rank-badge {
  flex: none; min-width: 46px; height: 46px; padding: 0 7px; border-radius: 12px;
  display: grid; place-items: center; gap: 0;
  background: linear-gradient(140deg, var(--accent), #7b5cff);
  color: #fff; font-weight: 800; line-height: 1;
}
.rank-badge small { font-size: 9px; font-weight: 600; opacity: .85; letter-spacing: .4px; }
.rank-badge b { font-size: 19px; }
.card-title { min-width: 0; }
.card-title h3 { font-size: 16.5px; letter-spacing: -.2px; }
.card-title .en { font-size: 12.5px; color: var(--muted); }
.card-loc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; }
.card-loc .dot { color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 11.5px; padding: 2.5px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.tag.tag-hot { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 20%, transparent); }
.card-intro {
  font-size: 13px; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.mini-stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; }
.mini-stat .k { font-size: 11px; color: var(--muted); }
.mini-stat .v { font-size: 13.5px; font-weight: 650; color: var(--text); }
.card-diversity { display: flex; flex-direction: column; gap: 5px; }
.div-bar { height: 8px; border-radius: 999px; overflow: hidden; display: flex; background: var(--surface-3); }
.div-bar span { display: block; height: 100%; }
.div-legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--muted); }
.div-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.card-actions { display: flex; gap: 8px; margin-top: auto; align-items: center; }
.card-actions .ghost-btn { flex: none; }
.card-actions .primary-btn { flex: 1; }
.pick {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  color: var(--muted); cursor: pointer; user-select: none;
}
.pick input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* ---------- 通用面板头 ---------- */
.panel-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2 { font-size: 20px; }
.panel-head p { font-size: 13px; color: var(--muted); }
.panel-head > button { margin-left: auto; }

.table-view, .map-view, .compare-panel, .method {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 18px; margin-top: 20px;
}
.table-scroll { overflow-x: auto; }
.data-table, .compare-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 900px; }
.data-table th, .compare-table th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 650;
  padding: 9px 10px; border-bottom: 1px solid var(--border-strong); white-space: nowrap;
  background: var(--surface); position: sticky; top: 0;
}
.data-table th[data-sort] { cursor: pointer; user-select: none; }
.data-table th[data-sort]:hover { color: var(--accent-text); }
.data-table th.sorted-asc::after { content: " ▲"; font-size: 9px; }
.data-table th.sorted-desc::after { content: " ▼"; font-size: 9px; }
.data-table td, .compare-table td {
  padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top;
}
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .school-cell b { font-size: 13.5px; }
.data-table .school-cell span { display: block; font-size: 11.5px; color: var(--muted); }
.th-num, .data-table td:first-child { text-align: center; }
.nowrap { white-space: nowrap; }
.table-link { background: none; border: none; color: var(--accent-text); cursor: pointer; font: inherit; font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; padding: 0; }

/* ---------- 地图 ---------- */
.map-canvas {
  position: relative; width: 100%; aspect-ratio: 16 / 8.4;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.map-grid-line { position: absolute; background: var(--border); }
.map-dot {
  position: absolute; transform: translate(-50%, -50%);
  border-radius: 50%; border: 2px solid var(--surface); cursor: pointer;
  transition: transform .12s ease; padding: 0;
}
.map-dot:hover, .map-dot:focus-visible { transform: translate(-50%, -50%) scale(1.6); z-index: 5; outline: none; }
.map-dot-label {
  position: absolute; transform: translate(-50%, -140%);
  font-size: 10.5px; color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s ease;
}
.map-dot:hover + .map-dot-label, .map-dot:focus-visible + .map-dot-label { opacity: 1; z-index: 6; }
.map-region-label {
  position: absolute; font-size: 12px; font-weight: 700; color: var(--muted);
  letter-spacing: 2px; opacity: .55; pointer-events: none;
}
.map-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- 方法说明 ---------- */
.method-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.method-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.method-card h3 { font-size: 14.5px; margin-bottom: 8px; color: var(--accent-text); }
.method-card ul { font-size: 13px; color: var(--text-2); }

/* ---------- 对比 ---------- */
.compare-panel { scroll-margin-top: 80px; }
.compare-table { min-width: 720px; }
.compare-table th { position: static; font-size: 13px; color: var(--text); background: var(--surface-2); }
.compare-table th.cmp-school { min-width: 170px; }
.compare-table td:first-child, .compare-table th:first-child {
  width: 130px; font-size: 12.5px; color: var(--muted); font-weight: 650;
  background: var(--surface-2); position: sticky; left: 0;
}
.compare-table td:first-child { color: var(--text-2); }
.cmp-rank { display: inline-block; font-size: 11px; background: var(--accent-soft); color: var(--accent-text); border-radius: 6px; padding: 1px 7px; margin-bottom: 4px; }

/* ---------- 抽屉 ---------- */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(10, 14, 22, .5); z-index: 90;
  backdrop-filter: blur(2px); animation: fade .18s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  width: min(940px, 100%); background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slide-in .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes slide-in { from { transform: translateX(28px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer-head {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.drawer-head-text { min-width: 0; flex: 1; }
.drawer-rank {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .3px;
  background: var(--accent-soft); color: var(--accent-text);
  border-radius: 999px; padding: 2px 10px; margin-bottom: 6px;
}
.drawer-head h2 { font-size: 22px; letter-spacing: -.3px; }
.drawer-head p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.drawer-tabs {
  display: flex; gap: 4px; padding: 10px 18px 0; overflow-x: auto;
  border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.drawer-tab {
  font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer;
  border: none; background: none; color: var(--muted); padding: 7px 12px 10px;
  border-bottom: 2px solid transparent; font-weight: 600;
}
.drawer-tab:hover { color: var(--text); }
.drawer-tab.is-active { color: var(--accent-text); border-bottom-color: var(--accent); }
.drawer-body { padding: 20px 22px 60px; overflow-y: auto; flex: 1; }
.drawer-body h3 { font-size: 15.5px; margin: 22px 0 8px; }
.drawer-body h3:first-child { margin-top: 0; }
.drawer-body p { font-size: 14px; color: var(--text-2); }
.drawer-body ul { font-size: 13.5px; color: var(--text-2); }
.lead { font-size: 15px !important; color: var(--text) !important; }

.fact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.fact {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 13px;
}
.fact .k { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.fact .v { font-size: 13.5px; color: var(--text); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 4px 0 8px; }
.big-stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.big-stat .v { font-size: 22px; font-weight: 750; letter-spacing: -.5px; color: var(--accent-text); }
.big-stat .k { font-size: 12px; color: var(--muted); margin-top: 3px; }

.bar-block { margin: 10px 0 16px; }
.bar-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.bar-track { height: 12px; border-radius: 999px; background: var(--surface-3); position: relative; overflow: hidden; }
.bar-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #7b5cff); }
.bar-range { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, #ff9f45, #ff6b6b); }
.bar-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

.div-list { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.div-row { display: grid; grid-template-columns: 82px 1fr 52px; gap: 10px; align-items: center; font-size: 13px; }
.div-row .name { color: var(--text-2); }
.div-row .track { height: 9px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.div-row .track i { display: block; height: 100%; border-radius: 999px; }
.div-row .pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }

.prog-list { display: grid; gap: 10px; }
.prog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px;
  background: var(--surface-2); border-left: 3px solid var(--accent);
}
.prog h4 { font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prog .lv {
  font-size: 11px; font-weight: 700; padding: 1.5px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-text);
}
.prog .lv.tier-1 { background: #ffe9cc; color: #a05a00; }
.prog .lv.tier-2 { background: #e2f6ef; color: #0b6b52; }
.prog p { font-size: 13px; margin-top: 5px; }
.prog .strength { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
html[data-theme="dark"] .prog .lv.tier-1 { background: #422c0d; color: #ffc478; }
html[data-theme="dark"] .prog .lv.tier-2 { background: #10352a; color: #6fe3bf; }

.callout {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--ok);
  border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; color: var(--text-2); margin-top: 14px;
}
.callout.warn { border-left-color: var(--warn); }
.drawer-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.drawer-links a {
  font-size: 13px; text-decoration: none; color: var(--accent-text);
  background: var(--accent-soft); border-radius: 999px; padding: 6px 13px; font-weight: 600;
}
.drawer-links a:hover { filter: brightness(.97); }

/* ---------- 底部对比条 ---------- */
.compare-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px); border-top: 1px solid var(--border-strong);
  box-shadow: 0 -6px 24px rgba(19, 23, 34, .10);
  animation: rise .2s ease;
}
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
.compare-bar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 10px 22px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.compare-bar-label { font-size: 13px; color: var(--muted); }
.compare-bar-label b { color: var(--text); }
.compare-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.compare-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 6px 4px 12px; color: var(--text-2);
}
.compare-chip button {
  border: none; background: var(--surface-3); color: var(--text-2); cursor: pointer;
  width: 18px; height: 18px; border-radius: 50%; font-size: 13px; line-height: 1;
}
.compare-bar-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 14, 22, .55); z-index: 110;
  display: grid; place-items: center; padding: 20px; animation: fade .16s ease;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: min(680px, 100%); max-height: 82vh; display: flex; flex-direction: column;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 18px 20px 24px; overflow-y: auto; font-size: 14px; color: var(--text-2); display: flex; flex-direction: column; gap: 12px; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--border); margin-top: 34px; background: var(--surface); }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 22px;
  display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: center;
  font-size: 13px; color: var(--muted);
}
.footer-inner strong { color: var(--text); font-size: 14px; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: 13px; }

.empty {
  grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
}

/* ---------- 响应式 ---------- */

/* =========================================================
   追加：地图排名圆点 / 分类视图 / 卡片自选 / 学费表 / 官网链接
   ========================================================= */

/* 地图 */
.map-body { display: block; }
.map-body.is-collapsed { display: none; }
.map-actions { margin-left: auto; display: flex; gap: 8px; }
.map-legend-note { color: var(--text-2); }
.map-canvas { position: relative; width: 100%; aspect-ratio: 16 / 8.6; min-height: 320px; }
.map-dot {
  display: grid; place-items: center;
  font-size: 10px; font-weight: 800; color: #fff; line-height: 1;
  letter-spacing: -.3px; text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .28) inset;
}
.map-dot:hover { transform: translate(-50%, -50%) scale(1.35); }
.map-dot-label.is-on {
  opacity: 1; transform: translate(-50%, -140%);
  font-weight: 650; box-shadow: var(--shadow-sm);
}
.map-dot-label.is-left { transform: translate(-50%, -140%); }

/* 分类浏览 */
.groups-view { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 18px; margin-top: 20px; }
.group-panel { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.group-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.group-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.group-head .caret { font-size: 12px; color: var(--muted); transition: transform .15s ease; }
.group-panel.is-collapsed .caret { transform: rotate(-90deg); }
.group-count { font-size: 12px; color: var(--muted); }
.group-actions { margin-left: auto; display: flex; gap: 8px; }
.group-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; padding: 14px; }
.group-panel.is-collapsed .group-cards { display: none; }
.group-hint { font-size: 12px; color: var(--muted); padding: 0 4px 12px; }

/* 卡片：可点击自选 + 官网 */
.card { cursor: pointer; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); }
.picked-flag {
  position: absolute; top: -9px; right: 12px;
  font-size: 11px; font-weight: 700; color: #fff;
  background: var(--accent); border-radius: 999px; padding: 2px 10px;
  box-shadow: var(--shadow-sm);
}
.card-site {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--accent-text); text-decoration: none;
  background: var(--accent-soft); border-radius: 999px; padding: 5px 12px; font-weight: 600;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-site:hover { filter: brightness(1.05); text-decoration: underline; text-underline-offset: 3px; }
.card-actions { flex-wrap: wrap; }
.card-actions .primary-btn { flex: 1 1 auto; }
.card-foot { font-size: 11.5px; color: var(--muted); }

/* 学费 */
.eng-strip {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.eng-strip .eng-title { font-size: 11px; color: var(--muted); font-weight: 650; letter-spacing: .2px; }
.eng-strip .eng-body { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.cost-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.cost-block { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.cost-block > header {
  background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.cost-block > header h3 { font-size: 14.5px; }
.cost-block > header span { font-size: 12px; color: var(--muted); }
.cost-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cost-table th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 650;
  padding: 8px 12px; border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
.cost-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.cost-table tr:last-child td { border-bottom: none; }
.cost-table .num { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 650; color: var(--text); }
.cost-table .prog-name { font-weight: 650; color: var(--text); }
.cost-table .prog-name span { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); }
.cost-table .note { color: var(--muted); font-size: 12px; min-width: 180px; }
.cost-table-scroll { overflow-x: auto; }
.cost-free { color: var(--ok) !important; font-weight: 700; }

/* 深色主题下的细节打磨 */
html[data-theme="dark"] .map-canvas { background: #0f131c; }
html[data-theme="dark"] .map-dot { border-color: #0f131c; }
html[data-theme="dark"] .map-dot-label { background: #1c222e; border-color: #364154; }
html[data-theme="dark"] .card-site { background: #1e2540; color: #a8b6ff; }
html[data-theme="dark"] .prog { background: #1c222e; }

@media (max-width: 760px) {
  .group-cards { grid-template-columns: 1fr; }
  .map-canvas { min-height: 260px; }
  .map-actions { margin-left: 0; }
}
@media (max-width: 1000px) {
  .hero-inner { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { padding-bottom: 130px; }
  main { padding: 0 14px; }
  .topbar-inner { padding: 10px 14px; }
  .brand-text span { display: none; }
  .toolbar { position: static; padding: 14px; }
  .grid { grid-template-columns: 1fr; }
  .hero { padding-top: 22px; }
  .compare-bar-inner { padding: 10px 14px; }
  .drawer-body { padding: 16px 16px 50px; }
  .drawer-head { padding: 14px 16px 12px; }
  .drawer-head h2 { font-size: 19px; }
  .div-row { grid-template-columns: 70px 1fr 44px; }
}

@media print {
  .topbar, .toolbar, .compare-bar, .drawer, .drawer-backdrop, .footer { display: none !important; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
