/* Variables necesarias */
:root {
  --primary-color: rgba(1, 1, 1, 0.9);
  --secondary-color: #ff8c42;
  --accent-color: #4a6fa5;
  --white: #ffffff;
  --black: #000000;
  --light-gray: #f5f5f5;
  --dark-gray: #333333;
  --correct-color: #4caf50;
  --incorrect-color: #f44336;
  --warning-color: #ff9800;
  --info-color: #2196f3;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --border-radius: 12px;
}

/* Reset básico */
* {
  font-family: "Poppins", sans-serif;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Header Styles */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--primary-color);
  padding: 0 10%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border-bottom: 2px solid var(--secondary-color);
  transition: all 0.3s ease;
}

.header:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  letter-spacing: 1px;
}

.navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header .navigation ul li {
  float: left;
  position: relative;
}

.header .navigation ul li a {
  font-size: 16px;
  font-weight: 500;
  color: var(--white);
  text-decoration: none;
  padding: 22px 20px;
  display: block;
  transition: all 0.3s ease;
}

.header .navigation ul li a:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  color: var(--black);
}

#toggle,
.header label {
  display: none;
  cursor: pointer;
}

.menu {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
}

/* Animación para el menú desplegable */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Ajuste para el body debido al header fijo */
body {
  padding-top: 80px;
  background-color: var(--light-gray);
  color: var(--dark-gray);
  line-height: 1.6;
}

/* Estilos generales del contenedor */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Sección de Instrucciones */
.instructions-section {
  background-color: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 30px;
  margin-bottom: 30px;
}

.instructions-section h1 {
  color: var(--accent-color);
  margin-bottom: 20px;
  font-size: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.instructions-section h2 {
  color: var(--dark-gray);
  margin-bottom: 15px;
  font-size: 22px;
}

.instructions-container p {
  margin-bottom: 25px;
  font-size: 17px;
  color: #555;
}

.grammar-rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

.rule-card {
  background-color: var(--light-gray);
  border-radius: var(--border-radius);
  padding: 20px;
  border-top: 4px solid var(--accent-color);
}

.rule-card h3 {
  color: var(--accent-color);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
}

.formula {
  background-color: var(--white);
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  border-left: 3px solid var(--secondary-color);
  font-family: monospace;
  font-size: 16px;
  color: var(--dark-gray);
}

.example {
  background-color: #f8f9fa;
  padding: 12px;
  border-radius: 8px;
  margin-top: 10px;
}

.highlight {
  color: var(--secondary-color);
  font-weight: 600;
}

.note {
  font-size: 14px;
  color: #666;
  font-style: italic;
  margin-top: 10px;
  padding: 8px;
  background-color: #fff3cd;
  border-radius: 4px;
  border-left: 3px solid #ffc107;
}

.usage-examples {
  margin: 30px 0;
}

.usage-examples h3 {
  color: var(--dark-gray);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.usage-item {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: var(--border-radius);
  padding: 20px;
  text-align: center;
  transition: transform 0.3s ease;
}

.usage-item:hover {
  transform: translateY(-5px);
}

.usage-item i {
  font-size: 32px;
  color: var(--accent-color);
  margin-bottom: 15px;
}

.usage-item h4 {
  color: var(--dark-gray);
  margin-bottom: 10px;
}

.usage-item p {
  font-size: 14px;
  color: #666;
  font-style: italic;
}

.start-button-container {
  text-align: center;
  margin-top: 30px;
}

/* Botones */
.btn-primary, .btn-secondary, .option-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-primary {
  background-color: var(--secondary-color);
  color: var(--black);
}

.btn-primary:hover {
  background-color: #e67e22;
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
  background-color: var(--accent-color);
  color: var(--white);
}

.btn-secondary:hover {
  background-color: #3a5a8a;
  transform: translateY(-3px);
}

.btn-secondary:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  transform: none;
}

/* Sección del Juego */
.game-section {
  background-color: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 30px;
  margin-bottom: 30px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  background-color: var(--light-gray);
  padding: 15px 20px;
  border-radius: var(--border-radius);
  flex-wrap: wrap;
  gap: 15px;
}

.score-container, .progress-container, .timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
}

.score-label, .progress-label {
  font-size: 14px;
  color: #777;
  margin-bottom: 5px;
}

.score {
  font-size: 32px;
  font-weight: 700;
  color: var(--secondary-color);
}

.progress-container {
  flex-grow: 1;
  max-width: 300px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background-color: var(--accent-color);
  width: 10%;
  transition: width 0.3s ease;
}

.timer-container {
  background-color: var(--accent-color);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-container i {
  font-size: 18px;
}

#timer {
  font-size: 24px;
  font-weight: 700;
}

.game-card {
  background-color: var(--light-gray);
  border-radius: var(--border-radius);
  padding: 30px;
}

.question-container {
  margin-bottom: 30px;
}

#question-type {
  color: var(--dark-gray);
  margin-bottom: 10px;
  font-size: 18px;
}

.question-text {
  background-color: var(--white);
  padding: 25px;
  border-radius: var(--border-radius);
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 2px solid var(--accent-color);
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

@media (max-width: 768px) {
  .options-grid {
    grid-template-columns: 1fr;
  }
}

.option-btn {
  background-color: var(--white);
  color: var(--dark-gray);
  padding: 20px;
  text-align: left;
  border: 2px solid #ddd;
  font-size: 18px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 15px;
}

.option-btn:hover {
  border-color: var(--accent-color);
  background-color: #f0f7ff;
}

.option-btn.correct-answer {
  background-color: #d4edda;
  border-color: var(--correct-color);
  color: #155724;
}

.option-btn.incorrect-answer {
  background-color: #f8d7da;
  border-color: var(--incorrect-color);
  color: #721c24;
}

.option-number {
  background-color: var(--accent-color);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.feedback-container {
  margin-bottom: 25px;
}

.feedback {
  padding: 15px;
  border-radius: var(--border-radius);
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.feedback.correct {
  background-color: #d4edda;
  color: #155724;
  border-left: 4px solid var(--correct-color);
}

.feedback.incorrect {
  background-color: #f8d7da;
  color: #721c24;
  border-left: 4px solid var(--incorrect-color);
}

.feedback.hint {
  background-color: #fff3cd;
  color: #856404;
  border-left: 4px solid var(--warning-color);
}

.game-controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.rules-summary {
  margin-top: 30px;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--secondary-color);
}

.rules-summary h4 {
  color: var(--dark-gray);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.rules-summary ul {
  list-style: none;
  padding-left: 0;
}

.rules-summary li {
  margin-bottom: 8px;
  padding-left: 25px;
  position: relative;
}

.rules-summary li:before {
  content: "✓";
  color: var(--correct-color);
  font-weight: bold;
  position: absolute;
  left: 0;
}

/* Sección de Práctica */
.practice-section {
  background-color: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 30px;
  margin-bottom: 30px;
}

.practice-section h2 {
  color: var(--accent-color);
  margin-bottom: 25px;
  font-size: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.practice-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

@media (max-width: 992px) {
  .practice-container {
    grid-template-columns: 1fr;
  }
}

.sentence-builder {
  background-color: var(--light-gray);
  border-radius: var(--border-radius);
  padding: 25px;
}

.sentence-builder h3 {
  color: var(--dark-gray);
  margin-bottom: 20px;
}

.builder-controls {
  margin-bottom: 25px;
}

.builder-part {
  margin-bottom: 20px;
}

.builder-part label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--dark-gray);
}

.builder-input {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.builder-static {
  font-weight: 600;
  color: var(--accent-color);
  padding: 8px 12px;
  background-color: var(--white);
  border-radius: 4px;
  border: 1px solid #ddd;
}

.builder-select, .builder-text {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  min-width: 120px;
}

.builder-text {
  flex-grow: 1;
  min-width: 150px;
}

.built-sentence {
  margin: 25px 0;
  text-align: center;
}

.sentence-display {
  background-color: var(--white);
  padding: 20px;
  border-radius: var(--border-radius);
  font-size: 20px;
  margin: 15px 0;
  border: 2px dashed var(--accent-color);
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.examples-box {
  margin-top: 25px;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: var(--border-radius);
}

.examples-box h4 {
  color: var(--dark-gray);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.example-item {
  background-color: var(--white);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  border-left: 3px solid var(--secondary-color);
}

.stats-panel {
  background-color: var(--light-gray);
  border-radius: var(--border-radius);
  padding: 25px;
}

.stats-panel h3 {
  color: var(--dark-gray);
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

.stat-card {
  background-color: var(--white);
  border-radius: var(--border-radius);
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-icon.correct {
  background-color: #d4edda;
  color: var(--correct-color);
}

.stat-icon.incorrect {
  background-color: #f8d7da;
  color: var(--incorrect-color);
}

.stat-icon.streak {
  background-color: #fff3cd;
  color: #ff9800;
}

.stat-icon.accuracy {
  background-color: #cce5ff;
  color: var(--info-color);
}

.stat-info h4 {
  font-size: 14px;
  color: #777;
  margin-bottom: 5px;
}

.stat-info p {
  font-size: 24px;
  font-weight: 700;
  color: var(--dark-gray);
}

.tips-box {
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--warning-color);
}

.tips-box h4 {
  color: var(--dark-gray);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tips-box ul {
  list-style: none;
  padding-left: 0;
}

.tips-box li {
  margin-bottom: 8px;
  padding-left: 25px;
  position: relative;
}

.tips-box li:before {
  content: "💡";
  position: absolute;
  left: 0;
}

/* Footer */
.footer {
  background-color: var(--primary-color);
  color: var(--white);
  text-align: center;
  padding: 25px;
  margin-top: 30px;
}

.footer p {
  margin-bottom: 10px;
}

.copyright {
  font-size: 14px;
  color: #aaa;
}

/* Media Queries para responsive */
@media (max-width: 950px) {
  .header label {
    display: initial;
  }

  .header {
    padding: 15px 10%;
  }

  .header .navigation {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary-color);
    display: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  .header .navigation ul li {
    width: 100%;
  }

  .header .navigation ul li a {
    padding: 12px 20px;
    font-size: 18px;
  }

  #toggle:checked ~ .navigation {
    display: block;
    animation: slideDown 0.4s ease-out;
  }
  
  .game-header {
    flex-direction: column;
    text-align: center;
  }
  
  .score-container, .progress-container, .timer-container {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 768px) {
  .grammar-rules {
    grid-template-columns: 1fr;
  }
  
  .usage-grid {
    grid-template-columns: 1fr;
  }
  
  .game-controls {
    flex-direction: column;
  }
  
  .btn-primary, .btn-secondary, .option-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 22px;
  }

  .header {
    padding: 12px 5%;
  }
  
  .question-text {
    font-size: 18px;
    padding: 15px;
  }
  
  .builder-input {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .builder-select, .builder-text {
    width: 100%;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}