/* Global Reset & Box Sizing */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 10px;
  padding: 10px;
  height: 100%;
  font-family: Arial, sans-serif;
  background: #f0f0f0;
}
h1 {
  margin-bottom: 10px;
}
p {
  margin-bottom: 20px;
}

/* Layout: Full-screen responsive container */
#game-container {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}
.container {
  border: 2px dashed #ccc;
  background: #fff;
  padding: 10px;
  flex: 1 1 400px;
  max-width: 500px;
  /* Setting a fixed height for scrollable area */
  height: 400px;
  overflow-y: auto;
  position: relative;
}
.container h2 {
  margin-top: 0;
}

/* Right container: layout for draggable letters */
#right-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.draggable {
  margin: 10px;
  padding: 5px;
  border: 2px solid #333;
  border-radius: 4px;
  background: #ffecb3;
  font-size: 32px;
  cursor: move;
  user-select: none;
  transition: transform 0.2s ease;
}
.draggable.dragging {
  transform: scale(1.1);
}

/* Left container: each placed letter becomes a card */
.placed-letter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 2px solid #333;
  border-radius: 4px;
  background: #ffecb3;
  padding: 5px 10px;
  margin: 5px 0;
  font-size: 32px;
  cursor: move;
  user-select: none;
}
.placed-letter.dragging {
  background: #d0f0d0;
}
/* Remove button for placed letters */
.remove-btn {
  color: red;
  cursor: pointer;
  font-size: 24px;
  margin-left: 10px;
}

/* Control buttons styling */
#control-buttons {
  margin-top: 20px;
}
button {
  padding: 10px 20px;
  margin: 5px;
  font-size: 16px;
  cursor: pointer;
}

/* Correct Order Panel */
#correct-order {
  display: none;
  margin-top: 20px;
  padding: 10px;
  border: 2px dashed #666;
  background: #fff;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}
#correct-order h2 {
  margin-top: 0;
}
#correct-order .letter {
  display: inline-block;
  margin: 5px;
  padding: 5px 8px;
  border: 2px solid #333;
  border-radius: 4px;
  background: lightskyblue;
  font-size: 32px;
}

/* Popup overlay for feedback */
#popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
#popup-message {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  font-size: 24px;
}

/* Confetti animation when perfect score is reached */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background: red;
  animation: confettiFall 3s linear forwards;
  opacity: 0;
}
@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Responsive design adjustments */
@media (max-width: 768px) {
  #game-container {
    flex-direction: column;
  }
  .container {
    max-width: 100%;
  }
}
