/* Set the overall page background to gray */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 5vh 20px 20px; /* top padding pushes content downward a bit */
    background-color: #fff;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* align to top */
    text-align: center;
    min-height: 100vh;
    box-sizing: border-box;
    overflow-y: auto;
}


/* Style the container to stand out with a white background */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    position: relative;
    box-sizing: border-box;

    /* Ensure it's centered and respects full viewport width if needed */
    width: 90vw;
}


/*to adjust for smaller screens and to prevent the game from being clipped */
@media (max-height: 600px) {
  body {
    justify-content: flex-start;
    padding-top: 10px;
  }
  #highest,
  #lowest {
    margin: 4px 0;
  }
}


h1 {
    margin-bottom: 20px;

}


#question-container {
    margin-bottom: 20px; /* Add margin-bottom */
}

ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column; /* Display items in a column */
    align-items: center; /* Center items horizontally */
}

li {
    padding: 10px;
    margin: 5px;
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    cursor: grab;
    width: 80%; /* Make items wider */
    height: 60px; /* Make items shorter */
    box-sizing: border-box; /* Include padding and border in width */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px; /* Rounded corners */
    font-weight: bold; /* Bold text */
}

.correct-order li {
    background-color: #c3e6cb; /* Green background color */
    border-color: #4cae4c; /* Green border color */
}

.incorrect-order li {
    background-color: #f8d7da; /* Red background color */
    border-color: #dc3545; /* Red border color */
}

#result {
    margin-top: 30px;
    font-weight: bold;
}

#check {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}


#check:hover {
    background-color: #0056b3;
}

.label-container {
    position: relative;
}

#highest {
  text-align: center;
  font-size: 12px;
  color: #999;
  font-weight: bold;
  font-style: italic;
  margin: 4px 0; /* Adjust spacing here */
  line-height: 1.4;
}

#lowest {
  text-align: center;
  font-size: 12px;
  color: #999;
  font-weight: bold;
  font-style: italic;
  margin-top: 4px;  /* Reduce the gap between options and this label */
  margin-bottom: 4px; /* Reduce the gap below this label */
  line-height: 1.4;
}

#items {
  list-style-type: none;
  padding: 0;
  margin: 6px 0 6px 0; /* tighter spacing between labels and list */
  display: flex;
  flex-direction: column;
  align-items: center;
}


#lives {
    padding-top: 0px; /* Add more space above the Lives counter if needed */
    margin-top: 0;
    padding-bottom: 10px;
}

.result-message {
    margin-bottom: 10px; /* Adjust the value as needed */
}

.hidden {
    display: none;
}

#performance-summary {
    margin-top: 20px;
    padding: 20px;
    border-top: 1px solid #ccc;
    text-align: left;
}

#correct-order-list {
    list-style-type: none;
    padding: 0;
}

#correct-order-list li {
    padding: 10px;
    margin: 5px 0;
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.guess {
    display: flex;
    justify-content: space-around;
    margin: 10px 0;
}

.guess span {
    padding: 10px;
    border: 1px solid #ccc;
    background-color: #f1f1f1;
    border-radius: 5px;
}



/* Reduce spacing around the modal content */
#resultsModal .modal-content {
  padding: 16px 16px;
}

/* Shrink space above and below headings */
#resultsModal .modal-content h2,
#resultsModal .modal-content h3 {
  margin: 8px 0;
}

/* Reduce space between guessed order lines */
.guessed-order-line {
  margin-bottom: 4px;
  padding-bottom: 2px;
  gap: 6px;
}

/* Tighter spacing for the correct answer list */
#correct-order-list li {
  padding: 6px 10px;
  margin: 4px 0;
}

/* Reduce space above and below the dashed line */
#resultsModal hr {
  margin-top: 8px;
  margin-bottom: 8px;
}

/* Tighten up guessed orders section */
.guessed-orders-section {
  margin-top: 12px;
}



.guessed-order-line.correct-order .order-item,
.guessed-order-line.correct-order .order-number {
    background-color: #c3e6cb;
    border: 1px solid #4cae4c;
    border-radius: 5px;
    padding: 5px 10px;
    margin-right: 5px;
}

.guessed-order-line.incorrect-order .order-item,
.guessed-order-line.incorrect-order .order-number {
    background-color: #f8d7da;
    border: 1px solid #dc3545;
    border-radius: 5px;
    padding: 5px 10px;
    margin-right: 5px;
}

.order-item {
    padding: 5px 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
}

.sortable-ghost {
    opacity: 0.5;
}

/* Modal */
.modal {
    display: none; /* hidden by default */
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    padding: 20px;
    box-sizing: border-box;
}

/* Add this new class below it */
.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Modal Content */
.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    max-height: 90vh; /* restrict modal height */
    overflow-y: auto;  /* scroll internally if needed */
    border-radius: 8px;
    position: relative;
    box-sizing: border-box;
}

@media only screen and (max-width: 600px) {
  .modal-content {
    width: 98%; /* Increase width on small screens */
    max-width: 98%;
  }
}


#modal-body ul {
    list-style-type: none;
    padding: 0;
}

#modal-body li {
    background-color: #ddd;
    margin: 5px 0;
    padding: 10px;
    text-align: left;
}

/* The Close Button */
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute; /* Position it in the top right corner */
    top: 10px;
    right: 10px;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Adjust Close "X" positioning for the end-game results modal */
#resultsModal .close {
  top: 0px;     /* move it closer to the top edge */
  right: 0px;   /* move it closer to the right edge */
}

/* End-game close button adjustments for smaller screens */
@media (max-width: 600px) {
  #resultsModal .close {
    top: -20px;     /* still near the top */
    right: -4px;  /* push slightly outside content area to avoid overlapping text */
  }
}



.win-message {
    margin-top: 0px;
    margin-bottom: 20px; /* Adjust the value to get the desired spacing */
}

.play-again-button {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

.play-again-button:hover {
    background-color: #218838;
}

#streak {
    margin-top: 10px;
    font-weight: bold;
    font-size: 16px;
}

#streak-count {
    color: #007bff;
}

#streak-high-score {
    color: #28a745;
}

.correct-item {
    background-color: #c3e6cb;
    border: 1px solid #4cae4c;
    border-radius: 5px;
    padding: 5px 10px;
    margin-right: 5px;
}

.incorrect-item {
    background-color: #f8d7da;
    border: 1px solid #dc3545;
    border-radius: 5px;
    padding: 5px 10px;
    margin-right: 5px;
}

.guessed-order-line {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbars on iOS/Android where possible */
.guessed-order-line::-webkit-scrollbar {
    height: 4px;
}
.guessed-order-line::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 10px;
}

/* Make all items uniform */
.order-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    max-width: 100px;
    height: 45px;
    padding: 5px;
    margin: 0 4px;
    background-color: #f0f0f0;
    border-radius: 5px;
    text-align: center;

    /* KEY additions to fix long word overflow */
    white-space: normal;
    word-break: break-word;      /* ← This breaks long single words */
    overflow-wrap: break-word;
    
    font-weight: bold;
    font-size: 14px;
}

.order-number {
    margin-right: 10px;
    font-weight: bold;
    font-size: 14px;
    color: #333;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center; /* vertically center with guess boxes */
    justify-content: center;
    height: 45px; /* match height of .order-item for alignment */
    line-height: 1;
}

/* Coloring for correctness */
.correct-item {
    background-color: #c3e6cb;
    border: 1px solid #4cae4c;
}

.incorrect-item {
    background-color: #f8d7da;
    border: 1px solid #dc3545;
}

#lives-hearts {
  font-size: 1.5em;
  letter-spacing: 0.3em;
}

.share-button {
  display: block;
  margin: 20px auto 0 auto;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 8px;
  border: none;
  background-color: #007BFF; /* bright blue */
  color: white;
}

.share-button:hover {
  background-color: #0069d9; /* slightly darker blue on hover */
}

.mode-toggle {
  display: flex;
  align-items: center;
  justify-content: center; /* This centers it horizontally */
  gap: 10px;
  margin-top: 20px;
  font-family: sans-serif;
  text-align: center;
}


.mode-label {
  font-size: 16px;
  color: #aaa;
  font-weight: normal;
  transition: color 0.3s, font-weight 0.3s;
}

.mode-label.active {
  color: #000;
  font-weight: bold;
}

/* Slider toggle styling */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0;
  right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #4caf50;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

#modeConfirmModal {
  display: none;
  position: fixed;
  z-index: 1001;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  align-items: center;  /* Vertically center */
  justify-content: center;  /* Horizontally center */
}

#modeConfirmModal.show {
  display: flex;
}

#modeConfirmModal .modal-content {
  background-color: #fff;
  padding: 16px 20px;
  border: 1px solid #888;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-sizing: border-box;
  text-align: center;
}

/* Optional: Cap the modal’s max height */
@media (max-height: 500px) {
  #modeConfirmModal .modal-content {
    max-height: 90vh;
    overflow-y: auto;
  }
}



#modeConfirmModal .modal-buttons {
  display: flex;
  justify-content: space-around;
  margin-top: 20px;
}

#modeConfirmModal .modal-buttons button {
  padding: 8px 16px;
  border: none;
  background-color: #0066cc;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}

#modeConfirmModal .modal-buttons button:hover {
  background-color: #004999;
}

.selected-option {
  background-color: #f9f9f9 !important; /* Same as normal to remove blue highlight */
  border: 2px solid #A9A9A9 !important; /* Keep distinct border */
}


.option-move {
  animation: moveOption 0.3s ease;
}

@keyframes moveOption {
  0% {
    transform: scale(1.05);
    background-color: #d9ecff;
  }
  100% {
    transform: scale(1);
    background-color: #f9f9f9; /* original background */
  }
}

#introModal .modal-content {
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.3;
  width: 80%;
  max-width: 400px;
}

#introModal .modal-content h2 {
  margin-top: 4px;
  margin-bottom: 4px;
  font-size: 25px;
}

#introModal .modal-content p {
  margin-bottom: 2px;
  font-size: 15px;
  line-height: 1.4;
}

.selected-option {
    border: 2px solid blue;
    background-color: #eef;
}

.correct-item {
    border: 2px solid green;
    background-color: #cfc;
}

.incorrect-item {
    border: 2px solid red;
    background-color: #fdd;
}

.logo-title {
  width: 80%;
  max-width: 300px;
  height: auto;
  margin: 0 auto 12px;
}

/* Ensure we can position the X inside the content */
#modalContent {
  position: relative;
}

.modal-close-x {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 24px;
  line-height: 1;
  background: transparent;
  border: none;
  cursor: pointer;
}

/* Make the question text bigger on smaller screens */
@media (max-width: 600px) {
  #question {
    font-size: 18px;    /* default is likely around 16px; bump this up */
    line-height: 1.4;   /* keep it readable */
  }
}
