/* ============================================================
   ValoPlant 战术板
   首屏(顶栏 / 左右面板 / 画板 / 时间轴)和欢迎弹窗统一走这套 token。
   ============================================================ */
:root {
  /* 表面:冷调近黑,从舞台到卡片逐级变亮 */
  --bg-0: #05070a;                    /* 舞台 */
  --bg-1: #0a0e14;                    /* 面板;和 fabric 画布底色是同一个值 */
  --bg-2: #10141c;                    /* 卡片 / 输入框 */
  --bg-3: #171c27;                    /* hover */
  --bg-4: #202636;                    /* 选中 / 按下 */
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --tx-1: #eef0f6;
  --tx-2: #a6adbd;
  --tx-3: #6f7688;
  --tx-4: #454b5a;
  /* 强调色只有一个:品牌紫 */
  --ac: #a78bfa;
  --ac-hi: #c4b5fd;
  --ac-ink: #0d0b1a;
  --ac-soft: rgba(167, 139, 250, 0.13);
  --ac-line: rgba(167, 139, 250, 0.42);
  --ok: #34d399;
  --bad: #f87171;
  /* 位置色:和画板上 token 的描边是同一组 */
  --r-duelist: #ef4444;
  --r-initiator: #fbbf24;
  --r-sentinel: #10b981;
  --r-controller: #a78bfa;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --glass: rgba(14, 17, 24, 0.8);          /* 浮在画板上的小控件 */
  --glass-solid: rgba(17, 20, 29, 0.93);   /* 菜单:底下的字不能透上来 */
  --shadow-pop: 0 18px 48px -12px rgba(0, 0, 0, 0.78), 0 2px 8px rgba(0, 0, 0, 0.4);
  /* 布局尺寸。画布是正方形,边长 = min(中间区宽, 中间区高) - 40;战术存档按像素坐标存,
     所以同一个窗口尺寸下画布边长不能变,否则老存档就和地图对不上了。
     - 顶栏 + 时间轴的高度之和固定 140px。
     - 两侧面板基准 232 + 252。窗口比较宽、画布被高度卡住时,两边本来是空着的黑边:
       把这部分富余(--spare)分给两侧面板,且分出去的永远不超过富余,所以画布边长不受影响。 */
  --hdr-h: 56px;
  --tl-h: 84px;
  --spare: calc(100vw - 100vh - 344px);          /* = 中间区宽 - (画布边长 + 40),按基准面板宽算 */
  --left-w: calc(232px + clamp(0px, var(--spare) * 0.4, 68px));
  --right-w: calc(252px + clamp(0px, var(--spare) * 0.6, 128px));
  /* 画板在中间区里的位置(和 app.js 的 sizeCanvasToWrap 同一个算法),浮在画板角上的小控件靠它对齐 */
  --wrap-w: calc(100vw - var(--left-w) - var(--right-w));
  --wrap-h: calc(100vh - var(--hdr-h) - var(--tl-h));
  --board: max(320px, min(var(--wrap-w), var(--wrap-h)) - 40px);
  --board-x: calc((var(--wrap-w) - var(--board)) / 2);       /* 画板到中间区左右边的距离 */
  --board-y: calc((var(--wrap-h) - var(--board)) / 2);       /* 到上下边的距离 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--tx-1);
  display: grid;
  grid-template:
    "header   header   header"   var(--hdr-h)
    "left     canvas   right"    1fr
    "timeline timeline timeline" var(--tl-h)
    / var(--left-w) 1fr var(--right-w);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* 全站按钮 / 下拉的底子(各弹窗也靠它) */
button, select {
  background: transparent; color: var(--tx-1); border: 1px solid transparent;
  padding: 6px 11px; border-radius: 4px; cursor: pointer; font-size: 13px;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  min-width: 30px;
}
button:hover { background: var(--bg-4); }
select {
  background: #161a26; border: 1px solid #1f2433;
  padding: 6px 28px 6px 10px;
  min-width: 140px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%236f7688' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
select:hover { border-color: var(--ac); }
:focus-visible { outline: 2px solid var(--ac-line); outline-offset: 2px; }

/* 图标:<svg class="ic"><use href="#i-xxx"/></svg> */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic {
  width: 16px; height: 16px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
kbd {
  font: 500 10.5px var(--mono); color: var(--tx-2);
  background: var(--bg-4); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 4px;
}

/* 进场 */
@keyframes drop-in  { from { opacity: 0; transform: translateY(-8px); } }
@keyframes rise-in  { from { opacity: 0; transform: translateY(8px); } }
@keyframes slide-l  { from { opacity: 0; transform: translateX(-12px); } }
@keyframes slide-r  { from { opacity: 0; transform: translateX(12px); } }
@keyframes fade-in  { from { opacity: 0; } }
@keyframes pop-in   { from { opacity: 0; transform: translateY(-4px) scale(0.97); } }
@keyframes card-in  { from { opacity: 0; transform: translateY(6px) scale(0.94); } }

/* ===== 顶栏 ===== */
header {
  grid-area: header;
  position: relative; z-index: 20;
  /* 三段:左右两段等宽时工具组正好居中;哪边内容更宽就让它多占,工具组跟着让位,不会互相压住 */
  display: grid; grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  align-items: center; column-gap: 14px;
  padding: 0 14px;
  background: linear-gradient(180deg, #0d1119 0%, var(--bg-1) 100%);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  animation: drop-in 0.5s var(--ease) backwards;
}
header::after {            /* 底边一丝紫光 */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--ac-line) 18%, transparent 52%);
  pointer-events: none;
}
.hdr-zone { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hdr-right { justify-content: flex-end; gap: 2px; }
.hdr-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 6px; flex-shrink: 0; }

.brand { display: flex; align-items: center; gap: 9px; margin-right: 8px; flex-shrink: 0; }
.brand-mark {
  width: 24px; height: 24px; flex-shrink: 0; fill: var(--ac);
  filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.5));
}
.brand-word { font-size: 14px; font-weight: 800; letter-spacing: 0.16em; color: var(--tx-1); }
.brand-accent { color: var(--ac); }
.brand-suffix {
  font-size: 11px; font-weight: 500; color: var(--tx-3); letter-spacing: 0.06em;
  padding: 2px 8px; border: 1px solid var(--line); border-radius: 20px;
}
/* 顶栏随窗口变窄一级级收紧:副标题 → 右侧按钮的文字 → 品牌字 */
@media (max-width: 1500px) { .brand-suffix { display: none; } }
@media (max-width: 1200px) { .brand-word { display: none; } }

.ctl { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

header select {
  height: 32px; min-width: 0;
  border: 1px solid var(--line); border-radius: 9px;
  color: var(--tx-1); font-size: 13px; font-weight: 500;
  background-color: var(--bg-2);
  background-repeat: no-repeat;
  transition: border-color 0.15s, background-color 0.15s;
}
header select:hover { border-color: var(--ac-line); background-color: var(--bg-3); }
#mapSelect {
  width: 152px; padding: 0 26px 0 32px;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a78bfa' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M9 4.5L3.5 7v12.5L9 17l6 2.5 5.5-2.5V4.5L15 7z'/><path d='M9 4.5V17'/><path d='M15 7v12.5'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%236f7688' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
  background-position: left 10px center, right 10px center;
  background-size: 15px 15px, 10px 6px;
}
#langSelect {
  width: 74px; margin-left: 6px; padding: 0 22px 0 30px;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f7688' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='8.5'/><path d='M3.5 12h17'/><path d='M12 3.5c2.4 2.6 3.6 5.4 3.6 8.5s-1.2 5.9-3.6 8.5c-2.4-2.6-3.6-5.4-3.6-8.5s1.2-5.9 3.6-8.5z'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%236f7688' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
  background-position: left 9px center, right 8px center;
  background-size: 14px 14px, 10px 6px;
}

/* 顶栏三种按钮:纯图标 / 图标+字 / 工具 */
.icon-btn, .hbtn, .tool {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; min-width: 32px; padding: 0 8px;
  border-radius: 9px; border: 1px solid transparent;
  color: var(--tx-2); font-size: 12.5px; font-weight: 500;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s var(--ease), box-shadow 0.2s;
}
.icon-btn { width: 32px; padding: 0; }
.icon-btn:hover, .hbtn:hover, .tool:hover { background: var(--bg-3); color: var(--tx-1); }
.icon-btn:active, .hbtn:active, .tool:active { transform: scale(0.93); }
.hbtn .lbl { display: none; }                 /* 默认只留图标,宽屏才带字 */
@media (min-width: 1361px) {
  .hbtn-text { padding: 0 10px; }
  .hbtn-text .lbl { display: inline; }
}
@media (min-width: 1640px) {
  .hbtn { padding: 0 10px; }
  .hbtn .lbl { display: inline; }
}
@media (max-width: 1360px) {
  #mapSelect { width: 132px; }
  #langSelect { margin-left: 2px; }
  .hdr-sep { margin: 0 3px; }
}
.ic-chev { width: 12px; height: 12px; margin-left: -3px; opacity: 0.6; transition: transform 0.2s var(--ease); }
.menu-trigger.open .ic-chev { transform: rotate(180deg); }
.menu-trigger.open, #gridBtn.snap-on {
  background: var(--ac-soft); border-color: var(--ac-line); color: var(--ac-hi);
}

.tool-group {
  padding: 3px; gap: 2px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.tool-group .tool, .tool-group .icon-btn { width: 32px; height: 28px; padding: 0; border-radius: 8px; }
.tool .ic { width: 17px; height: 17px; }
.tool.active, .tool.active:hover {
  background: var(--ac); color: var(--ac-ink);
  box-shadow: 0 0 0 1px var(--ac), 0 4px 16px -3px rgba(167, 139, 250, 0.65);
}
header input[type="color"] {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; margin: 0 6px 0 5px; padding: 0;
  border: none; border-radius: 50%; background: none; cursor: pointer;
  box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 3.5px var(--line-2);
  transition: box-shadow 0.2s, transform 0.2s var(--ease);
}
header input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
header input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
header input[type="color"]::-moz-color-swatch { border: none; border-radius: 50%; }
header input[type="color"]:hover { transform: scale(1.1); box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 3.5px var(--ac-line); }

/* 图标按钮的说明气泡(代替系统 title,出得快) */
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 10px); left: 50%;
  transform: translate(-50%, -4px);
  padding: 5px 9px; border-radius: 7px;
  background: #1b2030; border: 1px solid var(--line-2);
  color: var(--tx-1); font-size: 11.5px; font-weight: 500; letter-spacing: 0.01em; white-space: nowrap;
  box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity 0.14s, transform 0.14s var(--ease);
}
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  opacity: 1; transform: translate(-50%, 0); transition-delay: 0.35s;
}
.hdr-right [data-tip]::after { left: auto; right: 0; transform: translate(0, -4px); }
.hdr-right [data-tip]:hover::after, .hdr-right [data-tip]:focus-visible::after { transform: translate(0, 0); }

/* ===== 左右面板 ===== */
.palette { background: var(--bg-1); overflow-y: auto; padding: 14px 12px; }
#agentPalette {
  grid-area: left; border-right: 1px solid var(--line);
  padding: 0; display: flex; flex-direction: column;
  animation: slide-l 0.55s var(--ease) 0.05s backwards;
}
.palette-tabs {
  display: flex; gap: 2px; flex-shrink: 0;
  margin: 10px 10px 0; padding: 3px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px;
}
.ptab {
  flex: 1; min-width: 0; height: 28px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px;
  color: var(--tx-3); font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
}
.ptab:hover { color: var(--tx-1); background: transparent; }
.ptab.active {
  background: var(--bg-4); color: var(--tx-1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 3px rgba(0, 0, 0, 0.45);
}
.ptab-count { font: 600 10px var(--mono); color: var(--tx-3); letter-spacing: 0; }
.ptab.active .ptab-count { color: var(--ac); }
.ptab-content { flex: 1; overflow-y: auto; padding: 12px 12px 18px; }
.ptab-content.hidden { display: none; }

/* 位置筛选 */
.role-filter { display: flex; gap: 4px; margin-bottom: 12px; }
.role-chip {
  --rc: var(--tx-1);
  flex: 1; min-width: 0; height: 40px; padding: 0 2px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px;
  color: var(--tx-3); font-size: 10.5px; font-weight: 600; white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.2s, transform 0.15s var(--ease);
}
.role-chip svg { width: 13px; height: 13px; flex-shrink: 0; }
.role-chip[data-role="all"] svg { display: none; }
.role-chip:hover {
  color: var(--rc); background: var(--bg-3);
  border-color: color-mix(in srgb, var(--rc) 40%, transparent);
}
.role-chip:active { transform: scale(0.95); }
.role-chip.active {
  color: var(--rc);
  background: color-mix(in srgb, var(--rc) 13%, var(--bg-2));
  border-color: color-mix(in srgb, var(--rc) 55%, transparent);
  box-shadow: 0 0 16px -5px color-mix(in srgb, var(--rc) 80%, transparent);
}

/* 特工 */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.agent-card.role-hidden, .agent-group-title.role-hidden { display: none; }
.agent-group-title, .agent-card { --rc: var(--tx-3); }
.agent-group-title[data-role="Duelist"],    .agent-card[data-role="Duelist"]    { --rc: var(--r-duelist); }
.agent-group-title[data-role="Initiator"],  .agent-card[data-role="Initiator"]  { --rc: var(--r-initiator); }
.agent-group-title[data-role="Sentinel"],   .agent-card[data-role="Sentinel"]   { --rc: var(--r-sentinel); }
.agent-group-title[data-role="Controller"], .agent-card[data-role="Controller"] { --rc: var(--r-controller); }
.agent-group-title {
  grid-column: 1 / -1;
  position: sticky; top: -12px; z-index: 2;      /* 滚动时贴顶 */
  display: flex; align-items: center; gap: 7px;
  margin-top: 10px; padding: 8px 2px 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; color: var(--rc);
  background: linear-gradient(var(--bg-1) 80%, transparent);
}
.agent-group-title:first-child { margin-top: -4px; }
.agent-group-title::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
  background: var(--rc); box-shadow: 0 0 8px var(--rc);
}
.agent-group-title::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--rc) 38%, transparent), transparent);
}
.ag-count { font: 600 10px var(--mono); color: var(--tx-3); letter-spacing: 0; }
.agent-card {
  position: relative; aspect-ratio: 1; overflow: hidden;
  border-radius: 10px; border: 1px solid var(--line);
  background:
    radial-gradient(110% 80% at 50% 0%, color-mix(in srgb, var(--rc) 28%, transparent), transparent 72%),
    var(--bg-2);
  cursor: grab;
  transition: transform 0.22s var(--ease), border-color 0.2s, box-shadow 0.25s;
  animation: card-in 0.4s var(--ease) calc(var(--i, 0) * 26ms + 80ms) backwards;
}
/* 按行错开进场(大致每 3–4 个一行) */
.agent-grid > :nth-child(n+5)  { --i: 1; }
.agent-grid > :nth-child(n+8)  { --i: 2; }
.agent-grid > :nth-child(n+11) { --i: 3; }
.agent-grid > :nth-child(n+14) { --i: 4; }
.agent-grid > :nth-child(n+17) { --i: 5; }
.agent-grid > :nth-child(n+20) { --i: 6; }
.agent-grid > :nth-child(n+23) { --i: 7; }
.agent-grid > :nth-child(n+26) { --i: 8; }
.agent-card img {
  width: 100%; height: 100%; object-fit: cover; pointer-events: none;
  transform: scale(1.04);
  transition: transform 0.4s var(--ease);
}
.agent-card:hover {
  z-index: 1; transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--rc) 75%, transparent);
  box-shadow: 0 10px 22px -10px var(--rc), inset 0 0 0 1px color-mix(in srgb, var(--rc) 22%, transparent);
}
.agent-card:hover img { transform: scale(1.14); }
.agent-card:active { cursor: grabbing; transform: scale(0.95); }
.agent-card .name {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px 3px 5px;
  background: linear-gradient(to top, rgba(5, 7, 10, 0.95) 28%, rgba(5, 7, 10, 0.6) 62%, transparent);
  color: #fff; font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agent-card .role-stripe { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; z-index: 1; }

/* 武器 */
.weapon-list { display: flex; flex-direction: column; gap: 14px; }
.weapon-section-title {
  display: flex; align-items: center; gap: 7px; margin-bottom: 7px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--tx-2);
}
.cat-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.weapon-section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.weapon-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 3px;
  min-height: 60px; padding: 9px 9px 7px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  cursor: grab;
  transition: transform 0.2s var(--ease), border-color 0.2s, background 0.2s;
}
.weapon-card:hover { border-color: var(--ac-line); background: var(--bg-3); transform: translateY(-1px); }
.weapon-card:active { cursor: grabbing; transform: scale(0.97); }
.weapon-card img {
  width: 100%; height: 22px; object-fit: contain; object-position: left center;
  pointer-events: none; opacity: 0.92;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
}
.weapon-card .weapon-name {
  font-size: 11.5px; font-weight: 600; color: var(--tx-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.weapon-card .weapon-cost { font: 500 10.5px var(--mono); color: var(--tx-3); }
.weapon-card .weapon-cost.free { color: var(--tx-4); }
.weapon-card .weapon-cost::before { content: "$"; opacity: 0.6; margin-right: 1px; }

/* 标记 */
.marker-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.marker-card {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 6px 10px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  cursor: grab;
  transition: transform 0.2s var(--ease), border-color 0.2s, background 0.2s;
}
.marker-card:hover { border-color: var(--ac-line); background: var(--bg-3); transform: translateY(-2px); }
.marker-card:active { cursor: grabbing; transform: scale(0.96); }
.marker-card img {
  width: 34px; height: 34px; pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
  transition: transform 0.3s var(--ease);
}
.marker-card:hover img { transform: scale(1.1) rotate(-5deg); }
.marker-card .marker-label { font-size: 11.5px; font-weight: 600; color: var(--tx-2); }

/* 右栏 */
#abilityPalette {
  grid-area: right; border-left: 1px solid var(--line);
  padding: 12px 12px 96px;                      /* 底部留给右下角的 AI 教练按钮 */
  animation: slide-r 0.55s var(--ease) 0.05s backwards;
}
.palette-title {
  display: flex; align-items: center; gap: 8px;
  margin: 22px 0 10px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--tx-3);
}
.palette-title:first-child { margin-top: 2px; }
.palette-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.palette-sub {
  color: var(--ac); text-transform: none; letter-spacing: 0.02em;
  font-size: 11.5px; font-weight: 600;
}

.ability-list { display: flex; flex-direction: column; gap: 5px; }
.ability-card {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px 7px 7px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px;
  cursor: grab;
  transition: transform 0.2s var(--ease), border-color 0.2s, background 0.2s;
  animation: rise-in 0.3s var(--ease) backwards;
}
.ability-card:nth-child(2) { animation-delay: 40ms; }
.ability-card:nth-child(3) { animation-delay: 80ms; }
.ability-card:nth-child(4) { animation-delay: 120ms; }
.ability-card:nth-child(n+5) { animation-delay: 160ms; }
.ability-card:hover { border-color: var(--ac-line); background: var(--bg-3); transform: translateX(-2px); }
.ability-card:active { cursor: grabbing; transform: scale(0.98); }
.ability-card img {
  width: 34px; height: 34px; padding: 6px; flex-shrink: 0;
  border-radius: 9px; background: var(--bg-4);
  pointer-events: none;
}
.ability-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ability-name {
  font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ability-slot {
  font: 500 10px var(--mono); color: var(--tx-3);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.ability-key {
  flex-shrink: 0; min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 11px var(--mono); color: var(--tx-2);
  background: var(--bg-1); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px;
}

/* 空状态 */
.hint {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px 16px 18px;
  border: 1px dashed var(--line-2); border-radius: 12px;
  background: radial-gradient(120% 100% at 50% 0%, rgba(167, 139, 250, 0.07), transparent 70%);
  color: var(--tx-3); font-size: 11.5px; line-height: 1.65; text-align: center; text-wrap: balance;
}
.hint::before {
  content: ""; width: 36px; height: 36px; border-radius: 11px;
  border: 1px solid var(--line-2);
  background: var(--bg-3) center / 18px 18px no-repeat;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a78bfa' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><path d='M5.5 4l5.2 14.5 2.1-6.2 6.2-2.1z'/><path d='M15.5 16.5l3.5 3.5' stroke-dasharray='1.5 2.5'/></svg>");
}
#lineupList .hint::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a78bfa' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='4' width='16' height='16' rx='3' stroke-dasharray='2.6 2.6'/><circle cx='9.5' cy='10' r='1.6'/><circle cx='14.8' cy='14.2' r='1.6'/><path d='M10.8 11l2.7 2.2'/></svg>");
}

/* 选中详情 */
.selection-info {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  font-size: 11.5px; color: var(--tx-2); line-height: 1.6;
  max-height: 220px; overflow-y: auto;
}
.selection-info.hidden { display: none; }
.selection-info .si-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border: 1.5px solid var(--ac); border-radius: 10px;
  object-fit: contain; background: var(--bg-1);
}
.selection-info .si-icon-circle { border-radius: 50%; object-fit: cover; }
.selection-info .si-icon-weapon { height: 24px; align-self: center; padding: 2px; border: none; background: none; }
.selection-info .si-icon-marker {
  width: 22px; height: 22px; margin-top: 4px;
  border: none; border-radius: 50%; box-shadow: 0 0 10px currentColor;
}
.selection-info .si-body { flex: 1; min-width: 0; }
.selection-info .si-name { display: block; margin-bottom: 1px; color: var(--tx-1); font-weight: 600; font-size: 13.5px; }
.selection-info .si-meta {
  margin-bottom: 7px; color: var(--tx-3); font-size: 10.5px;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.selection-info .si-desc { color: var(--tx-2); font-size: 11.5px; }

/* Lineup 库 */
.lineup-title { justify-content: space-between; }
.lineup-title::after { display: none; }
.lineup-actions { display: inline-flex; gap: 4px; }
.mini-btn {
  width: 24px; height: 24px; min-width: 24px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 7px;
  color: var(--tx-3);
}
.mini-btn .ic { width: 13px; height: 13px; }
.mini-btn:hover { color: var(--ac); border-color: var(--ac-line); background: var(--bg-3); }
.lineup-search {
  width: 100%; height: 30px; margin-bottom: 7px; padding: 0 10px 0 30px;
  background: var(--bg-2) 10px center / 13px 13px no-repeat;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f7688' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='6.2'/><path d='M19.8 19.8l-4.3-4.3'/></svg>");
  border: 1px solid var(--line); border-radius: 9px;
  color: var(--tx-1); font-size: 12px; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lineup-search::placeholder { color: var(--tx-3); }
.lineup-search:focus { outline: none; border-color: var(--ac-line); box-shadow: 0 0 0 3px var(--ac-soft); }
.lineup-filter { margin-bottom: 7px; }
.lineup-filter .role-chip { height: 34px; font-size: 10px; gap: 2px; }
.lineup-filter .role-chip svg { width: 12px; height: 12px; }
.star-chip { flex: 0 0 30px; }
.star-chip.active svg { fill: currentColor; }
.lineup-filter-extra { display: flex; gap: 6px; margin-bottom: 10px; }
.lineup-filter-extra select {
  flex: 1; min-width: 0; height: 28px; padding: 0 22px 0 9px;
  background-color: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--tx-2); font-size: 11.5px;
  background-position: right 8px center;
}
.lineup-filter-extra select:hover, .lineup-filter-extra select:focus { border-color: var(--ac-line); outline: none; }

.lineup-list { display: flex; flex-direction: column; gap: 5px; }
.lineup-card {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  content-visibility: auto; contain-intrinsic-size: auto 52px;   /* 公共库一张图几百条,屏外的先不画 */
}
.lineup-card:hover { border-color: var(--ac-line); background: var(--bg-3); }
.lineup-avatar {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 50%; border: 1.5px solid var(--ac);
  object-fit: cover; background: var(--bg-4);
}
.lineup-avatar-empty { border-style: dashed; }
.lineup-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lineup-card .lineup-name {
  min-width: 0; font-size: 12px; font-weight: 600; color: var(--tx-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lineup-card .lineup-sub {
  font-size: 10.5px; color: var(--tx-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lineup-card .lineup-meta {
  position: absolute; right: 10px; bottom: 8px;
  font: 500 10px var(--mono); color: var(--tx-3);
}
/* 标星 / 详情 / 删除:悬停才出现,叠在右上,不占标题的宽度 */
.lineup-card .lineup-star, .lineup-card .lineup-info, .lineup-card .lineup-del {
  position: absolute; top: 5px;
  width: 20px; height: 20px; min-width: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 6px; background: var(--bg-4);
  color: var(--tx-2); font-size: 12px; line-height: 1;
  opacity: 0; transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.lineup-card .lineup-star { right: 6px; }
.lineup-card .lineup-info { right: 29px; }
.lineup-card .lineup-del  { right: 52px; }
.lineup-card:hover .lineup-star, .lineup-card:hover .lineup-info, .lineup-card:hover .lineup-del,
.lineup-card .lineup-star.on { opacity: 1; }
.lineup-card:hover .lineup-name { padding-right: 68px; }
.lineup-card:has(.lineup-star.on) .lineup-name { padding-right: 24px; }
.lineup-card:has(.lineup-star.on):hover .lineup-name { padding-right: 68px; }
.lineup-card .lineup-star.on { color: #fbbf24; background: transparent; }
.lineup-card:hover .lineup-star.on { background: var(--bg-4); }
.lineup-card .lineup-star:hover { color: #fbbf24; }
.lineup-card .lineup-info:hover { color: var(--ac-hi); }
.lineup-card .lineup-del:hover { color: #fff; background: var(--bad); }
.lu-has-video { font-size: 11px; margin-left: 4px; opacity: 0.7; }

/* 提示 */
.tips { list-style: none; padding: 0; }
.tips.hidden { display: none; }
.tips li {
  position: relative; padding: 4px 0 4px 15px;
  color: var(--tx-3); font-size: 11.5px; line-height: 1.55;
}
.tips li::before {
  content: ""; position: absolute; left: 2px; top: 11px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--ac); opacity: 0.7;
}

/* ===== 画板 ===== */
#canvasWrap {
  grid-area: canvas; position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: var(--bg-0);
}
#canvasWrap::before {      /* 点阵地面 */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 78% 78% at 50% 50%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 78% 78% at 50% 50%, #000 30%, transparent 100%);
}
#canvasWrap::after {       /* 画板背后一团慢慢呼吸的环境光;到中间区边缘正好淡完,不留硬边 */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(167, 139, 250, 0.2), rgba(99, 112, 224, 0.08) 58%, transparent 100%);
  animation: stage-breathe 9s ease-in-out infinite alternate;
}
@keyframes stage-breathe {
  from { opacity: 0.55; transform: scale(0.94); }
  to   { opacity: 1;    transform: scale(1); }
}
/* 只做透明度进场:画板和它的祖先不能加 transform,fabric 靠它们的位置算鼠标坐标 */
.canvas-container {
  border-radius: 14px;
  box-shadow:
    0 0 0 1px var(--line-2),
    0 34px 70px -28px rgba(0, 0, 0, 0.95),
    0 0 100px -24px rgba(167, 139, 250, 0.26);
  animation: fade-in 0.8s ease 0.1s backwards;
}
.canvas-container canvas { border-radius: 14px; }
.canvas-container::before {   /* 四角取景框 */
  content: ""; position: absolute; inset: -8px; pointer-events: none;
  --b: linear-gradient(var(--ac), var(--ac));
  background:
    var(--b) left top / 20px 1.5px,      var(--b) left top / 1.5px 20px,
    var(--b) right top / 20px 1.5px,     var(--b) right top / 1.5px 20px,
    var(--b) left bottom / 20px 1.5px,   var(--b) left bottom / 1.5px 20px,
    var(--b) right bottom / 20px 1.5px,  var(--b) right bottom / 1.5px 20px;
  background-repeat: no-repeat;
  animation: bracket-pulse 4.5s ease-in-out infinite alternate;
}
@keyframes bracket-pulse { from { opacity: 0.4; } to { opacity: 0.95; } }
canvas { display: block; border-radius: 4px; }

/* 准星 overlay:绝对定位浮在主 canvas 上,pointer-events 透明,不挡操作 */
#crosshairOverlay {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
  /* mix-blend-mode: screen 让暗色背景下白色准星更亮 */
  mix-blend-mode: screen;
}
#crosshairOverlay.hidden { display: none; }

.loading {
  position: absolute; color: var(--tx-3); font-size: 12px; letter-spacing: 0.16em;
  animation: fade-in 0.9s ease infinite alternate;
}
.loading.hidden { display: none; }

/* 画板右上角的小控制条(贴在画板角内侧) */
#floatingControls {
  position: absolute; top: calc(var(--board-y) + 10px); right: calc(var(--board-x) + 10px); z-index: 5;
  display: flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 10px 28px -12px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: fade-in 0.6s ease 0.3s backwards;
}
.floating-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 26px; min-width: 26px; padding: 0 8px;
  border: none; border-radius: 8px; background: transparent;
  color: var(--tx-3); font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
}
.floating-btn .ic { width: 14px; height: 14px; }
.floating-btn:hover { color: var(--tx-1); background: var(--bg-3); }
.floating-btn.active { color: var(--ac-hi); background: var(--ac-soft); }
#helpBtn { padding: 0; }
.floating-slider {
  display: flex; align-items: center; gap: 8px;
  height: 26px; margin: 0 2px; padding: 0 10px;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
.fs-label { font-size: 10.5px; font-weight: 600; color: var(--tx-3); letter-spacing: 0.08em; }
.fs-value { min-width: 34px; text-align: right; font: 600 10.5px var(--mono); color: var(--tx-2); }
#sizeSlider {                    /* 平时收起只显示百分比,指到「尺寸」上再展开,少挡一点地图 */
  -webkit-appearance: none; appearance: none;
  width: 0; margin: 0 -4px; opacity: 0;
  height: 3px; background: var(--bg-4);
  border-radius: 2px; outline: none; cursor: pointer;
  transition: width 0.25s var(--ease), margin 0.25s var(--ease), opacity 0.2s;
}
.floating-slider:hover #sizeSlider, .floating-slider:focus-within #sizeSlider { width: 76px; margin: 0; opacity: 1; }
@media (hover: none) { #sizeSlider { width: 76px; margin: 0; opacity: 1; } }
#sizeSlider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; background: #fff;
  border-radius: 50%; cursor: pointer;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.35), 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s var(--ease);
}
#sizeSlider::-webkit-slider-thumb:hover { transform: scale(1.2); }
#sizeSlider::-moz-range-thumb {
  width: 12px; height: 12px; background: #fff; border: none;
  border-radius: 50%; cursor: pointer;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.35);
}

/* ===== 播放进度条(贴在时间轴上沿) ===== */
#playbackProgress {
  position: fixed;
  left: var(--left-w); right: var(--right-w);
  bottom: var(--tl-h);
  height: 2px;
  background: var(--line);
  z-index: 6;
  transition: opacity 0.25s, height 0.15s;
}
#playbackProgress.hidden { opacity: 0; pointer-events: none; visibility: hidden; }
#playbackProgress:hover, #playbackProgress.scrubbing { height: 5px; }
#playbackProgress.scrubbing .playback-fill { transition: none; }
.playback-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--ac), var(--ac-hi));
  transition: width 0.2s linear;
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.7);
}
.playback-label {              /* 画板右下角内侧 */
  position: absolute; bottom: calc(100% + var(--board-y) + 10px); right: calc(var(--board-x) + 10px);
  padding: 3px 8px; border-radius: 7px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2);
  font: 600 10px var(--mono); color: var(--ac-hi); letter-spacing: 0.08em;
}

/* ===== 时间轴 ===== */
#timeline {
  grid-area: timeline;
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: linear-gradient(180deg, var(--bg-1), #0c1018);
  border-top: 1px solid var(--line);
  overflow: hidden;
  animation: rise-in 0.55s var(--ease) 0.1s backwards;
}
.timeline-status {
  display: flex; flex-direction: column; gap: 3px;
  flex-shrink: 0; min-width: 96px; padding-right: 4px;
}
.status-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--tx-3);
}
.status-meta { font-size: 11px; font-weight: 500; color: var(--tx-2); font-variant-numeric: tabular-nums; }
.save-status { color: var(--tx-3); }
.save-status::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px;
  border-radius: 50%; background: var(--tx-4); vertical-align: 1px;
}
.save-status.ok { color: var(--ok); }
.save-status.ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.save-status.fail { color: var(--bad); }
.save-status.fail::before { background: var(--bad); box-shadow: 0 0 8px var(--bad); }

.rounds-list { display: flex; align-items: center; gap: 8px; flex: 1; overflow-x: auto; padding: 8px 2px; }
.round-card {
  flex-shrink: 0; position: relative; overflow: hidden;
  width: 112px; height: 62px; padding: 7px 9px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px;
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.25s;
}
.round-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.round-card.active {
  border-color: var(--ac);
  box-shadow: 0 0 0 1px var(--ac), 0 8px 24px -8px rgba(167, 139, 250, 0.65);
}
.round-card .round-thumb {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0.8; pointer-events: none;
  transition: opacity 0.2s, transform 0.5s var(--ease);
}
.round-card::after {       /* 压暗上下两头,让字站得住 */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(5, 7, 10, 0.9), rgba(5, 7, 10, 0) 58%, rgba(5, 7, 10, 0.42));
}
.round-card.active .round-thumb { opacity: 1; }
.round-card:hover .round-thumb { transform: scale(1.07); }
.round-card .round-num, .round-card .round-name { position: relative; z-index: 1; }
.round-card .round-num {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em; color: var(--tx-2);
  font-variant-numeric: tabular-nums;
}
.round-card.active .round-num { color: var(--ac-hi); }
.round-card .round-name {
  font-size: 12.5px; font-weight: 600; color: var(--tx-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.round-card .round-delete {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 18px; height: 18px; min-width: 0; padding: 0;
  border: none; border-radius: 6px; background: rgba(5, 7, 10, 0.65);
  color: var(--tx-2); font-size: 13px; line-height: 1;
  opacity: 0; transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.round-card:hover .round-delete { opacity: 1; }
.round-card .round-delete:hover { color: #fff; background: var(--bad); }

.transport {
  display: flex; align-items: center; gap: 2px; padding: 3px; flex-shrink: 0;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
}
.timeline-select {
  height: 30px; width: 64px; min-width: 0; padding: 0 20px 0 10px;
  border: none; border-radius: 8px;
  background-color: transparent; background-position: right 8px center;
  color: var(--tx-2); font: 600 12px var(--mono);
}
.timeline-select:hover { background-color: var(--bg-3); color: var(--tx-1); }
.timeline-btn {
  height: 30px; padding: 0 13px;
  border: none; border-radius: 8px;
  color: var(--tx-1); font-size: 12px; font-weight: 600; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.timeline-btn:hover { background: var(--bg-3); }
.timeline-btn:active { transform: scale(0.96); }
#recordBtn::first-letter { color: var(--bad); }
.timeline-btn.playing { color: var(--ok); background: rgba(52, 211, 153, 0.12); }
.timeline-btn.recording {
  color: var(--bad); background: rgba(248, 113, 113, 0.12);
  animation: rec-pulse 1.2s infinite;
}
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.45); }
  50%      { box-shadow: 0 0 0 5px rgba(248, 113, 113, 0); }
}
.round-add {
  flex-shrink: 0; height: 38px; padding: 0 14px;
  border: 1px dashed var(--line-2); border-radius: 11px;
  color: var(--tx-2); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.round-add:hover { border-style: solid; border-color: var(--ac-line); color: var(--ac-hi); background: var(--ac-soft); }
.round-add:active { transform: scale(0.96); }

/* ===== 右键菜单 ===== */
.context-menu {
  position: fixed; z-index: 100;
  min-width: 188px; padding: 5px;
  background: var(--glass-solid);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: var(--shadow-pop), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  font-size: 12.5px;
  animation: pop-in 0.14s var(--ease);
}
.context-menu.hidden { display: none; }
.context-menu:not(.hidden) ~ #canvasTooltip { display: none; }   /* 菜单开着时别让悬停名牌压在上面 */
.context-menu button {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; height: 28px; padding: 0 10px; text-align: left;
  border: none; border-radius: 7px;
  color: var(--tx-1); font-size: 12.5px;
  min-width: 0;
}
.context-menu button:hover { background: var(--ac-soft); }
.context-menu button.danger { color: var(--bad); }
.context-menu button.danger:hover { background: rgba(248, 113, 113, 0.14); }
.ctx-lead { display: inline-flex; align-items: center; gap: 7px; }
.ctx-color-row { display: flex; align-items: center; gap: 7px; padding: 6px 10px; }
.ctx-color-label { flex: 1; font-size: 12.5px; color: var(--tx-2); white-space: nowrap; }
.context-menu .ctx-color-dot {
  width: 15px; height: 15px; border-radius: 50%;
  border: none !important;
  cursor: pointer; padding: 0 !important;
  min-width: 0 !important;
  display: flex !important; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px #151922, 0 0 0 3px transparent;
  transition: transform 0.15s var(--ease), box-shadow 0.15s;
}
.context-menu .ctx-color-dot:hover { transform: scale(1.2); box-shadow: 0 0 0 2px #151922, 0 0 0 3.5px #fff; }
.context-menu .ctx-color-clear {
  background: transparent; color: var(--tx-3); font-size: 10px;
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.context-sep { height: 1px; background: var(--line); margin: 5px 8px; }

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

/* ===== Help Modal ===== */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.modal.hidden { display: none; }
.modal-bg {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  background: #11141c; border: 1px solid #2a3448;
  border-radius: 10px;
  width: min(680px, 90vw);
  max-height: 86vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(167,139,250,0.2);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #1f2433;
}
.modal-header h3 {
  font-size: 14px; letter-spacing: 2px; text-transform: uppercase;
  color: #a78bfa; font-weight: 700; margin: 0;
}
.modal-close {
  background: transparent; border: none; color: #94a3b8;
  font-size: 22px; line-height: 1; cursor: pointer;
  padding: 4px 10px; border-radius: 4px;
  min-width: 0;
}
.modal-close:hover { color: #ef4444; background: rgba(239,68,68,0.1); }
.modal-body {
  overflow-y: auto; padding: 16px 24px 22px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px 32px;
}
.modal-body section h4 {
  font-size: 10px; text-transform: uppercase; letter-spacing: 2.5px;
  color: #64748b; font-weight: 700; margin: 0 0 8px;
  padding-bottom: 6px; border-bottom: 1px solid #1f2433;
}
.kbd-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; gap: 12px; font-size: 12px;
}
.kbd-row > span:first-child {
  color: #e5e7eb; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
}
.kbd-row > span:last-child {
  color: #94a3b8; font-size: 11px;
  text-align: right;
}
.kbd-row kbd {
  font-size: 10px; color: #a78bfa;
  background: #1a1f2e;
  border: 1px solid #2a3448;
  padding: 2px 7px; border-radius: 4px;
  font-family: -apple-system, "Helvetica Neue", monospace;
  letter-spacing: 0.5px;
}
.role-swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 5px currentColor;
  margin-right: 4px;
}

/* ===== 画板悬停名牌 ===== */
.canvas-tooltip {
  position: fixed;
  padding: 4px 9px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); border-radius: 7px;
  color: var(--tx-1); font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
  white-space: nowrap; pointer-events: none;
  z-index: 220;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.7);
}
.canvas-tooltip.hidden { display: none; }

/* ===== Update banner(新版本提示)===== */
.update-banner {
  position: fixed; top: 12px; left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  display: flex; align-items: center; gap: 12px;
  background: #11141c; border: 1px solid #a78bfa;
  border-radius: 6px;
  padding: 8px 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.6), 0 0 0 1px rgba(167,139,250,0.3);
  font-size: 12px; color: #e5e7eb;
  letter-spacing: 0.4px;
}
.update-banner.hidden { display: none; }
.update-banner button {
  background: #a78bfa; color: #0a0e14;
  border: none; padding: 4px 12px; border-radius: 4px;
  cursor: pointer; font-size: 12px; font-weight: 700;
  min-width: 50px;
}
.update-banner button:hover { background: #c4b5fd; }
.update-banner button#updateBannerClose {
  background: transparent; color: #64748b;
  padding: 0 4px; font-size: 16px; min-width: auto;
}
.update-banner button#updateBannerClose:hover { color: #ef4444; background: transparent; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: calc(var(--tl-h) + 18px); left: 50%;
  transform: translateX(-50%) translateY(10px) scale(0.97);
  display: flex; align-items: center; gap: 9px;
  padding: 9px 16px 9px 13px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--line-2); border-radius: 12px;
  color: var(--tx-1); font-size: 12.5px; font-weight: 500;
  box-shadow: var(--shadow-pop), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.25s var(--ease);
  z-index: 1000;
}
.toast::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  background: var(--ac); box-shadow: 0 0 10px var(--ac);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
.toast.hidden { display: none; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1); border-radius: 4px;
  border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); background-clip: content-box; }

/* ===== Crosshair Modal(strats.gg 风格) ===== */
.modal-card-wide { width: min(960px, 94vw); }
.crosshair-body {
  grid-template-columns: 1.1fr 1fr !important;
  gap: 24px !important;
  padding: 18px 24px 22px !important;
}
.crosshair-left section { margin-bottom: 16px; }
.crosshair-left section h4 {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
}
.ch-count {
  background: #1a1f2e; color: #a78bfa;
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  border: 1px solid #2a3448;
}
.ch-input {
  width: 100%; box-sizing: border-box;
  background: #0a0e14; border: 1px solid #2a3448;
  color: #e5e7eb; font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 11px; line-height: 1.4;
  padding: 8px 10px; border-radius: 6px;
  resize: vertical;
}
.ch-input:focus { outline: none; border-color: #a78bfa; box-shadow: 0 0 0 1px rgba(167,139,250,0.4); }
.ch-row {
  display: flex; gap: 8px; margin-top: 8px; align-items: center;
}
.ch-name {
  flex: 1; background: #0a0e14; border: 1px solid #2a3448;
  color: #e5e7eb; padding: 6px 10px; border-radius: 6px;
  font-size: 12px;
}
.ch-name:focus { outline: none; border-color: #a78bfa; }
.ch-row button.primary {
  background: #a78bfa; color: #0a0e14; border: none;
  padding: 6px 14px; border-radius: 6px; font-weight: 700;
  cursor: pointer; font-size: 12px;
}
.ch-row button.primary:hover { background: #c4b5fd; }
.ch-tip {
  color: #64748b; font-size: 10.5px; margin-top: 6px; line-height: 1.5;
}
.ch-presets {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 6px;
}
.ch-preset {
  background: #131826; border: 1px solid #1f2433;
  border-radius: 6px; padding: 6px 4px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: all 0.15s;
}
.ch-preset:hover { border-color: #a78bfa; transform: translateY(-1px); }
.ch-preset canvas {
  width: 56px; height: 56px; background: #0a0e14;
  border-radius: 4px;
}
.ch-preset .ch-preset-name {
  font-size: 10px; color: #e5e7eb; font-weight: 600;
  letter-spacing: 0.5px;
}
.ch-saved-list {
  max-height: 220px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.ch-saved-empty {
  color: #475569; font-size: 11px; text-align: center;
  padding: 20px 0; font-style: italic;
}
.ch-saved-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  background: #131826; border: 1px solid #1f2433;
  transition: all 0.15s;
}
.ch-saved-item:hover { border-color: #a78bfa; background: #1a1f2e; }
.ch-saved-item.active {
  border-color: #a78bfa;
  box-shadow: 0 0 0 1px rgba(167,139,250,0.3);
}
.ch-saved-item canvas {
  width: 36px; height: 36px; background: #0a0e14;
  border-radius: 4px; flex-shrink: 0;
}
.ch-saved-meta {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.ch-saved-name {
  font-size: 12px; color: #e5e7eb; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ch-saved-code {
  font-size: 9px; color: #64748b;
  font-family: ui-monospace, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ch-saved-del {
  background: transparent; border: none; color: #64748b;
  font-size: 14px; padding: 4px 6px; cursor: pointer; border-radius: 4px;
}
.ch-saved-del:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

.crosshair-right {
  display: flex; flex-direction: column; gap: 14px;
}
.ch-preview-wrap {
  position: relative;
  background: linear-gradient(135deg, #1a2333 0%, #0a0e14 100%);
  border: 1px solid #2a3448;
  border-radius: 10px;
  padding: 16px;
  display: flex; align-items: center; justify-content: center;
  min-height: 312px;
}
#chPreviewCanvas {
  display: block;
  image-rendering: pixelated;
}
.ch-preview-label {
  position: absolute; top: 8px; left: 12px;
  font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
  color: #64748b; font-weight: 700;
}
.ch-actions {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.ch-actions button {
  background: #131826; border: 1px solid #1f2433; color: #e5e7eb;
  padding: 8px; border-radius: 6px; cursor: pointer;
  font-size: 11px; font-weight: 600;
  transition: all 0.15s;
}
.ch-actions button:hover { border-color: #a78bfa; color: #a78bfa; }
.ch-params {
  background: #0a0e14; border: 1px solid #1f2433;
  border-radius: 8px; padding: 12px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  font-size: 11px;
  font-family: ui-monospace, "Cascadia Code", monospace;
}
.ch-param-row {
  display: flex; justify-content: space-between;
  padding: 2px 0;
}
.ch-param-key { color: #64748b; }
.ch-param-val { color: #a78bfa; font-weight: 600; }

/* ===== Lineup 卡片上的小标签 ===== */
.lineup-card-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.lu-type-badge {
  font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
  padding: 1px 6px; border-radius: 5px;
  background: var(--ac-soft); color: var(--ac-hi);
}
.lu-type-smoke { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; }
.lu-type-flash { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.lu-type-molly { background: rgba(239, 68, 68, 0.16); color: #fca5a5; }
.lu-type-recon { background: rgba(96, 165, 250, 0.16); color: #93c5fd; }
.lu-type-setup { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.lu-site-badge {
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 5px;
  background: var(--bg-4); color: var(--tx-2);
}
.lu-ai-score {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  background: var(--ac-soft); color: var(--ac-hi);
  border: 1px solid var(--ac-line); border-radius: 8px;
  font: 600 9.5px var(--mono); letter-spacing: 0.03em;
  vertical-align: middle;
}
.lu-tag-chip {
  font-size: 9.5px; padding: 1px 6px; border-radius: 8px;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.28);
  color: #67e8f9; font-weight: 600;
}
.lu-tag-more { font-size: 9px; color: var(--tx-3); font-weight: 600; padding: 1px 4px; }
.lu-diff { display: inline-flex; gap: 1px; color: #fbbf24; font-size: 9px; }
.lu-diff-empty { color: var(--tx-4); }

/* ===== Crosshair Editor(调参面板)===== */
.ch-editor {
  background: #0a0e14; border: 1px solid #1f2433;
  border-radius: 8px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.ch-edit-row {
  display: flex; align-items: center; gap: 10px;
}
.ch-edit-label {
  font-size: 10.5px; color: #94a3b8; min-width: 36px;
  letter-spacing: 0.5px;
}
.ch-color-row {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.ch-color-swatch {
  width: 18px; height: 18px; border-radius: 3px;
  border: 1.5px solid #2a3448; cursor: pointer;
  padding: 0; transition: all 0.12s;
}
.ch-color-swatch:hover { transform: scale(1.15); }
.ch-color-swatch.active {
  border-color: #a78bfa;
  box-shadow: 0 0 0 1px rgba(167,139,250,0.5);
}
.ch-color-custom {
  width: 22px !important; height: 22px;
  background: linear-gradient(135deg, #ff0080 0%, #ffff00 50%, #00ffff 100%);
}
.ch-edit-group {
  background: #131826; border: 1px solid #1f2433;
  border-radius: 6px; padding: 6px 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.ch-edit-group.disabled .ch-slider-row {
  opacity: 0.4; pointer-events: none;
}
.ch-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: #e5e7eb;
  cursor: pointer; user-select: none;
}
.ch-toggle input { accent-color: #a78bfa; cursor: pointer; }
.ch-slider-row {
  display: grid; grid-template-columns: 44px 1fr 28px;
  gap: 8px; align-items: center;
  font-size: 10px; color: #94a3b8;
}
.ch-slider-row input[type=range] {
  width: 100%; accent-color: #a78bfa;
  height: 4px;
}
.ch-sl-val {
  color: #a78bfa; font-family: ui-monospace, monospace;
  font-size: 10px; text-align: right; font-weight: 600;
}
.ch-reset {
  margin-top: 4px;
  background: transparent; border: 1px dashed #2a3448;
  color: #94a3b8; padding: 4px; border-radius: 4px;
  cursor: pointer; font-size: 11px;
}
.ch-reset:hover { border-color: #a78bfa; color: #a78bfa; }

/* ===== Guide Modal(攻略中心,3DM 风格)===== */
.guide-search {
  flex: 0 0 240px;
  background: #0a0e14; border: 1px solid #2a3448;
  color: #e5e7eb; padding: 6px 10px; border-radius: 6px;
  font-size: 12px; margin: 0 12px;
}
.guide-search:focus { outline: none; border-color: #a78bfa; }
.modal-header { gap: 12px; }
.guide-body {
  grid-template-columns: 180px 1fr !important;
  gap: 0 !important;
  padding: 0 !important;
  min-height: 60vh; max-height: 80vh;
}
.guide-nav {
  background: #0a0e14; border-right: 1px solid #1f2433;
  padding: 12px 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.guide-tab {
  background: transparent; border: 1px solid transparent;
  color: #94a3b8; padding: 9px 12px;
  border-radius: 6px; cursor: pointer;
  text-align: left; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  transition: all 0.12s;
}
.guide-tab:hover { color: #e5e7eb; background: #131826; }
.guide-tab.active {
  background: rgba(167,139,250,0.12);
  color: #a78bfa;
  border-color: rgba(167,139,250,0.3);
}
.guide-source {
  margin-top: auto; padding-top: 16px;
  font-size: 9.5px; color: #475569;
  text-align: center; line-height: 1.5;
  border-top: 1px dashed #1f2433;
}
.guide-content {
  overflow-y: auto;
  padding: 18px 22px 22px;
  color: #e5e7eb; font-size: 12.5px; line-height: 1.6;
}
.guide-content h4 {
  font-size: 13px; color: #c4b5fd;
  margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid #1f2433;
  letter-spacing: 0.5px;
}
.guide-content h5 {
  font-size: 11px; color: #94a3b8;
  margin: 18px 0 8px;
  text-transform: uppercase; letter-spacing: 1.5px;
  font-weight: 700;
}
.guide-content p {
  margin: 0 0 10px; color: #cbd5e1; font-size: 12px;
}
.guide-content ul, .guide-content ol {
  margin: 0 0 12px; padding-left: 20px;
  color: #cbd5e1; font-size: 12px;
}
.guide-content li { margin-bottom: 4px; }
.guide-content code {
  background: #1a1f2e; padding: 2px 6px; border-radius: 3px;
  font-family: ui-monospace, monospace; font-size: 10.5px;
  color: #fbbf24;
}
.guide-content table {
  width: 100%; border-collapse: collapse;
  margin-bottom: 14px; font-size: 11.5px;
}
.guide-content th, .guide-content td {
  text-align: left; padding: 6px 10px;
  border-bottom: 1px solid #1f2433;
}
.guide-content th {
  color: #a78bfa; font-weight: 700;
  background: #131826;
  text-transform: uppercase; font-size: 10px; letter-spacing: 1px;
}
.guide-content tr:hover td { background: #131826; }
.guide-content .g-tag {
  display: inline-block; padding: 1px 8px;
  border-radius: 10px; font-size: 10px;
  background: rgba(167,139,250,0.15); color: #c4b5fd;
  font-weight: 700;
}
.guide-content .g-tag-duelist    { background: rgba(239,68,68,0.18); color: #fca5a5; }
.guide-content .g-tag-initiator  { background: rgba(251,191,36,0.20); color: #fbbf24; }
.guide-content .g-tag-sentinel   { background: rgba(16,185,129,0.18); color: #6ee7b7; }
.guide-content .g-tag-controller { background: rgba(167,139,250,0.18); color: #c4b5fd; }

.guide-map-select {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
}
.guide-map-chip {
  background: #131826; border: 1px solid #1f2433;
  color: #cbd5e1; padding: 5px 12px; border-radius: 14px;
  cursor: pointer; font-size: 11px;
  transition: all 0.12s;
}
.guide-map-chip:hover { border-color: #a78bfa; color: #a78bfa; }
.guide-map-chip.active {
  background: rgba(167,139,250,0.15);
  border-color: #a78bfa; color: #a78bfa; font-weight: 700;
}
.guide-callout-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px;
}
.guide-callout-item {
  background: #131826; border: 1px solid #1f2433;
  padding: 6px 10px; border-radius: 6px;
  font-size: 11px;
}
.guide-callout-item .gc-en { color: #a78bfa; font-weight: 700; }
.guide-callout-item .gc-zh { color: #94a3b8; font-size: 10.5px; margin-top: 2px; }

.guide-agent-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px; margin-bottom: 16px;
}
.guide-agent-chip {
  background: #131826; border: 2px solid transparent;
  border-radius: 8px; padding: 6px;
  cursor: pointer; transition: all 0.12s;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.guide-agent-chip:hover { transform: translateY(-1px); }
.guide-agent-chip.active { border-color: #a78bfa; }
.guide-agent-chip img {
  width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid #2a3448;
}
.guide-agent-chip .gac-name {
  font-size: 10px; color: #e5e7eb; font-weight: 600;
}
.guide-ability-row {
  display: grid; grid-template-columns: 60px 1fr;
  gap: 12px; padding: 10px 0;
  border-bottom: 1px solid #1f2433;
}
.guide-ability-row:last-child { border-bottom: 0; }
.guide-ability-slot {
  background: #1a1f2e; border-radius: 6px;
  padding: 6px; text-align: center;
  font-size: 10px; color: #94a3b8;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.guide-ability-slot img { width: 32px; height: 32px; }
.guide-ability-slot .gas-key {
  font-family: ui-monospace, monospace; color: #fbbf24; font-weight: 700;
}
.guide-ability-body h6 {
  font-size: 13px; color: #e5e7eb; margin: 0 0 4px;
}
.guide-ability-body .gab-tip {
  background: rgba(251,191,36,0.10);
  border-left: 2px solid #fbbf24;
  padding: 6px 10px; margin-top: 6px;
  font-size: 11.5px; color: #fde68a; border-radius: 0 4px 4px 0;
}

.guide-rank-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.guide-rank-item {
  background: #131826; border-left: 3px solid var(--rk, #a78bfa);
  padding: 8px 12px; border-radius: 0 6px 6px 0;
  font-size: 11px;
}
.guide-rank-item .gri-name { color: #e5e7eb; font-weight: 700; font-size: 13px; }
.guide-rank-item .gri-pct { color: #64748b; font-size: 10px; margin-top: 2px; }

.guide-empty { color: #64748b; text-align: center; padding: 40px 0; font-size: 13px; }

/* ===== 🔊 Speak 按钮(浏览器 TTS 朗读英文)===== */
.term-speak {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0;
  margin-right: 6px;
  vertical-align: -4px;
  background: rgba(167,139,250,0.10);
  border: 1px solid rgba(167,139,250,0.25);
  color: #a78bfa;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px; line-height: 1;
  transition: all 0.15s;
  min-width: 22px;  /* 防止被 reset 覆盖 */
}
.term-speak:hover {
  background: #a78bfa;
  color: #0a0e14;
  transform: scale(1.12);
}
.term-speak:active { transform: scale(0.95); }
.term-speak.playing {
  background: #a78bfa;
  color: #0a0e14;
  animation: speak-pulse 1.2s ease-in-out infinite;
}
@keyframes speak-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(167,139,250, 0.55); }
  50%      { box-shadow: 0 0 0 7px rgba(167,139,250, 0); }
}

/* 表格里的 td 第一个 cell 让按钮 + 文本贴齐 */
.guide-content td .term-speak { margin-right: 8px; }
/* h6 / h5 标题里的按钮稍微再小一点对齐 */
.guide-ability-body h6 .term-speak,
.gri-name .term-speak {
  width: 20px; height: 20px; font-size: 10px;
  vertical-align: -2px; margin-right: 5px;
}

/* ===== Layers panel(图层显隐浮窗)===== */
.layers-panel {
  position: fixed; right: 20px; top: 70px;
  background: #11141c; border: 1px solid #2a3448;
  border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,0.5);
  width: 220px; z-index: 150;
  display: flex; flex-direction: column;
}
.layers-panel.hidden { display: none; }
.layers-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid #1f2433;
  font-size: 11px; color: #a78bfa; font-weight: 700;
  letter-spacing: 1px;
}
.layers-header button {
  background: transparent; border: none; color: #64748b;
  cursor: pointer; font-size: 18px; padding: 0 4px; min-width: 0;
}
.layers-header button:hover { color: #ef4444; }
.layers-body {
  padding: 8px 12px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.layer-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 5px;
  font-size: 12px; color: #e5e7eb; cursor: pointer;
  user-select: none;
}
.layer-row:hover { background: #131826; }
.layer-row input { accent-color: #a78bfa; cursor: pointer; }
.layer-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
}
.layers-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed #1f2433;
}
.layers-actions button {
  background: #131826; border: 1px solid #1f2433;
  color: #cbd5e1; padding: 5px; border-radius: 5px;
  cursor: pointer; font-size: 11px;
}
.layers-actions button:hover { border-color: #a78bfa; color: #a78bfa; }

/* 自定义地图 option 标识 */
#mapSelect option.custom-map { color: #fbbf24; font-style: italic; }

/* 本地文件夹联动上了:菜单项变绿 */
#folderSyncBtn.folder-linked, #folderSyncBtn.folder-linked .ic { color: #6ee7b7; }

/* ===== 顶栏下拉菜单 ===== */
.menu-wrap { position: relative; display: inline-flex; }
.menu-dropdown {
  position: absolute; top: calc(100% + 9px); right: 0;
  min-width: 232px; padding: 5px;
  background: var(--glass-solid);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line-2); border-radius: 13px;
  box-shadow: var(--shadow-pop), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  z-index: 150;
  display: none;
  transform-origin: top right;
}
.menu-dropdown.open { display: block; animation: pop-in 0.16s var(--ease); }
.menu-dropdown button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; height: 32px; padding: 0 10px; margin: 0;
  border: none; border-radius: 8px;
  color: var(--tx-1); font-size: 12.5px; text-align: left;
}
.menu-dropdown button .ic { color: var(--tx-3); transition: color 0.15s; }
.menu-dropdown button:hover { background: var(--ac-soft); }
.menu-dropdown button:hover .ic { color: var(--ac-hi); }
.mi-hint {
  margin-left: auto; padding-left: 16px;
  font: 500 10.5px var(--mono); color: var(--tx-3); letter-spacing: 0.03em;
}
.menu-sep { height: 1px; background: var(--line); margin: 5px 8px; }

/* ===== ⌘K 命令面板(v67) ===== */
.cmdk-modal {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
}
.cmdk-modal.hidden { display: none; }
.cmdk-bg {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
}
.cmdk-card {
  position: relative;
  background: #11141c; border: 1px solid #2a3448;
  border-radius: 12px;
  width: min(640px, 92vw);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(167,139,250,0.25);
  overflow: hidden;
  animation: cmdk-pop 0.15s ease-out;
}
@keyframes cmdk-pop {
  from { transform: translateY(-10px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.cmdk-input {
  width: 100%; box-sizing: border-box;
  background: transparent; border: none; border-bottom: 1px solid #1f2433;
  color: #e5e7eb; padding: 14px 18px;
  font-size: 15px;
  outline: none;
}
.cmdk-input::placeholder { color: #64748b; }
.cmdk-list {
  max-height: 50vh; overflow-y: auto;
  padding: 6px;
}
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 6px;
  cursor: pointer; user-select: none;
  font-size: 13px;
}
.cmdk-item .cmdk-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.cmdk-item .cmdk-title { color: #e5e7eb; font-weight: 600; flex: 1; }
.cmdk-item .cmdk-hint { color: #64748b; font-size: 11px; }
.cmdk-item.active {
  background: rgba(167,139,250,0.15);
}
.cmdk-item.active .cmdk-title { color: #a78bfa; }
.cmdk-item:hover { background: #131826; }
.cmdk-empty {
  text-align: center; padding: 40px 0;
  color: #64748b; font-size: 13px;
}
.cmdk-footer {
  padding: 8px 14px; border-top: 1px solid #1f2433;
  color: #64748b; font-size: 10.5px;
  display: flex; gap: 8px; align-items: center;
}
.cmdk-footer kbd {
  background: #1a1f2e; color: #a78bfa;
  padding: 2px 6px; border-radius: 3px;
  font-size: 10px; font-family: ui-monospace, monospace;
  border: 1px solid #2a3448; margin: 0 2px;
}

/* 网格对齐开着时,在画板上叠一层 20px 网格(盖在 canvas 上面才看得见) */
body.snap-grid .canvas-container::after {
  content: ""; position: absolute; inset: 0; border-radius: 14px; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(167, 139, 250, 0.11) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(167, 139, 250, 0.11) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* 画板坐标读数:贴在画板左下角内侧(原来压在时间轴按钮上) */
.canvas-coord {
  position: fixed; left: calc(var(--left-w) + var(--board-x) + 10px); bottom: calc(var(--tl-h) + var(--board-y) + 10px);
  padding: 4px 9px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); border-radius: 8px;
  font: 500 10.5px var(--mono); color: var(--tx-1); letter-spacing: 0.03em;
  z-index: 90;
  pointer-events: none;
}
.canvas-coord.hidden { display: none; }
.canvas-coord .cc-sep { color: var(--tx-4); margin: 0 4px; }
.canvas-coord .cc-label { color: var(--tx-3); margin-right: 5px; }

/* ===== 欢迎弹窗 ===== */
.modal-card.welcome {
  width: min(900px, 94vw); max-height: 92vh;
  flex-direction: row; overflow: hidden;
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 20px;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(167, 139, 250, 0.12), 0 0 120px -30px rgba(167, 139, 250, 0.35);
  animation: welcome-in 0.5s var(--ease) backwards;
}
@keyframes welcome-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
#welcomeModal .modal-bg {
  background: rgba(3, 4, 7, 0.72);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  animation: fade-in 0.3s ease backwards;
}
.welcome-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 30px; height: 30px; padding: 0; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--tx-3); font-size: 20px;
}
.welcome-close:hover { color: var(--tx-1); background: var(--bg-4); }

/* 左:会动的示意战术图 */
.welcome-hero {
  position: relative; flex: 0 0 41%; min-height: 500px; overflow: hidden;
  background: #07090e; border-right: 1px solid var(--line);
}
.welcome-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.w-rooms path { fill: rgba(255, 255, 255, 0.035); stroke: rgba(255, 255, 255, 0.17); stroke-width: 1.2; stroke-linejoin: round; }
.w-scan { animation: w-scan 8s linear infinite; }
@keyframes w-scan { to { transform: translateY(700px); } }
.w-smoke circle {
  fill: rgba(167, 139, 250, 0.14); stroke: #a78bfa; stroke-width: 1.6; stroke-dasharray: 5 4.5;
  transform-box: fill-box; transform-origin: center;
  animation: w-spin 26s linear infinite;
}
.w-smoke-2 circle { animation-duration: 34s; animation-direction: reverse; }
@keyframes w-spin { to { transform: rotate(360deg); } }
.w-flow {
  fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 9 8;
  animation: w-dash 1.5s linear infinite;
}
.w-flow-2 { animation-duration: 1.9s; }
.w-flow-3 { animation-duration: 1.7s; }
@keyframes w-dash { to { stroke-dashoffset: -34; } }
.w-plant circle { fill: none; stroke: #f87171; stroke-width: 1.6; }
.w-plant .w-plant-dot { fill: #f87171; stroke: none; }
.w-plant .w-ping {
  transform-box: fill-box; transform-origin: center;
  animation: w-ping 2.2s var(--ease) infinite;
}
@keyframes w-ping { from { transform: scale(1); opacity: 0.9; } to { transform: scale(3.2); opacity: 0; } }
.w-token { animation: w-bob 4.4s ease-in-out infinite alternate; }
.w-t2 { animation-delay: -1.1s; }
.w-t3 { animation-delay: -2.3s; }
.w-t4 { animation-delay: -3.1s; }
.w-t5 { animation-delay: -0.6s; }
@keyframes w-bob { from { transform: translateY(-2px); } to { transform: translateY(2.5px); } }
.w-token circle { fill: #0c1017; stroke: var(--c); stroke-width: 2.4; filter: drop-shadow(0 0 7px var(--c)); }
.w-token text { fill: var(--c); font: 700 13px var(--mono); text-anchor: middle; }
.welcome-hero::after {     /* 底部压暗,托住品牌字 */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 24%;
  background: linear-gradient(to top, #07090e 30%, transparent);
  pointer-events: none;
}
.welcome-lockup {
  position: absolute; left: 24px; bottom: 22px; z-index: 1;
  display: flex; align-items: center; gap: 10px;
}
.welcome-lockup .brand-mark { width: 30px; height: 30px; }
.welcome-lockup .brand-word { font-size: 17px; }
.welcome-ver {
  padding: 2px 7px; border: 1px solid var(--line-2); border-radius: 20px;
  font: 600 10.5px var(--mono); color: var(--tx-2);
}
.welcome-ver:empty { display: none; }

/* 右:说明 + 三个入口 */
.welcome-main { flex: 1; min-width: 0; padding: 34px 34px 22px 32px; display: flex; flex-direction: column; overflow-y: auto; }
.welcome-main > * { animation: rise-in 0.5s var(--ease) backwards; }
.welcome-main > :nth-child(2) { animation-delay: 60ms; }
.welcome-main > :nth-child(3) { animation-delay: 110ms; }
.welcome-main > :nth-child(4) { animation-delay: 160ms; }
.welcome-main > :nth-child(5) { animation-delay: 220ms; }
.welcome-main > :nth-child(6) { animation-delay: 270ms; }
.welcome-main > :nth-child(7) { animation-delay: 320ms; }
.welcome-eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: 0.16em; color: var(--ac); }
.welcome-main h3 {
  margin: 10px 0 10px; font-size: 27px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25;
  color: var(--tx-1); text-wrap: balance;
}
.welcome-lead { margin-bottom: 18px; font-size: 13.5px; line-height: 1.7; color: var(--tx-2); max-width: 44ch; }
.welcome-cards { display: flex; flex-direction: column; gap: 7px; }
.welcome-card {
  display: flex; align-items: center; gap: 13px;
  width: 100%; padding: 11px 13px; text-align: left;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 13px;
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s, background 0.2s;
}
.welcome-card:hover { border-color: var(--ac-line); background: var(--bg-3); transform: translateX(3px); }
.welcome-card .wc-icon {
  flex-shrink: 0; width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px; background: var(--ac-soft); color: var(--ac-hi);
  border: 1px solid rgba(167, 139, 250, 0.22);
}
.welcome-card .wc-icon .ic { width: 19px; height: 19px; }
.welcome-card .wc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.welcome-card .wc-title { font-size: 13.5px; font-weight: 600; color: var(--tx-1); }
.welcome-card .wc-desc { font-size: 12px; line-height: 1.55; color: var(--tx-3); }
.welcome-card .wc-desc b { color: var(--tx-1); font-weight: 600; font-variant-numeric: tabular-nums; }
.welcome-card .wc-go { color: var(--tx-4); transition: color 0.2s, transform 0.2s var(--ease); }
.welcome-card:hover .wc-go { color: var(--ac-hi); transform: translateX(3px); }
.welcome-stats {
  display: grid; grid-template-columns: repeat(5, auto); justify-content: space-between; gap: 6px;
  margin-top: 20px; padding: 14px 2px 0; border-top: 1px solid var(--line);
}
.welcome-stats > div { display: flex; flex-direction: column; gap: 3px; }
.welcome-stats b { font: 600 19px var(--mono); letter-spacing: -0.02em; color: var(--tx-1); }
.welcome-stats span { font-size: 11px; color: var(--tx-3); }
.welcome-foot { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 20px 0 22px;
  background: var(--ac); color: var(--ac-ink); border: none; border-radius: 12px;
  font-size: 13.5px; font-weight: 700;
  box-shadow: 0 10px 26px -8px rgba(167, 139, 250, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.2s var(--ease), background 0.2s, box-shadow 0.2s;
}
.btn-primary:hover { background: var(--ac-hi); transform: translateY(-1px); box-shadow: 0 14px 32px -8px rgba(167, 139, 250, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary .ic { stroke-width: 2.2; transition: transform 0.2s var(--ease); }
.btn-primary:hover .ic { transform: translateX(3px); }
.welcome-hint { font-size: 12px; color: var(--tx-3); }
.welcome-legal { margin-top: auto; padding-top: 18px; font-size: 10.5px; color: var(--tx-4); }
@media (max-width: 760px) {
  .modal-card.welcome { flex-direction: column; overflow-y: auto; }
  .welcome-hero { flex: 0 0 190px; min-height: 0; border-right: none; border-bottom: 1px solid var(--line); }
  .welcome-main { padding: 22px 20px 18px; overflow: visible; }
  .welcome-main h3 { font-size: 22px; }
  .welcome-stats { grid-template-columns: repeat(3, auto); row-gap: 12px; }
}

/* 🖐 全局拖拽接收 overlay(v65)*/
.drop-overlay {
  position: fixed; inset: 0;
  z-index: 300;
  background: rgba(10,14,20,0.85);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;  /* 不挡 dragover/drop 事件 */
  animation: drop-fade 0.2s ease-out;
}
.drop-overlay.hidden { display: none; }
.drop-overlay-inner {
  border: 3px dashed #a78bfa;
  border-radius: 16px;
  padding: 60px 80px;
  text-align: center;
  background: rgba(17,20,28,0.65);
  box-shadow: 0 0 60px rgba(167,139,250,0.4);
}
.drop-overlay-icon { font-size: 64px; }
.drop-overlay-text {
  font-size: 16px; color: #e5e7eb;
  font-weight: 700; margin-top: 18px;
  letter-spacing: 0.5px;
}
@keyframes drop-fade {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ===== Cheatsheet 浮窗 ===== */
.cheatsheet {
  position: fixed; right: 16px; bottom: 16px;
  background: rgba(17,20,28,0.96);
  border: 1px solid #2a3448; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  width: 190px; z-index: 180;
  backdrop-filter: blur(6px);
  font-size: 11px;
}
.cheatsheet.hidden { display: none; }
.cheatsheet-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #1f2433;
  color: #a78bfa; font-weight: 700; letter-spacing: 0.5px;
}
.cheatsheet-header button {
  background: transparent; border: none; color: #64748b;
  font-size: 14px; padding: 0 4px; cursor: pointer; min-width: 0;
}
.cheatsheet-header button:hover { color: #ef4444; }
.cheatsheet-body {
  padding: 8px 12px; display: grid;
  grid-template-columns: 1fr 1fr; gap: 4px 8px;
}
.cs-row { color: #cbd5e1; display: flex; align-items: center; gap: 4px; }
.cs-row kbd {
  background: #131826; color: #a78bfa;
  padding: 1px 5px; font-size: 9.5px; border-radius: 3px;
  font-family: ui-monospace, monospace;
  border: 1px solid #1f2433;
}

/* ===== 🎥 演示模式(全屏 + 隐藏 UI)===== */
body.demo-mode header,
body.demo-mode aside.palette,
body.demo-mode #agentPalette,
body.demo-mode #rightPalette,
body.demo-mode .rounds-bar,
body.demo-mode #helpModal,
body.demo-mode #updateBanner,
body.demo-mode #cheatsheet {
  display: none !important;
}
body.demo-mode #app {
  grid-template-columns: 0 1fr 0 !important;
  grid-template-rows: 0 1fr !important;
}
body.demo-mode .canvas-wrap {
  padding: 0 !important;
}
.demo-bar {
  position: fixed; left: 50%; bottom: 18px;
  transform: translateX(-50%);
  background: rgba(17,20,28,0.92);
  border: 1px solid #2a3448; border-radius: 36px;
  padding: 8px 14px;
  display: flex; align-items: center; gap: 14px;
  z-index: 250; backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.demo-bar.hidden { display: none; }
.demo-bar button {
  background: transparent; border: none; color: #cbd5e1;
  cursor: pointer; padding: 4px 8px; border-radius: 50%;
  width: 32px; height: 32px; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.demo-bar button:hover { background: #1a1f2e; color: #a78bfa; }
.demo-bar-info {
  color: #a78bfa; font-size: 12px; font-weight: 700;
  font-family: ui-monospace, monospace;
  padding: 0 6px; min-width: 50px; text-align: center;
}
.demo-bar-exit {
  color: #ef4444 !important;
  border-left: 1px solid #2a3448 !important;
  border-radius: 0 18px 18px 0 !important;
  margin-left: 4px; padding-left: 12px !important;
}
.demo-bar-exit:hover { background: rgba(239,68,68,0.15) !important; }
.demo-timeline {
  flex: 1; min-width: 120px; max-width: 280px;
  height: 6px; background: #1a1f2e; border-radius: 3px;
  position: relative; cursor: pointer;
  margin: 0 4px;
}
.demo-timeline-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, #a78bfa, #c4b5fd);
  border-radius: 3px;
  transition: width 0.2s ease-out;
  pointer-events: none;
}
.demo-timeline-ticks {
  position: absolute; left: 0; right: 0; top: 0; bottom: 0;
  pointer-events: none;
}
.demo-timeline-tick {
  position: absolute; top: -2px;
  width: 1px; height: 10px;
  background: rgba(255,255,255,0.18);
}
.demo-note {
  position: fixed; left: 50%; top: 24px;
  transform: translateX(-50%);
  background: rgba(17,20,28,0.95); backdrop-filter: blur(6px);
  border: 1px solid rgba(167,139,250,0.4);
  border-radius: 24px;
  padding: 8px 18px;
  font-size: 14px; color: #e5e7eb;
  max-width: 70vw;
  z-index: 245;
  box-shadow: 0 4px 18px rgba(0,0,0,0.5);
  letter-spacing: 0.3px;
}
.demo-note.hidden { display: none; }
.demo-note::before {
  content: '📝 '; color: #a78bfa;
}
body:not(.demo-mode) .demo-note { display: none; }

.demo-timeline-note {
  position: absolute; top: -16px;
  transform: translate(-50%, 0);
  font-size: 9px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.7));
  cursor: help;
  pointer-events: auto;
}
.demo-timeline-thumb {
  position: absolute; top: 50%;
  width: 10px; height: 10px;
  background: #fff; border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px #a78bfa, 0 2px 6px rgba(0,0,0,0.4);
  pointer-events: none;
  transition: left 0.2s ease-out;
}

/* ===== Spike 倒计时浮窗 ===== */
.spike-timer {
  position: fixed; right: 16px; top: 70px;
  background: rgba(17,20,28,0.95); backdrop-filter: blur(6px);
  border: 1px solid #2a3448; border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  width: 150px; z-index: 170;
  padding: 12px 14px;
  text-align: center;
}
.spike-timer.hidden { display: none; }
.spike-timer.planted {
  border-color: #ef4444;
  box-shadow: 0 0 24px rgba(239,68,68,0.45), 0 0 0 1px #ef4444;
  animation: spike-pulse 1s ease-in-out infinite;
}
@keyframes spike-pulse {
  0%, 100% { box-shadow: 0 0 24px rgba(239,68,68,0.35), 0 0 0 1px #ef4444; }
  50%      { box-shadow: 0 0 32px rgba(239,68,68,0.7), 0 0 0 1px #ef4444; }
}
.spike-timer-time {
  font-size: 32px; font-family: ui-monospace, monospace;
  color: #a78bfa; font-weight: 700; line-height: 1;
}
.spike-timer.planted .spike-timer-time {
  color: #ef4444;
}
.spike-timer-label {
  font-size: 10px; color: #64748b; letter-spacing: 2px;
  text-transform: uppercase; margin-top: 4px;
}
.spike-timer-row {
  display: flex; justify-content: center; gap: 4px;
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid #1f2433;
}
.spike-timer-row button {
  background: transparent; border: none; color: #cbd5e1;
  cursor: pointer; padding: 4px 8px; border-radius: 5px;
  min-width: 26px; font-size: 13px;
}
.spike-timer-row button:hover { background: #1a1f2e; color: #a78bfa; }
.spike-timer-row #spikePlant:hover { color: #ef4444; background: rgba(239,68,68,0.12); }
.spike-timer-row #spikeClose:hover { color: #ef4444; background: rgba(239,68,68,0.15); }

/* ===== Skins Library(皮肤库)===== */
.skins-body {
  grid-template-columns: 200px 1fr !important;
  gap: 0 !important;
  padding: 0 !important;
  min-height: 60vh; max-height: 82vh;
}
.skins-sidebar {
  background: #0a0e14; border-right: 1px solid #1f2433;
  padding: 14px 14px;
  overflow-y: auto;
}
.skins-sidebar h4 {
  font-size: 10px; color: #64748b; text-transform: uppercase;
  letter-spacing: 1.5px; margin: 0 0 8px;
  padding-bottom: 6px; border-bottom: 1px solid #1f2433;
}
.skins-sidebar h4:not(:first-child) { margin-top: 18px; }
.skins-weapon-sel {
  width: 100%; box-sizing: border-box;
  background: #131826; color: #e5e7eb;
  border: 1px solid #2a3448; border-radius: 5px;
  padding: 6px 8px; font-size: 12px;
}
.skins-weapon-sel:focus { outline: none; border-color: #a78bfa; }
.skins-tier-chips {
  display: flex; flex-direction: column; gap: 4px;
}
.skins-tier-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 5px;
  cursor: pointer; font-size: 11.5px; color: #cbd5e1;
  background: #131826; border: 1px solid transparent;
  transition: all 0.12s;
}
.skins-tier-chip:hover { background: #1a1f2e; }
.skins-tier-chip.active {
  background: rgba(167,139,250,0.12);
  border-color: var(--tc, #a78bfa);
  color: #fff;
}
.skins-tier-chip .stc-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--tc, #a78bfa);
  flex-shrink: 0;
}
.skins-grid {
  overflow-y: auto; padding: 14px 18px 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  /* 每一行按卡片自己的高度来;不写的话,上千张卡片的行高会被这个定高的滚动区压扁,只剩一条边 */
  grid-auto-rows: max-content;
  gap: 10px;
  align-content: start;
}
.skin-card {
  background: linear-gradient(135deg, #1a2333 0%, #0e1320 100%);
  border: 1px solid var(--tc, #2a3448);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer; transition: all 0.15s;
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
}
.skin-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4), 0 0 0 1px var(--tc, #a78bfa);
}
.skin-card-img {
  width: 100%; height: 70px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.skin-card-name {
  font-size: 11.5px; color: #e5e7eb; font-weight: 600;
  text-align: center;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  min-height: 30px; line-height: 1.3;
}
.skin-card-tier {
  position: absolute; top: 6px; right: 6px;
  font-size: 9px; padding: 2px 6px; border-radius: 8px;
  background: var(--tc, #a78bfa); color: #0a0e14;
  font-weight: 700; letter-spacing: 0.5px;
}
.skin-fav {
  position: absolute; top: 4px; left: 4px;
  width: 26px; height: 26px; padding: 0;
  background: rgba(0,0,0,0.55);
  border: 1px solid #1f2433;
  color: #94a3b8;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px; line-height: 1;
  z-index: 2;
  transition: all 0.15s;
}
.skin-fav:hover { color: #ef4444; transform: scale(1.15); border-color: #ef4444; }
.skin-fav.on { color: #ef4444; background: rgba(239,68,68,0.18); border-color: #ef4444; }
.skin-fav.on:hover { color: #fca5a5; }
.skins-empty {
  grid-column: 1 / -1;
  text-align: center; padding: 60px 0;
  color: #64748b; font-size: 13px;
}

/* ===== Skin Detail 浮窗 ===== */
.skin-detail {
  position: fixed; inset: 0; z-index: 220;
  display: flex; align-items: center; justify-content: center;
}
.skin-detail.hidden { display: none; }
.skin-detail-bg {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(8px);
}
.skin-detail-card {
  position: relative;
  background: linear-gradient(135deg, #131826 0%, #0a0e14 100%);
  border: 1px solid var(--tc, #2a3448);
  border-radius: 14px;
  width: min(700px, 92vw); padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px var(--tc, #a78bfa);
}
.skin-detail-card .modal-close {
  position: absolute; top: 10px; right: 14px;
}
.skin-detail-img-wrap {
  width: 100%; height: 220px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
#skinDetailImg {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.5));
}
.skin-detail-info { padding: 0 6px; }
.skin-detail-tier {
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--tc, #a78bfa); font-weight: 700;
  margin-bottom: 4px;
}
.skin-detail-info h3 {
  font-size: 18px; color: #e5e7eb; margin: 0 0 14px;
}
.skin-detail-row {
  display: grid; grid-template-columns: 60px 1fr;
  gap: 12px; align-items: center; padding: 6px 0;
  border-top: 1px solid #1f2433;
}
.skin-detail-label {
  font-size: 10.5px; color: #64748b;
  text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700;
}
.skin-detail-chromas {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.skin-detail-chroma {
  width: 38px; height: 38px; border-radius: 6px;
  border: 2px solid #2a3448; cursor: pointer;
  background-size: cover; background-position: center;
  background-color: #1a1f2e;
  transition: all 0.12s;
  padding: 0;
}
.skin-detail-chroma:hover, .skin-detail-chroma.active {
  border-color: var(--tc, #a78bfa);
  transform: scale(1.08);
}

/* ===== Daily Shop ===== */
.shop-body { padding: 16px 22px 22px; display: flex; flex-direction: column; }
.shop-timer {
  text-align: center; color: #fbbf24;
  font-family: ui-monospace, monospace; font-size: 14px;
  padding: 8px; margin-bottom: 14px;
  background: rgba(251,191,36,0.08);
  border: 1px dashed rgba(251,191,36,0.3);
  border-radius: 6px;
}
.shop-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.shop-item {
  background: linear-gradient(135deg, #1a2333 0%, #0a0e14 100%);
  border: 1px solid var(--tc, #2a3448);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer; transition: all 0.15s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.shop-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px var(--tc), 0 8px 20px rgba(0,0,0,0.4);
}
.shop-item img {
  width: 100%; height: 90px; object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}
.shop-item-name {
  font-size: 12px; font-weight: 700; color: #e5e7eb; text-align: center;
  min-height: 30px;
}
.shop-item-tier {
  font-size: 10px; color: var(--tc, #a78bfa); font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
}
.shop-item-price {
  font-size: 11px; color: #fbbf24; font-weight: 700;
}
.shop-reroll {
  margin: 14px auto 0;
  background: #a78bfa; color: #0a0e14; border: none;
  padding: 8px 22px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 700;
}
.shop-reroll:hover { background: #c4b5fd; }
.shop-tip {
  margin: 14px 0 0; font-size: 11px; color: #64748b; text-align: center;
}

/* ===== Stats 统计面板 ===== */
.stats-body { padding: 18px 22px 22px !important; display: block !important; }
.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; margin-bottom: 18px;
}
.stats-card {
  background: linear-gradient(135deg, #131826 0%, #0a0e14 100%);
  border: 1px solid #1f2433;
  border-radius: 8px; padding: 14px;
}
.stats-card-label {
  font-size: 10px; color: #64748b; text-transform: uppercase;
  letter-spacing: 1.5px; margin-bottom: 6px;
}
.stats-card-value {
  font-size: 24px; color: #a78bfa; font-weight: 700;
  font-family: ui-monospace, monospace;
}
.stats-card-sub { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.stats-section { margin-top: 18px; }
.stats-section h4 {
  font-size: 11px; color: #94a3b8; text-transform: uppercase;
  letter-spacing: 1.5px; margin: 0 0 10px;
}
.stats-bar {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; padding: 6px 0;
}
.stats-bar-name { width: 90px; color: #e5e7eb; font-weight: 600; }
.stats-bar-track {
  flex: 1; height: 6px; background: #1a1f2e; border-radius: 3px; overflow: hidden;
}
.stats-bar-fill { height: 100%; background: var(--rc, #a78bfa); }
.stats-bar-val { width: 36px; text-align: right; color: #a78bfa; font-family: ui-monospace, monospace; }
.stats-storage {
  background: #0a0e14; border: 1px dashed #1f2433;
  padding: 10px 14px; border-radius: 6px;
  font-size: 11px; color: #94a3b8;
  font-family: ui-monospace, monospace; margin-top: 12px;
}

/* tools tab 横栏 */
.tools-tabs { display: flex; gap: 4px; margin: 0 auto 0 12px; flex: 1; }
.tools-tab {
  background: transparent; border: 1px solid transparent;
  color: #94a3b8; padding: 6px 10px; border-radius: 6px;
  font-size: 11.5px; cursor: pointer; font-weight: 600;
  transition: all 0.12s;
}
.tools-tab:hover { color: #e5e7eb; background: #131826; }
.tools-tab.active { background: rgba(167,139,250,0.12); color: #a78bfa; border-color: rgba(167,139,250,0.3); }

/* ⏱ 训练计时器 */
.timer-wrap { text-align: center; padding: 20px 0; }
.timer-display {
  font-size: 56px; font-family: ui-monospace, monospace;
  font-weight: 700; color: #a78bfa;
  letter-spacing: 2px; line-height: 1.1;
}
.timer-display .timer-ms { font-size: 22px; color: #64748b; vertical-align: top; }
.timer-controls {
  display: flex; gap: 8px; justify-content: center; margin-top: 18px;
}
.timer-controls button {
  background: #131826; border: 1px solid #2a3448; color: #e5e7eb;
  padding: 8px 18px; border-radius: 6px; cursor: pointer;
  font-size: 12px; font-weight: 700;
}
.timer-controls button.primary { background: #a78bfa; color: #0a0e14; border: none; }
.timer-controls button.primary:hover { background: #c4b5fd; }
.timer-controls button:hover { border-color: #a78bfa; color: #a78bfa; }
.timer-laps {
  margin-top: 18px; max-height: 200px; overflow-y: auto;
  background: #0a0e14; border: 1px solid #1f2433; border-radius: 6px;
}
.timer-lap {
  display: flex; justify-content: space-between;
  padding: 6px 14px; font-size: 11px; font-family: ui-monospace, monospace;
  border-bottom: 1px solid #1f2433; color: #94a3b8;
}
.timer-lap:last-child { border-bottom: 0; }
.timer-lap-idx { color: #64748b; }
.timer-lap-time { color: #a78bfa; }

/* 🏆 RR 计算器 + 💰 经济计算器 */
.calc-form {
  background: #0a0e14; border: 1px solid #1f2433;
  border-radius: 8px; padding: 16px; margin-bottom: 14px;
}
.calc-row {
  display: grid; grid-template-columns: 100px 1fr;
  gap: 10px; align-items: center;
  margin-bottom: 10px;
}
.calc-row label { font-size: 11.5px; color: #94a3b8; font-weight: 600; }
.calc-row input, .calc-row select {
  background: #131826; border: 1px solid #2a3448;
  color: #e5e7eb; padding: 6px 10px; border-radius: 5px;
  font-size: 12px; width: 100%; box-sizing: border-box;
}
.calc-row input:focus, .calc-row select:focus {
  outline: none; border-color: #a78bfa;
}
.calc-result {
  margin-top: 14px; padding: 16px;
  background: rgba(167,139,250,0.08);
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: 8px;
  text-align: center;
}
.calc-result-value {
  font-size: 26px; color: #a78bfa; font-weight: 700;
  font-family: ui-monospace, monospace;
}
.calc-result-label {
  font-size: 10px; color: #64748b;
  text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 6px;
}
.calc-result-detail {
  font-size: 11.5px; color: #cbd5e1; margin-top: 8px;
}

/* 经济计算器:回合序列 */
.econ-rounds {
  display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0 14px;
}
.econ-round-btn {
  width: 30px; height: 30px; border-radius: 5px;
  background: #131826; border: 1px solid #2a3448; color: #94a3b8;
  cursor: pointer; font-size: 12px; font-weight: 700;
  font-family: ui-monospace, monospace;
}
.econ-round-btn.win  { background: rgba(16,185,129,0.18); border-color: #10b981; color: #6ee7b7; }
.econ-round-btn.lose { background: rgba(239,68,68,0.18); border-color: #ef4444; color: #fca5a5; }
.econ-round-btn:hover { border-color: #a78bfa; }
.econ-tip {
  font-size: 10px; color: #64748b; text-align: center;
}

/* 🔫 武器对比 */
.cmp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cmp-side {
  background: #0a0e14; border: 1px solid #1f2433;
  border-radius: 8px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.cmp-side select {
  background: #131826; color: #e5e7eb; border: 1px solid #2a3448;
  padding: 6px 10px; border-radius: 5px; font-size: 12px;
}
.cmp-side select:focus { outline: none; border-color: #a78bfa; }
.cmp-img {
  height: 70px; display: flex; align-items: center; justify-content: center;
}
.cmp-img img { max-height: 70px; max-width: 100%; object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5)); }
.cmp-name { text-align: center; font-weight: 700; color: #e5e7eb; font-size: 13px; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 12px; }
.cmp-table th, .cmp-table td {
  padding: 6px 10px; border-bottom: 1px solid #1f2433;
  text-align: center;
}
.cmp-table th {
  color: #64748b; font-weight: 700; font-size: 10px;
  text-transform: uppercase; letter-spacing: 1.5px;
  background: #131826;
}
.cmp-table td.cmp-label { text-align: left; color: #94a3b8; font-weight: 600; }
.cmp-table td.cmp-win { color: #6ee7b7; font-weight: 700; }
.cmp-table td.cmp-lose { color: #94a3b8; }
.cmp-table tr:hover td { background: #131826; }

/* ===== 📱 移动端 / 窄屏适配(v62)===== */
@media (max-width: 1100px) {
  /* 顶栏总长太长 → 横向滚动 */
  header {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    white-space: nowrap;
    scrollbar-width: thin;
  }
  header::-webkit-scrollbar { height: 4px; }
  header .ctl, header .tool-group {
    flex-shrink: 0;
  }
  /* 缩小顶栏按钮 padding,密集挤进去 */
  header button {
    padding: 4px 8px !important;
    font-size: 11.5px !important;
  }
}

@media (max-width: 800px) {
  /* 真小屏(手机横屏 / 窄竖屏)*/
  /* aside palette 改为底部抽屉 */
  #app {
    grid-template-columns: 0 1fr 0 !important;
    grid-template-rows: auto 1fr auto !important;
  }
  aside.palette {
    grid-column: 1 / -1;
    max-height: 200px;
    overflow-y: auto;
  }
  #agentPalette { grid-row: 3; }
  #rightPalette { grid-row: 3; }
  /* canvas 占主区 */
  .canvas-wrap { padding: 6px !important; }
  /* 文字字号下调 */
  body { font-size: 13px; }
}

@media (max-width: 520px) {
  /* 手机竖屏:进一步精简 */
  .brand { font-size: 12px !important; }
  header { padding: 4px 6px !important; gap: 4px !important; }
  /* modal 整宽 */
  .modal-card { width: 96vw !important; max-height: 90vh; }
  .modal-card-wide { width: 96vw !important; }
  /* 工具集 tabs 横滚 */
  .tools-tabs { overflow-x: auto; }
  /* lineup 卡片更紧凑 */
  .lineup-card { padding: 6px 8px; }
  /* 演示 demo bar 精简 */
  .demo-bar { padding: 4px 8px; gap: 6px; }
  .demo-timeline { min-width: 60px; max-width: 140px; }
}

/* ====== v81 🖼 分享 / iframe 嵌入 ====== */

/* share modal — 复制链接 + iframe 嵌入代码 + 实时预览 */
.share-body { padding: 18px 22px 22px; max-height: 78vh; overflow-y: auto; }
.share-section { margin-bottom: 22px; }
.share-section:last-child { margin-bottom: 0; }
.share-section-head { display: flex; align-items: baseline; justify-content: space-between; }
.share-section h4 {
  margin: 0 0 4px; font-size: 13px; color: #cbd5e1; font-weight: 700;
}
.share-size {
  font-family: ui-monospace, monospace; font-size: 11px; color: #64748b;
}
.share-tip {
  margin: 0 0 10px; font-size: 11.5px; color: #64748b; line-height: 1.55;
}
.share-row { display: flex; gap: 8px; }
.share-input {
  flex: 1; min-width: 0;
  background: #0a0e14; color: #e5e7eb;
  border: 1px solid #2a3448; border-radius: 6px;
  padding: 9px 11px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px; line-height: 1.5;
  user-select: text; -webkit-user-select: text;
}
.share-input:focus { outline: none; border-color: #a78bfa; }
.share-textarea { width: 100%; resize: vertical; min-height: 64px; }
.share-copy-btn {
  background: #a78bfa; color: #0a0e14;
  border: 0; padding: 0 16px; border-radius: 6px;
  font-weight: 700; font-size: 12px; cursor: pointer;
  min-width: 92px; white-space: nowrap;
  transition: background 0.15s;
}
.share-copy-btn:hover { background: #c4b5fd; }
.share-copy-btn-block {
  width: 100%; margin-top: 8px; padding: 10px;
}
.share-preview-wrap {
  margin-top: 14px;
  border: 1px solid #2a3448; border-radius: 8px;
  overflow: hidden; background: #0a0e14;
}
.share-preview-label {
  background: #131826; padding: 6px 12px;
  font-size: 11px; color: #94a3b8;
  border-bottom: 1px solid #1f2433;
}
.share-preview {
  width: 100%; height: 320px;
  display: block; background: #0a0e14; border: 0;
}

/* ====== v81 嵌入模式(只读 player) ====== */
html[data-embed="1"], html[data-embed="1"] body {
  background: #0a0e14;
}
html[data-embed="1"] body { overflow: hidden; }
html[data-embed="1"] { --left-w: 0px; --right-w: 0px; --hdr-h: 0px; --tl-h: 56px; }   /* 嵌入态没有顶栏和侧栏,贴画板角的小控件按这个算 */
/* 把 grid 改成单列 — header / left / right / cmdk / welcome 全藏 */
html[data-embed="1"] body {
  grid-template:
    "canvas"   1fr
    "timeline" 56px
    / 1fr !important;
}
html[data-embed="1"] header,
html[data-embed="1"] #agentPalette,
html[data-embed="1"] #abilityPalette,
html[data-embed="1"] #floatingControls,
html[data-embed="1"] #welcomeModal,
html[data-embed="1"] #shareModal,
html[data-embed="1"] #cmdkModal,
html[data-embed="1"] #helpModal,
html[data-embed="1"] #updateBanner,
html[data-embed="1"] #spikeTimer,
html[data-embed="1"] #cheatsheet,
html[data-embed="1"] #contextMenu,
html[data-embed="1"] #layersPanel,
html[data-embed="1"] #canvasCoord,
html[data-embed="1"] #demoBar,
html[data-embed="1"] #crosshairModal,
html[data-embed="1"] #guideModal,
html[data-embed="1"] #skinsModal,
html[data-embed="1"] #skinDetail,
html[data-embed="1"] #statsModal,
html[data-embed="1"] #shopModal {
  display: none !important;
}
/* 嵌入态 timeline 简化 — 只留回合切换 + 播放(去除录制 / 新增回合 / 速度选择) */
html[data-embed="1"] #timeline {
  height: 56px;
  padding: 8px 12px;
}
html[data-embed="1"] #timeline #recordBtn,
html[data-embed="1"] #timeline #addRoundBtn,
html[data-embed="1"] #timeline #speedSelect,
html[data-embed="1"] #timeline #saveStatus {
  display: none !important;
}

/* 嵌入态底角 brand badge */
.embed-badge {
  position: fixed;
  bottom: 64px; right: 12px;
  background: rgba(10, 14, 20, 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(167, 139, 250, 0.45);
  border-radius: 18px;
  padding: 6px 12px;
  color: #cbd5e1; text-decoration: none;
  font-size: 11.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  z-index: 9999;
  transition: opacity 0.2s, transform 0.2s, border-color 0.2s;
  opacity: 0.82;
  letter-spacing: 0.5px;
}
.embed-badge:hover {
  opacity: 1; transform: translateY(-1px);
  border-color: #a78bfa;
}
.embed-badge.hidden { display: none; }
.embed-badge-mark { color: #a78bfa; font-size: 13px; }
.embed-badge-text b { color: #a78bfa; font-weight: 800; }

/* 嵌入态:canvas 占整个视口宽度 */
html[data-embed="1"] #canvasWrap { padding: 0; }

/* ====== v82 📱 双指捏合缩放 + 平移 ====== */

/* zoom 比例指示器:zoom !== 100% 时浮在 canvas 左上角,点击复位 */
.zoom-indicator {
  position: absolute; top: calc(var(--board-y) + 10px); left: calc(var(--board-x) + 10px);
  height: 32px; padding: 0 11px;
  display: inline-flex; align-items: center;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--ac-line); border-radius: 12px;
  color: var(--ac-hi); font: 600 11.5px var(--mono); letter-spacing: 0.03em;
  cursor: pointer;
  z-index: 95;
  user-select: none; -webkit-user-select: none;
}
.zoom-indicator::after { content: '· 复位'; margin-left: 7px; color: var(--tx-3); font-weight: 500; font-family: var(--font); }
.zoom-indicator:hover { background: var(--ac-soft); }
.zoom-indicator.hidden { display: none; }

/* 嵌入态也允许缩放手势,但 indicator 移到右上 不挡 timeline */
html[data-embed="1"] .zoom-indicator {
  top: 10px; right: 10px; left: auto;
}

/* ====== v90 🤖 AI Tool Calling — tool log 渲染 ====== */

.ai-msg-tools, .ai-msg-grounded {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 4px;
  background: rgba(167,139,250,0.2);
  color: #c4b5fd;
}
.ai-tool-log {
  margin: 4px 0 6px;
  padding: 6px 10px;
  background: rgba(167,139,250,0.06);
  border-left: 3px solid rgba(167,139,250,0.5);
  border-radius: 4px;
  font-size: 10.5px;
  font-family: ui-monospace, monospace;
}
.ai-tool-row {
  display: flex; align-items: baseline; gap: 6px;
  padding: 2px 0;
  line-height: 1.5;
  color: #94a3b8;
  flex-wrap: wrap;
}
.ai-tool-icon { width: 14px; flex-shrink: 0; }
.ai-tool-name {
  background: #0a0e14; padding: 1px 5px; border-radius: 3px;
  color: #c4b5fd; font-size: 10px;
}
.ai-tool-args { color: #64748b; font-size: 10px; }
.ai-tool-msg { color: #cbd5e1; }

/* v97 撤销 AI 整条按钮 */
.ai-undo-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid rgba(239,68,68,0.4);
  border-radius: 10px;
  color: #ef4444;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ai-undo-btn:hover {
  background: rgba(239,68,68,0.14);
  color: #fca5a5;
}
.ai-msg-undone {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 4px;
  background: rgba(239,68,68,0.16);
  color: #fca5a5;
}
.ai-msg.undone .ai-msg-text {
  opacity: 0.45;
  text-decoration: line-through;
  text-decoration-color: rgba(239,68,68,0.4);
}
.ai-msg.undone .ai-tool-log {
  opacity: 0.45;
}

/* ====== v89 💬 浮动 AI 教练(Intercom 风) ====== */

/* 右下角的 AI 教练按钮:一圈慢慢转的光边 */
@property --fab-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.ai-fab {
  position: fixed;
  bottom: calc(var(--tl-h) + 16px); right: 18px;
  z-index: 200;
  display: flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 16px 0 13px;
  border: 1.5px solid transparent; border-radius: 22px;
  background:
    linear-gradient(#141826, #141826) padding-box,
    conic-gradient(from var(--fab-a), #a78bfa, #6d5fd6 28%, #1c2032 46%, #1c2032 62%, #c4b5fd 84%, #a78bfa) border-box;
  color: var(--tx-1); font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 30px -8px rgba(167, 139, 250, 0.6), 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
  animation: fab-spin 5s linear infinite, rise-in 0.6s var(--ease) 0.4s backwards;
  user-select: none; -webkit-user-select: none;
}
@keyframes fab-spin { to { --fab-a: 360deg; } }
.ai-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px -8px rgba(167, 139, 250, 0.85), 0 4px 10px rgba(0, 0, 0, 0.5);
}
.ai-fab:active { transform: scale(0.96); }
.ai-fab.hidden { display: none; }
.ai-fab-icon { display: inline-flex; color: var(--ac-hi); }
.ai-fab-icon .ic { width: 17px; height: 17px; }
.ai-fab-label { letter-spacing: 0.04em; }
@media (max-width: 520px) {
  .ai-fab-label { display: none; }
  .ai-fab { padding: 0 11px; }
}

/* 浮动 chat 卡片 */
.ai-floating-panel {
  position: fixed;
  bottom: 100px; right: 18px;
  width: 380px; max-width: calc(100vw - 36px);
  height: 540px; max-height: calc(100vh - 140px);
  z-index: 220;
  background: #11141c;
  border: 1px solid #2a3448;
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6), 0 4px 16px rgba(167,139,250,0.18);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: aip-pop 0.18s ease-out;
}
.ai-floating-panel.hidden { display: none; }
@keyframes aip-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.aip-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(167,139,250,0.16), rgba(167,139,250,0.04));
  border-bottom: 1px solid rgba(167,139,250,0.25);
}
.aip-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; color: #e5e7eb;
}
.aip-title-icon { font-size: 15px; }
.aip-title-tag {
  background: rgba(167,139,250,0.22);
  color: #c4b5fd;
  font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 8px;
  font-family: ui-monospace, monospace;
}
.aip-actions { display: flex; gap: 2px; }
.aip-icon-btn {
  background: transparent; border: 0; color: #94a3b8;
  width: 28px; height: 28px; padding: 0;
  border-radius: 6px;
  font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.aip-icon-btn:hover { background: rgba(167,139,250,0.18); color: #e5e7eb; }

.aip-settings {
  padding: 10px 14px;
  background: #0e1118;
  border-bottom: 1px solid #1f2433;
  display: grid; gap: 6px;
}
.aip-settings.hidden { display: none; }
.aip-settings-row {
  display: flex; gap: 6px;
}
.aip-settings input, .aip-settings select {
  flex: 1; min-width: 0;
  background: #0a0e14; color: #e5e7eb;
  border: 1px solid #2a3448; border-radius: 5px;
  padding: 6px 9px;
  font-family: ui-monospace, monospace; font-size: 11.5px;
}
.aip-settings input:focus, .aip-settings select:focus {
  outline: none; border-color: #a78bfa;
}
.aip-grounding {
  display: flex; align-items: center; gap: 4px;
  background: #0a0e14; border: 1px solid #2a3448;
  border-radius: 5px; padding: 0 9px;
  font-size: 12px; color: #cbd5e1; cursor: pointer;
}
.aip-grounding input { accent-color: #a78bfa; }
.aip-tip {
  font-size: 10.5px; color: #64748b; margin: 2px 0 0; line-height: 1.5;
}
.aip-tip a { color: #a78bfa; text-decoration: none; }

/* v95 高级设置(自定义 endpoint) */
.aip-advanced {
  margin-top: 8px;
  padding: 6px 0 0;
  border-top: 1px dashed rgba(167,139,250,0.18);
}
.aip-advanced summary {
  font-size: 10.5px; color: #94a3b8; cursor: pointer;
  padding: 4px 0;
  user-select: none;
}
.aip-advanced summary:hover { color: #c4b5fd; }
.aip-advanced[open] summary { color: #a78bfa; }
.aip-advanced .aip-settings-row { margin-top: 6px; }
.aip-advanced input[type="text"] {
  background: #0a0e14; color: #e5e7eb;
  border: 1px solid #2a3448; border-radius: 5px;
  padding: 6px 9px; width: 100%;
  font-family: ui-monospace, monospace; font-size: 11px;
}
.aip-advanced input[type="text"]:focus { outline: none; border-color: #a78bfa; }
.aip-advanced textarea {
  background: #0a0e14; color: #e5e7eb;
  border: 1px solid #2a3448; border-radius: 5px;
  padding: 7px 10px; width: 100%;
  font-family: inherit; font-size: 11.5px;
  resize: vertical; min-height: 56px;
}
.aip-advanced textarea:focus { outline: none; border-color: #a78bfa; }

.aip-messages {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: #0a0e14;
  scroll-behavior: smooth;
}
.aip-messages::-webkit-scrollbar { width: 6px; }
.aip-messages::-webkit-scrollbar-thumb {
  background: rgba(167,139,250,0.3); border-radius: 3px;
}

/* 复用 ai-msg / ai-citations / ai-chip 既有样式 */
.aip-welcome {
  color: #cbd5e1; font-size: 12px;
}
.aip-welcome-title {
  font-size: 13px; color: #e5e7eb; font-weight: 600;
  margin-bottom: 8px;
}
.aip-welcome-chips {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.aip-chip {
  background: rgba(167,139,250,0.08);
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: 12px;
  padding: 4px 9px;
  color: #c4b5fd;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.aip-chip-hero {
  background: linear-gradient(135deg, rgba(167,139,250,0.35), rgba(196,181,253,0.18)) !important;
  border-color: #a78bfa !important;
  color: #e5e7eb !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(167,139,250,0.25);
  width: 100%;  /* 占满 hero 一行 */
  margin-bottom: 4px;
}
.aip-chip-hero:hover {
  background: linear-gradient(135deg, rgba(167,139,250,0.5), rgba(196,181,253,0.3)) !important;
  transform: translateY(-1px);
}
.aip-chip:hover {
  background: rgba(167,139,250,0.18);
  border-color: #a78bfa;
  color: #e5e7eb;
}

.aip-input-bar {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 6px;
  padding: 10px 12px;
  background: #0e1118;
  border-top: 1px solid #1f2433;
}
/* v93 🎙 麦克风按钮 */
.aip-mic {
  background: transparent;
  border: 1px solid #2a3448;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 15px;
  padding: 0 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.aip-mic:hover { background: rgba(167,139,250,0.16); color: #c4b5fd; border-color: #a78bfa; }
.aip-mic:disabled { cursor: not-allowed; }
.aip-mic.listening {
  background: rgba(239,68,68,0.18);
  color: #ef4444;
  border-color: #ef4444;
  animation: aip-mic-pulse 1s ease-in-out infinite;
}
@keyframes aip-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
  50%      { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}
.aip-input-bar textarea {
  background: #0a0e14; color: #e5e7eb;
  border: 1px solid #2a3448; border-radius: 6px;
  padding: 7px 10px;
  font-family: inherit; font-size: 12.5px; line-height: 1.5;
  resize: none;
  max-height: 80px;
}
.aip-input-bar textarea:focus {
  outline: none; border-color: #a78bfa;
}
.aip-send {
  background: #a78bfa; color: #0a0e14;
  border: 0; border-radius: 6px;
  padding: 0 14px;
  font-weight: 700; font-size: 14px; cursor: pointer;
  white-space: nowrap;
}
.aip-send:hover { background: #c4b5fd; }
.aip-send:disabled { background: #2a3448; color: #64748b; cursor: not-allowed; }

/* 嵌入模式不显示浮动 AI(iframe 不污染父页面)*/
html[data-embed="1"] .ai-fab,
html[data-embed="1"] .ai-floating-panel {
  display: none !important;
}

/* ====== v85 🌐 Grounding toggle / kb-status / citation chips ====== */

/* settings 区 grounding toggle */
.ai-grounding-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: #cbd5e1; cursor: pointer;
  user-select: none; -webkit-user-select: none;
}
.ai-grounding-row input[type="checkbox"] {
  width: 14px; height: 14px; accent-color: #a78bfa; cursor: pointer;
}
.ai-grounding-row input[disabled] { opacity: 0.4; cursor: not-allowed; }
.ai-grounding-row input[disabled] + span { opacity: 0.5; }
.ai-grounding-tip code {
  background: #0a0e14; padding: 1px 5px; border-radius: 3px;
  font-family: ui-monospace, monospace; font-size: 10.5px; color: #c4b5fd;
}

/* 知识库状态栏 */
.ai-kb-status {
  background: linear-gradient(180deg, rgba(167,139,250,0.08), rgba(167,139,250,0.02));
  border: 1px solid rgba(167,139,250,0.22);
  border-radius: 6px; padding: 7px 12px;
  font-size: 11.5px; color: #cbd5e1;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 4px;
}
.ai-kb-status strong { color: #a78bfa; }
.ai-kb-grounding {
  font-size: 10.5px; padding: 2px 8px; border-radius: 10px;
  font-weight: 700; letter-spacing: 0.4px;
}
.ai-kb-grounding.on {
  background: rgba(16,185,129,0.18); color: #34d399;
  border: 1px solid rgba(16,185,129,0.4);
}
.ai-kb-grounding.off {
  background: rgba(100,116,139,0.18); color: #94a3b8;
  border: 1px solid rgba(100,116,139,0.4);
}
.ai-kb-grounding.na {
  background: rgba(251,191,36,0.16); color: #fbbf24;
  border: 1px solid rgba(251,191,36,0.4);
}

/* 消息附带 grounded 标记 + citation chips */
.ai-msg-grounded {
  display: inline-block;
  font-size: 11px;
  margin-left: 4px;
}
.ai-citations {
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(167,139,250,0.06);
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: 6px;
  font-size: 10.5px;
  color: #94a3b8;
}
.ai-citations-head {
  margin-bottom: 6px;
  color: #cbd5e1;
}
.ai-citations-head code {
  background: #0a0e14; padding: 1px 5px; border-radius: 3px;
  font-family: ui-monospace, monospace; font-size: 10px; color: #c4b5fd;
}
.ai-citations-list {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ai-citation {
  display: inline-block;
  padding: 3px 8px;
  background: #0a0e14;
  border: 1px solid #2a3448;
  border-radius: 4px;
  color: #a78bfa; text-decoration: none;
  font-size: 10.5px; font-family: ui-monospace, monospace;
  transition: background 0.15s, border-color 0.15s;
}
.ai-citation:hover {
  background: rgba(167,139,250,0.12);
  border-color: #a78bfa;
  color: #c4b5fd;
}

/* ====== v88 新手术语 — 紧凑版 chip nav 单行横滚 + table 压缩 ====== */

/* 头部:标题 + tip 一行 */
.term-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin: 4px 0 8px;
}
.term-header h4 {
  margin: 0 !important;
  font-size: 14px !important;
}
.term-header-count {
  display: inline-block;
  background: rgba(167,139,250,0.22);
  color: #c4b5fd;
  font-size: 10.5px; font-weight: 700;
  padding: 1px 7px; border-radius: 8px;
  font-family: ui-monospace, monospace;
  margin-left: 4px;
}
.term-header-tip {
  font-size: 10.5px; color: #64748b;
}

/* chip 导航 — 单行横滚 */
.term-cat-nav {
  display: flex; gap: 6px;
  margin: 0 0 12px;
  padding: 8px 10px;
  background: rgba(167,139,250,0.04);
  border: 1px solid rgba(167,139,250,0.16);
  border-radius: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.term-cat-nav::-webkit-scrollbar {
  height: 4px;
}
.term-cat-nav::-webkit-scrollbar-thumb {
  background: rgba(167,139,250,0.4);
  border-radius: 2px;
}
.term-cat-link {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 9px;
  background: #131826;
  border: 1px solid #2a3448;
  border-radius: 12px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
  scroll-snap-align: start;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.term-cat-link:hover {
  background: rgba(167,139,250,0.16);
  border-color: #a78bfa;
  color: #e5e7eb;
}
.term-cat-count {
  display: inline-block;
  background: rgba(167,139,250,0.22);
  color: #c4b5fd;
  font-size: 9.5px; font-weight: 700;
  padding: 0 5px;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
}

/* section 标题更紧凑 */
.term-cat {
  margin: 14px 0;
  scroll-margin-top: 10px;
}
.term-cat-title {
  font-size: 12.5px;
  color: #a78bfa;
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(167,139,250,0.2);
  display: flex; align-items: center; gap: 6px;
  font-weight: 700;
}
.term-cat-sub {
  font-size: 10.5px;
  color: #64748b;
  font-weight: 500;
  font-family: ui-monospace, monospace;
}
.term-cat-chip {
  display: inline-block;
  padding: 1px 7px;
  background: rgba(167,139,250,0.12);
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: 8px;
  color: #c4b5fd;
  font-size: 10.5px;
  white-space: nowrap;
}

/* 表格紧凑 — 隐藏 thead,行 padding 减小 */
.term-table {
  font-size: 12px;
}
.term-table tbody tr td {
  padding: 5px 8px !important;
}
.term-table .term-key {
  width: 30%;
  white-space: nowrap;
}

/* 右键菜单里的「问 AI 教练」 */
.context-menu .ctx-ask-ai { color: var(--ac-hi); font-weight: 600; }

/* ====== v83 💬 AI 战术教练(攻略中心第 7 tab) ====== */

.guide-tab-ai {
  position: relative;
  background: linear-gradient(180deg, rgba(167,139,250,0.06), transparent) !important;
}
.guide-tab-ai.active {
  color: #a78bfa !important;
  background: linear-gradient(180deg, rgba(167,139,250,0.16), transparent) !important;
}
.guide-tab-badge {
  position: absolute; top: 6px; right: 6px;
  background: #a78bfa; color: #0a0e14;
  font-size: 9px; font-weight: 800;
  padding: 1px 5px; border-radius: 3px;
  letter-spacing: 0.5px;
}

.ai-coach {
  display: flex; flex-direction: column;
  height: 100%; min-height: 0;
  gap: 8px;
}

/* 设置(API key / model)— v86 折叠态一行紧凑 */
.ai-settings {
  background: #131826; border: 1px solid #1f2433;
  border-radius: 8px; padding: 6px 12px;
  flex-shrink: 0;
}
.ai-settings.collapsed { padding: 6px 12px; }
.ai-settings.collapsed .ai-settings-body { display: none; }
.ai-settings:not(.collapsed) { padding: 8px 12px 12px; }
.ai-settings-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11.5px; color: #cbd5e1; font-weight: 600;
  cursor: pointer;
  gap: 8px;
}
.ai-settings-summary {
  display: inline-flex; align-items: center; gap: 6px;
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.ai-settings-summary code {
  background: #0a0e14; padding: 1px 5px; border-radius: 3px;
  font-family: ui-monospace, monospace; font-size: 10.5px; color: #c4b5fd;
}
.ai-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 10.5px; font-weight: 700;
  border: 1px solid transparent;
}
.ai-dot.on  { background: rgba(16,185,129,0.22); color: #34d399; border-color: rgba(16,185,129,0.4); }
.ai-dot.off { background: rgba(100,116,139,0.18); color: #94a3b8; border-color: rgba(100,116,139,0.4); }
.ai-dot.na  { background: rgba(251,191,36,0.18); color: #fbbf24; border-color: rgba(251,191,36,0.4); }
.ai-settings-toggle {
  background: transparent; border: 0; color: #94a3b8;
  cursor: pointer; padding: 0 4px;
  transition: transform 0.2s;
  font-size: 10px; line-height: 1;
}
.ai-settings.collapsed .ai-settings-toggle { transform: rotate(-90deg); }
.ai-settings-body { margin-top: 10px; }
.ai-settings-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 8px;
  align-items: end;
}
.ai-field label {
  font-size: 10.5px; color: #94a3b8; display: block; margin-bottom: 2px;
}
.ai-settings input, .ai-settings select {
  background: #0a0e14; color: #e5e7eb;
  border: 1px solid #2a3448; border-radius: 5px;
  padding: 6px 9px; width: 100%;
  font-family: ui-monospace, monospace; font-size: 11.5px;
}
.ai-settings input:focus, .ai-settings select:focus {
  outline: none; border-color: #a78bfa;
}
.ai-field-grounding { padding-bottom: 6px; }
.ai-tip {
  font-size: 10.5px; color: #64748b; margin: 6px 0 0; line-height: 1.5;
}
.ai-tip a { color: #a78bfa; text-decoration: none; }
.ai-tip a:hover { text-decoration: underline; }

/* 消息流 */
.ai-messages {
  flex: 1; min-height: 180px;
  overflow-y: auto;
  background: #0a0e14; border: 1px solid #1f2433;
  border-radius: 8px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}
/* v86 紧凑欢迎卡 */
.ai-welcome {
  color: #cbd5e1;
}
.ai-welcome-title {
  font-size: 13px; color: #e5e7eb; font-weight: 600;
  margin-bottom: 10px;
}
.ai-welcome-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ai-chip {
  background: rgba(167,139,250,0.08);
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: 14px;
  padding: 5px 11px;
  color: #c4b5fd;
  font-size: 11.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.ai-chip:hover {
  background: rgba(167,139,250,0.18);
  border-color: #a78bfa;
  color: #e5e7eb;
}
.ai-msg {
  display: flex; flex-direction: column; gap: 4px;
  max-width: 90%;
}
.ai-msg-user { align-self: flex-end; align-items: flex-end; }
.ai-msg-assistant { align-self: flex-start; }
.ai-msg-role {
  font-size: 10.5px; color: #64748b; font-weight: 700;
  letter-spacing: 0.5px;
}
.ai-msg-text {
  background: #131826; border: 1px solid #1f2433;
  border-radius: 10px; padding: 9px 13px;
  font-size: 13px; line-height: 1.7; color: #e5e7eb;
  word-wrap: break-word; white-space: pre-wrap;
}
.ai-msg-user .ai-msg-text {
  background: rgba(167,139,250,0.14);
  border-color: rgba(167,139,250,0.4);
  color: #e5e7eb;
}
.ai-msg-text strong { color: #a78bfa; font-weight: 700; }
.ai-msg-text code {
  background: #0a0e14; padding: 1px 5px; border-radius: 3px;
  font-family: ui-monospace, monospace; font-size: 11.5px;
  color: #c4b5fd;
}
.ai-msg-text.streaming::after {
  content: '▊';
  color: #a78bfa;
  animation: ai-blink 1s steps(2) infinite;
  margin-left: 2px;
}
@keyframes ai-blink { 50% { opacity: 0; } }

/* 输入栏 — v86 紧凑 */
.ai-input-bar {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 6px;
  flex-shrink: 0;
}
.ai-input-bar textarea {
  background: #0a0e14; color: #e5e7eb;
  border: 1px solid #2a3448; border-radius: 8px;
  padding: 8px 11px;
  font-family: inherit; font-size: 12.5px; line-height: 1.5;
  resize: none;
  transition: border-color 0.15s;
  grid-column: 1;
}
.ai-input-bar textarea:focus {
  outline: none; border-color: #a78bfa;
}
.ai-input-actions {
  display: contents;
}
.ai-send, .ai-clear {
  border: 0; border-radius: 8px;
  font-weight: 700; font-size: 14px; cursor: pointer;
  white-space: nowrap;
  min-width: 40px;
  height: 100%;
  display: inline-flex; align-items: center; justify-content: center;
}
.ai-send {
  background: #a78bfa; color: #0a0e14;
  padding: 0 16px;
}
.ai-send:hover { background: #c4b5fd; }
.ai-send:disabled { background: #2a3448; color: #64748b; cursor: not-allowed; }
.ai-clear {
  background: transparent; color: #94a3b8;
  border: 1px solid #2a3448;
  padding: 0 10px;
  font-size: 16px;
}
.ai-clear:hover { background: #131826; color: #ef4444; border-color: #ef4444; }

/* 检索上下文显示 */
.ai-context {
  font-size: 10.5px; color: #64748b;
  padding: 0 4px;
  font-family: ui-monospace, monospace;
  flex-shrink: 0;
}
.ai-context-kb {
  display: inline-block;
  padding: 1px 6px; border-radius: 3px;
  background: rgba(167,139,250,0.12); color: #a78bfa;
  margin: 0 2px;
}
