/* ============================================
   Preposiciones Study App — Tema Preposiciones 🔤
   Principal=#3498db  Infrecuente=#9b59b6
   Correct=#27ae60    Incorrect=#e74c3c
   ============================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', 'Arial Rounded MT Bold', Arial, sans-serif;
  background: linear-gradient(135deg, #eaf6ff 0%, #fff 50%, #fef9e7 100%);
  color: #222;
  min-height: 100vh;
  padding: 16px;
  font-size: 18px;
  line-height: 1.5;
}

/* ---- Views ---- */
.view {
  display: none;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}
.view.active {
  display: block;
}

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

/* ---- Typography ---- */
h1 {
  font-size: 2.2rem;
  text-align: center;
  color: #2c3e50;
  margin-bottom: 8px;
}
h2 {
  font-size: 1.6rem;
  text-align: center;
  color: #2c3e50;
  margin-bottom: 16px;
}
h3 {
  font-size: 1.25rem;
  margin: 20px 0 8px;
  padding-bottom: 4px;
}
.subtitle {
  text-align: center;
  font-size: 1.15rem;
  color: #555;
  margin-bottom: 24px;
}

/* ---- Main Menu Grid ---- */
.menu-grid {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
.menu-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 220px;
  padding: 24px 16px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  color: #fff;
}
.menu-btn:hover,
.menu-btn:focus {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  outline: 3px solid #2c3e50;
}
.menu-btn--guide {
  background: linear-gradient(135deg, #3498db, #5dade2);
}
.menu-btn--practice {
  background: linear-gradient(135deg, #e74c3c, #ec7063);
}
.menu-emoji { font-size: 2.5rem; }
.menu-title { font-size: 1.2rem; font-weight: 700; }

/* ---- Exercise Menu Grid ---- */
.exercise-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 8px;
}
.exercise-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  color: #fff;
}
.exercise-btn:hover,
.exercise-btn:focus {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  outline: 3px solid #2c3e50;
}
.exercise-btn--completar {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
}
.exercise-btn--opcion {
  background: linear-gradient(135deg, #f39c12, #f1c40f);
}
.exercise-btn--clasificar {
  background: linear-gradient(135deg, #8e44ad, #a569bd);
}
.exercise-btn--corregir {
  background: linear-gradient(135deg, #e74c3c, #ec7063);
}

/* ---- Back Button ---- */
.btn-back {
  display: inline-block;
  padding: 8px 16px;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid #3498db;
  border-radius: 10px;
  background: transparent;
  color: #3498db;
  cursor: pointer;
  margin-bottom: 12px;
  transition: background 0.15s, color 0.15s;
}
.btn-back:hover,
.btn-back:focus {
  background: #3498db;
  color: #fff;
  outline: none;
}

/* ---- Guide Content ---- */
.guide-content {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.guide-intro {
  font-size: 1.1rem;
  color: #444;
  margin-bottom: 20px;
  padding: 16px;
  background: #eaf4fc;
  border-radius: 12px;
  border-left: 5px solid #3498db;
}

/* ---- Preposición Cards Grid ---- */
.preposicion-group-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #2c3e50;
  margin: 20px 0 10px;
}
.preposicion-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.preposicion-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 2px solid #3498db;
  border-radius: 12px;
  background: #fff;
  color: #3498db;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.preposicion-card:hover,
.preposicion-card:focus {
  background: #3498db;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(52,152,219,0.3);
  outline: none;
}
.preposicion-card.active {
  background: #3498db;
  color: #fff;
}

/* Infrecuente cards */
.preposicion-card--infrecuente {
  border-color: #9b59b6;
  color: #9b59b6;
}
.preposicion-card--infrecuente:hover,
.preposicion-card--infrecuente:focus {
  background: #9b59b6;
  color: #fff;
  box-shadow: 0 4px 12px rgba(155,89,182,0.3);
}
.preposicion-card--infrecuente.active {
  background: #9b59b6;
  color: #fff;
}

/* ---- Preposición Detail Panel ---- */
.preposicion-detail {
  display: none;
  background: #f8f9fa;
  border-radius: 12px;
  padding: 18px;
  margin: 12px 0 20px;
  border-left: 5px solid #3498db;
  animation: fadeIn 0.3s ease;
}
.preposicion-detail.active {
  display: block;
}
.preposicion-detail--infrecuente {
  border-left-color: #9b59b6;
}
.preposicion-detail h4 {
  font-size: 1.15rem;
  color: #2c3e50;
  margin-bottom: 8px;
}
.preposicion-detail .definicion {
  font-size: 1.05rem;
  color: #444;
  margin-bottom: 12px;
}
.preposicion-detail .ejemplos-list {
  list-style: none;
  padding: 0;
}
.preposicion-detail .ejemplos-list li {
  padding: 6px 12px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.8);
  border-radius: 8px;
  font-size: 1.05rem;
}
.preposicion-detail .ejemplos-list li::before {
  content: "📌 ";
}
.preposicion-highlight {
  color: #3498db;
  font-weight: 700;
}
.preposicion-highlight--infrecuente {
  color: #9b59b6;
  font-weight: 700;
}

/* ---- Score Display ---- */
.score-display {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #3498db;
  background: #eaf4fc;
  border-radius: 10px;
  padding: 8px 16px;
  margin-bottom: 16px;
}

/* ---- Exercise Area ---- */
.exercise-area {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* ---- Sentence Display ---- */
.sentence-display {
  text-align: center;
  margin-bottom: 20px;
}
.sentence-label {
  font-size: 1rem;
  color: #777;
  margin-bottom: 6px;
}
.sentence-text {
  font-size: 1.4rem;
  font-weight: 700;
  color: #2c3e50;
  background: #f8f9fa;
  border-radius: 10px;
  padding: 14px 18px;
  border: 2px dashed #bbb;
}
.sentence-text .blank {
  display: inline-block;
  min-width: 80px;
  border-bottom: 3px solid #3498db;
  color: #3498db;
  font-weight: 700;
}
.sentence-text .incorrect-prep {
  color: #e74c3c;
  font-weight: 700;
  text-decoration: underline wavy #e74c3c;
  padding: 2px 4px;
  background: rgba(231,76,60,0.1);
  border-radius: 4px;
}

/* ---- Completion Message ---- */
.completion-message {
  text-align: center;
  font-size: 1.3rem;
  padding: 24px;
  color: #27ae60;
}

/* ---- Form Inputs ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.form-group label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #444;
}
.form-input,
.form-select {
  padding: 10px 14px;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid #ccc;
  border-radius: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}
.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52,152,219,0.15);
}

/* Correct / Incorrect field states */
.field-correct {
  border-color: #27ae60 !important;
  background: #eafaf1 !important;
}
.field-incorrect {
  border-color: #e74c3c !important;
  background: #fdedec !important;
}

/* Expected answer hint */
.expected-hint {
  font-size: 0.85rem;
  color: #c0392b;
  margin-top: 2px;
  font-style: italic;
}

/* ---- Option Buttons (Opción Múltiple) ---- */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.option-btn {
  padding: 14px 18px;
  font-size: 1.15rem;
  font-family: inherit;
  font-weight: 600;
  border: 2px solid #3498db;
  border-radius: 12px;
  background: #fff;
  color: #3498db;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s, border-color 0.15s;
}
.option-btn:hover,
.option-btn:focus {
  background: #eaf4fc;
  transform: translateY(-2px);
  outline: none;
}
.option-btn:disabled {
  cursor: default;
  transform: none;
}
.option-btn.option-correct {
  border-color: #27ae60 !important;
  background: #eafaf1 !important;
  color: #27ae60 !important;
}
.option-btn.option-incorrect {
  border-color: #e74c3c !important;
  background: #fdedec !important;
  color: #e74c3c !important;
}

/* ---- Clasificar Exercise ---- */
.clasificar-list {
  list-style: none;
  padding: 0;
  margin-bottom: 16px;
}
.clasificar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 2px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.clasificar-item .oracion-text {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
  color: #2c3e50;
}
.clasificar-item .form-select {
  min-width: 140px;
}
.clasificar-item.item-correct {
  border-color: #27ae60;
  background: #eafaf1;
}
.clasificar-item.item-incorrect {
  border-color: #e74c3c;
  background: #fdedec;
}
.clasificar-item .expected-hint {
  font-size: 0.85rem;
  color: #c0392b;
  font-style: italic;
}

/* ---- Feedback ---- */
.feedback {
  min-height: 24px;
  margin-bottom: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  border-radius: 10px;
  padding: 8px;
}
.feedback-correct {
  color: #27ae60;
  background: #eafaf1;
}
.feedback-incorrect {
  color: #c0392b;
  background: #fdedec;
}

/* ---- Buttons ---- */
.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-primary {
  padding: 12px 28px;
  font-size: 1.15rem;
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: #3498db;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover,
.btn-primary:focus {
  background: #2980b9;
  outline: none;
}
.btn-primary:active {
  transform: scale(0.97);
}
.btn-next {
  padding: 12px 28px;
  font-size: 1.15rem;
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: #27ae60;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-next:hover,
.btn-next:focus {
  background: #1e8449;
  outline: none;
}
.btn-next:active {
  transform: scale(0.97);
}

.hidden {
  display: none !important;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 600px) {
  body {
    padding: 10px;
    font-size: 16px;
  }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.1rem; }

  .menu-grid {
    flex-direction: column;
    align-items: center;
  }
  .menu-btn {
    width: 100%;
    max-width: 300px;
  }

  .exercise-grid {
    grid-template-columns: 1fr;
  }

  .guide-content {
    padding: 14px;
  }

  .preposicion-cards {
    gap: 8px;
  }
  .preposicion-card {
    padding: 8px 14px;
    font-size: 1rem;
  }

  .exercise-area {
    padding: 16px;
  }
  .sentence-text {
    font-size: 1.15rem;
    padding: 10px 14px;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .clasificar-item {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .btn-row {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-primary,
  .btn-next {
    width: 100%;
    text-align: center;
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .menu-btn {
    width: 180px;
  }
  .exercise-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
