/* Layout skeleton */
*,
*::before,
*::after {
  box-sizing: border-box;
}


[hidden] {
  display: none !important
}


html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  /* Use min-height for embedding compatibility */
  width: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
  /* Allow vertical scroll when embedded */
}


body {
  background: radial-gradient(circle at top, #b5bbc8, #eaebf1);
  color: #e5e7eb;
}



/* Mode Selection Screen */
#modeSelection {
  min-height: 100vh;
  /* Use viewport height for both standalone and embedded */
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  /* Internal scroll if parent too small */
}


#modeSelectionContainer {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  padding: 40px;
  text-align: center;
  max-width: 600px;
  width: 100%;
}


#modeSelectionContainer h1 {
  margin: 0 0 10px 0;
  color: #000000;
  font-size: 2rem;
  font-weight: 600;
}


#modeSelectionContainer p {
  margin: 0 0 30px 0;
  color: #555555;
  font-size: 1.1rem;
}


#modeButtons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}


.modeBtn {
  background: #2980b9;
  /* Sober Blue */
  color: white;
  border: none;
  border-radius: 6px;
  padding: 15px 25px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}


.modeBtn:hover {
  background: #3498db;
  transform: translateY(-2px);
}


.modeBtn:active {
  transform: translateY(-2px);
}


.modeIcon {
  font-size: 3rem;
}


.modeTitle {
  font-size: 1.2rem;
  font-weight: 600;
}


.modeDesc {
  font-size: 0.85rem;
  opacity: 0.9;
}



#mainContainer {
  min-height: 100vh;
  /* Flexible height for embedding */
  width: 100%;
  display: none;
  /* JS toggles this to flex */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: transparent;
  overflow-x: hidden;
  
}


#container {
  width: 100%;
  max-width: 1400px;
  flex: 1;
  /* Grow to fill available space */
  min-height: 0;
  /* Allow flexbox shrinking */
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  /* Internal scroll for content */
  
}


#mainPane {
  display: flex;
  flex-direction: column;
  gap: 16px;
}


/* Virtual Labs Header */
#vl-header {
  background: #fff;
  border-bottom: 4px solid #d35400;
  /* Sober Orange */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  box-shadow: none;
}


.vl-title {
  font-size: 1.5rem;
  font-weight: 500;
  color: #2980b9;
  /* Sober Matte Blue */
  text-align: center;
  flex: 1;
}


.vl-btn {
  background: #2980b9;
  /* Sober Matte Blue */
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
}


.vl-btn:hover {
  background: #3498db;
  /* Slightly lighter blue on hover */
}



#backToModeSelection {
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 500;
  transition: background 0.2s;
  position: absolute;
  top:5px;
  left:5px;
}


#backToModeSelection:hover {
  background: #5568d3;
}





/* ================= Visual Section ================= */


#visualSection {
  display: flex;
  gap: 12px;
  height: calc(100vh - 200px);
  /* Dynamic height accounting for navbar/padding */
  min-height: 700px;
  /* Minimum usable height */
  max-height: 900px;
  /* Maximum height to prevent overflow */
  padding: 4px;


  
}


#leftPanel {
  display: flex;
  gap: 12px;
  flex: 1;
  min-width: 0;
}


/* ---------- Left Controls ---------- */


#visControls {
  width: 380px;
  /* Slightly wider for table/analysis */
  background: #ffffff;
  border: 1px solid black;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.78rem;
  overflow-y: auto;
  /* Allow scrolling if controls get long */
}


/* Analysis Section */
#analysisSection {
  border-top: 1px solid #e5e7eb;
  padding-top: 24px;
  margin-top: 12px;
}


#distanceSection, #distanceSectionVis {
  margin-top: 10px;
}


#distanceSection h3, #distanceSectionVis h3 {
  margin: 0 0 6px 0;
  font-size: 0.9rem;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}


#analysisSection h3 {
  margin: 0 0 8px 0;
  font-size: 0.9rem;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}


.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}


.analysis-card {
  background: #2980b9;
  /* Match Random Graph button (Blue) */
  color: #ffffff;
  border-radius: 6px;
  padding: 8px;
  /* Compact padding */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}


.card-value {
  font-size: 1.1rem;
  /* Smaller font */
  font-weight: 700;
  color: #ffffff;
}


.card-label {
  font-size: 0.65rem;
  /* Smaller label */
  text-transform: uppercase;
  opacity: 0.9;
  margin-top: 2px;
}


.controlGroup label {
  font-weight: 500;
  margin-bottom: 4px;
  display: block;
  color: black
}


.controlGroup input,
.controlGroup select {
  width: 100%;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid black;
  font-size: 0.78rem;
}


.controlGroup button {
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid #2980b9;
  background: #2980b9;
  /* Sober Blue */
  color: white;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}


.controlGroup button:hover {
  background: #3498db;
  border-color: #3498db;
}


.simButtons {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  
}


.simButtons button {
  flex: 1;
  font-size: 0.7rem !important;
  padding: 4px 8px !important;
  font-weight: 500;
}


/* ---------- Graph Area ---------- */


#graphArea {
  flex: 1;
  min-width: 500px;
  background: #ffffff;
  border: 1px solid black;
  border-radius: 10px;
  padding: 6px;
  position: relative;
}

#graphHint {
  background: #7a3df0;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 6px;
  box-shadow: 0 2px 6px rgba(122, 61, 240, 0.3);
}

#graphHint.hidden {
  display: none;
}


#graphSvg {
  width: 100%;
  height: 100%;
}


/* ---------- Code Walkthrough ---------- */


#codeSection {
  display: none;
  flex: 0.6;
  min-width: 350px;
}


#codeSection.active {
  display: flex;
  flex-direction: column;
}


#codePanel {
  background: #ffffff;
  border: 1px solid black;
  border-radius: 10px;
  padding: 10px;
  height: auto;
  max-height: 600px;
  display: flex;
  flex-direction: column;
  align-self: flex-start;
}


#negativeCycleNote {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 10px;
  font-size: 0.65rem;
  color: #78350f;
  line-height: 1.4;
}


#negativeCycleNote strong {
  color: #92400e;
  display: block;
  margin-bottom: 4px;
}


#negativeCycleNote pre {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 6px 8px;
  margin: 4px 0;
  font-family: "Consolas", "SFMono-Regular", "Courier New", monospace;
  font-size: 0.6rem;
  color: #92400e;
  white-space: pre;
  overflow-x: auto;
}


#negativeCycleNote span {
  display: block;
  margin-top: 4px;
}

#shortestPathsSection {
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 10px;
  font-size: 0.65rem;
  color: #0c4a6e;
  line-height: 1.4;
}

#shortestPathsSection h3 {
  margin: 0 0 6px 0;
  font-size: 0.9rem;
  color: #0c4a6e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#shortestPathsList {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.path-item {
  background: #ffffff;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  padding: 4px 6px;
  font-family: "Consolas", "SFMono-Regular", "Courier New", monospace;
  font-size: 0.65rem;
  color: #0c4a6e;
}

.path-item .path-label {
  font-weight: 600;
  color: #0369a1;
}

.path-item .path-route {
  color: #0c4a6e;
  margin-left: 4px;
}

.path-item .path-distance {
  color: #0369a1;
  font-weight: 600;
  margin-left: 4px;
}

/* Highlighted path item */
.path-item.highlighted {
  background: #e9d5ff;
  border: 2px solid #7a3df0;
  box-shadow: 0 0 8px rgba(122, 61, 240, 0.4);
}


#codeHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #111827;
}


#codeHeader h3 {
  margin: 0;
}


#codeHeader p {
  margin: 4px 0 0 0;
  color: #4b5563;
  font-size: 0.9rem;
}


#codeLegend {
  font-size: 0.85rem;
  color: #1f2937;
  font-weight: 600;
}


#codeExplanation {
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: #0c4a6e;
  line-height: 1.5;
  font-weight: 500;
  min-height: 40px;
  display: flex;
  align-items: center;
}

#codeExplanation:empty {
  display: none;
}

#codeExplanation.success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #14532d;
}

#codeExplanation.warning {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #78350f;
}

#codeWindow {
  background: #ffffff;
  color: #000000;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px;
  max-height: 400px;
  overflow-y: auto;
  font-family: "Consolas", "SFMono-Regular", "Courier New", monospace;
  font-size: 0.65rem;
}


.code-line {
  display: flex;
  gap: 8px;
  padding: 3px 6px;
  border-radius: 4px;
  align-items: flex-start;
}


.line-number {
  width: 28px;
  text-align: right;
  color: #6b7280;
  user-select: none;
  flex-shrink: 0;
}


.code-text {
  white-space: pre;
  flex: 1;
  color: #000000;
}


.code-line.active {
  background: #fef08a;
  color: #1f2937;
}


/* ---------- SVG Styling ---------- */


.node {
  fill: #f8fafc;
  stroke: #2563eb;
  stroke-width: 2;
  transition: fill 0.3s ease;
}


.node.active {
  fill: #f4f2ed;
  stroke: #f59e0b;
  stroke-width: 3;
}


.node.visited {
  fill: #93c5fd;
}


.node.source {
  fill: rgb(230, 255, 230);
  stroke: #16a34a;
  stroke-width: 3;
}


.node.updated {
  fill: #a78bfa;
  stroke: #7c3aed;
  stroke-width: 3;
}


.node.relaxed {
  fill: #60a5fa;
  stroke: #2563eb;
  stroke-width: 3;
}


/* Distance Table (Grid Layout) */
#distanceTable {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  /* removed max-height and overflow-y to allow full section scrolling */
  font-size: 0.8rem;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
}


.dist-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: #2980b9;
  /* Match Analysis cards & Random Graph button */
  color: white;
  padding: 6px;
  font-weight: 600;
  text-align: center;
  position: sticky;
  top: 0;
}


.dist-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 4px 6px;
  border-bottom: 1px solid #e2e8f0;
  text-align: center;
  align-items: center;
  color: #0f172a;
  /* Force dark text */
  font-weight: 500;
}


/* Removed duplicate/old table styles */


#statusMessage {
  font-size: 0.85rem;
  min-height: 50px;
  display: flex;
  align-items: center;
}

#statusMessage.info {
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  color: #0c4a6e;
  /* Dark Blue for good contrast */
}


#statusMessage.success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #14532d;
  /* Dark Green */
}


#statusMessage.warning {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #78350f;
  /* Dark Amber */
}


button#resetBtn {
  background: #d35400;
  /* Sober Orange for Reset */
  border-color: #d35400;
}


button#resetBtn:hover {
  background: #e67e22;
  border-color: #e67e22;
}


button#prevBtn {
  background: #7c3aed;
  /* Purple */
  border-color: #7c3aed;
}


button#prevBtn:hover {
  background: #8b5cf6;
  border-color: #8b5cf6;
}


button#playBtn {
  background: #27ae60;
  /* Green for Play/Run - Optional, or keep Blue */
  border-color: #27ae60;
}


button#playBtn:hover {
  background: #2ecc71;
  border-color: #2ecc71;
}


/* Distance Table */
/* Consolidated Table Styles Above */


/* Consolidated styles are above. */


/* Remove old table styles if conflicting */
#distTable th {
  display: none;
}


.edge {
  stroke: #7f8c8d;
  /* Dark Gray for inactive edges */
  stroke-width: 2;
  marker-end: url(#arrow);
  transition: stroke 0.3s ease;
}


.edge-group {
  cursor: pointer;
}


.edge-hit {
  stroke: transparent;
  stroke-width: 16;
  fill: none;
}


.edge-delete {
  display: none;
}


.edge-delete circle {
  fill: #ef4444;
  stroke: #b91c1c;
  stroke-width: 1;
}


.edge-delete text {
  fill: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
}


.edge-group:hover .edge-delete {
  display: block;
}


.edge.active {
  stroke: #d35400;
  /* Sober Orange for active edges */
  stroke-width: 3;
}


.edge.negative {
  stroke-dasharray: 5;
}


svg {
  width: 100%;
  height: 100%;
}


.node {
  fill: #fff;
  stroke: #34495e;
  /* Dark Blue-Gray Stroke */
  stroke-width: 2;
}


.node.source {
  fill: #27ae60;
  /* Sober Green */
  stroke: #2ecc71;
  color: white;
  /* For text if needed */
}


.node.active {
  fill: #f39c12;
  /* Sober Yellow/Amber */
  stroke: #f1c40f;
}


.node.updated {
  fill: #e67e22;
  /* Sober Orange */
  stroke: #d35400;
}


.node-text {
  text-anchor: middle;
  font-size: 14px;
  font-weight: bold;
  pointer-events: none;
}


.edge {
  stroke: #333;
  stroke-width: 2;
}


.edge.negative {
  stroke: red;
}


.edge-weight {
  font-size: 12px;
  font-weight: bold;
  fill: #000;
  background: white;
  pointer-events: none;
  dominant-baseline: middle;
  text-anchor: middle;
}


.edge-weight.editable {
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
}



.edge.active {
  stroke-width: 4;
}


/* Path Highlighting (Purple for shortest path) */
.node.path-node {
  fill: #e9d5ff !important;
  stroke: #7a3df0 !important;
  stroke-width: 3 !important;
}


.edge.path-edge {
  stroke: #7a3df0 !important;
  stroke-width: 3 !important;
  opacity: 1 !important;
}


/*  MODAL  */
/* ---------- MODAL ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}


.modal.hidden {
  display: none !important;
}


.modal-content {
  background: white;
  width: 900px;
  height: 600px;
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}


.modal-content.small {
  width: 320px;
  height: auto;
  padding: 16px;
}




/* ================= MODAL HEADER ================= */
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
}


#modal-heading {
  font-size: 15px;
  font-weight: 600;
  color: #000;
}


.modal-header button {
  border: none;
  background: transparent;
  font-size: 18px;
  color: #000;
  cursor: pointer;
  padding: 4px 8px;
}


.modal-header button:hover {
  background: #f3f4f6;
  border-radius: 6px;
}


/* ================= SVG AREA ================= */
#manual-svg {
  flex: 1;
  background: linear-gradient(#fafafa, #f5f5f5);
  margin: 16px;
  border-radius: 12px;
  cursor: crosshair;
}


/* ================= FOOTER / TOOLBAR ================= */
.toolbar {
  padding: 14px 20px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}


/* ================= BUTTONS ================= */
button {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #000;
  cursor: pointer;
  transition: background 0.15s ease, border 0.15s ease;
}


button:hover {
  background: #f3f4f6;
}


button.primary {
  background: #000;
  color: #fff;
  border: 1px solid #000;
}


button.primary:hover {
  background: #111;
}


button.secondary {
  background: #ffffff;
}


/* ================= GRAPH ELEMENTS ================= */


/* Nodes */
.manual-node {
  fill: #ffffff;
  stroke: #34495e;
  /* Sober Dark Blue-Gray */
  stroke-width: 2;
  cursor: pointer;
  transition: all 0.15s ease;
}


.manual-node:hover {
  fill: #f3f4f6;
}


.manual-node.selected {
  fill: #f39c12;
  /* Sober Yellow */
  stroke: #e67e22;
  stroke-width: 2.5;
}


/* Node labels */
.node-label {
  font-size: 11px;
  font-weight: 600;
  fill: #000000;
  text-anchor: middle;
  pointer-events: none;
}


/* Edges */
.manual-edge {
  stroke: #7f8c8d;
  /* Sober Gray */
  stroke-width: 2;
  cursor: pointer;
  transition: stroke 0.15s ease;
}


.manual-edge:hover {
  stroke: #d35400;
  /* Sober Orange */
}


/* Edge weight */
.edge-weight {
  font-size: 10px;
  font-weight: 500;
  fill: #000;
  pointer-events: none;
  text-anchor: middle;


}


/* Edge weight background */
.edge-weight-bg {
  fill: transparent;
  stroke: transparent;
  stroke-width: 0.8;
  rx: 8;
  ry: 8
}


/* ================= ERROR BADGE ================= */
#manual-error {
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}


#manual-error.hidden {
  display: none;
}


/* ================= EDGE MODAL ================= */
.modal-actions {
  padding-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}


/* ================= MODAL TEXT VISIBILITY FIX ================= */
.modal-content h3 {
  color: #111827;
  /* distinct dark color */
  margin-top: 0;
}


#edge-info {
  color: #374151;
  /* readable gray */
  margin-bottom: 12px;
}


.modal-content input {
  color: #111827;
  border-color: #d1d5db;
}


.modal-content input::placeholder {
  color: #9ca3af;
}


/* ================= HEADING ================= */
#modal-heading {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}


/* Manual Instructions */
.manual-instructions {
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 10px;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}


.manual-instructions p {
  margin: 0;
  font-size: 0.75rem;
  color: #334155;
  font-weight: 500;
}


.manual-instructions strong {
  color: #0f172a;
}


/* ================= RESPONSIVE MEDIA QUERIES ================= */


/* For embedded mode or smaller viewports */
@media (max-height: 800px) {
  #visualSection {
    height: calc(100vh - 150px);
    min-height: 500px;
  }


  #container {
    padding: 20px;
  }
}


/* For very small viewports or heavily embedded scenarios */
@media (max-height: 600px) {
  #visualSection {
    height: calc(100vh - 100px);
    min-height: 400px;
  }


  #mainContainer {
    padding: 10px;
  }


  #container {
    padding: 15px;
    gap: 15px;
  }
}


/* Tablet (portrait + small landscape) */
@media (max-width: 1024px) {
  #mainContainer {
    padding: 12px;
  }

  #container {
    padding: 10px;
    border-radius: 12px;
    gap: 12px;
  }

  #visualSection {
    flex-direction: column;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  #leftPanel {
    flex-direction: column;
    gap: 10px;
  }

  #visControls {
    width: 100%;
    max-height: none;
    overflow-y: visible;
  }

  #graphArea {
    min-width: 0;
    width: 100%;
    min-height: 420px;
  }

  #graphSvg {
    height: 420px;
  }

  #codeSection {
    min-width: 0;
    width: 100%;
    flex: 1;
  }

  #codePanel {
    width: 100%;
    max-height: none;
  }

  .simButtons {
    flex-wrap: wrap;
    gap: 8px;
  }

  .simButtons button {
    flex: 1 1 calc(50% - 8px);
    min-height: 40px;
    font-size: 0.8rem !important;
  }
}

/* Phones */
@media (max-width: 767px) {
  #modeSelection {
    padding: 12px;
  }

  #modeSelectionContainer {
    padding: 18px 14px;
    border-radius: 12px;
  }

  #modeButtons {
    gap: 12px;
  }

  .modeBtn {
    min-width: 0;
    width: 100%;
    padding: 12px 14px;
  }

  #backToModeSelection {
    position: static;
    align-self: flex-start;
    margin: 0 0 8px 0;
    font-size: 0.78rem;
    padding: 8px 12px;
  }

  #mainContainer {
    padding: 8px;
    justify-content: flex-start;
  }

  #container {
    max-width: 100%;
    padding: 8px;
    border-radius: 10px;
  }

  #visControls {
    padding: 10px;
    gap: 10px;
    font-size: 0.85rem;
  }

  .controlGroup input,
  .controlGroup select {
    min-height: 38px;
    font-size: 0.9rem;
  }

  .controlGroup button {
    min-height: 38px;
    font-size: 0.85rem;
  }

  .simButtons button {
    flex: 1 1 100%;
    min-height: 42px;
  }

  #statusMessage {
    min-height: 42px;
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  #graphArea {
    min-height: 340px;
    padding: 4px;
  }

  #graphSvg {
    height: 340px;
  }

  #codeWindow {
    max-height: 250px;
    font-size: 0.72rem;
  }

  #distanceTable,
  #distanceTableVis {
    font-size: 0.75rem;
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .card-value {
    font-size: 1rem;
  }

  .card-label {
    font-size: 0.68rem;
  }

  .modal-content {
    width: 96vw;
    height: 86vh;
  }

  .modal-content.small {
    width: 92vw;
  }
}