
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    html {
      overflow-y: scroll;
      overflow-x: auto;
    }

    a:link { text-decoration:none; }

    body {
      font-family: Arial, sans-serif;
      background: #f5f5f5;
      padding: 0;
      margin: 0;
      min-height: 100vh;
    }

    /* Tooltip for point hover */
    .umap-tooltip {
      position: absolute;
      background: rgba(0, 0, 0, 0.85);
      color: white;
      padding: 6px 10px;
      border-radius: 4px;
      font-size: 13px;
      pointer-events: none;
      z-index: 10000;
      white-space: pre-wrap;
      max-width: 400px;
      box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }

    .header {
      background: white;
      padding: 15px 20px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100%;
    }

    .header img {
      max-width: 100%;
      height: auto;
      display: block;
    }

    .container {
      display: grid;
      grid-template-columns: 1240px 350px;
      gap: 0;
      height: auto;
      overflow: visible;
      width: 1590px;
      margin: 0 auto;
    }

    .panel {
      background: white;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
      overflow: visible;
      display: flex;
      flex-direction: column;
    }

    /* Plot panel (first) should expand to fit content */
    .panel:first-child {
      height: auto;
    }

    /* List panel (second) needs fixed height for scrolling */
    .panel:last-child {
      height: 991px;
    }

    .panel-header {
      background: #f9f9f9;
      padding: 15px 20px;
      border-bottom: 1px solid #ddd;
      font-weight: bold;
      color: #333;
    }

    .panel-content {
      padding: 20px;
      flex: 1;
      overflow: visible;
      display: flex;
      flex-direction: column;
    }

    /* Plot panel should not constrain the SVG */
    .panel:first-child .panel-content {
      overflow: visible;
    }

    /* List panel needs scroll for long lists */
    .panel:last-child .panel-content {
      overflow-y: auto;
    }

    #scatplot {
      width: 1200px;
      height: 900px;
      flex: 0 0 auto;
    }

    /* Legend below plot */
    .plot-legend {
      width: 100%;
      max-width: 1200px;
      margin-top: 15px;
      padding: 10px;
      background: #f9f9f9;
      border: 1px solid #ddd;
      border-radius: 4px;
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 8px 12px;
      font-size: 12px;
    }

    .plot-legend .legend-item {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 4px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .plot-legend .legend-color-box {
      width: 14px;
      height: 14px;
      border: 1px solid #999;
      border-radius: 2px;
      flex-shrink: 0;
    }

    .plot-legend .legend-label {
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      color: #333;
    }

    .plot-legend .legend-count {
      margin-left: 4px;
      color: #666;
      font-size: 0.9em;
      flex-shrink: 0;
    }

    .plot-legend .legend-item.legend-disabled .legend-count {
      color: #999;
    }

    /* Disabled legend item (when trace is hidden) */
    .plot-legend .legend-item.legend-disabled {
      opacity: 0.4;
    }

    .plot-legend .legend-item.legend-disabled .legend-label {
      text-decoration: line-through;
      color: #999;
    }

    .plot-legend .legend-item.legend-disabled .legend-color-box {
      opacity: 0.3;
    }

    /* Adjust legend for many items */
    .plot-legend:has(> .legend-item:nth-child(30)) {
      grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
      font-size: 11px;
    }

    .plot-legend:has(> .legend-item:nth-child(50)) {
      grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
      font-size: 10px;
    }

    .list-container {
      flex: 1;
      overflow-y: auto;
      border: 1px solid #ddd;
      border-radius: 4px;
    }

    .list-container ol {
      list-style-position: inside;
      padding: 10px;
    }

    .list-container li {
      padding: 8px;
      margin-bottom: 4px;
      background: #f9f9f9;
      border-radius: 3px;
      cursor: pointer;
      transition: all 0.2s;
      border-left: 3px solid transparent;
      font-size: 13px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .list-container li .color-box {
      width: 12px;
      height: 12px;
      border-radius: 2px;
      flex-shrink: 0;
      border: 1px solid #999;
    }

    .list-container li .color-box.selected {
      background: white !important;
      border: 2px solid #333;
    }

    .list-container li:hover {
      background: #f0f0f0;
      border-left-color: #0066cc;
    }

    .list-container li.selected {
      background: #fff3cd !important;
      border-left-color: #ff9800;
      font-weight: 500;
    }

    /* Highlighted state (temporary, when clicked from list) */
    .list-container li.highlighted {
      background: #FFD700 !important;
      border-left-color: #FF8C00;
      font-weight: bold;
      box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    }

    /* When item is both selected and highlighted, keep the highlight style */
    .list-container li.selected.highlighted {
      background: #FFD700 !important;
      border-left-color: #FF8C00;
      font-weight: bold;
      box-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
    }

    .controls {
      padding: 15px 20px;
      background: #f9f9f9;
      border-top: 1px solid #ddd;
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      flex-shrink: 0;
    }

    button {
      padding: 8px 16px;
      background: white;
      border: 1px solid #ddd;
      border-radius: 4px;
      cursor: pointer;
      font-size: 13px;
      transition: all 0.2s;
    }

    button:hover {
      background: #f0f0f0;
      border-color: #999;
    }

    button.primary {
      background: #0066cc;
      color: white;
      border-color: #0066cc;
    }

    button.primary:hover {
      background: #0052a3;
      border-color: #0052a3;
    }

    button.primary:disabled {
      background: #999;
      border-color: #999;
      cursor: not-allowed;
      opacity: 0.6;
    }

    /* Mode toggle buttons */
    button.mode-btn {
      padding: 8px 16px;
      background: white;
      border: 1px solid #ddd;
      border-radius: 0;
      cursor: pointer;
      font-size: 13px;
      transition: all 0.2s;
      margin: 0;
    }

    button.mode-btn:first-of-type {
      border-radius: 4px 0 0 4px;
    }

    button.mode-btn:last-of-type {
      border-radius: 0 4px 4px 0;
      margin-left: -1px;
    }

    button.mode-btn:hover {
      background: #f0f0f0;
      z-index: 1;
    }

    button.mode-btn.active {
      background: #0066cc;
      color: white;
      border-color: #0066cc;
      font-weight: bold;
      z-index: 2;
    }

    button.mode-btn.active:hover {
      background: #0052a3;
      border-color: #0052a3;
    }

    .smlbtn { border:1px #aaa solid; border-radius:4px; padding:2px; font-size:0.8em; 
              background:#dadada; color:#009; text-decoration:none;  } 
    .smlbtn:hover { cursor:hover; background:#ffe; color:#00a; }

    .stats {
      padding: 10px;
      background: #f9f9f9;
      border-radius: 4px;
      font-size: 13px;
      color: #666;
      margin-bottom: 10px;
      flex-shrink: 0;
    }

    .stats strong {
      color: #0066cc;
      font-weight: bold;
    }

    .footer {
      background: #f9f9f9;
      padding: 20px;
      text-align: center;
      border-top: 1px solid #ddd;
      color: #666;
      font-size: 13px;
      margin-top: 20px;
      width: 100%;
      clear: both;
    }

    .footer hr {
      border: none;
      border-top: 1px solid #ddd;
      margin: 15px 0;
    }

    .code-example {
      background: #f5f5f5;
      padding: 15px;
      border-radius: 4px;
      font-family: monospace;
      font-size: 12px;
      overflow-x: auto;
      margin-top: 20px;
      border: 1px solid #ddd;
    }

    @media (max-width: 1630px) {
      .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        height: auto;
        width: 100%;
        max-width: 100%;
      }

      .panel {
        height: auto;
        min-height: 400px;
      }

      #scatplot {
        width: 100%;
        height: auto;
        max-width: 1200px;
      }
    }

#prgupdr { float:right; color:#4a4; font-style:italic; }

/**
 * UmapPlot CSS Styling
 * Matches Plotly appearance while providing custom interaction styles
 */

.umap-container {
  position: relative;
  width: 100%;
  background: #f5f5f5;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.umap-container svg {
  display: block;
  margin: 0 auto;
}

/* Plot elements */
.plot-background {
  cursor: crosshair;
}

.plot-title {
  fill: #222;
  font-family: Arial, sans-serif;
  pointer-events: none;
}

.axis-label {
  fill: #666;
  font-family: Arial, sans-serif;
  pointer-events: none;
}

/* Points - filters disabled for performance with large datasets */
.plot-point {
  cursor: pointer;
  transition: none; /* Disable transitions for performance */
  /* filter: drop-shadow removed - too expensive for 10K+ points */
}

.plot-point:hover {
  /* Hover effect handled via JS attribute changes */
}

.plot-point[data-selected="true"] {
  opacity: 1 !important;
}

/* Grid */
.grid-layer line {
  pointer-events: none;
}

/* Selection */
.selection-layer {
  pointer-events: none;
}

.selection-box {
  pointer-events: none;
  animation: selectionBlink 0.5s infinite;
}

@keyframes selectionBlink {
  0%, 100% {
    stroke-opacity: 1;
  }
  50% {
    stroke-opacity: 0.5;
  }
}

/* Old SVG legend styles removed - now using HTML legend below plot */

/* Hover info box */
.hover-info {
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12px;
  font-family: Arial, sans-serif;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  max-width: 300px;
}

.hover-info-title {
  font-weight: bold;
  margin-bottom: 4px;
}

.hover-info-content {
  color: #666;
  word-break: break-word;
}

/* Selection mode indicators */
.umap-container.selecting {
  background: #f9f9f9;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .plot-title {
    font-size: 14px;
  }

  .axis-label {
    font-size: 9px;
  }
}

/* Print styles */
@media print {
  .umap-container {
    box-shadow: none;
    border: 1px solid #ddd;
  }

  .plot-point {
    filter: none;
  }

  .selection-box {
    display: none;
  }
}

/* Toolbar styles (if added) */
.umap-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
  align-items: center;
}

.umap-toolbar button {
  padding: 6px 12px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: Arial, sans-serif;
  transition: all 0.2s ease;
}

.umap-toolbar button:hover {
  background: #f0f0f0;
  border-color: #999;
}

.umap-toolbar button.active {
  background: #0066cc;
  color: white;
  border-color: #0066cc;
}

/* Selection info */
.umap-selection-info {
  padding: 8px;
  background: #f9f9f9;
  border-top: 1px solid #ddd;
  font-size: 12px;
  font-family: Arial, sans-serif;
  color: #666;
}

.umap-selection-info strong {
  color: #333;
}

/* Loading state */
.umap-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 400px;
  font-family: Arial, sans-serif;
  color: #999;
}

.umap-loading::after {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-left: 8px;
  border: 3px solid #f0f0f0;
  border-top: 3px solid #0066cc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 3D Viewer Modal */
.modal-3d {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal-3d.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-3d-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 1200px;
  height: 80vh;
  max-height: 800px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-3d-content-large {
  max-width: 1400px;
  height: 90vh;
  max-height: 1000px;
}

.modal-3d-header {
  padding: 20px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-3d-header h3 {
  margin: 0;
  font-size: 20px;
  color: #333;
}

.modal-3d-close {
  background: none;
  border: none;
  font-size: 32px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-3d-close:hover {
  background: #f0f0f0;
  color: #333;
}

.modal-3d-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-3d-download {
  background: #0066cc;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.modal-3d-download:hover {
  background: #0052a3;
}

.modal-3d-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

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

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

.viewer-3d-info {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.95);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.viewer-3d-info div {
  margin: 4px 0;
}

.viewer-3d-info span {
  font-weight: bold;
  color: #0066cc;
}

/* 3D Labels */
.label-3d {
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid #0066cc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

/* Search autocomplete dropdown */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  background: white;
  border: 1px solid #ccc;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.search-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover,
.search-item.highlighted {
  background: #f0f7ff;
}

.search-item .search-type {
  font-size: 11px;
  color: #888;
  margin-left: 8px;
  font-style: italic;
}

.search-item .search-count {
  float: right;
  font-size: 11px;
  color: #666;
  background: #eee;
  padding: 2px 6px;
  border-radius: 10px;
}

.search-item .search-match {
  font-weight: bold;
  color: #0066cc;
}

/* Pfam search description in dropdown */
.search-item .pfam-desc {
  font-size: 11px;
  color: #666;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Zoom controls in plot corner */
.zoom-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 100;
}

.zoom-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #ccc;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  transition: all 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.zoom-btn:hover {
  background: #f0f7ff;
  border-color: #0066cc;
  color: #0066cc;
}

.zoom-btn:active {
  background: #e0efff;
  transform: scale(0.95);
}

.zoom-btn svg {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  display: block;
  pointer-events: none;
  stroke: #555 !important;
  fill: none !important;
}

.zoom-btn:hover svg {
  stroke: #0066cc !important;
}

/* Plot size toggle buttons */
.size-btn {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid #ccc;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
}

.size-btn:first-of-type {
  border-radius: 4px 0 0 4px;
  border-right: none;
}

.size-btn:last-of-type {
  border-radius: 0 4px 4px 0;
}

.size-btn:hover {
  background: #f0f7ff;
  border-color: #0066cc;
}

.size-btn.active {
  background: #0066cc;
  color: white;
  border-color: #0066cc;
}

#scatplot.small {
  width: 800px;
  height: 680px;
}

.plot-legend.small {
  max-width: 800px;
}

/* Tree button container */
.tree-button-container {
  width: 100%;
  max-width: 1200px;
  margin-top: 15px;
  padding: 12px 15px;
  background: #f0f7ff;
  border: 1px solid #0066cc;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.tree-button-container.small {
  max-width: 800px;
}

.tree-button-container .tree-description {
  color: #555;
  font-size: 13px;
  font-style: italic;
}

/* Compare banner */
.compare-banner {
  width: 100%;
  max-width: 1200px;
  margin-top: 15px;
  padding: 12px 15px;
  background: #fff3e0;
  border: 2px solid #FF6600;
  border-radius: 4px;
  display: flex;
  align-items: center;
}

.compare-banner.small {
  max-width: 800px;
}

.compare-banner-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.compare-banner-content span {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

.compare-banner-content button.secondary {
  background: white;
  border: 1px solid #c00;
  color: #c00;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.compare-banner-content button.secondary:hover {
  background: #ffebee;
}

circle.region1-locked {
  cursor: not-allowed;
}
