@import url("https://fonts.googleapis.com/css?family=Comfortaa");

/* Estilos para el título (igual que cupones) */
.title-large {
  font-size: 36px;
  margin-bottom: 15px;
  color: #333;
}

.text-center {
  text-align: center;
}

.subtitle {
  color: #666;
  font-size: 18px;
  margin-bottom: 40px;
}

/* Tower Game Styles */
.game-section {
  padding: 40px 0;
}

.game-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  height: 600px;
  overflow: hidden;
  background-color: #f7f7f7;
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
  margin-top: 30px;
}

/* Leaderboard styles */
.leaderboard-container {
  max-width: 900px;
  margin: 30px auto;
  padding: 20px;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.leaderboard-title {
  text-align: center;
  color: #333;
  margin-bottom: 20px;
  font-size: 24px;
  border-bottom: 2px solid #DE826B;
  padding-bottom: 10px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 auto;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.leaderboard-table th {
  background-color: #f8f8f8;
  font-weight: 600;
  color: #333;
}

.leaderboard-table tr:hover {
  background-color: #f5f5f5;
}

.leaderboard-table .current-user {
  background-color: rgba(222, 130, 107, 0.1);
  font-weight: bold;
}

.separator-row {
  height: 20px;
}

.separator-line {
  border-bottom: 2px solid #DE826B !important;
  position: relative;
  padding: 0 !important;
}

.separator-line::before {
  content: "···";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  color: #DE826B;
  font-size: 18px;
  font-weight: bold;
  padding: 0 10px;
  letter-spacing: 5px;
}

.no-scores {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 20px;
}

.personal-best-container {
  max-width: 900px;
  margin: 20px auto;
  text-align: center;
  font-size: 18px;
  color: #333;
}

.personal-best-container h3 {
  display: inline-block;
  padding: 10px 20px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.personal-best-container span {
  color: #DE826B;
  font-weight: bold;
  font-size: 22px;
}

/* Existing game styles */
#container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#game {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#score {
  position: absolute;
  top: 20px;
  width: 100%;
  text-align: center;
  font-size: 30px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

#instructions {
  position: absolute;
  width: 100%;
  bottom: 20px;
  text-align: center;
  color: #fff;
  font-size: 16px;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.game-over, .game-ready {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.7);
  color: #fff;
  text-align: center;
  z-index: 3;
}

.game-over {
  display: none;
}

.game-ready.hide,
.game-over.hide {
  display: none;
}

.game-ready h2, .game-over h2 {
  font-size: 36px;
  margin-bottom: 15px;
}

.game-ready p, .game-over p {
  font-size: 18px;
  margin-bottom: 10px;
}

/* Add these styles for the restart message and saving score message */
.restart-message {
  font-weight: bold;
  margin-top: 15px;
  color: #4CAF50;
  cursor: pointer;
}

.saving-score-message {
  margin-top: 15px;
  font-size: 16px;
  animation: pulsate 1.5s infinite alternate;
}

@keyframes pulsate {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

/* Modify game-over to ensure it properly shows messages */
.game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.7);
  color: #fff;
  text-align: center;
  z-index: 3;
  padding: 20px;
}

.game-over p {
  margin: 8px 0;
}

/* Add these styles to ensure the start button is clearly visible and clickable */

#start-button {
  background-color: #DE826B;
  color: white;
  padding: 15px 40px;
  font-size: 20px;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.3s ease;
  user-select: none;
  position: relative;
  z-index: 10;
}

#start-button:hover {
  background-color: #c66b55;
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

#start-button:active {
  transform: scale(0.98);
}

/* Make sure game-ready is visible in ready state */
#container.ready .game-ready {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Fix for button click inside the container */
.game-ready {
  pointer-events: auto;
}

#container.playing .game-ready {
  display: none;
}

#container.ready .game-ready {
  display: flex;
}

#container.ended .game-over {
  display: flex;
}

/* Fix for Three.js canvas centering */
canvas {
  display: block;
  margin: 0 auto;
  width: 100% !important;
  height: 100% !important;
  position: absolute;
  top: 0;
  left: 0;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
  .game-container {
    height: 450px;
  }
  
  #score {
    font-size: 24px;
  }
  
  #instructions {
    font-size: 14px;
  }
  
  .game-ready h2, .game-over h2 {
    font-size: 28px;
  }
  
  .game-ready p, .game-over p {
    font-size: 16px;
  }
  
  #start-button {
    padding: 12px 30px;
    font-size: 18px;
  }
  
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 8px 10px;
    font-size: 14px;
  }
  
  .leaderboard-title {
    font-size: 20px;
  }
  
  .personal-best-container {
    font-size: 16px;
  }
  
  .personal-best-container span {
    font-size: 18px;
  }

  .separator-line::before {
    font-size: 14px;
    padding: 0 5px;
  }
}

@media screen and (max-width: 480px) {
  .game-container {
    height: 350px;
  }
  
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 6px 8px;
    font-size: 12px;
  }
  
  .leaderboard-container {
    padding: 15px 10px;
  }

  .separator-row {
    height: 15px;
  }

  .separator-line::before {
    font-size: 12px;
    padding: 0 3px;
    letter-spacing: 3px;
  }
}

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

.login-modal-content {
  background-color: #fff;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 500px;
  position: relative;
  animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
  from {opacity: 0; transform: scale(0.9);}
  to {opacity: 1; transform: scale(1);}
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  color: #777;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.close-modal:hover {
  color: #DE826B;
}

.login-modal-content h2 {
  color: #333;
  font-size: 24px;
  margin-top: 0;
  margin-bottom: 15px;
  text-align: center;
}

.login-modal-content p {
  color: #555;
  font-size: 16px;
  margin-bottom: 25px;
  text-align: center;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.modal-button {
  padding: 12px 25px;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  text-align: center;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.login-button {
  background-color: #DE826B;
  color: white;
}

.login-button:hover {
  background-color: #c66b55;
}

.cancel-button {
  background-color: #f0f0f0;
  color: #333;
}

.cancel-button:hover {
  background-color: #e0e0e0;
}

/* High score message styling */
.high-score-message {
  color: #ffcc00;
  font-size: 22px;
  font-weight: bold;
  margin: 10px 0;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.7);
  animation: pulseText 1s infinite alternate;
}

@keyframes pulseText {
  from {opacity: 0.8; transform: scale(1);}
  to {opacity: 1; transform: scale(1.05);}
}

/* Success and Error message styles */
.message {
    margin: 20px auto;
    padding: 15px;
    border-radius: 5px;
    max-width: 900px;
    text-align: center;
    font-weight: bold;
    animation: fadeIn 0.5s;
}

.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

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

/* Add styles for the promotional text */
.promo-text {
  margin: 15px auto 20px;
  padding: 10px 15px;
  background-color: #DE826B; /* Salmón del sitio */
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  max-width: 800px;
  box-shadow: 0 6px 16px rgba(222,130,107,0.35);
  font-size: 18px;
  line-height: 1.4;
}

.promo-text p {
  margin: 0;
}

@media screen and (max-width: 768px) {
  .promo-text {
    font-size: 16px;
    padding: 8px 12px;
  }
}
