/* ===============================
   THEME VARIABLES
   =============================== */
:root {
  /* Primary colors */
  --primary-color: #d35400; /* Orange from guess section */
  --primary-light: #e67e22;
  --primary-dark: #a04000;

  /* Secondary colors */
  --secondary-color: #3498db; /* Blue */
  --secondary-light: #5dade2;
  --secondary-dark: #2874a6;

  /* Neutral colors */
  --neutral-dark: #2c3e50;
  --neutral-medium: #7f8c8d;
  --neutral-light: #ecf0f1;

  /* Background colors */
  --bg-light: #f8f3ea; /* From guess section */
  --bg-dark: #2c3e50;
  --bg-card: #ffffff;

  /* Rating range colors (colorblind-friendly) */
  --rating-1: #0072b2; /* 1-1199 - Blue */
  --rating-2: #56b4e9; /* 1200-1699 - Light blue */
  --rating-3: #f0e442; /* 1700-1899 - Yellow */
  --rating-4: #e69f00; /* 1900-2299 - Orange */
  --rating-5: #d55e00; /* 2300+ - Red-orange */

  /* Typography */
  --font-heading: "Playfair Display", serif;
  --font-body: "Roboto", sans-serif;

  /* Spacing */
  --spacing-xs: 5px;
  --spacing-sm: 10px;
  --spacing-md: 20px;
  --spacing-lg: 40px;
  --spacing-xl: 80px;

  /* Border radius */
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 16px;

  /* Transitions */
  --transition-fast: 0.3s;
  --transition-medium: 0.5s;
  --transition-slow: 0.8s;

  /* Shadows */
  --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.1);
  --shadow-heavy: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* ===============================
     BASE STYLES
     =============================== */
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background-color: var(--bg-light);
  font-family: var(--font-body);
  color: var(--neutral-dark);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  color: var(--neutral-dark);
  margin-top: 0;
}

h1 {
  font-size: 3em;
  font-weight: 700;
}

h2 {
  font-size: 2em;
  font-weight: 600;
  color: var(--primary-color);
}

h3 {
  font-size: 1.5em;
  font-weight: 500;
}

p {
  margin-bottom: 1em;
  line-height: 1.6;
}

button {
  font-size: 1.2rem;
  font-weight: 600;
  padding: 12px 30px;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: block;
  margin: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(211, 84, 0, 0.3);
}

/* ===============================
     SECTION STYLING
     =============================== */
.section {
  padding: 0;
  background-color: var(--bg-light);
}

/* For sections with content that might be taller than viewport */
.section.fp-auto-height {
  padding: var(--spacing-lg) 0;
}

/* Card styling for content containers */
.content-card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-medium);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

/* ===============================
     VISUALIZATION CONTAINER STYLES
     =============================== */
.visualization-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-md);
}

.visualization-header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

.visualization-content {
  position: relative;
  min-height: 300px;
  width: 100%;
}

/* ===============================
     D3 VISUALIZATION SPECIFIC STYLES
     =============================== */
.d3-visualization {
  position: relative;
}

/* SVG basic styling */
.d3-visualization svg,
.visualization-svg {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0 auto;
}

/* Axis styling */
.d3-visualization .axis path,
.d3-visualization .axis line {
  stroke: var(--neutral-medium);
  stroke-width: 1px;
}

.d3-visualization .axis text,
.axis-label {
  fill: var(--neutral-dark);
  font-size: 12px;
  text-anchor: middle;
}

/* Grid lines */
.d3-visualization .grid line {
  stroke: rgba(0, 0, 0, 0.1);
  stroke-dasharray: 2, 2;
}

/* Tooltips */
.d3-tooltip,
.visualization-tooltip,
.masters-tooltip,
.tooltip {
  position: absolute;
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-medium);
  pointer-events: none;
  z-index: 1000 !important;
  max-width: 300px;
  font-size: 14px;
  line-height: 1.4;
  border: none;
}

.d3-tooltip.hidden,
.visualization-tooltip.hidden,
.tooltip.hidden {
  opacity: 0;
  visibility: hidden;
}

.visualization-tooltip strong {
  color: var(--primary-color);
}

/* Rating colors for consistent use across visualizations */
.rating-color-1 {
  fill: var(--rating-1);
  stroke: var(--rating-1);
}
.rating-color-2 {
  fill: var(--rating-2);
  stroke: var(--rating-2);
}
.rating-color-3 {
  fill: var(--rating-3);
  stroke: var(--rating-3);
}
.rating-color-4 {
  fill: var(--rating-4);
  stroke: var(--rating-4);
}
.rating-color-5 {
  fill: var(--rating-5);
  stroke: var(--rating-5);
}

/* ===============================
     LEGEND STYLES
     =============================== */
.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: var(--spacing-md) 0;
}

.legend-item {
  display: flex;
  align-items: center;
  margin: 0 var(--spacing-md) var(--spacing-sm) 0;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 8px 12px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  /* Removed transform and box-shadow hover transitions */
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-right: 10px;
  border: 1px solid white;
}

.legend-title {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 15px;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 8px;
}

/* ===============================
     BUTTON & INTERACTIVE ELEMENT STYLES
     =============================== */
.btn,
.connection-btn,
.transition-btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-weight: 600;
  transition: background-color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
  text-align: center;
}

.btn:hover,
.connection-btn:hover,
.transition-btn:hover {
  background-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.btn:active,
.connection-btn:active,
.transition-btn:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-light);
}

.btn-secondary {
  background-color: var(--secondary-color);
}

.btn-secondary:hover {
  background-color: var(--secondary-light);
}

.transition-btn {
  margin-top: 20px;
  display: block;
}

.connection-btn {
  margin: 5px;
  font-size: 0.9rem;
}

.connection-btn.active {
  background-color: var(--secondary-color);
  color: white;
}

/* Reset button */
.reset-button {
  margin: 10px auto;
  display: block;
  padding: 6px 12px;
  background-color: var(--secondary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
}

.reset-button:hover {
  background-color: var(--secondary-light);
}

.reset-button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

/* ===============================
     ENHANCED GUESS SECTION STYLES
     =============================== */
#guess-section {
  background: linear-gradient(135deg, #f8f3ea 0%, #e6e2d3 100%);
  position: relative;
}

#guess-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('data:image/svg+xml;utf8,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10,3 L17,7 L17,14 L10,18 L3,14 L3,7 L10,3 Z" stroke="rgba(211, 84, 0, 0.1)" fill="none"/></svg>');
  background-size: 100px 100px;
  opacity: 0.3;
}

.guess-hero {
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  position: relative;
  z-index: 10;
  max-width: 800px;
  margin: 0 auto;
  border: 1px solid rgba(211, 84, 0, 0.2);
}

.mega-title {
  color: var(--primary-color);
  font-size: 3.5rem !important;
  margin-bottom: 20px;
  font-weight: 700;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
}

.large-subtitle {
  font-size: 1.4rem !important;
  color: var(--neutral-dark);
  margin-bottom: 40px;
}

.guess-interaction-area {
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 25px;
  margin-top: 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  position: relative;
}

.range-bounds {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--neutral-dark);
}

.guess-slider-container {
  margin-bottom: 30px;
  padding: 0 10px;
  position: relative;
}

.guess-slider {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(
    to right,
    #d35400 0%,
    #d35400 20%,
    #bbb 20%,
    #bbb 100%
  );
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.guess-slider::-webkit-slider-thumb {
  width: 34px;
  height: 34px;
  border: 3px solid white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
  transform: translateY(-50%);
}

.guess-slider::-moz-range-thumb {
  width: 34px;
  height: 34px;
  border: 3px solid white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
  transform: translateY(-50%);
}

.range-ticks {
  position: relative;
  height: 30px;
  margin-top: -15px;
}

.tick {
  position: absolute;
  width: 2px;
  height: 8px;
  background-color: #aaa;
  top: 0;
}

.tick-label {
  position: absolute;
  font-size: 12px;
  top: 12px;
  left: 50%;
  color: #666;
}

.guess-value-display {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
  font-size: 1.1rem;
}

.guess-value-label {
  font-weight: 500;
  margin-right: 10px;
  color: var(--neutral-dark);
}

.guess-value-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
  background-color: rgba(211, 84, 0, 0.1);
  padding: 3px 15px;
  border-radius: 8px;
  min-width: 120px;
  text-align: center;
  margin: 0 10px;
}

.guess-value-suffix {
  font-weight: 500;
  color: var(--neutral-dark);
}

.guess-button {
  font-size: 1.2rem;
  font-weight: 600;
  padding: 12px 30px;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: block;
  margin: 0 auto;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(211, 84, 0, 0.3);
}

.guess-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(211, 84, 0, 0.4);
}

.guess-button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(211, 84, 0, 0.3);
}

.guess-result {
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  text-align: center;
  transition: all 0.5s ease;
}

.result-message {
  font-size: 1.4rem;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 30px;
  font-weight: 500;
}

.actual-number {
  margin-bottom: 40px;
}

.number-label {
  font-size: 1.2rem;
  color: var(--neutral-dark);
  margin-bottom: 10px;
}

.number-value {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 5px;
}

.number-suffix {
  font-size: 1.1rem;
  color: var(--neutral-dark);
}

.continue-prompt {
  margin-top: 30px;
  color: var(--neutral-dark);
  font-size: 1.1rem;
}

.bounce-arrow {
  margin-top: 20px;
  color: var(--primary-color);
  animation: bounceDownArrow 2.5s infinite;
}

input[type="range"] {
  width: 100%;
  height: 10px;
  border-radius: 5px;
  background: #ddd;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: var(--shadow-light);
}

input[type="range"]::-moz-range-thumb {
  width: 30px;
  height: 30px;
  background: var(--primary-color);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: var(--shadow-light);
  transform: translateY(-50%);
}

/* ===============================
     ANIMATION CLASSES
     =============================== */
.fade-in {
  animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.slide-in {
  animation: slideIn 0.5s forwards;
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.transition-fade-out {
  animation: fadeOut 0.5s forwards;
}

.transition-fade-in {
  animation: fadeIn 0.5s forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.bounce-arrow {
  animation: bounceDownArrow 2s infinite;
  color: var(--primary-color);
  margin-top: 15px;
}

@keyframes bounceDownArrow {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-15px);
  }
  60% {
    transform: translateY(-7px);
  }
}

/* Button pulse animation */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(211, 84, 0, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(211, 84, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(211, 84, 0, 0);
  }
}

.pulse-animation {
  animation: pulse 1.5s infinite;
}

/* Loading spinner animation */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ===============================
     MASTERS TIMELINE SPECIFIC STYLES
     =============================== */
#masters-visualization {
  width: 100%;
  min-height: 500px;
  margin-bottom: var(--spacing-lg);
}

#masters-visualization .bar {
  fill: var(--secondary-color);
}

#masters-visualization .bar:hover {
  fill: var(--primary-color);
}

#masters-visualization .line {
  stroke: var(--primary-color);
  stroke-width: 2;
  fill: none;
}

#masters-visualization .dot {
  fill: var(--primary-color);
}

/* ===============================
     RATINGS COMPARISON SPECIFIC STYLES
     =============================== */
.chart-container {
  width: 100%;
  height: 600px;
  position: relative;
}

.line {
  fill: none;
  stroke-width: 2.5;
}

.line-167084 {
  stroke: var(--rating-1);
}

.line-132534 {
  stroke: var(--rating-5);
}

.dot {
  transition: r 0.2s ease;
  cursor: pointer;
}

.brush .selection {
  fill: #64b0df;
  fill-opacity: 0.2;
  stroke: #2a7b9b;
}

/* ===============================
     GRID VISUALIZATION STYLES
     =============================== */
.grid-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.grid-circle {
  transition: r 0.2s ease, fill 0.3s ease;
  cursor: pointer;
}

.grid-circle:hover {
  stroke-width: 2;
  stroke: white;
}

/* Info container */
.info-movecharts-container {
  padding: 25px;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  border-right: 4px solid var(--primary-color);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  opacity: 1;
  transition: opacity 0.5s ease, transform 0.5s ease;
  transform: translateY(20px);
}

.info-container {
  padding: 25px;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  border-left: 4px solid var(--primary-color);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
  transform: translateY(20px);
}



.info-container.visible {
  opacity: 1;
  transform: translateY(0);
}

.info-title {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-weight: 600;
}

.info-stat {
  line-height: 1.6;
  margin-bottom: 20px;
  color: var(--neutral-dark);
}

/* ===============================
     HOURGLASS/FUNNEL VISUALIZATION STYLES
     =============================== */
/* Ensure hourglass SVG container is properly sized and visible */
#hourglass-svg {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 30 !important;
}

/* Force hourglass section to have a proper height */
#hourglass-section {
  min-height: 500px;
  position: relative;
}

/* Ensure the container-fluid in hourglass section has proper dimensions */
#hourglass-section .container-fluid {
  height: 100%;
  position: relative;
}

.ball {
  transition: fill 0.8s ease, r 0.2s ease;
}

.funnel-wall {
  transition: stroke-dashoffset 1s ease, stroke-width 0.3s ease;
  stroke-linecap: round;
}

.funnel-wall:hover {
  stroke-width: 3;
}

.zones-group polygon {
  transition: fill-opacity 0.6s ease, transform 0.5s ease;
}

.zones-group polygon:hover {
  fill-opacity: 0.6;
  transform: scale(1.01);
}

/* Legend and explanation panels for hourglass */
.legend-container,
.explanation-text {
  padding: 20px;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  opacity: 1 !important;
  transition: opacity 0.5s ease, transform 0.5s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  z-index: 40 !important;
  pointer-events: none;
}

.legend-container {
  position: absolute;
  top: 50px;
  left: 50px;
  max-width: 250px;
  border-left: 4px solid var(--primary-color);
  transform: translateY(0);
}

.explanation-text {
  position: absolute;
  bottom: 50px;
  right: 50px;
  max-width: 350px;
  border-left: 4px solid var(--secondary-color);
  transform: translateY(0);
}

.explanation-title {
  color: var(--secondary-color);
  margin-bottom: 15px;
  font-weight: 600;
}

/* Use original colors for hourglass legend */
#hourglass-legend .legend-item:nth-child(1) .legend-color {
  background-color: var(--rating-1) !important;
}

#hourglass-legend .legend-item:nth-child(2) .legend-color {
  background-color: var(--rating-2) !important;
}

#hourglass-legend .legend-item:nth-child(3) .legend-color {
  background-color: var(--rating-3) !important;
}

#hourglass-legend .legend-item:nth-child(4) .legend-color {
  background-color: var(--rating-4) !important;
}

#hourglass-legend .legend-item:nth-child(5) .legend-color {
  background-color: var(--rating-5) !important;
}

/* Physics engine loading indicator */
.physics-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ===============================
     WORLD MAP VISUALIZATION STYLES
     =============================== */
.connection-point {
  transition: r 0.5s ease;
}

.country {
  transition: fill 0.5s ease;
}

.connection-line {
  transition: stroke-dashoffset 2s ease;
}

/* Map container */
#map-container {
  height: 50vh !important; /* Reduced from 70vh to 50vh */
  margin-bottom: 20px;
}

/* Leaflet Map Styles */
#leaflet-map-container {
  height: 50vh;
  width: 100%;
  margin: 20px 0;
  border: 1px solid #ddd;
}

/* ===============================
     MASTERS MODAL STYLES
     =============================== */
.masters-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.masters-modal.visible {
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
}

.masters-modal-content {
  background-color: white;
  border-radius: 15px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 30px;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
  border-top: 5px solid var(--primary-color);
}

.masters-modal.visible .masters-modal-content {
  transform: translateY(0);
}

.masters-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #eee;
  padding-bottom: 15px;
}

.masters-modal-title {
  font-size: 1.8rem;
  color: var(--primary-color);
  margin: 0;
}

.masters-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #777;
  transition: color 0.2s ease;
}

.masters-modal-close:hover {
  color: var(--primary-color);
}

.masters-modal-body {
  margin-bottom: 20px;
}

.masters-modal-footer {
  text-align: right;
  border-top: 1px solid #eee;
  padding-top: 15px;
}

.masters-modal .close-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.masters-modal .close-button:hover {
  background-color: var(--primary-dark);
}

.masters-modal table {
  width: 100%;
  border-collapse: collapse;
}

.masters-modal th,
.masters-modal td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.masters-modal th {
  background-color: #f8f9fa;
  color: var(--primary-color);
  font-weight: 600;
}

.masters-modal tr:hover {
  background-color: #f8f9fa;
}

/* Table scrolling styles for masters and organizers tables */
.table-scrollable-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: var(--border-radius-sm);
  position: relative;
}

/* Style for tables with scrollable content */
.table-scrollable {
  width: 100%;
  margin-bottom: 0;
}

/* Fixed header for scrollable tables */
.table-scrollable thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

/* Card body with scrollable tables needs padding adjustments */
.card-body-scrollable {
  padding: 0;
}

/* Table hover behavior in scrollable tables */
.table-scrollable tbody tr:hover {
  background-color: rgba(248, 249, 250, 0.7);
}

/* Responsive map container and tables layout */
.map-tables-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Map container responsive height */
#leaflet-map-container {
  flex: 1;
  min-height: 300px;
  max-height: 50vh;
}

/* Tables row layout */
.tables-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 3px;
}

/* Tables card responsive sizing */
.table-card {
  flex: 1;
  min-width: 300px;
  max-width: 100%;
  margin-bottom: 20px;
}

/* Responsive height for scrollable tables based on viewport */
@media (max-height: 900px) {
  .table-scrollable-container {
    max-height: 300px;
  }
}

@media (max-height: 700px) {
  .table-scrollable-container {
    max-height: 200px;
  }
}

/* ===============================
     RESPONSIVE STYLES
     =============================== */
@media (max-width: 991px) {
  .visualization-container {
    padding: var(--spacing-sm);
  }

  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 1.8rem;
  }

  .legend {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-container {
    height: 400px;
  }

  .legend-container,
  .explanation-text {
    position: static;
    margin: 20px auto;
    transform: none;
    max-width: 100%;
  }

  /* Adjust table container height for medium screens */
  .table-scrollable-container {
    max-height: 250px;
  }

  /* Force tables to be full width on smaller screens */
  .table-card {
    flex-basis: 100%;
  }
}

@media (max-width: 768px) {
  .visualization-content {
    min-height: 200px;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .content-card {
    padding: var(--spacing-md);
  }

  .chart-container {
    height: 300px;
  }

  .mega-title {
    font-size: 2rem !important;
  }

  .large-subtitle {
    font-size: 1rem !important;
  }

  .info-container {
    padding: 15px;
  }

  .transition-btn {
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  .legend-item {
    padding: 6px 10px;
    font-size: 0.9rem;
  }

  #hourglass-legend {
    top: 20px !important;
    left: 20px !important;
    max-width: 200px !important;
    padding: 15px !important;
  }

  #chess-explanation-hourglass {
    bottom: 20px !important;
    right: 20px !important;
    max-width: 250px !important;
    padding: 15px !important;
  }

  .masters-modal-content {
    width: 95%;
    padding: 20px;
  }

  .masters-modal th,
  .masters-modal td {
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  /* Further reduce table heights on small screens */
  .table-scrollable-container {
    max-height: 200px;
  }
}

@media (max-width: 480px) {
  .btn,
  .connection-btn,
  .transition-btn {
    width: 100%;
    margin-bottom: var(--spacing-sm);
  }
}

/* ===============================
     ADDITIONAL FIXES FOR VISUALIZATION CONTAINERS
     =============================== */
/* Ensure visualization containers have proper dimensions */
#chart,
#map-container,
#masters-visualization,
#hourglass-svg,
#grid-display-container {
  min-height: 400px;
  width: 100%;
  display: block !important;
  position: relative;
}

/* Fix common fullpage.js issues with visualization containers */
.fp-viewing-players #chart,
.fp-viewing-map #map-container,
.fp-viewing-masters #masters-visualization,
.fp-viewing-hourglass #hourglass-svg,
.fp-viewing-grid #grid-display-container {
  visibility: visible !important;
  opacity: 1 !important;
}

/* Fix section heights */
.section {
  height: 100vh !important;
  position: relative;
  overflow: hidden;
}

/* Fix tooltips */
.d3-tooltip,
.visualization-tooltip,
.tooltip {
  z-index: 10000 !important;
}

/* Force visualization visibility */
.d3-visualization,
.visualization-svg {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* SVG element visibility */
svg path,
svg line,
svg rect,
svg circle,
svg text {
  visibility: visible !important;
}

/* Additional style for masters visualization */
#masters-visualization {
  min-height: 500px;
}

/* Additional style for players visualization */
.chart-container {
  min-height: 400px;
}

/* Tooltips */
.tooltip,
#tooltip,
#masters-tooltip,
.rating-tooltip {
  position: absolute;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 4px;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tooltip.hidden,
#tooltip.hidden,
#masters-tooltip.hidden,
.rating-tooltip.hidden {
  display: none;
}

#tooltip {
  position: absolute;
  width: 200px;
  height: auto;
  padding: 10px;
  background-color: white;
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
  border-radius: 10px;
  -webkit-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
  -moz-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
  box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* #tooltip.hidden {
  display: none;
} */

#tooltip p {
  margin: 0;
  font-family: sans-serif;
  font-size: 16px;
  line-height: 20px;
}

#masters-visualization {
  width: 100%;
  height: 600px;
  margin: 0 auto;
  position: relative;
}

.tooltip {
  pointer-events: none;
  font-size: 14px;
  z-index: 100;
  max-width: 300px;
}

.dot {
  transition: r 0.2s ease;
}

.dot:hover {
  cursor: pointer;
}

.chart-container {
  position: relative;
}
.line {
  fill: none;
  stroke-width: 2.5;
}
.line-167084 {
  stroke: #2b83ba;
}
.line-132534 {
  stroke: #d7191c;
}
.axis-label {
  font-size: 12px;
  text-anchor: middle;
}
.rating-tooltip {
  position: absolute;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 4px;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.rating-tooltip.hidden {
  display: none;
}

.masters-tooltip {
  position: absolute;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 4px;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.legend {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.legend-item {
  display: flex;
  align-items: center;
  margin: 0 15px;
}
.legend-color {
  width: 20px;
  height: 10px;
  margin-right: 5px;
}
.axis path,
.axis line {
  stroke: #888;
}
.axis text {
  fill: #333;
}
.grid line {
  stroke: #e0e0e0;
  stroke-opacity: 0.7;
}
.brush .selection {
  fill: #69b3a2;
  fill-opacity: 0.2;
  stroke: #2a7b9b;
}
.context-chart {
  margin-top: 15px;
}
.reset-button {
  margin: 10px auto;
  display: block;
  padding: 6px 12px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.reset-button:hover {
  background-color: #45a049;
}
.reset-button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}
.hidden {
  display: none;
}

/* Masters Tooltip Styling */
#masters-tooltip {
  position: absolute;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  border-radius: 4px;
  font-size: 14px;
  pointer-events: none;
  opacity: 0;
  z-index: 100;
  transition: opacity 0.3s;
}

#masters-tooltip.visible {
  opacity: 1;
}

#masters-tooltip.hidden {
  opacity: 0;
}

/* Map styles */
#map-container {
  width: 100%;
  height: 70vh;
  margin: 0 auto;
}

/* Make section heights full viewport height */
.section {
  height: 100vh;
  padding: 50px 0;
}

/* Player Bio Styles */
.player-bio-section {
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  border-left: 3px solid #2b83ba;
  background-color: rgba(249, 249, 249, 0.7);
  transition: all 0.5s ease;
  display: none;
  opacity: 0;
}

.player-bio-section.aaron {
  border-left-color: #2b83ba;
}

.player-bio-section.nikolay {
  border-left-color: #d7191c;
}

.bio-title {
  margin-bottom: 0.5rem;
  color: #333;
  font-weight: 500;
}

.bio-text {
  color: #555;
  line-height: 1.5;
  margin-bottom: 0;
}

/* Player Portrait Frames */
.player-portrait-container {
  display: flex;
  justify-content: center;
  gap: 20px; /* Reduced from 30px */
  margin: 10px 0; /* Reduced from 20px */
}

.player-portrait {
  width: 90px; /* Reduced from 120px */
  height: 90px; /* Reduced from 120px */
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
  background-color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-portrait:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.player-portrait.active {
  transform: scale(
    1.3
  ); /* Increased from 1.05 for more noticeable magnification */
  box-shadow: 0 8px 16px rgba(6, 6, 6, 0.4); /* Deeper drop shadow instead of halo */
}

.player-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-portrait.aaron-portrait {
  border: 4px solid #2b83ba;
}

.player-portrait.nikolay-portrait {
  border: 4px solid #d7191c;
}

/* Add player names under the portraits */
.player-portrait::after {
  content: attr(data-name);
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-weight: bold;
  font-size: 14px;
  white-space: nowrap;
}

/* Portrait container for layout */
.portraits-wrapper {
  position: relative;
  height: 110px; /* Reduced from 150px */
  margin-top: 10px; /* Reduced from 20px */
  margin-bottom: 20px; /* Reduced from 40px */
}
