/* CSS Variables */
:root {
  /* Typography - Title Font Options */
  --title-font: "Noto Sans", sans-serif;
  
  /* Typography - Body Font Options */
  --body-font: "Noto Sans", sans-serif;
  
  /* UI Font */
  --ui-font: "Noto Sans", sans-serif;
  
  /* Author Font */
  --author-font: "Lato", sans-serif;
  
  /* Font sizes */
  --base-font-size: 16px;
  --h1-size: 2.5rem;
  --h2-size: 1.6rem;
  --h3-size: 1.3rem;
  --h4-size: 1.1rem;
  --body-size: 1rem;
  --small-text: 0.9rem;
  --author-size: 1rem;
  
  /* Colors */
  --text-color: #333;
  --background-color: #efefef;
  --content-bg: #efefef;
  --footer-bg: #f5f5f5;
  --author-text: #6c757d;
  --footer-text: #adb5bd;
  --sim-bg: #fff;
  --card-bg: white;
  --card-shadow: rgba(0, 0, 0, 0.1);
  
  /* UI Colors */
  --primary-btn: #3a86ff;
  --primary-btn-hover: #2a75ee;
  --danger-btn: #ef476f;
  --danger-btn-hover: #e02f5a;
  --control-bg: #f8f9fa;
  --border-color: #e5e5e5;
  
  /* Layout */
  --content-width: 800px;
  --content-padding: 2rem 1rem;
  --section-spacing: 2.5rem;
  --simulation-width: 95vw;
  --simulation-max-width: 1400px;
}

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

body {
  background-color: var(--background-color);
  font-family: var(--ui-font);
  font-size: var(--base-font-size);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 120vh;
  margin: 0;
  padding: 0;
  color: var(--text-color);
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--title-font);
  line-height: 1.2;
  font-weight: 600;
}

h1 {
  font-size: var(--h1-size);
  margin-bottom: 1.2rem;
  margin-top: 2.5rem;
}

h2 {
  font-size: var(--h2-size);
  margin-top: var(--section-spacing);
  margin-bottom: 1.2rem;
}

h3 {
  font-size: var(--h3-size);
  margin-bottom: 1rem;
}

h4 {
  font-size: var(--h4-size);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

p {
  font-family: var(--body-font);
  font-size: var(--body-size);
  line-height: 1.5;
  margin-bottom: 1rem;
  color: var(--text-color);
}

ul, ol {
  font-family: var(--body-font);
  font-size: var(--body-size);
  line-height: 1.5;
  color: var(--text-color);
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Author styling */
.author {
  margin: 0.8rem 0 1.5rem 0;
  font-family: var(--author-font);
  font-style: normal;
  font-weight: 400;
}

.author p {
  margin: 0;
  font-family: var(--author-font);
  color: var(--author-text);
  font-size: var(--author-size);
  margin-bottom: 4rem;
}

/* Content */
.content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--content-padding);
  background-color: var(--content-bg);
  position: relative;
  overflow: visible;
}

.text-block {
  margin-bottom: 2rem;
}

/* Simulation section - replaces both simulation-block and sequence-block */
.simulation-container {
  background-color: var(--sim-bg);
  padding: 20px 0;
  margin: 2.5rem 0;
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  /* border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color); */
}

.simulation-container h2 {
  font-family: var(--ui-font);
  font-weight: 600;
  font-size: 1.3rem;
  margin-top: 0;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  max-width: var(--simulation-max-width);
  margin-left: auto;
  margin-right: auto;
  padding: 0 20px;
}

/* Three column layout */
.simulation-grid {
  display: grid;
  grid-template-columns: 1fr 2.2fr 1.4fr;
  gap: 20px;
  width: 100%;
  max-width: var(--simulation-max-width);
  margin-left: auto;
  margin-right: auto;
  padding: 0 30px;
}

/* Controls column */
.controls-column {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Strategy selection */
.strategy-selection {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 15px;
}

.strategy-group {
  margin-bottom: 12px;
}

.strategy-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 3px;
}

.strategy-description {
  font-size: 0.85rem;
  color: #666;
  margin-top: 4px;
  margin-bottom: 0;
  min-height: 2em; /* Ensure consistent height even when empty */
}

/* Color indicator styling */
.color-indicator {
  display: none; /* Hide color indicators */
}

/* Proportion control styling */
.proportion-control-container {
  background-color: var(--control-bg);
  padding: 12px 15px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.proportion-control-container h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.proportion-slider-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.proportion-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  background: #ddd;
}

.proportion-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 2px solid #577590;
  cursor: pointer;
}

.proportion-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 2px solid #577590;
  cursor: pointer;
}

.proportion-label {
  font-size: 12px;
  font-weight: bold;
  width: 40px;
  text-align: center;
}

/* Tournament parameters */
.tournament-params {
  background-color: var(--control-bg);
  padding: 12px 15px;
  border-radius: 4px;
  border: none;
}

.param-group {
  margin-bottom: 20px;
}

.param-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  font-size: 0.9rem;
}

.param-description {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 10px;
}

.slider-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.slider-container input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: #ddd;
  outline: none;
  margin: 5px 0;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 2px solid #577590;
  cursor: pointer;
}

.slider-container input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 2px solid #577590;
  cursor: pointer;
}

.slider-minmax {
  display: flex;
  justify-content: space-between; /* Return to space-between for proportion slider */
  width: 100%;
}

/* Only hide min values for sliders other than proportion */
.param-group:not(:first-child) .slider-min {
  display: none; /* Hide min values for all except proportion slider */
  text-align: left;
  font-size: 12px;
}

/* For proportion slider specifically */
.param-group:first-child .slider-min {
  display: block; /* Show for proportion slider */
  text-align: left;
  font-size: 12px;
}

.slider-max {
  text-align: right;
  font-size: 12px;
}

/* Button styling */
.button-group {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
}

.button-group button {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

#start-tournament {
  background-color: var(--primary-btn);
  color: white;
}

#start-tournament:hover:not(:disabled) {
  background-color: var(--primary-btn-hover);
}

#stop-tournament {
  background-color: var(--danger-btn);
  color: white;
}

#stop-tournament:hover:not(:disabled) {
  background-color: var(--danger-btn-hover);
}

#reset-visualization {
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  color: #333;
}

#reset-visualization:hover {
  background-color: #e9ecef;
}

/* Button disabled state */
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #ddd; /* Gray border for disabled state */
}

/* Form controls styling */
select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: white;
  font-family: var(--ui-font);
  font-size: 0.9rem;
  color: var(--text-color);
  width: 100%;
  max-width: 100%;
  cursor: pointer;
  outline: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  height: 62px; /* Increased height to fit two lines by default */
  /* Custom select styling for flat, minimalist appearance */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='8' fill='none' stroke='%23666' stroke-width='1.5'><path d='M1,1 L7,7 L13,1' /></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  white-space: normal; /* Allow text to wrap */
}

select:focus {
  border-color: var(--primary-btn);
}

select option {
  padding: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 62px; /* Match the height of the select */
  white-space: normal;
  text-align: left;
}

select option::before {
  content: attr(value);
  display: inline;
  font-weight: 600;
}

/* Style for strategy name and description in dropdowns */
.strategy-name {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.strategy-desc {
  display: block;
  font-size: 0.8rem;
  color: #999;
  font-style: italic;
}

/* Visualization columns - remove borders */
.agent-pool-column, .histogram-column {
  height: 500px;
  background-color: var(--card-bg);
  border: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* For testing - give histogram a background color to match settings */
.histogram-column {
  background-color: var(--control-bg);
  /* border: 2px solid #3a86ff; /* Add a visible blue border */ 
  padding: 0; /* Remove specific padding to ensure consistency */
}

/* Strategy selection when placed above agent pool */
.strategy-selection-container {
  margin-bottom: 12px;
  background-color: var(--control-bg);
  border-radius: 4px;
  padding: 12px 15px;
  flex-shrink: 0;  /* Prevent container from shrinking */
}

.strategy-selection-header {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 10px;
  text-align: center;
}

.strategy-selection-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 15px;
}

.strategy-selection-row .strategy-group {
  flex: 1;
  margin-bottom: 0;
}

.agent-pool-visualization {
  flex: 1;
  position: relative;
  min-height: 400px; /* Ensure minimum height for visualization */
  width: 100%;
  background-color: var(--control-bg); /* For testing purposes */
  overflow: visible; /* Allow content to overflow without being cut off */
}

/* Ensure the SVG can also overflow */
#agent-pool-container svg {
  overflow: visible;
}

/* Running indicator */
#running-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #adb6c4; /* Updated color as requested */
  font-weight: bold;
  font-size: 13px;
  font-family: var(--ui-font);
  position: absolute; /* Position absolutely within agent-pool-visualization */
  bottom: 45px; /* Moved up from 15px to prevent being cut off */
  right: 15px; /* Position at right */
  background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent background */
  padding: 6px 12px;
  border-radius: 4px;
  z-index: 100; /* Ensure it's above other elements */
}

#running-indicator.hidden {
  display: none;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(173, 182, 196, 0.3); /* Add faint circular track */
  border-top-color: #adb6c4; /* Keep the animated part more visible */
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Strategy node styling */
.strategy circle {
  cursor: pointer;
  transition: r 0.3s ease-out, stroke-width 0.3s ease-out;
}

.strategy circle:hover {
  stroke-width: 3px;
  stroke: #fff;
}

.strategy text {
  pointer-events: none;
  font-family: var(--ui-font);
}

.matchup-line {
  pointer-events: none;
}

/* Agent pool styling */
.agent {
  transition: r 0.3s ease-out;
  cursor: pointer;
}

.agent:hover {
  opacity: 0.9;
}

/* Histogram styling */
.histogram-area {
  transition: d 0.3s ease-out;
}

.histogram-area:hover {
  opacity: 0.8;
}

.histogram-line {
  transition: d 0.3s ease-out;
  pointer-events: none;
}

/* Axis styling */
.x-axis path,
.x-axis line,
.y-axis path,
.y-axis line {
  stroke: #ccc;
  stroke-width: 1px;
}

.x-axis text,
.y-axis text {
  font-size: 11px;
  fill: #666;
  font-family: var(--ui-font);
}

.x-axis-label,
.y-axis-label {
  font-size: 12px;
  fill: #333;
  font-family: var(--ui-font);
}

/* Legend styling */
.legend-item text {
  fill: #333;
  font-family: var(--ui-font);
  font-size: 12px;
}

/* Grid lines */
.grid-line {
  stroke: #eee;
  stroke-width: 1;
}

/* Y-axis labels */
.left-y-label, .right-y-label {
  font-size: 10px;
  fill: #777;
  font-family: var(--ui-font);
}

/* Winner styles */
.winner-label {
  font-size: 13px;
  text-align: center;
  color: var(--primary-btn);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--ui-font);
  font-weight: bold;
}

/* Strategy name and total score text */
.strategy-name-label, .strategy-label {
  font-family: var(--ui-font);
  font-size: 15px !important;
}

.total-score, .avg-score {
  font-family: var(--ui-font);
  font-size: 12px !important;
}
.section-divider {
    border: 0;
    height: 1px;
    background-color: var(--footer-text);
    opacity: 0.3;
    margin: 4rem auto;
    width: 100%;
    max-width: var(--content-width);
}

/* More Stories section */
.more-stories {
    background: var(--background-color);
    padding: var(--section-spacing) 0;
    margin-top: 4rem;
    width: 100%;
}

.more-stories .content {
    max-width: 100%;
    padding: 0 2rem;
    background-color: transparent;
}

.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    align-items: start;
}

.story-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.story-card {
    background: var(--card-bg);
    overflow: hidden;
    border: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    height: auto;
}

.story-card img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    background-color: #000;
}

.story-card-content {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.story-card h4 {
    font-size: var(--h4-size);
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

.story-card p {
    margin: 0;
    font-size: var(--small-text);
    color: var(--footer-text);
}

/* Center the "More Stories" heading */
.more-stories h3 {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Footer */
.footer {
  min-height: 20vh;
  background-color: var(--footer-bg);
  margin-top: 3rem;
  padding: 2rem 0;
}

.footer .container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1rem;
  color: var(--footer-text);
}

.footer p {
  margin-bottom: 1rem;
  color: var(--footer-text);
  font-family: var(--ui-font);
  font-size: 0.9rem;
}

.footer a {
  color: var(--footer-text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.2s ease-in-out;
}

.footer a:hover {
  border-bottom-color: var(--footer-text);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .simulation-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "controls controls"
      "agents histogram";
  }
  
  .controls-column {
    grid-area: controls;
  }
  
  .agent-pool-column {
    grid-area: agents;
  }
  
  .histogram-column {
    grid-area: histogram;
  }
}

@media (max-width: 768px) {
  :root {
    --base-font-size: 16px;
    --h1-size: 1.8rem;
    --h2-size: 1.4rem;
    --simulation-width: 100%;
  }
  
  .simulation-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "controls"
      "agents"
      "histogram";
  }
  
  .simulation-container {
    width: 100%;
    left: 0;
    transform: none;
    padding: 15px;
  }
  
  .agent-pool-column, .histogram-column {
    height: 400px;
  }
  
  /* Make the strategy selection row stack for mobile */
  .strategy-selection-row {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  :root {
    --content-padding: 1rem 0.5rem;
  }
  
  h1 {
    font-size: 1.7rem;
  }
  
  h2 {
    font-size: 1.3rem;
  }
  
  .agent-pool-column, .histogram-column {
    height: 350px;
  }
}

/* Additional testing styles to visualize content */
/* Agent pool column styling for testing */
.agent-pool-column {
  /* border: 2px solid #06d6a0; /* Add a visible green border */
}

#agent-pool-container svg {
  /* border: 2px dashed #9b5de5; /* Purple dashed border for the agent pool SVG */
}

/* Strategy selection when placed above agent pool */
.strategy-selection-container {
  margin-bottom: 12px;
  background-color: var(--control-bg);
  border-radius: 4px;
  padding: 12px 15px;
  flex-shrink: 0;  /* Prevent container from shrinking */
}

.strategy-selection-header {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 10px;
  text-align: center;
}

.strategy-selection-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 15px;
}

.strategy-selection-row .strategy-group {
  flex: 1;
  margin-bottom: 0;
}

.agent-pool-visualization {
  flex: 1;
  position: relative;
  min-height: 400px; /* Ensure minimum height for visualization */
  width: 100%;
  background-color: var(--control-bg); /* For testing purposes */
  overflow: visible; /* Allow content to overflow without being cut off */
}

/* Ensure the SVG can also overflow */
#agent-pool-container svg {
  overflow: visible;
}

/* Running indicator */
#running-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #adb6c4; /* Updated color as requested */
  font-weight: bold;
  font-size: 13px;
  font-family: var(--ui-font);
  position: absolute; /* Position absolutely within agent-pool-visualization */
  bottom: 45px; /* Moved up from 15px to prevent being cut off */
  right: 15px; /* Position at right */
  background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent background */
  padding: 6px 12px;
  border-radius: 4px;
  z-index: 100; /* Ensure it's above other elements */
}

#running-indicator.hidden {
  display: none;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(173, 182, 196, 0.3); /* Add faint circular track */
  border-top-color: #adb6c4; /* Keep the animated part more visible */
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Strategy node styling */
.strategy circle {
  cursor: pointer;
  transition: r 0.3s ease-out, stroke-width 0.3s ease-out;
}

.strategy circle:hover {
  stroke-width: 3px;
  stroke: #fff;
}

.strategy text {
  pointer-events: none;
  font-family: var(--ui-font);
}

.matchup-line {
  pointer-events: none;
}

/* Agent pool styling */
.agent {
  transition: r 0.3s ease-out;
  cursor: pointer;
}

.agent:hover {
  opacity: 0.9;
}

/* Histogram styling */
.histogram-area {
  transition: d 0.3s ease-out;
}

.histogram-area:hover {
  opacity: 0.8;
}

.histogram-line {
  transition: d 0.3s ease-out;
  pointer-events: none;
}

/* Axis styling */
.x-axis path,
.x-axis line,
.y-axis path,
.y-axis line {
  stroke: #ccc;
  stroke-width: 1px;
}

.x-axis text,
.y-axis text {
  font-size: 11px;
  fill: #666;
  font-family: var(--ui-font);
}

.x-axis-label,
.y-axis-label {
  font-size: 12px;
  fill: #333;
  font-family: var(--ui-font);
}

/* Legend styling */
.legend-item text {
  fill: #333;
  font-family: var(--ui-font);
  font-size: 12px;
}

/* Grid lines */
.grid-line {
  stroke: #eee;
  stroke-width: 1;
}

/* Y-axis labels */
.left-y-label, .right-y-label {
  font-size: 10px;
  fill: #777;
  font-family: var(--ui-font);
}

/* Winner styles */
.winner-label {
  font-size: 13px;
  text-align: center;
  color: var(--primary-btn);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--ui-font);
  font-weight: bold;
}

/* Strategy name and total score text */
.strategy-name-label, .strategy-label {
  font-family: var(--ui-font);
  font-size: 15px !important;
}

.total-score, .avg-score {
  font-family: var(--ui-font);
  font-size: 12px !important;
}

/* More Stories section */
.more-stories {
  background: var(--background-color);
  padding: var(--section-spacing) 0;
  margin-top: 3rem;
  width: 100%;
}

.more-stories .content {
  max-width: 100%;
  padding: 0 2rem;
  background-color: transparent;
}

.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  align-items: start;
}

.story-card {
  background: var(--card-bg);
  overflow: hidden;
  border: 1px solid #eaeaea;
  display: flex;
  flex-direction: column;
  height: auto;
}

/* .story-card img {
  width: 100%;
  height: 180px;
  display: block;
  object-fit: cover;
  background-color: #f5f5f5;
} */

.story-card-content {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.story-card h4 {
  font-size: var(--h4-size);
  margin: 0 0 0.5rem 0;
  font-weight: 600;
}

.story-card p {
  margin: 0;
  font-size: var(--small-text);
  color: var(--footer-text);
}

/* Center the "More Stories" heading */
.more-stories h3 {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Footer */
.footer {
  min-height: 20vh;
  background-color: var(--footer-bg);
  margin-top: 3rem;
  padding: 2rem 0;
}

.footer .container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1rem;
  color: var(--footer-text);
}

.footer p {
  margin-bottom: 1rem;
  color: var(--footer-text);
  font-family: var(--ui-font);
  font-size: 0.9rem;
}

.footer a {
  color: var(--footer-text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.2s ease-in-out;
}

.footer a:hover {
  border-bottom-color: var(--footer-text);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .simulation-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "controls controls"
      "agents histogram";
  }
  
  .controls-column {
    grid-area: controls;
  }
  
  .agent-pool-column {
    grid-area: agents;
  }
  
  .histogram-column {
    grid-area: histogram;
  }
}

@media (max-width: 768px) {
  :root {
    --base-font-size: 16px;
    --h1-size: 1.8rem;
    --h2-size: 1.4rem;
    --simulation-width: 100%;
  }
  
  .simulation-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "controls"
      "agents"
      "histogram";
  }
  
  .simulation-container {
    width: 100%;
    left: 0;
    transform: none;
    padding: 15px;
  }
  
  .agent-pool-column, .histogram-column {
    height: 400px;
  }
  
  /* Make the strategy selection row stack for mobile */
  .strategy-selection-row {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  :root {
    --content-padding: 1rem 0.5rem;
  }
  
  h1 {
    font-size: 1.7rem;
  }
  
  h2 {
    font-size: 1.3rem;
  }
  
  .agent-pool-column, .histogram-column {
    height: 350px;
  }
} /* More Stories Section */
.more-stories {
    background: var(--background-color);
    padding: var(--section-spacing) 0;
    margin-top: 4rem;
    width: 100%;
}

.section-divider {
    border: 0;
    height: 1px;
    background-color: var(--footer-text);
    opacity: 0.3;
    margin: 4rem auto;
    width: 100%;
    max-width: var(--content-width);
}

.more-stories .content {
    max-width: 100%;
    padding: 0 2rem;
    background-color: transparent;
}

.more-stories h3 {
    font-family: var(--title-font);
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    align-items: start;
}

/* Story Cards */
.stories-track .story-card {
    flex: 0 0 auto;
    width: calc(33.333% - 20px);
    /* Show 3 cards by default, with margins */
    margin: 0 10px;
    background: var(--card-bg);
    border-radius: 8px !important;
    overflow: visible;
    /* Changed from hidden to visible */
    box-shadow: none;
    border: none !important;
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-origin: center center;
    position: relative;
    z-index: 1;
}

.stories-track .story-card:hover,
.stories-track .story-card:focus,
.stories-track .story-card:active {
    border: none !important;
    border-bottom: none !important;
    text-decoration: none;
    outline: none;
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    z-index: 2;
    /* Bring hovered card to front */
    border-radius: 8px !important;
}

/* Override any default link styles for story cards */
a.story-card,
a.story-card:hover,
a.story-card:active,
a.story-card:visited,
a.story-card:focus {
    border: none !important;
    border-bottom: none !important;
    text-decoration: none !important;
}

/* Story card content styling */
.story-card-content {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-bottom-left-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
}

.story-card h4 {
    font-family: var(--title-font);
    font-size: var(--h4-size);
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    color: var(--text-color);
}

.story-card p {
    margin: 0;
    font-size: var(--small-text);
    color: var(--footer-text);
}

.story-card:hover h4 {
    color: #0077b6;
}

/* Story card media container with aspect ratio */
.story-card-media {
    position: relative;
    width: 100%;
    padding-top: 107.5%;
    /* 1/0.93 ≈ 107.5% to create 0.93:1 ratio */
    overflow: hidden;
    /* Keep media content contained */
    background-color: #fff;
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
    border: none !important;
    border-bottom: none !important;
    transition: none !important;
}

.story-card-media img,
.story-card-media video {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    height: 100%;
    object-fit: cover;
    border: 0 !important;
    border-bottom: 0 !important;
    outline: 0 !important;
    transition: none !important;
    box-shadow: none !important;
}

/* Additional specific rule to override any hover borders on media elements */
.stories-track .story-card:hover .story-card-media,
.stories-track .story-card:focus .story-card-media,
.stories-track .story-card:active .story-card-media {
    border: none !important;
    border-bottom: none !important;
    outline: none !important;
    transition: none !important;
}

.stories-track .story-card:hover .story-card-media img,
.stories-track .story-card:hover .story-card-media video,
.stories-track .story-card:focus .story-card-media img,
.stories-track .story-card:focus .story-card-media video,
.stories-track .story-card:active .story-card-media img,
.stories-track .story-card:active .story-card-media video {
    border: 0 !important;
    border-bottom: 0 !important;
    outline: 0 !important;
    transition: none !important;
    box-shadow: none !important;
}

/* Responsive adjustments */
@media (min-width: 1100px) {
    .story-card {
        width: calc(25% - 20px);
        /* Show 4 cards on large screens */
        border-radius: 8px !important;
    }
}

@media (max-width: 900px) {
    .story-card {
        width: calc(50% - 20px);
        /* Show 2 cards on medium screens */
        border-radius: 8px !important;
    }
}

@media (max-width: 600px) {
    .story-card {
        width: calc(100% - 20px);
        /* Show 1 card on smaller screens */
        border-radius: 8px !important;
    }

    .stories-carousel-container {
        padding: 0 30px;
    }
}

/* Stories Carousel */
.stories-carousel-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    /* Space for navigation buttons */
}

.stories-carousel {
    width: 100%;
    overflow: visible;
    /* Allow cards to expand outside of container on hover */
    position: relative;
    padding: 10px 0 20px 0;
    /* Add padding to accommodate transformed cards */
}

.stories-track {
    display: flex;
    transition: transform 0.4s ease-in-out;
    padding: 10px 0;
    /* Add padding to accommodate shadows */
}

.story-card:hover h4 {
    color: #0070f3;
}

/* Navigation buttons */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: white;
    border: 1px solid #eaeaea;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    color: #666;
}

.carousel-nav:hover {
    background-color: #f5f5f5;
    /* color: #333; */
}

.carousel-nav.prev {
    left: 0;
}

.carousel-nav.next {
    right: 0;
}

/* Fix story card styling to remove hover border and ensure consistent rounded corners */
a.story-card {
    border-bottom: none;
    border: none !important;
}

.stories-track a.story-card:hover {
    border-bottom: none !important;
    border-bottom-color: transparent;
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Completely remove any border from story card links */
.stories-track a.story-card,
.stories-track a.story-card:hover,
.stories-track a.story-card:focus,
.stories-track a.story-card:active {
    border: none;
    border-bottom: none;
    text-decoration: none;
    outline: none;
}

/* Ensure consistent rounded corners on all story cards, including when hovered */
.stories-track .story-card {
    border-radius: 8px !important;
    overflow: hidden;
}

.stories-track .story-card:hover {
    border-radius: 8px !important;
}

/* Prevent any hover border on story card media */
.story-card-media,
.story-card-media img,
.story-card-media video {
    border: none !important;
    outline: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    :root {
        --base-font-size: 16px;
        --h1-size: 2rem;
    }
}

/* Override the default a:hover behavior specifically for story cards */
.more-stories a:hover,
.more-stories a:hover *,
.more-stories a:hover *:before,
.more-stories a:hover *:after {
    border: none !important;
    border-bottom: none !important;
    border-color: transparent !important;
    border-bottom-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

/* Ultimate override for story card borders - added at the end to have maximum specificity */
.story-card,
.story-card *,
.story-card:hover,
.story-card:hover *,
.stories-track .story-card,
.stories-track .story-card *,
.stories-track .story-card:hover,
.stories-track .story-card:hover *,
.story-card-media,
.story-card-media *,
.story-card-media img,
.story-card-media video,
.story-card:hover .story-card-media,
.story-card:hover .story-card-media img,
.story-card:hover .story-card-media video,
.story-card::before,
.story-card::after,
.story-card *::before,
.story-card *::after,
.story-card:hover::before,
.story-card:hover::after,
.story-card:hover *::before,
.story-card:hover *::after {
    border: 0 none !important;
    border-bottom: 0 none !important;
    border-top: 0 none !important;
    border-left: 0 none !important;
    border-right: 0 none !important;
    border-color: transparent !important;
    border-style: none !important;
    border-width: 0 !important;
    outline: 0 none !important;
}

/* Prevent hover events on media elements */
.story-card-media,
.story-card-media img,
.story-card-media video {
    pointer-events: none !important;
}

/* Apply border radius only where needed */
.story-card,
.story-card:hover {
    border-radius: 8px !important;
}

.story-card-media {
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
}

.story-card-content {
    border-bottom-left-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
}

/* Ultimate video element reset - this overrides ALL browser styling for videos */
video {
    all: initial !important;
    /* Reset all properties */
    display: block !important;
    /* Maintain block display */
    position: absolute !important;
    top: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    height: 100% !important;
    object-fit: cover !important;
    background-clip: padding-box !important;
    /* Prevent background extending into border area */
    -webkit-background-clip: padding-box !important;
    border: 0 !important;
    border-width: 0 !important;
    border-style: none !important;
    border-color: transparent !important;
    outline: 0 !important;
    box-shadow: none !important;
}

/* Video wrapper to isolate media elements */
.video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    border: 0 !important;
    border-width: 0 !important;
    border-style: none !important;
    border-color: transparent !important;
    outline: 0 !important;
}

.video-wrapper * {
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    border: 0 !important;
    border-width: 0 !important;
    border-style: none !important;
    border-color: transparent !important;
    outline: 0 !important;
}