:root {
  --bg-primary: #0e141b;
  --bg-secondary: #111827;
  --bg-card: #1f2937;
  --bg-card-hover: #374151;
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --color-accusation: #991b1b;
  --color-evidence: #d97706;
  --color-defense: #065f46;
  --edge-opacity: 0.35;
  --transition-fast: 120ms ease;
  --transition-normal: 180ms ease;
}

.map-body {
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

.map-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px clamp(20px, 5vw, 60px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(15, 20, 27, 0.9);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.map-topbar h1 {
  font-family: "Fraunces", serif;
  font-size: 1.8rem;
}

.map-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.canvas-wrap {
  position: relative;
  height: calc(100vh - 96px);
  overflow: hidden;
}

.case-panel {
  position: absolute;
  top: 24px;
  left: 24px;
  width: min(360px, 90vw);
  background: linear-gradient(135deg, rgba(139, 30, 30, 0.85) 0%, rgba(80, 15, 15, 0.9) 50%, rgba(17, 24, 39, 0.95) 100%);
  border: 1px solid rgba(200, 60, 60, 0.2);
  border-radius: 18px;
  padding: 16px;
  z-index: 5;
  box-shadow: 0 24px 60px rgba(100, 10, 10, 0.4), inset 0 1px 0 rgba(255, 100, 100, 0.08);
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.case-panel.collapsed {
  transform: translateX(-110%);
  opacity: 0;
  pointer-events: none;
}

.panel-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-size: 1.3rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.panel-close-btn:hover {
  background: rgba(255, 80, 80, 0.3);
}

.panel-reopen-btn {
  display: none;
  position: fixed;
  top: 110px;
  left: 24px;
  z-index: 6;
  background: linear-gradient(135deg, rgba(139, 30, 30, 0.9), rgba(80, 15, 15, 0.95));
  border: 1px solid rgba(200, 60, 60, 0.25);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(100, 10, 10, 0.3);
  transition: var(--transition-fast);
}

.panel-reopen-btn:hover {
  background: linear-gradient(135deg, rgba(160, 35, 35, 0.95), rgba(100, 20, 20, 0.98));
}


.panel-summary {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-summary p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.panel-label {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.65rem;
  color: rgba(255, 180, 180, 0.7);
}

.panel-grid {
  display: grid;
  gap: 10px;
}

.panel-grid span {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: rgba(255, 180, 180, 0.6);
}

.panel-grid p {
  margin-top: 4px;
  color: var(--text-secondary);
}

.mono {
  font-family: "Space Grotesk", monospace;
  color: var(--text-muted);
}

.network.full {
  height: 100%;
  background-color: var(--bg-primary);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
}

.modal-card {
  background: rgba(17, 24, 39, 0.94);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px;
  min-width: min(90vw, 560px);
  color: var(--text-primary);
  backdrop-filter: blur(12px);
}

.case-detail-grid {
  display: grid;
  gap: 12px;
}

.case-detail-grid span {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
}

.person-modal-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.avatar.lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  object-fit: cover;
}

.tag {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(153, 27, 27, 0.25);
  color: #fca5a5;
  font-size: 0.75rem;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 10px 0 14px;
}

.tab {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab.active {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.3);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel ul {
  display: grid;
  gap: 8px;
  list-style: none;
}

.link-list button {
  background: transparent;
  border: none;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.link-list button:hover {
  color: #93c5fd;
}

.person-modal-wide {
  min-width: min(90vw, 640px);
  max-height: 80vh;
  overflow-y: auto;
}

.person-summary {
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.person-summary h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.1em;
}

.person-summary p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.header-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#person-edit-form label {
  display: grid;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

#person-edit-form input,
#person-edit-form select,
#person-edit-form textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.edit-form-buttons {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.actions-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.person-actions-list {
  display: grid;
  gap: 12px;
}

.action-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
}

.action-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.action-card-header h5 {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.action-sentence {
  font-size: 0.8rem;
  color: #fca5a5;
  margin-bottom: 10px;
  font-style: italic;
}

.action-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.action-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 4px;
}

.action-section p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

.ghost-modal-card {
  max-width: 340px;
}

.ghost-modal-body {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
}

.ghost-avatar {
  opacity: 0.5;
  border: 2px dashed var(--text-secondary);
  border-radius: 50%;
}

.ghost-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ghost-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ghost-role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid;
}

.role-unknown { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.4); color: #fbbf24; }
.role-defendant { background: rgba(209, 213, 219, 0.1); border-color: rgba(209, 213, 219, 0.4); color: #d1d5db; }
.role-informant { background: rgba(234, 179, 8, 0.1); border-color: rgba(234, 179, 8, 0.4); color: #eab308; }
.role-witness { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.4); color: #3b82f6; }
.role-secretWitness { background: rgba(229, 231, 235, 0.1); border-color: rgba(229, 231, 235, 0.4); color: #e5e7eb; }
.role-victim { background: rgba(168, 85, 247, 0.1); border-color: rgba(168, 85, 247, 0.4); color: #a855f7; }
.role-fugitive { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.4); color: #ef4444; }
.role-detained { background: rgba(156, 163, 175, 0.1); border-color: rgba(156, 163, 175, 0.4); color: #9ca3af; }

.ghost-note {
  font-size: 0.78rem;
  margin-top: 4px;
  font-style: italic;
}

@media (max-width: 900px) {
  .case-panel {
    position: static;
    width: 100%;
    margin: 12px 0;
  }

  .canvas-wrap {
    height: auto;
    min-height: 70vh;
  }
}
