/* Copyright 2026 Nexus Graph. All rights reserved. */

/* ================= 设计令牌 ================= */
:root {
  --bg: #0b1220;
  --bg-2: #0f1a2e;
  --bg-3: #13213a;
  --panel: rgba(13, 22, 40, 0.86);
  --panel-solid: #0f1a2e;
  --card: rgba(255, 255, 255, 0.035);
  --card-hover: rgba(255, 255, 255, 0.06);
  --line: rgba(148, 178, 214, 0.14);
  --line-strong: rgba(148, 178, 214, 0.26);
  --text: #e6edf7;
  --text-2: #a3b1c6;
  --muted: #6b7a90;
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.14);
  --gold: #f5c97b;
  --gold-soft: rgba(245, 201, 123, 0.14);
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --topbar-h: 60px;
  --sidebar-w: 380px;
  --drawer-w: 400px;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ================= 通用组件 ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--text);
  font-size: 14px; white-space: nowrap;
  transition: background .2s, border-color .2s, transform .1s, color .2s;
}
.btn:hover { background: var(--card-hover); border-color: rgba(34, 211, 238, 0.45); }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, #22d3ee, #0ea5c6);
  border-color: transparent; color: #04111d; font-weight: 600;
}
.btn-primary:hover { background: linear-gradient(135deg, #4fe0f4, #22b8d8); border-color: transparent; }
.btn-gold { background: linear-gradient(135deg, #f8d696, #e9b45c); color: #2b1b02; border-color: transparent; font-weight: 600; }
.btn-gold:hover { background: linear-gradient(135deg, #fbe1ad, #f0c06e); border-color: transparent; }
.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); backdrop-filter: blur(10px);
  transition: background .2s, border-color .2s;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { border-color: rgba(34, 211, 238, 0.5); background: var(--bg-3); }
.icon-btn.is-on { color: var(--cyan); border-color: rgba(34, 211, 238, 0.45); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 36px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--card); font-size: 13px; color: var(--text-2);
  transition: all .2s;
}
.chip:hover { color: var(--text); border-color: rgba(34, 211, 238, 0.5); }
.chip.is-a { color: #04111d; background: var(--cyan); border-color: var(--cyan); font-weight: 600; }
.chip.is-b { color: #2b1b02; background: var(--gold); border-color: var(--gold); font-weight: 600; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.section-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--text);
}
.section-title small { font-size: 12px; font-weight: 400; color: var(--muted); }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.gold { color: var(--gold); }
.cyan { color: var(--cyan); }
.code-badge {
  display: inline-block; padding: 0 6px; border-radius: 6px;
  background: var(--cyan-soft); color: var(--cyan);
  font: 600 12px/20px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .5px;
}
.code-badge.is-gold { background: var(--gold-soft); color: var(--gold); }

/* ================= 布局 ================= */
.app { position: fixed; inset: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: none; z-index: 30;
  display: flex; align-items: center; gap: 20px;
  padding: 0 16px 0 18px;
  background: linear-gradient(180deg, rgba(11, 18, 32, 0.98), rgba(11, 18, 32, 0.9));
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: none; }
.brand-logo { width: 32px; height: 32px; color: var(--cyan); }
.brand-sub { font-size: 11px; color: var(--text-2); letter-spacing: 1px; line-height: 1.3; white-space: nowrap; }
.brand-title {
  margin: 0; font-size: 18px; font-weight: 700; letter-spacing: 2px; line-height: 1.3; white-space: nowrap;
  background: linear-gradient(90deg, #ffffff, #bdefff 60%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.view-switch {
  display: flex; padding: 3px; gap: 2px; flex: none;
  border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
}
.view-btn {
  min-height: 36px; padding: 0 16px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2); font-size: 13px; white-space: nowrap;
  transition: all .25s var(--ease);
}
.view-btn:hover { color: var(--text); }
.view-btn.is-active { background: var(--cyan-soft); color: var(--cyan); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.35); font-weight: 600; }

.topbar-search { flex: 1 1 320px; max-width: 440px; min-width: 200px; }

.top-actions { display: flex; gap: 4px; margin-left: auto; flex: none; }
.top-btn {
  min-height: 38px; padding: 0 12px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--text-2); font-size: 13px; white-space: nowrap;
  transition: all .2s;
}
.top-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.top-btn.is-active { color: var(--cyan); background: var(--cyan-soft); }
.top-btn-primary { color: var(--gold); border-color: rgba(245, 201, 123, 0.35); margin-left: 6px; }
.top-btn-primary:hover { color: #ffe3ad; background: var(--gold-soft); }

.workspace { position: relative; flex: 1; display: flex; min-height: 0; }

/* ---------- 左侧栏 ---------- */
.sidebar {
  width: var(--sidebar-w); flex: none; z-index: 20;
  display: flex; flex-direction: column;
  background: var(--panel-solid); border-right: 1px solid var(--line);
  transition: margin-left .35s var(--ease);
}
.app.sidebar-collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }
.sidebar-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.sidebar-tabs { flex: 1; display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, 0.035); }
.side-tab {
  flex: 1; min-height: 36px; border: 0; border-radius: 9px; background: transparent;
  color: var(--text-2); font-size: 13px; transition: all .2s;
}
.side-tab:hover { color: var(--text); }
.side-tab.is-active { background: var(--bg-3); color: var(--text); font-weight: 600; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 8px rgba(0, 0, 0, 0.3); }
.sidebar-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(148, 178, 214, 0.25) transparent; }
.panel { display: none; padding: 16px; animation: fadeUp .35s var(--ease); }
.panel.is-active { display: block; }
.panel > * + * { margin-top: 14px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 画布 ---------- */
.stage { position: relative; flex: 1; min-width: 0; overflow: hidden; background: var(--bg); }
.gl-canvas, .label-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.gl-canvas { touch-action: none; outline: none; transition: opacity .35s ease; }
.gl-canvas.is-switching { opacity: 0; }
.label-canvas { pointer-events: none; }
.stage-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(5, 9, 18, 0.55) 100%);
}

.sidebar-open {
  position: absolute; left: 12px; top: 12px; z-index: 5;
  width: 40px; height: 40px; display: none; place-items: center;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(10px);
}
.sidebar-open svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.app.sidebar-collapsed .sidebar-open { display: grid; }
.sidebar-open:hover { border-color: rgba(34, 211, 238, 0.5); }

.hl-banner {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 6;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 140px);
  padding: 6px 6px 6px 14px; border-radius: 999px;
  background: var(--panel); border: 1px solid rgba(245, 201, 123, 0.35); backdrop-filter: blur(12px);
  box-shadow: var(--shadow); font-size: 13px;
  animation: fadeUp .3s var(--ease);
}
.hl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); flex: none; animation: pulse 1.6s infinite; }
.hl-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-clear { flex: none; min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 12px; }
.hl-clear:hover { background: rgba(255, 255, 255, 0.14); }
@keyframes pulse { 50% { opacity: .35; } }

.legend {
  position: absolute; left: 16px; bottom: 16px; z-index: 4;
  padding: 10px 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px);
  font-size: 12px; color: var(--text-2);
  display: grid; gap: 6px; pointer-events: none;
}
.legend-row { display: flex; align-items: center; gap: 10px; }
.legend-title { color: var(--text); width: 64px; flex: none; }
.legend-dots { display: flex; align-items: center; gap: 6px; width: 72px; }
.legend-dots i { width: var(--s); height: var(--s); border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px rgba(34, 211, 238, 0.8); }
.legend-dots i:nth-child(1) { background: #157a92; box-shadow: none; }
.legend-dots i:nth-child(3) { background: #fff1cc; box-shadow: 0 0 10px var(--gold); }
.legend-ramp { width: 72px; height: 4px; border-radius: 2px; }
.legend-note b { font-weight: 400; color: var(--text-2); }

.zoom-ctrl { position: absolute; right: 16px; bottom: 16px; z-index: 4; display: grid; gap: 6px; }
.zoom-ctrl .icon-btn { width: 44px; height: 44px; }

.stage-hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3;
  padding: 6px 14px; border-radius: 999px; font-size: 12px; color: var(--text-2);
  background: rgba(11, 18, 32, 0.6); border: 1px solid var(--line);
  pointer-events: none; white-space: nowrap; transition: opacity .6s;
}
.stage-hint.is-faded { opacity: 0; }

.tooltip {
  position: absolute; z-index: 8; pointer-events: none; min-width: 180px; max-width: 280px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(10, 17, 31, 0.94); border: 1px solid rgba(34, 211, 238, 0.35);
  box-shadow: var(--shadow); font-size: 12px; line-height: 1.55;
}
.tooltip-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.tooltip-meta { color: var(--text-2); }
.tooltip-codes { margin-top: 6px; display: flex; gap: 6px; align-items: center; }

/* ---------- 右侧抽屉 ---------- */
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 25;
  width: var(--drawer-w); max-width: 100%;
  background: rgba(13, 22, 40, 0.96); border-left: 1px solid var(--line);
  backdrop-filter: blur(16px); box-shadow: -20px 0 50px rgba(0, 0, 0, 0.45);
  transform: translateX(105%); transition: transform .4s var(--ease);
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: none; }
.drawer-close { position: absolute; top: 14px; right: 14px; z-index: 2; width: 44px; height: 44px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 20px 28px; overscroll-behavior: contain; scrollbar-width: thin; }
.drawer-body > * + * { margin-top: 16px; }

.ap-head { padding-right: 48px; }
.ap-codes { display: flex; align-items: baseline; gap: 10px; }
.ap-iata {
  font: 700 34px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 2px;
  background: linear-gradient(90deg, #fff, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ap-icao { font: 500 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-2); }
.ap-name { margin: 10px 0 2px; font-size: 20px; font-weight: 700; line-height: 1.35; }
.ap-name-en { font-size: 12px; color: var(--muted); }
.ap-loc { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); font-size: 12px; color: var(--text-2); }

.ap-hero { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); background: linear-gradient(135deg, rgba(34, 211, 238, 0.14), rgba(245, 201, 123, 0.08)); border: 1px solid rgba(34, 211, 238, 0.25); }
.ap-hero-num { font-size: 36px; font-weight: 700; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.ap-hero-label { font-size: 13px; color: var(--text); }
.ap-hero-sub { font-size: 12px; color: var(--text-2); }

.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kv { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--line); }
.kv-k { font-size: 12px; color: var(--muted); }
.kv-v { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.kv-v small { color: var(--text-2); font-size: 12px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

.route-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.route-list > li, .rank-list > li { min-width: 0; }
.route-item {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px;
  border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--line);
  cursor: pointer; transition: background .2s, border-color .2s; width: 100%; text-align: left;
}
.route-item:hover { background: var(--card-hover); border-color: rgba(34, 211, 238, 0.4); }
.route-rank { width: 20px; flex: none; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.route-item:nth-child(-n+3) .route-rank { color: var(--gold); }
.route-main { flex: 1; min-width: 0; }
.route-title, .route-sub { display: block; }
.route-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-dist { flex: none; text-align: right; font-variant-numeric: tabular-nums; color: var(--cyan); font-size: 13px; }
.route-dist small { display: block; color: var(--muted); font-size: 11px; }

/* ================= 搜索框 ================= */
.search-box { position: relative; }
.search-field {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
  border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.04);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.search-field:focus-within { border-color: rgba(34, 211, 238, 0.6); background: rgba(34, 211, 238, 0.05); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12); }
.search-field svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--text-2); stroke-width: 2; stroke-linecap: round; }
.search-label { flex: none; font-size: 12px; color: var(--muted); }
.search-input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 14px; }
.search-input::placeholder { color: var(--muted); }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search-clear { flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.search-clear:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.search-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50;
  max-height: min(420px, 60vh); overflow-y: auto; padding: 6px;
  border-radius: 14px; background: rgba(12, 20, 36, 0.98); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); animation: fadeUp .2s var(--ease);
}
.search-group { padding: 6px 10px 4px; font-size: 12px; color: var(--muted); }
.search-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 10px;
  border: 0; border-radius: 10px; background: transparent; text-align: left;
}
.search-item.is-active, .search-item:hover { background: rgba(34, 211, 238, 0.1); }
.search-item-main { flex: 1; min-width: 0; }
.search-item-title, .search-item-sub { display: block; }
.search-item-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item mark { background: transparent; color: var(--gold); font-weight: 600; }
.search-item-deg { flex: none; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.search-empty { padding: 18px 12px; text-align: center; color: var(--text-2); font-size: 13px; }
.search-empty b { color: var(--cyan); font-weight: 600; cursor: pointer; }

/* ================= 洞察面板 ================= */
.panel-intro { font-size: 13px; color: var(--text-2); }
.panel-intro strong { color: var(--text); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  padding: 12px; border-radius: var(--radius-sm);
  background: linear-gradient(160deg, rgba(34, 211, 238, 0.09), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line);
}
.stat-num { font-size: 21px; font-weight: 700; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-unit { font-size: 12px; font-weight: 400; color: var(--text-2); margin-left: 2px; }
.stat-label { margin-top: 2px; font-size: 12px; color: var(--muted); }

.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rank-item {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px;
  min-height: 44px; padding: 4px 8px; border-radius: 10px; cursor: pointer; transition: background .2s;
  border: 0; background: transparent; width: 100%; text-align: left;
}
.rank-item:hover { background: var(--card-hover); }
.rank-no { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; }
.rank-item:nth-child(-n+3) .rank-no { color: var(--gold); }
.rank-name { min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { display: block; height: 4px; margin-top: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #0ea5c6, var(--cyan)); }
.rank-item:nth-child(-n+3) .rank-bar i { background: linear-gradient(90deg, var(--cyan), var(--gold)); }
.rank-val { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text); }
.rank-val small { color: var(--muted); font-size: 11px; }

.chart { position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 10px; }
.chart .axis line, .chart .axis path { stroke: rgba(148, 178, 214, 0.18); }
.chart .grid line { stroke: rgba(148, 178, 214, 0.08); }
.chart .bar { transition: opacity .15s; }
.chart .hit { fill: transparent; cursor: default; }
.chart-tip {
  position: absolute; z-index: 3; pointer-events: none; transform: translate(-50%, -100%);
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  background: rgba(10, 17, 31, 0.96); border: 1px solid var(--line-strong); font-size: 12px; box-shadow: var(--shadow);
}
.chart-caption { margin-top: 10px; font-size: 13px; color: var(--text-2); line-height: 1.7; }
.chart-caption strong { color: var(--gold); font-weight: 600; }

.quote {
  position: relative; padding: 12px 14px 12px 16px; border-radius: var(--radius-sm);
  background: var(--gold-soft); color: #fbe7c2; font-size: 14px; line-height: 1.7;
}
.quote::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: var(--gold); }

.hero-number { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.hero-number b { font-size: 48px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; background: linear-gradient(90deg, var(--cyan), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-number span { font-size: 16px; color: var(--text); }
.hero-number .hero-lead { flex-basis: 100%; font-size: 14px; color: var(--text-2); }

.sample-result { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(34, 211, 238, 0.07); border: 1px dashed rgba(34, 211, 238, 0.35); font-size: 13px; color: var(--text-2); }
.sample-result strong { color: var(--cyan); }

/* ================= 国家筛选 ================= */
.seg { display: flex; padding: 3px; gap: 2px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.seg button { flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-size: 13px; }
.seg button.is-active { background: var(--bg-3); color: var(--text); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.slots { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.slot {
  min-height: 48px; padding: 6px 10px; border-radius: var(--radius-sm); border: 1px dashed var(--line-strong);
  display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; color: var(--muted);
}
.slot.is-filled { border-style: solid; color: var(--text); }
.slot.is-a.is-filled { border-color: rgba(34, 211, 238, 0.6); background: var(--cyan-soft); }
.slot.is-b.is-filled { border-color: rgba(245, 201, 123, 0.6); background: var(--gold-soft); }
.slot button { width: 28px; height: 28px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, 0.08); display: grid; place-items: center; }
.slot-sep { color: var(--muted); }
.country-filter { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.04); outline: none; }
.country-filter:focus { border-color: rgba(34, 211, 238, 0.6); }
.country-list { max-height: 260px; overflow-y: auto; display: grid; gap: 2px; padding-right: 4px; scrollbar-width: thin; }
.country-row {
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; text-align: left; width: 100%;
}
.country-row:hover { background: var(--card-hover); }
.country-row .cn { flex: 1; }
.country-row .cc { font: 500 11px ui-monospace, Menlo, monospace; color: var(--muted); }
.country-row .ct { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.result-card { border-color: rgba(245, 201, 123, 0.3); }
.result-head { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.result-lines { font-size: 13px; color: var(--text-2); }
.result-lines b { color: var(--text); font-variant-numeric: tabular-nums; }
.mini-bars { display: grid; gap: 6px; margin-top: 10px; }
.mini-bar { display: grid; grid-template-columns: 76px 1fr 44px; gap: 8px; align-items: center; font-size: 12px; color: var(--text-2); }
.mini-bar .track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.mini-bar .track i { display: block; height: 100%; border-radius: 3px; background: var(--cyan); }
.mini-bar .v { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

/* ================= 路径探索 ================= */
.path-form { display: grid; gap: 8px; position: relative; }
.path-swap {
  position: absolute; right: -6px; top: 26px; z-index: 2; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--line-strong); background: var(--bg-3);
  display: grid; place-items: center;
}
.path-swap svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.path-form .search-box { margin-right: 34px; }
.path-answer { font-size: 17px; line-height: 1.7; font-weight: 600; color: var(--text); }
.path-answer em { font-style: normal; color: var(--gold); }
.path-answer .accent { color: var(--cyan); }
.timeline { list-style: none; margin: 14px 0 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 12px; bottom: 12px; width: 2px; background: linear-gradient(var(--cyan), var(--gold)); opacity: .5; }
.tl-stop { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.tl-dot { width: 20px; height: 20px; flex: none; border-radius: 50%; background: var(--bg); border: 2px solid var(--cyan); margin-top: 2px; }
.tl-stop.is-end .tl-dot { border-color: var(--gold); background: var(--gold); box-shadow: 0 0 10px rgba(245, 201, 123, 0.6); }
.tl-stop.is-start .tl-dot { background: var(--cyan); box-shadow: 0 0 10px rgba(34, 211, 238, 0.6); }
.tl-name { font-size: 14px; }
.tl-sub { font-size: 12px; color: var(--muted); }
.tl-leg { margin: 0 0 0 32px; padding: 2px 0; font-size: 12px; color: var(--cyan); }
.empty-state { text-align: center; padding: 18px 8px; color: var(--text-2); font-size: 13px; line-height: 1.8; }
.empty-state .big { font-size: 28px; margin-bottom: 4px; }

/* ================= 科普角 ================= */
.learn-card { position: relative; overflow: hidden; }
.learn-no { font: 800 12px/1 ui-monospace, Menlo, monospace; color: var(--gold); letter-spacing: 2px; }
.learn-title { margin: 6px 0 8px; font-size: 17px; font-weight: 700; }
.learn-text { font-size: 14px; line-height: 1.85; color: var(--text-2); }
.learn-text strong { color: var(--text); }
.learn-text p { margin: 0 0 8px; }
.learn-figure { margin: 12px 0 10px; padding: 10px; border-radius: var(--radius-sm); background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); }
.learn-figure svg { width: 100%; height: auto; }
.learn-card .btn { margin-top: 6px; }
.triple { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; margin: 4px 0; }
.triple .node { padding: 2px 8px; border-radius: 999px; background: var(--cyan-soft); color: var(--cyan); }
.triple .node.n2 { background: var(--gold-soft); color: var(--gold); }
.triple .rel { color: var(--text-2); font-size: 12px; }

/* ================= 移动端底部标签栏 & 提示 ================= */
.tabbar { display: none; }
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 100;
  padding: 10px 18px; border-radius: 999px; font-size: 13px;
  background: rgba(12, 20, 36, 0.96); border: 1px solid rgba(34, 211, 238, 0.4); box-shadow: var(--shadow);
  animation: fadeUp .25s var(--ease);
}

/* ================= 加载遮罩 ================= */
.loader {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 40%, #13254a 0%, #0b1220 60%);
  transition: opacity .6s ease, visibility .6s;
}
.loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-card { width: min(420px, 100%); text-align: center; }
.loader-orbit { position: relative; width: 120px; height: 120px; margin: 0 auto 26px; }
.orbit-ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(34, 211, 238, 0.35); }
.orbit-ring.r2 { inset: 22px; border-color: rgba(245, 201, 123, 0.3); transform: rotateX(65deg); }
.orbit-core { position: absolute; inset: 42px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #4fe0f4, #0e7490 70%); box-shadow: 0 0 40px rgba(34, 211, 238, 0.5); }
.orbit-plane { position: absolute; inset: 0; animation: spin 2.2s linear infinite; }
.orbit-plane::before { content: ""; position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 14px var(--gold); }
@keyframes spin { to { transform: rotate(360deg); } }
.loader-brand { font-size: 12px; letter-spacing: 3px; color: var(--text-2); }
.loader-title { margin: 6px 0 18px; font-size: 28px; font-weight: 800; letter-spacing: 6px; background: linear-gradient(90deg, #fff, #bdefff 60%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.loader-status { min-height: 22px; font-size: 14px; color: var(--text); }
.loader-bar { height: 4px; margin: 14px auto 0; width: 80%; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.loader-bar span { display: block; height: 100%; width: 0; border-radius: 2px; background: linear-gradient(90deg, var(--cyan), var(--gold)); transition: width .3s ease; }
.loader-error { margin-top: 22px; padding: 16px; border-radius: var(--radius); background: rgba(248, 113, 113, 0.08); border: 1px solid rgba(248, 113, 113, 0.35); text-align: left; }
.loader-error-title { font-weight: 700; color: #fecaca; margin-bottom: 6px; }
.loader-error-reason { margin: 0 0 14px; font-size: 13px; color: var(--text-2); line-height: 1.75; white-space: pre-line; }
.loader.has-error .loader-orbit, .loader.has-error .loader-bar { display: none; }
.noscript { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: var(--bg); color: var(--text); padding: 24px; text-align: center; }

/* ================= 响应式：平板 ================= */
@media (max-width: 1280px) {
  .top-actions .top-btn:not(.top-btn-primary) { display: none; }
  :root { --sidebar-w: 340px; }
}

/* ================= 响应式：手机 ================= */
@media (max-width: 768px) {
  :root { --topbar-h: auto; --tabbar-h: 60px; }
  .topbar { flex-wrap: wrap; gap: 8px 10px; padding: 8px 12px 10px; padding-top: max(8px, env(safe-area-inset-top)); }
  .brand { flex: 1; }
  .brand-logo { width: 28px; height: 28px; }
  .brand-sub { font-size: 10px; letter-spacing: .5px; }
  .brand-title { font-size: 16px; letter-spacing: 1px; }
  .view-btn { padding: 0 12px; min-height: 40px; }
  .topbar-search { order: 3; flex: 1 1 100%; max-width: none; min-width: 0; }
  .top-actions { display: none; }
  .search-field { height: 44px; }

  .workspace { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); top: 0;
    width: auto; z-index: 40; margin: 0 !important; border: 0;
    transform: translateY(0); transition: transform .35s var(--ease);
  }
  .app.sidebar-collapsed .sidebar { transform: translateY(105%); }
  .sidebar-head { padding-top: max(12px, env(safe-area-inset-top)); }
  #sidebar-close svg { transform: rotate(-90deg); }
  .sidebar-open { display: none !important; }
  .side-tab { min-height: 40px; }

  .drawer { position: fixed; inset: 0; width: 100%; z-index: 60; border: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }

  .legend { left: 10px; bottom: 10px; padding: 8px 10px; font-size: 11px; gap: 4px; }
  .legend-note { display: none; }
  .legend-title { width: auto; }
  .zoom-ctrl { right: 10px; bottom: 10px; }
  .stage-hint { display: none; }
  .hl-banner { top: 10px; max-width: calc(100% - 20px); font-size: 12px; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(11, 18, 32, 0.97); border-top: 1px solid var(--line); backdrop-filter: blur(12px);
  }
  .tabbar button { flex: 1; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--text-2); min-height: 44px; }
  .tabbar button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar button.is-active { color: var(--cyan); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .stat-num { font-size: 19px; }
}

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