/* 🧱 Estructura base */
html, body {
  touch-action: manipulation;
  font-family: system-ui, sans-serif;
  margin: 0;
  padding: 0;
}

/* 🌟 Contenidor general del joc */
.game-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0.4rem 0rem 0rem;
  width: 100%;
}

.game-wrapper {
  min-height: calc(100vh - 30rem);
}

/* 🔝 Barra superior sticky amb marcador i botó */
.game-header {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background-color: white;
  border-bottom: 1px solid #ddd;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 10;
}
.scoreboard {
  grid-column: 1 / 2;
  grid-row: 1;
}

.reset-button {
  grid-column: 2 / 3;
  grid-row: 1;
}

.extra-content {
  grid-column: 1 / 3; /* ocupa les 2 columnes */
  grid-row: 2;
}

/* 🧮 Marcador de punts */
.scoreboard {
  font-size: 1.1rem;
  font-weight: bold;
  color: #333;
}

/* 🔄 Botó de reinici */
.reset-button {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.reset-button:hover {
  background-color: #ffeeba;
}

/* 📦 Contenidor de la pregunta */
.question-container {
  background: white;
  padding: 2rem;
  border-radius: 1rem;
  max-width: 520px;
  margin: 2rem auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  text-align: center;
}
@media screen and (max-width: 800px) {
  .question-container {
    max-width: 100%;
    padding: 0px;
    margin: 0 px;
  }
}

/* ❓ Títol de la pregunta */
.question-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: #222;
}

/* 🔘 Opcions */
.option-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-button {
  width: 100%;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 2px solid #ccc;
  background-color: #f7f7f7;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-button:hover {
  background-color: #e9ecef;
}

.option-button.correct {
  background-color: #d4edda;
  border-color: #28a745;
  color: #155724;
}

.option-button.incorrect {
  background-color: #f8d7da;
  border-color: #dc3545;
  color: #721c24;
}

.option-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ▶️ Botó de següent */
.next-button {
  margin-top: 1rem;
  background-color: #007bff;
  border: none;
  color: white;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
}

.next-button:hover {
  background-color: #0056b3;
}

/* 🎉 Feedback visual */
.answer-feedback {
  margin-top: 2rem;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: bold;
  animation: fadeIn 0.3s ease;
}

.answer-feedback.correcte {
  background-color: #d4edda;
  color: #155724;
  border: 2px solid #28a745;
}

.answer-feedback.incorrecte {
  background-color: #f8d7da;
  color: #721c24;
  border: 2px solid #dc3545;
}

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


@keyframes pulse {
  0% { transform: scale(1); background-color: #d4edda; }
  50% { transform: scale(1.05); background-color: #bce5c6; }
  100% { transform: scale(1); background-color: #d4edda; }
}

.animate-pulse-correcte {
  animation: pulse 0.6s ease;
}

/* 📱 Responsivitat mòbil */
@media (max-width: 800px) {
  .game-container {
    max-width: 100%;
    border: 1px solid #ddd;
    padding: 0px;
    border-radius: 0.5rem;
  }
  
  .game-header {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
  }

  .scoreboard,
  .reset-button,
  .extra-content {
    grid-column: 1;
  }

  .reset-button {
    width: 100%;
  }
}


/* 🌐 Estils per el raning */
.ranking-container {
  max-width: 600px;
  margin: 2rem auto;
  padding: 1rem;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

.ranking-container h2 {
  text-align: center;
  margin-bottom: 1rem;
}

.ranking-list {
  list-style: none;
  padding: 0;
}

.ranking-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
}

.ranking-user {
  font-weight: bold;
}

.ranking-score {
  font-family: monospace;
}

