/* full-screen canvas */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

#cy {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}

/* Control Panel - Simple and Clean */
#controls {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 160px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* Primary control group gets subtle emphasis */
.control-group.primary {
  border-color: #4a90e2;
  box-shadow: 0 1px 3px rgba(74, 144, 226, 0.1);
}

/* Simple Button Styles */
#controls button {
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: white;
  color: #333;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

#controls button:hover {
  background: #f5f5f5;
}

/* Subtle visual cues for button types */
.btn-primary {
  border-color: #999;
  font-weight: 500;
}

/* Primary action button - most commonly used */
#btnAddStatement {
  background: #f8f9ff !important;
  border-color: #4a90e2 !important;
  font-weight: 500;
  color: #2c5aa0;
}

#btnAddStatement:hover {
  background: #eef4ff !important;
  border-color: #357abd !important;
}

.btn-danger {
  color: #d32f2f;
}

/* File operation buttons */
.btn-file {
  background: #f8f9fa !important;
  border-color: #6c757d !important;
  color: #495057;
  font-weight: 500;
}

.btn-file:hover {
  background: #e9ecef !important;
  border-color: #5a6268 !important;
}

.btn-file-secondary {
  background: #ffffff !important;
  border-color: #6c757d !important;
  color: #6c757d;
}

.btn-file-secondary:hover {
  background: #f8f9fa !important;
  color: #495057;
}

/* View control buttons */
.btn-view {
  background: #ffffff !important;
  border-color: #ccc !important;
  color: #333;
}

.btn-view:hover {
  background: #f5f5f5 !important;
}

/* Help and documentation buttons */
.btn-help {
  background: #ffffff !important;
  border-color: #ccc !important;
  color: #333;
}

.btn-help:hover {
  background: #f5f5f5 !important;
}

/* Selection Styles */
.selection-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #1976d2;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  z-index: 10;
  pointer-events: none;
}

.multi-select-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

.multi-select-controls.active {
  display: flex;
}

.multi-select-controls button {
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: white;
  color: #333;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.multi-select-controls button:hover {
  background: #f5f5f5;
}

.multi-select-controls .selection-count {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
  text-align: center;
}

/* custom right-click menu */
#menu {
  position: absolute;
  display: none;
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 10;
}

#menu ul {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

#menu ul li {
  padding: 6px 12px;
  cursor: pointer;
}

#menu ul li:hover {
  background-color: #f0f0f0;
}

/* Enhanced Modal Styling */
.modifier-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  color: #2c3e50;
  padding: 24px 28px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 100000;
  min-width: 280px;
  text-align: center;
  opacity: 1;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.modifier-modal-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 16px;
  color: #2c3e50;
  cursor: move;
}

.modifier-modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  gap: 5px;
}

.modifier-modal input,
.modifier-modal select {
  background: #ffffff;
  color: #2c3e50;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 8px 12px;
  box-sizing: border-box;
  outline: none;
  font-size: 16px;
  transition: border-color 0.2s ease;
}

.modifier-modal input:focus,
.modifier-modal select:focus {
  border-color: #4a90e2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.modifier-modal button {
  background: #f8f9fa;
  color: #495057;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  padding: 8px 20px;
  margin: 8px 6px 0 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.modifier-modal button:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  transform: translateY(-1px);
}

.modifier-modal .danger {
  color: #f55;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1em;
}
.node-hover-box, .modifier-box {
  pointer-events: none;
}
.rationale-modal {
  z-index: 10001 !important;
}
.rationale-modal textarea {
  resize: vertical;
  font-family: inherit;
}

#contributing-factors-modal {
  z-index: 10001 !important;
}
#contributing-factors-modal textarea {
  resize: vertical;
  font-family: inherit;
}

#edit-label-modal {
  position: fixed;
  left: 0;
  top: 0;
  background: #fff;
  color: #111;
  padding: 24px 24px 18px 24px;
  border: 2px solid #1976d2;
  border-radius: 8px;
  box-shadow: 0 6px 30px #1976d255;
  min-width: 350px;
  z-index: 10001;
}

#edit-label-modal input,
#edit-label-modal textarea {
  border: 1px solid #bbb;
  border-radius: 4px;
  padding: 4px 8px;
  box-sizing: border-box;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  width: 100%;
}

#edit-label-modal button {
  background: #f4f4f4;
  color: #222;
  border: 1px solid #888;
  border-radius: 4px;
  padding: 4px 16px;
  margin: 0 5px;
  cursor: pointer;
  transition: background 0.15s;
}
#edit-label-modal button:hover {
  background: #e0e0e0;
}

/* Enhanced Visual Signals Modal */
#visual-signals-modal {
  position: fixed;
  background: #ffffff;
  padding: 28px 32px 24px 32px;
  border: none;
  border-radius: 16px;
  z-index: 10001;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1);
  min-width: 420px;
  max-width: 480px;
}

#visual-signals-modal .modal-title {
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 20px;
  cursor: move;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #2c3e50;
  border-bottom: 2px solid #f1f3f4;
  padding-bottom: 12px;
}

/* ---- FIX: match checkbox label size, darken top text, tooltip alignment ---- */
#bayes-modal .step-sub {
  font-size: 15px;       /* same as label */
  font-weight: 500;      /* same emphasis as label */
  color: #1a1a1a;        /* keep your darker text color */
  margin-bottom: 8px;
  line-height: 1.4;
}

/* Resize and align checkbox to match text */
#bayes-modal input[type="checkbox"] {
  width: 15px;           /* proportional to 15px text */
  height: 15px;
  margin-right: 6px;
  vertical-align: middle; /* centers with text baseline */
  cursor: pointer;
  accent-color: #4a90e2;
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: middle;
}

/* Persistent modal header with context */
#bayes-modal .modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  margin-bottom: 6px;
  font-weight: 600;
  color: #1f2d3d;
  opacity: 0.9;
  cursor: move;
  user-select: none;
}

#bayes-modal.modal {
  position: fixed;
  top: 8vh;
  left: 50%;
  transform: translateX(-50%);
  min-width: 440px;
  max-width: 95vw;
  max-height: 88vh;
  background: #ffffff;
  color: #2c3e50;
  padding: 16px 24px 14px 24px;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 1002;
  opacity: 1;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Modal title spacing (aligned with header style) */
#bayes-modal .modal-title {
  height: 24px;
  margin-bottom: 6px;
}

/* rest of your CSS unchanged ... */


/* Compact step styling for better vertical space usage */
#bayes-modal .step {
  margin-bottom: 14px;  /* Reduced from 20px */
  padding-bottom: 10px;  /* Reduced from 16px */
  border-bottom: 1px solid #f1f3f4;
}

#bayes-modal .step:last-child {
  border-bottom: none;
  margin-bottom: 6px;
}

#bayes-modal .step-title {
  font-size: 16px;
  font-weight: 600;
  color: #25364a;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#bayes-modal .step.current .step-title { color: #1a3e7a; }
#bayes-modal .step.collapsed .step-title { color: #7b8a97; font-weight: 600; opacity: 0.85; }

/* Baseline step styling with reduced spacing */
#bayes-modal #step-baseline .step-title {
  padding: 4px 0;
  border-bottom: 2px solid #eef1f4;
  margin-bottom: 8px;
}

#bayes-modal .step-sub {
  font-size: 15px;
  color: #3a4a5a;
  margin-bottom: 10px;
  line-height: 1.55;
}
#bayes-modal .step.collapsed .step-sub { display: none; }

#bayes-modal .slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 4px 0; /* add breathing room so thumb isn't clipped */
}

#bayes-modal .region-label,
#bayes-modal .ratio-label {
  font-size: 13px;
  color: #6c757d;
  margin-bottom: 4px;  /* Reduced from 6px */
}

#bayes-modal .ratio-label {
  font-weight: 500;
  color: #495057;
}

#bayes-modal .warning {
  color: #dc3545;
  font-size: 13px;
  margin-bottom: 6px;  /* Reduced from 8px */
  min-height: 16px;    /* Reduced from 18px */
  font-weight: 500;
}

#bayes-modal .actions {
  margin-top: 8px;  /* Reduced from 12px */
}

#bayes-modal .actions button {
  background: #4a90e2;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;  /* Slightly reduced padding */
  margin-right: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

#bayes-modal .actions button:hover {
  background: #357abd;
  transform: translateY(-1px);
}

/* Current step callout on slider region for focus */
#bayes-modal .step.current .slider-row { outline: 2px solid #e6f0ff; border-radius: 10px; }

/* Ensure modal interior padding doesn’t look like background to avoid accidental close */
#bayes-modal { background-clip: padding-box; }

#bayes-modal .locked {
  background: #f7f9fb;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #e6ebf0;
  font-size: 15px;
}

/* Summary section with reduced spacing */
#bayes-modal .summary {
  background: #f8f9fa;
  padding: 12px 16px;  /* Reduced from 16px 20px */
  border-radius: 12px;
  border: 1px solid #e9ecef;
  line-height: 1.5;    /* Reduced from 1.6 */
  font-size: 16px;
  margin-top: 6px;     /* Reduced from 8px */
}

#bayes-modal .summary b {
  color: #2c3e50;
}

/* Enhanced checkbox styling */
#bayes-modal input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  cursor: pointer;
  accent-color: #4a90e2;
}

/* Enhanced slider styling with reduced margins */
#bayes-modal input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px; /* was 6px */
  border-radius: 4px;
  background: #e9ecef;
  outline: none;
  margin: 8px 0;
}

#bayes-modal input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #4a90e2;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#bayes-modal input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #4a90e2;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Modal header styling */
#bayes-modal .modal-header {
  font-size: 17px;
  font-weight: 600;
  color: #333;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
  cursor: move;
}
/* .hidden class for modal visibility control */
.hidden {
  display: none !important;
}
.edge-tooltip {
  position: fixed;
  z-index: 100000;
  background: #fff !important;
  color: #111 !important;
  border-radius: 7px;
  box-shadow: 0 2px 12px #0007 !important;
  padding: 12px 16px;
  pointer-events: none;
  font-size: 15px;
  opacity: 0.98;
  min-width: 190px;
  transition: opacity 0.15s;
}
.edge-tooltip .lr-value {
  color: #1976d2 !important;  /* or use another highlight color */
  font-weight: bold;
  font-size: 1.13em;
}
.custom-tooltip {
  display: none;
  position: absolute;
  z-index: 10000;
  background: #222;
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.97em;
  max-width: 340px;
  white-space: normal;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  line-height: 1.4;
}
.false-highlight {
  font-weight: bold;
  font-style: italic;
  color: red;
}


