/* 作战桌：墨色海洋 + 暖灰陆地 + 钠灯琥珀一种强调色；朱红只给冲突与风险 */
:root {
  --sea: oklch(0.165 0.014 245);
  --land: oklch(0.315 0.012 75);
  --land-hi: oklch(0.37 0.014 75);
  --panel: oklch(0.195 0.01 250);
  --panel-2: oklch(0.225 0.01 250);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: oklch(0.93 0.012 85);
  --muted: oklch(0.7 0.012 85);
  --faint: oklch(0.55 0.01 85);
  --amber: oklch(0.8 0.14 72);
  --amber-dim: oklch(0.8 0.14 72 / 0.16);
  --hot: oklch(0.64 0.19 32);
  --r1: 2px;
  --r2: 6px;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --sans: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--sea); color: var(--text); font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

#map { position: fixed; inset: 0; background: var(--sea); }
.leaflet-container { background: var(--sea); font-family: var(--sans); }
.leaflet-control-attribution { background: rgba(0,0,0,.35) !important; color: var(--faint) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-control-zoom { border: 0 !important; margin: 0 16px 64px 0 !important; }
.leaflet-control-zoom a { background: var(--panel-2) !important; color: var(--text) !important; border: 1px solid var(--line) !important;
  width: 36px !important; height: 36px !important; line-height: 34px !important; border-radius: var(--r1) !important; }

/* ---- 品牌 ---- */
.brand { position: fixed; top: 16px; left: 16px; z-index: 900; display: flex; gap: 12px; align-items: center;
  pointer-events: none; }
.brand-mark { width: 30px; height: 30px; border: 1.5px solid var(--amber); border-radius: 50%; position: relative; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: var(--amber); }
.brand-mark::before { left: -6px; right: -6px; top: 50%; height: 1px; }
.brand-mark::after { top: -6px; bottom: -6px; left: 50%; width: 1px; }
.brand h1 { margin: 0; font: 600 24px/1 var(--serif); letter-spacing: -0.012em; }
.brand-sub { margin: 4px 0 0; font-size: 11px; letter-spacing: 0.24em; color: var(--muted); }

/* ---- 搜索 ---- */
.search { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 950; width: min(360px, calc(100vw - 32px)); }
.search input { width: 100%; height: 40px; padding: 0 14px; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--r2); color: var(--text); font-size: 14px; }
.search input::placeholder { color: var(--faint); }
#qres { list-style: none; margin: 4px 0 0; padding: 4px; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--r2); max-height: 50vh; overflow: auto; display: none; }
#qres.on { display: block; }
#qres li { padding: 8px 10px; border-radius: var(--r1); cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
#qres li[aria-selected="true"], #qres li:hover { background: var(--amber-dim); }
#qres .en { color: var(--faint); font-size: 12px; }
.star { color: var(--amber); }

/* ---- 左侧图层面板 ---- */
.panel { position: fixed; z-index: 900; left: 16px; top: 76px; bottom: 16px; width: 316px; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; }
.panel-grip { display: none; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.tabs button { height: 42px; color: var(--muted); font-size: 13px; letter-spacing: 0.1em; position: relative;
  transition: color .2s var(--ease); }
.tabs button.on { color: var(--text); }
.tabs button.on::after { content: ""; position: absolute; left: 30%; right: 30%; bottom: -1px; height: 2px; background: var(--amber); }
.panel-body { flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; min-height: 120px; }
.pane { display: none; padding: 6px 0; }
.pane.on { display: block; }
.modes, .toggles { list-style: none; margin: 0; padding: 0; }
.grp { padding: 10px 16px 4px; font-size: 11px; letter-spacing: 0.2em; color: var(--faint); }
.modes button, .toggles label { width: 100%; min-height: 36px; padding: 6px 16px; display: flex; align-items: center; gap: 10px;
  text-align: left; cursor: pointer; transition: background-color .15s var(--ease); }
@media (hover: hover) { .modes button:hover, .toggles label:hover { background: rgba(255,255,255,.04); } }
.modes button.on { background: var(--amber-dim); }
.modes button.on .nm { color: var(--amber); }
.sw { width: 10px; height: 10px; border-radius: var(--r1); flex: none; }
.nm { flex: 1; }
.kind { font-size: 11px; color: var(--faint); }
.toggles input { accent-color: oklch(0.8 0.14 72); width: 16px; height: 16px; }
.fine { margin: 8px 16px; font-size: 11px; color: var(--faint); }

/* 面板底部：当前图层简报 */
.brief { flex: none; max-height: 46%; overflow: auto; overscroll-behavior: contain; border-top: 1px solid var(--line);
  background: var(--panel-2); padding: 14px 16px; font-size: 13px; }
.brief:empty { display: none; }
.brief h3 { margin: 0 0 6px; font: 600 17px/1.3 var(--serif); }
.brief .src { font-size: 11px; color: var(--faint); margin-bottom: 8px; }
.brief p { margin: 6px 0; color: var(--muted); text-wrap: pretty; }
.brief b { color: var(--text); font-weight: 600; }
.legend { display: flex; align-items: center; gap: 6px; margin: 8px 0; font-size: 11px; color: var(--faint); }
.legend .ramp { flex: 1; height: 8px; border-radius: var(--r1); }
.rank { list-style: none; margin: 8px 0; padding: 0; counter-reset: r; }
.rank li { display: grid; grid-template-columns: 20px 1fr auto; gap: 6px; align-items: center; padding: 3px 0; cursor: pointer; }
.rank li::before { counter-increment: r; content: counter(r); font: 11px var(--mono); color: var(--faint); }
.rank .bar { grid-column: 2 / 4; height: 3px; background: var(--amber); opacity: .7; border-radius: 1px; margin-top: -2px; }
.rank .v { font: 12px var(--mono); color: var(--muted); }
.tagline { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--muted); margin-right: 4px; }
.ashare { margin-top: 10px; padding: 10px 12px; background: var(--amber-dim); border-radius: var(--r1); color: var(--text); }
.ashare::before { content: "A股映射"; display: block; font-size: 11px; letter-spacing: 0.2em; color: var(--amber); margin-bottom: 4px; }

/* ---- 右侧国家档案 ---- */
.drawer { position: fixed; z-index: 1000; top: 16px; right: 16px; bottom: 16px; width: 440px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r2); overflow: auto; overscroll-behavior: contain;
  transform: translateX(0); opacity: 1; transition: transform .35s var(--ease), opacity .25s var(--ease); }
.drawer[hidden] { display: block; transform: translateX(24px); opacity: 0; pointer-events: none; }
.x { position: sticky; top: 8px; float: right; margin: 8px 8px 0 0; width: 40px; height: 40px; border-radius: var(--r1);
  color: var(--muted); z-index: 2; background: var(--panel); }
.dz-head { padding: 22px 20px 14px; border-bottom: 1px solid var(--line); }
.dz-head .iso { font: 11px var(--mono); letter-spacing: 0.2em; color: var(--faint); }
.dz-head h2 { margin: 4px 0 2px; font: 600 32px/1.1 var(--serif); letter-spacing: -0.022em; }
.dz-head .en { color: var(--muted); font-size: 13px; }
.dz-head .tag { margin: 12px 0 0; font: 16px/1.5 var(--serif); color: var(--amber); text-wrap: balance; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); cursor: pointer; }
.chip i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.stat { padding: 12px 20px 10px; border-right: 1px solid var(--line); }
.stat:nth-child(3n) { border-right: 0; }
.stat:nth-child(n+4) { border-top: 1px solid var(--line); }
.stat .k { font-size: 11px; color: var(--faint); }
.stat .v { font: 600 17px/1.3 var(--mono); font-variant-numeric: tabular-nums; }
.stat .y { font: 10px var(--mono); color: var(--faint); }
.jump { position: sticky; top: 0; z-index: 1; display: flex; gap: 2px; overflow-x: auto; padding: 6px 12px; background: var(--panel);
  border-bottom: 1px solid var(--line); scrollbar-width: none; }
.jump a { flex: none; padding: 6px 9px; font-size: 12px; color: var(--muted); text-decoration: none; border-radius: var(--r1); }
.jump a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.sec { padding: 16px 20px 6px; border-bottom: 1px solid var(--line); }
.sec h4 { margin: 0 0 10px; font: 600 13px/1 var(--sans); letter-spacing: 0.24em; color: var(--amber); }
.sec p { margin: 0 0 10px; text-wrap: pretty; }
.kv { display: grid; grid-template-columns: 72px 1fr; gap: 6px 12px; margin: 0 0 12px; }
.kv dt { color: var(--faint); font-size: 12px; padding-top: 2px; }
.kv dd { margin: 0; }
.risk { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: var(--r1); background: rgba(255,255,255,.07); }
.risk.hi { background: oklch(0.64 0.19 32 / .22); color: oklch(0.82 0.1 32); }
.trade { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
.trade td { padding: 8px 6px 8px 0; border-top: 1px solid var(--line); vertical-align: top; }
.trade td:first-child { color: var(--text); width: 32%; }
.trade td:nth-child(2) { color: var(--muted); }
.trade td:last-child { color: var(--amber); }
.cities { list-style: none; margin: 0 0 12px; padding: 0; }
.cities li { display: flex; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); cursor: pointer; }
.cities li b { flex: none; min-width: 5.5em; font-weight: 600; }
.cities li span { color: var(--muted); }
.fb { font-size: 12.5px; color: var(--muted); }
.fb details { border-top: 1px solid var(--line); padding: 8px 0; }
.fb summary { cursor: pointer; color: var(--text); }
.fb .en-t { margin: 6px 0 0; font-family: var(--sans); line-height: 1.5; }
.note { font-size: 11px; color: var(--faint); padding: 14px 20px 24px; }
.pos-row { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; }
.pos-row .v { font: 12px var(--mono); color: var(--amber); min-width: 4.5em; }

/* ---- 地图上的标注 ---- */
.clabel { color: rgba(240, 232, 216, .62); font: 12px/1 var(--sans); white-space: nowrap; text-shadow: 0 0 3px var(--sea), 0 0 6px var(--sea);
  transform: translate(-50%, -50%); pointer-events: none; letter-spacing: .06em; }
.clabel.deep { color: rgba(247, 238, 222, .9); font-family: var(--serif); font-size: 13px; }
.clabel.big { font-size: 15px; }
.clabel.sel { color: var(--amber); }
.pt { position: relative; width: 14px; height: 14px; }
.pt.choke::before { content: ""; position: absolute; inset: 1px; border: 2px solid var(--amber); transform: rotate(45deg); background: var(--sea); }
.pt.hot::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--hot); }
.pt.hot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--hot); animation: ping 2.4s var(--ease) infinite; }
@keyframes ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(2.6); opacity: 0; } }
.pt-lab { position: absolute; left: 18px; top: -2px; white-space: nowrap; font-size: 12px; color: var(--text);
  text-shadow: 0 0 3px var(--sea), 0 0 6px var(--sea); }
.pt.hot .pt-lab { color: oklch(0.82 0.1 32); }
.city-dia { width: 9px; height: 9px; background: var(--amber); transform: rotate(45deg); border: 1px solid var(--sea); }

.leaflet-popup-content-wrapper { background: var(--panel-2); color: var(--text); border-radius: var(--r2); border: 1px solid var(--line-2); box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.leaflet-popup-tip { background: var(--panel-2); }
.leaflet-popup-content { margin: 14px 16px; font-size: 13px; line-height: 1.55; width: 300px !important; max-height: 50vh; overflow: auto; }
.leaflet-popup-content h3 { margin: 0 0 6px; font: 600 17px/1.3 var(--serif); }
.leaflet-popup-content p { margin: 6px 0; color: var(--muted); }
.leaflet-popup-content p b { color: var(--text); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-tooltip { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r1); box-shadow: none; font-size: 12px; }
.leaflet-tooltip::before { display: none; }

/* ---- 坐标读数（签名交互：跟着鼠标走的经纬度与国名）---- */
.readout { position: fixed; z-index: 900; left: 348px; bottom: 16px; display: flex; gap: 14px; align-items: baseline;
  padding: 7px 12px; background: rgba(20, 22, 26, .78); border: 1px solid var(--line); border-radius: var(--r1); font-size: 12px; }
#ro-name { font-family: var(--serif); font-size: 14px; color: var(--amber); min-width: 4em; }
#ro-ll { color: var(--muted); }

/* ---- 手机 ---- */
@media (max-width: 760px) {
  .brand { top: 12px; left: 12px; }
  .brand h1 { font-size: 19px; }
  .brand-sub { display: none; }
  .brand-mark { width: 22px; height: 22px; }
  .search { top: 10px; left: auto; right: 12px; transform: none; width: calc(100vw - 150px); }
  .panel { left: 0; right: 0; bottom: 0; top: auto; width: auto; height: 48vh; border-radius: 12px 12px 0 0;
    padding-bottom: env(safe-area-inset-bottom); transition: transform .35s var(--ease); }
  .panel.min { transform: translateY(calc(100% - 92px)); }
  .panel-grip { display: flex; justify-content: center; align-items: center; height: 22px; flex: none; }
  .panel-grip span { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); }
  .brief { max-height: 40%; }
  .drawer { top: 0; right: 0; bottom: 0; left: 0; width: auto; border-radius: 0; border: 0; padding-bottom: env(safe-area-inset-bottom); }
  .readout { display: none; }
  .leaflet-control-zoom { display: none; }
  .dz-head h2 { font-size: 28px; }
  .stat { padding: 10px 14px 8px; }
  .sec, .dz-head { padding-left: 16px; padding-right: 16px; }
  .leaflet-popup-content { width: 250px !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.lo .pt-lab { display: none; }
