.map-container {
  max-width: 100%; /* Make sure map-container never exceeds the screen width */
  margin: 10px auto;
  position: relative;
  width: 100%;
  overflow: hidden; /* Prevent overflow from map-container */
}

.map-image {
  width: 100%;
  display: block;
}

.state-label {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 12px;
  pointer-events: none;
  /*max-width: 25%; ADD THIS LINE (Adjust percentage as needed) */
  box-sizing: border-box;
  /*Ensures padding doesn't add to the width*/
  word-break: break-word;
  /*Handles long state names*/
}

/*Position labels precisely based on the provided image.
     These values are ESTIMATES and will likely need adjustment.*/

#pennsylvania {
  top: 25%;
  left: 78%;
}

#ohio {
  top: 33%;
  left: 70%;
}

#california {
  top: 43%;
  left: 2%;
}

#texas {
  top: 68%;
  left: 35%;
}

#wisconsin {
  top: 18%;
  left: 57%;
}

.data-table {
  max-width: 600px;
  /* Match map container's max-width */
  margin: 20px auto;
  border-collapse: collapse;
  width: 90%;
  /* Take up 90% of the screen width */
}

.data-table th,
.data-table td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

.data-table th {
  background-color: #f2f2f2;
}

/* Media query for smaller screens */
@media (max-width: 768px) {
  .map-container {
    width: 95%;
    /* Take up more width on smaller screens */
  }

  .data-table {
    width: 95%;
    /* Take up more width on smaller screens */
  }

  .state-label {
    font-size: 10px;
    /* Smaller font size on smaller screens */
    padding: 3px;
  }
}

.key-container {
  display: flex;
  /* Use flexbox for easier alignment */
  flex-wrap: wrap;
  /* Allow items to wrap to the next line */
  justify-content: flex-start;
  /* Align items to the start of the line */
  margin-top: 10px;
}

.key-item {
  display: inline-flex;
  align-items: center;
  margin: 5px 10px;
  /* Add spacing between items */
  word-break: break-word;
  /* Handle long words */
}

.color-box {
  width: 20px;
  height: 20px;
  display: inline-block;
  margin-right: 5px;
  border: 1px solid #000;
  box-sizing: border-box;
  vertical-align: middle;
  /* Align color box vertically */
}

.key-text {
  vertical-align: middle;
  /* Align text vertically */
}

/* Color assignments based on the image */
.african-american {
  background-color: #972e71;
}

.aleut-eskimo {
  background-color: #f19b5e;
}

.american {
  background-color: #f6f2c2;
}

.american-indian {
  background-color: #f8ce7c;
}

.dutch {
  background-color: #008c4d;
}

.english {
  background-color: #ccafcd;
}

.finnish {
  background-color: #7dc296;
}

.french {
  background-color: #5ab3dd;
}

.german {
  background-color: #c0eae8;
}

.hispanic-spanish {
  background-color: #f1dfdd;
}

.irish {
  background-color: #9781b2;
}

.italian {
  background-color: #0072b1;
}

.mexican {
  background-color: #f0aeba;
}

.norwegian {
  background-color: #dbe7b7;
}

.puerto-rican {
  background-color: #d93190;
}

.other {
  background-color: #ffffff;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .container {
    padding: 10px;
  }

  .key-item {
    margin: 3px 5px;
  }

  .color-box {
    width: 15px;
    height: 15px;
    margin-right: 3px;
  }

  .key-text {
    font-size: 0.9em;
    /* Smaller text on small screens */
  }
}