body {
  font-family: Arial, sans-serif;
  margin: 10%;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: #f4f4f9;
}

:root {
  --game-panel-width: min(100%, 760px);
}

* {
  box-sizing: border-box;
}

h1 {
  color: #333;
}

#poemDetails {
  max-width: var(--game-panel-width);
}

.poem-display {
  margin: 20px 0;
  padding: 20px;
  border: 4px solid black;
  border-radius: 5px;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: left;
  transition: border 0.3s ease-in-out;
  user-select: none;
  width: var(--game-panel-width);
}

.line-box {
  padding: 5px;
  margin: 10px 0;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: #e8e8e8;
  min-width: 100px;
  max-width: 100%;
  text-align: left;
  width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.line-box.dragging {
  opacity: 0.5;
}

.line-box.over {
  border: 2px dashed #007bff;
}

.dropdown-item.disabled {
  color: #999 !important;
  background-color: #f0f0f0 !important;
  cursor: not-allowed !important;
  pointer-events: none;
  text-decoration: line-through;
}

.word-bag {
  margin-top: 20px;
  max-width: 100px;
  position: fixed;
  right: 20px; /* Adjust based on your layout */
  z-index: 1000; /* Ensure it stays above other elements */
  top: 50px;
}

.dropdown-toggle {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  margin-top: 5px;
  width: 100%;
  text-align: left;
  max-width: 100%;
}

.word-box {
  margin-top: 5px;
  margin-right: 10px;
  width: 100px;
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: #e8e8e8;
  max-width: 100px;
  text-align: center;
  cursor: grab;
  float: right;
}

.word-box.dragging {
  opacity: 0.5;
}

.word-box.over {
  border: 2px dashed #007bff;
}

.word-box.completed {
  border-color: lightgreen;
  border-width: 4px;
}

.poem-display.correct {
  border-color: green;
  border-width: 6px;
  animation: flash-border-correct 0.5s alternate infinite;
}

.poem-display.incorrect {
  border-color: red;
  border-width: 6px;
  animation: flash-border-incorrect 0.5s alternate infinite;
}

.line-box.correct {
  border-color: green;
  border-width: 6px;
  animation: flash-border-correct 0.5s alternate infinite;
}

.line-box.completed {
  border-color: lightgreen;
  border-width: 4px;
}

.line-box.incorrect {
  border-color: orangered;
  border-width: 4px;
  animation: flash-border-incorrect 0.5s alternate infinite;
}

.line-box.attempted {
  border-color: red;
  border-width: 4px;
}

.ordered-lines {
  margin-top: 20px;
  padding: 10px;
  border: 2px solid #ddd;
  background-color: #f9f9f9;
  width: var(--game-panel-width);
}

.ordered-lines .chunk {
  margin-bottom: 10px;
  border-top: 1px solid #ccc;
  padding-top: 10px;
}

.instructions {
  margin-top: 10px;
  padding: 10px;
  font-size: 14px;
  color: black;
  text-align: center;
  width: var(--game-panel-width);
}

.progress-bar {
  margin: 10px 0;
  padding: 10px;
  font-size: 14px;
  text-align: center;
  color: #333;
  background-color: #0d6efd2b;
  width: var(--game-panel-width);
}

.progress-bar.out-of-moves {
  margin: 10px 0;
  padding: 10px;
  font-size: 14px;
  text-align: center;
  color: #000;
  background-color: red;
}

.score {
  font-size: 16px;
  margin-bottom: 10px;
}

.next-verse {
  margin-top: 20px;
  margin-left: auto;
  margin-right: auto;
  padding: 10px 20px;
  font-size: 16px;
  color: white;
  background-color: #007bff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  display: block;
  width: 100%;
  max-width: 130px;
}

.next-verse:hover {
  background-color: #0056b3;
}

.next-verse:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

footer {
  margin-top: 20px;
}

@media (max-width: 768px) {
  :root {
    --game-panel-width: 100%;
  }

  body {
    margin: 0;
    padding: 10px;
    min-height: auto;
  }

  h1 {
    text-align: center;
    font-size: 1.5rem;
    line-height: 1.2;
  }

  #poemDetails,
  .poem-display,
  .ordered-lines,
  .instructions,
  .progress-bar {
    width: 100%;
    max-width: 100%;
  }

  .poem-display {
    padding: 12px;
    margin: 12px 0;
  }

  .line-box {
    margin: 8px 0;
    min-width: 0;
    max-width: 100%;
  }

  .dropdown-toggle {
    white-space: normal;
    width: 100%;
    overflow-wrap: anywhere;
  }

  .word-bag {
    position: static;
    right: auto;
    top: auto;
    max-width: 100%;
    width: 100%;
    margin-top: 12px;
  }

  .word-box {
    float: none;
    width: 100%;
    max-width: 100%;
    margin-right: 0;
  }

  .next-verse {
    width: 100%;
    max-width: 100px;
    font-size: 14px;
  }

  footer {
    margin-top: 20px;
    text-align: center;
    padding: 0 6px;
  }
}

@keyframes flash-border-correct {
  0% {
    border-color: green;
  }

  100% {
    border-color: lightgreen;
  }
}

@keyframes flash-border-incorrect {
  0% {
    border-color: red;
  }

  100% {
    border-color: rgb(241, 234, 234);
  }
}
