/* ============================================
   Mapa de España Webapp — Tema Geografía 🗺️
   Colores: Verde #2e7d32, Azul #1565c0
   ============================================ */

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

body {
  font-family: 'Segoe UI', 'Arial Rounded MT Bold', Arial, sans-serif;
  background: linear-gradient(135deg, #e8f5e9 0%, #fff 50%, #e3f2fd 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: #2e7d32;
  margin-bottom: 8px;
}
h2 {
  font-size: 1.6rem;
  text-align: center;
  color: #2e7d32;
  margin-bottom: 16px;
}
.subtitle {
  text-align: center;
  font-size: 1.15rem;
  color: #555;
  margin-bottom: 24px;
}

/* ---- Menu Grid ---- */
.menu-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  margin: 0 auto;
}
.menu-btn {
  padding: 16px 20px;
  font-size: 1.15rem;
  font-family: inherit;
  border: 2px solid #2e7d32;
  border-radius: 12px;
  background: #fff;
  color: #2e7d32;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.menu-btn:hover,
.menu-btn:focus {
  background: #2e7d32;
  color: #fff;
  outline: none;
}

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

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

/* ---- Score Display ---- */
.score-display {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #2e7d32;
  background: #e8f5e9;
  border-radius: 10px;
  padding: 8px 16px;
  margin-bottom: 16px;
  display: inline-block;
  width: 100%;
}

/* ---- Progress Counter ---- */
.progress-counter {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #2e7d32;
  background: #e8f5e9;
  border-radius: 10px;
  padding: 8px 16px;
  margin-bottom: 12px;
  width: 100%;
}

/* ---- Guide Hint ---- */
.guide-hint {
  text-align: center;
  font-size: 1.05rem;
  color: #555;
  margin-bottom: 16px;
  font-style: italic;
}

.hidden {
  display: none !important;
}

/* ============================================
   Map Container & SVG
   ============================================ */

.map-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto 20px;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  overflow: hidden;
}
.map-container svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ---- Province Labels (hidden by default, shown when discovered) ---- */
.province-label {
  display: none;
  font-size: 10px;
  font-weight: 600;
  fill: #222;
  pointer-events: none;
}
.province-label.visible {
  display: block;
}

/* ---- Province Numbers (hidden by default, shown in practice mode) ---- */
.province-number {
  display: none;
  font-size: 12px;
  font-weight: 700;
  fill: #fff;
  stroke: #333;
  stroke-width: 0.3;
  pointer-events: none;
}
.province-number.visible {
  display: block;
}

/* ---- Province Path Interactions ---- */
path[data-province]:hover {
  opacity: 0.7;
  cursor: pointer;
}
path[data-province].discovered {
  stroke-width: 2;
}

/* ============================================
   Practice Mode — Lists & Items
   ============================================ */

.practice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.practice-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 2px solid #ddd;
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
}
.practice-item label {
  font-weight: 700;
  color: #2e7d32;
  min-width: 32px;
  text-align: center;
}
.practice-item select,
.practice-item input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid #ccc;
  border-radius: 8px;
  transition: border-color 0.2s;
}
.practice-item select:focus,
.practice-item input[type="text"]:focus {
  border-color: #2e7d32;
  outline: none;
  box-shadow: 0 0 0 3px rgba(46,125,50,0.15);
}

/* ---- Validation Feedback ---- */
.practice-item.correct {
  border-color: #2e7d32;
  background: #e8f5e9;
}
.practice-item.incorrect {
  border-color: #c62828;
  background: #ffebee;
}

.correct-answer {
  font-size: 0.9rem;
  color: #c62828;
  font-weight: 600;
  margin-left: 8px;
  white-space: nowrap;
}

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

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

  .map-container {
    padding: 8px;
  }

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

  .practice-item {
    flex-wrap: wrap;
  }
  .practice-item select,
  .practice-item input[type="text"] {
    width: 100%;
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .map-container {
    padding: 12px;
  }
}
