/* ============================================================
 * theme-terminal.css —— Bloomberg 终端风格
 * 由 html[data-theme="terminal"] 启用；仅覆盖令牌与少量组件，
 * 未覆盖的组件经设计令牌自动换肤。底部行情条仅在终端主题显示。
 * ============================================================ */

html[data-theme="terminal"] {
  /* 色板：黑底 + 琥珀主色 */
  --paper: #0a0c0f;
  --paper-2: #12151b;
  --card: #0e1116;
  --ink: #d6dae2;
  --ink-2: #9aa3b2;
  --ink-3: #5d6673;
  --line: #232830;
  --line-strong: #39414d;

  --seal: #e8a33d;          /* 琥珀 */
  --seal-deep: #c9882a;
  --seal-soft: #2a2211;
  --seal-glow: rgba(232, 163, 61, .18);

  /* 状态底色 → 暗色半透明 */
  --st-open-bg: rgba(76, 192, 119, .12);
  --st-cond-bg: rgba(240, 161, 50, .12);
  --st-limited-bg: rgba(165, 139, 255, .12);
  --st-closed-bg: rgba(255, 107, 94, .12);
  --st-unknown-bg: rgba(146, 141, 128, .12);

  /* 阴影与圆角：终端无投影、小圆角 */
  --shadow-1: none;
  --shadow-2: 0 0 0 1px var(--line);
  --shadow-pop: 0 8px 32px rgba(0, 0, 0, .6), 0 0 0 1px var(--line-strong);
  --r-sm: 2px; --r-md: 3px; --r-lg: 4px;

  /* 地图配色（文字标注类走 CSS 变量，矢量层由 Basemap.applyTheme 重着色） */
  --map-bg: #0a0c0f;
  --map-clabel: #77808f;
  --map-clabel-cn: #e8a33d;
  --map-sea: #3d5a73;
  --map-provlabel: #5d6673;
  --map-gratlabel: #4a5260;
  --map-labelshadow: rgba(10, 12, 15, .9);
  --map-dotborder: #0a0c0f;
}

/* ---------- 字体与密度 ---------- */
html[data-theme="terminal"] body {
  font-family: "Cascadia Mono", Consolas, "SF Mono", Menlo, "PingFang SC", "Microsoft YaHei", monospace;
  font-size: 12.5px;
}
html[data-theme="terminal"] .brand .t,
html[data-theme="terminal"] .d-title,
html[data-theme="terminal"] .page-head h2,
html[data-theme="terminal"] .cat-card .nm,
html[data-theme="terminal"] .pol-card .pc-h .nm,
html[data-theme="terminal"] .cat-group-t .nm,
html[data-theme="terminal"] .about-sec h3 {
  font-family: inherit;
  letter-spacing: .02em;
}
html[data-theme="terminal"] .topbar { height: 48px; }
html[data-theme="terminal"] .topbar,
html[data-theme="terminal"] .sidebar,
html[data-theme="terminal"] .rightbar {
  background: var(--card);
  backdrop-filter: none;
}
html[data-theme="terminal"] .seal-logo {
  background: linear-gradient(145deg, #b9832f, #8a5f22);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .18);
  border-radius: 4px;
}
html[data-theme="terminal"] .nav button { font-size: 12.5px; letter-spacing: .05em; }
html[data-theme="terminal"] .nav button.on { color: var(--seal); }
html[data-theme="terminal"] .g-search { background: #10131a; font-family: inherit; }
html[data-theme="terminal"] .g-search .kbd { font-family: inherit; }
html[data-theme="terminal"] .side-search input { font-family: inherit; background: #10131a; }
html[data-theme="terminal"] .port-card { padding: 7px 10px; margin-bottom: 4px; }
html[data-theme="terminal"] .port-card.on { box-shadow: inset 2px 0 0 var(--seal), inset 0 0 0 1px var(--seal); }
html[data-theme="terminal"] .port-card.on::before { display: none; }
html[data-theme="terminal"] .pc-sub { font-size: 11px; }
html[data-theme="terminal"] .pc-meta { font-size: 10px; margin-top: 2px; }
html[data-theme="terminal"] .badge { font-size: 10px; border-radius: 2px; }
html[data-theme="terminal"] .vbadge { font-size: 10px; border-radius: 2px; }
html[data-theme="terminal"] .d-title { font-size: 16.5px; }
html[data-theme="terminal"] .d-tabs button { font-size: 11.5px; letter-spacing: .05em; }
html[data-theme="terminal"] .sec-t { letter-spacing: .14em; }
html[data-theme="terminal"] .sec-t::before { background: var(--seal); }
html[data-theme="terminal"] .txt-block { background: var(--paper-2); font-size: 12px; line-height: 1.7; }
html[data-theme="terminal"] .txt-block.warn { background: rgba(240, 161, 50, .07); border-color: rgba(240, 161, 50, .25); color: #e8b968; }
html[data-theme="terminal"] .txt-block.risk { background: rgba(255, 107, 94, .07); border-color: rgba(255, 107, 94, .25); color: #f0917f; }
html[data-theme="terminal"] .txt-block.ok { background: rgba(76, 192, 119, .07); border-color: rgba(76, 192, 119, .25); color: #6fcf97; }
html[data-theme="terminal"] .kv { font-size: 12px; }
html[data-theme="terminal"] .src-kind.官方 { background: var(--st-open-bg); }
html[data-theme="terminal"] .pol-alert { background: #10141a; border-color: #2c3540; color: #9fb6cc; }
html[data-theme="terminal"] .pol-alert b { color: #cfe0f0; }
html[data-theme="terminal"] .pol-alert .muted { color: var(--ink-3); }
html[data-theme="terminal"] .way-table td { font-size: 12px; }
html[data-theme="terminal"] .about-card { font-size: 12px; }
html[data-theme="terminal"] .f-item .box { border-radius: 2px; }

/* 状态徽标文字色（终端亮色变体） */
html[data-theme="terminal"] .st-open { color: #4cc077; }
html[data-theme="terminal"] .st-cond { color: #f0a132; }
html[data-theme="terminal"] .st-limited { color: #a58bff; }
html[data-theme="terminal"] .st-closed { color: #ff6b5e; }
html[data-theme="terminal"] .st-unknown { color: #928d80; }

/* ---------- 地图 Leaflet 终端化 ---------- */
html[data-theme="terminal"] .leaflet-container { background: var(--map-bg); outline: none; }
html[data-theme="terminal"] .map-stage { background: var(--map-bg); }
#map { background: var(--map-bg); }
html[data-theme="terminal"] .leaflet-control-attribution {
  background: rgba(14, 17, 22, .85) !important;
  color: var(--ink-3) !important;
}
html[data-theme="terminal"] .leaflet-control-scale-line {
  background: rgba(14, 17, 22, .85) !important;
  border-color: var(--ink-3) !important;
  color: var(--ink-2) !important;
}
html[data-theme="terminal"] .port-tip {
  background: #10141a !important;
  border-color: #39414d !important;
  color: #d6dae2 !important;
}

/* 地名标注颜色（paper 值写进变量，terminal 在上方覆盖） */
:root {
  --map-bg: #eee9dd;
  --map-clabel: #857a62;
  --map-clabel-cn: #6d6a5e;
  --map-sea: #7f96a3;
  --map-provlabel: #9a9078;
  --map-gratlabel: #a89d84;
  --map-labelshadow: rgba(247, 245, 240, .9);
  --map-dotborder: #fff;
}
.country-label { color: var(--map-clabel); text-shadow: 0 1px 4px var(--map-labelshadow); }
.country-label.cn { color: var(--map-clabel-cn); }
.province-label { color: var(--map-provlabel); text-shadow: 0 1px 3px var(--map-labelshadow); }
.sea-label { color: var(--map-sea); }
.grat-label { color: var(--map-gratlabel); }
.port-label { text-shadow: 0 1px 3px var(--map-labelshadow), 0 0 6px var(--map-labelshadow); }
.port-marker .pm-dot { border-color: var(--map-dotborder); }
html[data-theme="terminal"] .port-marker .pm-dot { box-shadow: 0 1px 4px rgba(0, 0, 0, .7); }
html[data-theme="terminal"] .port-label .star, html[data-theme="terminal"] .star { color: #e8c14a; }

/* 地图浮层控件（终端风格 square） */
html[data-theme="terminal"] .legend-card,
html[data-theme="terminal"] .region-pill,
html[data-theme="terminal"] .zoom-ctrl,
html[data-theme="terminal"] .layers-btn,
html[data-theme="terminal"] .compass,
html[data-theme="terminal"] .ibtn {
  background: var(--card);
  border-radius: var(--r-sm);
}
html[data-theme="terminal"] .legend-card .lg-line i { border-top-color: var(--ink-3); }
html[data-theme="terminal"] .legend-card .lg-row .sw { box-shadow: 0 0 0 2px rgba(10, 12, 15, .7); }

/* ---------- 终端底部行情条（仅终端主题显示） ---------- */
.term-bar { display: none; }

html[data-theme="terminal"] .term-bar {
  display: flex; align-items: center; gap: 0;
  flex: none; height: 26px;
  background: #0d0f13;
  border-top: 1px solid #232830;
  font-size: 11px; color: var(--ink-2);
  overflow: hidden; user-select: none;
}
.tb-cmd {
  flex: none; padding: 0 12px; height: 100%;
  display: flex; align-items: center; gap: 8px;
  color: var(--seal); font-weight: 700; letter-spacing: .06em;
  background: #12151b; border-right: 1px solid #232830;
}
.tb-cmd .sig { color: #4cc077; animation: blink 2.4s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.tb-ticker { flex: 1; overflow: hidden; height: 100%; display: flex; align-items: center; position: relative; }
.tb-ticker-track {
  display: inline-flex; gap: 26px; white-space: nowrap;
  padding-left: 16px;
  animation: ticker 90s linear infinite;
}
.tb-ticker:hover .tb-ticker-track { animation-play-state: paused; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tk-item { display: inline-flex; align-items: center; gap: 7px; }
.tk-item b { font-size: 8px; }
.tk-item i { font-style: normal; color: var(--ink-3); }
.tb-clock {
  flex: none; padding: 0 12px; height: 100%;
  display: flex; align-items: center;
  color: var(--seal); font-variant-numeric: tabular-nums;
  border-left: 1px solid #232830; background: #12151b;
}

/* 选中环与脉冲 → 琥珀 */
html[data-theme="terminal"] .port-marker.sel .pm-dot {
  border-color: var(--seal);
}

/* 结果排序 / 图例文案 */
html[data-theme="terminal"] .results-head b,
html[data-theme="terminal"] .results-head .sort { letter-spacing: .04em; }
