/* ============================================================
   大盘云图 · 样式
   深浅双主题，配色取自原站 CSS 变量
   ============================================================ */
:root {
  --brand: #ef4444;
  --brand-foreground: #fff;
  --radius: 10px;
  --font: Arial, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --transition: .15s cubic-bezier(.4,0,.2,1);
}

/* ---------- 暗色（默认，对齐原站 dark） ---------- */
html[data-mode="dark"] {
  --background: #0f1319;
  --card: #1d2227;
  --card-foreground: #e2e5e8;
  --muted: #292e34;
  --muted-foreground: #93a0b0;
  --border: rgba(255,255,255,.10);
  --foreground: #ebeef2;
  --accent: #292e34;
  --panel: #161b21;
  --panel-2: #1d2227;
  --shadow: 0 8px 30px rgba(0,0,0,.55);
  --hover: rgba(255,255,255,.06);
}
/* ---------- 亮色：暖白护眼（刻意压低亮度与饱和度，长时间盯盘不刺眼） ----------
   要点：
   ① 底不用纯白 —— 用带暖调的米白 #f4f1ea，蓝光更少
   ② 卡片比底更亮一档但不刺眼 #fbf9f4
   ③ 文字不用纯黑 —— #2f2c28 暖深灰，对比够但不生硬
   ④ 灰色系整体偏暖，避免发青
   ------------------------------------------------------------------ */
html[data-mode="light"] {
  --background: #f4f1ea;      /* 暖米白底（非纯白） */
  --card: #fbf9f4;            /* 卡片：比底亮一点点 */
  --card-foreground: #2f2c28; /* 暖深灰，不用纯黑 */
  --muted: #eae5da;           /* 暖灰填充 */
  --muted-foreground: #6b6459;/* 暖灰次要文字（比原来浅，更柔） */
  --border: #ddd6c8;          /* 暖调边框 */
  --foreground: #2f2c28;
  --accent: #eae5da;
  --panel: #fbf9f4;
  --panel-2: #f0ece3;         /* 内嵌面板：略深于卡片 */
  --shadow: 0 8px 26px rgba(80,68,48,.13);
  --hover: rgba(90,76,52,.055);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--background);
  color: var(--foreground);
  overflow: hidden;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  /* ★ 纵向 flex：顶栏/情绪带/自选栏 高度自适应，layout 吃掉剩余空间。
     之前用 calc(100% - 52px) 硬算，后加了情绪带+自选栏就溢出了 72px。 */
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  height: 52px; padding: 0 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; letter-spacing: .3px; white-space: nowrap; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 5px; flex: none;
  background: linear-gradient(135deg, #ef4444 0%, #f59e0b 50%, #22c55e 100%);
}
.topbar-sep { width: 1px; height: 22px; background: var(--border); flex: none; }

/* 市场标签页 */
.tabs { display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 6px 11px; border-radius: 7px; font-size: 13px; font-weight: 500;
  color: var(--muted-foreground); white-space: nowrap; transition: var(--transition);
}
.tab:hover { background: var(--hover); color: var(--foreground); }
.tab.active { background: var(--brand); color: var(--brand-foreground); font-weight: 600; }

/* 周期切换 */
.periods { display: flex; gap: 2px; background: var(--muted); border-radius: 8px; padding: 3px; flex: none; }
.period {
  padding: 5px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600;
  color: var(--muted-foreground); transition: var(--transition); white-space: nowrap;
}
.period.active { background: var(--card); color: var(--foreground); box-shadow: 0 1px 3px rgba(0,0,0,.16); }

/* 图标按钮 */
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  color: var(--muted-foreground); transition: var(--transition); flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--foreground); }
.icon-btn.on { background: var(--brand); color: var(--brand-foreground); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- 主体布局 ---------- */
.layout { display: flex; flex: 1 1 auto; min-height: 0; position: relative; }

/* 侧栏 */
.sidebar {
  width: 206px; flex: none; background: var(--card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto; min-height: 0;
  padding: 7px 9px; gap: 8px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  overscroll-behavior: contain;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--muted-foreground); }
.sidebar.hidden { display: none; }
.side-sec-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: .6px;
  color: var(--muted-foreground); text-transform: uppercase;
  margin-bottom: 4px; line-height: 1.25;
}
#boardList > .side-sec-title, .sidebar > div > .side-sec-title { margin-top: 0; }
.side-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 7px; border-radius: 6px; font-size: 12.5px; line-height: 1.5;
  color: var(--foreground); transition: var(--transition); width: 100%; text-align: left;
}
.side-item:hover { background: var(--hover); }
.side-item.active { background: var(--brand); color: var(--brand-foreground); font-weight: 600; }
.side-item .pct { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12px; }
.pct.up { color: #f2545b; }
.pct.down { color: #2ec27e; }
.pct.flat { color: var(--muted-foreground); }
html[data-up="green"] .pct.up { color: #2ec27e; }
html[data-up="green"] .pct.down { color: #f2545b; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.stat {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 7px;
}
.stat-label { font-size: 10px; color: var(--muted-foreground); margin-bottom: 1px; line-height: 1.3; }
.stat-value { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat-value.sm { font-size: 12px; }

/* 画布区 */
/* Offscreen panels must not scroll the map when their controls receive focus. */
.canvas-wrap { flex: 1 1 auto; position: relative; min-width: 0; overflow: clip; background: var(--background); }
#map { display: block; width: 100%; height: 100%; touch-action: none; }

/* 右下角控制条 */
/* 控制条样式已废弃（按钮已移除，滚轮/快捷键替代）——保留选择器以兼容旧缓存 */
.controls {
  position: absolute; right: 12px; bottom: 12px; z-index: 20;
  display: flex; flex-direction: row; gap: 6px;
  padding: 5px; border-radius: 11px;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.ctrl-btn {
  width: 30px; height: 30px; border-radius: 7px;
  background: transparent; border: none;
  display: grid; place-items: center; color: var(--muted-foreground);
  transition: var(--transition);
}
.ctrl-btn:hover { color: var(--foreground); background: var(--panel-2); }
.ctrl-btn svg { width: 15px; height: 15px; }

/* 图例（已移入侧栏 —— 不再浮在画布上遮挡色块） */
.side-legend { display: flex; flex-direction: column; }
.legend {
  position: static;                 /* 取消绝对定位 */
  display: flex; align-items: center; gap: 6px;
  padding: 0 2px; margin-top: 2px;
  background: none; border: none; box-shadow: none;
  white-space: nowrap;
}
.legend-bar { flex: 1 1 auto; height: 7px; border-radius: 4px; min-width: 60px; }
.legend-tick {
  font-variant-numeric: tabular-nums; font-weight: 600;
  color: var(--muted-foreground); font-size: 10px; flex: none;
}
.side-legend .legend-note {
  font-size: 10px; color: var(--muted-foreground);
  margin-top: 3px; padding: 0 2px; line-height: 1.4;
}

/* 悬浮详情卡 */
.hovercard {
  position: absolute; z-index: 30; pointer-events: none;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 11px; min-width: 168px;
  box-shadow: var(--shadow); display: none;
  overflow: hidden;
  font-size: 12.5px;
}
.hovercard.show { display: block; }
.hc-name { font-weight: 700; font-size: 13.5px; margin-bottom: 1px; }
.hc-code { font-size: 11px; color: var(--muted-foreground); font-family: var(--mono); margin-bottom: 6px; }
.hc-row { display: flex; justify-content: space-between; gap: 14px; padding: 2px 0; }
.hc-row span:first-child { color: var(--muted-foreground); }
.hc-row span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }

/* 详细面板（点击块弹出） */
.detail {
  position: absolute; top: 0; right: 0; bottom: 0; width: 340px; z-index: 50;
  background: var(--card); border-left: 1px solid var(--border);
  box-shadow: var(--shadow); transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.detail.open { transform: translateX(0); }
.detail-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }
.detail-title { font-size: 17px; font-weight: 700; }
.detail-sub { font-size: 12px; color: var(--muted-foreground); margin-top: 3px; font-family: var(--mono); }
.detail-close { position: absolute; top: 11px; right: 11px; }
.detail-body { flex: 1 1 auto; overflow-y: auto; padding: 12px 14px; }
.detail-big { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 12px; }
.detail-rows { display: flex; flex-direction: column; gap: 0; }
.dr { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.dr:last-child { border-bottom: none; }
.dr span:first-child { color: var(--muted-foreground); }
.dr span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }

/* 板块成分列表 */
.rank-row {
  display: flex; align-items: center; gap: 6px; padding: 1px 5px;
  border-radius: 5px; font-size: 12.5px; line-height: 1.5;
  cursor: pointer; transition: var(--transition);
}
.rank-row:hover { background: var(--hover); }
.rank-dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.rank-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-pct { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12px; }

/* 设置面板 */
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 320px; z-index: 60;
  background: var(--card); border-left: 1px solid var(--border);
  box-shadow: var(--shadow); transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 15px; }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--muted-foreground); }
.opt-row { display: flex; flex-wrap: wrap; gap: 6px; }
.opt {
  padding: 6px 11px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--panel-2); font-size: 12.5px; color: var(--muted-foreground);
  transition: var(--transition);
}
.opt:hover { border-color: var(--brand); color: var(--foreground); }
.opt.active { background: var(--brand); border-color: var(--brand); color: var(--brand-foreground); font-weight: 600; }

/* 主题色板预览 */
.swatch-row { display: flex; align-items: center; gap: 4px; }
.swatch { width: 17px; height: 17px; border-radius: 4px; border: 1px solid var(--border); }

/* 空状态 */
.empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted-foreground); font-size: 14px; text-align: center; padding: 24px;
}
.empty.hidden { display: none; }

/* 加载 */
.loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--background); z-index: 70; }
.loading.hidden { display: none; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 悬浮提示条 */
.toast {
  position: absolute; left: 50%; transform: translateX(-50%) translateY(-8px);
  bottom: 62px; z-index: 80; background: var(--card);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 15px; font-size: 13px; box-shadow: var(--shadow);
  opacity: 0; transition: var(--transition); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 帮助浮层 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90;
  display: none; place-items: center; padding: 24px;
}
.modal-mask.open { display: grid; }
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  max-width: 560px; width: 100%; max-height: 82vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between;
  padding: 15px 17px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; }
.modal-body { padding: 17px; font-size: 13.5px; line-height: 1.85; }
.modal-body h4 { margin: 0 0 8px; font-size: 14px; }
.modal-body ul { margin: 0 0 16px; padding-left: 19px; }
.modal-body li { margin-bottom: 5px; color: var(--muted-foreground); }
.modal-body kbd {
  display: inline-block; min-width: 20px; text-align: center;
  padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border);
  background: var(--muted); font-family: var(--mono); font-size: 11.5px;
  font-weight: 600; color: var(--foreground);
}

/* 全屏 */
body.fs .layout { flex: 1 1 auto; }

/* 响应式 */
@media (max-width: 900px) {
  .sidebar { position: absolute; left: 0; top: 0; bottom: 0; z-index: 45; box-shadow: var(--shadow); }
  .detail, .drawer { width: min(340px, 88vw); }
}
/* ============================================================
   大盘云图 · 追加样式 v2
   K线容器 / 状态栏 / 新悬浮卡
   ============================================================ */

/* 顶栏副标题 */
.brand-sub { font-size: 11px; font-weight: 500; color: var(--muted-foreground); letter-spacing: 0; }

/* 实时状态 */
.status {
  display: flex; align-items: center; gap: 6px; flex: none;
  font-size: 11.5px; padding: 5px 10px; border-radius: 7px;
  background: var(--muted); color: var(--muted-foreground);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-foreground); flex: none; }
.status.live { color: #2ec27e; background: rgba(46,194,126,.12); }
.status.live .dot { background: #2ec27e; animation: pulse 2s cubic-bezier(.4,0,.6,1) infinite; }
.status.offline { color: var(--muted-foreground); }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }


/* ---------- 悬浮卡（含K线） ---------- */
.hovercard {
  position: absolute; z-index: 30; pointer-events: none;
  /* ★ 悬浮窗固定深色（对齐原站）—— 不跟随主题。
     原来用 var(--card)/var(--foreground)：浅色主题下变成浅底深字，
     而标题栏/提示条是固定白字 → 落在浅底上完全看不清（用户报的 bug）。 */
  background: #1b2026; border: 1px solid rgba(255,255,255,.10);
  color: #e8ecf1;
  border-radius: 12px; padding: 11px 13px 10px;
  /* ★ 绝对禁止横向滚动（用户明确要求「绝对不允许出现横滑动条」） */
  overflow-x: hidden;
  overflow-y: hidden;
  /* ★ 固定宽高：内容变化（名字长短/K线加载）时尺寸绝不抖动，
     否则位置会重算 → 用户看到的「窗口乱跳」 */
  width: 480px; height: 716px;
  box-sizing: border-box;
  display: none;
}
.hovercard.show { display: block; }
/* 悬浮卡标题栏 —— 随涨跌变色的实心条（对齐原站视觉）
   涨=红底 / 跌=绿底 / 平=灰底；文字一律白色保证对比度 */
.hc-head {
  display: flex; align-items: center; gap: 8px;
  margin: -9px -11px 8px;          /* 抵消卡片内边距，做成通栏 */
  padding: 7px 11px;
  border-radius: 9px 9px 0 0;
  background: var(--hc-head-bg, #2f3542);
  color: #fff;
  transition: background .18s ease;
}
.hc-head.up   { --hc-head-bg: linear-gradient(180deg, #e03236, #bd2429); }   /* 同主图红系，深一档保证白字可读 */
.hc-head.down { --hc-head-bg: linear-gradient(180deg, #27a94c, #1d8a3c); }   /* 同主图绿系，深一档 */
.hc-head.flat { --hc-head-bg: linear-gradient(180deg, #5a6472, #454d59); }
.hc-name { font-weight: 700; font-size: 16px; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.22); }
.hc-code { font-size: 11.5px; color: rgba(255,255,255,.78); font-family: var(--mono); }
.hc-price { margin-left: auto; font-weight: 700; font-size: 16px; color: #fff;
            font-variant-numeric: tabular-nums; }
.hc-pct { font-weight: 700; font-size: 16px; color: #fff; font-variant-numeric: tabular-nums;
          padding-left: 8px; margin-left: 2px; border-left: 1px solid rgba(255,255,255,.32); }

#hover-kline {
  display: block; width: 100%; height: 300px; flex: none;
  border-radius: 7px; background: #1d2227;
  border: 1px solid var(--border);
}
.hc-klegend {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted-foreground);
  margin: 7px 0 9px; font-variant-numeric: tabular-nums; min-height: 15px;
}
.hc-klegend .kma1 { color: #4a9eff; }
.hc-klegend .kma2 { color: #3ad1d6; }
.hc-klegend .kma3 { color: #e05fd8; }
.hc-klegend b { font-weight: 700; }

.hc-meta { display: flex; gap: 16px; font-size: 13.5px; color: var(--muted-foreground); flex-wrap: wrap; }
.hc-meta b { color: #e8ecf1; font-weight: 600; font-variant-numeric: tabular-nums; }
.hc-meta2 { font-size: 12.5px; color: var(--muted-foreground); margin-top: 4px; opacity: .85; }

/* ---------- 详情面板里的 K 线 ---------- */
#detail-kline {
  display: block; width: 100%; height: 168px;
  border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--border); margin-bottom: 6px;
}
.detail-body .hc-klegend { margin-bottom: 12px; }

/* ---------- 侧栏小元素 ---------- */
.side-item .cnt { font-size: 10px; opacity: .5; margin-left: 2px; }
.mini-empty { font-size: 11.5px; color: var(--muted-foreground); padding: 3px 4px; }
.rank-name .code { color: var(--muted-foreground); font-size: 10.5px; font-family: var(--mono); margin-left: 3px; }

/* 搜索框 */
#search-input {
  width: 100%; padding: 11px 13px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--foreground); font-size: 14px; outline: none;
}
#search-input:focus { border-color: var(--brand); }
#search-results { margin-top: 12px; max-height: 46vh; overflow-y: auto; }

/* 禁用的设置项 */
.opt[disabled] { cursor: default; opacity: .85; }
.opt[disabled]:hover { border-color: var(--brand); }

/* 亮色模式下悬浮卡 K 线的网格线要换色 */
html[data-mode="light"] .hc-klegend { color: #5c6b7f; }

/* 亮色模式下 K 线网格线用暖灰，减少线条存在感 */
html[data-mode="light"] .hc-klegend { color: #6b6459; }
/* ============================================================
   盯盘增强：情绪带 / 自选栏 / 动效
   ------------------------------------------------------------
   动效原则：只在"变化"和"操作"时动，绝不重复播放。
   ★ 不做 prefers-reduced-motion 降级 —— 用户系统关了动画，
     守卫会静默禁用，他会以为功能没做出来。
   ============================================================ */

/* ---------- 自选栏 ---------- */
.watchbar {
  display: flex; align-items: center; gap: 10px; flex: none;
  min-height: 42px; padding: 5px 12px;
  background: var(--panel-2); border-bottom: 1px solid var(--border);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
}
.watchbar::-webkit-scrollbar { height: 5px; }
.watchbar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.wb-label {
  display: flex; align-items: center; gap: 5px; flex: none;
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  color: var(--muted-foreground); text-transform: uppercase;
}
.wb-label svg { width: 13px; height: 13px; }
.wb-items { display: flex; gap: 7px; flex: 1 1 auto; }
.wb-chip {
  display: flex; align-items: center; gap: 7px; flex: none;
  padding: 5px 9px; border-radius: 8px;
  background: var(--card); border: 1px solid var(--border);
  cursor: pointer; transition: var(--transition);
  position: relative; overflow: hidden;
}
.wb-chip:hover { border-color: var(--brand); transform: translateY(-1px); }
.wb-chip .wb-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.wb-chip .wb-pct { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wb-chip .wb-spark { width: 38px; height: 16px; flex: none; opacity: .9; }
.wb-chip .wb-del {
  width: 15px; height: 15px; border-radius: 4px; flex: none;
  display: grid; place-items: center; color: var(--muted-foreground);
  opacity: 0; transition: var(--transition);
}
.wb-chip:hover .wb-del { opacity: 1; }
.wb-chip .wb-del:hover { background: var(--destructive, #d73431); color: #fff; }
.wb-chip .wb-del svg { width: 10px; height: 10px; }
.wb-empty { font-size: 12px; color: var(--muted-foreground); padding: 2px 4px; }
.wb-empty b { color: var(--foreground); font-weight: 700; }
.wb-empty.hidden { display: none; }

/* 自选异动：整条脉冲一下（一次性，不循环） */
@keyframes wbPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,236,180,.75); }
  100% { box-shadow: 0 0 0 9px rgba(255,236,180,0); }
}
.wb-chip.pulse { animation: wbPulse .85s cubic-bezier(.2,.7,.3,1) 1; }
.wb-chip.pulse-down { animation: wbPulseDown .85s cubic-bezier(.2,.7,.3,1) 1; }
@keyframes wbPulseDown {
  0%   { box-shadow: 0 0 0 0 rgba(196,224,255,.75); }
  100% { box-shadow: 0 0 0 9px rgba(196,224,255,0); }
}

/* ---------- 星标按钮 ---------- */
.star-btn {
  position: absolute; top: 42px; right: 44px;
  width: 28px; height: 28px; border-radius: 7px;
  display: grid; place-items: center;
  color: var(--muted-foreground); transition: var(--transition);
}
.star-btn:hover { background: var(--hover); color: var(--foreground); }
.star-btn svg { width: 15px; height: 15px; }
.star-btn.on { color: #e8b64c; }
.star-btn.on svg { fill: #e8b64c; }
.star-btn.bump { animation: starBump .34s cubic-bezier(.3,1.6,.5,1) 1; }
@keyframes starBump {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.28); }
  100% { transform: scale(1); }
}

/* ---------- 悬浮卡淡入（操作反馈，120ms） ---------- */
@keyframes hcIn {
  from { opacity: 0; transform: scale(.97); }
  to   { opacity: 1; transform: scale(1); }
}
.hovercard.show { animation: hcIn .12s cubic-bezier(.2,.8,.3,1) 1; }

/* ---------- 统计数字变化时轻微高亮 ---------- */
@keyframes numFlash {
  0%   { background: rgba(255,236,180,.30); }
  100% { background: transparent; }
}
.stat-value.flash { animation: numFlash .9s ease-out 1; border-radius: 4px; }

/* ---------- 异动提示条（右上角浮出，一次性） ---------- */
.move-toast {
  position: absolute; top: 12px; right: 14px; z-index: 75;
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none; max-width: 300px;
}
.move-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 11px; border-radius: 9px;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: 12.5px;
  animation: mvIn .28s cubic-bezier(.2,.9,.3,1) 1;
}
.move-item.mv-out { animation: mvOut .34s ease-in 1 forwards; }
@keyframes mvIn {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes mvOut {
  to { opacity: 0; transform: translateX(18px); }
}
.move-item .mv-name { font-weight: 600; }
.move-item .mv-delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.move-item .mv-arrow { color: var(--muted-foreground); font-size: 11px; }

/* ---------- 交易所标签 ---------- */
.wb-chip .wb-ex { font-size: 9.5px; color: var(--muted-foreground); font-family: var(--mono); }

/* 全屏时隐藏情绪带，纯云图（自选已在侧栏内，随侧栏一起隐藏） */

/* 响应式 */
@media (max-width: 900px) {
  .watchbar { min-height: 38px; }
  .move-toast { max-width: 200px; }
}

/* ============================================================
   自选移入侧栏：改为紧凑竖向行
   ============================================================ */
.side-watch { display: flex; flex-direction: column; }
.side-watch .wb-items {
  display: flex; flex-direction: column; gap: 2px;
  flex: none; max-height: 132px; overflow-y: auto;
  scrollbar-width: thin;
}
.side-watch .wb-items::-webkit-scrollbar { width: 4px; }
.side-watch .wb-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* 自选行：名称 + 迷你走势 + 涨跌，一行放下 */
.wb-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 6px; border-radius: 6px;
  background: transparent; border: 1px solid transparent;
  cursor: pointer; transition: var(--transition);
  position: relative; overflow: hidden; flex: none;
  line-height: 1.5;
}
.wb-chip:hover { background: var(--hover); border-color: var(--border); transform: none; }
.wb-chip .wb-name {
  font-size: 12px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  flex: 1 1 auto; min-width: 0;
}
.wb-chip .wb-spark { width: 30px; height: 13px; flex: none; opacity: .85; }
.wb-chip .wb-pct {
  font-size: 11.5px; font-weight: 700;
  font-variant-numeric: tabular-nums; flex: none;
}
.wb-chip .wb-del {
  width: 14px; height: 14px; border-radius: 4px; flex: none;
  display: grid; place-items: center; color: var(--muted-foreground);
  opacity: 0; transition: var(--transition);
}
.wb-chip:hover .wb-del { opacity: 1; }
.wb-chip .wb-del:hover { background: var(--destructive, #d73431); color: #fff; }
.wb-chip .wb-del svg { width: 9px; height: 9px; }
.wb-chip .wb-ex { display: none; }

/* 空态：侧栏里要更紧凑 */
.side-watch .wb-empty {
  font-size: 10.5px; color: var(--muted-foreground);
  padding: 2px 4px; line-height: 1.5;
}
.side-watch .wb-empty b { color: var(--foreground); font-weight: 700; }
.side-watch .wb-empty.hidden { display: none; }

/* K线画布容器 */
.hc-klinebox {
  position: relative;
  overflow: hidden;
}
#dt-body .hc-kimg { height: 340px; border-radius: 8px; }

/* ============================================================
   全屏显示模式（用户可选）
   ------------------------------------------------------------
   blocks  = 只保留红绿色块区域（最纯粹的盯盘视图）
   sidebar = 保留侧栏（色块 + 自选/统计/榜单）
   all     = 保留全部（顶栏 + 情绪带 + 侧栏）
   ============================================================ */

/* 任何全屏模式下，色块区域都吃掉全部剩余空间 */
body.fs .layout { flex: 1 1 auto; min-height: 0; }

/* --- blocks：只留色块 --- */
body.fs.fs-hide-top .topbar { display: none; }
body.fs.fs-hide-sidebar .sidebar { display: none; }

/* --- sidebar：留侧栏，隐藏顶栏与情绪带 --- */
body.fs.fs-keep-sidebar .topbar { display: none; }
body.fs:not(.fs-hide-sidebar) .sidebar.hidden { display: flex; }

/* 全屏时右上角异动提示缩小一点，别抢戏 */
body.fs .move-toast { max-width: 260px; top: 10px; right: 12px; }


/* ============================================================
   快捷键提示条（K 线下方，对齐原站「G键固定，M键停靠，S切换排序」）
   ------------------------------------------------------------ */
.hotkeys {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  margin: 8px 0 10px;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--panel-2, rgba(128,140,160,.08));
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted-foreground);
  line-height: 1.5;
}
.hotkeys span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.hotkeys kbd {
  display: inline-block;
  min-width: 17px; padding: 1px 5px;
  border-radius: 4px;
  background: var(--card); color: var(--foreground);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  font-family: var(--mono, ui-monospace, Consolas, monospace);
  font-size: 10.5px; font-weight: 700; text-align: center;
  box-shadow: 0 1px 0 rgba(0,0,0,.12);
}
.hotkeys.pinned { border-color: rgba(255,214,74,.55); background: rgba(255,214,74,.10); }

/* 面板停靠左侧（M 键切换） */
body[data-dock="left"] #detail { left: 0; right: auto; }


/* ============================================================
   面板「已固定」状态视觉（G 键）
   ------------------------------------------------------------
   用户反馈「按了 G 面板没固定」—— 其实是逻辑生效了，
   但视觉反馈太弱（只有提示条边框变色），用户看不出来。
   现在给足反馈：面板金色描边 + 外发光 + 标题旁「已固定」标签。
   ============================================================ */
#detail.pinned {
  border-left: 2px solid rgba(255, 214, 74, .85);
  box-shadow: -6px 0 22px rgba(255, 200, 60, .22), var(--shadow);
}
.pin-flag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  color: #3a2a00;
  background: linear-gradient(180deg, #ffd64a, #f0b429);
  vertical-align: middle;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}


/* ============================================================
   悬浮窗「已锁定」状态（G 键）
   ------------------------------------------------------------
   锁定后鼠标移开也不消失，可以慢慢看 K 线。
   给明显的视觉标记，否则用户不知道锁定生效了。
   ============================================================ */
.hovercard.locked {
  border: 1.5px solid rgba(255, 214, 74, .92);
  box-shadow: 0 0 0 1px rgba(255,214,74,.35), 0 10px 30px rgba(0,0,0,.45);
  pointer-events: none;
}
/* ★ 已移除卡片上方的「已锁定 · 按 G 解锁」浮标（用户要求）
   —— 改到卡片底部快捷键条里高亮显示，见 .hc-keys .k-lock.is-on */


/* ============================================================
   B：迷你走势线（悬浮卡头部，名称右侧）
   ------------------------------------------------------------
   用户要求「跟原站一样显示」——原站每只股票名字后面有一条
   当日走势迷你折线，一眼看出"今天走强还是走弱"。
   实现：内联 SVG（无需 canvas，不占额外内存）。
   ============================================================ */
.hc-spark {
  display: inline-block;
  width: 46px; height: 15px;
  margin-left: 6px;
  vertical-align: middle;
  opacity: .95;
}
.hc-spark path { fill: none; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }

/* 悬浮卡新增字段的样式微调 */
#hc-extra b { color: #e8ecf1; font-weight: 600; font-variant-numeric: tabular-nums; }
.hc-meta2 .hc-exch {
  margin-left: 6px; padding: 0 6px; border-radius: 4px;
  background: var(--panel-2, rgba(128,140,160,.14));
  font-size: 10.5px;
}


/* ============================================================
   悬浮窗扩展内容（原「点击弹出详情面板」已并入）
   ------------------------------------------------------------
   用户要求：把详情面板的内容补进悬浮窗，取消点击弹出的面板。
   新增：市值口径/交易所/同板块排名 + 同板块涨跌榜（12 行）
   ============================================================ */
.hc-rows {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  margin-top: 5px;
  font-size: 12px; color: var(--muted-foreground);
}
.hc-rows b { color: #e8ecf1; font-weight: 600; font-variant-numeric: tabular-nums; }

.hc-peers {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 7px;
}
.hc-peers-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11.5px; color: var(--muted-foreground);
  margin-bottom: 5px;
}
.hc-peers-head b { color: #e8ecf1; font-weight: 700; }
.hc-peers-sort { font-size: 10.5px; opacity: .8; }

.hc-peers-list {
  /* ★ 单列：一行一只股票（用户明确要求） */
  display: block;
}
.hc-peer {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; line-height: 1.75;
  min-width: 0;
  color: #dbe2ea;                       /* 固定浅色（深色浮窗） */
  padding: 1px 4px;
  border-radius: 4px;
}
.hc-peer:hover { background: rgba(255,255,255,.06); }
.hc-peer.me {
  background: rgba(255, 214, 74, .14);
  border-radius: 4px;
  padding: 0 4px;
  margin: 0 -4px;
  font-weight: 700;
}
.hc-peer-dot { width: 5px; height: 5px; border-radius: 50%; flex: none; }
.hc-peer-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #e8ecf1;                       /* ★ 固定浅色，不再用 var(--foreground) */
}
.hc-peer-pct { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; }
.hc-peer-empty { font-size: 11.5px; color: var(--muted-foreground); opacity: .7; }


/* ★★★ 锁定后：悬浮窗可交互（点排序标签 / 滚轮滚动）
   —— 未锁定时保持 pointer-events:none，让鼠标事件穿透到画布（否则挡住色块） */
.hovercard.locked {
  pointer-events: auto !important;
  cursor: default;
}
.hovercard.locked .hc-peers-list { pointer-events: auto; }

/* 排序标签栏 */
.hc-sorts {
  display: flex; flex-wrap: wrap; gap: 3px;
  margin-bottom: 6px;
  max-width: 100%;
  overflow: hidden;                     /* ★ 禁止撑出横向滚动条 */
}
.hc-sort {
  flex: none;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  font-size: 11px; font-family: inherit;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.hc-sort:hover { background: var(--panel-2, rgba(128,140,160,.16)); color: var(--foreground); }
.hc-sort.on {
  background: rgba(255, 214, 74, .18);
  border-color: rgba(255, 214, 74, .65);
  color: var(--foreground);
  font-weight: 700;
}

/* 列表可滚动 */
.hc-peers-list {
  /* ★ 一行只显示一只股票（用户要求）—— 原来是两列网格 */
  max-height: 152px;
  overflow-y: auto;
  overflow-x: hidden;                    /* ★ 禁横向 */
  padding-right: 4px;
  scrollbar-width: auto;                 /* ★ 加宽竖滚动条（原 thin 太窄） */
  overscroll-behavior: contain;
}
.hc-peers-list::-webkit-scrollbar { width: 10px; }          /* ★ 6px → 10px，用户嫌太窄 */
.hc-peers-list::-webkit-scrollbar-thumb {
  background: rgba(170,185,205,.55); border-radius: 5px;
  border: 2px solid transparent; background-clip: padding-box;
}
.hc-peers-list::-webkit-scrollbar-thumb:hover { background: rgba(190,205,225,.75); background-clip: padding-box; }
.hc-peers-list::-webkit-scrollbar-track { background: rgba(255,255,255,.05); border-radius: 5px; }

/* 底部统计行 */
.hc-peers-foot {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 5px; padding-top: 5px;
  border-top: 1px solid var(--border);
  font-size: 10.5px; color: var(--muted-foreground);
}
.hc-peers-foot b { color: #e8ecf1; font-weight: 700; }
.hc-scroll-hint { opacity: .75; font-style: italic; }


/* ============================================================
   悬浮窗底部快捷键提示（对齐原站「G键固定，M键停靠，S切换排序」）
   ------------------------------------------------------------
   深色浮窗专用固定色 —— 不用 var()，避免浅色主题下变黑字。
   ============================================================ */
.hc-keys {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px;
  margin-top: 7px; padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,.09);
  font-size: 11px; color: #9aa7b6;
}
.hc-keys span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.hc-keys kbd {
  display: inline-block; min-width: 16px;
  padding: 1px 5px; border-radius: 4px;
  background: rgba(255,255,255,.10);
  color: #e8ecf1;
  border: 1px solid rgba(255,255,255,.16);
  border-bottom-width: 2px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px; font-weight: 700; text-align: center;
}
.hc-keys-tip { margin-left: auto; opacity: .8; font-style: italic; font-size: 10.5px; }

/* ══════════════════════════════════════════════════════════
   ★★★ 修复「G 锁定后只有半个身子」（用户报）
   ──────────────────────────────────────────────────────────
   病根：卡片固定 716px 高。在 1366x768 / 1280x720 这类屏幕上
         卡片底部会超出视口 → 被切掉 → 看起来「只有半个身子」。
   修法：max-height 跟随视口高度，卡片内部滚动。
        任何屏幕都完整可见。
   ══════════════════════════════════════════════════════════ */
#hovercard {
  /* Clamp the remembered anchor on resize, including while locked. No JS polling. */
  left: clamp(6px, var(--hc-left, 6px), calc(100% - min(480px, calc(100% - 12px)) - 6px));
  top: clamp(6px, var(--hc-top, 6px), calc(100% - min(716px, var(--hc-max, calc(100% - 12px))) - 6px));
  max-width: calc(100% - 12px);
  /* ★★★ 修复「锁定后只有半个身子」（用户报）
     ------------------------------------------------------------
     病根：卡片是 .canvas-wrap 的绝对定位子元素，而 .canvas-wrap
           有 overflow:hidden 且高度只有 ~674px（1280x720 屏）。
           之前用 max-height: calc(100vh - 16px) = 704px →
           卡片底部超出容器 36px → 被裁掉 → 看起来「只有半个身子」。
     修法：max-height 用【父容器高度】而非视口高度。
           并用 JS 变量 --hc-max 兜底（见 dpy-app.js）。 */
  max-height: var(--hc-max, calc(100% - 12px));
  overflow-y: auto;
  overflow-x: hidden;
}
#hovercard::-webkit-scrollbar { width: 9px; }
#hovercard::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.20);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
}
#hovercard::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.32); background-clip: content-box; }
#hovercard::-webkit-scrollbar-track { background: rgba(255,255,255,.05); border-radius: 5px; }

/* 内部各区块也允许纵向滚动（榜单等） */
#hovercard .hc-peers-list { overscroll-behavior: contain; }

/* 窄屏顶栏按功能分行，保留市场、周期、状态和全部操作入口。 */
@media (max-width: 700px) {
  .topbar { height: auto; flex: none; flex-wrap: wrap; gap: 4px; padding: 6px 8px; }
  .topbar .brand { flex: 1 0 130px; font-size: 14px; gap: 6px; }
  .topbar .brand-mark { width: 18px; height: 18px; }
  .topbar .topbar-sep { display: none; }
  .topbar .icon-btn { width: 30px; height: 30px; }
  .topbar .tabs { order: 2; flex: 1 0 100%; }
  .topbar .periods { order: 3; width: 100%; }
  .topbar .period { flex: 1; padding: 5px 4px; }
  .topbar .status { order: 4; width: 100%; font-size: 11px; }
  .hc-head { flex-wrap: wrap; gap: 5px; }
  .hc-name { font-size: 14px; }
  .hc-code { font-size: 10px; }
  .hc-price, .hc-pct { font-size: 14px; }
}

/* ══════════════════════════════════════════════════════════
   ★ 卡片底部快捷键条：锁定后「G 锁定」高亮 + 文案变「按 G 解锁」
     （用户要求：去掉卡片上方的浮标，改到底部这条上提示）
   ══════════════════════════════════════════════════════════ */
.hc-keys .k-item {
  transition: color .15s ease, background .15s ease, box-shadow .15s ease;
  border-radius: 5px;
  padding: 1px 5px;
  margin: -1px -2px;
}
.hc-keys .k-item.is-on {
  color: #ffd64a;
  background: rgba(255,214,74,.14);
  box-shadow: inset 0 0 0 1px rgba(255,214,74,.55);
}
.hc-keys .k-item.is-on kbd {
  background: linear-gradient(180deg, #ffd64a, #f0b429);
  color: #3a2a00;
  border-color: transparent;
}
