/* ============================================================
   styles.css — 深色主题，太空/推理游戏风格
   ============================================================ */

:root {
  --bg-base:        #0d1117;
  --bg-surface:     #161b22;
  --bg-elevated:    #1f2937;
  --bg-hover:       #2d3748;
  --border:         #30363d;
  --border-light:   #3d4a5c;
  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #484f58;
  --accent-blue:    #58a6ff;
  --accent-blue-bg: #1a3a5c;
  --goose-color:    #3fb950;
  --goose-bg:       #0d2818;
  --goose-border:   #1f5c30;
  --duck-color:     #f85149;
  --duck-bg:        #2d0f0e;
  --duck-border:    #6b1c1a;
  --neutral-color:  #a371f7;
  --neutral-bg:     #1a0d2e;
  --neutral-border: #4a2a7a;
  --trust-unknown:    #484f58;
  --trust-suspicious: #d29922;
  --trust-trusted:    #58a6ff;
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px; --radius-xl: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.6);
  --transition: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'PingFang SC','Hiragino Sans GB','Microsoft YaHei','Noto Sans SC',sans-serif;
  background: var(--bg-base); color: var(--text-primary);
  min-width: 1200px; min-height: 100vh; line-height: 1.5;
}
.hidden { display: none !important; }

/* ── 顶部导航栏 ── */
#app-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.header-left { display: flex; align-items: center; gap: 16px; }
.app-title { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.02em; }
.round-badge {
  background: var(--accent-blue-bg); color: var(--accent-blue);
  border: 1px solid var(--accent-blue); border-radius: 20px;
  padding: 2px 12px; font-size: 0.85rem; font-weight: 600;
}
.phase-nav {
  display: flex; gap: 4px; background: var(--bg-base);
  border-radius: var(--radius-lg); padding: 4px; border: 1px solid var(--border);
}
.nav-btn {
  background: transparent; border: none; color: var(--text-secondary);
  padding: 6px 18px; border-radius: var(--radius-md); cursor: pointer;
  font-size: 0.9rem; font-weight: 500; font-family: inherit;
  transition: background var(--transition), color var(--transition);
}
.nav-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }
.nav-btn.active { background: var(--accent-blue-bg); color: var(--accent-blue); font-weight: 600; }
.nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.header-right { display: flex; gap: 8px; align-items: center; }

/* ── 通用按钮 ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius-md);
  border: 1px solid transparent; font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition); white-space: nowrap; font-family: inherit;
}
.btn-primary { background: var(--accent-blue); color: #0d1117; border-color: var(--accent-blue); }
.btn-primary:hover { background: #79b8ff; }
.btn-primary:active { transform: scale(0.97); }
.toast-container {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none;
}
.toast {
  background: rgba(0, 0, 0, 0.8); color: white; padding: 10px 20px;
  border-radius: 20px; font-size: 0.9rem; animation: toast-in-out 2s forwards;
}
@keyframes toast-in-out {
  0% { opacity: 0; transform: translateY(20px); }
  15% { opacity: 1; transform: translateY(0); }
  85% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-20px); }
}
.trust-flash { animation: trust-flash-anim 0.6s ease-out; }
@keyframes trust-flash-anim {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.8); }
  100% { box-shadow: 0 0 20px 20px rgba(255, 255, 255, 0); }
}
.flash-suspicious { animation-name: flash-susp-anim; }
.flash-trusted { animation-name: flash-trust-anim; }
.flash-confirmed_duck { animation-name: flash-duck-anim; }
@keyframes flash-susp-anim {
  0% { box-shadow: 0 0 0 0 rgba(240, 180, 41, 0.8); }
  100% { box-shadow: 0 0 20px 20px rgba(240, 180, 41, 0); }
}
@keyframes flash-trust-anim {
  0% { box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.8); }
  100% { box-shadow: 0 0 20px 20px rgba(88, 166, 255, 0); }
}
@keyframes flash-duck-anim {
  0% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.8); }
  100% { box-shadow: 0 0 20px 20px rgba(255, 68, 68, 0); }
}
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-light); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: #2d0f0e; color: var(--duck-color); border-color: var(--duck-border); }
.btn-danger:hover { background: #4a1a18; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-large { padding: 12px 36px; font-size: 1.05rem; font-weight: 700; margin-top: auto; }

/* ── 主内容区 ── */
#app-main { height: calc(100vh - 56px); overflow: hidden; }
.phase-section { display: none; height: 100%; overflow-y: auto; }
.phase-section.active { display: flex; flex-direction: column; }

/* ── 阶段一：初始化 ── */
.init-layout {
  display: flex; height: 100%; overflow: hidden;
}
.init-left {
  width: 360px; flex-shrink: 0; border-right: 1px solid var(--border);
  padding: 24px 28px; display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto;
}
.init-right {
  flex: 1; padding: 24px 28px; display: flex; flex-direction: column; gap: 16px;
  overflow-y: auto;
}
.init-left-locked .stepper-btn,
.init-left-locked .map-btn,
.init-left-locked .faction-num {
  pointer-events: none; opacity: 0.45;
}
.init-left-locked .stepper-value { opacity: 0.45; }
.init-locked-tip {
  font-size: 0.82rem; color: #d29922;
  background: #2a1f00; border: 1px solid #5a4000;
  border-radius: var(--radius-sm); padding: 6px 10px;
  margin-top: auto;
}
.section-title {
  font-size: 1.15rem; font-weight: 700;
  border-bottom: 1px solid var(--border); padding-bottom: 10px;
}
.config-block { display: flex; flex-direction: column; gap: 10px; }
.config-label {
  font-size: 0.85rem; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.stepper {
  display: flex; align-items: center; width: fit-content;
  border: 1px solid var(--border-light); border-radius: var(--radius-md); overflow: hidden;
}
.stepper-btn {
  background: var(--bg-elevated); border: none; color: var(--text-primary);
  width: 40px; height: 40px; font-size: 1.2rem; cursor: pointer; font-family: inherit;
  transition: background var(--transition);
}
.stepper-btn:hover { background: var(--bg-hover); }
.stepper-value {
  min-width: 60px; text-align: center; font-size: 1.3rem; font-weight: 700;
  background: var(--bg-surface); padding: 0 12px; line-height: 40px;
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
}
.map-selector { display: flex; gap: 12px; }
.map-btn {
  flex: 1; padding: 10px 16px;
  background: var(--bg-elevated); border: 2px solid var(--border);
  border-radius: var(--radius-md); color: var(--text-secondary);
  font-size: 1rem; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all var(--transition);
}
.map-btn:hover { border-color: var(--border-light); color: var(--text-primary); background: var(--bg-hover); }
.map-btn.active { border-color: var(--accent-blue); color: var(--accent-blue); background: var(--accent-blue-bg); }
.faction-inputs { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.faction-input-group {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 8px 14px;
}
.faction-input-group label { font-weight: 600; font-size: 1rem; }
.faction-num {
  width: 60px; background: var(--bg-base); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 1.1rem; font-weight: 700; text-align: center; padding: 4px 8px; font-family: inherit;
}
.faction-num:focus { outline: none; border-color: var(--accent-blue); }
.faction-total { color: var(--text-secondary); font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.error-msg { color: var(--duck-color); font-size: 0.85rem; font-weight: 500; }
.open-roles-container { display: flex; flex-direction: column; gap: 10px; }
.open-roles-groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.open-roles-search-wrap {
  display: flex; align-items: center; gap: 6px;
}
.open-roles-search {
  width: 260px; background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-size: 0.88rem; padding: 6px 12px; font-family: inherit;
  transition: border-color var(--transition);
}
.open-roles-search:focus { outline: none; border-color: var(--accent-blue); }
.open-roles-search::placeholder { color: var(--text-muted); }
.open-roles-search-clear {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 0.8rem; padding: 4px 8px; cursor: pointer; font-family: inherit;
  transition: all var(--transition);
}
.open-roles-search-clear:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── 我的角色选择器 ── */
.my-role-selector-wrap { position: relative; }
.my-role-input {
  width: 100%; background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-size: 0.95rem; padding: 10px 14px; font-family: inherit;
  transition: border-color var(--transition);
}
.my-role-input:focus { outline: none; border-color: var(--accent-blue); }

.my-role-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); margin-top: 4px; max-height: 240px;
  overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.my-role-item {
  padding: 8px 12px; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  transition: background var(--transition); border-bottom: 1px solid var(--border-light);
}
.my-role-item:last-child { border-bottom: none; }
.my-role-item:hover { background: var(--bg-hover); }
.my-role-item .role-name { font-weight: 700; }
.my-role-item .faction-label { font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; }

.selected-role-box {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.selected-role-box .role-icon { font-size: 1.2rem; }
.selected-role-box .role-name { font-weight: 700; flex: 1; }
.selected-role-box .faction-tag { font-size: 0.75rem; padding: 2px 8px; border-radius: 12px; }
.selected-role-box .role-clear-btn {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1rem; padding: 4px;
}
.selected-role-box .role-clear-btn:hover { color: var(--duck-color); }

/* 阵营颜色微调 */
.faction-goose .faction-label, .faction-goose .faction-tag { background: rgba(74, 232, 96, 0.15); color: var(--goose-color); }
.faction-duck .faction-label, .faction-duck .faction-tag { background: rgba(88, 166, 255, 0.15); color: var(--duck-color); }
.faction-neutral .faction-label, .faction-neutral .faction-tag { background: rgba(240, 180, 41, 0.15); color: var(--neutral-color); }
.selected-role-box.faction-goose { border-color: var(--goose-color); }
.selected-role-box.faction-duck { border-color: var(--duck-color); }
.ai-settings-modal { width: 440px; max-width: 90vw; }
.settings-section { margin-bottom: 20px; padding: 15px; background: rgba(255,255,255,0.03); border-radius: var(--radius-md); border: 1px solid var(--border-light); }
.settings-section h4 { font-size: 0.95rem; margin-bottom: 12px; color: var(--text-primary); border-bottom: 1px solid var(--border-light); padding-bottom: 6px; }
.ai-settings-field { margin-bottom: 12px; }
.ai-settings-field label { display: block; font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 4px; }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }
.settings-select { width: 100%; background: var(--bg-elevated); border: 1px solid var(--border-light); border-radius: var(--radius-sm); color: var(--text-primary); padding: 8px; font-family: inherit; }
.ai-model-display { font-size: 0.9rem; color: var(--accent-blue); font-weight: 600; }
.open-roles-voice-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.open-roles-voice-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.open-roles-voice-btn.listening {
  border-color: #ff2222;
  color: #ffaaaa;
  box-shadow: 0 0 12px rgba(255, 34, 34, 0.25);
}
.role-faction-group { display: flex; flex-direction: column; gap: 8px; }
.role-faction-label {
  font-size: 1rem; font-weight: 700; color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
  padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.role-letter-row { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.role-letter-tag {
  font-size: 0.78rem; font-weight: 800; color: var(--text-muted);
  width: 18px; text-align: center; flex-shrink: 0; font-family: monospace;
}
.role-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.role-chip {
  padding: 6px 16px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-secondary);
  font-size: 1rem; cursor: pointer; transition: all var(--transition); user-select: none;
}
.role-chip:hover { border-color: var(--border-light); color: var(--text-primary); }
.role-chip.selected-goose   { background: var(--goose-bg);   border-color: var(--goose-border);   color: var(--goose-color); }
.role-chip.selected-duck    { background: var(--duck-bg);    border-color: var(--duck-border);    color: var(--duck-color); }
.role-chip.selected-neutral { background: var(--neutral-bg); border-color: var(--neutral-border); color: var(--neutral-color); }

/* ── 阶段二：游戏 ── */
.game-layout { display: flex; height: 100%; overflow: hidden; }
.map-panel { flex: 1; display: flex; flex-direction: column; border-right: 1px solid var(--border); overflow: hidden; }
.map-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg-surface); flex-shrink: 0;
}
.map-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
#btn-voice-sighting.listening {
  border-color: #ff2222;
  color: #ffaaaa;
  box-shadow: 0 0 14px rgba(255, 34, 34, 0.28);
}
.map-title { font-size: 1rem; font-weight: 600; }
.map-wrapper {
  flex: 1; position: relative; overflow: auto;
  background: radial-gradient(ellipse at center, #111827 0%, #0d1117 100%);
}
.map-theme-basement {
  background: radial-gradient(ellipse at center, #1a0a2e 0%, #0d0718 100%);
  --node-default: #2d1b4e; --node-border: #6b3fa0;
}
.map-theme-basement .map-node { color: #c4a8e8; }
.map-theme-basement .map-node.selected {
  background: #4a1e7a; border-color: #a855f7; color: #e9d5ff;
  box-shadow: 0 0 16px rgba(168,85,247,0.5);
}
.map-theme-basement .map-node.has-sighting { border-color: #f0c040; }
.map-theme-basement .map-edge { stroke: #5b2d8a; }
.map-theme-basement .map-edge-path { stroke: #a855f7; }
.map-theme-jungle {
  background: radial-gradient(ellipse at center, #1a1a0a 0%, #0f120a 100%);
  --node-default: #2a2d18; --node-border: #5a6e2a;
}
.map-theme-jungle .map-node { color: #b8c97a; }
.map-theme-jungle .map-node.selected {
  background: #3a4a1a; border-color: #8aaa30; color: #d4e896;
  box-shadow: 0 0 16px rgba(138,170,48,0.5);
}
.map-theme-jungle .map-node.has-sighting { border-color: #d29922; }
.map-theme-jungle .map-edge { stroke: #4a5a20; }
.map-theme-jungle .map-edge-path { stroke: #8aaa30; }
.map-svg { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 1; }
.map-nodes { position: relative; z-index: 2; }
.map-node {
  position: absolute; transform: translate(-50%, -50%);
  background: var(--node-default, #1f2937); border: 2px solid var(--node-border, #3d4a5c);
  border-radius: var(--radius-md); padding: 6px 10px;
  font-size: 0.78rem; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; transition: all var(--transition);
  user-select: none; z-index: 2; text-align: center; min-width: 64px;
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
.map-node:hover {
  background: var(--bg-hover); border-color: var(--accent-blue); color: var(--text-primary);
  transform: translate(-50%, -50%) scale(1.06); box-shadow: 0 0 12px rgba(88,166,255,0.3); z-index: 10;
}
.map-node.selected {
  background: var(--accent-blue-bg); border-color: var(--accent-blue);
  color: var(--accent-blue); font-weight: 700; box-shadow: 0 0 16px rgba(88,166,255,0.4);
}
.map-node.has-sighting { border-color: #d29922; }
.node-label-text { display: block; }
.node-sighting-dots {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 4px; margin-top: 4px;
}
.node-player-dot-wrapper {
  position: relative; flex-shrink: 0;
}
.node-player-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #000; border: 2px solid;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; line-height: 1;
}
.node-player-dead-icon {
  position: absolute; bottom: -6px; right: -7px;
  font-size: 12px; line-height: 1; pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(255,180,0,0.9)) drop-shadow(0 0 6px rgba(255,120,0,0.7));
}
.node-order-badge {
  position: absolute; top: -8px; left: -8px;
  background: var(--accent-blue); color: #0d1117; border-radius: 50%;
  width: 18px; height: 18px; font-size: 0.7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; z-index: 3;
}
.map-edge { stroke: #3d4a5c; stroke-width: 1.5; opacity: 0.5; }
.map-edge-path {
  stroke: var(--accent-blue); stroke-width: 3; opacity: 0.85;
  stroke-dasharray: 6 3; animation: dash-flow 1s linear infinite;
}
@keyframes dash-flow { to { stroke-dashoffset: -18; } }
.path-summary-box {
  padding: 10px 20px; background: var(--bg-surface); border-top: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 8px; flex-shrink: 0;
}
.path-summary-label { color: var(--text-secondary); font-size: 0.85rem; white-space: nowrap; padding-top: 1px; }
.path-summary-text { color: var(--text-primary); font-size: 0.85rem; line-height: 1.6; flex: 1; }
.game-side-panel {
  width: 300px; flex-shrink: 0; display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg-surface);
}
.side-block { flex: 1; overflow-y: auto; padding: 16px; border-bottom: 1px solid var(--border); }
.side-block h4 {
  font-size: 0.85rem; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px;
}
.hint-text { color: var(--text-muted); font-size: 0.82rem; font-style: italic; }
.sighting-list, .history-list { display: flex; flex-direction: column; gap: 8px; }
.sighting-item {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px;
}
.sighting-room { font-size: 0.82rem; font-weight: 600; color: var(--accent-blue); }
.sighting-nums { font-size: 0.8rem; color: var(--text-secondary); }
.history-item {
  font-size: 0.82rem; color: var(--text-secondary); padding: 6px 8px;
  background: var(--bg-elevated); border-radius: var(--radius-sm); border-left: 2px solid var(--border-light);
}
.history-item strong { color: var(--text-primary); }
.game-actions { padding: 16px; flex-shrink: 0; }
.game-actions .btn { width: 100%; justify-content: center; }

/* ── 阶段三：会议 ── */
.meeting-layout { display: flex; height: 100%; overflow: hidden; }
.players-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.players-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg-surface); flex-shrink: 0;
}
.players-header h3 { font-size: 1rem; font-weight: 600; }
.meeting-actions { display: flex; gap: 8px; }
.player-cards-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.player-cards-grid {
  position: absolute;
  inset: 0;
  padding: 8px 12px;
  display: grid; grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 6px;
  box-sizing: border-box;
}

/* SVG 连线画布层 */
.group-lines-svg {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  overflow: visible;
}

/* 抱团连线样式 */
.group-line {
  stroke-width: 3;
  stroke-linecap: round;
  fill: none;
  pointer-events: stroke;
  cursor: pointer;
  transition: stroke-width 0.2s ease;
}

.group-line:hover {
  stroke-width: 5;
}

.group-line.selected {
  stroke-width: 5;
  filter: drop-shadow(0 0 4px rgba(255,255,255,0.5));
}

/* 拖拽中的预览线 */
.group-line-preview {
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
  stroke-dasharray: 6,4;
  opacity: 0.7;
}

/* 玩家卡片上的连接点小色点 */
.player-color-dot {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
  z-index: 10;
  pointer-events: auto;
  cursor: grab;
}

/* 玩家卡片 — 紧凑版 */
.player-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 7px 10px;
  display: flex; flex-direction: column; gap: 0;
  justify-content: space-between;
  overflow: visible; min-height: 0; position: relative; z-index: 1;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.player-card:focus-within { z-index: 10; }
.player-card:hover { box-shadow: var(--shadow-sm); }

/* 未知阵营 */
.player-card.alive:not([class*='faction-']) { background: #1f2937; border-color: #4a5568; border-left: 4px solid #4a5568; }
.player-card.dead:not([class*='faction-'])  { background: #161b22; border-color: #30363d; border-left: 4px solid #30363d; opacity: 0.55; }

/* 存活 + 阵营 → 深色底+阵营色调+粗左边框 */
.player-card.alive.faction-goose   { background: #163d22; border-left: 4px solid #3fb950; border-color: #2ea043; }
.player-card.alive.faction-duck    { background: #3d1212; border-left: 4px solid #f85149; border-color: #c93c37; }
.player-card.alive.faction-neutral { background: #221040; border-left: 4px solid #a371f7; border-color: #7c4dcc; }

/* 死亡 + 阵营 → 更暗，左边框变灰 */
.player-card.dead.faction-goose   { background: #0a150d; border-left: 4px solid #2a6b35; border-color: #1a3020; opacity: 0.6; }
.player-card.dead.faction-duck    { background: #160808; border-left: 4px solid #8b2e2b; border-color: #3d1210; opacity: 0.6; }
.player-card.dead.faction-neutral { background: #0d0814; border-left: 4px solid #6040a0; border-color: #2a1a45; opacity: 0.6; }

/* 第一行：编号 + 存活 + 可信度 + 阵营按钮 */
.card-header { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex: 0 0 33%; min-height: 0; }
.card-num { font-size: 2.4rem; font-weight: 900; min-width: 44px; color: inherit; line-height: 1; }
.faction-goose  .card-num { color: #56d364; text-shadow: 0 0 12px rgba(63,185,80,0.4); }
.faction-duck   .card-num { color: #ff7b72; text-shadow: 0 0 12px rgba(248,81,73,0.4); }
.faction-neutral .card-num { color: #c9a0ff; text-shadow: 0 0 12px rgba(163,113,247,0.4); }
.alive-btn {
  padding: 5px 14px; border-radius: 14px; border: 1px solid;
  font-size: 1.05rem; font-weight: 700; cursor: pointer;
  transition: all var(--transition); font-family: inherit; line-height: 1.4;
}
.alive-btn.alive { background: #0d2818; border-color: #1f5c30; color: #3fb950; }
.alive-btn.dead  { background: #1f2937; border-color: #4a5568; color: #6e7681; }
.card-role-tag {
  padding: 5px 14px; border-radius: 14px; border: 1px solid;
  font-size: 1.05rem; font-weight: 700; white-space: nowrap; max-width: 110px;
  overflow: hidden; text-overflow: ellipsis; line-height: 1.4;
}
.card-role-tag.goose   { background: #0d2818; border-color: #2ea043; color: #3fb950; }
.card-role-tag.duck    { background: #2d0f0e; border-color: #6b1c1a; color: #f85149; }
.card-role-tag.neutral { background: #1a0d2e; border-color: #4a2a7a; color: #a371f7; }
.trust-btn {
  margin-left: auto; padding: 5px 14px; border-radius: 14px; border: 1px solid;
  font-size: 1.05rem; font-weight: 700; cursor: pointer;
  transition: all var(--transition); font-family: inherit; line-height: 1.4;
}
.trust-unknown        { background: #252b36; border-color: #6e7681; color: #adb5bd; }
.trust-suspicious     { background: #3d2e00; border-color: #d29922; color: #f0c040; }
.trust-trusted        { background: #0d2a4a; border-color: #58a6ff; color: #79c0ff; }
.trust-confirmed_duck { background: #3d1010; border-color: #f85149; color: #ff7b72; }

/* 第二行：阵营 + 角色搜索 横排 */
.card-row2 { display: flex; gap: 5px; align-items: center; flex-shrink: 0; padding-top: 5px; border-top: 1px solid rgba(255,255,255,0.08); }
.faction-btns { display: flex; gap: 4px; flex-shrink: 0; }
.faction-btn {
  padding: 4px 9px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-secondary);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition); font-family: inherit; white-space: nowrap;
}
.faction-btn:hover { border-color: var(--border-light); color: var(--text-secondary); }
.faction-btn.active-goose   { background: #163d22; border-color: #3fb950; color: #56d364; }
.faction-btn.active-duck    { background: #3d1212; border-color: #f85149; color: #ff7b72; }
.faction-btn.active-neutral { background: #221040; border-color: #a371f7; color: #c9a0ff; }

/* 第三行：目击 + 备注 横排 */
.card-row3 { display: flex; gap: 6px; align-items: stretch; flex: 1; min-height: 0; padding-top: 5px; border-top: 1px solid rgba(255,255,255,0.08); }
.card-section-label {
  font-size: 0.72rem; font-weight: 700; color: var(--text-secondary);
  letter-spacing: 0.02em; margin-bottom: 3px;
}
.card-sightings { font-size: 0.88rem; color: var(--text-secondary); flex-shrink: 0; width: 108px; overflow: hidden; border-right: 1px solid rgba(255,255,255,0.08); padding-right: 6px; }
.sighting-entry { display: flex; gap: 4px; align-items: baseline; flex-wrap: wrap; }
.sighting-round { color: #79c0ff; font-weight: 800; font-size: 0.82rem; white-space: nowrap; }
.sighting-entry span:last-child { color: #cdd9e5; font-size: 0.85rem; }
.no-sighting { color: #6e7681; font-size: 0.85rem; font-style: italic; }
.card-notes { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.card-notes textarea {
  flex: 1; width: 100%; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm); color: inherit;
  font-size: 0.88rem; padding: 3px 6px; resize: none; min-height: 0; max-height: 52px;
  font-family: inherit; line-height: 1.4; transition: border-color var(--transition);
}
.card-notes textarea:focus { outline: none; border-color: rgba(255,255,255,0.4); }
.card-notes textarea::placeholder { color: rgba(255,255,255,0.3); }
.role-search-wrapper { position: relative; }
.role-search-input {
  width: 100%; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm); color: inherit;
  font-size: 0.88rem; padding: 4px 8px; font-family: inherit; transition: border-color var(--transition);
}
.role-search-input:focus { outline: none; border-color: rgba(255,255,255,0.4); }
.role-search-input::placeholder { color: rgba(255,255,255,0.3); }
.role-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  z-index: 200; max-height: 180px; overflow-y: auto; display: none;
}
.role-dropdown.open { display: block; }
.role-option {
  padding: 7px 12px; font-size: 0.82rem; cursor: pointer;
  display: flex; align-items: center; gap: 8px; transition: background var(--transition);
}
.role-option:hover { background: var(--bg-hover); }
.role-option-faction {
  font-size: 0.7rem; padding: 1px 6px; border-radius: 10px; font-weight: 600;
}
.role-option-faction.goose   { background: var(--goose-bg);   color: var(--goose-color); }
.role-option-faction.duck    { background: var(--duck-bg);    color: var(--duck-color); }
.role-option-faction.neutral { background: var(--neutral-bg); color: var(--neutral-color); }

/* ── 阵营统计面板 ── */
.stats-panel {
  width: 280px; flex-shrink: 0; background: var(--bg-surface);
  border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden;
}
.stats-panel h3 {
  font-size: 0.95rem; font-weight: 600; padding: 14px 16px;
  border-bottom: 1px solid var(--border); color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0;
}
.faction-stats { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.faction-stat-block { border-radius: var(--radius-md); border: 1px solid var(--border); overflow: hidden; }
.faction-stat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; font-weight: 700; font-size: 0.9rem;
}
.faction-stat-header.goose   { background: var(--goose-bg);   color: var(--goose-color);   border-bottom: 1px solid var(--goose-border); }
.faction-stat-header.duck    { background: var(--duck-bg);    color: var(--duck-color);    border-bottom: 1px solid var(--duck-border); }
.faction-stat-header.neutral { background: var(--neutral-bg); color: var(--neutral-color); border-bottom: 1px solid var(--neutral-border); }
.faction-stat-count { font-size: 1.1rem; font-weight: 800; }
.faction-stat-body { padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--bg-base); }
.stat-row { display: flex; flex-direction: column; gap: 3px; }
.stat-row-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.stat-tag { font-size: 0.95rem; padding: 4px 12px; border-radius: 12px; font-weight: 700; border: 1px solid; }
.stat-tag.open    { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-light); }
.stat-tag.jumped  { background: #3a2a00; color: #f0b429; border-color: #8a6200; }
.stat-tag.unknown-slot { background: var(--bg-elevated); color: var(--text-muted); border: 1px dashed var(--border); font-style: italic; }
/* 已有玩家认领 → 亮绿高亮 */
.stat-tag.claimed { background: #0d3a1a; color: #4ae860; border-color: #2ea043; font-weight: 800; }
/* 暂无玩家认领 → 暗色低对比 */
.stat-tag.unclaimed { background: #1a1f27; color: #6e7681; border-color: #30363d; }
.stat-empty { font-size: 0.78rem; color: var(--text-muted); font-style: italic; }
/* 死亡角色 tag */
.stat-tag.dead-role { background: #2a0a0a; color: #ff4444; border-color: #7a1a1a; text-decoration: line-through; opacity: 0.85; }
.stat-tag.dead-role .dead-cross { margin-right: 4px; font-weight: 900; color: #ff2222; font-style: normal; }
/* 明牌已满时超额跳出 tag */
.stat-tag.overflowed-role { background: #2a1a00; color: #f0b429; border-color: #8a5a00; border-style: dashed; }
.stat-tag.overflowed-role .overflow-warn { margin-right: 4px; font-weight: 900; font-style: normal; }
/* stat-tag-wrap 用于定位角标 */
.stat-tag-wrap { position: relative; display: inline-flex; }
/* 重复认领数字角标 */
.stat-tag-badge {
  position: absolute; top: -6px; right: -6px;
  background: #e53e3e; color: #fff;
  font-size: 0.65rem; font-weight: 900;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #1a1f27; line-height: 1;
}
/* 玩家卡片阵营总数超限（最高警告）*/
.player-card.faction-exceeded-card {
  outline: 2px solid #ff2222;
  box-shadow: 0 0 12px 4px rgba(255,34,34,0.7), 0 0 24px 8px rgba(255,34,34,0.35);
  animation: exceeded-glow 1s ease-in-out infinite alternate;
}
@keyframes exceeded-glow {
  from { box-shadow: 0 0 10px 3px rgba(255,34,34,0.6), 0 0 20px 6px rgba(255,34,34,0.25); }
  to   { box-shadow: 0 0 18px 7px rgba(255,34,34,0.9), 0 0 36px 14px rgba(255,34,34,0.45); }
}

/* 玩家卡片重复角色发光轮廓 */
.player-card.duplicate-role {
  outline: 2px solid #e53e3e;
  box-shadow: 0 0 10px 3px rgba(229, 62, 62, 0.55), 0 0 20px 6px rgba(229, 62, 62, 0.25);
  animation: duplicate-glow 1.5s ease-in-out infinite alternate;
}
@keyframes duplicate-glow {
  from { box-shadow: 0 0 8px 2px rgba(229,62,62,0.5), 0 0 16px 4px rgba(229,62,62,0.2); }
  to   { box-shadow: 0 0 14px 5px rgba(229,62,62,0.8), 0 0 28px 10px rgba(229,62,62,0.35); }
}

/* ── 弹窗 ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 200;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius-xl); padding: 28px 32px; min-width: 360px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 16px;
}
.modal-box h3 { font-size: 1.1rem; font-weight: 700; }
.modal-box p  { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── 目击输入浮层 ── */
.sighting-popover {
  position: fixed; z-index: 150;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 14px 16px;
  box-shadow: var(--shadow-lg); min-width: 220px;
  display: flex; flex-direction: column; gap: 8px;
}
.popover-header { display: flex; align-items: center; justify-content: space-between; }
.popover-header span { font-weight: 700; font-size: 0.9rem; color: var(--accent-blue); }
.popover-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 0.9rem; padding: 2px 4px; border-radius: var(--radius-sm);
  transition: color var(--transition); font-family: inherit;
}
.popover-close:hover { color: var(--text-primary); }
.popover-label { font-size: 0.78rem; color: var(--text-secondary); }
.popover-input {
  background: var(--bg-base); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 0.85rem; padding: 6px 8px; font-family: inherit; width: 100%;
}
.popover-input:focus { outline: none; border-color: var(--accent-blue); }

/* ── 滚动条美化 ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── 署名水印 ── */
#watermark {
  position: fixed; bottom: 10px; right: 14px;
  font-size: 0.72rem; color: rgba(139,148,158,0.45);
  pointer-events: none; user-select: none;
  letter-spacing: 0.04em; z-index: 9999;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ── AI 设置按钮 ── */
#btn-ai-settings {
  font-size: 0.78rem; padding: 4px 10px;
}

/* ── 会议页 AI 分析按钮 ── */
.btn-ai {
  background: linear-gradient(135deg, #4a1fa8 0%, #7c3aed 100%);
  color: #fff; border: 1px solid #6d28d9;
  font-weight: 600; letter-spacing: 0.02em;
  transition: opacity var(--transition), box-shadow var(--transition);
}
.btn-ai:hover { opacity: 0.88; box-shadow: 0 0 12px rgba(124,58,237,0.5); }
.btn-ai:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── AI 设置模态框内容 ── */
.ai-settings-desc {
  font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.6;
}
.ai-settings-desc strong { color: var(--accent-blue); }
.ai-settings-field {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.ai-settings-field label {
  font-size: 0.82rem; color: var(--text-secondary); white-space: nowrap; min-width: 54px;
}
.ai-settings-field input[type="password"],
.ai-settings-field input[type="text"] {
  flex: 1; background: var(--bg-base); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 0.85rem; padding: 6px 10px; font-family: inherit;
}
.ai-settings-field input:focus { outline: none; border-color: #7c3aed; }
.ai-model-display {
  font-size: 0.85rem; color: var(--text-primary); background: var(--bg-base);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 10px; flex: 1;
}
.ai-model-note { color: var(--text-muted); font-size: 0.78rem; }

/* ── AI 结果面板（右侧栏内） ── */
.ai-result-panel {
  margin-top: 18px;
  background: linear-gradient(160deg, #1a1030 0%, #12101e 100%);
  border: 1px solid #4a2a7a;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 0 20px rgba(124,58,237,0.15);
  display: flex;
  flex-direction: column;
}

/* 弹出模式样式 */
.ai-result-panel.popout {
  position: fixed;
  top: 100px;
  left: 100px;
  width: 480px;
  max-height: 80vh;
  z-index: 300;
  margin-top: 0;
  resize: both;
  overflow: auto;
}

.ai-result-panel.dragging {
  opacity: 0.9;
  box-shadow: 0 8px 32px rgba(124,58,237,0.4);
}

.ai-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(124,58,237,0.18);
  border-bottom: 1px solid #4a2a7a;
  cursor: default;
}

.ai-result-panel.popout .ai-result-header {
  cursor: move;
}

.ai-result-title {
  font-weight: 700; font-size: 0.88rem;
  color: #c4b5fd; letter-spacing: 0.03em;
}

.ai-result-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ai-result-popout,
.ai-result-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 0.85rem; padding: 2px 6px;
  border-radius: var(--radius-sm); transition: color var(--transition);
  font-family: inherit;
}

.ai-result-popout:hover,
.ai-result-close:hover { color: var(--text-primary); }

.ai-result-popout {
  font-size: 0.9rem;
}

/* 阵营统计置顶区域 */
.ai-faction-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(74,42,122,0.3);
}

.ai-alive-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
}

.ai-alive-count span {
  color: #c4b5fd;
  font-weight: 700;
}

.ai-faction-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.ai-faction-item {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  background: rgba(124,58,237,0.08);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(74,42,122,0.3);
}

.ai-faction-item.unknown {
  background: rgba(100,100,100,0.1);
  border-color: rgba(100,100,100,0.3);
}

.ai-faction-icon {
  font-size: 0.85rem;
}

.ai-faction-name {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.ai-faction-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: #c4b5fd;
  min-width: 14px;
  text-align: center;
}

.ai-faction-item.unknown .ai-faction-count {
  color: var(--text-muted);
}

.ai-result-body {
  padding: 14px 14px 10px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.83rem; line-height: 1.75; color: var(--text-primary);
}

.ai-result-panel.popout .ai-result-body {
  max-height: none;
  flex: 1;
}

.ai-result-footer {
  padding: 8px 14px;
  font-size: 0.72rem; color: var(--text-muted);
  border-top: 1px solid rgba(74,42,122,0.4);
  text-align: center; letter-spacing: 0.02em;
}

/* ── AI 加载状态 ── */
.ai-loading {
  display: flex; align-items: center; gap: 10px;
  color: #c4b5fd; font-size: 0.85rem; padding: 8px 0;
}
.ai-spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(196,181,253,0.25);
  border-top-color: #c4b5fd;
  border-radius: 50%;
  animation: ai-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

/* ── AI 流式文本 & 光标 ── */
.ai-stream-text { white-space: pre-wrap; word-break: break-word; }
.ai-cursor {
  display: inline-block;
  color: #c4b5fd;
  animation: ai-blink 0.8s step-end infinite;
  margin-left: 1px;
}
@keyframes ai-blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ── AI section 颜色标签 ── */
.ai-section-tag {
  font-weight: 700; font-size: 0.83rem;
  border-radius: 3px; padding: 0 2px;
}
.ai-section-contradiction { color: #f87171; }
.ai-section-suspect       { color: #fbbf24; }
.ai-section-trust         { color: #34d399; }
.ai-section-faction       { color: #60a5fa; }
.ai-section-suggest       { color: #c4b5fd; }
.ai-section-default       { color: var(--text-secondary); }

/* ── AI 错误信息 ── */
.ai-error-msg {
  color: var(--text-secondary); font-size: 0.83rem; line-height: 1.7;
  padding: 4px 0;
}
