/* === EVIDENCE BOARD — manual case graph (tray → nodes → hand-drawn edges) === */

#scene-evidence-board {
  padding: 14px;
  align-items: stretch;
}

.evidence-board-container {
  width: 100%;
  max-width: 100%;
  height: calc(100vh - 84px);
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(200px, 270px) minmax(0, 1fr);
  column-gap: 12px;
  overflow: hidden;
}

.panel-kicker {
  color: #79a6b8;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ---------- Left: clue tray ---------- */
.evidence-tray,
.evidence-workspace {
  min-height: 0;
  background: rgba(26, 26, 26, 0.92);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.evidence-tray {
  padding: 16px;
}

.tray-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.tray-heading h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--text-primary);
}

.tray-heading span {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.tray-search {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.tray-search:focus {
  outline: none;
  border-color: var(--accent-gold-dim);
}

.tray-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.tray-clue {
  --tone: var(--accent-gold);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--tone);
  padding: 9px 10px;
  cursor: grab;
  color: var(--text-primary);
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  gap: 2px;
  user-select: none;
  touch-action: none;
  transition: border-color 0.15s, transform 0.15s;
}

.tray-clue:hover {
  border-color: var(--tone);
  transform: translateX(2px);
}

.tray-clue:active { cursor: grabbing; }

.tray-clue-id {
  color: var(--tone);
  font-size: 0.72rem;
  letter-spacing: 1px;
}

.tray-clue-title {
  font-size: 0.88rem;
  line-height: 1.35;
}

.tray-clue-location {
  color: var(--text-secondary);
  font-size: 0.74rem;
}

.empty-tray {
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 14px 4px;
  border: 1px dashed var(--border);
  text-align: center;
}

.tray-hint {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.5;
}

/* ---------- Right: workspace ---------- */
.evidence-workspace {
  padding: 14px 16px 16px;
}

.evidence-board-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.evidence-board-header h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--text-primary);
}

.board-meters {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
}

.deduction-counter {
  color: var(--accent-gold);
  font-size: 0.85rem;
  white-space: nowrap;
}

.board-hint {
  color: var(--text-secondary);
  font-size: 0.74rem;
  text-align: right;
  max-width: 460px;
}

/* ---------- Canvas ---------- */
.evidence-map {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  overflow: hidden;
  background:
    linear-gradient(rgba(200, 169, 110, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200, 169, 110, 0.045) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 40%, rgba(38, 34, 26, 0.9), rgba(16, 15, 12, 0.96));
  background-size: 44px 44px, 44px 44px, cover;
}

.graph-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
  touch-action: none;
  user-select: none;
}

.graph-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
  pointer-events: none;
  text-align: center;
  padding: 0 40px;
}

.graph-empty.hidden { display: none; }

/* ---------- Nodes (d3-force 圆形节点，恢复自 watson-evidence-board) ---------- */
.graph-node {
  --tone: var(--accent-gold);
  cursor: grab;
}

.graph-node:active { cursor: grabbing; }

.graph-node:focus { outline: none; }

.graph-node circle.node-body {
  fill: #15140f;
  stroke: var(--tone, #c8a96e);
  stroke-width: 2.5;
  transition: stroke 0.16s ease, filter 0.16s ease;
}

.graph-node:hover circle.node-body {
  stroke: var(--accent-gold);
  filter: drop-shadow(0 0 7px rgba(200, 169, 110, 0.6));
}

.graph-node:focus circle.node-body {
  stroke: #f1cf81;
  stroke-width: 4;
  filter: drop-shadow(0 0 8px rgba(241, 207, 129, 0.72));
}

.graph-node.link-target circle.node-body {
  stroke: #f1cf81;
  stroke-width: 4;
  filter: drop-shadow(0 0 10px rgba(241, 207, 129, 0.85));
}

.graph-node-id {
  fill: var(--tone, #c8a96e);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.78rem;
  pointer-events: none;
}

.graph-node-label {
  fill: rgba(232, 224, 208, 0.85);
  font-size: 0.68rem;
  pointer-events: none;
}

/* 连接点：悬停节点时出现在圆周四个方位 */
.node-anchor {
  fill: var(--accent-gold);
  stroke: #14120d;
  stroke-width: 2;
  opacity: 0;
  transition: opacity 0.12s;
  cursor: crosshair;
}

.graph-node:hover .node-anchor,
body.is-linking .node-anchor {
  opacity: 1;
}

.node-anchor:hover { r: 7.5; }

/* 移除按钮：悬停节点时出现在右上 */
.node-remove {
  opacity: 0;
  transition: opacity 0.15s;
  cursor: pointer;
}

.graph-node:hover .node-remove { opacity: 1; }

.node-remove circle {
  fill: #14120d;
  stroke: var(--border);
  stroke-width: 1;
  transition: stroke 0.15s;
}

.node-remove text {
  fill: var(--text-secondary);
  font-size: 0.8rem;
  pointer-events: none;
  transition: fill 0.15s;
}

.node-remove:hover circle { stroke: var(--danger); }
.node-remove:hover text { fill: var(--danger); }

/* ---------- Edges（直线 + 弹性跟随） ---------- */
.graph-edge { cursor: pointer; }

.graph-edge:focus { outline: none; }

.graph-edge-hit {
  stroke: transparent;
  stroke-width: 16;
  pointer-events: stroke;
}

.graph-edge-line {
  stroke: rgba(200, 169, 110, 0.5);
  stroke-width: 2;
  transition: stroke 0.16s ease, stroke-width 0.16s ease;
}

.graph-edge:hover .graph-edge-line,
.graph-edge:focus .graph-edge-line {
  stroke: var(--accent-gold);
  stroke-width: 3;
}

.edge-note-dot {
  fill: var(--accent-gold);
  stroke: #14120d;
  stroke-width: 1.5;
  pointer-events: none;
}

.temp-edge {
  fill: none;
  stroke: var(--accent-gold);
  stroke-width: 2;
  stroke-dasharray: 6 5;
  opacity: 0.9;
  pointer-events: none;
}

.temp-edge.hidden { display: none; }

/* ---------- Edge tooltip & menu ---------- */
.edge-tooltip {
  position: absolute;
  z-index: 20;
  max-width: 280px;
  background: rgba(20, 18, 13, 0.96);
  border: 1px solid var(--accent-gold-dim);
  color: var(--text-primary);
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 7px 10px;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.edge-tooltip.hidden { display: none; }

.edge-menu {
  position: absolute;
  z-index: 21;
  width: 260px;
  background: #17150f;
  border: 1px solid var(--accent-gold-dim);
  padding: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.edge-menu.hidden { display: none; }

.edge-menu textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.84rem;
  line-height: 1.5;
  padding: 8px;
  resize: vertical;
  margin-bottom: 8px;
}

.edge-menu textarea:focus {
  outline: none;
  border-color: var(--accent-gold-dim);
}

.edge-menu-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

/* ---------- Drag ghost (tray → canvas) ---------- */
.drag-ghost {
  position: fixed;
  z-index: 9000;
  pointer-events: none;
  background: #211f19;
  border: 1px solid var(--accent-gold);
  color: var(--text-primary);
  font-size: 0.8rem;
  padding: 6px 10px;
  max-width: 220px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.6);
  opacity: 0.92;
}

/* ---------- Tones (canon lanes) ---------- */
.tone-scene        { --tone: #c8a96e; }
.tone-witness      { --tone: #7fa06f; }
.tone-knowledge    { --tone: #8fb6ce; }
.tone-weapon       { --tone: #d0b16b; }
.tone-document     { --tone: #b89bd4; }
.tone-alibi        { --tone: #4799ca; }
.tone-motive       { --tone: #c78268; }
.tone-misdirection { --tone: #d1a24f; }

/* ---------- Toast (shared with interviews / rooms / accusation) ---------- */
.deduction-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--accent-gold);
  padding: 16px 24px;
  font-size: 0.95rem;
  color: var(--accent-gold);
  z-index: 7000;
  max-width: 520px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.24s ease;
}

.deduction-toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 760px) {
  .evidence-board-container {
    grid-template-columns: 1fr;
    grid-template-rows: 200px minmax(0, 1fr);
    row-gap: 12px;
  }
}
