:root {
  color-scheme: light dark;
  --panel_border: #8884;
  --selected_row: #56b4e933;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  line-height: 1.5;
}

main {
  max-width: 60rem;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* ------------------------------------------------------------------------- */
/* Visor 3D: lienzo a pantalla y lista de lesiones al lado.                  */
/* ------------------------------------------------------------------------- */

.viewer_page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.viewer_header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--panel_border);
}

.viewer_header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.study_title {
  margin: 0;
  opacity: 0.8;
}

main.viewer_layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 28rem);
  max-width: none;
  margin: 0;
  padding: 0;
}

.viewer_stage {
  position: relative;
  min-height: 60vh;
}

.viewer_canvas {
  position: absolute;
  inset: 0;
}

.viewer_canvas canvas {
  display: block;
}

.status_message {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  background: Canvas;
  border: 1px solid var(--panel_border);
}

.reset_view {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
}

.toggle_confidence {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 5;
}

.toggle_confidence.on {
  background: #2563EB;
  color: #FFFFFF;
}

.conf_legend {
  position: absolute;
  bottom: 3.5rem;
  left: 1rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 12px;
  z-index: 6;
  font-size: 11px;
  color: #E2E8F0;
}

.cl_title {
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
}

.cl_bar {
  width: 160px;
  height: 10px;
  border-radius: 4px;
  margin-bottom: 4px;
  background: linear-gradient(to right, #0000ff, #00ffff, #00ff00, #ffff00, #ff0000);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.cl_ticks {
  display: flex;
  justify-content: space-between;
  font-family: monospace;
  font-size: 10px;
  color: #94A3B8;
}

.point_tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 15;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #38BDF8;
  color: #F8FAFC;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  transform: translate(-50%, -125%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.orientation_cube {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  width: 120px;
  height: 120px;
  pointer-events: none;
}

.orientation_cube canvas {
  display: block;
}

.lesion_panel {
  overflow: auto;
  padding: 1rem;
  border-left: 1px solid var(--panel_border);
}

.lesion_panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.panel_hint {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  opacity: 0.8;
}

.lesion_table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.lesion_table th,
.lesion_table td {
  padding: 0.25rem 0.375rem;
  text-align: left;
  border-bottom: 1px solid var(--panel_border);
}

.lesion_row {
  cursor: pointer;
}

.lesion_row:focus-visible {
  outline: 2px solid #0072b2;
  outline-offset: -2px;
}

.lesion_row_selected {
  background: var(--selected_row);
}

.color_swatch {
  display: inline-block;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  border: 1px solid var(--panel_border);
  vertical-align: middle;
}

.downloads {
  margin-top: 1.5rem;
}

.hidden {
  display: none;
}

.visually_hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 48rem) {
  main.viewer_layout {
    grid-template-columns: 1fr;
  }

  .lesion_panel {
    border-left: none;
    border-top: 1px solid var(--panel_border);
  }
}
