body {
  font-family: sans-serif;
  background: #f8f4e3;
  padding: 20px;
  text-align: center;
}

h2 {
  color: #9b7b4d;
}

#escenario {
  background-size: cover;
  background-position: center;
  position: relative;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 3 / 2;
  margin: auto;
  border: 4px solid #9b7b4d;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

#bandeja {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding: 10px;
  background: #fff9ec;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.pieza {
  width: 10%; 
  max-width: 70px;
  cursor: grab;
  margin: 5px;
  transition: transform 0.2s ease;
}

.pieza:hover {
  transform: scale(1.05);
}

.pieza-colocada {
  position: absolute;
  cursor: grab;
  max-width: 12%; 
}

#controles {
  margin-top: 15px;
}

.marca-agua {
  position: absolute;
  bottom: 5px;
  right: 10px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: bold;
  background-color: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  user-select: none;
}

button {
  background-color: #9b7b4d;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#controles button {
  padding: 10px 20px;
}

button:hover {
  background-color: #b4905a;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-contenido {
  background-color: #fff9ec;
  padding: 30px;
  border-radius: 15px;
  max-width: 90%;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  position: relative;
  text-align: center;
}

.cerrar-modal {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #9b7b4d;
}

.opciones-finalizar {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.opcion-btn {
  padding: 12px;
  background-color: #9b7b4d;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.redes-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  background-color: #9b7b4d;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.opcion-btn:hover {
  background-color: #b4905a;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
  }
  to {
    transform: translateY(0);
  }
}

.modal.mostrar {
  display: flex;
  animation: fadeIn 0.3s forwards;
}

.modal-contenido.mostrar {
  animation: slideUp 0.3s forwards;
}

@media (max-width: 768px) {
  .pieza {
    width: 14%;
    max-width: 60px;
  }

  .pieza-colocada {
    max-width: 15%;
  }

  #escenario {
    width: 95%;
    height: auto;
    aspect-ratio: 3 / 2;
  }

  .modal-contenido {
    padding: 20px;
  }

  button,
  .opcion-btn,
  .redes-btn {
    font-size: 14px;
    padding: 10px;
  }

  .marca-agua {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .pieza {
    width: 18%;
    max-width: 50px;
  }

  .pieza-colocada {
    max-width: 10%;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  #escenario,
  #escenario * {
    visibility: visible;
  }

  #escenario {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
  }
}

.footer {
  text-align: center;
  padding: 15px;
  font-size: 14px;
  color: #9b7b4d;
  margin-top: 70px;
}

@media (max-width: 768px) {
  .footer {
    font-size: 13px;
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .footer {
    font-size: 12px;
    padding: 10px;
  }
}
