/* Core Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
}

body {
  background-color: black;
  transition: background-color 0.3s;
}

/* Footer UI */
#ui-elements {
  position: fixed;
  width: 100%;
  height: 100%;
  transition: opacity 0.5s ease;
  opacity: 1;
  pointer-events: none;
}

footer {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: sans-serif;
  pointer-events: auto;
  display: flex;
  justify-content: center;
  gap: 14px;
}

.button-wrapper {
  position: relative;
}

/* Icon Buttons (smaller) */
.icon-btn {
  background: white;
  border: none;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}

.icon-btn:hover {
  transform: scale(1.05);
}

.icon-btn img {
  width: 26px;
  height: 26px;
  display: block;
}

/* Help button in bottom-right */
.help-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: white;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  font-weight: bold;
  width: 28px;
  height: 28px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

/* Help Popup (Centered above buttons) */
#help-popup {
  position: absolute;
  bottom: 75px; /* Slightly above the buttons */
  left: 50%;
  transform: translateX(-50%); /* Center horizontally */
  background: rgba(255, 255, 255, 0.95);
  color: #000;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  font-family: sans-serif;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  display: none;
  pointer-events: none;
  width: max-content;
  white-space: nowrap;
}

/* Custom Color Picker Popup (at the same location as help popup) */
#color-picker-popup {
  position: absolute;
  bottom: 75px; /* Same as help popup */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  color: #000;
  padding: 16px;
  border-radius: 8px;
  font-size: 14px;
  font-family: sans-serif;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  display: none;
  width: 250px;
  pointer-events: auto;
}

#color-picker-popup div {
  margin-bottom: 10px;
}

#color-picker-popup input[type="range"] {
  width: 100%;
}

#color-picker-popup input[type="text"] {
  width: 100%;
  padding: 8px;
  margin-top: 5px;
  font-size: 14px;
}

#color-picker-popup button {
  padding: 8px 16px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

#color-picker-popup button:hover {
  background-color: #45a049;
}

/* Color Swatches */
#color-swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.color-box {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #ddd;
  cursor: pointer;
}

.color-box:hover {
  opacity: 0.8;
}

.color-box:active {
  opacity: 0.6;
}
