body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #f0f0f0;
  overflow-x: hidden;
}

#start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 90vh;
  text-align: center;
}

#start-screen h1 {
  font-size: 2.5em;
  margin-bottom: 20px;
}

#carousel {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

#carousel-image-wrapper {
  width: 450px;
  height: 450px;
  overflow: hidden;
}

.carousel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#prev-image, #next-image {
  background: #333;
  color: white;
  border: none;
  padding: 10px;
  font-size: 1.5em;
  cursor: pointer;
  margin: 0 10px;
}

#start-button {
  background: #28a745;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 1.2em;
  cursor: pointer;
  border-radius: 5px;
}

#control-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  background: #333;
  padding: 3px;
  z-index: 20;
}

#control-panel button {
  background: #555;
  color: white;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 5px;
}

#puzzle-container {
  position: relative;
  width: 100%;
  height: 100%;
  padding-top: 70px; /* Espaço para o control-panel */
}

#puzzle-board {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.8);
  border: 2px solid #ccc;
  box-sizing: border-box;
}

#puzzle-tiles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.puzzle-tile {
  position: absolute;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  overflow: hidden;
  z-index: 10;
  cursor: grab;
  pointer-events: auto;
}

.puzzle-tile:active {
  cursor: grabbing;
}

.puzzle-tile img {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.grid-quadrant {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.grid-quadrant.highlighted {
  background-color: rgba(0, 255, 0, 0.2);
}

#reference-image {
  position: fixed;
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid #333;
  z-index: 15;
  overflow: hidden;
  display: none;
}

#reference-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#reference-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

#reference-overlay-image {
  max-width: 90%;
  max-height: 70%;
  object-fit: contain;
}

#close-reference {
  background: #dc3545;
  color: white;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  margin-top: 10px;
  border-radius: 5px;
}

#fireworks-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 25;
}

#completion-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  z-index: 30;
  max-width: 80%;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#completion-message h2 {
  margin: 0 0 10px;
  font-size: 1.5em;
}

#play-again {
  background: #28a745;
  color: white;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 5px;
}

@media (max-width: 600px) {
  #carousel-image-wrapper {
    width: 200px;
    height: 200px;
  }

  #start-screen h1 {
    font-size: 2em;
  }

  #control-panel {
    justify-content: flex-start; /* Alinha os botões à esquerda */
    flex-wrap: nowrap; /* Evita quebra de linha */
    gap: 10px; /* Espaçamento entre os botões */
    padding: 8px;
  }

  #control-panel button {
    padding: 6px 12px; /* Reduz o padding */
    font-size: 14px; /* Reduz o tamanho da fonte */
  }


  #reference-overlay-image {
    max-width: 80%;
    max-height: 60%;
  }

  #puzzle-board, #puzzle-tiles {
    margin-top: 15px; /* Aumentado para evitar corte */
  }

  #completion-message {
    max-width: 90%;
    padding: 15px;
  }

  #completion-message h2 {
    font-size: 1.2em;
  }
}