/* tongtang-multichart.css — 合盘多盘对照（配套 tongtang-multichart.js）
 * 抽屉 #tt-multi 贴在工作台 #tt-panel 外侧；全屏对照 #tt-multi-full 占满聊天以外的区域。
 * 星盘本身的样式由 JS 从 tongtang-chart.css 的 #tt-panel 规则复制而来。 */
:root {
  --ttm-a: #9db06a;
  --ttm-b: #6f9fd0;
  --ttm-rel: #c9a24b;
  --ttm-ease: cubic-bezier(.22, 1, .36, 1);
  --ttm-ease-out: cubic-bezier(.4, 0, .7, .2);
  --ttm-dur: .46s;
  --ttm-out: .32s;
}
@supports (animation-timing-function: linear(0, 1)) {
  :root { --ttm-ease: linear(0, .24 8%, .62 20%, .9 34%, 1.02 48%, 1.01 62%, 1); }
}

/* ── 抽屉：从工作台下面向聊天方向滑出 ── */
.ttm-drawer {
  position: fixed; top: 0; height: 100vh; height: 100dvh;
  width: var(--ttm-w, 440px);
  z-index: 9997; display: flex; flex-direction: column; overflow: hidden;
  background: var(--color-surface-raised, #1c1c1c);
  color: var(--color-text, rgba(255, 255, 255, .9));
  font-family: var(--font-ui, "Noto Sans SC", sans-serif);
  border-left: .5px solid var(--color-line, rgba(255, 255, 255, .12));
  box-shadow: -6px 0 32px rgba(0, 0, 0, .24);
  visibility: hidden;
  transform: translateX(calc(var(--ttm-dir, 1) * 100%));
  /* 收起：干脆地缩回工作台下面（加速离场），动画结束后再隐藏 */
  transition: transform var(--ttm-out) var(--ttm-ease-out), visibility 0s linear var(--ttm-out);
  will-change: transform;
}
.ttm-drawer[data-side="left"] {
  border-left: 0; border-right: .5px solid var(--color-line, rgba(255, 255, 255, .12));
  box-shadow: 6px 0 32px rgba(0, 0, 0, .24);
}
.ttm-drawer.is-open {
  visibility: visible; transform: none;
  transition: transform var(--ttm-dur) var(--ttm-ease), visibility 0s;
}
.ttm-head, .ttm-body {
  opacity: 0; transform: translateX(calc(var(--ttm-dir, 1) * 14px));
  transition: opacity .24s ease, transform .36s var(--ttm-ease);
}
.ttm-drawer.is-open .ttm-head { opacity: 1; transform: none; transition-delay: .12s; }
.ttm-drawer.is-open .ttm-body { opacity: 1; transform: none; transition-delay: .2s; }

.ttm-head {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  height: var(--tt-chat-head-h, 56px); padding: 0 12px 0 16px;
  border-bottom: .5px solid var(--color-line, rgba(255, 255, 255, .12));
}
.ttm-title { font-size: 13px; font-weight: 600; white-space: nowrap; }
.ttm-chips { display: flex; gap: 6px; min-width: 0; flex: 1; overflow: hidden; }
.ttm-chip {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%;
  padding: 5px 10px; border-radius: 999px; font: inherit; font-size: 12px; cursor: pointer;
  color: var(--color-text-muted, rgba(255, 255, 255, .6));
  background: transparent; border: 1px solid transparent;
}
.ttm-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttm-chip:hover { background: var(--color-hover, rgba(255, 255, 255, .06)); }
.ttm-chip.active {
  color: var(--color-text, rgba(255, 255, 255, .92)); font-weight: 600;
  background: var(--color-hover, rgba(255, 255, 255, .08));
  border-color: var(--color-line-strong, var(--color-line, rgba(255, 255, 255, .18)));
}
.ttm-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--ttm-a); }
.ttm-dot.b { background: var(--ttm-b); }
.ttm-dot.rel { background: var(--ttm-rel); }
.ttm-actions, .ttm-factions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ttm-actions button, .ttm-factions button {
  min-width: 28px; height: 28px; padding: 0 8px; border: 0; border-radius: 6px; cursor: pointer;
  background: transparent; font: inherit; font-size: 13px;
  color: var(--color-text-muted, rgba(255, 255, 255, .55));
}
.ttm-actions button:hover, .ttm-factions button:hover {
  background: var(--color-hover, rgba(255, 255, 255, .08));
  color: var(--color-text, rgba(255, 255, 255, .92));
}
.ttm-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; overscroll-behavior: contain; }
/* 八字 / 紫微合盘：宽度够时甲乙两张盘在抽屉里并排，各自滚动 */
.ttm-body.ttm-dual { display: grid; grid-template-columns: 1fr 1fr; padding: 0; overflow: hidden; }
.ttm-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ttm-col + .ttm-col { border-left: .5px solid var(--color-line, rgba(255, 255, 255, .12)); }
.ttm-col-head {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 9px 14px;
  font-size: 12.5px; font-weight: 600; border-bottom: .5px solid var(--color-line, rgba(255, 255, 255, .1));
}
.ttm-col-head span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttm-col-body { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; overscroll-behavior: contain; }
.ttm-drawer[data-cols="2"] .ttm-chips { display: none; }
.ttm-drawer[data-cols="2"] .ttm-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ttm-empty { margin: 24px 0; text-align: center; color: var(--color-text-muted, rgba(255, 255, 255, .55)); font-size: 12px; }

/* 抽屉与对照格子里只看本命：隐藏盘型切换条 */
#tt-multi .tt-astro-kinds, #tt-multi-full .tt-astro-kinds,
#tt-multi .tt-astro-toolbar, #tt-multi-full [data-cell="A"] .tt-astro-toolbar, #tt-multi-full [data-cell="B"] .tt-astro-toolbar { display: none !important; }

/* 抽屉收起后停在工作台边缘的小签 / 放不下抽屉时的「全屏对照」入口 */
.ttm-tab {
  position: fixed; top: 38%; z-index: 9997;
  writing-mode: vertical-rl; letter-spacing: .12em;
  padding: 14px 6px; font: inherit; font-size: 12px; cursor: pointer;
  color: var(--color-text-muted, rgba(255, 255, 255, .7));
  background: var(--color-surface-raised, #1c1c1c);
  border: .5px solid var(--color-line, rgba(255, 255, 255, .16)); border-right: 0;
  border-radius: 8px 0 0 8px; box-shadow: -4px 0 16px rgba(0, 0, 0, .18);
  animation: ttm-tab-in .36s var(--ttm-ease) both;
}
.ttm-tab[data-side="left"] { border: .5px solid var(--color-line, rgba(255, 255, 255, .16)); border-left: 0; border-radius: 0 8px 8px 0; box-shadow: 4px 0 16px rgba(0, 0, 0, .18); }
.ttm-tab:hover { color: var(--color-text, #fff); }
.ttm-tab[hidden] { display: none !important; }
@keyframes ttm-tab-in { from { opacity: 0; transform: translateX(calc(var(--ttm-dir, 1) * 10px)); } to { opacity: 1; transform: none; } }

/* ── 全屏对照：盘面占满聊天以外的区域，聊天区由 applyDockPush 收成侧栏 ── */
.ttm-full {
  position: fixed; top: 0; bottom: 0; z-index: 9999;
  display: flex; flex-direction: column;
  background: var(--color-surface-raised, #1c1c1c);
  color: var(--color-text, rgba(255, 255, 255, .9));
  font-family: var(--font-ui, "Noto Sans SC", sans-serif);
  border-left: .5px solid var(--color-line, rgba(255, 255, 255, .12));
  box-shadow: -6px 0 32px rgba(0, 0, 0, .28);
  opacity: 0; visibility: hidden;
  transform: translateX(calc(var(--ttm-dir, 1) * 28px));
  transition: opacity var(--ttm-out) ease, transform var(--ttm-out) var(--ttm-ease-out), visibility 0s linear var(--ttm-out);
}
.ttm-full[data-side="left"] { border-left: 0; border-right: .5px solid var(--color-line, rgba(255, 255, 255, .12)); box-shadow: 6px 0 32px rgba(0, 0, 0, .28); }
.ttm-full.is-open {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .3s ease, transform var(--ttm-dur) var(--ttm-ease), visibility 0s;
}
.ttm-fhead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0;
  height: var(--tt-chat-head-h, 56px); padding: 0 16px;
  border-bottom: .5px solid var(--color-line, rgba(255, 255, 255, .12));
}
.ttm-ftitle { font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttm-factions button { padding: 0 12px; border: .5px solid var(--color-line, rgba(255, 255, 255, .16)); }
.ttm-grid {
  flex: 1; min-height: 0; display: grid; gap: 1px; overflow: auto; overscroll-behavior: contain;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  grid-auto-rows: minmax(420px, 1fr);
  background: var(--color-line, rgba(255, 255, 255, .12));
}
.ttm-cell {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--color-surface-raised, #1c1c1c);
  opacity: 0; transform: translateY(10px);
}
.ttm-full.is-open .ttm-cell { animation: ttm-cell-in .42s var(--ttm-ease) both; }
.ttm-full.is-open .ttm-cell[data-cell="A"] { animation-delay: .12s; }
.ttm-full.is-open .ttm-cell[data-cell="R"] { animation-delay: .19s; }
.ttm-full.is-open .ttm-cell[data-cell="B"] { animation-delay: .26s; }
@keyframes ttm-cell-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ttm-cell-head {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 10px 14px;
  font-size: 12.5px; font-weight: 600;
  border-bottom: .5px solid var(--color-line, rgba(255, 255, 255, .1));
}
.ttm-cell-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; overscroll-behavior: contain; }

/* 聊天侧栏宽度拖柄：贴在盘面与聊天的交界处 */
.ttm-resize { position: absolute; top: 0; bottom: 0; left: -4px; width: 8px; z-index: 5; cursor: col-resize; background: transparent; transition: background .15s; }
.ttm-full[data-side="left"] .ttm-resize { left: auto; right: -4px; }
.ttm-resize:hover, .ttm-resize:focus-visible, body.ttm-dragging .ttm-resize { background: color-mix(in srgb, var(--color-accent, #d18a32) 55%, transparent); outline: none; }
body.ttm-dragging { user-select: none; cursor: col-resize; }
body.ttm-dragging section.con { transition: none !important; }

/* ── 聊天位置：侧栏（默认）/ 细轨 / 底部带 ── */
.ttm-chatmode { display: inline-flex; padding: 2px; gap: 2px; border: .5px solid var(--color-line, rgba(255, 255, 255, .16)); border-radius: 8px; }
.ttm-factions .ttm-chatmode button { min-width: 0; height: 24px; padding: 0 9px; border: 0; border-radius: 6px; font-size: 12px; }
.ttm-factions .ttm-chatmode button[aria-pressed="true"] {
  color: var(--color-text, rgba(255, 255, 255, .92)); background: var(--color-hover, rgba(255, 255, 255, .1)); font-weight: 600;
}
.ttm-full[data-chatmode="bottom"] { border-left: 0; border-right: 0; border-bottom: .5px solid var(--color-line, rgba(255, 255, 255, .12)); box-shadow: 0 6px 32px rgba(0, 0, 0, .28); }
.ttm-full[data-chatmode="bottom"] .ttm-resize { left: 0; right: 0; top: auto; bottom: -4px; width: auto; height: 8px; cursor: row-resize; }
body.ttm-dragging:has(.ttm-full[data-chatmode="bottom"]) { cursor: row-resize; }
.ttm-full .ttm-resize[hidden] { display: none; }

/* 细轨：聊天区收成一条窄边，仍在原位；回复有新内容时亮点提示 */
.ttm-rail {
  position: fixed; top: 0; bottom: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 0;
  background: var(--color-surface-raised, #1c1c1c); color: var(--color-text-muted, rgba(255, 255, 255, .65));
  border: 0; border-left: .5px solid var(--color-line, rgba(255, 255, 255, .12)); border-right: .5px solid var(--color-line, rgba(255, 255, 255, .12));
  font: inherit; font-size: 12px; cursor: pointer; animation: ttm-tab-in .36s var(--ttm-ease) both;
}
.ttm-rail:hover { color: var(--color-text, #fff); background: var(--color-hover, #242424); }
.ttm-rail:focus-visible { outline: 2px solid var(--color-accent, #d18a32); outline-offset: -2px; }
.ttm-rail[hidden] { display: none !important; }
.ttm-rail-txt { writing-mode: vertical-rl; letter-spacing: .18em; }
.ttm-rail-dot { width: 8px; height: 8px; margin-top: auto; border-radius: 50%; background: var(--color-accent, #d18a32); opacity: 0; transform: scale(.4); transition: opacity .2s, transform .2s; }
.ttm-rail.has-new .ttm-rail-dot { opacity: 1; transform: none; animation: ttm-pulse 1.6s ease-in-out infinite; }
@keyframes ttm-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-accent, #d18a32) 55%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }

/* 全屏对照期间不再显示面板收起后的恢复浮标；主面板被盘面盖住，底部带模式下也不能露出来 */
body.ttm-full-on #tt-panel-restore-tab { display: none !important; }
body.ttm-full-on #tt-panel { visibility: hidden !important; }

/* 命盘内容在抽屉 / 格子里的细节 */
.ttm-note { margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; font-size: 12px; line-height: 1.5; color: #b45309; background: rgba(245, 158, 11, .12); border: .5px solid rgba(245, 158, 11, .35); }
/* Time tables use the same global .ziwei-time-* rules as the focus chart. */
.ttm-cell .ttc-open { display: none; }
.ttm-cell .ttc-card { max-width: none; margin: 0; }

@media (max-width: 768px) {
  .ttm-drawer, .ttm-tab, .ttm-full, .ttm-rail { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .ttm-drawer, .ttm-head, .ttm-body, .ttm-full, .ttm-tab { transition-duration: .01ms !important; transition-delay: 0s !important; }
  .ttm-drawer.is-open, .ttm-full.is-open { transition-duration: .01ms !important; }
  .ttm-cell, .ttm-tab, .ttm-rail { animation: none !important; opacity: 1 !important; transform: none !important; }
  .ttm-rail-dot { animation: none !important; }
}

/* Match #tt-chart-body padding and the focus panel tab-row height. */
.ttm-col-body{padding:12px}
.ttm-col-head{box-sizing:border-box;min-height:56px;padding:8px 12px}
.ttm-col-head>span{padding:6px 10px;border:1px solid var(--color-line-strong,var(--color-line));border-radius:var(--radius-sm,8px);background:var(--color-hover);font-size:12px;font-weight:600}
