body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", sans-serif;
 background: linear-gradient(135deg, #FFD0A1, #FFE2B0, #FFF3D4);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

h1 {
  font-size: 3rem;
  margin-top: 40px;
  margin-bottom: 0;
  color: #444;
  animation: pulse 2s infinite;
  letter-spacing: 2px;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); color: #444; }
  50% { transform: scale(1.05); color: #3e8ecf; }
}

header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
}

.controls-container {
  display: flex;
  justify-content: center;
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 30px;
  margin-top: 80px;
  background: linear-gradient(135deg, rgba(255, 179, 71, 0.7), rgba(255, 204, 102, 0.7));
  padding: 40px 50px;
  border-radius: 80px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  width: 300px;
  height: 240px;
}

.form-row {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.controls label {
  font-weight: 500;
}

.controls input,
.controls select,
.controls button {
  padding: 10px 16px;
  margin-top: 20px;
  font-size: 1rem;
  width: 150px;
  border-radius: 12px;
  border: none;
  outline: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, background-color 0.3s;
}

.controls button {
  background-color: #67c2ff;
  color: white;
  font-weight: bold;
}

.controls button:hover {
  background-color: #57b2f0;
  transform: scale(1.05);
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  width: 100%;
  max-width: 1000px;
}

.canvas-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  background: white;
  padding: 12px;
  margin-top: 10px;
  border-radius: 16px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  width: fit-content;
  height: fit-content;
}

canvas {
  width: 1000px;
  height: 600px;
  border: 3px solid #fdf5e6;
  border-radius: 10px;
  background-color: white;
  display: block;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  image-rendering: pixelated; /* ensures sharp circles on some displays */
}

#status {
  font-weight: bold;
  margin-top: 0;
  margin-bottom: 10px;
  color: #333;
}

#startBtn,
#restartBtn {
  width: 100px;
  padding: 12px 20px;
  font-size: 1.1rem;
  font-weight: bold;
  background: linear-gradient(145deg, #7bdcff, #3faefc);
  color: white;
  border: none;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(63, 174, 252, 0.4);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  margin-top: 25px;
}

#restartBtn {
  background: #67c2ff;
  border-radius: 12px;
  margin-top: 20px;
}

#restartBtn:hover {
  background-color: #57b2f0;
}

#startBtn:hover {
  transform: scale(1.07);
  box-shadow: 0 8px 18px rgba(63, 174, 252, 0.6);
}

#startBtn:active {
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: scale(0.98);
}

.hidden {
  display: none !important;
}

@media (max-width: 500px) {
  .controls {
    width: 90%;
    padding: 20px 15px;
  }

  h1 {
    font-size: 2rem;
  }

  #startBtn,
  #restartBtn {
    width: auto;
    font-size: 0.9rem;
  }

  canvas {
    width: 90vw;
    height: auto;
  }
}

/* ✅ Prevent selection on double-click for entire body */
body {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* ✅ Remove focus glow from buttons */
button:focus {
  outline: none;
  box-shadow: none;
}

.hidden {
  display: none !important;
}

.button-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px; /* spacing between buttons */
  margin-top: 20px;
}

#restartBtn {
  width: 100px;
  margin-top: auto;
  padding: 12px 20px;
  font-size: 1.1rem;
  font-weight: bold;
  color: white;
  border: none;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1; /* prevents text from stretching button */
}

#undoBtn {
  width: 100px;
 margin-top: auto;
  padding: 12px 20px;
  font-size: 1.1rem;
  font-weight: bold;
  color: white;
  border: none;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1; /* prevents text from stretching button */
}

#restartBtn {
  background: linear-gradient(145deg, #67c2ff, #3faefc);
}

#undoBtn {
  background: linear-gradient(145deg, #ffaa7f, #ff9966);
}

#restartBtn:hover {
  background-color: #57b2f0;
}

#undoBtn:hover {
  background-color: #ff9966;
}
.rules-wrapper {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  font-family: "Segoe UI", sans-serif;
}

.rules-btn {
  background: linear-gradient(145deg, #ffaa7f, #ff9966);
  color: white;
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, background 0.3s ease;
}

.rules-btn:hover {
  background: linear-gradient(145deg, #ff7844, #ff7844);
  transform: scale(1.07);
}

.rules-wrapper {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  font-family: "Segoe UI", sans-serif;
}

.rules-panel {
  position: absolute;
  top: 100%;
  right: 0;
  display: none;
  background: #fff3e8;
  color: #333;
  border: 2px solid #ffd4b8;
  padding: 16px 20px;
  border-radius: 20px;
  width: 260px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  animation: fadeSlide 0.3s ease-in-out;
  font-size: 14px;
  margin-top: 8px;
}

.rules-wrapper:hover .rules-panel {
  display: block;
}


.rules-panel strong {
  display: block;
  margin-bottom: 10px;
  font-size: 16px;
}

.rules-panel ul {
  list-style: disc;
  padding-left: 20px;
  margin: 0;
}

.rules-panel li {
  margin-bottom: 6px;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
