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

body {
  font-family: Arial, sans-serif;
  background: #f0f2f5;
  color: #222;
  padding: 36px 20px;
}

/* ── Portada (index.html) ── */

body.portada {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
}

.portada-wrap {
  max-width: 640px;
  width: 100%;
  text-align: center;
  margin-bottom: 48px;
}

.modulo {
  font-size: 0.78em;
  font-weight: bold;
  letter-spacing: .08em;
  color: #4472C4;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.portada-wrap h1 {
  font-size: 2em;
  color: #1a1a2e;
  margin-bottom: 10px;
  line-height: 1.2;
}

.asignatura {
  font-size: 0.88em;
  color: #666;
  margin-bottom: 20px;
  line-height: 1.5;
}

.separador {
  width: 48px;
  height: 3px;
  background: #4472C4;
  margin: 0 auto 20px;
  border-radius: 2px;
}

.alumno { font-size: 0.88em; color: #888; }
.alumno strong { color: #333; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 760px;
  width: 100%;
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .portada-wrap h1 { font-size: 1.5em; }
}

.card {
  background: #fff;
  border: 1px solid #dde2ea;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.card-head {
  padding: 16px 18px 12px;
  border-bottom: 1px solid #f0f2f5;
}

.num {
  font-size: 0.72em;
  font-weight: bold;
  letter-spacing: .06em;
  color: #4472C4;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.card-head h2 { font-size: 0.95em; color: #1a1a2e; }

.card-body {
  padding: 12px 18px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.card-body .enunciado {
  font-size: 0.82em;
  color: #666;
  line-height: 1.6;
}

.btn-ver {
  display: inline-block;
  background: #4472C4;
  color: #fff;
  text-decoration: none;
  padding: 8px 18px;
  border-radius: 4px;
  font-size: 0.83em;
  font-weight: bold;
  align-self: flex-start;
  transition: background .15s;
}
.btn-ver:hover { background: #3560b0; }

/* ── Páginas de actividad ── */

.volver {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.83em;
  color: #4472C4;
  text-decoration: none;
  margin-bottom: 28px;
}
.volver:hover { text-decoration: underline; }

.volver-wrap { max-width: 820px; margin: 0 auto; }

.bloque-solucion { padding: 14px 16px; }


.cabecera {
  max-width: 820px;
  margin: 0 auto 32px;
  border-left: 4px solid #4472C4;
  padding-left: 18px;
}

.cabecera .num {
  font-size: 0.75em;
  font-weight: bold;
  color: #4472C4;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.cabecera h1 { font-size: 1.4em; color: #1a1a2e; margin-bottom: 6px; }
.cabecera .enunciado { font-size: 0.88em; color: #666; line-height: 1.6; font-style: italic; }

.contenido {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.bloque {
  background: #fff;
  border: 1px solid #dde2ea;
  border-radius: 5px;
  overflow: hidden;
}

.bloque h2 {
  font-size: 0.78em;
  font-weight: bold;
  color: #777;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 16px;
  background: #f8f9fb;
  border-bottom: 1px solid #eef0f4;
}

.bloque h3 {
  font-size: 0.75em;
  font-weight: bold;
  color: #999;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 16px 0;
}

.ficheros { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px; }

.fichero {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0f4fb;
  border: 1px solid #c8d5ec;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.82em;
  color: #2a4a8a;
  text-decoration: none;
  transition: background .15s;
}
.fichero:hover { background: #dce6f7; }
.fichero.dest { background: #4472C4; border-color: #3560b0; color: #fff; font-weight: bold; }
.fichero.dest:hover { background: #3560b0; }

.solucion {
  border-left: 3px solid #4472C4;
  background: #f7f9fc;
  border-radius: 0 4px 4px 0;
  padding: 12px 16px;
  font-size: 0.86em;
  color: #444;
  line-height: 1.7;
}

.solucion strong {
  display: block;
  font-size: 0.73em;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #4472C4;
  margin-bottom: 6px;
}

.solucion p + p { margin-top: 6px; }

.solucion ul {
  padding-left: 18px;
  margin-top: 6px;
  line-height: 1.7;
}
.solucion ul + p { margin-top: 6px; }

.solucion-nota {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #dde2ea;
  font-size: 0.82em;
  color: #888;
  font-style: italic;
}

/* ── Tests de errores ── */

.tests-lista {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.test-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f2f5;
}
.test-item:last-child { border-bottom: none; }

.test-item .fichero { white-space: nowrap; flex-shrink: 0; }

.test-resultados {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.8em;
  padding-top: 4px;
}

.test-pasa  { color: #166534; }
.test-falla { color: #991b1b; }

/* ── Pie de página ── */

footer {
  max-width: 820px;
  margin: 36px auto 0;
  font-size: 0.78em;
  color: #bbb;
}

/* ── Validador XML (validacion.html) ── */

.validador { max-width: 720px; margin: 0 auto; }
.validador h1 { font-size: 1.1em; color: #1a1a2e; margin-bottom: 4px; }
.validador > p { font-size: 0.83em; color: #888; margin-bottom: 16px; }

.validador-modos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.validador-modo {
  border: 1px solid #dde2ea;
  border-radius: 4px;
  padding: 12px 14px;
  background: #f8f9fb;
}

.validador-modo h3 {
  font-size: 0.82em;
  font-weight: bold;
  color: #2c5fbe;
  margin-bottom: 6px;
}


.validador-fila {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.validador select {
  border: 1px solid #cfd5df;
  border-radius: 4px;
  padding: 7px 10px;
  font-size: 0.88em;
  background: #fff;
}

.validador button {
  background: #2c5fbe;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 4px;
  font-size: 0.88em;
  cursor: pointer;
}
.validador button:hover    { background: #2452a8; }
.validador button.secundario { background: #888; }
.validador button.secundario:hover { background: #666; }

.validador textarea {
  width: 100%;
  height: 320px;
  border: 1px solid #cfd5df;
  border-radius: 4px;
  padding: 12px;
  font-family: 'Courier New', monospace;
  font-size: 0.8em;
  line-height: 1.6;
  resize: vertical;
  background: #fff;
  outline: none;
  margin-bottom: 14px;
}

#resultado { display: none; }

.resultado-ok   { background: #f0fdf4; border: 1px solid #86efac; border-radius: 4px; padding: 14px 16px; }
.resultado-fail { background: #fef2f2; border: 1px solid #fca5a5; border-radius: 4px; padding: 14px 16px; }

.resultado-etiqueta { font-weight: bold; font-size: 0.88em; margin-bottom: 8px; }
.resultado-ok   .resultado-etiqueta { color: #166534; }
.resultado-fail .resultado-etiqueta { color: #991b1b; }

.resultado-errores { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.resultado-err {
  font-family: 'Courier New', monospace;
  font-size: 0.78em;
  color: #7f1d1d;
  background: #fee2e2;
  border-left: 2px solid #f87171;
  padding: 4px 8px;
}
