body {
  background-color: #222;
  color: white;
  font-family: sans-serif;
  text-align: center;
  margin: 0;
  padding: 0;
}

canvas {
  border: 2px solid #fff;
  margin-top: 20px;
}

#currentWord {
  margin-top: 10px;
  font-size: 1.5rem;
  color: #ffb;
}
#wordText {
  font-weight: bold;
  color: #fff;
}
#dictionaryCount {
  font-weight: bold;
  color: #fff;
}
#hud {
  margin-top: 15px;
  color: #fff;
  font-family: sans-serif;
  font-size: 1.2rem;
}
#score {
  margin-top: 5px;
  color: #ffb;
}

.flash {
  filter: brightness(1.5);
  transition: filter 0.15s ease;
}

#wordPopups {
  position: relative;
  width: 100%;
  height: 0;
  pointer-events: none; /* so it doesn't block mouse input */
}

.wordPopup {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-family: 'Arial', sans-serif;
  font-weight: bold;
  font-size: 1.6rem;
  text-shadow: 0 0 5px rgba(0,0,0,0.6);
  opacity: 0;
  animation: popupFloat 2s ease-out forwards;
  white-space: nowrap;
}

.wordPopup.newWord {
  color: #4caf50;
  font-size: 2rem;
  animation: popupFloat 3s ease-out forwards;
}

.wordPopup.invalidWord {
  color: #ff3b3b;
}

@keyframes popupFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  10% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -30px);
  }
}

/* Center the canvas in the viewport */
#gameWrapper {
  position: relative; /* needed for absolute positioning of dictionary */
  width: 100%;
  display: flex;
  justify-content: center; /* center the canvas horizontally */
  margin-top: 0px; /* optional top offset */
}

/* The dictionary is positioned relative to the canvas */
#dictionaryContainer {
  position: absolute;
  left: calc(50% + 300px); /* 50% = canvas center, 300px = half canvas width + margin */
  top: 20px; /* top aligned with canvas */
  width: 300px;
  max-height: 580px; /* same as canvas height */
  overflow-y: auto;
  border: 2px solid #fff;
  background-color: #111;
  padding: 10px;
  color: #fff;
}

#dictionaryHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

#dictionaryHeader button {
  background-color: #333;
  border: 1px solid #fff;
  color: #fff;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 0.9rem;
}

#dictionaryList div {
  padding: 2px 0;
}

.dictionaryEntry {
  display: flex;
  justify-content: space-between; /* word left, score right */
  padding: 2px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1); /* optional separator */
}

.wordText {
  text-align: left;
}

.scoreText {
  text-align: right;
}

#shuffleContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 10px;
}

#shuffleBarOuter {
  width: 600px;
  height: 16px;
  border: 2px solid #fff;
  background-color: #333;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 6px;
  cursor: not-allowed; /* default disabled state */
  position: relative;
  user-select: none;
}

/* enabled/ready state */
#shuffleBarOuter.ready {
  cursor: pointer;
  border-color: #3cd35f;
  box-shadow: 0 0 6px rgba(60,211,95,0.12);
}
 
/* label centered on the bar */
#shuffleLabel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-weight: bold;
  border-color: #777;
  top: 7px;
  font-size: 0.9rem;
  pointer-events: none;
  white-space: nowrap;
}

#shuffleBarInner {
  height: 100%;
  width: 0%;
  background-color: #4caf50;
  transition: width 0.3s ease;
}

#resetConfirm {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
#resetConfirm.hidden { display: none; }
.modal {
  background: #222;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  color: white;
}
.modal button {
  margin: 10px;
}
#resetButton {
  background-color: #a53935; /* red */
  color: #fff;
  border: 1px solid #571c1c;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.12s ease, transform 0.06s ease;
  margin-top: 10px;
}